Commit 06ed8931 authored by Stefan Behnel's avatar Stefan Behnel

Fix king1 - compile time == operator

parent 6478e87d
...@@ -2639,7 +2639,7 @@ class SizeofVarNode(SizeofNode): ...@@ -2639,7 +2639,7 @@ class SizeofVarNode(SizeofNode):
compile_time_binary_operators = { compile_time_binary_operators = {
'<': operator.lt, '<': operator.lt,
'<=': operator.le, '<=': operator.le,
'=': operator.eq, '==': operator.eq,
'!=': operator.ne, '!=': operator.ne,
'>=': operator.ge, '>=': operator.ge,
'>': operator.gt, '>': operator.gt,
...@@ -2667,7 +2667,7 @@ def get_compile_time_binop(node): ...@@ -2667,7 +2667,7 @@ def get_compile_time_binop(node):
if not func: if not func:
error(node.pos, error(node.pos,
"Binary '%s' not supported in compile-time expression" "Binary '%s' not supported in compile-time expression"
% self.operator) % node.operator)
return func return func
class BinopNode(ExprNode): class BinopNode(ExprNode):
...@@ -3109,11 +3109,12 @@ class CmpNode: ...@@ -3109,11 +3109,12 @@ class CmpNode:
def cascaded_compile_time_value(self, operand1, denv): def cascaded_compile_time_value(self, operand1, denv):
func = get_compile_time_binop(self) func = get_compile_time_binop(self)
operand2 = self.operand.compile_time_value(denv) operand2 = self.operand2.compile_time_value(denv)
try: try:
result = func(operand1, operand2) result = func(operand1, operand2)
except Exception, e: except Exception, e:
self.compile_time_value_error(e) self.compile_time_value_error(e)
result = None
if result: if result:
cascade = self.cascade cascade = self.cascade
if cascade: if cascade:
...@@ -3221,7 +3222,7 @@ class PrimaryCmpNode(ExprNode, CmpNode): ...@@ -3221,7 +3222,7 @@ class PrimaryCmpNode(ExprNode, CmpNode):
cascade = None cascade = None
def compile_time_value(self, denv): def compile_time_value(self, denv):
operand1 = self.operand.compile_time_value(denv) operand1 = self.operand1.compile_time_value(denv)
return self.cascaded_compile_time_value(operand1, denv) return self.cascaded_compile_time_value(operand1, denv)
def analyse_types(self, env): def analyse_types(self, env):
......
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