1.1 --- a/inspector.py Tue Aug 30 17:25:15 2016 +0200
1.2 +++ b/inspector.py Tue Aug 30 19:09:42 2016 +0200
1.3 @@ -22,6 +22,7 @@
1.4
1.5 from branching import BranchTracker
1.6 from common import *
1.7 +from errors import InspectError
1.8 from modules import *
1.9 from os import listdir
1.10 from os.path import extsep, split, splitext
1.11 @@ -582,13 +583,16 @@
1.12 elif isinstance(n, compiler.ast.Tuple):
1.13 return self.get_literal_instance(n, "tuple")
1.14
1.15 - # List comprehensions and if expressions.
1.16 + # Unsupported nodes.
1.17 +
1.18 + elif isinstance(n, compiler.ast.GenExpr):
1.19 + raise InspectError("Generator expressions are not supported.", self.get_namespace_path(), n)
1.20 +
1.21 + elif isinstance(n, compiler.ast.IfExp):
1.22 + raise InspectError("If-else expressions are not supported.", self.get_namespace_path(), n)
1.23
1.24 elif isinstance(n, compiler.ast.ListComp):
1.25 - self.process_listcomp_node(n)
1.26 -
1.27 - elif isinstance(n, compiler.ast.IfExp):
1.28 - self.process_ifexp_node(n)
1.29 + raise InspectError("List comprehensions are not supported.", self.get_namespace_path(), n)
1.30
1.31 # All other nodes are processed depth-first.
1.32
1.33 @@ -987,18 +991,6 @@
1.34
1.35 tracker.merge_branches()
1.36
1.37 - def process_ifexp_node(self, n):
1.38 -
1.39 - "Process the given if expression node 'n'."
1.40 -
1.41 - name_ref = self.process_structure_node(self.convert_ifexp_node(n))
1.42 -
1.43 - path = self.get_namespace_path()
1.44 - self.allocate_arguments(path, self.function_defaults[name_ref.get_origin()])
1.45 - self.deallocate_arguments(path, self.function_defaults[name_ref.get_origin()])
1.46 -
1.47 - return InvocationRef(name_ref)
1.48 -
1.49 def process_import_node(self, n):
1.50
1.51 "Process the given import node 'n'."
1.52 @@ -1060,18 +1052,6 @@
1.53 origin = self.get_object_path(name)
1.54 return ResolvedNameRef(name, Reference("<function>", origin))
1.55
1.56 - def process_listcomp_node(self, n):
1.57 -
1.58 - "Process the given list comprehension node 'n'."
1.59 -
1.60 - name_ref = self.process_structure_node(self.convert_listcomp_node(n))
1.61 -
1.62 - path = self.get_namespace_path()
1.63 - self.allocate_arguments(path, self.function_defaults[name_ref.get_origin()])
1.64 - self.deallocate_arguments(path, self.function_defaults[name_ref.get_origin()])
1.65 -
1.66 - return InvocationRef(name_ref)
1.67 -
1.68 def process_logical_node(self, n):
1.69
1.70 "Process the given operator node 'n'."