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

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

Issue 1567603005: Set up rewriting triggers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Clean up and rename to RewriteNonPattern Created 4 years, 11 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 | « src/parsing/parser.h ('k') | src/parsing/parser-base.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 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-visitor.h" 9 #include "src/ast/ast-expression-visitor.h"
10 #include "src/ast/ast-literal-reindexer.h" 10 #include "src/ast/ast-literal-reindexer.h"
(...skipping 4732 matching lines...) Expand 10 before | Expand all | Expand 10 after
4743 proxy, CONST, block_scope, pos, is_class_declaration, 4743 proxy, CONST, block_scope, pos, is_class_declaration,
4744 scope_->class_declaration_group_start()); 4744 scope_->class_declaration_group_start());
4745 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); 4745 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
4746 } 4746 }
4747 4747
4748 Expression* extends = NULL; 4748 Expression* extends = NULL;
4749 if (Check(Token::EXTENDS)) { 4749 if (Check(Token::EXTENDS)) {
4750 block_scope->set_start_position(scanner()->location().end_pos); 4750 block_scope->set_start_position(scanner()->location().end_pos);
4751 ExpressionClassifier classifier; 4751 ExpressionClassifier classifier;
4752 extends = ParseLeftHandSideExpression(&classifier, CHECK_OK); 4752 extends = ParseLeftHandSideExpression(&classifier, CHECK_OK);
4753 extends = ParserTraits::RewriteExpression(extends, &classifier, CHECK_OK); 4753 extends = ParserTraits::RewriteNonPattern(extends, &classifier, CHECK_OK);
4754 } else { 4754 } else {
4755 block_scope->set_start_position(scanner()->location().end_pos); 4755 block_scope->set_start_position(scanner()->location().end_pos);
4756 } 4756 }
4757 4757
4758 4758
4759 ClassLiteralChecker checker(this); 4759 ClassLiteralChecker checker(this);
4760 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); 4760 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone());
4761 FunctionLiteral* constructor = NULL; 4761 FunctionLiteral* constructor = NULL;
4762 bool has_seen_constructor = false; 4762 bool has_seen_constructor = false;
4763 4763
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
5385 SetLanguageMode(scope_, 5385 SetLanguageMode(scope_,
5386 static_cast<LanguageMode>(scope_->language_mode() | mode)); 5386 static_cast<LanguageMode>(scope_->language_mode() | mode));
5387 } 5387 }
5388 5388
5389 5389
5390 void ParserTraits::RewriteDestructuringAssignments() { 5390 void ParserTraits::RewriteDestructuringAssignments() {
5391 parser_->RewriteDestructuringAssignments(); 5391 parser_->RewriteDestructuringAssignments();
5392 } 5392 }
5393 5393
5394 5394
5395 Expression* ParserTraits::RewriteExpression( 5395 Expression* ParserTraits::RewriteNonPattern(
5396 Expression* expr, const ExpressionClassifier* classifier, bool* ok) { 5396 Expression* expr, const ExpressionClassifier* classifier, bool* ok) {
5397 return parser_->RewriteExpression(expr, classifier, ok); 5397 return parser_->RewriteNonPattern(expr, classifier, ok);
5398 } 5398 }
5399 5399
5400 5400
5401 ObjectLiteralProperty* ParserTraits::RewriteObjectLiteralProperty( 5401 ObjectLiteralProperty* ParserTraits::RewriteObjectLiteralProperty(
5402 ObjectLiteralProperty* property, const ExpressionClassifier* classifier, 5402 ObjectLiteralProperty* property, const ExpressionClassifier* classifier,
5403 bool* ok) { 5403 bool* ok) {
5404 return parser_->RewriteObjectLiteralProperty(property, classifier, ok); 5404 return parser_->RewriteObjectLiteralProperty(property, classifier, ok);
5405 } 5405 }
5406 5406
5407 5407
5408 Expression* Parser::RewriteExpression(Expression* expr, 5408 Expression* Parser::RewriteNonPattern(Expression* expr,
5409 const ExpressionClassifier* classifier, 5409 const ExpressionClassifier* classifier,
5410 bool* ok) { 5410 bool* ok) {
5411 // For the time being, this does no rewriting at all. 5411 // For the time being, this does no rewriting at all.
5412 ValidateExpression(classifier, ok); 5412 ValidateExpression(classifier, ok);
5413 return expr; 5413 return expr;
5414 } 5414 }
5415 5415
5416 5416
5417 ObjectLiteralProperty* Parser::RewriteObjectLiteralProperty( 5417 ObjectLiteralProperty* Parser::RewriteObjectLiteralProperty(
5418 ObjectLiteralProperty* property, const ExpressionClassifier* classifier, 5418 ObjectLiteralProperty* property, const ExpressionClassifier* classifier,
5419 bool* ok) { 5419 bool* ok) {
5420 if (property != nullptr) { 5420 if (property != nullptr) {
5421 Expression* key = RewriteExpression(property->key(), classifier, ok); 5421 Expression* key = RewriteNonPattern(property->key(), classifier, ok);
5422 property->set_key(key); 5422 property->set_key(key);
5423 Expression* value = RewriteExpression(property->value(), classifier, ok); 5423 Expression* value = RewriteNonPattern(property->value(), classifier, ok);
5424 property->set_value(value); 5424 property->set_value(value);
5425 } 5425 }
5426 return property; 5426 return property;
5427 } 5427 }
5428 5428
5429 5429
5430 void Parser::RewriteDestructuringAssignments() { 5430 void Parser::RewriteDestructuringAssignments() {
5431 FunctionState* func = function_state_; 5431 FunctionState* func = function_state_;
5432 if (!allow_harmony_destructuring_assignment()) return; 5432 if (!allow_harmony_destructuring_assignment()) return;
5433 const List<DestructuringAssignment>& assignments = 5433 const List<DestructuringAssignment>& assignments =
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
5487 auto class_literal = value->AsClassLiteral(); 5487 auto class_literal = value->AsClassLiteral();
5488 if (class_literal->raw_name() == nullptr) { 5488 if (class_literal->raw_name() == nullptr) {
5489 class_literal->set_raw_name(name); 5489 class_literal->set_raw_name(name);
5490 } 5490 }
5491 } 5491 }
5492 } 5492 }
5493 5493
5494 5494
5495 } // namespace internal 5495 } // namespace internal
5496 } // namespace v8 5496 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698