1
2/**
3 * Copyright (c) 2021-2024 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
25namespace ark::es2panda::ir {
26
27class ImportSource {
28public:
29    explicit ImportSource(ir::StringLiteral *source, ir::StringLiteral *resolvedSource, Language lang, bool hasDecl)
30        : source_(source), resolvedSource_(resolvedSource), lang_(lang), hasDecl_(hasDecl)
31    {
32    }
33    NO_COPY_SEMANTIC(ImportSource);
34    NO_MOVE_SEMANTIC(ImportSource);
35    ~ImportSource() = default;
36
37    const ir::StringLiteral *Source() const
38    {
39        return source_;
40    }
41
42    ir::StringLiteral *Source()
43    {
44        return source_;
45    }
46
47    const ir::StringLiteral *ResolvedSource() const
48    {
49        return resolvedSource_;
50    }
51
52    ir::StringLiteral *ResolvedSource()
53    {
54        return resolvedSource_;
55    }
56
57    es2panda::Language Language() const
58    {
59        return lang_;
60    }
61
62    bool HasDecl() const
63    {
64        return hasDecl_;
65    }
66
67private:
68    ir::StringLiteral *source_ {};
69    ir::StringLiteral *resolvedSource_ {};
70    es2panda::Language lang_;
71    bool hasDecl_;
72};
73
74}  // namespace ark::es2panda::ir
75#endif