1 /**
2  * Copyright (c) 2021-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_TYPE_NODE_H
17 #define ES2PANDA_IR_TYPE_NODE_H
18 
19 #include "ir/expression.h"
20 
21 namespace ark::es2panda::checker {
22 class TSChecker;
23 class Type;
24 }  // namespace ark::es2panda::checker
25 
26 namespace ark::es2panda::ir {
27 class TypeNode : public Expression {
28 public:
29     TypeNode() = delete;
30     ~TypeNode() override = default;
31 
32     NO_COPY_SEMANTIC(TypeNode);
33     NO_MOVE_SEMANTIC(TypeNode);
34 
35     [[nodiscard]] bool IsTypeNode() const noexcept override
36     {
37         return true;
38     }
39 
GetType([[maybe_unused]] checker::TSChecker *checker)40     [[nodiscard]] virtual checker::Type *GetType([[maybe_unused]] checker::TSChecker *checker)
41     {
42         return nullptr;
43     }
44 
GetType([[maybe_unused]] checker::ETSChecker *checker)45     [[nodiscard]] virtual checker::Type *GetType([[maybe_unused]] checker::ETSChecker *checker)
46     {
47         return nullptr;
48     }
49 
50     [[nodiscard]] TypeNode *Clone(ArenaAllocator *allocator, AstNode *parent) override;
51 
52 protected:
TypeNode(AstNodeType const type)53     explicit TypeNode(AstNodeType const type) : Expression(type) {}
TypeNode(AstNodeType const type, ModifierFlags const flags)54     explicit TypeNode(AstNodeType const type, ModifierFlags const flags) : Expression(type, flags) {}
55 };
56 }  // namespace ark::es2panda::ir
57 
58 #endif /* ES2PANDA_IR_TYPE_NODE_H */
59