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

"Initial" variables no longer included in JSON listing #527

Closed
chrispcampbell opened this issue Aug 28, 2024 · 1 comment · Fixed by #529 or #530
Closed

"Initial" variables no longer included in JSON listing #527

chrispcampbell opened this issue Aug 28, 2024 · 1 comment · Fixed by #529 or #530
Assignees

Comments

@chrispcampbell
Copy link
Contributor

Due to a recent change in the compile package, variables of type initial are no longer being included in the generated JSON listing file. I discovered this after I upgraded to the latest compile package and ran an internal tool that makes use of the JSON listing file, which flagged the missing variables.

In PR #490, I added support for overriding data+lookup variables. As part of that change, I added code so that in addition to the usual full JSON listing, we also now generate a minimal JSON listing file ({model}_min.json). In adding that, I intended to fix an issue where there were duplicate entries being included in the listing files, due to the fact that we were using initVars.

Here's the relevant commit:
c0a184c

And a screenshot for context:
image

The problem with that fix is that we no longer include variables of type initial (those that are defined using the INITIAL function). These variables have their varType set to initial and their code is generated into the initLevels function by virtue of being part of the set of variables returned by initVars (the set of variables that have hasInitValue===true).

I will amend the above code so that it includes initial variables and will add a test case that covers this (since the existing tests did not cover this).

@chrispcampbell
Copy link
Contributor Author

I decided to go back to using initVars because that matches what is used by code gen when generating the initLevel function, and it includes initial variables. I fixed the allListedVars to remove duplicates, so that should resolve the issue that I was trying to fix the last time.

I noticed in fixing this that calling these xxxVars functions results in some redundant sorting work in the case where sde generate is used with both --list and --outformat (JSON listing in addition to code gen). I will address that separately in #528.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant