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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 | 1028 |
1029 // Parse function body. | 1029 // Parse function body. |
1030 bool outer_is_script_scope = scope_->is_script_scope(); | 1030 bool outer_is_script_scope = scope_->is_script_scope(); |
1031 Scope* function_scope = NewScope(scope_, FUNCTION_SCOPE, kind); | 1031 Scope* function_scope = NewScope(scope_, FUNCTION_SCOPE, kind); |
1032 PreParserFactory factory(NULL); | 1032 PreParserFactory factory(NULL); |
1033 FunctionState function_state(&function_state_, &scope_, function_scope, kind, | 1033 FunctionState function_state(&function_state_, &scope_, function_scope, kind, |
1034 &factory); | 1034 &factory); |
1035 ExpressionClassifier formals_classifier; | 1035 ExpressionClassifier formals_classifier; |
1036 | 1036 |
1037 bool has_rest = false; | 1037 bool has_rest = false; |
1038 bool has_parameter_expressions = false; | |
1039 PreParserExpressionList initializers = NewExpressionList(0, zone()); | |
1040 Expect(Token::LPAREN, CHECK_OK); | 1038 Expect(Token::LPAREN, CHECK_OK); |
1041 int start_position = scanner()->location().beg_pos; | 1039 int start_position = scanner()->location().beg_pos; |
1042 function_scope->set_start_position(start_position); | 1040 function_scope->set_start_position(start_position); |
1043 int num_parameters; | 1041 int num_parameters; |
1044 { | 1042 { |
1045 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); | 1043 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); |
1046 num_parameters = ParseFormalParameterList( | 1044 num_parameters = ParseFormalParameterList(&duplicate_finder, &has_rest, |
1047 &duplicate_finder, initializers, &has_parameter_expressions, &has_rest, | 1045 &formals_classifier, CHECK_OK); |
1048 &formals_classifier, CHECK_OK); | |
1049 } | 1046 } |
1050 Expect(Token::RPAREN, CHECK_OK); | 1047 Expect(Token::RPAREN, CHECK_OK); |
1051 int formals_end_position = scanner()->location().end_pos; | 1048 int formals_end_position = scanner()->location().end_pos; |
1052 | 1049 |
1053 CheckArityRestrictions(num_parameters, arity_restriction, has_rest, | 1050 CheckArityRestrictions(num_parameters, arity_restriction, has_rest, |
1054 start_position, formals_end_position, CHECK_OK); | 1051 start_position, formals_end_position, CHECK_OK); |
1055 | 1052 |
1056 // See Parser::ParseFunctionLiteral for more information about lazy parsing | 1053 // See Parser::ParseFunctionLiteral for more information about lazy parsing |
1057 // and lazy compilation. | 1054 // and lazy compilation. |
1058 bool is_lazily_parsed = | 1055 bool is_lazily_parsed = |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 | 1186 |
1190 DCHECK(!spread_pos.IsValid()); | 1187 DCHECK(!spread_pos.IsValid()); |
1191 | 1188 |
1192 return Expression::Default(); | 1189 return Expression::Default(); |
1193 } | 1190 } |
1194 | 1191 |
1195 #undef CHECK_OK | 1192 #undef CHECK_OK |
1196 | 1193 |
1197 | 1194 |
1198 } } // v8::internal | 1195 } } // v8::internal |
OLD | NEW |