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

Remove function scope and improve type tracking #401

Merged
merged 28 commits into from
May 3, 2021

Conversation

TwitchBronBron
Copy link
Member

Migrated from #258

Notable changes:

  • completely removed the FunctionScope concept in favor of capturing variable declarations for each function at parse-time and storing them in references. This cut down on a lot of after-parse looping.
  • Add LazyType to defer deriving the type of certain variable types until after the file has been parsed.
  • Add SymbolTable at multiple levels (Scope, Parser, NamespaceStatement, FunctionExpression) to help track variable assignments and function definitions.
  • Add type checking for function arguments

This change yielded some fairly impressive performance improvements for the validate cycle:
image

TwitchBronBron and others added 25 commits December 18, 2020 15:04
* Ran npm audit and fixed vulvnerability

* Added symbol table class

* Parser adds to a symbol table as it parses code

* Revert package changes

* Fixed test that was referencing LazyType when it was not supposed to

* Better handling of a variable potentially changing type. Added getSymbolType() function and fixed error of a function inheriting symbols from a containing function

* Fixed typo

* Removed code comment

* Fixes from PR comments - and made sure for each loop variables were added to the symbolTable

* Changed BscSymbol interface to include a range

Co-authored-by: Mark Pearce <[email protected]>
* Adds SymbolTable.hasKey method

* Makes CustomType display its actual type

* Standardize how a FunctionType is created from an expression

* Adds symbol tables to namespaces

* Adds a symbol table to scope, and computes merged symbol tables across files

* Use the symbolTable on getHover

* Working on argument type mismatch validation

* Proper type tracking across files in the same scope, including namespaces. Adds validation on argument types

* Fixed bad whitespace in tests

* Updates from code review

* Fixed all circular dependency issues

* Hopefully fixed all whitespace issues

* Fixes for when scope changes

* Fixed lint error and remove symbolTable clear - it was not needed

* Clean up getHover code

Co-authored-by: Mark Pearce <[email protected]>
@TwitchBronBron TwitchBronBron merged commit 7fd077d into v1 May 3, 2021
@TwitchBronBron TwitchBronBron deleted the remove-FunctionScope-and-improve-type-tracking branch May 3, 2021 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants