• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2023 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 panda::es2panda::ir {
25 
26 class ETSReExportDeclaration {
27 public:
ETSReExportDeclaration(ETSImportDeclaration * const etsImportDeclarations,std::vector<std::string> const & userPaths,util::StringView programPath,ArenaAllocator * allocator)28     explicit ETSReExportDeclaration(ETSImportDeclaration *const etsImportDeclarations,
29                                     std::vector<std::string> const &userPaths, util::StringView programPath,
30                                     ArenaAllocator *allocator)
31         : etsImportDeclarations_(etsImportDeclarations), userPaths_(allocator->Adapter()), programPath_(programPath)
32     {
33         for (const auto &path : userPaths) {
34             userPaths_.emplace_back(util::UString(path, allocator).View());
35         }
36     }
37 
GetETSImportDeclarations()38     ETSImportDeclaration *GetETSImportDeclarations() const
39     {
40         return etsImportDeclarations_;
41     }
42 
GetETSImportDeclarations()43     ETSImportDeclaration *GetETSImportDeclarations()
44     {
45         return etsImportDeclarations_;
46     }
47 
GetUserPaths()48     const ArenaVector<util::StringView> &GetUserPaths() const
49     {
50         return userPaths_;
51     }
52 
GetProgramPath()53     util::StringView const &GetProgramPath() const
54     {
55         return programPath_;
56     }
57 
58 private:
59     ETSImportDeclaration *etsImportDeclarations_;
60     ArenaVector<util::StringView> userPaths_;
61     util::StringView programPath_;
62 };
63 }  // namespace panda::es2panda::ir
64 
65 #endif
66