Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Unified Diff: src/parsing/parser.cc

Issue 2849773002: Revert of Wrap ClassLiterals in DoExpressions instead of giving them BlockScopes. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.h ('k') | test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 65271d9a5c3fcebd28baf1a2425d5295573c0fa5..a2bda669d9e6566b386d55728ece9b4c9aa72770 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -796,7 +796,7 @@
function_token_position, type, language_mode, ok);
}
-Expression* ParserTraits::ParseClassLiteral(
+ClassLiteral* ParserTraits::ParseClassLiteral(
Type::ExpressionClassifier* classifier, const AstRawString* name,
Scanner::Location class_name_location, bool name_is_strict_reserved,
int pos, bool* ok) {
@@ -2267,8 +2267,8 @@
variable_name = name;
}
- Expression* value = ParseClassLiteral(nullptr, name, scanner()->location(),
- is_strict_reserved, pos, CHECK_OK);
+ ClassLiteral* value = ParseClassLiteral(nullptr, name, scanner()->location(),
+ is_strict_reserved, pos, CHECK_OK);
VariableProxy* proxy = NewUnresolved(variable_name, LET);
Declaration* declaration =
@@ -5005,11 +5005,11 @@
return result;
}
-Expression* Parser::ParseClassLiteral(ExpressionClassifier* classifier,
- const AstRawString* name,
- Scanner::Location class_name_location,
- bool name_is_strict_reserved, int pos,
- bool* ok) {
+ClassLiteral* Parser::ParseClassLiteral(ExpressionClassifier* classifier,
+ const AstRawString* name,
+ Scanner::Location class_name_location,
+ bool name_is_strict_reserved, int pos,
+ bool* ok) {
// All parts of a ClassDeclaration and ClassExpression are strict code.
if (name_is_strict_reserved) {
ReportMessageAt(class_name_location,
@@ -5111,21 +5111,8 @@
proxy->var()->set_initializer_position(end_pos);
}
- Block* do_block = factory()->NewBlock(nullptr, 1, false, pos);
- do_block->set_scope(block_scope);
- Variable* result_var =
- block_scope->NewTemporary(ast_value_factory()->empty_string());
- DoExpression* do_expr = factory()->NewDoExpression(do_block, result_var, pos);
-
- ClassLiteral* class_literal = factory()->NewClassLiteral(
- proxy, extends, constructor, properties, pos, end_pos);
-
- do_block->statements()->Add(
- factory()->NewExpressionStatement(class_literal, pos), zone());
- do_expr->set_represented_function(constructor);
- Rewriter::Rewrite(this, do_expr, ast_value_factory());
-
- return do_expr;
+ return factory()->NewClassLiteral(block_scope, proxy, extends, constructor,
+ properties, pos, end_pos);
}
@@ -6119,8 +6106,8 @@
if (function != nullptr) {
function->set_raw_name(name);
} else {
- DCHECK(value->IsDoExpression());
- value->AsDoExpression()->represented_function()->set_raw_name(name);
+ DCHECK(value->IsClassLiteral());
+ value->AsClassLiteral()->constructor()->set_raw_name(name);
}
}
« no previous file with comments | « src/parsing/parser.h ('k') | test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698