-
Notifications
You must be signed in to change notification settings - Fork 28
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 #2165) add support for associate constructs. #2167
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #2167 +/- ##
==========================================
- Coverage 99.84% 99.84% -0.01%
==========================================
Files 334 336 +2
Lines 45137 45239 +102
==========================================
+ Hits 45068 45169 +101
- Misses 69 70 +1
☔ View full report in Codecov by Sentry. |
I need to test this branch with some real NEMOVAR code before putting it as ready for review. |
Of course, the very first NEMOVAR I tried this on had some WRITE stmts inside the associate construct so we're no further forward. I can refine by checking which symbols are referenced by the resulting CodeBlock but that may not help. If that's so then I think the only option is to remove the WRITES? |
In the telco this morning @sergisiso reminded me that we can't handle Associate constructs that contain calls to impure routines either. I need to catch this case. |
I could refine what I have to check that any Call or Write is not the last statement in the construct. Beyond that, I could check whether there are any reads of any associate names after a Call or write. |
The ASSOCIATE constructs in the NV code we looked at today all contained calls and so this approach won't work. We could allow a user to permit calls within associate blocks but that feels dangerous and very hard to test. I think therefore that the only remaining option is to create temporary variables and that means we have to be able to determine their type. |
This is an initial cut that we can improve upon if we need to. In particular, the solution chosen here replaces instances of associate-name with the corresponding expression. However, since that expression must be evaluated at the start of the construct, if any of the variables it references are written to within the construct then this substitution cannot be performed. We could refine this by checking the precise location at which any such writes are performed - if they happen to only occur after lines where we need to perform the substitution then this would still be OK.
Alternatively, we could attempt to determine the type of the expression and then store its value in a new variable at the start of the construct.