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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Do nothing, as we've just aborted scanning this function. | 127 // Do nothing, as we've just aborted scanning this function. |
128 } else if (stack_overflow()) { | 128 } else if (stack_overflow()) { |
129 return kPreParseStackOverflow; | 129 return kPreParseStackOverflow; |
130 } else if (!ok) { | 130 } else if (!ok) { |
131 ReportUnexpectedToken(scanner()->current_token()); | 131 ReportUnexpectedToken(scanner()->current_token()); |
132 } else { | 132 } else { |
133 DCHECK_EQ(Token::RBRACE, scanner()->peek()); | 133 DCHECK_EQ(Token::RBRACE, scanner()->peek()); |
134 if (is_strict(scope_->language_mode())) { | 134 if (is_strict(scope_->language_mode())) { |
135 int end_pos = scanner()->location().end_pos; | 135 int end_pos = scanner()->location().end_pos; |
136 CheckStrictOctalLiteral(start_position, end_pos, &ok); | 136 CheckStrictOctalLiteral(start_position, end_pos, &ok); |
137 CheckDecimalLiteralWithLeadingZero(use_counts, start_position, end_pos); | |
138 if (!ok) return kPreParseSuccess; | 137 if (!ok) return kPreParseSuccess; |
139 } | 138 } |
140 } | 139 } |
141 return kPreParseSuccess; | 140 return kPreParseSuccess; |
142 } | 141 } |
143 | 142 |
144 PreParserExpression PreParserTraits::ParseClassLiteral( | 143 PreParserExpression PreParserTraits::ParseClassLiteral( |
145 Type::ExpressionClassifier* classifier, PreParserIdentifier name, | 144 Type::ExpressionClassifier* classifier, PreParserIdentifier name, |
146 Scanner::Location class_name_location, bool name_is_strict_reserved, | 145 Scanner::Location class_name_location, bool name_is_strict_reserved, |
147 int pos, bool* ok) { | 146 int pos, bool* ok) { |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 CheckFunctionName(language_mode, function_name, function_name_validity, | 1099 CheckFunctionName(language_mode, function_name, function_name_validity, |
1101 function_name_location, CHECK_OK); | 1100 function_name_location, CHECK_OK); |
1102 const bool allow_duplicate_parameters = | 1101 const bool allow_duplicate_parameters = |
1103 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); | 1102 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); |
1104 ValidateFormalParameters(&formals_classifier, language_mode, | 1103 ValidateFormalParameters(&formals_classifier, language_mode, |
1105 allow_duplicate_parameters, CHECK_OK); | 1104 allow_duplicate_parameters, CHECK_OK); |
1106 | 1105 |
1107 if (is_strict(language_mode)) { | 1106 if (is_strict(language_mode)) { |
1108 int end_position = scanner()->location().end_pos; | 1107 int end_position = scanner()->location().end_pos; |
1109 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK); | 1108 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK); |
1110 CheckDecimalLiteralWithLeadingZero(use_counts_, start_position, | |
1111 end_position); | |
1112 } | 1109 } |
1113 | 1110 |
1114 return Expression::Default(); | 1111 return Expression::Default(); |
1115 } | 1112 } |
1116 | 1113 |
1117 | 1114 |
1118 void PreParser::ParseLazyFunctionLiteralBody(bool* ok, | 1115 void PreParser::ParseLazyFunctionLiteralBody(bool* ok, |
1119 Scanner::BookmarkScope* bookmark) { | 1116 Scanner::BookmarkScope* bookmark) { |
1120 int body_start = position(); | 1117 int body_start = position(); |
1121 ParseStatementList(Token::RBRACE, ok, bookmark); | 1118 ParseStatementList(Token::RBRACE, ok, bookmark); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 } | 1224 } |
1228 Expect(Token::RBRACE, CHECK_OK); | 1225 Expect(Token::RBRACE, CHECK_OK); |
1229 return PreParserExpression::Default(); | 1226 return PreParserExpression::Default(); |
1230 } | 1227 } |
1231 | 1228 |
1232 #undef CHECK_OK | 1229 #undef CHECK_OK |
1233 | 1230 |
1234 | 1231 |
1235 } // namespace internal | 1232 } // namespace internal |
1236 } // namespace v8 | 1233 } // namespace v8 |
OLD | NEW |