當前位置: 首頁>>代碼示例>>C#>>正文


C# Semantics.CType類代碼示例

本文整理匯總了C#中Microsoft.CSharp.RuntimeBinder.Semantics.CType的典型用法代碼示例。如果您正苦於以下問題:C# CType類的具體用法?C# CType怎麽用?C# CType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CType類屬於Microsoft.CSharp.RuntimeBinder.Semantics命名空間,在下文中一共展示了CType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CheckAccess2

        public virtual ACCESSERROR CheckAccess2(Symbol symCheck, AggregateType atsCheck, Symbol symWhere, CType typeThru)
        {
            Debug.Assert(symCheck != null);
            Debug.Assert(atsCheck == null || symCheck.parent == atsCheck.getAggregate());
            Debug.Assert(typeThru == null ||
                   typeThru.IsAggregateType() ||
                   typeThru.IsTypeParameterType() ||
                   typeThru.IsArrayType() ||
                   typeThru.IsNullableType() ||
                   typeThru.IsErrorType());

#if DEBUG

            switch (symCheck.getKind())
            {
                default:
                    break;
                case SYMKIND.SK_MethodSymbol:
                case SYMKIND.SK_PropertySymbol:
                case SYMKIND.SK_FieldSymbol:
                case SYMKIND.SK_EventSymbol:
                    Debug.Assert(atsCheck != null);
                    break;
            }

#endif // DEBUG

            ACCESSERROR error = CheckAccessCore(symCheck, atsCheck, symWhere, typeThru);
            if (ACCESSERROR.ACCESSERROR_NOERROR != error)
            {
                return error;
            }

            // Check the accessibility of the return CType.
            CType CType = symCheck.getType();
            if (CType == null)
            {
                return ACCESSERROR.ACCESSERROR_NOERROR;
            }

            // For members of AGGSYMs, atsCheck should always be specified!
            Debug.Assert(atsCheck != null);

            if (atsCheck.getAggregate().IsSource())
            {
                // We already check the "at least as accessible as" rules.
                // Does this always work for generics?
                // Could we get a bad CType argument in typeThru?
                // Maybe call CheckTypeAccess on typeThru?
                return ACCESSERROR.ACCESSERROR_NOERROR;
            }

            // Substitute on the CType.
            if (atsCheck.GetTypeArgsAll().size > 0)
            {
                CType = SymbolLoader.GetTypeManager().SubstType(CType, atsCheck);
            }

            return CheckTypeAccess(CType, symWhere) ? ACCESSERROR.ACCESSERROR_NOERROR : ACCESSERROR.ACCESSERROR_NOACCESS;
        }
開發者ID:ChuangYang,項目名稱:corefx,代碼行數:60,代碼來源:SemanticChecker.cs

示例2: CheckForStaticClass

 // Generate an error if CType is static.
 public bool CheckForStaticClass(Symbol symCtx, CType CType, ErrorCode err)
 {
     if (!CType.isStaticClass())
         return false;
     ReportStaticClassError(symCtx, CType, err);
     return true;
 }
開發者ID:ChuangYang,項目名稱:corefx,代碼行數:8,代碼來源:SemanticChecker.cs

示例3: CMethodIterator

 public CMethodIterator(CSemanticChecker checker, SymbolLoader symLoader, Name name, TypeArray containingTypes, CType @object, CType qualifyingType, Declaration context, bool allowBogusAndInaccessible, bool allowExtensionMethods, int arity, EXPRFLAG flags, symbmask_t mask)
 {
     Debug.Assert(name != null);
     Debug.Assert(symLoader != null);
     Debug.Assert(checker != null);
     Debug.Assert(containingTypes != null);
     _pSemanticChecker = checker;
     _pSymbolLoader = symLoader;
     _pCurrentType = null;
     _pCurrentSym = null;
     _pName = name;
     _pContainingTypes = containingTypes;
     _pQualifyingType = qualifyingType;
     _pContext = context;
     _bAllowBogusAndInaccessible = allowBogusAndInaccessible;
     _bAllowExtensionMethods = allowExtensionMethods;
     _nArity = arity;
     _flags = flags;
     _mask = mask;
     _nCurrentTypeCount = 0;
     _bIsCheckingInstanceMethods = true;
     _bAtEnd = false;
     _bCurrentSymIsBogus = false;
     _bCurrentSymIsInaccessible = false;
     _bcanIncludeExtensionsInResults = _bAllowExtensionMethods;
     _bEndIterationAtCurrentExtensionList = false;
 }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:27,代碼來源:MethodIterator.cs

