Commit 76b7df45 authored by brubbel's avatar brubbel Committed by oroulet

bugfix generating uaprotocol_auto

parent 0c1660b3
......@@ -106,6 +106,7 @@ class Struct:
parents: List[Any] = field(default_factory=list)
# we splt some structs, they must not be registered as extension objects
do_not_register: bool = False
is_data_type: bool = False
def __hash__(self):
return hash(self.name)
......@@ -327,6 +328,7 @@ class Parser:
if ref.text == "i=22" or ref.text in self.model.known_structs:
struct = self.parse_struct(name, el)
struct.is_data_type = True
if ref.text in self.model.known_structs:
parent = self.model.get_struct_by_nodeid(ref.text)
for sfield in reversed(parent.fields):
......
......@@ -130,8 +130,7 @@ class CodeGenerator:
self.write(f':vartype {field.name}: {field.data_type}')
self.write('"""')
# FIXME: next line is a weak way to find out if object is a datatype or not...
if "Parameter" not in obj.name and "Result" not in obj.name:
if obj.is_data_type:
self.write('')
self.write(f'data_type = NodeId(ObjectIds.{obj.name})')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment