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 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 isolate()->factory()->invalid_lhs_in_prefix_op_symbol(); | 2586 isolate()->factory()->invalid_lhs_in_prefix_op_symbol(); |
2587 expression = NewThrowReferenceError(type); | 2587 expression = NewThrowReferenceError(type); |
2588 } | 2588 } |
2589 | 2589 |
2590 if (top_scope_->is_strict_mode()) { | 2590 if (top_scope_->is_strict_mode()) { |
2591 // Prefix expression operand in strict mode may not be eval or arguments. | 2591 // Prefix expression operand in strict mode may not be eval or arguments. |
2592 CheckStrictModeLValue(expression, "strict_lhs_prefix", CHECK_OK); | 2592 CheckStrictModeLValue(expression, "strict_lhs_prefix", CHECK_OK); |
2593 } | 2593 } |
2594 | 2594 |
2595 int position = scanner().location().beg_pos; | 2595 int position = scanner().location().beg_pos; |
2596 IncrementOperation* increment = | 2596 return new(zone()) CountOperation(op, |
2597 new(zone()) IncrementOperation(op, expression); | 2597 true /* prefix */, |
2598 return new(zone()) CountOperation(true /* prefix */, increment, position); | 2598 expression, |
| 2599 position); |
2599 | 2600 |
2600 } else { | 2601 } else { |
2601 return ParsePostfixExpression(ok); | 2602 return ParsePostfixExpression(ok); |
2602 } | 2603 } |
2603 } | 2604 } |
2604 | 2605 |
2605 | 2606 |
2606 Expression* Parser::ParsePostfixExpression(bool* ok) { | 2607 Expression* Parser::ParsePostfixExpression(bool* ok) { |
2607 // PostfixExpression :: | 2608 // PostfixExpression :: |
2608 // LeftHandSideExpression ('++' | '--')? | 2609 // LeftHandSideExpression ('++' | '--')? |
(...skipping 11 matching lines...) Expand all Loading... |
2620 expression = NewThrowReferenceError(type); | 2621 expression = NewThrowReferenceError(type); |
2621 } | 2622 } |
2622 | 2623 |
2623 if (top_scope_->is_strict_mode()) { | 2624 if (top_scope_->is_strict_mode()) { |
2624 // Postfix expression operand in strict mode may not be eval or arguments. | 2625 // Postfix expression operand in strict mode may not be eval or arguments. |
2625 CheckStrictModeLValue(expression, "strict_lhs_prefix", CHECK_OK); | 2626 CheckStrictModeLValue(expression, "strict_lhs_prefix", CHECK_OK); |
2626 } | 2627 } |
2627 | 2628 |
2628 Token::Value next = Next(); | 2629 Token::Value next = Next(); |
2629 int position = scanner().location().beg_pos; | 2630 int position = scanner().location().beg_pos; |
2630 IncrementOperation* increment = | |
2631 new(zone()) IncrementOperation(next, expression); | |
2632 expression = | 2631 expression = |
2633 new(zone()) CountOperation(false /* postfix */, increment, position); | 2632 new(zone()) CountOperation(next, |
| 2633 false /* postfix */, |
| 2634 expression, |
| 2635 position); |
2634 } | 2636 } |
2635 return expression; | 2637 return expression; |
2636 } | 2638 } |
2637 | 2639 |
2638 | 2640 |
2639 Expression* Parser::ParseLeftHandSideExpression(bool* ok) { | 2641 Expression* Parser::ParseLeftHandSideExpression(bool* ok) { |
2640 // LeftHandSideExpression :: | 2642 // LeftHandSideExpression :: |
2641 // (NewExpression | MemberExpression) ... | 2643 // (NewExpression | MemberExpression) ... |
2642 | 2644 |
2643 Expression* result; | 2645 Expression* result; |
(...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5159 info->is_global(), | 5161 info->is_global(), |
5160 info->StrictMode()); | 5162 info->StrictMode()); |
5161 } | 5163 } |
5162 } | 5164 } |
5163 | 5165 |
5164 info->SetFunction(result); | 5166 info->SetFunction(result); |
5165 return (result != NULL); | 5167 return (result != NULL); |
5166 } | 5168 } |
5167 | 5169 |
5168 } } // namespace v8::internal | 5170 } } // namespace v8::internal |
OLD | NEW |