示例4: CopyItems

 public void CopyItems(int i, int c, CType[] dest)
 {
     for (int j = 0; j < c; ++j)
     {
         dest[j] = _items[i + j];
     }
 }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:7,代碼來源:TypeArray.cs

示例5: GetMethodIterator

 public CMethodIterator GetMethodIterator(
     CSemanticChecker pChecker, SymbolLoader pSymLoader, CType pObject, CType pQualifyingType, Declaration pContext, bool allowBogusAndInaccessible, bool allowExtensionMethods, int arity, EXPRFLAG flags, symbmask_t mask)
 {
     Debug.Assert(pSymLoader != null);
     CMethodIterator iterator = new CMethodIterator(pChecker, pSymLoader, _pName, ContainingTypes, pObject, pQualifyingType, pContext, allowBogusAndInaccessible, allowExtensionMethods, arity, flags, mask);
     return iterator;
 }
開發者ID:dotnet,項目名稱:corefx,代碼行數:7,代碼來源:MemberLookupResults.cs

示例6: TypeArray

 public TypeArray(CType[] types)
 {
     _items = types;
     if (_items == null)
     {
         _items = Array.Empty<CType>();
     }
 }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:8,代碼來源:TypeArray.cs

示例7: SubstContext

 public SubstContext(CType[] prgtypeCls, int ctypeCls, CType[] prgtypeMeth, int ctypeMeth, SubstTypeFlags grfst)
 {
     this.prgtypeCls = prgtypeCls;
     this.ctypeCls = ctypeCls;
     this.prgtypeMeth = prgtypeMeth;
     this.ctypeMeth = ctypeMeth;
     this.grfst = grfst;
 }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:8,代碼來源:SubstitutionContext.cs

示例8: ImplicitConversion

 public ImplicitConversion(ExpressionBinder binder, EXPR exprSrc, CType typeSrc, EXPRTYPEORNAMESPACE typeDest, bool needsExprDest, CONVERTTYPE flags)
 {
     _binder = binder;
     _exprSrc = exprSrc;
     _typeSrc = typeSrc;
     _typeDest = typeDest.TypeOrNamespace.AsType();
     _exprTypeDest = typeDest;
     _needsExprDest = needsExprDest;
     _flags = flags;
     _exprDest = null;
 }
開發者ID:dotnet,項目名稱:corefx,代碼行數:11,代碼來源:ImplicitConversion.cs

示例9: CreateFunctionPointer

 public EXPRFUNCPTR CreateFunctionPointer(EXPRFLAG nFlags, CType pType, EXPR pObject, MethWithInst MWI)
 {
     Debug.Assert(0 == (nFlags & ~(EXPRFLAG.EXF_BASECALL)));
     EXPRFUNCPTR rval = new EXPRFUNCPTR();
     rval.kind = ExpressionKind.EK_FUNCPTR;
     rval.type = pType;
     rval.flags = nFlags;
     rval.OptionalObject = pObject;
     rval.mwi = new MethWithInst(MWI);
     Debug.Assert(rval != null);
     return (rval);
 }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:12,代碼來源:ExprFactory.cs

示例10: ExplicitConversion

            // ----------------------------------------------------------------------------
            // BindExplicitConversion
            // ----------------------------------------------------------------------------

            public ExplicitConversion(ExpressionBinder binder, EXPR exprSrc, CType typeSrc, EXPRTYPEORNAMESPACE typeDest, CType pDestinationTypeForLambdaErrorReporting, bool needsExprDest, CONVERTTYPE flags)
            {
                _binder = binder;
                _exprSrc = exprSrc;
                _typeSrc = typeSrc;
                _typeDest = typeDest.TypeOrNamespace.AsType();
                _pDestinationTypeForLambdaErrorReporting = pDestinationTypeForLambdaErrorReporting;
                _exprTypeDest = typeDest;
                _needsExprDest = needsExprDest;
                _flags = flags;
                _exprDest = null;
            }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:16,代碼來源:ExplicitConversion.cs

