Пример #1
0
 internal void AnyTranslator(IntPtr isolate, ISetValueToJs setValueApi, IntPtr holder, object obj)
 {
     if (obj == null)
     {
         setValueApi.SetNull(isolate, holder);
     }
     else
     {
         Type realType = obj.GetType();
         if (realType == typeof(object))
         {
             int typeId   = typeRegister.GetTypeId(isolate, realType);
             int objectId = objectPool.FindOrAddObject(obj);
             setValueApi.SetObject(isolate, holder, typeId, new IntPtr(objectId));
         }
         else
         {
             GetTranslateFunc(realType)(isolate, setValueApi, holder, obj);
         }
     }
 }
Пример #2
0
        internal IntPtr InvokeConstructor(IntPtr isolate, int callbackIdx, IntPtr info, int paramLen)
        {
            object obj = constructorCallbacks[callbackIdx](isolate, info, paramLen);

            if (obj == null)
            {
                return(IntPtr.Zero);
            }
            int objectId = objectPool.FindOrAddObject(obj);

            return(new IntPtr(objectId));
        }