diff python/c3/typecheck.py @ 155:b28a11c01dbe

Simplified IR classes
author Windel Bouwman
date Sun, 03 Mar 2013 13:20:03 +0100
parents b73bc14a3aa3
children 8104fc8b5e90
line wrap: on
line diff
--- a/python/c3/typecheck.py	Sat Mar 02 10:19:38 2013 +0100
+++ b/python/c3/typecheck.py	Sun Mar 03 13:20:03 2013 +0100
@@ -1,7 +1,7 @@
 from .astnodes import BaseType, Variable, Designator, Function
 from .astnodes import CompoundStatement, Assignment, VariableUse
 from .astnodes import Binop, Unop, Constant
-from .astnodes import IfStatement, WhileStatement, ReturnStatement
+from .astnodes import IfStatement, WhileStatement, ReturnStatement, ProcedureCall
 from .astnodes import FunctionType, BaseType
 from . import astnodes
 from .scope import topScope
@@ -32,12 +32,14 @@
             self.check(s)
       elif type(sym) is IfStatement:
          self.check(sym.condition)
-         print(sym.condition)
          self.check(sym.truestatement)
          self.check(sym.falsestatement)
       elif type(sym) is VariableUse:
          if type(sym.target) is Designator:
             sym.target = self.resolveDesignator(sym.target)
+      elif type(sym) is ProcedureCall:
+         if type(sym.proc) is Designator:
+            sym.proc = self.resolveDesignator(sym.proc)
       elif type(sym) is Assignment:
          self.check(sym.lval)
          self.check(sym.rval)