Skip to content

bug(semantic): Incorrect ScopeId for IIFEs #4452

@DonIsaac

Description

@DonIsaac

See this test case for a reproduction

function foo()

In this following scope ids are equal:

  • the root scope id
  • AstNode::scope_id(), when called on foo's declaration node
  • SymbolTable::get_scope_id(), when called with foo's SymbolId

Now, consider this snippet:

(function foo() {})()

Here, the following scope ids are equal

  • the root scope id
  • AstNode::scope_id(), when called on foo's declaration node
    However, the symbol id obtained from SymbolTable::get_scope_id() is not the same as the other two.

I'm not certain what expected behavior here is, whether foo should be considered in the root scope or not, but the scope id for its AstNode and for the Symbol should definitely be the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions