private static void WrapMembers(MemberInfo[] members) { int index = 0; int length = members.Length; while (index < length) { MemberInfo info = members[index]; MemberTypes memberType = info.MemberType; if (memberType != MemberTypes.Field) { if (memberType == MemberTypes.Method) { goto Label_0032; } if (memberType == MemberTypes.Property) { goto Label_0042; } } else { members[index] = new JSFieldInfo((FieldInfo)info); } goto Label_0050; Label_0032: members[index] = new JSMethodInfo((MethodInfo)info); goto Label_0050; Label_0042: members[index] = new JSPropertyInfo((PropertyInfo)info); Label_0050: index++; } }
public FieldInfo AddField(string name) { JSFieldInfo fi = new JSFieldInfo(name); elems.Add(name, fi); return(fi); }
private static bool TryDirectGetObjectProperty(out object result, object obj, string rhs) { ArrayObject ary = obj as ArrayObject; StringObject str = obj as StringObject; ScriptObject js_obj = obj as ScriptObject; if (js_obj != null) { Hashtable elems = js_obj.elems; // Numeric index? uint index; if (IsArrayIndex(rhs, out index)) { if (ary != null) { result = elems [index]; return(true); } else if (str != null) { string str_val = str.value; if (index < str_val.Length) { result = str_val.Substring((int)index, 1); } else { result = null; } return(true); } } if (elems.ContainsKey(rhs)) { object val = elems [rhs]; JSFieldInfo field = val as JSFieldInfo; if (field != null) { result = field.GetValue(rhs); } else { result = val; } return(true); } } bool success = TryGetNativeProperty(out result, obj, rhs); return(success); }
internal void AddField(object name, object value) { string str_name = Convert.ToString(name); if (proper_array_index(str_name)) { JSFieldInfo field = (JSFieldInfo)AddField(str_name); field.SetValue(str_name, value); } else { throw new Exception("Not a valid index array"); } }
private static void WrapMembers(MemberInfo[] members) { for (int i = 0, n = members.Length; i < n; i++) { MemberInfo mem = members[i]; switch (mem.MemberType) { case MemberTypes.Field: members[i] = new JSFieldInfo((FieldInfo)mem); break; case MemberTypes.Method: members[i] = new JSMethodInfo((MethodInfo)mem); break; case MemberTypes.Property: members[i] = new JSPropertyInfo((PropertyInfo)mem); break; } } }
public FieldInfo AddField (string name) { JSFieldInfo fi = new JSFieldInfo (name); elems.Add (name, fi); return fi; }
private static void WrapMembers(MemberInfo[] members){ for (int i = 0, n = members.Length; i < n; i++){ MemberInfo mem = members[i]; switch (mem.MemberType){ case MemberTypes.Field: members[i] = new JSFieldInfo((FieldInfo)mem); break; case MemberTypes.Method: members[i] = new JSMethodInfo((MethodInfo)mem); break; case MemberTypes.Property: members[i] = new JSPropertyInfo((PropertyInfo)mem); break; } } }
private static void WrapMembers(MemberInfo[] members) { int index = 0; int length = members.Length; while (index < length) { MemberInfo info = members[index]; MemberTypes memberType = info.MemberType; if (memberType != MemberTypes.Field) { if (memberType == MemberTypes.Method) { goto Label_0032; } if (memberType == MemberTypes.Property) { goto Label_0042; } } else { members[index] = new JSFieldInfo((FieldInfo) info); } goto Label_0050; Label_0032: members[index] = new JSMethodInfo((MethodInfo) info); goto Label_0050; Label_0042: members[index] = new JSPropertyInfo((PropertyInfo) info); Label_0050: index++; } }