mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 23:56:06 +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
Notes:
sideshowbarker
2024-07-17 18:23:22 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 380abddf3c
Pull-request: https://github.com/SerenityOS/serenity/pull/19719
Reviewed-by: https://github.com/awesomekling
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