Skip to content
Snippets Groups Projects
Commit 014fbe36 authored by Xun Yang's avatar Xun Yang
Browse files

boolean ops

parent f74e5218
No related branches found
No related tags found
No related merge requests found
...@@ -236,7 +236,11 @@ class ExprNode(ASTNode): ...@@ -236,7 +236,11 @@ class ExprNode(ASTNode):
elif self.op in ['+', '-', '*', '/']: elif self.op in ['+', '-', '*', '/']:
self.myType = TypeStruct("int") self.myType = TypeStruct("int")
return return
# # Boolean operations:
elif self.left.myType.name == 'boolean' and self.right.myType.name == 'boolean':
if self.op in ['&&', '&', '|', '||']:
self.myType = TypeStruct("boolean")
return
# Other Comparisons: # Other Comparisons:
elif self.left.myType.assignable(self.right.myType) or self.right.myType.assignable(self.left.myType): elif self.left.myType.assignable(self.right.myType) or self.right.myType.assignable(self.left.myType):
if self.op == '==' or self.op == '!=': if self.op == '==' or self.op == '!=':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment