mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:07:35 +00:00
LibJS: Update parser to detect if identifier refer a "local" variable
This modification enables the parser to determine whether an identifier used within a function refers to a local variable or not. In this context, a local identifier means that it is not captured by any nested function declaration which means it modified only from inside a function. The information about whether identifier is local is stored inside Identifier AST node and also contains information about the index of local variable inside a function and information about total number of local variables used by a function is stored in function nodes.
This commit is contained in:
parent
c734f2b5e6
commit
380abddf3c
4 changed files with 270 additions and 99 deletions
|
@ -342,6 +342,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
NonnullRefPtr<Identifier const> create_identifier_and_register_in_current_scope(SourceRange range, DeprecatedFlyString string);
|
||||
|
||||
NonnullRefPtr<SourceCode const> m_source_code;
|
||||
Vector<Position> m_rule_starts;
|
||||
ParserState m_state;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue