1.1 --- a/lib/builtins.py Sun Apr 05 03:05:59 2009 +0200
1.2 +++ b/lib/builtins.py Sun Apr 05 03:41:21 2009 +0200
1.3 @@ -336,5 +336,6 @@
1.4 StopIteration
1.5 TypeError
1.6 ellipsis
1.7 +bool
1.8
1.9 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/micropython/trans.py Sun Apr 05 03:05:59 2009 +0200
2.2 +++ b/micropython/trans.py Sun Apr 05 03:41:21 2009 +0200
2.3 @@ -1137,11 +1137,11 @@
2.4 end_block = self.new_block()
2.5
2.6 self.new_op(JumpIfTrue(true_block))
2.7 - self.new_op(LoadAddress(self.importer.get_predefined_constant("False")))
2.8 + self.new_op(LoadConst(self.importer.get_predefined_constant("False")))
2.9 self.new_op(Jump(end_block))
2.10
2.11 self.set_block(true_block)
2.12 - self.new_op(LoadAddress(self.importer.get_predefined_constant("True")))
2.13 + self.new_op(LoadConst(self.importer.get_predefined_constant("True")))
2.14
2.15 self.set_block(end_block)
2.16
3.1 --- a/rsvp.py Sun Apr 05 03:05:59 2009 +0200
3.2 +++ b/rsvp.py Sun Apr 05 03:41:21 2009 +0200
3.3 @@ -325,7 +325,7 @@
3.4 # Instructions.
3.5
3.6 def LoadConst(self):
3.7 - self.value = None, self.operand
3.8 + self.value = self.operand, self.operand
3.9
3.10 def LoadName(self):
3.11 frame = self.local_sp_stack[-1]
3.12 @@ -478,7 +478,7 @@
3.13
3.14 def LoadContext(self):
3.15 context, ref = self.value
3.16 - self.value = None, context
3.17 + self.value = context, context
3.18
3.19 def CheckFrame(self):
3.20 operand = self.operand
3.21 @@ -561,7 +561,7 @@
3.22 return self.operand
3.23
3.24 def LoadException(self):
3.25 - self.value = None, self.exception
3.26 + self.value = self.exception, self.exception
3.27
3.28 def StoreException(self):
3.29 self.exception = self.value[1]
3.30 @@ -696,11 +696,20 @@
3.31 else:
3.32 self.result = self.false_constant, self.false_constant
3.33
3.34 + def builtins_bool_bool(self):
3.35 + frame = self.local_sp_stack[-1]
3.36 +
3.37 + # Get operands addresses.
3.38 +
3.39 + left_context, left = self.frame_stack[frame]
3.40 + self.result = left, left
3.41 +
3.42 native_functions = {
3.43 "__builtins__.object.__init__" : builtins_object_init,
3.44 "__builtins__.int.__init__" : builtins_int_init,
3.45 "__builtins__.int.__add__" : builtins_int_add,
3.46 "__builtins__.int.__bool__" : builtins_int_bool,
3.47 + "__builtins__.bool.__bool__" : builtins_bool_bool,
3.48 }
3.49
3.50 # vim: tabstop=4 expandtab shiftwidth=4