@@ -52,11 +52,11 @@ def flatten_type(self, type):
5252 def simple_type_parent (self , type ):
5353 parent = self .schema .types [type ].type .type
5454 if isinstance (parent , nodes .AggregationType ): parent = None
55- return None if parent in self .express_to_cpp_typemapping else parent
55+ return None if str ( parent ) in self .express_to_cpp_typemapping else parent
5656
5757 def make_type_string (self , type ):
58- if isinstance (type , str ):
59- return self .express_to_cpp_typemapping .get (type , type )
58+ if isinstance (type , ( str , nodes . BinaryType ) ):
59+ return self .express_to_cpp_typemapping .get (str ( type ) , type )
6060 else :
6161 is_list = self .schema .is_entity (type .type )
6262 is_nested_list = isinstance (type .type , nodes .AggregationType )
@@ -83,12 +83,8 @@ def make_argument_entity(self, attr):
8383
8484 def make_argument_type (self , attr ):
8585 def _make_argument_type (type ):
86- if type in self .express_to_cpp_typemapping :
87- return self .express_to_cpp_typemapping .get (type , type ).split ('::' )[- 1 ].upper ()
88- elif self .schema .is_entity (type ) or isinstance (type , nodes .SelectType ):
86+ if self .schema .is_entity (type ) or isinstance (type , nodes .SelectType ):
8987 return "ENTITY_INSTANCE"
90- elif self .schema .is_type (type ):
91- return _make_argument_type (self .schema .types [type ].type .type )
9288 elif isinstance (type , nodes .BinaryType ):
9389 return "BINARY"
9490 elif isinstance (type , nodes .EnumerationType ):
@@ -97,17 +93,21 @@ def _make_argument_type(type):
9793 ty = _make_argument_type (type .type )
9894 if ty == "UNKNOWN" : return "UNKNOWN"
9995 return "AGGREGATE_OF_" + ty
96+ elif str (type ) in self .express_to_cpp_typemapping :
97+ return self .express_to_cpp_typemapping .get (str (type ), type ).split ('::' )[- 1 ].upper ()
98+ elif self .schema .is_type (type ):
99+ return _make_argument_type (self .schema .types [type ].type .type )
100100 else :
101101 raise ValueError ("Unable to map type %r for attribute %r" % (type , attr ))
102102 ty = _make_argument_type (attr .type if hasattr (attr , 'type' ) else attr )
103103 if ty not in self .supported_argument_types :
104- print ("Attribute %r mapped as 'unknown'" % (type , attr ), file = sys .stderr )
104+ print ("Attribute %r mapped as 'unknown'" % (attr ), file = sys .stderr )
105105 ty = 'UNKNOWN'
106106 return "IfcUtil::Argument_%s" % ty
107107
108108 def get_type_dep (self , type ):
109109 if isinstance (type , str ):
110- return self .express_to_cpp_typemapping .get (type , type )
110+ return self .express_to_cpp_typemapping .get (str ( type ) , type )
111111 else :
112112 return self .get_type_dep (type .type )
113113
@@ -124,7 +124,7 @@ def get_parameter_type(self, attr, allow_optional, allow_entities, allow_pointer
124124 ty = self .get_parameter_type (attr_type .type if is_nested_list else attr_type , False , allow_entities , False )
125125 if self .schema .is_select (attr_type .type ):
126126 type_str = templates .untyped_list
127- elif self .schema .is_simpletype (ty ) or ty in self .express_to_cpp_typemapping .values ():
127+ elif self .schema .is_simpletype (ty ) or str ( ty ) in self .express_to_cpp_typemapping .values ():
128128 tmpl = templates .nested_array_type if is_nested_list else templates .array_type
129129 type_str = tmpl % {
130130 'instance_type' : ty ,
0 commit comments