OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2512 double value = expression->AsLiteral()->handle()->Number(); | 2512 double value = expression->AsLiteral()->handle()->Number(); |
2513 switch (op) { | 2513 switch (op) { |
2514 case Token::ADD: | 2514 case Token::ADD: |
2515 return expression; | 2515 return expression; |
2516 case Token::SUB: | 2516 case Token::SUB: |
2517 return NewNumberLiteral(-value); | 2517 return NewNumberLiteral(-value); |
2518 case Token::BIT_NOT: | 2518 case Token::BIT_NOT: |
2519 return NewNumberLiteral(~DoubleToInt32(value)); | 2519 return NewNumberLiteral(~DoubleToInt32(value)); |
2520 default: break; | 2520 default: break; |
2521 } | 2521 } |
2522 } | 2522 } |
Martin Maly
2011/02/14 05:15:22
This is contained in the other CL...
| |
2523 | 2523 |
2524 // "delete identifier" is a syntax error in strict mode. | |
2525 if (op == Token::DELETE && temp_scope_->StrictMode()) { | |
2526 VariableProxy* operand = expression->AsVariableProxy(); | |
2527 if (operand != NULL && !operand->is_this()) { | |
2528 ReportMessage("strict_delete", Vector<const char*>::empty()); | |
2529 *ok = false; | |
2530 return NULL; | |
2531 } | |
2532 } | |
2533 | |
2524 return new UnaryOperation(op, expression); | 2534 return new UnaryOperation(op, expression); |
2525 | 2535 |
2526 } else if (Token::IsCountOp(op)) { | 2536 } else if (Token::IsCountOp(op)) { |
2527 op = Next(); | 2537 op = Next(); |
2528 Expression* expression = ParseUnaryExpression(CHECK_OK); | 2538 Expression* expression = ParseUnaryExpression(CHECK_OK); |
2529 // Signal a reference error if the expression is an invalid | 2539 // Signal a reference error if the expression is an invalid |
2530 // left-hand side expression. We could report this as a syntax | 2540 // left-hand side expression. We could report this as a syntax |
2531 // error here but for compatibility with JSC we choose to report the | 2541 // error here but for compatibility with JSC we choose to report the |
2532 // error at runtime. | 2542 // error at runtime. |
2533 if (expression == NULL || !expression->IsValidLeftHandSide()) { | 2543 if (expression == NULL || !expression->IsValidLeftHandSide()) { |
(...skipping 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5102 info->is_global(), | 5112 info->is_global(), |
5103 info->StrictMode()); | 5113 info->StrictMode()); |
5104 } | 5114 } |
5105 } | 5115 } |
5106 | 5116 |
5107 info->SetFunction(result); | 5117 info->SetFunction(result); |
5108 return (result != NULL); | 5118 return (result != NULL); |
5109 } | 5119 } |
5110 | 5120 |
5111 } } // namespace v8::internal | 5121 } } // namespace v8::internal |
OLD | NEW |