1 /** 2 * Copyright (c) 2023-2024 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_IR_ETS_RE_EXPORT_DECLARATION_H 17 #define ES2PANDA_IR_ETS_RE_EXPORT_DECLARATION_H 18 19 #include "ir/ets/etsImportDeclaration.h" 20 #include "ir/ets/etsImportSource.h" 21 #include "ir/module/importDeclaration.h" 22 #include "varbinder/varbinder.h" 23 24 namespace ark::es2panda::ir { 25 26 class ETSReExportDeclaration : public Statement { 27 public: 28 explicit ETSReExportDeclaration(ETSImportDeclaration *etsImportDeclarations, 29 const std::vector<std::string> &userPaths, util::StringView programPath, 30 ArenaAllocator *allocator); 31 GetETSImportDeclarations() const32 ETSImportDeclaration *GetETSImportDeclarations() const 33 { 34 return etsImportDeclarations_; 35 } 36 GetETSImportDeclarations()37 ETSImportDeclaration *GetETSImportDeclarations() 38 { 39 return etsImportDeclarations_; 40 } 41 GetUserPaths() const42 const ArenaVector<util::StringView> &GetUserPaths() const 43 { 44 return userPaths_; 45 } 46 GetProgramPath() const47 util::StringView const &GetProgramPath() const 48 { 49 return programPath_; 50 } 51 52 void TransformChildren(const NodeTransformer &cb, std::string_view transformationName) override; 53 54 void Iterate(const NodeTraverser &cb) const override; 55 56 void Dump(ir::AstDumper *dumper) const override; 57 void Dump([[maybe_unused]] ir::SrcDumper *dumper) const override {}; 58 59 void Compile(compiler::PandaGen * /*pg*/) const override {} 60 61 void Compile(compiler::ETSGen * /*gen*/) const override {} 62 63 checker::Type *Check(checker::TSChecker * /*checker*/) override 64 { 65 return nullptr; 66 } 67 68 checker::Type *Check(checker::ETSChecker * /*checker*/) override 69 { 70 return nullptr; 71 } 72 73 void Accept(ASTVisitorT *v) override 74 { 75 v->Accept(this); 76 } 77 78 private: 79 // NOTE(rsipka): this should use a singular name 80 ETSImportDeclaration *etsImportDeclarations_; 81 ArenaVector<util::StringView> userPaths_; 82 util::StringView programPath_; 83 }; 84 } // namespace ark::es2panda::ir 85 86 #endif 87