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
There are a lot of static analysis data structures that should be refactored into instance data structures so that they do not need to be reset between independent compilations within a single process (as in the test suite and the prototype UI).
Examples:
BuildSymbolTables.nodeSymbolTableMap
LJASTBuildClassLinks.nameClassMap
ASTClass.nameClassMap
ASTClassBlock.nameAttributeMap
This will significantly simplify the LJStaticAnalysisTest.init() method (and similar code in the prototype UI if that is accepted into master by that point).
I'm struggling a lot with ASTClass.nameClassMap. I understand that we don't want to clear it between compilations but it's challenging because the structure holds a list of signatures that the different ASTClasses add to. Also, the ASTClass constructor isn't used by any other program than ASTClass. Normally, an ASTClass is typecast from the parseMap. It's not easy to explain like this, but I'm not sure how to implement this as an instance variable. The other three are done and simple.
Hmm. @Zamua or @hinescd any suggestions? I'm not opposed to using the Singleton pattern if necessary as long as there's a clean way to clear it out. Maybe the StaticAnalysis class should handle all of that. Now that I think about it, actually, StaticAnalysis.errors should probably be included in this list as well.
Perhaps this state maintenance should be handled by a new visitor instead of inside of ASTClass. If you want two separate states then create two separate visitors
Same goes for other places where we should be handling state. We could maybe make a StateVisitor that is generic enough, but I haven't given it all that much thought yet
Activity
Reset static analysis data structures between compilations
MrBartWolf commentedon Apr 14, 2020
I'm struggling a lot with ASTClass.nameClassMap. I understand that we don't want to clear it between compilations but it's challenging because the structure holds a list of signatures that the different ASTClasses add to. Also, the ASTClass constructor isn't used by any other program than ASTClass. Normally, an ASTClass is typecast from the parseMap. It's not easy to explain like this, but I'm not sure how to implement this as an instance variable. The other three are done and simple.
lam2mo commentedon Apr 14, 2020
Hmm. @Zamua or @hinescd any suggestions? I'm not opposed to using the Singleton pattern if necessary as long as there's a clean way to clear it out. Maybe the
StaticAnalysisclass should handle all of that. Now that I think about it, actually,StaticAnalysis.errorsshould probably be included in this list as well.Zamua commentedon Apr 14, 2020
Perhaps this state maintenance should be handled by a new visitor instead of inside of ASTClass. If you want two separate states then create two separate visitors
Zamua commentedon Apr 14, 2020
Same goes for other places where we should be handling state. We could maybe make a StateVisitor that is generic enough, but I haven't given it all that much thought yet