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

Side by Side Diff: src/parsing/parser-base.h

Issue 2578893005: Remove class fields desugaring (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 int position; 666 int position;
667 DeclarationParsingResult parsing_result; 667 DeclarationParsingResult parsing_result;
668 }; 668 };
669 669
670 struct ClassInfo { 670 struct ClassInfo {
671 public: 671 public:
672 explicit ClassInfo(ParserBase* parser) 672 explicit ClassInfo(ParserBase* parser)
673 : proxy(nullptr), 673 : proxy(nullptr),
674 extends(parser->impl()->EmptyExpression()), 674 extends(parser->impl()->EmptyExpression()),
675 properties(parser->impl()->NewClassPropertyList(4)), 675 properties(parser->impl()->NewClassPropertyList(4)),
676 instance_field_initializers(parser->impl()->NewExpressionList(0)),
677 constructor(parser->impl()->EmptyFunctionLiteral()), 676 constructor(parser->impl()->EmptyFunctionLiteral()),
678 has_seen_constructor(false), 677 has_seen_constructor(false),
679 static_initializer_var(nullptr),
680 has_name_static_property(false), 678 has_name_static_property(false),
681 has_static_computed_names(false) {} 679 has_static_computed_names(false) {}
682 VariableProxy* proxy; 680 VariableProxy* proxy;
683 ExpressionT extends; 681 ExpressionT extends;
684 typename Types::ClassPropertyList properties; 682 typename Types::ClassPropertyList properties;
685 ExpressionListT instance_field_initializers;
686 FunctionLiteralT constructor; 683 FunctionLiteralT constructor;
687 bool has_seen_constructor; 684 bool has_seen_constructor;
688 Variable* static_initializer_var;
689 bool has_name_static_property; 685 bool has_name_static_property;
690 bool has_static_computed_names; 686 bool has_static_computed_names;
691 }; 687 };
692 688
693 DeclarationScope* NewScriptScope() const { 689 DeclarationScope* NewScriptScope() const {
694 return new (zone()) DeclarationScope(zone(), ast_value_factory()); 690 return new (zone()) DeclarationScope(zone(), ast_value_factory());
695 } 691 }
696 692
697 DeclarationScope* NewVarblockScope() const { 693 DeclarationScope* NewVarblockScope() const {
698 return new (zone()) DeclarationScope(zone(), scope(), BLOCK_SCOPE); 694 return new (zone()) DeclarationScope(zone(), scope(), BLOCK_SCOPE);
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 initializer_scope->set_end_position(scanner()->location().end_pos); 2298 initializer_scope->set_end_position(scanner()->location().end_pos);
2303 typename Types::StatementList body = impl()->NewStatementList(1); 2299 typename Types::StatementList body = impl()->NewStatementList(1);
2304 body->Add(factory()->NewReturnStatement(value, kNoSourcePosition), zone()); 2300 body->Add(factory()->NewReturnStatement(value, kNoSourcePosition), zone());
2305 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( 2301 FunctionLiteralT function_literal = factory()->NewFunctionLiteral(
2306 impl()->EmptyIdentifierString(), initializer_scope, body, 2302 impl()->EmptyIdentifierString(), initializer_scope, body,
2307 initializer_state.materialized_literal_count(), 2303 initializer_state.materialized_literal_count(),
2308 initializer_state.expected_property_count(), 0, 0, 2304 initializer_state.expected_property_count(), 0, 0,
2309 FunctionLiteral::kNoDuplicateParameters, 2305 FunctionLiteral::kNoDuplicateParameters,
2310 FunctionLiteral::kAnonymousExpression, default_eager_compile_hint_, 2306 FunctionLiteral::kAnonymousExpression, default_eager_compile_hint_,
2311 initializer_scope->start_position(), true, GetNextFunctionLiteralId()); 2307 initializer_scope->start_position(), true, GetNextFunctionLiteralId());
2312 function_literal->set_is_class_field_initializer(true);
2313 return function_literal; 2308 return function_literal;
2314 } 2309 }
2315 2310
2316 template <typename Impl> 2311 template <typename Impl>
2317 typename ParserBase<Impl>::ObjectLiteralPropertyT 2312 typename ParserBase<Impl>::ObjectLiteralPropertyT
2318 ParserBase<Impl>::ParseObjectPropertyDefinition(ObjectLiteralChecker* checker, 2313 ParserBase<Impl>::ParseObjectPropertyDefinition(ObjectLiteralChecker* checker,
2319 bool* is_computed_name, 2314 bool* is_computed_name,
2320 bool* ok) { 2315 bool* ok) {
2321 bool is_get = false; 2316 bool is_get = false;
2322 bool is_set = false; 2317 bool is_set = false;
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 bool is_super_call = result->IsSuperCallReference(); 3150 bool is_super_call = result->IsSuperCallReference();
3156 if (spread_pos.IsValid()) { 3151 if (spread_pos.IsValid()) {
3157 result = impl()->SpreadCall(result, args, pos); 3152 result = impl()->SpreadCall(result, args, pos);
3158 } else { 3153 } else {
3159 result = factory()->NewCall(result, args, pos, is_possibly_eval); 3154 result = factory()->NewCall(result, args, pos, is_possibly_eval);
3160 } 3155 }
3161 3156
3162 // Explicit calls to the super constructor using super() perform an 3157 // Explicit calls to the super constructor using super() perform an
3163 // implicit binding assignment to the 'this' variable. 3158 // implicit binding assignment to the 'this' variable.
3164 if (is_super_call) { 3159 if (is_super_call) {
3165 result = impl()->RewriteSuperCall(result);
3166 ExpressionT this_expr = impl()->ThisExpression(pos); 3160 ExpressionT this_expr = impl()->ThisExpression(pos);
3167 result = 3161 result =
3168 factory()->NewAssignment(Token::INIT, this_expr, result, pos); 3162 factory()->NewAssignment(Token::INIT, this_expr, result, pos);
3169 } 3163 }
3170 3164
3171 if (fni_ != NULL) fni_->RemoveLastFunction(); 3165 if (fni_ != NULL) fni_->RemoveLastFunction();
3172 break; 3166 break;
3173 } 3167 }
3174 3168
3175 case Token::PERIOD: { 3169 case Token::PERIOD: {
(...skipping 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after
5499 has_seen_constructor_ = true; 5493 has_seen_constructor_ = true;
5500 return; 5494 return;
5501 } 5495 }
5502 } 5496 }
5503 5497
5504 5498
5505 } // namespace internal 5499 } // namespace internal
5506 } // namespace v8 5500 } // namespace v8
5507 5501
5508 #endif // V8_PARSING_PARSER_BASE_H 5502 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698