Skip to content

Commit

Permalink
Frontend: Force ProcedureSymbol for struct constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
mlange05 committed Nov 26, 2024
1 parent 8ddfad2 commit 8a975bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion loki/frontend/fparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2602,7 +2602,7 @@ def visit_Structure_Constructor(self, o, **kwargs):

# `name` is a DerivedType but we represent a constructor call as InlineCall for
# which we need ProcedureSymbol
name = sym.Variable(name=name.name, scope=scope)
name = sym.ProcedureSymbol(name=name.name, scope=scope)

if o.children[1] is not None:
arguments = self.visit(o.children[1], **kwargs)
Expand Down
4 changes: 3 additions & 1 deletion loki/frontend/omni.py
Original file line number Diff line number Diff line change
Expand Up @@ -1253,10 +1253,12 @@ def visit_functionCall(self, o, **kwargs):
return sym.InlineCall(name, parameters=args, kw_parameters=kw_args)

def visit_FstructConstructor(self, o, **kwargs):
scope = kwargs['scope']
_type = self.type_from_type_attrib(o.attrib['type'], **kwargs)
assert isinstance(_type.dtype, DerivedType)

name = sym.Variable(name=_type.dtype.name)
# The constructor is represented as an InlineCall with a ProcedureSymbol
name = sym.ProcedureSymbol(name=_type.dtype.name, scope=scope)
args = [self.visit(a, **kwargs) for a in o]

# Separate keyword argument from positional arguments
Expand Down

0 comments on commit 8a975bf

Please sign in to comment.