| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 383 } |
| 384 | 384 |
| 385 | 385 |
| 386 PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(bool* ok) { | 386 PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(bool* ok) { |
| 387 // ExpressionStatement | LabelledStatement :: | 387 // ExpressionStatement | LabelledStatement :: |
| 388 // Expression ';' | 388 // Expression ';' |
| 389 // Identifier ':' Statement | 389 // Identifier ':' Statement |
| 390 | 390 |
| 391 Expression expr = ParseExpression(true, CHECK_OK); | 391 Expression expr = ParseExpression(true, CHECK_OK); |
| 392 if (expr.IsRawIdentifier()) { | 392 if (expr.IsRawIdentifier()) { |
| 393 if (peek() == i::Token::COLON && | 393 ASSERT(!expr.AsIdentifier().IsFutureReserved()); |
| 394 (!strict_mode() || !expr.AsIdentifier().IsFutureReserved())) { | 394 ASSERT(!strict_mode() || !expr.AsIdentifier().IsFutureStrictReserved()); |
| 395 if (peek() == i::Token::COLON) { |
| 395 Consume(i::Token::COLON); | 396 Consume(i::Token::COLON); |
| 396 return ParseStatement(ok); | 397 return ParseStatement(ok); |
| 397 } | 398 } |
| 398 // Preparsing is disabled for extensions (because the extension details | 399 // Preparsing is disabled for extensions (because the extension details |
| 399 // aren't passed to lazily compiled functions), so we don't | 400 // aren't passed to lazily compiled functions), so we don't |
| 400 // accept "native function" in the preparser. | 401 // accept "native function" in the preparser. |
| 401 } | 402 } |
| 402 // Parsed expression statement. | 403 // Parsed expression statement. |
| 403 ExpectSemicolon(CHECK_OK); | 404 ExpectSemicolon(CHECK_OK); |
| 404 return Statement::ExpressionStatement(expr); | 405 return Statement::ExpressionStatement(expr); |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 | 1430 |
| 1430 | 1431 |
| 1431 PreParser::Identifier PreParser::ParseIdentifier(bool* ok) { | 1432 PreParser::Identifier PreParser::ParseIdentifier(bool* ok) { |
| 1432 i::Token::Value next = Next(); | 1433 i::Token::Value next = Next(); |
| 1433 switch (next) { | 1434 switch (next) { |
| 1434 case i::Token::FUTURE_RESERVED_WORD: { | 1435 case i::Token::FUTURE_RESERVED_WORD: { |
| 1435 i::Scanner::Location location = scanner_->location(); | 1436 i::Scanner::Location location = scanner_->location(); |
| 1436 ReportMessageAt(location.beg_pos, location.end_pos, | 1437 ReportMessageAt(location.beg_pos, location.end_pos, |
| 1437 "reserved_word", NULL); | 1438 "reserved_word", NULL); |
| 1438 *ok = false; | 1439 *ok = false; |
| 1440 return GetIdentifierSymbol(); |
| 1439 } | 1441 } |
| 1442 case i::Token::FUTURE_STRICT_RESERVED_WORD: |
| 1443 if (strict_mode()) { |
| 1444 i::Scanner::Location location = scanner_->location(); |
| 1445 ReportMessageAt(location.beg_pos, location.end_pos, |
| 1446 "strict_reserved_word", NULL); |
| 1447 *ok = false; |
| 1448 } |
| 1440 // FALLTHROUGH | 1449 // FALLTHROUGH |
| 1441 case i::Token::FUTURE_STRICT_RESERVED_WORD: | |
| 1442 case i::Token::IDENTIFIER: | 1450 case i::Token::IDENTIFIER: |
| 1443 return GetIdentifierSymbol(); | 1451 return GetIdentifierSymbol(); |
| 1444 default: | 1452 default: |
| 1445 *ok = false; | 1453 *ok = false; |
| 1446 return Identifier::Default(); | 1454 return Identifier::Default(); |
| 1447 } | 1455 } |
| 1448 } | 1456 } |
| 1449 | 1457 |
| 1450 | 1458 |
| 1451 void PreParser::SetStrictModeViolation(i::Scanner::Location location, | 1459 void PreParser::SetStrictModeViolation(i::Scanner::Location location, |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); | 1680 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); |
| 1673 } | 1681 } |
| 1674 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); | 1682 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); |
| 1675 } | 1683 } |
| 1676 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); | 1684 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); |
| 1677 | 1685 |
| 1678 backing_store_.AddBlock(bytes); | 1686 backing_store_.AddBlock(bytes); |
| 1679 return backing_store_.EndSequence().start(); | 1687 return backing_store_.EndSequence().start(); |
| 1680 } | 1688 } |
| 1681 } } // v8::preparser | 1689 } } // v8::preparser |
| OLD | NEW |