OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 <cmath> | 5 #include <cmath> |
6 | 6 |
7 #include "src/allocation.h" | 7 #include "src/allocation.h" |
8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 FunctionLiteral::ArityRestriction arity_restriction, bool* ok) { | 1026 FunctionLiteral::ArityRestriction arity_restriction, bool* ok) { |
1027 // Function :: | 1027 // Function :: |
1028 // '(' FormalParameterList? ')' '{' FunctionBody '}' | 1028 // '(' FormalParameterList? ')' '{' FunctionBody '}' |
1029 | 1029 |
1030 // Parse function body. | 1030 // Parse function body. |
1031 bool outer_is_script_scope = scope_->is_script_scope(); | 1031 bool outer_is_script_scope = scope_->is_script_scope(); |
1032 Scope* function_scope = NewScope(scope_, FUNCTION_SCOPE, kind); | 1032 Scope* function_scope = NewScope(scope_, FUNCTION_SCOPE, kind); |
1033 PreParserFactory factory(NULL); | 1033 PreParserFactory factory(NULL); |
1034 FunctionState function_state(&function_state_, &scope_, function_scope, kind, | 1034 FunctionState function_state(&function_state_, &scope_, function_scope, kind, |
1035 &factory); | 1035 &factory); |
1036 ExpressionClassifier formals_classifier; | 1036 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); |
| 1037 ExpressionClassifier formals_classifier(&duplicate_finder); |
1037 | 1038 |
1038 bool has_rest = false; | 1039 bool has_rest = false; |
1039 Expect(Token::LPAREN, CHECK_OK); | 1040 Expect(Token::LPAREN, CHECK_OK); |
1040 int start_position = scanner()->location().beg_pos; | 1041 int start_position = scanner()->location().beg_pos; |
1041 function_scope->set_start_position(start_position); | 1042 function_scope->set_start_position(start_position); |
1042 int num_parameters; | 1043 int num_parameters = ParseFormalParameterList(nullptr, &has_rest, |
1043 { | 1044 &formals_classifier, CHECK_OK); |
1044 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); | |
1045 num_parameters = ParseFormalParameterList(&duplicate_finder, &has_rest, | |
1046 &formals_classifier, CHECK_OK); | |
1047 } | |
1048 Expect(Token::RPAREN, CHECK_OK); | 1045 Expect(Token::RPAREN, CHECK_OK); |
1049 int formals_end_position = scanner()->location().end_pos; | 1046 int formals_end_position = scanner()->location().end_pos; |
1050 | 1047 |
1051 CheckArityRestrictions(num_parameters, arity_restriction, has_rest, | 1048 CheckArityRestrictions(num_parameters, arity_restriction, has_rest, |
1052 start_position, formals_end_position, CHECK_OK); | 1049 start_position, formals_end_position, CHECK_OK); |
1053 | 1050 |
1054 // See Parser::ParseFunctionLiteral for more information about lazy parsing | 1051 // See Parser::ParseFunctionLiteral for more information about lazy parsing |
1055 // and lazy compilation. | 1052 // and lazy compilation. |
1056 bool is_lazily_parsed = | 1053 bool is_lazily_parsed = |
1057 (outer_is_script_scope && allow_lazy() && !parenthesized_function_); | 1054 (outer_is_script_scope && allow_lazy() && !parenthesized_function_); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 | 1184 |
1188 DCHECK(!spread_pos.IsValid()); | 1185 DCHECK(!spread_pos.IsValid()); |
1189 | 1186 |
1190 return Expression::Default(); | 1187 return Expression::Default(); |
1191 } | 1188 } |
1192 | 1189 |
1193 #undef CHECK_OK | 1190 #undef CHECK_OK |
1194 | 1191 |
1195 | 1192 |
1196 } } // v8::internal | 1193 } } // v8::internal |
OLD | NEW |