Prop() public method

public Prop ( ) : Microsoft.CSharp.RuntimeBinder.Semantics.PropertySymbol
return Microsoft.CSharp.RuntimeBinder.Semantics.PropertySymbol
Esempio n. 1
0
        private void ReportBogus(SymWithType swt)
        {
            Debug.Assert(swt.Sym.hasBogus() && swt.Sym.checkBogus());

            switch (swt.Sym.getKind())
            {
            case SYMKIND.SK_EventSymbol:
                break;

            case SYMKIND.SK_PropertySymbol:
                if (swt.Prop().useMethInstead)
                {
                    MethodSymbol meth1 = swt.Prop().methGet;
                    MethodSymbol meth2 = swt.Prop().methSet;
                    ReportBogusForEventsAndProperties(swt, meth1, meth2);
                    return;
                }
                break;

            case SYMKIND.SK_MethodSymbol:
                if (swt.Meth().name == NameManager.GetPredefinedName(PredefinedName.PN_INVOKE) && swt.Meth().getClass().IsDelegate())
                {
                    swt.Set(swt.Meth().getClass(), swt.GetType());
                }
                break;

            default:
                break;
            }

            // Generic bogus error.
            GetErrorContext().ErrorRef(ErrorCode.ERR_BindToBogus, swt);
        }
Esempio n. 2
0
        private static RuntimeBinderException ReportBogus(SymWithType swt)
        {
            Debug.Assert(CSemanticChecker.CheckBogus(swt.Sym));
            MethodSymbol meth1 = swt.Prop().GetterMethod;
            MethodSymbol meth2 = swt.Prop().SetterMethod;

            Debug.Assert((meth1 ?? meth2) != null);
            return(meth1 == null | meth2 == null
                ? ErrorHandling.Error(
                       ErrorCode.ERR_BindToBogusProp1, swt.Sym.name, new SymWithType(meth1 ?? meth2, swt.GetType()),
                       new ErrArgRefOnly(swt.Sym))
                : ErrorHandling.Error(
                       ErrorCode.ERR_BindToBogusProp2, swt.Sym.name, new SymWithType(meth1, swt.GetType()),
                       new SymWithType(meth2, swt.GetType()), new ErrArgRefOnly(swt.Sym)));
        }
Esempio n. 3
0
        private void ReportBogus(SymWithType swt)
        {
            Debug.Assert(CSemanticChecker.CheckBogus(swt.Sym));
            MethodSymbol meth1 = swt.Prop().GetterMethod;
            MethodSymbol meth2 = swt.Prop().SetterMethod;

            Debug.Assert((meth1 ?? meth2) != null);
            if (meth1 == null | meth2 == null)
            {
                GetErrorContext().Error(
                    ErrorCode.ERR_BindToBogusProp1, swt.Sym.name, new SymWithType(meth1 ?? meth2, swt.GetType()),
                    new ErrArgRefOnly(swt.Sym));
            }
            else
            {
                GetErrorContext().Error(
                    ErrorCode.ERR_BindToBogusProp2, swt.Sym.name, new SymWithType(meth1, swt.GetType()),
                    new SymWithType(meth2, swt.GetType()), new ErrArgRefOnly(swt.Sym));
            }
        }
Esempio n. 4
0
        /////////////////////////////////////////////////////////////////////////////////

        private EXPR CreateProperty(
            SymWithType swt,
            EXPR callingObject,
            BindingFlag flags)
        {
            // For a property, we simply create the EXPRPROP for the thing, call the
            // expression tree rewriter, rewrite it, and send it on its way.

            PropertySymbol property = swt.Prop();
            AggregateType propertyType = swt.GetType();
            PropWithType pwt = new PropWithType(property, propertyType);
            EXPRMEMGRP pMemGroup = CreateMemberGroupEXPR(property.name.Text, null, callingObject, SYMKIND.SK_PropertySymbol);

            return _binder.BindToProperty(// For a static property instance, don't set the object.
                    callingObject.isCLASS() ? null : callingObject, pwt, flags, null, null, pMemGroup);
        }
Esempio n. 5
0
        private void ReportBogus(SymWithType swt)
        {
            Debug.Assert(swt.Sym.hasBogus() && swt.Sym.checkBogus());

            switch (swt.Sym.getKind())
            {
                case SYMKIND.SK_EventSymbol:
                    break;

                case SYMKIND.SK_PropertySymbol:
                    if (swt.Prop().useMethInstead)
                    {
                        MethodSymbol meth1 = swt.Prop().methGet;
                        MethodSymbol meth2 = swt.Prop().methSet;
                        ReportBogusForEventsAndProperties(swt, meth1, meth2);
                        return;
                    }
                    break;

                case SYMKIND.SK_MethodSymbol:
                    if (swt.Meth().name == GetSymbolLoader().GetNameManager().GetPredefName(PredefinedName.PN_INVOKE) && swt.Meth().getClass().IsDelegate())
                    {
                        swt.Set(swt.Meth().getClass(), swt.GetType());
                    }
                    break;

                default:
                    break;
            }

            // Generic bogus error.
            GetErrorContext().ErrorRef(ErrorCode.ERR_BindToBogus, swt);
        }