Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aas_core_codegen/csharp/lib/_generate_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ def _generate_constructor(

if len(arg_codes) == 0:
blocks.append(f"public {cls_name}()\n{{")
if len(arg_codes) == 1:
elif len(arg_codes) == 1:
blocks.append(f"public {cls_name}({arg_codes[0]})\n{{")
else:
arg_block = ",\n".join(arg_codes)
Expand Down
2 changes: 1 addition & 1 deletion aas_core_codegen/python/lib/_generate_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ def _generate_constructor(

if len(arg_codes) == 0:
writer.write("def __init__(self) -> None:\n")
if len(arg_codes) == 1:
elif len(arg_codes) == 1:
writer.write(f"def __init__(self, {arg_codes[0]}) -> None:\n")
else:
arg_block = ",\n".join(["self"] + arg_codes)
Expand Down
2 changes: 1 addition & 1 deletion aas_core_codegen/typescript/lib/_generate_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ def _generate_constructor(

if len(arg_codes) == 0:
blocks.append("constructor() {")
if len(arg_codes) == 1:
elif len(arg_codes) == 1:
blocks.append(f"constructor({arg_codes[0]}) {{")
else:
arg_block = ",\n".join(arg_codes)
Expand Down
14 changes: 14 additions & 0 deletions dev/test_data/common_meta_models/deep_class_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ def __init__(
self.details = details


@abstract
@serialization(with_model_type=True)
class Marker(DBC):
def __init__(self) -> None:
pass


# NOTE (mristin):
# The constructor only calls the parent constructor, but has no arguments.
class Plain_marker(Marker, DBC):
def __init__(self) -> None:
Marker.__init__(self)


class Something(DBC):
some_choice: Node
something_without_choice: Branch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,96 @@ SymbolTable(
methods_by_name=...,
method_id_set=...,
invariant_id_set=...),
AbstractClass(
name='Marker',
inheritances=[],
inheritance_id_set=...,
ancestors=[],
ancestor_id_set=...,
interface=Interface(
base='Reference to AbstractClass Marker',
name='Marker',
inheritances=[],
implementers=[
'Reference to ConcreteClass Plain_marker'],
properties=[],
signatures=[],
description=None,
parsed=...,
properties_by_name=...,
property_id_set=...),
descendant_id_set=...,
descendants=[
'Reference to ConcreteClass Plain_marker'],
concrete_descendant_id_set=...,
concrete_descendants=[
'Reference to ConcreteClass Plain_marker'],
properties=[],
methods=[],
constructor=Constructor(
name='__init__',
arguments=[],
returns=None,
description=None,
contracts=Contracts(
preconditions=[],
snapshots=[],
postconditions=[]),
parsed=...,
arguments_by_name=...,
statements=[],
inlined_statements=[]),
invariants=[],
serialization=Serialization(
with_model_type=True),
description=None,
parsed=...,
properties_by_name=...,
property_id_set=...,
methods_by_name=...,
method_id_set=...,
invariant_id_set=...),
ConcreteClass(
name='Plain_marker',
inheritances=[
'Reference to AbstractClass Marker'],
inheritance_id_set=...,
ancestors=[
'Reference to AbstractClass Marker'],
ancestor_id_set=...,
interface=None,
descendant_id_set=...,
descendants=[],
concrete_descendant_id_set=...,
concrete_descendants=[],
properties=[],
methods=[],
constructor=Constructor(
name='__init__',
arguments=[],
returns=None,
description=None,
contracts=Contracts(
preconditions=[],
snapshots=[],
postconditions=[]),
parsed=...,
arguments_by_name=...,
statements=[
textwrap.dedent("""\
CallSuperConstructor(
super_name='Marker')""")],
inlined_statements=[]),
invariants=[],
serialization=Serialization(
with_model_type=True),
description=None,
parsed=...,
properties_by_name=...,
property_id_set=...,
methods_by_name=...,
method_id_set=...,
invariant_id_set=...),
ConcreteClass(
name='Something',
inheritances=[],
Expand Down Expand Up @@ -684,6 +774,8 @@ SymbolTable(
'Reference to our type Leaf',
'Reference to our type Blossom',
'Reference to our type Container',
'Reference to our type Marker',
'Reference to our type Plain_marker',
'Reference to our type Something'],
enumerations=[],
constrained_primitives=[],
Expand All @@ -692,12 +784,15 @@ SymbolTable(
'Reference to our type Branch',
'Reference to our type Leaf',
'Reference to our type Blossom',
'Reference to our type Marker',
'Reference to our type Plain_marker',
'Reference to our type Something',
'Reference to our type Container'],
concrete_classes=[
'Reference to our type Branch',
'Reference to our type Leaf',
'Reference to our type Blossom',
'Reference to our type Plain_marker',
'Reference to our type Something',
'Reference to our type Container'],
named_unions=[],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"modelType": "PlainMarker"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"modelType": "PlainMarker"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<plainMarker xmlns="https://dummy.com"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<plainMarker xmlns="https://dummy.com"/>
Loading
Loading