-
Notifications
You must be signed in to change notification settings - Fork 19
Types: New Scope accessors, refactoring and LazyNodeLookup removal #647
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
Open
mlange05
wants to merge
12
commits into
main
Choose a base branch
from
naml-scope-api-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e7aad03
Types: Exposing the base data types directly
mlange05 21b583b
Types: Add declare/update/get_type/get_dtype methods to Scope
mlange05 de52338
FParser: Refactor declaration handling to use symbol table
mlange05 08ed154
Function: Ensure implicit return types derive the right local type
mlange05 ca4f0be
Procedure: Move test for internal procedures to dedicated test
mlange05 4d7ed3f
Procedure: Change "members" to "internal procedures" and add alias
mlange05 05bf2cc
Procedure: Add test for variable aliasing in internal procedures
mlange05 98c8fd9
FParser: Avoid using `LazyNodeLookup` for`StatementFunctions`
mlange05 aadd118
IR: Make `StatementFunction` a `ScopedNode` to avoid removal
mlange05 655c6a3
Tools: Remove the now redundant `LazyNodeLookup` utility
mlange05 4be95bd
Transformation: Fix StmtFunction inlining bug by forcing re-scope
mlange05 9e029b0
Analysis: Treat new `StatementFunction` node in dataflow analysis
mlange05 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1571,9 +1571,12 @@ class _StatementFunctionBase(): | |||||||||
|
|
||||||||||
|
|
||||||||||
| @dataclass_strict(frozen=True) | ||||||||||
| class StatementFunction(LeafNode, _StatementFunctionBase): | ||||||||||
| class StatementFunction(ScopedNode, LeafNode, _StatementFunctionBase): | ||||||||||
| """ | ||||||||||
| Internal representation of Fortran statement function statements | ||||||||||
| Internal representation of Fortran statement function statements. | ||||||||||
|
|
||||||||||
| Internally, this is considered a :any:`ScopedNode` with an empty | ||||||||||
| body, because it may be the target of a :any:`ProcedureType`. | ||||||||||
|
Comment on lines
+1578
to
+1579
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
ScopedNode doesn't imply being an |
||||||||||
|
|
||||||||||
| Parameters | ||||||||||
| ---------- | ||||||||||
|
|
@@ -1589,8 +1592,10 @@ class StatementFunction(LeafNode, _StatementFunctionBase): | |||||||||
|
|
||||||||||
| _traversable = ['variable', 'arguments', 'rhs'] | ||||||||||
|
|
||||||||||
| def __post_init__(self): | ||||||||||
| super().__post_init__() | ||||||||||
| def __post_init__(self, parent=None): | ||||||||||
| super(ScopedNode, self).__post_init__(parent=parent) | ||||||||||
| super(LeafNode, self).__post_init__() | ||||||||||
|
|
||||||||||
| assert isinstance(self.variable, Expression) | ||||||||||
| assert is_iterable(self.arguments) and all(isinstance(a, Expression) for a in self.arguments) | ||||||||||
| assert isinstance(self.return_type, SymbolAttributes) | ||||||||||
|
|
@@ -1599,6 +1604,10 @@ def __post_init__(self): | |||||||||
| def name(self): | ||||||||||
| return str(self.variable) | ||||||||||
|
|
||||||||||
| @property | ||||||||||
| def variables(self): | ||||||||||
| return self.arguments | ||||||||||
|
|
||||||||||
| @property | ||||||||||
| def is_function(self): | ||||||||||
| return True | ||||||||||
|
|
||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems not to be covered by tests - any chance of monkey-patching this into an existing test to make sure it behaves as expected?