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
999bdc00
Commit
999bdc00
authored
Aug 05, 2014
by
dbarbera
Browse files
Refactor basic_type_of method
parent
1a45a200
Changes
1
Hide whitespace changes
Inline
Side-by-side
LlvmGenerator.py
View file @
999bdc00
...
...
@@ -46,6 +46,7 @@ class Context():
self
.
strings
=
{}
self
.
funcs
=
{}
self
.
lltypes
=
{}
self
.
basic_types
=
{}
# Initialize built-in types
self
.
i1
=
core
.
Type
.
int
(
1
)
...
...
@@ -96,13 +97,25 @@ class Context():
def
basic_type_of
(
self
,
asn1ty
):
''' Return the ASN.1 basic type of a type '''
if
asn1ty
.
kind
!=
'ReferenceType'
:
return
asn1ty
asn1ty_name
=
asn1ty
.
ReferencedTypeName
.
lower
()
# return the basic type if its cached
if
asn1ty_name
in
self
.
basic_types
:
return
self
.
basic_types
[
asn1ty_name
]
basic_type
=
asn1ty
while
basic_type
.
kind
==
'ReferenceType'
:
# Find type with proper case in the data view
for
typename
in
self
.
dataview
.
viewkeys
():
if
typename
.
lower
()
==
basic_type
.
ReferencedTypeName
.
lower
():
basic_type
=
self
.
dataview
[
typename
].
type
break
# cache the basic type
self
.
basic_types
[
asn1ty_name
]
=
basic_type
return
basic_type
def
type_of
(
self
,
asn1ty
):
...
...
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