Anonymous avatar Anonymous committed 12bd57b

evaluate: renamed get_statement_result() to eval_node

Comments (0)

Files changed (7)

rope/base/arguments.py

             return self._evaluate(self.args[0])
 
     def _evaluate(self, ast_node):
-        return rope.base.evaluate.get_statement_result(self.scope, ast_node)
+        return rope.base.evaluate.eval_node(self.scope, ast_node)
 
 
 def create_arguments(primary, pyfunction, call_node, scope):

rope/base/builtins.py

         self.scope = scope
 
     def get_returned_object(self, args):
-        result = rope.base.evaluate.get_statement_result(self.scope,
-                                                         self.node.body)
+        result = rope.base.evaluate.eval_node(self.scope, self.node.body)
         if result is not None:
             return result.get_object()
         else:

rope/base/evaluate.py

     return pyname_finder.get_primary_and_pyname_at(offset)
 
 
-def get_statement_result(scope, node):
+def eval_node(scope, node):
     """Evaluate a `ast.AST` node and return a PyName
 
     Return `None` if the expression cannot be evaluated.
-
     """
     return get_primary_and_result(scope, node)[1]
 
         self.result = self.scope.lookup(node.id)
 
     def _Attribute(self, node):
-        pyname = get_statement_result(self.scope, node.value)
+        pyname = eval_node(self.scope, node.value)
         if pyname is None:
             pyname = rope.base.pynames.UnboundName()
         self.old_result = pyname
 
     def _what_does_comprehension_hold(self, node):
         scope = self._make_comprehension_scope(node)
-        pyname = get_statement_result(scope, node.elt)
+        pyname = eval_node(scope, node.elt)
         return pyname.get_object() if pyname is not None else None
 
     def _make_comprehension_scope(self, node):
             pyobject=rope.base.builtins.get_tuple(*objects))
 
     def _get_object_for_node(self, stmt):
-        pyname = get_statement_result(self.scope, stmt)
+        pyname = eval_node(self.scope, stmt)
         pyobject = None
         if pyname is not None:
             pyobject = pyname.get_object()
             self._call_function(node.value, '__getslice__')
 
     def _call_function(self, node, function_name, other_args=None):
-        pyname = get_statement_result(self.scope, node)
+        pyname = eval_node(self.scope, node)
         if pyname is not None:
             pyobject = pyname.get_object()
         else:

rope/base/oi/soa.py

             rope.base.ast.walk(child, visitor)
             nodes.extend(visitor.nodes)
         for subscript, levels in nodes:
-            instance = evaluate.get_statement_result(self.scope, subscript.value)
+            instance = evaluate.eval_node(self.scope, subscript.value)
             args_pynames = []
-            args_pynames.append(evaluate.get_statement_result(
-                                self.scope, subscript.slice.value))
+            args_pynames.append(evaluate.eval_node(self.scope,
+                                                   subscript.slice.value))
             value = rope.base.oi.soi._infer_assignment(
                 rope.base.pynames.AssignmentValue(node.value, levels), self.pymodule)
             args_pynames.append(rope.base.pynames.UnboundName(value))

rope/base/oi/soi.py

     maxtries = 3
     for returned_node in reversed(scope._get_returned_asts()[-maxtries:]):
         try:
-            resulting_pyname = evaluate.get_statement_result(scope,
-                                                             returned_node)
+            resulting_pyname = evaluate.eval_node(scope, returned_node)
             if resulting_pyname is None:
                 continue
             pyobject = resulting_pyname.get_object()
     if lineno is None:
         lineno = _get_lineno_for_node(assign_node)
     holding_scope = pymodule.get_scope().get_inner_scope_for_line(lineno)
-    pyname = evaluate.get_statement_result(holding_scope, assign_node)
+    pyname = evaluate.eval_node(holding_scope, assign_node)
     if pyname is not None:
         result = pyname.get_object()
         if isinstance(result.get_type(), rope.base.builtins.Property) and \

rope/base/pyobjectsdef.py

         scope = self.parent.get_scope()
         if isinstance(self.parent, PyClass):
             for decorator in self.decorators:
-                pyname = rope.base.evaluate.get_statement_result(scope,
-                                                                 decorator)
+                pyname = rope.base.evaluate.eval_node(scope, decorator)
                 if pyname == rope.base.builtins.builtins['staticmethod']:
                     return 'staticmethod'
                 if pyname == rope.base.builtins.builtins['classmethod']:
     def _get_bases(self):
         result = []
         for base_name in self.ast_node.bases:
-            base = rope.base.evaluate.get_statement_result(
-                self.parent.get_scope(), base_name)
+            base = rope.base.evaluate.eval_node(self.parent.get_scope(),
+                                                base_name)
             if base is not None and \
                base.get_object().get_type() == get_base_type('Type'):
                 result.append(base.get_object())

rope/refactor/wildcards.py

             text = pymodule.source_code[start:end]
             return evaluate.get_pyname_in_scope(scope, text)
         else:
-            return evaluate.get_statement_result(scope, expression)
+            return evaluate.eval_node(scope, expression)
 
     def _evaluate(self, code):
         attributes = code.split('.')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.