OLD | NEW |
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/char-predicates-inl.h" | 10 #include "src/char-predicates-inl.h" |
(...skipping 3488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 SkipLazyFunctionBody(function_name, &materialized_literal_count, | 3499 SkipLazyFunctionBody(function_name, &materialized_literal_count, |
3500 &expected_property_count, CHECK_OK); | 3500 &expected_property_count, CHECK_OK); |
3501 } else { | 3501 } else { |
3502 body = ParseEagerFunctionBody(function_name, pos, fvar, fvar_init_op, | 3502 body = ParseEagerFunctionBody(function_name, pos, fvar, fvar_init_op, |
3503 is_generator, CHECK_OK); | 3503 is_generator, CHECK_OK); |
3504 materialized_literal_count = function_state.materialized_literal_count(); | 3504 materialized_literal_count = function_state.materialized_literal_count(); |
3505 expected_property_count = function_state.expected_property_count(); | 3505 expected_property_count = function_state.expected_property_count(); |
3506 handler_count = function_state.handler_count(); | 3506 handler_count = function_state.handler_count(); |
3507 } | 3507 } |
3508 | 3508 |
3509 // Validate strict mode. We can do this only after parsing the function, | 3509 // Validate strict mode. |
3510 // since the function can declare itself strict. | |
3511 if (strict_mode() == STRICT) { | 3510 if (strict_mode() == STRICT) { |
3512 if (IsEvalOrArguments(function_name)) { | 3511 CheckStrictFunctionNameAndParameters(function_name, |
3513 ReportMessageAt(function_name_location, "strict_eval_arguments"); | 3512 name_is_strict_reserved, |
3514 *ok = false; | 3513 function_name_location, |
3515 return NULL; | 3514 eval_args_error_log, |
3516 } | 3515 dupe_error_loc, |
3517 if (name_is_strict_reserved) { | 3516 reserved_loc, |
3518 ReportMessageAt(function_name_location, "unexpected_strict_reserved"); | 3517 CHECK_OK); |
3519 *ok = false; | |
3520 return NULL; | |
3521 } | |
3522 if (eval_args_error_log.IsValid()) { | |
3523 ReportMessageAt(eval_args_error_log, "strict_eval_arguments"); | |
3524 *ok = false; | |
3525 return NULL; | |
3526 } | |
3527 if (dupe_error_loc.IsValid()) { | |
3528 ReportMessageAt(dupe_error_loc, "strict_param_dupe"); | |
3529 *ok = false; | |
3530 return NULL; | |
3531 } | |
3532 if (reserved_loc.IsValid()) { | |
3533 ReportMessageAt(reserved_loc, "unexpected_strict_reserved"); | |
3534 *ok = false; | |
3535 return NULL; | |
3536 } | |
3537 CheckOctalLiteral(scope->start_position(), | 3518 CheckOctalLiteral(scope->start_position(), |
3538 scope->end_position(), | 3519 scope->end_position(), |
3539 CHECK_OK); | 3520 CHECK_OK); |
3540 } | 3521 } |
3541 ast_properties = *factory()->visitor()->ast_properties(); | 3522 ast_properties = *factory()->visitor()->ast_properties(); |
3542 dont_optimize_reason = factory()->visitor()->dont_optimize_reason(); | 3523 dont_optimize_reason = factory()->visitor()->dont_optimize_reason(); |
3543 } | 3524 } |
3544 | 3525 |
3545 if (allow_harmony_scoping() && strict_mode() == STRICT) { | 3526 if (allow_harmony_scoping() && strict_mode() == STRICT) { |
3546 CheckConflictingVarDeclarations(scope, CHECK_OK); | 3527 CheckConflictingVarDeclarations(scope, CHECK_OK); |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4829 } | 4810 } |
4830 info()->SetFunction(result); | 4811 info()->SetFunction(result); |
4831 ast_value_factory_->Internalize(isolate()); | 4812 ast_value_factory_->Internalize(isolate()); |
4832 // info takes ownership of ast_value_factory_. | 4813 // info takes ownership of ast_value_factory_. |
4833 info()->SetAstValueFactory(ast_value_factory_); | 4814 info()->SetAstValueFactory(ast_value_factory_); |
4834 ast_value_factory_ = NULL; | 4815 ast_value_factory_ = NULL; |
4835 return (result != NULL); | 4816 return (result != NULL); |
4836 } | 4817 } |
4837 | 4818 |
4838 } } // namespace v8::internal | 4819 } } // namespace v8::internal |
OLD | NEW |