OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2535 // DoStatement :: | 2535 // DoStatement :: |
2536 // 'do' Statement 'while' '(' Expression ')' ';' | 2536 // 'do' Statement 'while' '(' Expression ')' ';' |
2537 | 2537 |
2538 DoWhileStatement* loop = NEW(DoWhileStatement(labels)); | 2538 DoWhileStatement* loop = NEW(DoWhileStatement(labels)); |
2539 Target target(this, loop); | 2539 Target target(this, loop); |
2540 | 2540 |
2541 Expect(Token::DO, CHECK_OK); | 2541 Expect(Token::DO, CHECK_OK); |
2542 Statement* body = ParseStatement(NULL, CHECK_OK); | 2542 Statement* body = ParseStatement(NULL, CHECK_OK); |
2543 Expect(Token::WHILE, CHECK_OK); | 2543 Expect(Token::WHILE, CHECK_OK); |
2544 Expect(Token::LPAREN, CHECK_OK); | 2544 Expect(Token::LPAREN, CHECK_OK); |
| 2545 |
| 2546 if (loop != NULL) { |
| 2547 int position = scanner().location().beg_pos; |
| 2548 loop->set_condition_position(position); |
| 2549 } |
| 2550 |
2545 Expression* cond = ParseExpression(true, CHECK_OK); | 2551 Expression* cond = ParseExpression(true, CHECK_OK); |
2546 Expect(Token::RPAREN, CHECK_OK); | 2552 Expect(Token::RPAREN, CHECK_OK); |
2547 | 2553 |
2548 // Allow do-statements to be terminated with and without | 2554 // Allow do-statements to be terminated with and without |
2549 // semi-colons. This allows code such as 'do;while(0)return' to | 2555 // semi-colons. This allows code such as 'do;while(0)return' to |
2550 // parse, which would not be the case if we had used the | 2556 // parse, which would not be the case if we had used the |
2551 // ExpectSemicolon() functionality here. | 2557 // ExpectSemicolon() functionality here. |
2552 if (peek() == Token::SEMICOLON) Consume(Token::SEMICOLON); | 2558 if (peek() == Token::SEMICOLON) Consume(Token::SEMICOLON); |
2553 | 2559 |
2554 if (loop != NULL) loop->Initialize(cond, body); | 2560 if (loop != NULL) loop->Initialize(cond, body); |
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4781 start_position, | 4787 start_position, |
4782 is_expression); | 4788 is_expression); |
4783 return result; | 4789 return result; |
4784 } | 4790 } |
4785 | 4791 |
4786 | 4792 |
4787 #undef NEW | 4793 #undef NEW |
4788 | 4794 |
4789 | 4795 |
4790 } } // namespace v8::internal | 4796 } } // namespace v8::internal |
OLD | NEW |