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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 // ... | 272 // ... |
273 | 273 |
274 if (peek() == Token::SEMICOLON) { | 274 if (peek() == Token::SEMICOLON) { |
275 Next(); | 275 Next(); |
276 return Statement::Default(); | 276 return Statement::Default(); |
277 } | 277 } |
278 return ParseSubStatement(allow_function, ok); | 278 return ParseSubStatement(allow_function, ok); |
279 } | 279 } |
280 | 280 |
281 PreParser::Statement PreParser::ParseScopedStatement(bool legacy, bool* ok) { | 281 PreParser::Statement PreParser::ParseScopedStatement(bool legacy, bool* ok) { |
282 if (is_strict(language_mode()) || peek() != Token::FUNCTION || | 282 if (!(is_strict(language_mode()) || peek() != Token::FUNCTION || |
283 (legacy && allow_harmony_restrictive_declarations())) { | 283 (legacy && allow_harmony_restrictive_declarations()))) { |
284 return ParseSubStatement(kDisallowLabelledFunctionStatement, ok); | |
285 } else { | |
adamk
2016/05/02 21:38:55
Your compiler really can't tell that an unconditio
| |
286 Scope* body_scope = NewScope(scope_, BLOCK_SCOPE); | 284 Scope* body_scope = NewScope(scope_, BLOCK_SCOPE); |
287 BlockState block_state(&scope_, body_scope); | 285 BlockState block_state(&scope_, body_scope); |
288 return ParseFunctionDeclaration(CHECK_OK); | 286 return ParseFunctionDeclaration(CHECK_OK); |
adamk
2016/05/02 22:01:15
If it's only about CHECK_OK, then this can safely
| |
289 } | 287 } |
288 return ParseSubStatement(kDisallowLabelledFunctionStatement, ok); | |
290 } | 289 } |
291 | 290 |
292 PreParser::Statement PreParser::ParseSubStatement( | 291 PreParser::Statement PreParser::ParseSubStatement( |
293 AllowLabelledFunctionStatement allow_function, bool* ok) { | 292 AllowLabelledFunctionStatement allow_function, bool* ok) { |
294 // Statement :: | 293 // Statement :: |
295 // Block | 294 // Block |
296 // VariableStatement | 295 // VariableStatement |
297 // EmptyStatement | 296 // EmptyStatement |
298 // ExpressionStatement | 297 // ExpressionStatement |
299 // IfStatement | 298 // IfStatement |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1223 } | 1222 } |
1224 Expect(Token::RBRACE, CHECK_OK); | 1223 Expect(Token::RBRACE, CHECK_OK); |
1225 return PreParserExpression::Default(); | 1224 return PreParserExpression::Default(); |
1226 } | 1225 } |
1227 | 1226 |
1228 #undef CHECK_OK | 1227 #undef CHECK_OK |
1229 | 1228 |
1230 | 1229 |
1231 } // namespace internal | 1230 } // namespace internal |
1232 } // namespace v8 | 1231 } // namespace v8 |
OLD | NEW |