• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
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     void CheckVarianceRecursively(TypeRelation *relation, VarianceFlag varianceFlag) override;
48 
49     void ToString(std::stringstream &ss, bool precise) const override;
50     void ToAssemblerType(std::stringstream &ss) const override;
51     void ToDebugInfoType(std::stringstream &ss) const override;
52 
53     ETSPartialTypeParameter *Instantiate(ArenaAllocator *allocator, TypeRelation *relation,
54                                          GlobalTypesHolder *globalTypes) override;
55 
56 private:
57     ETSChecker *const checker_;
58     ETSTypeParameter *const typeParameter_;
59 };
60 }  // namespace ark::es2panda::checker
61 
62 #endif
63