Commit f3a3bbcf authored by Robert Bradshaw's avatar Robert Bradshaw

fix temp allocation order, remove straggling comment output

parents 363eb37c a48ee512
...@@ -467,7 +467,10 @@ class ExprNode(Node): ...@@ -467,7 +467,10 @@ class ExprNode(Node):
elif src.type.is_pyobject: elif src.type.is_pyobject:
src = CoerceFromPyTypeNode(dst_type, src, env) src = CoerceFromPyTypeNode(dst_type, src, env)
else: # neither src nor dst are py types else: # neither src nor dst are py types
if not dst_type.assignable_from(src_type): # Added the string comparison, since for c types that
# is enough, but SageX gets confused when the types are
# in different files.
if not (str(src.type) == str(dst_type) or dst_type.assignable_from(src_type)):
error(self.pos, "Cannot assign type '%s' to '%s'" % error(self.pos, "Cannot assign type '%s' to '%s'" %
(src.type, dst_type)) (src.type, dst_type))
return src return src
...@@ -3079,7 +3082,7 @@ class CloneNode(CoercionNode): ...@@ -3079,7 +3082,7 @@ class CloneNode(CoercionNode):
pass pass
def generate_disposal_code(self, code): def generate_disposal_code(self, code):
code.putln("// ---- CloneNode.generate_disposal_code() for %s"%self.arg.result_code) pass
def allocate_temps(self, env): def allocate_temps(self, env):
self.result_code = self.calculate_result_code() self.result_code = self.calculate_result_code()
......
...@@ -2742,9 +2742,9 @@ class InPlaceAssignmentNode(AssignmentNode): ...@@ -2742,9 +2742,9 @@ class InPlaceAssignmentNode(AssignmentNode):
self.result.allocate_temps(env) self.result.allocate_temps(env)
if use_temp: if use_temp:
self.rhs = self.rhs.coerce_to_temp(env) self.rhs = self.rhs.coerce_to_temp(env)
self.rhs.allocate_temps(env)
self.dup.allocate_subexpr_temps(env) self.dup.allocate_subexpr_temps(env)
self.dup.allocate_temp(env) self.dup.allocate_temp(env)
self.rhs.allocate_temps(env)
def analyse_expressions_2(self, env): def analyse_expressions_2(self, env):
self.lhs.allocate_target_temps(env) self.lhs.allocate_target_temps(env)
...@@ -2761,7 +2761,6 @@ class InPlaceAssignmentNode(AssignmentNode): ...@@ -2761,7 +2761,6 @@ class InPlaceAssignmentNode(AssignmentNode):
self.dup.generate_subexpr_evaluation_code(code) self.dup.generate_subexpr_evaluation_code(code)
self.dup.generate_result_code(code) self.dup.generate_result_code(code)
if self.lhs.type.is_pyobject: if self.lhs.type.is_pyobject:
code.putln("//---- iadd code");
code.putln( code.putln(
"%s = %s(%s, %s); if (!%s) %s" % ( "%s = %s(%s, %s); if (!%s) %s" % (
self.result.result_code, self.result.result_code,
......
...@@ -90,7 +90,7 @@ class PyrexType: ...@@ -90,7 +90,7 @@ class PyrexType:
return self.same_as_resolved_type(other_type.resolve(), **kwds) return self.same_as_resolved_type(other_type.resolve(), **kwds)
def same_as_resolved_type(self, other_type): def same_as_resolved_type(self, other_type):
return self is other_type or other_type is error_type return self == other_type or other_type is error_type
def subtype_of(self, other_type): def subtype_of(self, other_type):
return self.subtype_of_resolved_type(other_type.resolve()) return self.subtype_of_resolved_type(other_type.resolve())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment