1 /* 2 * Copyright (c) 2025 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 #ifndef ES2PANDA_COMPILER_CHECKER_TYPES_ETS_ANY_TYPE_H 16 #define ES2PANDA_COMPILER_CHECKER_TYPES_ETS_ANY_TYPE_H 17 18 #include "checker/types/type.h" 19 #include "ir/astNode.h" 20 21 namespace ark::es2panda::checker { 22 class ETSAnyType : public Type { 23 public: ETSAnyType()24 ETSAnyType() : Type(TypeFlag::ETS_ANY) {} 25 26 void Identical(TypeRelation *relation, Type *other) override; 27 void AssignmentTarget(TypeRelation *relation, Type *source) override; 28 bool AssignmentSource(TypeRelation *relation, Type *target) override; 29 void Compare(TypeRelation *relation, Type *other) override; 30 void Cast(TypeRelation *relation, Type *target) override; 31 void CastTarget(TypeRelation *relation, Type *source) override; 32 void IsSubtypeOf(TypeRelation *relation, Type *target) override; 33 void IsSupertypeOf(TypeRelation *relation, Type *source) override; 34 void ToString(std::stringstream &ss, bool precise) const override; 35 void ToAssemblerType(std::stringstream &ss) const override; 36 void ToDebugInfoType([[maybe_unused]] std::stringstream &ss) const override; 37 38 TypeFacts GetTypeFacts() const override; 39 40 Type *Instantiate(ArenaAllocator *allocator, TypeRelation *relation, GlobalTypesHolder *globalTypes) override; 41 ResolveConditionExpr()42 std::tuple<bool, bool> ResolveConditionExpr() const override 43 { 44 return {IsConstantType(), false}; 45 } 46 }; 47 } // namespace ark::es2panda::checker 48 49 #endif 50