Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
16e8bf98
Commit
16e8bf98
authored
Jul 03, 2014
by
dbarbera
Browse files
Fixed union field names
parent
dc45a40a
Changes
1
Hide whitespace changes
Inline
Side-by-side
LlvmGenerator.py
View file @
16e8bf98
...
...
@@ -168,9 +168,9 @@ class Context():
for
idx
,
field_name
in
enumerate
(
Helper
.
sorted_fields
(
choice_ty
)):
# enum values used in choice determinant/present
self
.
enums
[
field_name
]
=
core
.
Constant
.
int
(
self
.
i32
,
idx
)
self
.
enums
[
field_name
.
replace
(
'-'
,
'_'
)
]
=
core
.
Constant
.
int
(
self
.
i32
,
idx
)
field_names
.
append
(
field_name
)
field_names
.
append
(
field_name
.
replace
(
'-'
,
'_'
)
)
field_types
.
append
(
self
.
type_of
(
choice_ty
.
Children
[
field_name
].
type
))
union
=
self
.
decl_union
(
field_names
,
field_types
,
name
)
...
...
@@ -1079,7 +1079,7 @@ def _enumerated_value(primary):
@
expression
.
register
(
ogAST
.
PrimChoiceDeterminant
)
def
_choice_determinant
(
primary
):
''' Generate code for a choice determinant (enumerated) '''
enumerant
=
primary
.
value
[
0
].
replace
(
'
_
'
,
'
-
'
)
enumerant
=
primary
.
value
[
0
].
replace
(
'
-
'
,
'
_
'
)
return
ctx
.
enums
[
enumerant
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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