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); | |
1012 } | 1010 } |
1013 if (materialized_literals) { | 1011 if (materialized_literals) { |
1014 *materialized_literals = function_state_->materialized_literal_count(); | 1012 *materialized_literals = function_state_->materialized_literal_count(); |
1015 } | 1013 } |
1016 return kPreParseSuccess; | 1014 return kPreParseSuccess; |
1017 } | 1015 } |
1018 | 1016 |
1019 // Parses a single function literal, from the opening parentheses before | 1017 // Parses a single function literal, from the opening parentheses before |
1020 // parameters to the closing brace after the body. | 1018 // parameters to the closing brace after the body. |
1021 // Returns a FunctionEntry describing the body of the function in enough | 1019 // Returns a FunctionEntry describing the body of the function in enough |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 const PreParserFormalParameters& parameters, FunctionKind kind, | 1200 const PreParserFormalParameters& parameters, FunctionKind kind, |
1203 FunctionLiteral::FunctionType function_type, bool* ok) { | 1201 FunctionLiteral::FunctionType function_type, bool* ok) { |
1204 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, | 1202 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, |
1205 kind, function_type, ok); | 1203 kind, function_type, ok); |
1206 } | 1204 } |
1207 | 1205 |
1208 } // namespace internal | 1206 } // namespace internal |
1209 } // namespace v8 | 1207 } // namespace v8 |
1210 | 1208 |
1211 #endif // V8_PARSING_PREPARSER_H | 1209 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |