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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-rewriter.h" | 9 #include "src/ast/ast-expression-rewriter.h" |
10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 scope_->SetLanguageMode(info->language_mode()); | 936 scope_->SetLanguageMode(info->language_mode()); |
937 ParseStatementList(body, Token::EOS, &ok); | 937 ParseStatementList(body, Token::EOS, &ok); |
938 } | 938 } |
939 | 939 |
940 // The parser will peek but not consume EOS. Our scope logically goes all | 940 // The parser will peek but not consume EOS. Our scope logically goes all |
941 // the way to the EOS, though. | 941 // the way to the EOS, though. |
942 scope->set_end_position(scanner()->peek_location().beg_pos); | 942 scope->set_end_position(scanner()->peek_location().beg_pos); |
943 | 943 |
944 if (ok && is_strict(language_mode())) { | 944 if (ok && is_strict(language_mode())) { |
945 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); | 945 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); |
946 CheckDecimalLiteralWithLeadingZero(use_counts_, beg_pos, | |
947 scanner()->location().end_pos); | |
948 } | 946 } |
949 if (ok && is_sloppy(language_mode())) { | 947 if (ok && is_sloppy(language_mode())) { |
950 // TODO(littledan): Function bindings on the global object that modify | 948 // TODO(littledan): Function bindings on the global object that modify |
951 // pre-existing bindings should be made writable, enumerable and | 949 // pre-existing bindings should be made writable, enumerable and |
952 // nonconfigurable if possible, whereas this code will leave attributes | 950 // nonconfigurable if possible, whereas this code will leave attributes |
953 // unchanged if the property already exists. | 951 // unchanged if the property already exists. |
954 InsertSloppyBlockFunctionVarBindings(scope, &ok); | 952 InsertSloppyBlockFunctionVarBindings(scope, &ok); |
955 } | 953 } |
956 if (ok) { | 954 if (ok) { |
957 CheckConflictingVarDeclarations(scope_, &ok); | 955 CheckConflictingVarDeclarations(scope_, &ok); |
(...skipping 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4171 CheckFunctionName(language_mode, function_name, function_name_validity, | 4169 CheckFunctionName(language_mode, function_name, function_name_validity, |
4172 function_name_location, CHECK_OK); | 4170 function_name_location, CHECK_OK); |
4173 const bool allow_duplicate_parameters = | 4171 const bool allow_duplicate_parameters = |
4174 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); | 4172 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); |
4175 ValidateFormalParameters(&formals_classifier, language_mode, | 4173 ValidateFormalParameters(&formals_classifier, language_mode, |
4176 allow_duplicate_parameters, CHECK_OK); | 4174 allow_duplicate_parameters, CHECK_OK); |
4177 | 4175 |
4178 if (is_strict(language_mode)) { | 4176 if (is_strict(language_mode)) { |
4179 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), | 4177 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), |
4180 CHECK_OK); | 4178 CHECK_OK); |
4181 CheckDecimalLiteralWithLeadingZero(use_counts_, scope->start_position(), | |
4182 scope->end_position()); | |
4183 } | 4179 } |
4184 if (is_sloppy(language_mode)) { | 4180 if (is_sloppy(language_mode)) { |
4185 InsertSloppyBlockFunctionVarBindings(scope, CHECK_OK); | 4181 InsertSloppyBlockFunctionVarBindings(scope, CHECK_OK); |
4186 } | 4182 } |
4187 CheckConflictingVarDeclarations(scope, CHECK_OK); | 4183 CheckConflictingVarDeclarations(scope, CHECK_OK); |
4188 | 4184 |
4189 if (body) { | 4185 if (body) { |
4190 // If body can be inspected, rewrite queued destructuring assignments | 4186 // If body can be inspected, rewrite queued destructuring assignments |
4191 ParserTraits::RewriteDestructuringAssignments(); | 4187 ParserTraits::RewriteDestructuringAssignments(); |
4192 } | 4188 } |
(...skipping 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6821 try_block, target); | 6817 try_block, target); |
6822 final_loop = target; | 6818 final_loop = target; |
6823 } | 6819 } |
6824 | 6820 |
6825 return final_loop; | 6821 return final_loop; |
6826 } | 6822 } |
6827 | 6823 |
6828 | 6824 |
6829 } // namespace internal | 6825 } // namespace internal |
6830 } // namespace v8 | 6826 } // namespace v8 |
OLD | NEW |