internal void ResolveAssignmentToDefaultIndexedProperty(ASTList args, IReflect[] argIRs, AST rhvalue) { string str; IReflect reflect = this.InferType(null); Type t = (reflect is Type) ? ((Type)reflect) : null; if (reflect is ClassScope) { t = ((ClassScope)reflect).GetBakedSuperType(); } MemberInfo[] defaultMembers = JSBinder.GetDefaultMembers(t); if ((defaultMembers != null) && (defaultMembers.Length > 0)) { try { PropertyInfo prop = JSBinder.SelectProperty(defaultMembers, argIRs); if (prop == null) { goto Label_00B1; } this.method = JSProperty.GetSetMethod(prop, true); if (this.method == null) { base.context.HandleError(JSError.AssignmentToReadOnly, true); } if (!Binding.CheckParameters(prop.GetIndexParameters(), argIRs, args, base.context, 0, false, true)) { this.method = null; } } catch (AmbiguousMatchException) { base.context.HandleError(JSError.AmbiguousMatch); } return; } Label_00B1: str = (reflect is ClassScope) ? ((ClassScope)reflect).GetName() : ((Type)reflect).Name; base.context.HandleError(JSError.NotIndexable, str); }
internal void ResolveAssignmentToDefaultIndexedProperty(ASTList args, IReflect[] argIRs, AST rhvalue) { IReflect ir = this.InferType(null); Type t = ir is Type ? (Type)ir : null; if (ir is ClassScope) { t = ((ClassScope)ir).GetBakedSuperType(); } MemberInfo[] defaultMembers = JSBinder.GetDefaultMembers(t); if (defaultMembers != null && defaultMembers.Length > 0) { try{ PropertyInfo prop = JSBinder.SelectProperty(defaultMembers, argIRs); //Returns property getters as well if (prop != null) { this.method = JSProperty.GetSetMethod(prop, true); if (this.method == null) { this.context.HandleError(JSError.AssignmentToReadOnly, true); } if (!Binding.CheckParameters(prop.GetIndexParameters(), argIRs, args, this.context, 0, false, true)) { this.method = null; } return; } }catch (AmbiguousMatchException) { this.context.HandleError(JSError.AmbiguousMatch); return; } } String tname = ir is ClassScope ? ((ClassScope)ir).GetName() : ((Type)ir).Name; this.context.HandleError(JSError.NotIndexable, tname); }