internal override void ResolveCall(ASTList args, IReflect[] argIRs, bool constructor, bool brackets)
        {
            string str;

            if (constructor || !brackets)
            {
                if (this.isSuper)
                {
                    base.context.HandleError(JSError.IllegalUseOfSuper);
                    return;
                }
                base.context.HandleError(JSError.IllegalUseOfThis);
                return;
            }
            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
                {
                    this.method = JSBinder.SelectMethod(defaultMembers, argIRs);
                    if (this.method == null)
                    {
                        goto Label_00C5;
                    }
                    if (!Binding.CheckParameters(this.method.GetParameters(), argIRs, args, base.context, 0, false, true))
                    {
                        this.method = null;
                    }
                }
                catch (AmbiguousMatchException)
                {
                    base.context.HandleError(JSError.AmbiguousMatch);
                }
                return;
            }
Label_00C5:
            str = (reflect is ClassScope) ? ((ClassScope)reflect).GetName() : ((Type)reflect).Name;
            base.context.HandleError(JSError.NotIndexable, str);
        }
Beispiel #2
0
        internal override void ResolveCall(ASTList args, IReflect[] argIRs, bool constructor, bool brackets)
        {
            if (constructor || !brackets)
            {
                if (this.isSuper)
                {
                    this.context.HandleError(JSError.IllegalUseOfSuper);
                }
                else
                {
                    this.context.HandleError(JSError.IllegalUseOfThis);
                }
                return;
            }
            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{
                    this.method = JSBinder.SelectMethod(defaultMembers, argIRs); //Returns property getters as well
                    if (this.method != null)
                    {
                        if (!Binding.CheckParameters(this.method.GetParameters(), 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);
        }