internal BuiltinFunction(string name, object obj, MethodInfo method, ScriptFunction parent) : base(parent, name) { base.noExpando = false; ParameterInfo[] parameters = method.GetParameters(); base.ilength = parameters.Length; object[] objArray = Microsoft.JScript.CustomAttribute.GetCustomAttributes(method, typeof(JSFunctionAttribute), false); JSFunctionAttribute attribute = (objArray.Length > 0) ? ((JSFunctionAttribute)objArray[0]) : new JSFunctionAttribute(JSFunctionAttributeEnum.None); JSFunctionAttributeEnum attributeValue = attribute.attributeValue; if ((attributeValue & JSFunctionAttributeEnum.HasThisObject) != JSFunctionAttributeEnum.None) { base.ilength--; } if ((attributeValue & JSFunctionAttributeEnum.HasEngine) != JSFunctionAttributeEnum.None) { base.ilength--; } if ((attributeValue & JSFunctionAttributeEnum.HasVarArgs) != JSFunctionAttributeEnum.None) { base.ilength--; } this.biFunc = attribute.builtinFunction; if (this.biFunc == JSBuiltin.None) { this.method = new JSNativeMethod(method, obj, base.engine); } else { this.method = null; } }
internal BuiltinFunction(String name, Object obj, MethodInfo method, ScriptFunction parent) : base(parent, name) { this.noExpando = false; ParameterInfo[] pars = method.GetParameters(); int n = this.ilength = pars.Length; Object[] attrs = CustomAttribute.GetCustomAttributes(method, typeof(JSFunctionAttribute), false); JSFunctionAttribute attr = attrs.Length > 0 ? (JSFunctionAttribute)attrs[0] : new JSFunctionAttribute((JSFunctionAttributeEnum)0); JSFunctionAttributeEnum attrVal = attr.attributeValue; if ((attrVal & JSFunctionAttributeEnum.HasThisObject) != 0) { this.ilength--; } if ((attrVal & JSFunctionAttributeEnum.HasEngine) != 0) { this.ilength--; } if ((attrVal & JSFunctionAttributeEnum.HasVarArgs) != 0) { this.ilength--; } this.biFunc = attr.builtinFunction; if (this.biFunc == 0) { this.method = new JSNativeMethod(method, obj, this.engine); } else { this.method = null; } }
internal JSNativeMethod(MethodInfo method, object obj, VsaEngine engine) : base(obj) { this.method = method; this.formalParams = method.GetParameters(); object[] objArray = Microsoft.JScript.CustomAttribute.GetCustomAttributes(method, typeof(JSFunctionAttribute), false); JSFunctionAttribute attribute = (objArray.Length > 0) ? ((JSFunctionAttribute)objArray[0]) : new JSFunctionAttribute(JSFunctionAttributeEnum.None); JSFunctionAttributeEnum attributeValue = attribute.attributeValue; if ((attributeValue & JSFunctionAttributeEnum.HasThisObject) != JSFunctionAttributeEnum.None) { this.hasThis = true; } if ((attributeValue & JSFunctionAttributeEnum.HasEngine) != JSFunctionAttributeEnum.None) { this.hasEngine = true; } if ((attributeValue & JSFunctionAttributeEnum.HasVarArgs) != JSFunctionAttributeEnum.None) { this.hasVarargs = true; } this.engine = engine; }
internal JSNativeMethod(MethodInfo method, Object obj, VsaEngine engine) : base(obj) { this.method = method; this.formalParams = method.GetParameters(); Object[] attrs = CustomAttribute.GetCustomAttributes(method, typeof(JSFunctionAttribute), false); JSFunctionAttribute attr = attrs.Length > 0 ? (JSFunctionAttribute)attrs[0] : new JSFunctionAttribute((JSFunctionAttributeEnum)0); JSFunctionAttributeEnum attrVal = attr.attributeValue; if ((attrVal & JSFunctionAttributeEnum.HasThisObject) != 0) { this.hasThis = true; } if ((attrVal & JSFunctionAttributeEnum.HasEngine) != 0) { this.hasEngine = true; } if ((attrVal & JSFunctionAttributeEnum.HasVarArgs) != 0) { this.hasVarargs = true; } this.engine = engine; }