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 #ifndef V8_PARSING_PREPARSER_H | 5 #ifndef V8_PARSING_PREPARSER_H |
6 #define V8_PARSING_PREPARSER_H | 6 #define V8_PARSING_PREPARSER_H |
7 | 7 |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 bool ok = true; | 1000 bool ok = true; |
1001 int start_position = scanner()->peek_location().beg_pos; | 1001 int start_position = scanner()->peek_location().beg_pos; |
1002 parsing_module_ = is_module; | 1002 parsing_module_ = is_module; |
1003 ParseStatementList(Token::EOS, &ok); | 1003 ParseStatementList(Token::EOS, &ok); |
1004 if (stack_overflow()) return kPreParseStackOverflow; | 1004 if (stack_overflow()) return kPreParseStackOverflow; |
1005 if (!ok) { | 1005 if (!ok) { |
1006 ReportUnexpectedToken(scanner()->current_token()); | 1006 ReportUnexpectedToken(scanner()->current_token()); |
1007 } else if (is_strict(scope_->language_mode())) { | 1007 } else if (is_strict(scope_->language_mode())) { |
1008 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos, | 1008 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos, |
1009 &ok); | 1009 &ok); |
| 1010 CheckDecimalLiteralWithLeadingZero(use_counts_, start_position, |
| 1011 scanner()->location().end_pos); |
1010 } | 1012 } |
1011 if (materialized_literals) { | 1013 if (materialized_literals) { |
1012 *materialized_literals = function_state_->materialized_literal_count(); | 1014 *materialized_literals = function_state_->materialized_literal_count(); |
1013 } | 1015 } |
1014 return kPreParseSuccess; | 1016 return kPreParseSuccess; |
1015 } | 1017 } |
1016 | 1018 |
1017 // Parses a single function literal, from the opening parentheses before | 1019 // Parses a single function literal, from the opening parentheses before |
1018 // parameters to the closing brace after the body. | 1020 // parameters to the closing brace after the body. |
1019 // Returns a FunctionEntry describing the body of the function in enough | 1021 // Returns a FunctionEntry describing the body of the function in enough |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 const PreParserFormalParameters& parameters, FunctionKind kind, | 1202 const PreParserFormalParameters& parameters, FunctionKind kind, |
1201 FunctionLiteral::FunctionType function_type, bool* ok) { | 1203 FunctionLiteral::FunctionType function_type, bool* ok) { |
1202 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, | 1204 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, |
1203 kind, function_type, ok); | 1205 kind, function_type, ok); |
1204 } | 1206 } |
1205 | 1207 |
1206 } // namespace internal | 1208 } // namespace internal |
1207 } // namespace v8 | 1209 } // namespace v8 |
1208 | 1210 |
1209 #endif // V8_PARSING_PREPARSER_H | 1211 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |