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

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

Issue 2578103002: [parsing] Be less pessimistic about maybe_assigned of parameters. (Closed)
Patch Set: Remove unused var. 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/ast/scopes.cc ('k') | test/cctest/test-parsing.cc » ('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_H_ 5 #ifndef V8_PARSING_PARSER_H_
6 #define V8_PARSING_PARSER_H_ 6 #define V8_PARSING_PARSER_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/base/compiler-specific.h" 10 #include "src/base/compiler-specific.h"
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 const ThreadedList<ParserFormalParameters::Parameter>& parameters) { 1059 const ThreadedList<ParserFormalParameters::Parameter>& parameters) {
1060 for (auto parameter : parameters) { 1060 for (auto parameter : parameters) {
1061 bool is_duplicate = false; 1061 bool is_duplicate = false;
1062 bool is_simple = classifier()->is_simple_parameter_list(); 1062 bool is_simple = classifier()->is_simple_parameter_list();
1063 auto name = is_simple || parameter->is_rest 1063 auto name = is_simple || parameter->is_rest
1064 ? parameter->name 1064 ? parameter->name
1065 : ast_value_factory()->empty_string(); 1065 : ast_value_factory()->empty_string();
1066 auto mode = is_simple || parameter->is_rest ? VAR : TEMPORARY; 1066 auto mode = is_simple || parameter->is_rest ? VAR : TEMPORARY;
1067 if (!is_simple) scope->SetHasNonSimpleParameters(); 1067 if (!is_simple) scope->SetHasNonSimpleParameters();
1068 bool is_optional = parameter->initializer != nullptr; 1068 bool is_optional = parameter->initializer != nullptr;
1069 Variable* var = 1069 scope->DeclareParameter(name, mode, is_optional, parameter->is_rest,
1070 scope->DeclareParameter(name, mode, is_optional, parameter->is_rest, 1070 &is_duplicate, ast_value_factory());
1071 &is_duplicate, ast_value_factory());
1072 if (is_duplicate && 1071 if (is_duplicate &&
1073 classifier()->is_valid_formal_parameter_list_without_duplicates()) { 1072 classifier()->is_valid_formal_parameter_list_without_duplicates()) {
1074 classifier()->RecordDuplicateFormalParameterError( 1073 classifier()->RecordDuplicateFormalParameterError(
1075 scanner()->location()); 1074 scanner()->location());
1076 } 1075 }
1077 if (is_sloppy(scope->language_mode())) {
1078 // TODO(sigurds) Mark every parameter as maybe assigned. This is a
1079 // conservative approximation necessary to account for parameters
1080 // that are assigned via the arguments array.
1081 var->set_maybe_assigned();
1082 }
1083 } 1076 }
1084 } 1077 }
1085 1078
1086 void DeclareArrowFunctionFormalParameters(ParserFormalParameters* parameters, 1079 void DeclareArrowFunctionFormalParameters(ParserFormalParameters* parameters,
1087 Expression* params, 1080 Expression* params,
1088 const Scanner::Location& params_loc, 1081 const Scanner::Location& params_loc,
1089 Scanner::Location* duplicate_loc, 1082 Scanner::Location* duplicate_loc,
1090 bool* ok); 1083 bool* ok);
1091 1084
1092 void ReindexLiterals(const ParserFormalParameters& parameters); 1085 void ReindexLiterals(const ParserFormalParameters& parameters);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 1181
1189 private: 1182 private:
1190 ParserTarget** variable_; 1183 ParserTarget** variable_;
1191 ParserTarget* previous_; 1184 ParserTarget* previous_;
1192 }; 1185 };
1193 1186
1194 } // namespace internal 1187 } // namespace internal
1195 } // namespace v8 1188 } // namespace v8
1196 1189
1197 #endif // V8_PARSING_PARSER_H_ 1190 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698