| 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 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/ast-expression-rewriter.h" | 9 #include "src/ast/ast-expression-rewriter.h" |
| 10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
| (...skipping 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2714 | 2714 |
| 2715 Statement* Parser::ParseReturnStatement(bool* ok) { | 2715 Statement* Parser::ParseReturnStatement(bool* ok) { |
| 2716 // ReturnStatement :: | 2716 // ReturnStatement :: |
| 2717 // 'return' Expression? ';' | 2717 // 'return' Expression? ';' |
| 2718 | 2718 |
| 2719 // Consume the return token. It is necessary to do that before | 2719 // Consume the return token. It is necessary to do that before |
| 2720 // reporting any errors on it, because of the way errors are | 2720 // reporting any errors on it, because of the way errors are |
| 2721 // reported (underlining). | 2721 // reported (underlining). |
| 2722 Expect(Token::RETURN, CHECK_OK); | 2722 Expect(Token::RETURN, CHECK_OK); |
| 2723 Scanner::Location loc = scanner()->location(); | 2723 Scanner::Location loc = scanner()->location(); |
| 2724 function_state_->set_return_location(loc); | |
| 2725 | 2724 |
| 2726 Token::Value tok = peek(); | 2725 Token::Value tok = peek(); |
| 2727 Statement* result; | 2726 Statement* result; |
| 2728 Expression* return_value; | 2727 Expression* return_value; |
| 2729 if (scanner()->HasAnyLineTerminatorBeforeNext() || | 2728 if (scanner()->HasAnyLineTerminatorBeforeNext() || |
| 2730 tok == Token::SEMICOLON || | 2729 tok == Token::SEMICOLON || |
| 2731 tok == Token::RBRACE || | 2730 tok == Token::RBRACE || |
| 2732 tok == Token::EOS) { | 2731 tok == Token::EOS) { |
| 2733 if (IsSubclassConstructor(function_state_->kind())) { | 2732 if (IsSubclassConstructor(function_state_->kind())) { |
| 2734 return_value = ThisExpression(scope(), factory(), loc.beg_pos); | 2733 return_value = ThisExpression(scope(), factory(), loc.beg_pos); |
| (...skipping 4336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7071 node->Print(Isolate::Current()); | 7070 node->Print(Isolate::Current()); |
| 7072 } | 7071 } |
| 7073 #endif // DEBUG | 7072 #endif // DEBUG |
| 7074 | 7073 |
| 7075 #undef CHECK_OK | 7074 #undef CHECK_OK |
| 7076 #undef CHECK_OK_VOID | 7075 #undef CHECK_OK_VOID |
| 7077 #undef CHECK_FAILED | 7076 #undef CHECK_FAILED |
| 7078 | 7077 |
| 7079 } // namespace internal | 7078 } // namespace internal |
| 7080 } // namespace v8 | 7079 } // namespace v8 |
| OLD | NEW |