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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
(...skipping 2973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 // } | 2984 // } |
2985 Block* result = factory()->NewBlock(nullptr, 2, true, kNoSourcePosition); | 2985 Block* result = factory()->NewBlock(nullptr, 2, true, kNoSourcePosition); |
2986 | 2986 |
2987 // .promise = %AsyncFunctionPromiseCreate(); | 2987 // .promise = %AsyncFunctionPromiseCreate(); |
2988 Statement* set_promise; | 2988 Statement* set_promise; |
2989 { | 2989 { |
2990 Expression* create_promise = factory()->NewCallRuntime( | 2990 Expression* create_promise = factory()->NewCallRuntime( |
2991 Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX, | 2991 Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX, |
2992 new (zone()) ZoneList<Expression*>(0, zone()), kNoSourcePosition); | 2992 new (zone()) ZoneList<Expression*>(0, zone()), kNoSourcePosition); |
2993 Assignment* assign_promise = factory()->NewAssignment( | 2993 Assignment* assign_promise = factory()->NewAssignment( |
2994 Token::INIT, factory()->NewVariableProxy(PromiseVariable()), | 2994 Token::ASSIGN, factory()->NewVariableProxy(PromiseVariable()), |
2995 create_promise, kNoSourcePosition); | 2995 create_promise, kNoSourcePosition); |
2996 set_promise = | 2996 set_promise = |
2997 factory()->NewExpressionStatement(assign_promise, kNoSourcePosition); | 2997 factory()->NewExpressionStatement(assign_promise, kNoSourcePosition); |
2998 } | 2998 } |
2999 result->statements()->Add(set_promise, zone()); | 2999 result->statements()->Add(set_promise, zone()); |
3000 | 3000 |
3001 // catch (.catch) { return %RejectPromise(.promise, .catch), .promise } | 3001 // catch (.catch) { return %RejectPromise(.promise, .catch), .promise } |
3002 Scope* catch_scope = NewScope(CATCH_SCOPE); | 3002 Scope* catch_scope = NewScope(CATCH_SCOPE); |
3003 catch_scope->set_is_hidden(); | 3003 catch_scope->set_is_hidden(); |
3004 Variable* catch_variable = | 3004 Variable* catch_variable = |
(...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5018 | 5018 |
5019 return final_loop; | 5019 return final_loop; |
5020 } | 5020 } |
5021 | 5021 |
5022 #undef CHECK_OK | 5022 #undef CHECK_OK |
5023 #undef CHECK_OK_VOID | 5023 #undef CHECK_OK_VOID |
5024 #undef CHECK_FAILED | 5024 #undef CHECK_FAILED |
5025 | 5025 |
5026 } // namespace internal | 5026 } // namespace internal |
5027 } // namespace v8 | 5027 } // namespace v8 |
OLD | NEW |