1 /* 2 * Copyright (c) 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_COMPILER_CHECKER_TYPES_ETS_PARTIAL_TYPE_PARAMETER_TYPE_H 17 #define ES2PANDA_COMPILER_CHECKER_TYPES_ETS_PARTIAL_TYPE_PARAMETER_TYPE_H 18 19 #include "checker/types/ets/etsTypeParameter.h" 20 21 namespace ark::es2panda::checker { 22 class ETSChecker; 23 24 class ETSPartialTypeParameter : public Type { 25 public: 26 ETSPartialTypeParameter() = delete; 27 ~ETSPartialTypeParameter() override = default; 28 29 NO_COPY_SEMANTIC(ETSPartialTypeParameter); 30 NO_MOVE_SEMANTIC(ETSPartialTypeParameter); 31 32 explicit ETSPartialTypeParameter(ETSTypeParameter *typeParam, ETSChecker *checker); 33 GetUnderlying()34 ETSTypeParameter *GetUnderlying() const 35 { 36 return typeParameter_; 37 } 38 39 void Identical(TypeRelation *relation, Type *other) override; 40 void AssignmentTarget(TypeRelation *relation, Type *source) override; 41 bool AssignmentSource(TypeRelation *relation, Type *target) override; 42 void Cast(TypeRelation *relation, Type *target) override; 43 void CastTarget(TypeRelation *relation, Type *source) override; 44 void IsSupertypeOf(TypeRelation *relation, Type *source) override; 45 void IsSubtypeOf(TypeRelation *relation, Type *target) override; 46 Type *Substitute(TypeRelation *relation, const Substitution *substitution) override; 47 48 void ToString(std::stringstream &ss, bool precise) const override; 49 void ToAssemblerType(std::stringstream &ss) const override; 50 void ToDebugInfoType(std::stringstream &ss) const override; 51 52 ETSPartialTypeParameter *Instantiate(ArenaAllocator *allocator, TypeRelation *relation, 53 GlobalTypesHolder *globalTypes) override; 54 55 private: 56 ETSChecker *const checker_; 57 ETSTypeParameter *const typeParameter_; 58 }; 59 } // namespace ark::es2panda::checker 60 61 #endif 62