Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Towards #2586) Add support for object-oriented var =[>] this[%...]%procedure(...) assignment #2649

Merged
merged 10 commits into from
Jul 18, 2024
Merged
7 changes: 5 additions & 2 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,15 @@
PSyData API (e.g. when profiling).

57) PR #2647 for #1992. Adds MPI support to PSyKE. Each rank will write
its own output file(s). The generated driver has been extended so that
the name of the file to use can be specified on the command line.
its own output file(s). The generated driver has been extended so that
the name of the file to use can be specified on the command line.

58) PR #2637 for #2138. Add Fortran frontend support to parser array
declarations with expressions in their shape dimensions.

59) PR #2649 towards #2586. Adds support for pointer assignments of
the form `var =[>] this[%...]%procedure(...)`.

release 2.5.0 14th of February 2024

1) PR #2199 for #2189. Fix bugs with missing maps in enter data
Expand Down
Binary file modified psyclone.pdf
Binary file not shown.
8 changes: 8 additions & 0 deletions src/psyclone/psyir/frontend/fparser2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ def __init__(self):
Fortran2003.Where_Construct: self._where_construct_handler,
Fortran2003.Where_Stmt: self._where_construct_handler,
Fortran2003.Call_Stmt: self._call_handler,
Fortran2003.Function_Reference: self._call_handler,
Fortran2003.Subroutine_Subprogram: self._subroutine_handler,
Fortran2003.Module: self._module_handler,
Fortran2003.Main_Program: self._main_program_handler,
Expand Down Expand Up @@ -5129,6 +5130,13 @@ def _call_handler(self, node, parent):

'''
call = Call(parent=parent)
# TODO fparser/#447 For now `null()` is treated as a
# `Function_Reference` by fparser, instead of an
# `Intrinsic_Function_Reference` so we redirect to the correct
# handler for fparser2 tests to pass. This should be removed once
# fparser2 is fixed.
if str(node.items[0]).lower() == "null" and node.items[1] is None:
return self._intrinsic_handler(node, parent)
self.process_nodes(parent=call, nodes=[node.items[0]])
routine = call.children[0]
# If it's a plain reference, promote the symbol to a RoutineSymbol
Expand Down
6 changes: 3 additions & 3 deletions src/psyclone/tests/psyir/frontend/fparser2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def test_get_partial_datatype():
ids = [id(entry) for entry in walk(node)]
datatype, init = processor._get_partial_datatype(node, fake_parent, {})
assert isinstance(datatype, ScalarType)
assert isinstance(init, CodeBlock)
assert isinstance(init, IntrinsicCall)
assert init.parent is None
assert datatype.intrinsic is ScalarType.Intrinsic.INTEGER
# Check fparser2 tree is unmodified
Expand Down Expand Up @@ -727,7 +727,7 @@ def test_get_partial_datatype():
ids = [id(entry) for entry in walk(node)]
datatype, init = processor._get_partial_datatype(node, fake_parent, {})
assert isinstance(datatype, ScalarType)
assert isinstance(init, CodeBlock)
assert isinstance(init, IntrinsicCall)
assert init.parent is None
assert datatype.intrinsic is ScalarType.Intrinsic.INTEGER
# Check fparser2 tree is unmodified
Expand Down Expand Up @@ -861,7 +861,7 @@ def test_process_declarations():
ptr_sym = fake_parent.symbol_table.lookup("dptr")
assert isinstance(ptr_sym, DataSymbol)
assert isinstance(ptr_sym.datatype, UnsupportedFortranType)
assert isinstance(ptr_sym.initial_value, CodeBlock)
assert isinstance(ptr_sym.initial_value, IntrinsicCall)


@pytest.mark.usefixtures("f2008_parser")
Expand Down
Loading