diff python/c3/codegenerator.py @ 169:ee0d30533dae

Added more tests and improved the diagnostic update
author Windel Bouwman
date Sat, 23 Mar 2013 18:34:41 +0100
parents 0b5b2ee6b435
children 4348da5ca307
line wrap: on
line diff
--- a/python/c3/codegenerator.py	Fri Mar 22 19:09:38 2013 +0100
+++ b/python/c3/codegenerator.py	Sat Mar 23 18:34:41 2013 +0100
@@ -73,7 +73,7 @@
          bb.Instructions.append(ins)
          return tmp
       else:
-         print('Unknown binop')
+         print('Unknown binop {0}'.format(code))
          bb.Instructions.append(ir.BinaryOperator('unk2', code.op, a, b))
          return 'unk2'
    elif type(code) is astnodes.Constant:
@@ -84,6 +84,10 @@
       tmp = unique()
       ins = ir.LoadInstruction(tmp, code.target.name)
       return tmp
+   elif type(code) is astnodes.Literal:
+      tmp = unique()
+      ins = ir.LoadInstruction(tmp, code.val)
+      return tmp
    else:
       print('Unknown expr:', code)
       return 'unk'