Microsoft.CSharp.RuntimeBinder.RuntimeBinder.CheckForConditionalMethodError C# (CSharp) Method

CheckForConditionalMethodError() private method

private CheckForConditionalMethodError ( EXPR pExpr ) : void
pExpr Microsoft.CSharp.RuntimeBinder.Semantics.EXPR
return void
        private void CheckForConditionalMethodError(EXPR pExpr)
        {
            Debug.Assert(pExpr.isCALL());
            if (pExpr.isCALL())
            {
                // This mimics the behavior of the native CompilerSymbolLoader in GetConditionalSymbols. Override
                // methods cannot have the conditional attribute, but implicitly acquire it from their slot.

                EXPRCALL call = pExpr.asCALL();

                MethodSymbol method = call.mwi.Meth();
                if (method.isOverride)
                {
                    method = method.swtSlot.Meth();
                }

                object[] conditions = method.AssociatedMemberInfo.GetCustomAttributes(typeof(ConditionalAttribute), false).ToArray();
                if (conditions.Length > 0)
                {
                    throw Error.BindCallToConditionalMethod(method.name);
                }
            }
        }