koffi 2.1.0-beta.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog.md +2 -1
- package/build/qemu/2.1.0/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_win32_x64.tar.gz +0 -0
- package/doc/benchmarks.md +14 -14
- package/doc/benchmarks.xlsx +0 -0
- package/doc/index.rst +2 -2
- package/doc/static/perf_linux_20220812.png +0 -0
- package/doc/static/perf_windows_20220812.png +0 -0
- package/doc/types.md +10 -12
- package/package.json +2 -2
- package/qemu/registry/machines.json +2 -2
- package/qemu/registry/sha256sum.txt +2 -2
- package/src/abi_arm32.cc +23 -55
- package/src/abi_arm64.cc +22 -54
- package/src/abi_riscv64.cc +20 -52
- package/src/abi_x64_sysv.cc +20 -52
- package/src/abi_x64_win.cc +20 -52
- package/src/abi_x86.cc +24 -56
- package/src/call.cc +117 -143
- package/src/call.hh +4 -4
- package/src/ffi.cc +16 -4
- package/src/util.hh +0 -20
- package/test/callbacks.js +3 -3
- package/test/misc.c +2 -2
- package/test/sync.js +2 -2
- package/vendor/libcc/libcc.cc +75 -55
- package/vendor/libcc/libcc.hh +306 -255
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj +226 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.filters +10 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.user +4 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android.sln +75 -0
- package/vendor/raylib/projects/VS2022/examples/audio_module_playing.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_multichannel_sound.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_music_stream.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_raw_stream.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_sound_loading.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_stream_effects.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_2d_camera.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_2d_camera_mouse_zoom.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_2d_camera_platformer.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_3d_camera_first_person.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_3d_camera_free.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_3d_camera_mode.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_3d_picking.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_basic_screen_manager.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_basic_window.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_custom_frame_control.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_custom_logging.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_drop_files.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_gamepad.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_gestures.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_keys.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_mouse.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_mouse_wheel.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_multitouch.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_loading_thread.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_random_values.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_scissor_test.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_split_screen.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_storage_values.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_vr_simulator.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_window_flags.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_window_letterbox.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_window_should_close.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_world_screen.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/easings_testbed.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/embedded_files_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_animation.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_billboard.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_box_collisions.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_cubicmap.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_first_person_maze.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_geometric_shapes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_heightmap.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_loading_gltf.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_loading_vox.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_mesh_generation.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_mesh_picking.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_orthographic_projection.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_rlgl_solar_system.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_skybox.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_waving_cubes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_yaw_pitch_roll.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/rlgl_compute_shaders.vcxproj +391 -0
- package/vendor/raylib/projects/VS2022/examples/rlgl_standalone.vcxproj +391 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_basic_lighting.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_custom_uniform.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_eratosthenes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_fog.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_hot_reloading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_julia_set.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_mesh_instancing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_model_shader.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_multi_sample2d.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_palette_switch.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_postprocessing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_raymarching.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_shapes_textures.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_simple_mask.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_spotlight.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_texture_drawing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_texture_waves.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_basic_shapes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_bouncing_ball.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_collision_area.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_colors_palette.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_draw_circle_sector.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_draw_rectangle_rounded.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_draw_ring.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_easings_ball_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_easings_box_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_easings_rectangle_array.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_following_eyes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_lines_bezier.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_logo_raylib.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_logo_raylib_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_rectangle_scaling.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_codepoints_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_draw_3d.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_font_filters.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_font_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_font_sdf.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_font_spritefont.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_format_text.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_input_box.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_raylib_fonts.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_rectangle_bounds.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_unicode.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_writing_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_background_scrolling.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_blend_modes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_bunnymark.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_draw_tiled.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_fog_of_war.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_gif_player.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_drawing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_generation.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_processing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_text.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_logo_raylib.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_mouse_painting.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_npatch_drawing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_particles_blending.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_polygon.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_raw_data.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_sprite_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_sprite_button.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_sprite_explosion.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_srcrec_dstrec.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_to_image.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/raylib/raylib.vcxproj +340 -0
- package/vendor/raylib/projects/VS2022/raylib.sln +2347 -0
- package/build/qemu/2.1.0-beta.3/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_win32_x64.tar.gz +0 -0
- package/doc/dist/doctrees/benchmarks.doctree +0 -0
- package/doc/dist/doctrees/changes.doctree +0 -0
- package/doc/dist/doctrees/contribute.doctree +0 -0
- package/doc/dist/doctrees/environment.pickle +0 -0
- package/doc/dist/doctrees/functions.doctree +0 -0
- package/doc/dist/doctrees/index.doctree +0 -0
- package/doc/dist/doctrees/memory.doctree +0 -0
- package/doc/dist/doctrees/platforms.doctree +0 -0
- package/doc/dist/doctrees/start.doctree +0 -0
- package/doc/dist/doctrees/types.doctree +0 -0
- package/doc/dist/html/.buildinfo +0 -4
- package/doc/dist/html/_sources/benchmarks.md.txt +0 -137
- package/doc/dist/html/_sources/changes.md.txt +0 -161
- package/doc/dist/html/_sources/contribute.md.txt +0 -127
- package/doc/dist/html/_sources/functions.md.txt +0 -421
- package/doc/dist/html/_sources/index.rst.txt +0 -39
- package/doc/dist/html/_sources/memory.md.txt +0 -32
- package/doc/dist/html/_sources/platforms.md.txt +0 -31
- package/doc/dist/html/_sources/start.md.txt +0 -100
- package/doc/dist/html/_sources/types.md.txt +0 -541
- package/doc/dist/html/_static/_sphinx_javascript_frameworks_compat.js +0 -134
- package/doc/dist/html/_static/basic.css +0 -932
- package/doc/dist/html/_static/bench_linux.png +0 -0
- package/doc/dist/html/_static/bench_windows.png +0 -0
- package/doc/dist/html/_static/custom.css +0 -22
- package/doc/dist/html/_static/debug.css +0 -69
- package/doc/dist/html/_static/doctools.js +0 -264
- package/doc/dist/html/_static/documentation_options.js +0 -14
- package/doc/dist/html/_static/file.png +0 -0
- package/doc/dist/html/_static/jquery-3.6.0.js +0 -10881
- package/doc/dist/html/_static/jquery.js +0 -2
- package/doc/dist/html/_static/language_data.js +0 -199
- package/doc/dist/html/_static/minus.png +0 -0
- package/doc/dist/html/_static/perf_linux_20220623.png +0 -0
- package/doc/dist/html/_static/perf_linux_20220623_2.png +0 -0
- package/doc/dist/html/_static/perf_linux_20220627.png +0 -0
- package/doc/dist/html/_static/perf_linux_20220628.png +0 -0
- package/doc/dist/html/_static/perf_windows_20220623.png +0 -0
- package/doc/dist/html/_static/perf_windows_20220623_2.png +0 -0
- package/doc/dist/html/_static/perf_windows_20220627.png +0 -0
- package/doc/dist/html/_static/perf_windows_20220628.png +0 -0
- package/doc/dist/html/_static/plus.png +0 -0
- package/doc/dist/html/_static/pygments.css +0 -252
- package/doc/dist/html/_static/scripts/furo-extensions.js +0 -0
- package/doc/dist/html/_static/scripts/furo.js +0 -3
- package/doc/dist/html/_static/scripts/furo.js.LICENSE.txt +0 -7
- package/doc/dist/html/_static/scripts/furo.js.map +0 -1
- package/doc/dist/html/_static/searchtools.js +0 -531
- package/doc/dist/html/_static/skeleton.css +0 -296
- package/doc/dist/html/_static/styles/furo-extensions.css +0 -2
- package/doc/dist/html/_static/styles/furo-extensions.css.map +0 -1
- package/doc/dist/html/_static/styles/furo.css +0 -2
- package/doc/dist/html/_static/styles/furo.css.map +0 -1
- package/doc/dist/html/_static/underscore-1.13.1.js +0 -2042
- package/doc/dist/html/_static/underscore.js +0 -6
- package/doc/dist/html/benchmarks.html +0 -571
- package/doc/dist/html/changes.html +0 -686
- package/doc/dist/html/contribute.html +0 -403
- package/doc/dist/html/functions.html +0 -718
- package/doc/dist/html/genindex.html +0 -253
- package/doc/dist/html/index.html +0 -359
- package/doc/dist/html/memory.html +0 -346
- package/doc/dist/html/objects.inv +0 -0
- package/doc/dist/html/platforms.html +0 -371
- package/doc/dist/html/search.html +0 -261
- package/doc/dist/html/searchindex.js +0 -1
- package/doc/dist/html/start.html +0 -384
- package/doc/dist/html/types.html +0 -1061
package/src/abi_x64_win.cc
CHANGED
|
@@ -144,7 +144,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
144
144
|
#define PUSH_INTEGER(CType) \
|
|
145
145
|
do { \
|
|
146
146
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
147
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
147
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
148
148
|
return false; \
|
|
149
149
|
} \
|
|
150
150
|
\
|
|
@@ -154,7 +154,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
154
154
|
#define PUSH_INTEGER_SWAP(CType) \
|
|
155
155
|
do { \
|
|
156
156
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
157
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
157
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
158
158
|
return false; \
|
|
159
159
|
} \
|
|
160
160
|
\
|
|
@@ -174,7 +174,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
174
174
|
|
|
175
175
|
case PrimitiveKind::Bool: {
|
|
176
176
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
177
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
177
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
|
|
178
178
|
return false;
|
|
179
179
|
}
|
|
180
180
|
|
|
@@ -198,44 +198,28 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
198
198
|
case PrimitiveKind::UInt64S: { PUSH_INTEGER_SWAP(uint64_t); } break;
|
|
199
199
|
case PrimitiveKind::String: {
|
|
200
200
|
const char *str;
|
|
201
|
-
if (
|
|
202
|
-
str = PushString(value);
|
|
203
|
-
if (RG_UNLIKELY(!str))
|
|
204
|
-
return false;
|
|
205
|
-
} else if (IsNullOrUndefined(value)) {
|
|
206
|
-
str = nullptr;
|
|
207
|
-
} else {
|
|
208
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
201
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
209
202
|
return false;
|
|
210
|
-
}
|
|
211
203
|
|
|
212
204
|
*(const char **)(args_ptr++) = str;
|
|
213
205
|
} break;
|
|
214
206
|
case PrimitiveKind::String16: {
|
|
215
207
|
const char16_t *str16;
|
|
216
|
-
if (
|
|
217
|
-
str16 = PushString16(value);
|
|
218
|
-
if (RG_UNLIKELY(!str16))
|
|
219
|
-
return false;
|
|
220
|
-
} else if (IsNullOrUndefined(value)) {
|
|
221
|
-
str16 = nullptr;
|
|
222
|
-
} else {
|
|
223
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
208
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
224
209
|
return false;
|
|
225
|
-
}
|
|
226
210
|
|
|
227
211
|
*(const char16_t **)(args_ptr++) = str16;
|
|
228
212
|
} break;
|
|
229
213
|
case PrimitiveKind::Pointer: {
|
|
230
214
|
void *ptr;
|
|
231
|
-
if (RG_UNLIKELY(!PushPointer(value, param, &ptr)))
|
|
215
|
+
if (RG_UNLIKELY(!PushPointer(value, param.type, param.directions, &ptr)))
|
|
232
216
|
return false;
|
|
233
217
|
|
|
234
218
|
*(void **)(args_ptr++) = ptr;
|
|
235
219
|
} break;
|
|
236
220
|
case PrimitiveKind::Record: {
|
|
237
221
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
238
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
222
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
239
223
|
return false;
|
|
240
224
|
}
|
|
241
225
|
|
|
@@ -254,7 +238,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
254
238
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
255
239
|
case PrimitiveKind::Float32: {
|
|
256
240
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
257
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
241
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
258
242
|
return false;
|
|
259
243
|
}
|
|
260
244
|
|
|
@@ -265,7 +249,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
265
249
|
} break;
|
|
266
250
|
case PrimitiveKind::Float64: {
|
|
267
251
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
268
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
252
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
269
253
|
return false;
|
|
270
254
|
}
|
|
271
255
|
|
|
@@ -286,7 +270,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
286
270
|
} else if (IsNullOrUndefined(value)) {
|
|
287
271
|
ptr = nullptr;
|
|
288
272
|
} else {
|
|
289
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
273
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), param.type->name);
|
|
290
274
|
return false;
|
|
291
275
|
}
|
|
292
276
|
|
|
@@ -632,7 +616,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
632
616
|
#define RETURN_INTEGER(CType) \
|
|
633
617
|
do { \
|
|
634
618
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
635
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
619
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
636
620
|
return; \
|
|
637
621
|
} \
|
|
638
622
|
\
|
|
@@ -642,7 +626,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
642
626
|
#define RETURN_INTEGER_SWAP(CType) \
|
|
643
627
|
do { \
|
|
644
628
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
645
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
629
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
646
630
|
return; \
|
|
647
631
|
} \
|
|
648
632
|
\
|
|
@@ -654,7 +638,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
654
638
|
case PrimitiveKind::Void: {} break;
|
|
655
639
|
case PrimitiveKind::Bool: {
|
|
656
640
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
657
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
641
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
|
|
658
642
|
return;
|
|
659
643
|
}
|
|
660
644
|
|
|
@@ -677,31 +661,15 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
677
661
|
case PrimitiveKind::UInt64S: { RETURN_INTEGER_SWAP(uint64_t); } break;
|
|
678
662
|
case PrimitiveKind::String: {
|
|
679
663
|
const char *str;
|
|
680
|
-
if (
|
|
681
|
-
str = PushString(value);
|
|
682
|
-
if (RG_UNLIKELY(!str))
|
|
683
|
-
return;
|
|
684
|
-
} else if (IsNullOrUndefined(value)) {
|
|
685
|
-
str = nullptr;
|
|
686
|
-
} else {
|
|
687
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
664
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
688
665
|
return;
|
|
689
|
-
}
|
|
690
666
|
|
|
691
667
|
out_reg->rax = (uint64_t)str;
|
|
692
668
|
} break;
|
|
693
669
|
case PrimitiveKind::String16: {
|
|
694
670
|
const char16_t *str16;
|
|
695
|
-
if (
|
|
696
|
-
str16 = PushString16(value);
|
|
697
|
-
if (RG_UNLIKELY(!str16))
|
|
698
|
-
return;
|
|
699
|
-
} else if (IsNullOrUndefined(value)) {
|
|
700
|
-
str16 = nullptr;
|
|
701
|
-
} else {
|
|
702
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
671
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
703
672
|
return;
|
|
704
|
-
}
|
|
705
673
|
|
|
706
674
|
out_reg->rax = (uint64_t)str16;
|
|
707
675
|
} break;
|
|
@@ -720,7 +688,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
720
688
|
} else if (IsNullOrUndefined(value)) {
|
|
721
689
|
ptr = nullptr;
|
|
722
690
|
} else {
|
|
723
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
691
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
724
692
|
return;
|
|
725
693
|
}
|
|
726
694
|
|
|
@@ -728,7 +696,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
728
696
|
} break;
|
|
729
697
|
case PrimitiveKind::Record: {
|
|
730
698
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
731
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
699
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
732
700
|
return;
|
|
733
701
|
}
|
|
734
702
|
|
|
@@ -745,7 +713,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
745
713
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
746
714
|
case PrimitiveKind::Float32: {
|
|
747
715
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
748
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
716
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
749
717
|
return;
|
|
750
718
|
}
|
|
751
719
|
|
|
@@ -756,7 +724,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
756
724
|
} break;
|
|
757
725
|
case PrimitiveKind::Float64: {
|
|
758
726
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
759
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
727
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
760
728
|
return;
|
|
761
729
|
}
|
|
762
730
|
|
|
@@ -777,7 +745,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
777
745
|
} else if (IsNullOrUndefined(value)) {
|
|
778
746
|
ptr = nullptr;
|
|
779
747
|
} else {
|
|
780
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
748
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
781
749
|
return;
|
|
782
750
|
}
|
|
783
751
|
|
package/src/abi_x86.cc
CHANGED
|
@@ -200,7 +200,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
200
200
|
#define PUSH_INTEGER_32(CType) \
|
|
201
201
|
do { \
|
|
202
202
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
203
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
203
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
204
204
|
return false; \
|
|
205
205
|
} \
|
|
206
206
|
\
|
|
@@ -210,7 +210,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
210
210
|
#define PUSH_INTEGER_32_SWAP(CType) \
|
|
211
211
|
do { \
|
|
212
212
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
213
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
213
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
214
214
|
return false; \
|
|
215
215
|
} \
|
|
216
216
|
\
|
|
@@ -220,7 +220,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
220
220
|
#define PUSH_INTEGER_64(CType) \
|
|
221
221
|
do { \
|
|
222
222
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
223
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
223
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
224
224
|
return false; \
|
|
225
225
|
} \
|
|
226
226
|
\
|
|
@@ -232,7 +232,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
232
232
|
#define PUSH_INTEGER_64_SWAP(CType) \
|
|
233
233
|
do { \
|
|
234
234
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
235
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
235
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
236
236
|
return false; \
|
|
237
237
|
} \
|
|
238
238
|
\
|
|
@@ -254,7 +254,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
254
254
|
|
|
255
255
|
case PrimitiveKind::Bool: {
|
|
256
256
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
257
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
257
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
|
|
258
258
|
return false;
|
|
259
259
|
}
|
|
260
260
|
|
|
@@ -277,44 +277,28 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
277
277
|
case PrimitiveKind::UInt64S: { PUSH_INTEGER_64_SWAP(uint64_t); } break;
|
|
278
278
|
case PrimitiveKind::String: {
|
|
279
279
|
const char *str;
|
|
280
|
-
if (
|
|
281
|
-
str = PushString(value);
|
|
282
|
-
if (RG_UNLIKELY(!str))
|
|
283
|
-
return false;
|
|
284
|
-
} else if (IsNullOrUndefined(value)) {
|
|
285
|
-
str = nullptr;
|
|
286
|
-
} else {
|
|
287
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
280
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
288
281
|
return false;
|
|
289
|
-
}
|
|
290
282
|
|
|
291
283
|
*(const char **)((param.fast ? fast_ptr : args_ptr)++) = str;
|
|
292
284
|
} break;
|
|
293
285
|
case PrimitiveKind::String16: {
|
|
294
286
|
const char16_t *str16;
|
|
295
|
-
if (
|
|
296
|
-
str16 = PushString16(value);
|
|
297
|
-
if (RG_UNLIKELY(!str16))
|
|
298
|
-
return false;
|
|
299
|
-
} else if (IsNullOrUndefined(value)) {
|
|
300
|
-
str16 = nullptr;
|
|
301
|
-
} else {
|
|
302
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
287
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
303
288
|
return false;
|
|
304
|
-
}
|
|
305
289
|
|
|
306
290
|
*(const char16_t **)((param.fast ? fast_ptr : args_ptr)++) = str16;
|
|
307
291
|
} break;
|
|
308
292
|
case PrimitiveKind::Pointer: {
|
|
309
293
|
void *ptr;
|
|
310
|
-
if (RG_UNLIKELY(!PushPointer(value, param, &ptr)))
|
|
294
|
+
if (RG_UNLIKELY(!PushPointer(value, param.type, param.directions, &ptr)))
|
|
311
295
|
return false;
|
|
312
296
|
|
|
313
297
|
*(void **)((param.fast ? fast_ptr : args_ptr)++) = ptr;
|
|
314
298
|
} break;
|
|
315
299
|
case PrimitiveKind::Record: {
|
|
316
300
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
317
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
301
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
318
302
|
return false;
|
|
319
303
|
}
|
|
320
304
|
|
|
@@ -334,7 +318,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
334
318
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
335
319
|
case PrimitiveKind::Float32: {
|
|
336
320
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
337
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
321
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
338
322
|
return false;
|
|
339
323
|
}
|
|
340
324
|
|
|
@@ -343,7 +327,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
343
327
|
} break;
|
|
344
328
|
case PrimitiveKind::Float64: {
|
|
345
329
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
346
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
330
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
347
331
|
return false;
|
|
348
332
|
}
|
|
349
333
|
|
|
@@ -365,7 +349,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
365
349
|
} else if (IsNullOrUndefined(value)) {
|
|
366
350
|
ptr = nullptr;
|
|
367
351
|
} else {
|
|
368
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
352
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), param.type->name);
|
|
369
353
|
return false;
|
|
370
354
|
}
|
|
371
355
|
|
|
@@ -711,7 +695,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
711
695
|
#define RETURN_INTEGER_32(CType) \
|
|
712
696
|
do { \
|
|
713
697
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
714
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
698
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
715
699
|
return; \
|
|
716
700
|
} \
|
|
717
701
|
\
|
|
@@ -721,7 +705,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
721
705
|
#define RETURN_INTEGER_32_SWAP(CType) \
|
|
722
706
|
do { \
|
|
723
707
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
724
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
708
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
725
709
|
return; \
|
|
726
710
|
} \
|
|
727
711
|
\
|
|
@@ -731,7 +715,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
731
715
|
#define RETURN_INTEGER_64(CType) \
|
|
732
716
|
do { \
|
|
733
717
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
734
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
718
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
735
719
|
return; \
|
|
736
720
|
} \
|
|
737
721
|
\
|
|
@@ -743,7 +727,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
743
727
|
#define RETURN_INTEGER_64_SWAP(CType) \
|
|
744
728
|
do { \
|
|
745
729
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
746
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
730
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
747
731
|
return; \
|
|
748
732
|
} \
|
|
749
733
|
\
|
|
@@ -757,7 +741,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
757
741
|
case PrimitiveKind::Void: {} break;
|
|
758
742
|
case PrimitiveKind::Bool: {
|
|
759
743
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
760
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
744
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
|
|
761
745
|
return;
|
|
762
746
|
}
|
|
763
747
|
|
|
@@ -780,31 +764,15 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
780
764
|
case PrimitiveKind::UInt64S: { RETURN_INTEGER_64_SWAP(uint64_t); } break;
|
|
781
765
|
case PrimitiveKind::String: {
|
|
782
766
|
const char *str;
|
|
783
|
-
if (
|
|
784
|
-
str = PushString(value);
|
|
785
|
-
if (RG_UNLIKELY(!str))
|
|
786
|
-
return;
|
|
787
|
-
} else if (IsNullOrUndefined(value)) {
|
|
788
|
-
str = nullptr;
|
|
789
|
-
} else {
|
|
790
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
767
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
791
768
|
return;
|
|
792
|
-
}
|
|
793
769
|
|
|
794
770
|
out_reg->eax = (uint32_t)str;
|
|
795
771
|
} break;
|
|
796
772
|
case PrimitiveKind::String16: {
|
|
797
773
|
const char16_t *str16;
|
|
798
|
-
if (
|
|
799
|
-
str16 = PushString16(value);
|
|
800
|
-
if (RG_UNLIKELY(!str16))
|
|
801
|
-
return;
|
|
802
|
-
} else if (IsNullOrUndefined(value)) {
|
|
803
|
-
str16 = nullptr;
|
|
804
|
-
} else {
|
|
805
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
774
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
806
775
|
return;
|
|
807
|
-
}
|
|
808
776
|
|
|
809
777
|
out_reg->eax = (uint32_t)str16;
|
|
810
778
|
} break;
|
|
@@ -823,7 +791,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
823
791
|
} else if (IsNullOrUndefined(value)) {
|
|
824
792
|
ptr = nullptr;
|
|
825
793
|
} else {
|
|
826
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
794
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
827
795
|
return;
|
|
828
796
|
}
|
|
829
797
|
|
|
@@ -831,7 +799,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
831
799
|
} break;
|
|
832
800
|
case PrimitiveKind::Record: {
|
|
833
801
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
834
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
802
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
835
803
|
return;
|
|
836
804
|
}
|
|
837
805
|
|
|
@@ -848,7 +816,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
848
816
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
849
817
|
case PrimitiveKind::Float32: {
|
|
850
818
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
851
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
819
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
852
820
|
return;
|
|
853
821
|
}
|
|
854
822
|
|
|
@@ -857,7 +825,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
857
825
|
} break;
|
|
858
826
|
case PrimitiveKind::Float64: {
|
|
859
827
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
860
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
828
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
861
829
|
return;
|
|
862
830
|
}
|
|
863
831
|
|
|
@@ -878,7 +846,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
878
846
|
} else if (IsNullOrUndefined(value)) {
|
|
879
847
|
ptr = nullptr;
|
|
880
848
|
} else {
|
|
881
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
849
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
882
850
|
return;
|
|
883
851
|
}
|
|
884
852
|
|