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

Side by Side Diff: src/parsing/parser.cc

Issue 2278153004: Refactor object/class literal property name parsing (Closed)
Patch Set: address comments Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')
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 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/ast/ast-expression-rewriter.h" 10 #include "src/ast/ast-expression-rewriter.h"
(...skipping 4684 matching lines...) Expand 10 before | Expand all | Expand 10 after
4695 const bool has_extends = extends != nullptr; 4695 const bool has_extends = extends != nullptr;
4696 while (peek() != Token::RBRACE) { 4696 while (peek() != Token::RBRACE) {
4697 if (Check(Token::SEMICOLON)) continue; 4697 if (Check(Token::SEMICOLON)) continue;
4698 FuncNameInferrer::State fni_state(fni_); 4698 FuncNameInferrer::State fni_state(fni_);
4699 const bool in_class = true; 4699 const bool in_class = true;
4700 bool is_computed_name = false; // Classes do not care about computed 4700 bool is_computed_name = false; // Classes do not care about computed
4701 // property names here. 4701 // property names here.
4702 ExpressionClassifier property_classifier(this); 4702 ExpressionClassifier property_classifier(this);
4703 const AstRawString* property_name = nullptr; 4703 const AstRawString* property_name = nullptr;
4704 ObjectLiteral::Property* property = ParsePropertyDefinition( 4704 ObjectLiteral::Property* property = ParsePropertyDefinition(
4705 &checker, in_class, has_extends, MethodKind::kNormal, &is_computed_name, 4705 &checker, in_class, has_extends, &is_computed_name,
4706 &has_seen_constructor, &property_classifier, &property_name, CHECK_OK); 4706 &has_seen_constructor, &property_classifier, &property_name, CHECK_OK);
4707 RewriteNonPattern(&property_classifier, CHECK_OK); 4707 RewriteNonPattern(&property_classifier, CHECK_OK);
4708 if (classifier != nullptr) { 4708 if (classifier != nullptr) {
4709 classifier->AccumulateFormalParameterContainmentErrors( 4709 classifier->AccumulateFormalParameterContainmentErrors(
4710 &property_classifier); 4710 &property_classifier);
4711 } 4711 }
4712 4712
4713 if (has_seen_constructor && constructor == nullptr) { 4713 if (has_seen_constructor && constructor == nullptr) {
4714 constructor = GetPropertyValue(property)->AsFunctionLiteral(); 4714 constructor = GetPropertyValue(property)->AsFunctionLiteral();
4715 DCHECK_NOT_NULL(constructor); 4715 DCHECK_NOT_NULL(constructor);
(...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after
6643 node->Print(Isolate::Current()); 6643 node->Print(Isolate::Current());
6644 } 6644 }
6645 #endif // DEBUG 6645 #endif // DEBUG
6646 6646
6647 #undef CHECK_OK 6647 #undef CHECK_OK
6648 #undef CHECK_OK_VOID 6648 #undef CHECK_OK_VOID
6649 #undef CHECK_FAILED 6649 #undef CHECK_FAILED
6650 6650
6651 } // namespace internal 6651 } // namespace internal
6652 } // namespace v8 6652 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698