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 COMMON_INTERFACES_OBJECTS_BASE_TYPE_H 17 #define COMMON_INTERFACES_OBJECTS_BASE_TYPE_H 18 19 #include <vector> 20 #include <variant> 21 #include <cstdint> 22 #include <memory> 23 24 #include "objects/base_object.h" 25 #include "objects/string/base_string_declare.h" 26 27 namespace panda::ecmascript { 28 class JSTaggedValue; 29 } 30 31 using JSTaggedValue = panda::ecmascript::JSTaggedValue; 32 namespace common { 33 34 struct BaseUndefined {}; 35 struct BaseNull {}; 36 struct BaseBigInt { 37 uint32_t length; 38 bool sign; 39 std::vector<uint32_t> data; 40 }; 41 42 // The common consensus type between static and dynamic 43 using BaseType = std::variant<std::monostate, bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float, 44 double, int64_t, uint64_t, BaseUndefined, BaseNull, BaseBigInt, BaseObject*, 45 BaseString*>; 46 47 // base type for static vm 48 using BoxedValue = BaseObject *; 49 50 } // namespace common 51 #endif // COMMON_INTERFACES_OBJECTS_BASE_TYPE_H