| 148 | return JavaValue::unsafeMakeObject(nullptr); |
| 149 | } |
| 150 | |
| 151 | JavaObject toJavaObject(JavaEnv env, const Valdi::Value& weakValue) { |
| 152 | switch (weakValue.getType()) { |
| 153 | case Valdi::ValueType::Null: |
| 154 | return JavaObject(env); |
| 155 | case Valdi::ValueType::Undefined: |
| 156 | return undefinedValueJavaObject(env); |
| 157 | case Valdi::ValueType::InternedString: |
| 158 | return toJavaObject(env, weakValue.toStringBox()); |
| 159 | case Valdi::ValueType::StaticString: |
| 160 | return toJavaObject(env, *weakValue.getStaticString()); |
| 161 | case Valdi::ValueType::Int: |
| 162 | return toJavaObject(env, weakValue.toInt()); |
| 163 | case Valdi::ValueType::BigInt: |
| 164 | return toJavaObject(env, weakValue.getBigIntRef()); |
| 165 | case Valdi::ValueType::Long: |
| 166 | return toJavaObject(env, weakValue.toLong()); |
| 167 | case Valdi::ValueType::Double: |
| 168 | return toJavaObject(env, weakValue.toDouble()); |
| 169 | case Valdi::ValueType::Bool: |
| 170 | return toJavaObject(env, weakValue.toBool()); |
| 171 | case Valdi::ValueType::Map: |
| 172 | return toJavaObject(env, weakValue.getMapRef()); |
| 173 | case Valdi::ValueType::Array: |
| 174 | return toJavaObject(env, weakValue.getArrayRef()); |
| 175 | case Valdi::ValueType::TypedArray: |
| 176 | return toJavaObject(env, weakValue.getTypedArrayRef()); |
| 177 | case Valdi::ValueType::Function: |
| 178 | return toJavaObject(env, weakValue.getFunctionRef()); |
| 179 | case Valdi::ValueType::TypedObject: |
| 180 | return toJavaObject(env, weakValue.getTypedObjectRef()); |
| 181 | case Valdi::ValueType::ProxyTypedObject: |
| 182 | return toJavaObject(env, weakValue.getTypedProxyObjectRef()); |
| 183 | case Valdi::ValueType::ValdiObject: |
| 184 | return javaObjectFromValdiObject(weakValue.getValdiObject(), true); |
| 185 | case Valdi::ValueType::Error: |
| 186 | return toJavaObject(env, weakValue.getError()); |
| 187 | } |
| 188 | } |