Ejemplo n.º 1
0
        public static JSValue _DynamicMethodInvoke(JSContext ctx, JSValue this_obj, int argc, JSValue[] argv, int magic)
        {
            var typeDB = ScriptEngine.GetTypeDB(ctx);

            if (typeDB == null)
            {
                return(JSApi.JS_ThrowInternalError(ctx, "type db is null"));
            }

            var method = typeDB.GetDynamicMethod(magic);

            if (method != null)
            {
                try
                {
                    return(method.Invoke(ctx, this_obj, argc, argv));
                }
                catch (Exception exception)
                {
                    return(JSApi.ThrowException(ctx, exception));
                }
            }

            return(JSApi.JS_ThrowInternalError(ctx, "dynamic method not found"));
        }
Ejemplo n.º 2
0
        public static JSValue _DynamicFieldSetter(JSContext ctx, JSValue this_obj, JSValue val, int magic)
        {
            var typeDB = ScriptEngine.GetTypeDB(ctx);

            if (typeDB == null)
            {
                return(JSApi.JS_ThrowInternalError(ctx, "type db is null"));
            }

            var field = typeDB.GetDynamicField(magic);

            if (field != null)
            {
                try
                {
                    return(field.SetValue(ctx, this_obj, val));
                }
                catch (Exception exception)
                {
                    return(JSApi.ThrowException(ctx, exception));
                }
            }

            return(JSApi.JS_ThrowInternalError(ctx, "dynamic field not found"));
        }
Ejemplo n.º 3
0
 public static JSValue class_private_ctor(JSContext ctx, JSValue new_target, int argc, JSValue[] argv, int magic)
 {
     return(JSApi.JS_ThrowInternalError(ctx, "cant call constructor on this type"));
 }