Exemplo n.º 1
0
        public JsInstance WrapSpecialType(Type value, JsObject prototypePropertyPrototype)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            NativeConstructor nativeConstructor = new NativeConstructor(value, this.Global, prototypePropertyPrototype, this.PrototypeProperty);

            nativeConstructor.InitPrototype(this.Global);
            this.SetupNativeProperties((JsDictionaryObject)nativeConstructor);
            return((JsInstance)nativeConstructor);
        }
Exemplo n.º 2
0
        public JsInstance WrapSpecialType(Type value, JsObject prototypePropertyPrototype)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }


            NativeConstructor res;

            res = new NativeConstructor(value as Type, Global, prototypePropertyPrototype, PrototypeProperty);
            res.InitPrototype(Global);
            SetupNativeProperties(res);
            return(res);
        }
Exemplo n.º 3
0
 public override JsInstance Wrap <T>(T value)
 {
     if ((object)value == null)
     {
         throw new ArgumentNullException(nameof(value));
     }
     if ((object)value is Type)
     {
         NativeConstructor nativeConstructor = new NativeConstructor((object)value as Type, this.Global, (JsObject)null, this.PrototypeProperty);
         nativeConstructor.InitPrototype(this.Global);
         this.SetupNativeProperties((JsDictionaryObject)nativeConstructor);
         return((JsInstance)nativeConstructor);
     }
     throw new JintException("Attempt to wrap '" + value.GetType().FullName + "' with '" + typeof(Type).FullName + "'");
 }
Exemplo n.º 4
0
        public override JsInstance Wrap <T>(T value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            if (value is Type)
            {
                NativeConstructor res;
                res = new NativeConstructor(value as Type, Global, null, PrototypeProperty);
                res.InitPrototype(Global);
                SetupNativeProperties(res);
                return(res);
            }
            else
            {
                throw new JintException("Attempt to wrap '" + value.GetType().FullName + "' with '" + typeof(Type).FullName + "'");
            }
        }