private GetInferredType ( |
||
inference_target | ||
Résultat | IReflect |
internal override Object Evaluate() { ConstructorInfo c = (ConstructorInfo)((Binding)this.ctor).member; ParameterInfo[] pars = c.GetParameters(); int pn = pars.Length; for (int i = positionalArgValues.Count; i < pn; i++) { positionalArgValues.Add(Convert.CoerceT(null, pars[i].ParameterType)); } Object[] pArgVals = new Object[pn]; positionalArgValues.CopyTo(0, pArgVals, 0, pn); Object ca = c.Invoke(BindingFlags.ExactBinding, null, pArgVals, null); for (int i = 0, n = this.namedArgProperties.Count; i < n; i++) { JSProperty prop = this.namedArgProperties[i] as JSProperty; if (prop != null) { prop.SetValue(ca, Convert.Coerce(this.namedArgPropertyValues[i], prop.PropertyIR()), null); } else { ((PropertyInfo)this.namedArgProperties[i]).SetValue(ca, this.namedArgPropertyValues[i], null); } } for (int i = 0, n = this.namedArgFields.Count; i < n; i++) { JSVariableField field = this.namedArgFields[i] as JSVariableField; if (field != null) { field.SetValue(ca, Convert.Coerce(this.namedArgFieldValues[i], field.GetInferredType(null))); } else { ((FieldInfo)this.namedArgFields[i]).SetValue(ca, this.namedArgFieldValues[i]); } } return(ca); }
internal override object Evaluate() { ConstructorInfo member = (ConstructorInfo)((Binding)this.ctor).member; ParameterInfo[] parameters = member.GetParameters(); int length = parameters.Length; for (int i = this.positionalArgValues.Count; i < length; i++) { this.positionalArgValues.Add(Microsoft.JScript.Convert.CoerceT(null, parameters[i].ParameterType)); } object[] array = new object[length]; this.positionalArgValues.CopyTo(0, array, 0, length); object obj2 = member.Invoke(BindingFlags.ExactBinding, null, array, null); int num3 = 0; int count = this.namedArgProperties.Count; while (num3 < count) { JSProperty property = this.namedArgProperties[num3] as JSProperty; if (property != null) { property.SetValue(obj2, Microsoft.JScript.Convert.Coerce(this.namedArgPropertyValues[num3], property.PropertyIR()), null); } else { ((PropertyInfo)this.namedArgProperties[num3]).SetValue(obj2, this.namedArgPropertyValues[num3], null); } num3++; } int num5 = 0; int num6 = this.namedArgFields.Count; while (num5 < num6) { JSVariableField field = this.namedArgFields[num5] as JSVariableField; if (field != null) { field.SetValue(obj2, Microsoft.JScript.Convert.Coerce(this.namedArgFieldValues[num5], field.GetInferredType(null))); } else { ((FieldInfo)this.namedArgFields[num5]).SetValue(obj2, this.namedArgFieldValues[num5]); } num5++; } return(obj2); }