1.1 --- a/inspector.py Fri Nov 11 00:03:05 2016 +0100
1.2 +++ b/inspector.py Fri Nov 11 00:05:34 2016 +0100
1.3 @@ -278,6 +278,11 @@
1.4 self.process_structure(n)
1.5 self.trackers[-1].abandon_returning_branch()
1.6
1.7 + # Print statements.
1.8 +
1.9 + elif isinstance(n, (compiler.ast.Print, compiler.ast.Printnl)):
1.10 + self.process_print_node(n)
1.11 +
1.12 # Invocations.
1.13
1.14 elif isinstance(n, compiler.ast.CallFunc):
1.15 @@ -774,7 +779,7 @@
1.16
1.17 path = self.get_namespace_path()
1.18
1.19 - # Special names.
1.20 + # Special names that have already been identified.
1.21
1.22 if n.name.startswith("$"):
1.23 value = self.get_special(n.name)
1.24 @@ -801,6 +806,20 @@
1.25 self.set_special(n.name, value)
1.26 return value
1.27
1.28 + # Special case for print operations.
1.29 +
1.30 + elif n.name.startswith("$print"):
1.31 +
1.32 + # Attempt to get a reference.
1.33 +
1.34 + ref = self.get_builtin("print_")
1.35 +
1.36 + # Record the imported name and provide the resolved name reference.
1.37 +
1.38 + value = ResolvedNameRef(n.name, ref)
1.39 + self.set_special(n.name, value)
1.40 + return value
1.41 +
1.42 # Test for self usage, which is only allowed in methods.
1.43
1.44 if n.name == "self" and not (self.in_function and self.in_class):