Skip to content

Commit

Permalink
🏗 parser: Add scoped typed analysis to declarations (#15)
Browse files Browse the repository at this point in the history
Add scoped typed analysis to declarations, ensuring that variables or
parameters do not get redeclared in same block. Variables may be
re-declared in inner scope of a new block with a new type which does not
affect the outer scope. Add detailed tests for various scenarios.

As the parser will also take care of type analysis this is a necessary
addition and patches a whole in the previous global type analysis for
redeclaration.

Add a minor test refactor for parse error assertions

This merges the following commits:
* parser: Factor out parseError function in tests
* parser: Add scoped typed analysis to declarations

     pkg/parser/parser.go         | 196 ++++++++++++++++++++---------------
     pkg/parser/parser_literal.go |  18 ++--
     pkg/parser/parser_test.go    | 135 ++++++++++++++++++++++--
     pkg/parser/scope.go          |  34 ++++++
     4 files changed, 282 insertions(+), 101 deletions(-)

Pull-Request: #15
  • Loading branch information
juliaogris committed Sep 13, 2022
2 parents 4d29806 + 36c4311 commit c7b5ca3
Show file tree
Hide file tree
Showing 4 changed files with 282 additions and 101 deletions.
Loading

0 comments on commit c7b5ca3

Please sign in to comment.