mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-09 18:41:53 +00:00
LibJS: Preserve information about local variables declaration kind
This is required for upcoming change where we want to emit ThrowIfTDZ for assignment expressions only for lexical declarations.
This commit is contained in:
parent
2774068ca0
commit
db480b1f0c
Notes:
github-actions[bot]
2025-05-06 10:07:32 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: db480b1f0c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4616
Reviewed-by: https://github.com/awesomekling
11 changed files with 83 additions and 40 deletions
|
@ -53,6 +53,7 @@ public:
|
|||
void set_local_initialized(Identifier::Local const&);
|
||||
[[nodiscard]] bool is_local_initialized(u32 local_index) const;
|
||||
[[nodiscard]] bool is_local_initialized(Identifier::Local const&) const;
|
||||
[[nodiscard]] bool is_local_lexically_declared(Identifier::Local const& local) const;
|
||||
|
||||
class SourceLocationScope {
|
||||
public:
|
||||
|
@ -358,7 +359,7 @@ public:
|
|||
private:
|
||||
VM& m_vm;
|
||||
|
||||
static CodeGenerationErrorOr<GC::Ref<Executable>> compile(VM&, ASTNode const&, FunctionKind, GC::Ptr<ECMAScriptFunctionObject const>, MustPropagateCompletion, Vector<FlyString> local_variable_names);
|
||||
static CodeGenerationErrorOr<GC::Ref<Executable>> compile(VM&, ASTNode const&, FunctionKind, GC::Ptr<ECMAScriptFunctionObject const>, MustPropagateCompletion, Vector<LocalVariable> local_variable_names);
|
||||
|
||||
enum class JumpType {
|
||||
Continue,
|
||||
|
@ -413,6 +414,7 @@ private:
|
|||
|
||||
HashTable<u32> m_initialized_locals;
|
||||
HashTable<u32> m_initialized_arguments;
|
||||
Vector<LocalVariable> m_local_variables;
|
||||
|
||||
bool m_finished { false };
|
||||
bool m_must_propagate_completion { true };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue