29 for k, p
in zip(self.
params, params):
30 type_nodes.append((k, p))
31 type_resolved.append((k,
False))
32 type_nodes = dict(type_nodes)
33 type_resolved = dict(type_resolved)
34 type_resolved_count = 0
35 for k, v
in type_nodes.items():
36 if type(v)
is not type(self):
37 type_resolved_count += 1
39 while type_resolved_count != len(type_nodes):
40 for k
in type_nodes.keys():
44 if len(type_nodes[k].params) == 0:
46 type_resolved_count += 1
51 def bind(self, param_list, param_dict=None):
53 if params_dict is not empty, use params_dict, otherwise, first build param dict
54 currently, things like template<E, sc_in<E> > is not supported
59 if len(field_type.params) > 0:
60 instantiate_list = [ param_dict[p.name]
if p.name
in param_dict
else p.instantiate()
for p
in field_type.params ]
61 res = field_type.instantiate(params=instantiate_list)
62 fields.append((field_name, res))
64 fields.append((field_name, field_type.instantiate()))
65 fields = [ (str(field[0]), field[1])
for field
in fields ]
66 return aggregate(params=
None, fields=fields)
70 primitive_type = Primitive.get_primitive(self.
name)
71 is_int = re.match(
r'^[-+]?[0-9]+$', self.
name)
76 res = primitive_type(*list(map(
lambda x: x.instantiate(), self.
params)))
78 res = primitive_type(*list(params))
85 assert CType.types.is_custom_type(self.
name), f
'{self.name} is not a custom type'
86 t = CType.types.get_custom_type(self.
name)
87 return t.bind(param_list=self.
params)