-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: cherry-pick 3e037e195e50 from v8
- Loading branch information
1 parent
db68805
commit a1ff027
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
From 3e037e195e508dea045f5626862412e8f64fc919 Mon Sep 17 00:00:00 2001 | ||
From: Shu-yu Guo <syg@chromium.org> | ||
Date: Tue, 21 May 2024 10:06:20 -0700 | ||
Subject: [PATCH] [parser] Using FunctionParsingScope for parsing class static blocks | ||
|
||
Class static blocks contain statements, don't inherit the | ||
ExpressionScope stack. | ||
|
||
Bug: 341663589 | ||
Change-Id: Id52a60d77781201a706fcf2290d7d103f39bed83 | ||
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5553030 | ||
Commit-Queue: Shu-yu Guo <syg@chromium.org> | ||
Commit-Queue: Adam Klein <adamk@chromium.org> | ||
Reviewed-by: Adam Klein <adamk@chromium.org> | ||
Cr-Commit-Position: refs/heads/main@{#94014} | ||
--- | ||
|
||
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc | ||
index 660fdd2..de4df35 100644 | ||
--- a/src/ast/scopes.cc | ||
+++ b/src/ast/scopes.cc | ||
@@ -2447,7 +2447,7 @@ | ||
var->set_is_used(); | ||
if (inner_scope_calls_eval_ && !var->is_this()) var->SetMaybeAssigned(); | ||
} | ||
- DCHECK(!var->has_forced_context_allocation() || var->is_used()); | ||
+ CHECK(!var->has_forced_context_allocation() || var->is_used()); | ||
// Global variables do not need to be allocated. | ||
return !var->IsGlobalObjectProperty() && var->is_used(); | ||
} | ||
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h | ||
index 40914d3..65c338f 100644 | ||
--- a/src/parsing/parser-base.h | ||
+++ b/src/parsing/parser-base.h | ||
@@ -2661,6 +2661,7 @@ | ||
} | ||
|
||
FunctionState initializer_state(&function_state_, &scope_, initializer_scope); | ||
+ FunctionParsingScope body_parsing_scope(impl()); | ||
AcceptINScope accept_in(this, true); | ||
|
||
// Each static block has its own var and lexical scope, so make a new var |