| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 Expect(Token::RPAREN, CHECK_OK); | 224 Expect(Token::RPAREN, CHECK_OK); |
| 225 int formals_end_position = scanner()->location().end_pos; | 225 int formals_end_position = scanner()->location().end_pos; |
| 226 | 226 |
| 227 CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, | 227 CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, |
| 228 formals_end_position, CHECK_OK); | 228 formals_end_position, CHECK_OK); |
| 229 | 229 |
| 230 Expect(Token::LBRACE, CHECK_OK); | 230 Expect(Token::LBRACE, CHECK_OK); |
| 231 | 231 |
| 232 // Parse function body. | 232 // Parse function body. |
| 233 PreParserStatementList body; | 233 PreParserStatementList body; |
| 234 BlockT parameter_init_block = NullBlock(); |
| 234 int pos = function_token_pos == kNoSourcePosition ? peek_position() | 235 int pos = function_token_pos == kNoSourcePosition ? peek_position() |
| 235 : function_token_pos; | 236 : function_token_pos; |
| 236 ParseFunctionBody(body, function_name, pos, formals, kind, function_type, | 237 ParseFunctionBody(body, ¶meter_init_block, function_name, pos, formals, |
| 237 CHECK_OK); | 238 kind, function_type, CHECK_OK); |
| 238 | 239 |
| 239 // Parsing the body may change the language mode in our scope. | 240 // Parsing the body may change the language mode in our scope. |
| 240 language_mode = function_scope->language_mode(); | 241 language_mode = function_scope->language_mode(); |
| 241 | 242 |
| 242 if (is_sloppy(language_mode)) { | 243 if (is_sloppy(language_mode)) { |
| 243 function_scope->HoistSloppyBlockFunctions(nullptr); | 244 function_scope->HoistSloppyBlockFunctions(nullptr); |
| 244 } | 245 } |
| 245 | 246 |
| 246 // Validate name and parameter names. We can do this only after parsing the | 247 // Validate name and parameter names. We can do this only after parsing the |
| 247 // function, since the function can declare itself strict. | 248 // function, since the function can declare itself strict. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 319 } |
| 319 } | 320 } |
| 320 } | 321 } |
| 321 | 322 |
| 322 #undef CHECK_OK | 323 #undef CHECK_OK |
| 323 #undef CHECK_OK_CUSTOM | 324 #undef CHECK_OK_CUSTOM |
| 324 | 325 |
| 325 | 326 |
| 326 } // namespace internal | 327 } // namespace internal |
| 327 } // namespace v8 | 328 } // namespace v8 |
| OLD | NEW |