• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 - 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_ETS_CONVERSION_H
17 #define ES2PANDA_COMPILER_CHECKER_ETS_CONVERSION_H
18 
19 #include "checker/types/type.h"
20 #include "checker/types/typeRelation.h"
21 
22 namespace ark::es2panda::checker::conversion {
23 void Identity(TypeRelation *relation, Type *source, Type *target);
24 
25 void WideningPrimitive(TypeRelation *relation, Type *source, Type *target);
26 void NarrowingPrimitive(TypeRelation *relation, Type *source, Type *target);
27 void WideningNarrowingPrimitive(TypeRelation *relation, ByteType *source, CharType *target);
28 
29 void WideningReference(TypeRelation *relation, ETSObjectType *source, ETSObjectType *target);
30 void WideningReference(TypeRelation *relation, ETSArrayType *source, ETSObjectType *target);
31 void WideningReference(TypeRelation *relation, ETSArrayType *source, ETSArrayType *target);
32 
33 void NarrowingReference(TypeRelation *relation, ETSObjectType *source, ETSObjectType *target);
34 void NarrowingReference(TypeRelation *relation, ETSObjectType *source, ETSArrayType *target);
35 void NarrowingReference(TypeRelation *relation, ETSArrayType *source, ETSArrayType *target);
36 void NarrowingReference(TypeRelation *relation, ETSObjectType *source, ETSTupleType *target);
37 
38 ETSObjectType *Boxing(TypeRelation *relation, Type *source);
39 Type *Unboxing(TypeRelation *relation, ETSObjectType *source);
40 
41 void UnboxingWideningNarrowingPrimitive(TypeRelation *relation, ETSObjectType *source, Type *target);
42 void UnboxingNarrowingPrimitive(TypeRelation *relation, ETSObjectType *source, Type *target);
43 void UnboxingWideningPrimitive(TypeRelation *relation, ETSObjectType *source, Type *target);
44 void NarrowingReferenceUnboxing(TypeRelation *relation, ETSObjectType *source, Type *target);
45 void BoxingWideningReference(TypeRelation *relation, Type *source, ETSObjectType *target);
46 
47 void String(TypeRelation *relation, Type *source);
48 void Forbidden(TypeRelation *relation);
49 }  // namespace ark::es2panda::checker::conversion
50 
51 #endif
52