You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on the fixes for #179, I found an issue with the current implementation of the readEquation phase that is an obstacle to those fixes.
In cases like generateDelay3VarsForSeparatedVar where we generate variables at compile time in order to implement complex functions (e.g., DELAY3[I]), we call context.defineVariable() for each generated variable in isolation; each call to defineVariable() will do addVariable followed by readEquation.
The problem with this approach is that when there are multiple equations being defined (that refer to each other), we aren't able to access information from the variables that aren't yet added.
It would be better if we generate the text of all equations first, then change defineVariable(eqn: string) to be defineVariables(eqns: string[]). Then we can call addVariable on all those equations in a first pass, and then when it calls readEquation those variables will be defined and can be accessed.
This is basically a refactoring that has no impact on current behavior (all existing tests will pass), but it will make it easier to implement other in-progress fixes.
The text was updated successfully, but these errors were encountered:
While working on the fixes for #179, I found an issue with the current implementation of the
readEquation
phase that is an obstacle to those fixes.In cases like
generateDelay3VarsForSeparatedVar
where we generate variables at compile time in order to implement complex functions (e.g.,DELAY3[I]
), we callcontext.defineVariable()
for each generated variable in isolation; each call todefineVariable()
will doaddVariable
followed byreadEquation
.The problem with this approach is that when there are multiple equations being defined (that refer to each other), we aren't able to access information from the variables that aren't yet added.
It would be better if we generate the text of all equations first, then change
defineVariable(eqn: string)
to bedefineVariables(eqns: string[])
. Then we can calladdVariable
on all those equations in a first pass, and then when it callsreadEquation
those variables will be defined and can be accessed.This is basically a refactoring that has no impact on current behavior (all existing tests will pass), but it will make it easier to implement other in-progress fixes.
The text was updated successfully, but these errors were encountered: