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

Incorrect code gen using GET DIRECT LOOKUPS lookups #378

Closed
ToddFincannonEI opened this issue Oct 17, 2023 · 1 comment · Fixed by #379 or #380
Closed

Incorrect code gen using GET DIRECT LOOKUPS lookups #378

ToddFincannonEI opened this issue Oct 17, 2023 · 1 comment · Fixed by #379 or #380
Assignees

Comments

@ToddFincannonEI
Copy link
Collaborator

The LOOKUP FORWARD, LOOKUP BACKWARD, and LOOKUP INVERT functions takes a lookup as its first argument. This works fine when the lookup is defined using the literal lookup syntax, as in our existing test. However, when the lookup is read from a file with GET DIRECT LOOKUPS, incorrect code is generated: the lookup is dereferenced with _LOOKUP instead of being passed to the function.

@ToddFincannonEI
Copy link
Collaborator Author

This is solved by handling these three functions as special forms in visitVar. Note that WITH LOOKUP also takes a lookup argument, but this case does not apply there, since the lookup argument is meant to be a literal lookup.

Some function calls in visitVar were unnecessarily repeated many times, so I took the opportunity to refactor it.

I added tests for this case in the directlookups.mdl test model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment