-
Notifications
You must be signed in to change notification settings - Fork 12
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
IR: Symbol management on scoped nodes #375
Conversation
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/375/index.html |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #375 +/- ##
==========================================
+ Coverage 95.48% 95.50% +0.01%
==========================================
Files 185 186 +1
Lines 38646 38766 +120
==========================================
+ Hits 36902 37022 +120
Misses 1744 1744
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
80f5605
to
7855dd3
Compare
This allows on-the-fly construction of symbols from the given scope.
b245f8c
to
ee2751c
Compare
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.
Many thanks, this is fantastic!
(And I'm already dreading the follow-on PR that applies the strict Scope-local construction of symbols throughout... ;-)
Note: This PR sits on top of #372, so I'm only filing a draft before anticipated rebase.This PR brings a set of convenience methods and expression constructors to the
ScopedNode
andProgramUnit
classes. The idea is that eventually,Subroutine
andModule
classes should become scoped nodes and the expression management API should be equivalent between them.The idea is to add the following three utilities to the scope objects themselves, to enable quick(er) expression generation:
.get_symbol(name)
- utility to look up a symbol by it's name. This will first find it's true owning scope and attach the symbol..Variable(name, ....)
- a shortcut to the generalVariable
constructor that will attempt to build array and scalar symbols, depending on available type information.parse_expr
- a shortcut to the general expression parser that can generate nested expression trees from pure strings.