| 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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
| 6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2490 // '-' UnaryExpression | 2490 // '-' UnaryExpression |
| 2491 // '~' UnaryExpression | 2491 // '~' UnaryExpression |
| 2492 // '!' UnaryExpression | 2492 // '!' UnaryExpression |
| 2493 | 2493 |
| 2494 Token::Value op = peek(); | 2494 Token::Value op = peek(); |
| 2495 if (Token::IsUnaryOp(op)) { | 2495 if (Token::IsUnaryOp(op)) { |
| 2496 op = Next(); | 2496 op = Next(); |
| 2497 int pos = position(); | 2497 int pos = position(); |
| 2498 ExpressionT expression = ParseUnaryExpression(CHECK_OK); | 2498 ExpressionT expression = ParseUnaryExpression(CHECK_OK); |
| 2499 | 2499 |
| 2500 // "delete identifier" is a syntax error in strict mode. | 2500 if (op == Token::DELETE && is_strict(language_mode())) { |
| 2501 if (op == Token::DELETE && is_strict(language_mode()) && | 2501 if (is_strong(language_mode())) { |
| 2502 this->IsIdentifier(expression)) { | 2502 ReportMessage("strong_delete"); |
| 2503 ReportMessage("strict_delete"); | 2503 *ok = false; |
| 2504 *ok = false; | 2504 return this->EmptyExpression(); |
| 2505 return this->EmptyExpression(); | 2505 } else if (this->IsIdentifier(expression)) { |
| 2506 // "delete identifier" is a syntax error in strict mode. |
| 2507 ReportMessage("strict_delete"); |
| 2508 *ok = false; |
| 2509 return this->EmptyExpression(); |
| 2510 } |
| 2506 } | 2511 } |
| 2507 | 2512 |
| 2508 // Allow Traits do rewrite the expression. | 2513 // Allow Traits do rewrite the expression. |
| 2509 return this->BuildUnaryExpression(expression, op, pos, factory()); | 2514 return this->BuildUnaryExpression(expression, op, pos, factory()); |
| 2510 } else if (Token::IsCountOp(op)) { | 2515 } else if (Token::IsCountOp(op)) { |
| 2511 op = Next(); | 2516 op = Next(); |
| 2512 Scanner::Location lhs_location = scanner()->peek_location(); | 2517 Scanner::Location lhs_location = scanner()->peek_location(); |
| 2513 ExpressionT expression = this->ParseUnaryExpression(CHECK_OK); | 2518 ExpressionT expression = this->ParseUnaryExpression(CHECK_OK); |
| 2514 expression = this->CheckAndRewriteReferenceExpression( | 2519 expression = this->CheckAndRewriteReferenceExpression( |
| 2515 expression, lhs_location, "invalid_lhs_in_prefix_op", CHECK_OK); | 2520 expression, lhs_location, "invalid_lhs_in_prefix_op", CHECK_OK); |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3076 *ok = false; | 3081 *ok = false; |
| 3077 return; | 3082 return; |
| 3078 } | 3083 } |
| 3079 has_seen_constructor_ = true; | 3084 has_seen_constructor_ = true; |
| 3080 return; | 3085 return; |
| 3081 } | 3086 } |
| 3082 } | 3087 } |
| 3083 } } // v8::internal | 3088 } } // v8::internal |
| 3084 | 3089 |
| 3085 #endif // V8_PREPARSER_H | 3090 #endif // V8_PREPARSER_H |
| OLD | NEW |