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

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

Issue 2263973003: [parser] Modify some const qualifications (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 4 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 <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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 char array[100]; 570 char array[100];
571 const char* string = DoubleToCString(double_value, ArrayVector(array)); 571 const char* string = DoubleToCString(double_value, ArrayVector(array));
572 return parser_->ast_value_factory()->GetOneByteString(string); 572 return parser_->ast_value_factory()->GetOneByteString(string);
573 } 573 }
574 574
575 575
576 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) const { 576 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) const {
577 return parser_->scanner()->NextSymbol(parser_->ast_value_factory()); 577 return parser_->scanner()->NextSymbol(parser_->ast_value_factory());
578 } 578 }
579 579
580 Expression* ParserTraits::ThisExpression(int pos) const { 580 Expression* ParserTraits::ThisExpression(int pos) {
581 return parser_->NewUnresolved(parser_->ast_value_factory()->this_string(), 581 return parser_->NewUnresolved(parser_->ast_value_factory()->this_string(),
582 pos, pos + 4, Variable::THIS); 582 pos, pos + 4, Variable::THIS);
583 } 583 }
584 584
585 Expression* ParserTraits::NewSuperPropertyReference(AstNodeFactory* factory, 585 Expression* ParserTraits::NewSuperPropertyReference(AstNodeFactory* factory,
586 int pos) const { 586 int pos) {
587 // this_function[home_object_symbol] 587 // this_function[home_object_symbol]
588 VariableProxy* this_function_proxy = parser_->NewUnresolved( 588 VariableProxy* this_function_proxy = parser_->NewUnresolved(
589 parser_->ast_value_factory()->this_function_string(), pos); 589 parser_->ast_value_factory()->this_function_string(), pos);
590 Expression* home_object_symbol_literal = 590 Expression* home_object_symbol_literal =
591 factory->NewSymbolLiteral("home_object_symbol", kNoSourcePosition); 591 factory->NewSymbolLiteral("home_object_symbol", kNoSourcePosition);
592 Expression* home_object = factory->NewProperty( 592 Expression* home_object = factory->NewProperty(
593 this_function_proxy, home_object_symbol_literal, pos); 593 this_function_proxy, home_object_symbol_literal, pos);
594 return factory->NewSuperPropertyReference( 594 return factory->NewSuperPropertyReference(
595 ThisExpression(pos)->AsVariableProxy(), home_object, pos); 595 ThisExpression(pos)->AsVariableProxy(), home_object, pos);
596 } 596 }
597 597
598 Expression* ParserTraits::NewSuperCallReference(AstNodeFactory* factory, 598 Expression* ParserTraits::NewSuperCallReference(AstNodeFactory* factory,
599 int pos) const { 599 int pos) {
600 VariableProxy* new_target_proxy = parser_->NewUnresolved( 600 VariableProxy* new_target_proxy = parser_->NewUnresolved(
601 parser_->ast_value_factory()->new_target_string(), pos); 601 parser_->ast_value_factory()->new_target_string(), pos);
602 VariableProxy* this_function_proxy = parser_->NewUnresolved( 602 VariableProxy* this_function_proxy = parser_->NewUnresolved(
603 parser_->ast_value_factory()->this_function_string(), pos); 603 parser_->ast_value_factory()->this_function_string(), pos);
604 return factory->NewSuperCallReference(ThisExpression(pos)->AsVariableProxy(), 604 return factory->NewSuperCallReference(ThisExpression(pos)->AsVariableProxy(),
605 new_target_proxy, this_function_proxy, 605 new_target_proxy, this_function_proxy,
606 pos); 606 pos);
607 } 607 }
608 608
609 Expression* ParserTraits::NewTargetExpression(int pos) const { 609 Expression* ParserTraits::NewTargetExpression(int pos) {
610 static const int kNewTargetStringLength = 10; 610 static const int kNewTargetStringLength = 10;
611 auto proxy = 611 auto proxy =
612 parser_->NewUnresolved(parser_->ast_value_factory()->new_target_string(), 612 parser_->NewUnresolved(parser_->ast_value_factory()->new_target_string(),
613 pos, pos + kNewTargetStringLength); 613 pos, pos + kNewTargetStringLength);
614 proxy->set_is_new_target(); 614 proxy->set_is_new_target();
615 return proxy; 615 return proxy;
616 } 616 }
617 617
618 Expression* ParserTraits::FunctionSentExpression(AstNodeFactory* factory, 618 Expression* ParserTraits::FunctionSentExpression(AstNodeFactory* factory,
619 int pos) const { 619 int pos) const {
(...skipping 29 matching lines...) Expand all
649 } 649 }
650 default: 650 default:
651 DCHECK(false); 651 DCHECK(false);
652 } 652 }
653 return NULL; 653 return NULL;
654 } 654 }
655 655
656 Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name, 656 Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name,
657 int start_position, 657 int start_position,
658 int end_position, 658 int end_position,
659 InferName infer) const { 659 InferName infer) {
660 if (infer == InferName::kYes && parser_->fni_ != NULL) { 660 if (infer == InferName::kYes && parser_->fni_ != NULL) {
661 parser_->fni_->PushVariableName(name); 661 parser_->fni_->PushVariableName(name);
662 } 662 }
663 return parser_->NewUnresolved(name, start_position, end_position); 663 return parser_->NewUnresolved(name, start_position, end_position);
664 } 664 }
665 665
666 666
667 Expression* ParserTraits::ExpressionFromString(int pos, Scanner* scanner, 667 Expression* ParserTraits::ExpressionFromString(int pos, Scanner* scanner,
668 AstNodeFactory* factory) const { 668 AstNodeFactory* factory) const {
669 const AstRawString* symbol = GetSymbol(scanner); 669 const AstRawString* symbol = GetSymbol(scanner);
(...skipping 6247 matching lines...) Expand 10 before | Expand all | Expand 10 after
6917 node->Print(Isolate::Current()); 6917 node->Print(Isolate::Current());
6918 } 6918 }
6919 #endif // DEBUG 6919 #endif // DEBUG
6920 6920
6921 #undef CHECK_OK 6921 #undef CHECK_OK
6922 #undef CHECK_OK_VOID 6922 #undef CHECK_OK_VOID
6923 #undef CHECK_FAILED 6923 #undef CHECK_FAILED
6924 6924
6925 } // namespace internal 6925 } // namespace internal
6926 } // namespace v8 6926 } // 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