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

Side by Side Diff: src/preparser.h

Issue 1468143004: [es6] Self-assignment in a default parameter initializer should throw (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Change less behavior, add TODO Created 5 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/parser.cc ('k') | test/message/default-parameter-tdz.js » ('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_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/bailout-reason.h" 8 #include "src/bailout-reason.h"
9 #include "src/expression-classifier.h" 9 #include "src/expression-classifier.h"
10 #include "src/func-name-inferrer.h" 10 #include "src/func-name-inferrer.h"
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 return EmptyExpression(); 1701 return EmptyExpression();
1702 } 1702 }
1703 inline void MaterializeTemplateCallsiteLiterals(); 1703 inline void MaterializeTemplateCallsiteLiterals();
1704 PreParserExpression NoTemplateTag() { 1704 PreParserExpression NoTemplateTag() {
1705 return PreParserExpression::NoTemplateTag(); 1705 return PreParserExpression::NoTemplateTag();
1706 } 1706 }
1707 static bool IsTaggedTemplate(const PreParserExpression tag) { 1707 static bool IsTaggedTemplate(const PreParserExpression tag) {
1708 return !tag.IsNoTemplateTag(); 1708 return !tag.IsNoTemplateTag();
1709 } 1709 }
1710 1710
1711 void AddFormalParameter( 1711 void AddFormalParameter(PreParserFormalParameters* parameters,
1712 PreParserFormalParameters* parameters, PreParserExpression pattern, 1712 PreParserExpression pattern,
1713 PreParserExpression initializer, bool is_rest) { 1713 PreParserExpression initializer,
1714 int initializer_end_position, bool is_rest) {
1714 ++parameters->arity; 1715 ++parameters->arity;
1715 } 1716 }
1716 void DeclareFormalParameter(Scope* scope, PreParserIdentifier parameter, 1717 void DeclareFormalParameter(Scope* scope, PreParserIdentifier parameter,
1717 ExpressionClassifier* classifier) { 1718 ExpressionClassifier* classifier) {
1718 if (!classifier->is_simple_parameter_list()) { 1719 if (!classifier->is_simple_parameter_list()) {
1719 scope->SetHasNonSimpleParameters(); 1720 scope->SetHasNonSimpleParameters();
1720 } 1721 }
1721 } 1722 }
1722 1723
1723 void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} 1724 void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {}
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3830 ExpressionClassifier init_classifier; 3831 ExpressionClassifier init_classifier;
3831 initializer = ParseAssignmentExpression(true, &init_classifier, ok); 3832 initializer = ParseAssignmentExpression(true, &init_classifier, ok);
3832 if (!*ok) return; 3833 if (!*ok) return;
3833 ValidateExpression(&init_classifier, ok); 3834 ValidateExpression(&init_classifier, ok);
3834 ValidateFormalParameterInitializer(&init_classifier, ok); 3835 ValidateFormalParameterInitializer(&init_classifier, ok);
3835 if (!*ok) return; 3836 if (!*ok) return;
3836 parameters->is_simple = false; 3837 parameters->is_simple = false;
3837 classifier->RecordNonSimpleParameter(); 3838 classifier->RecordNonSimpleParameter();
3838 } 3839 }
3839 3840
3840 Traits::AddFormalParameter(parameters, pattern, initializer, is_rest); 3841 Traits::AddFormalParameter(parameters, pattern, initializer,
3842 scanner()->location().end_pos, is_rest);
3841 } 3843 }
3842 3844
3843 3845
3844 template <class Traits> 3846 template <class Traits>
3845 void ParserBase<Traits>::ParseFormalParameterList( 3847 void ParserBase<Traits>::ParseFormalParameterList(
3846 FormalParametersT* parameters, ExpressionClassifier* classifier, bool* ok) { 3848 FormalParametersT* parameters, ExpressionClassifier* classifier, bool* ok) {
3847 // FormalParameters[Yield,GeneratorParameter] : 3849 // FormalParameters[Yield,GeneratorParameter] :
3848 // [empty] 3850 // [empty]
3849 // FormalParameterList[?Yield, ?GeneratorParameter] 3851 // FormalParameterList[?Yield, ?GeneratorParameter]
3850 // 3852 //
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
4250 return; 4252 return;
4251 } 4253 }
4252 has_seen_constructor_ = true; 4254 has_seen_constructor_ = true;
4253 return; 4255 return;
4254 } 4256 }
4255 } 4257 }
4256 } // namespace internal 4258 } // namespace internal
4257 } // namespace v8 4259 } // namespace v8
4258 4260
4259 #endif // V8_PREPARSER_H 4261 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | test/message/default-parameter-tdz.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698