From 4c4edf1963135789d3b618716726c6a51713c8ee Mon Sep 17 00:00:00 2001 From: Joeri Exelmans Date: Wed, 9 Oct 2024 15:19:54 +0200 Subject: [PATCH] CD parser: only add ModelRefs for types that don't exist yet --- concrete_syntax/textual_cd/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/concrete_syntax/textual_cd/parser.py b/concrete_syntax/textual_cd/parser.py index 7f8b36e..1a3d4d9 100644 --- a/concrete_syntax/textual_cd/parser.py +++ b/concrete_syntax/textual_cd/parser.py @@ -122,8 +122,8 @@ def parse_cd(state, m_text): if attrs != None: for attr in attrs: (optional, attr_type, attr_name, constraint) = attr - # TODO: only create type ref if it doesn't exist yet - cd.create_model_ref(attr_type, primitive_types[attr_type]) + if state.read_dict(m, attr_type) == None: + cd.create_model_ref(attr_type, primitive_types[attr_type]) cd.create_attribute_link(class_name, attr_type, attr_name, optional) if constraint != None: _add_constraint_to_obj(f"{class_name}_{attr_name}", constraint)