示例11: TypeContainsAnonymousTypes

        public static bool TypeContainsAnonymousTypes(CType type)
        {
            CType ctype = (CType)type;

        LRecurse:  // Label used for "tail" recursion.
            switch (ctype.GetTypeKind())
            {
                default:
                    Debug.Assert(false, "Bad Symbol kind in TypeContainsAnonymousTypes");
                    return false;

                case TypeKind.TK_NullType:
                case TypeKind.TK_VoidType:
                case TypeKind.TK_NullableType:
                case TypeKind.TK_TypeParameterType:
                case TypeKind.TK_UnboundLambdaType:
                case TypeKind.TK_MethodGroupType:
                    return false;

                case TypeKind.TK_ArrayType:
                case TypeKind.TK_ParameterModifierType:
                case TypeKind.TK_PointerType:
                    ctype = (CType)ctype.GetBaseOrParameterOrElementType();
                    goto LRecurse;

                case TypeKind.TK_AggregateType:
                    if (ctype.AsAggregateType().getAggregate().IsAnonymousType())
                    {
                        return true;
                    }

                    TypeArray typeArgsAll = ctype.AsAggregateType().GetTypeArgsAll();
                    for (int i = 0; i < typeArgsAll.size; i++)
                    {
                        CType typeArg = typeArgsAll.Item(i);

                        if (TypeContainsAnonymousTypes(typeArg))
                        {
                            return true;
                        }
                    }
                    return false;

                case TypeKind.TK_ErrorType:
                    if (ctype.AsErrorType().HasTypeParent())
                    {
                        ctype = ctype.AsErrorType().GetTypeParent();
                        goto LRecurse;
                    }
                    return false;
            }
        }
開發者ID:ChuangYang,項目名稱:corefx,代碼行數:52,代碼來源:TypeManager.cs

示例12: BinOpFullSig

 public BinOpFullSig(CType type1, CType type2, PfnBindBinOp pfn, OpSigFlags grfos,
     LiftFlags grflt, BinOpFuncKind fnkind)
 {
     this.pt1 = PredefinedType.PT_UNDEFINEDINDEX;
     this.pt2 = PredefinedType.PT_UNDEFINEDINDEX;
     this.mask = BinOpMask.None;
     this.cbosSkip = 0;
     this.pfn = pfn;
     this.grfos = grfos;
     _type1 = type1;
     _type2 = type2;
     _grflt = grflt;
     this.fnkind = fnkind;
 }
開發者ID:dotnet,項目名稱:corefx,代碼行數:14,代碼來源:BinOpSig.cs

示例13: CreateField

 public EXPRFIELD CreateField(EXPRFLAG nFlags, CType pType, EXPR pOptionalObject, uint nOffset, FieldWithType FWT, EXPR pOptionalLHS)
 {
     Debug.Assert(0 == (nFlags & ~(EXPRFLAG.EXF_MEMBERSET | EXPRFLAG.EXF_MASK_ANY)));
     EXPRFIELD rval = new EXPRFIELD();
     rval.kind = ExpressionKind.EK_FIELD;
     rval.type = pType;
     rval.flags = nFlags;
     rval.SetOptionalObject(pOptionalObject);
     if (FWT != null)
     {
         rval.fwt = FWT;
     }
     Debug.Assert(rval != null);
     return (rval);
 }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:15,代碼來源:ExprFactory.cs

示例14: GetAts

        public AggregateType GetAts(ErrorHandling errorContext)
        {
            AggregateSymbol aggNullable = typeManager.GetNullable();
            if (aggNullable == null)
            {
                throw Error.InternalCompilerError();
            }

            if (ats == null)
            {
                CType typePar = GetUnderlyingType();
                CType[] typeParArray = new CType[] { typePar };
                TypeArray ta = symmgr.AllocParams(1, typeParArray);
                ats = typeManager.GetAggregate(aggNullable, ta);
            }
            return ats;
        }
開發者ID:dotnet,項目名稱:corefx,代碼行數:17,代碼來源:NullableType.cs

示例15: CreateCall

        public EXPRCALL CreateCall(EXPRFLAG nFlags, CType pType, EXPR pOptionalArguments, EXPRMEMGRP pMemberGroup, MethWithInst MWI)
        {
            Debug.Assert(0 == (nFlags &
               ~(
                   EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_CONSTRAINED | EXPRFLAG.EXF_BASECALL |
                   EXPRFLAG.EXF_NEWSTRUCTASSG |
                   EXPRFLAG.EXF_IMPLICITSTRUCTASSG | EXPRFLAG.EXF_MASK_ANY
               )
              ));

            EXPRCALL rval = new EXPRCALL();
            rval.kind = ExpressionKind.EK_CALL;
            rval.type = pType;
            rval.flags = nFlags;
            rval.SetOptionalArguments(pOptionalArguments);
            rval.SetMemberGroup(pMemberGroup);
            rval.nubLiftKind = NullableCallLiftKind.NotLifted;
            rval.castOfNonLiftedResultToLiftedType = null;

            rval.mwi = MWI;
            Debug.Assert(rval != null);
            return (rval);
        }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:23,代碼來源:ExprFactory.cs


注:本文中的Microsoft.CSharp.RuntimeBinder.Semantics.CType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。