• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /**
3  * Copyright (c) 2021 Huawei Device Co., Ltd.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ES2PANDA_IR_ETS_IMPORT_SOURCE_H
18 #define ES2PANDA_IR_ETS_IMPORT_SOURCE_H
19 
20 #include "checker/types/type.h"
21 #include "ir/astNode.h"
22 #include "ir/expressions/literals/stringLiteral.h"
23 #include "util/language.h"
24 
25 namespace panda::es2panda::ir {
26 
27 class ImportSource {
28 public:
29     explicit ImportSource(ir::StringLiteral *source, ir::StringLiteral *resolvedSource, Language lang, bool hasDecl,
30                           ir::StringLiteral *module = nullptr)
source_(source)31         : source_(source), resolvedSource_(resolvedSource), lang_(lang), hasDecl_(hasDecl), module_(module)
32     {
33     }
34     NO_COPY_SEMANTIC(ImportSource);
35     NO_MOVE_SEMANTIC(ImportSource);
36     ~ImportSource() = default;
37 
Source()38     const ir::StringLiteral *Source() const
39     {
40         return source_;
41     }
42 
Source()43     ir::StringLiteral *Source()
44     {
45         return source_;
46     }
47 
ResolvedSource()48     const ir::StringLiteral *ResolvedSource() const
49     {
50         return resolvedSource_;
51     }
52 
ResolvedSource()53     ir::StringLiteral *ResolvedSource()
54     {
55         return resolvedSource_;
56     }
57 
Module()58     const ir::StringLiteral *Module() const
59     {
60         return module_;
61     }
62 
Module()63     ir::StringLiteral *Module()
64     {
65         return module_;
66     }
67 
Language()68     es2panda::Language Language() const
69     {
70         return lang_;
71     }
72 
HasDecl()73     bool HasDecl() const
74     {
75         return hasDecl_;
76     }
77 
78 private:
79     ir::StringLiteral *source_ {};
80     ir::StringLiteral *resolvedSource_ {};
81     es2panda::Language lang_;
82     bool hasDecl_;
83     ir::StringLiteral *module_ {};
84 };
85 
86 }  // namespace panda::es2panda::ir
87 #endif