Skip to content

Refactor static data structures #89

Closed

Description

@lam2mo

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).

Activity

  1. MrBartWolf commented on Apr 14, 2020

    @MrBartWolf
    Contributor

    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.

  2. lam2mo commented on Apr 14, 2020

    @lam2mo
    MemberAuthor

    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.

  3. Zamua commented on Apr 14, 2020

    @Zamua
    Contributor

    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

  4. Zamua commented on Apr 14, 2020

    @Zamua
    Contributor

    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

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions