Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
2a8de51d
Commit
2a8de51d
authored
Jul 21, 2014
by
dbarbera
Browse files
Fix type analysis for logic expressions
parent
f819944e
Changes
1
Hide whitespace changes
Inline
Side-by-side
ogParser.py
View file @
2a8de51d
...
...
@@ -1040,16 +1040,22 @@ def logic_expression(root, context):
left_bty
=
find_basic_type
(
expr
.
left
.
exprType
)
right_bty
=
find_basic_type
(
expr
.
right
.
exprType
)
for
bty
in
left_bty
,
right_bty
:
if
shortcircuit
and
bty
.
kind
!=
'BooleanType'
:
msg
=
'Shortcircuit operators only work with type Boolean'
errors
.
append
(
error
(
root
,
msg
))
break
if
bty
.
kind
in
(
'BooleanType'
,
'BitStringType'
):
continue
elif
bty
.
kind
==
'SequenceOfType'
and
bty
.
type
.
kind
==
'BooleanType'
:
continue
else
:
msg
=
'Bitwise operators only work with
b
ooleans
and arrays o
f
b
ooleans'
msg
=
'Bitwise operators only work with
B
ooleans
, SequenceO
f
B
ooleans
or BitStrings
'
errors
.
append
(
error
(
root
,
msg
))
break
# TODO: Is this correct?
if
left_bty
.
kind
==
right_bty
.
kind
==
'BooleanType'
:
expr
.
exprType
=
BOOLEAN
else
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment