1 /* 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 3 * Copyright (c) 2021-2025 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_BROKEN_TYPE_NODE_H 18 #define ES2PANDA_IR_ETS_BROKEN_TYPE_NODE_H 19 20 #include "ir/typeNode.h" 21 22 namespace ark::es2panda::ir { 23 24 /* Synthetic type node, generated by a parser, placeholder for incorrect type. */ 25 26 class BrokenTypeNode : public TypeNode { 27 public: 28 ~BrokenTypeNode() override = default; 29 30 NO_COPY_SEMANTIC(BrokenTypeNode); 31 NO_MOVE_SEMANTIC(BrokenTypeNode); 32 BrokenTypeNode(ArenaAllocator * const allocator)33 explicit BrokenTypeNode(ArenaAllocator *const allocator) : TypeNode(AstNodeType::BROKEN_TYPE_NODE, allocator) {} 34 35 void TransformChildren(const NodeTransformer &cb, std::string_view transformationName) override; 36 void Iterate(const NodeTraverser &cb) const override; 37 void Dump(ir::AstDumper *dumper) const override; 38 void Dump(ir::SrcDumper *dumper) const override; 39 void Compile([[maybe_unused]] compiler::PandaGen *pg) const override; 40 void Compile([[maybe_unused]] compiler::ETSGen *etsg) const override; 41 checker::Type *Check([[maybe_unused]] checker::TSChecker *checker) override; 42 checker::Type *GetType([[maybe_unused]] checker::TSChecker *checker) override; 43 checker::VerifiedType Check([[maybe_unused]] checker::ETSChecker *checker) override; 44 checker::Type *GetType([[maybe_unused]] checker::ETSChecker *checker) override; 45 46 [[nodiscard]] BrokenTypeNode *Clone(ArenaAllocator *allocator, AstNode *parent) override; 47 Accept(ASTVisitorT * v)48 void Accept(ASTVisitorT *v) override 49 { 50 v->Accept(this); 51 } 52 }; 53 } // namespace ark::es2panda::ir 54 55 #endif /* ES2PANDA_IR_BROKEN_TYPE_NODE_H */ 56