godotjs / godotjs/GodotJS

jsb_check(class_info->name == p_type_name) Is this a bug?

Open
#231 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
765
Forks
46
PR merge metrics
No merged PRs in 30d

Description

jsb_godot_module_loader.cpp
if (const NativeClassInfoPtr class_info = env->expose_godot_object_class(ClassDB::classes.getptr(original_name)))
{
jsb_check(class_info->name == p_type_name);
jsb_check(!class_info->clazz.IsEmpty());
info.GetReturnValue().Set(class_info->clazz.Get(isolate));
return;
}
this line jsb_check(class_info->name == p_type_name);
Will accessing require("godot").GObject in JavaScript trigger an assertion failure, given that it is merely an alias?
const HashMap pascal_case_name_overrides = _create_hashmap_from_vector({
{ "BitMap", "Bitmap" },
{ "JSONRPC", "JsonRpc" },
{ "Object", "GObject" },
{ "Dictionary", "GDictionary" },
{ "Error", "GError" },
{ "Array", "GArray" },
{ "OpenXRIPBinding", "OpenXRIPBinding" },
{ "OpenXRIPBindingModifier", "OpenXRIPBindingModifier" },
{ "SkeletonModification2DCCDIK", "SkeletonModification2DCcdik" },
{ "SkeletonModification2DFABRIK", "SkeletonModification2DFabrik" },
{ "SkeletonModification3DCCDIK", "SkeletonModification3DCcdik" },
{ "SkeletonModification3DFABRIK", "SkeletonModification3DFabrik" },
});

Contributor guide

Open the contributing guide

Research direction

Read jsb_godot_module_loader.cpp at the expose_godot_object_class path and compare class_info->name with the pascal_case_name_overrides entries, especially the Object/GObject alias. Reproduce require("godot").GObject and check whether jsb_check(class_info->name == p_type_name) asserts; done means the alias loads without an assertion or the issue is confirmed with its cause documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, javascript
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.