1 /** 2 * Copyright (c) 2021-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 PANDA_PLUGINS_ETS_TYPEAPI_H_ 17 #define PANDA_PLUGINS_ETS_TYPEAPI_H_ 18 19 #include <string> 20 #include "type.h" 21 #include "types/ets_primitives.h" 22 #include "libpandafile/file.h" 23 #include "types/ets_string.h" 24 25 namespace ark::ets { 26 27 enum class EtsTypeAPIKind : EtsByte { 28 NONE = 0x0U, 29 VOID = 0x1U, 30 31 CHAR = 0x2U, 32 BOOLEAN = 0x3U, 33 BYTE = 0x4U, 34 SHORT = 0x5U, 35 INT = 0x6U, 36 LONG = 0x7U, 37 FLOAT = 0x8U, 38 DOUBLE = 0x9U, 39 40 CLASS = 0xAU, 41 STRING = 0xBU, 42 INTERFACE = 0xCU, 43 ARRAY = 0xDU, 44 TUPLE = 0xEU, 45 FUNCTIONAL = 0xFU, 46 METHOD = 0x10U, 47 UNION = 0x11U, 48 UNDEFINED = 0x12U, 49 NUL = 0x13U, 50 51 ENUM = 0x14U 52 }; 53 54 constexpr EtsByte ETS_TYPE_KIND_VALUE_MASK = 1U << 6U; 55 56 constexpr EtsChar VOID_PRIMITIVE_TYPE_DESC = 'V'; 57 58 enum class EtsValueTypeDesc : EtsChar { 59 BOOLEAN = 'Z', 60 BYTE = 'B', 61 SHORT = 'S', 62 CHAR = 'C', 63 INT = 'I', 64 LONG = 'J', 65 FLOAT = 'F', 66 DOUBLE = 'D', 67 }; 68 69 // Type attributes "flat" representation 70 enum class EtsTypeAPIAttributes : EtsInt { 71 STATIC = 1U << 0U, // Field, Method 72 INHERITED = 1U << 1U, // Field, Method 73 READONLY = 1U << 2U, // Field 74 FINAL = 1U << 3U, // Method, Class 75 ABSTRACT = 1U << 4U, // Method 76 CONSTRUCTOR = 1U << 5U, // Method 77 REST = 1U << 6U, // Parameter 78 OPTIONAL = 1U << 7U, // Parameter 79 THROWING = 1U << 8U, // Method, Lambda 80 NATIVE = 1U << 9U, // Method, Lambda 81 ASYNC = 1U << 10U, // Method, Lambda 82 NEVERRESULT = 1U << 11U, // Method, Lambda 83 GETTER = 1U << 12U, // Method 84 SETTER = 1U << 13U // Method 85 }; 86 87 enum class EtsTypeAPIAccessModifier : EtsByte { PUBLIC = 0, PRIVATE = 1, PROTECTED = 2 }; 88 89 } // namespace ark::ets 90 91 #endif // PANDA_PLUGINS_ETS_TYPEAPI_H_ 92