1 /** 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ES2PANDA_COMPILER_FUNCTION_ASYNC_GENERATOR_FUNCTION_BUILDER_H 17 #define ES2PANDA_COMPILER_FUNCTION_ASYNC_GENERATOR_FUNCTION_BUILDER_H 18 19 #include <ir/irnode.h> 20 21 #include <compiler/function/asyncFunctionBuilder.h> 22 23 namespace panda::es2panda::compiler { 24 class PandaGen; 25 26 class AsyncGeneratorFunctionBuilder : public FunctionBuilder { 27 public: AsyncGeneratorFunctionBuilder(PandaGen * pg,CatchTable * catchTable)28 explicit AsyncGeneratorFunctionBuilder(PandaGen *pg, CatchTable *catchTable) : FunctionBuilder(pg, catchTable) {} 29 ~AsyncGeneratorFunctionBuilder() override = default; 30 NO_COPY_SEMANTIC(AsyncGeneratorFunctionBuilder); 31 NO_MOVE_SEMANTIC(AsyncGeneratorFunctionBuilder); 32 33 void Prepare(const ir::ScriptFunction *node) override; 34 void CleanUp(const ir::ScriptFunction *node) const override; 35 36 void DirectReturn(const ir::AstNode *node) const override; 37 void ImplicitReturn(const ir::AstNode *node) const override; 38 void ExplicitReturn(const ir::AstNode *node) const override; 39 40 void Yield(const ir::AstNode *node) override; 41 42 protected: BuilderKind()43 BuilderType BuilderKind() const override 44 { 45 return BuilderType::ASYNC_GENERATOR; 46 } 47 48 IteratorType GeneratorKind() const override; 49 }; 50 } // namespace panda::es2panda::compiler 51 52 #endif 53