@@ -152,7 +152,7 @@ JSValue CppObjectMapper::PushNativeObject(const void* TypeId, void* ObjectPtr, b
152152 {
153153 ClassDefinition = &PtrClassDef;
154154 }
155- JSValue ctor = CreateClass (ClassDefinition);
155+ JSValue ctor = FindOrCreateClass (ClassDefinition);
156156 JSValue proto = JS_GetProperty (ctx, ctor, JS_ATOM_prototype);
157157 JSValue obj = JS_NewObjectProtoClass (ctx, proto, classId);
158158 JS_FreeValue (ctx, proto);
@@ -224,7 +224,7 @@ void CppObjectMapper::InitProperty(puerts::JSPropertyInfo* PropInfo, JSValue Obj
224224 JS_FreeValue (ctx, setter);
225225}
226226
227- JSValue CppObjectMapper::CreateClass (const puerts::JSClassDefinition* ClassDefinition)
227+ JSValue CppObjectMapper::FindOrCreateClass (const puerts::JSClassDefinition* ClassDefinition)
228228{
229229 auto it = TypeIdToFunctionMap.find (ClassDefinition->TypeId );
230230 if (it == TypeIdToFunctionMap.end ())
@@ -312,7 +312,7 @@ JSValue CppObjectMapper::CreateClass(const puerts::JSClassDefinition* ClassDefin
312312 {
313313 if (auto SuperDefinition = puerts::FindClassByID (ClassDefinition->SuperTypeId ))
314314 {
315- JSValue super_func = CreateClass (SuperDefinition);
315+ JSValue super_func = FindOrCreateClass (SuperDefinition);
316316 JSValue parent_proto = JS_GetProperty (ctx, super_func, JS_ATOM_prototype);
317317 JS_SetPrototype (ctx, proto, parent_proto);
318318 JS_FreeValue (ctx, parent_proto);
@@ -326,14 +326,14 @@ JSValue CppObjectMapper::CreateClass(const puerts::JSClassDefinition* ClassDefin
326326 return it->second ;
327327}
328328
329- JSValue CppObjectMapper::CreateClassByID (const void * typeId)
329+ JSValue CppObjectMapper::FindOrCreateClassByID (const void * typeId)
330330{
331331 auto clsDef = puerts::LoadClassByID (typeId);
332332 if (!clsDef)
333333 {
334334 return JS_UNDEFINED;
335335 }
336- return CreateClass (clsDef);
336+ return FindOrCreateClass (clsDef);
337337}
338338
339339void CppObjectMapper::Initialize (JSContext* ctx_)
0 commit comments