当前位置: 首页>>代码示例>>C#>>正文


C# AssemblySymbol类代码示例

本文整理汇总了C#中AssemblySymbol的典型用法代码示例。如果您正苦于以下问题:C# AssemblySymbol类的具体用法?C# AssemblySymbol怎么用?C# AssemblySymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AssemblySymbol类属于命名空间,在下文中一共展示了AssemblySymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CopyTypeCustomModifiers

        /// <param name="sourceType">Type that already has custom modifiers.</param>
        /// <param name="destinationType">Same as <paramref name="sourceType"/>, but without custom modifiers.  May differ in object/dynamic.</param>
        /// <param name="refKind"><see cref="RefKind"/> of the parameter of which this is the type (or <see cref="RefKind.None"/> for a return type.</param>
        /// <param name="containingAssembly">The assembly containing the signature referring to the destination type.</param>
        /// <returns><paramref name="destinationType"/> with custom modifiers copied from <paramref name="sourceType"/>.</returns>
        internal static TypeSymbol CopyTypeCustomModifiers(TypeSymbol sourceType, TypeSymbol destinationType, RefKind refKind, AssemblySymbol containingAssembly)
        {
            Debug.Assert(sourceType.Equals(destinationType, TypeCompareKind.AllIgnoreOptions));

            // NOTE: overrides can differ by object/dynamic.  If they do, we'll need to tweak newType before
            // we can use it in place of this.Type.  We do so by computing the dynamic transform flags that
            // code gen uses and then passing them to the dynamic type decoder that metadata reading uses.
            ImmutableArray<bool> flags = CSharpCompilation.DynamicTransformsEncoder.EncodeWithoutCustomModifierFlags(destinationType, refKind);
            TypeSymbol typeWithDynamic = DynamicTypeDecoder.TransformTypeWithoutCustomModifierFlags(sourceType, containingAssembly, refKind, flags);

            TypeSymbol resultType;
            if (destinationType.ContainsTuple() && !sourceType.Equals(destinationType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreDynamic))
            {
                // We also preserve tuple names, if present and different
                ImmutableArray<string> names = CSharpCompilation.TupleNamesEncoder.Encode(destinationType);
                resultType = TupleTypeDecoder.DecodeTupleTypesIfApplicable(typeWithDynamic, containingAssembly, names);
            }
            else
            {
                resultType = typeWithDynamic;
            }

            Debug.Assert(resultType.Equals(sourceType, TypeCompareKind.IgnoreDynamicAndTupleNames)); // Same custom modifiers as source type.
            Debug.Assert(resultType.Equals(destinationType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds)); // Same object/dynamic and tuple names as destination type.
            return resultType;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:31,代码来源:CustomModifierUtils.cs

示例2: SetCorLibrary

        /// <summary>
        /// A helper method for AssemblyManager to set the system assembly, which provides primitive 
        /// types like Object, String, etc., think mscorlib.dll. 
        /// </summary>
        /// <param name="corLibrary"></param>
        internal void SetCorLibrary(
            AssemblySymbol corLibrary)
        {
            Contract.ThrowIfNull(referencedAssemblies);
            Contract.ThrowIfNull(referencedAssemblySymbols);

            if (corLibrary != null && !ReferenceEquals(corLibrary, this.ContainingAssembly))
            {
                bool corLibraryIsOk = false;

                foreach (var asm in referencedAssemblySymbols)
                {
                    if (object.ReferenceEquals(asm, corLibrary))
                    {
                        corLibraryIsOk = true;
                        break;
                    }
                }

                Contract.ThrowIfFalse(corLibraryIsOk);
            }

            System.Diagnostics.Debug.Assert(coreLibrary == null);
            coreLibrary = corLibrary;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:30,代码来源:MetadataOrSourceModuleSymbol.cs

示例3: ResolveBounds

        /// <summary>
        /// Determine the effective base type, effective interface set, and set of type
        /// parameters (excluding cycles) from the type parameter constraints. Conflicts
        /// within the constraints and constraint types are returned as diagnostics.
        /// 'inherited' should be true if the type parameters are from an overridden
        /// generic method. In those cases, additional constraint checks are applied.
        /// </summary>
        public static TypeParameterBounds ResolveBounds(
            this TypeParameterSymbol typeParameter,
            AssemblySymbol corLibrary,
            ConsList<TypeParameterSymbol> inProgress,
            ImmutableArray<TypeSymbol> constraintTypes,
            bool inherited,
            CSharpCompilation currentCompilation,
            DiagnosticBag diagnostics)
        {
            var diagnosticsBuilder = ArrayBuilder<TypeParameterDiagnosticInfo>.GetInstance();
            ArrayBuilder<TypeParameterDiagnosticInfo> useSiteDiagnosticsBuilder = null;
            var bounds = typeParameter.ResolveBounds(corLibrary, inProgress, constraintTypes, inherited, currentCompilation, diagnosticsBuilder, ref useSiteDiagnosticsBuilder);

            if (useSiteDiagnosticsBuilder != null)
            {
                diagnosticsBuilder.AddRange(useSiteDiagnosticsBuilder);
            }

            foreach (var pair in diagnosticsBuilder)
            {
                diagnostics.Add(new CSDiagnostic(pair.DiagnosticInfo, pair.TypeParameter.Locations[0]));
            }

            diagnosticsBuilder.Free();
            return bounds;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:33,代码来源:ConstraintsHelper.cs

示例4: TransformTypeInternal

        private static TypeSymbol TransformTypeInternal(
            TypeSymbol metadataType,
            AssemblySymbol containingAssembly,
            int targetSymbolCustomModifierCount,
            RefKind targetSymbolRefKind,
            ImmutableArray<bool> dynamicTransformFlags,
            bool haveCustomModifierFlags)
        {
            Debug.Assert((object)metadataType != null);
            Debug.Assert((object)containingAssembly != null);
            Debug.Assert(!dynamicTransformFlags.IsDefault);

            if (dynamicTransformFlags.Length == 0)
            {
                return new UnsupportedMetadataTypeSymbol();
            }

            var decoder = new DynamicTypeDecoder(dynamicTransformFlags, haveCustomModifierFlags, containingAssembly);

            // Native compiler encodes bools (always false) for custom modifiers and parameter ref-kinds, if ref-kind is ref or out.
            if (decoder.HandleCustomModifiers(targetSymbolCustomModifierCount) && decoder.HandleParameterRefKind(targetSymbolRefKind))
            {
                TypeSymbol transformedType = decoder.TransformType(metadataType);

                if ((object)transformedType != null && decoder.index == dynamicTransformFlags.Length)
                {
                    return transformedType;
                }
            }

            // We ignore the dynamic transformation and return unchanged metadataType to match Dev11 behavior.
            return metadataType;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:33,代码来源:DynamicTypeDecoder.cs

示例5: CopyTypeCustomModifiers

        /// <param name="sourceType">Type that already has custom modifiers.</param>
        /// <param name="destinationType">Same as <paramref name="sourceType"/>, but without custom modifiers.  May differ in object/dynamic.</param>
        /// <param name="refKind"><see cref="RefKind"/> of the parameter of which this is the type (or <see cref="RefKind.None"/> for a return type.</param>
        /// <param name="containingAssembly">The assembly containing the signature referring to the destination type.</param>
        /// <returns><paramref name="destinationType"/> with custom modifiers copied from <paramref name="sourceType"/>.</returns>
        internal static TypeSymbol CopyTypeCustomModifiers(TypeSymbol sourceType, TypeSymbol destinationType, RefKind refKind, AssemblySymbol containingAssembly)
        {
            Debug.Assert(sourceType.Equals(destinationType, ignoreCustomModifiersAndArraySizesAndLowerBounds: true, ignoreDynamic: true));

            if (sourceType.ContainsTuple())
            {
                // TODO(https://github.com/dotnet/roslyn/issues/12389):
                // Need to save/restore tupleness as well
                if (sourceType.IsTupleType)
                {
                    Debug.Assert(destinationType.IsTupleType);
                    return destinationType;
                }

                ImmutableArray<bool> flags = CSharpCompilation.DynamicTransformsEncoder.EncodeWithoutCustomModifierFlags(destinationType, refKind);
                TypeSymbol resultType = DynamicTypeDecoder.TransformTypeWithoutCustomModifierFlags(sourceType, containingAssembly, refKind, flags);

                Debug.Assert(resultType.Equals(sourceType, ignoreCustomModifiersAndArraySizesAndLowerBounds: false, ignoreDynamic: true)); // Same custom modifiers as source type.
                return resultType;
            }
            else
            {
                // NOTE: overrides can differ by object/dynamic.  If they do, we'll need to tweak newType before
                // we can use it in place of this.Type.  We do so by computing the dynamic transform flags that
                // code gen uses and then passing them to the dynamic type decoder that metadata reading uses.
                ImmutableArray<bool> flags = CSharpCompilation.DynamicTransformsEncoder.EncodeWithoutCustomModifierFlags(destinationType, refKind);
                TypeSymbol resultType = DynamicTypeDecoder.TransformTypeWithoutCustomModifierFlags(sourceType, containingAssembly, refKind, flags);

                Debug.Assert(resultType.Equals(sourceType, ignoreCustomModifiersAndArraySizesAndLowerBounds: false, ignoreDynamic: true)); // Same custom modifiers as source type.
                Debug.Assert(resultType.Equals(destinationType, ignoreCustomModifiersAndArraySizesAndLowerBounds: true, ignoreDynamic: false)); // Same object/dynamic as destination type.
                return resultType;
            }
        }
开发者ID:xyh413,项目名称:roslyn,代码行数:38,代码来源:CustomModifierUtils.cs

示例6: IsSymbolAccessible

 /// <summary>
 /// Checks if 'symbol' is accessible from within assembly 'within'.  
 /// </summary>
 public static bool IsSymbolAccessible(
     Symbol symbol,
     AssemblySymbol within,
     ref HashSet<DiagnosticInfo> useSiteDiagnostics)
 {
     bool failedThroughTypeCheck;
     return IsSymbolAccessibleCore(symbol, within, null, out failedThroughTypeCheck, within.DeclaringCompilation, ref useSiteDiagnostics);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:11,代码来源:AccessCheck.cs

示例7: UnifiedAssembly

        public UnifiedAssembly(AssemblySymbol targetAssembly, AssemblyIdentity originalReference)
        {
            Debug.Assert(originalReference != null);
            Debug.Assert(targetAssembly != null);

            this.OriginalReference = originalReference;
            this.TargetAssembly = targetAssembly;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:8,代码来源:UnifiedAssembly.cs

示例8: NoPiaAmbiguousCanonicalTypeSymbol

 public NoPiaAmbiguousCanonicalTypeSymbol(
     AssemblySymbol embeddingAssembly,
     NamedTypeSymbol firstCandidate,
     NamedTypeSymbol secondCandidate)
 {
     _embeddingAssembly = embeddingAssembly;
     _firstCandidate = firstCandidate;
     _secondCandidate = secondCandidate;
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:9,代码来源:NoPiaAmbiguousCanonicalTypeSymbol.cs

示例9: TransformTypeWithoutCustomModifierFlags

 internal static TypeSymbol TransformTypeWithoutCustomModifierFlags(
     TypeSymbol type,
     AssemblySymbol containingAssembly,
     RefKind targetSymbolRefKind,
     ImmutableArray<bool> dynamicTransformFlags)
 {
     Debug.Assert(containingAssembly is SourceAssemblySymbol); // Doesn't happen during decoding.
     return TransformTypeInternal(type, containingAssembly, 0, targetSymbolRefKind, dynamicTransformFlags, haveCustomModifierFlags: false);
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:9,代码来源:DynamicTypeDecoder.cs

示例10: SetReferences

        /// <summary>
        /// A helper method for AssemblyManager to set assembly identities for assemblies 
        /// referenced by this module and corresponding AssemblySymbols.
        /// </summary>
        /// <param name="names"></param>
        /// <param name="symbols"></param>
        internal override void SetReferences(
            System.Reflection.AssemblyName[] names,
            AssemblySymbol[] symbols)
        {
            base.SetReferences(names, symbols);

            System.Diagnostics.Debug.Assert(coreLibrary == null);
            coreLibrary = null;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:15,代码来源:MetadataOrSourceModuleSymbol.cs

示例11: MissingModuleSymbol

        public MissingModuleSymbol(AssemblySymbol assembly, int ordinal)
        {
            Debug.Assert((object)assembly != null);
            Debug.Assert(ordinal >= -1);

            this.assembly = assembly;
            this.ordinal = ordinal;
            globalNamespace = new MissingNamespaceSymbol(this);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:9,代码来源:MissingModuleSymbol.cs

示例12: DynamicTypeDecoder

        private DynamicTypeDecoder(ImmutableArray<bool> dynamicTransformFlags, bool haveCustomModifierFlags, AssemblySymbol containingAssembly)
        {
            Debug.Assert(!dynamicTransformFlags.IsEmpty);
            Debug.Assert((object)containingAssembly != null);

            this.dynamicTransformFlags = dynamicTransformFlags;
            this.containingAssembly = containingAssembly;
            this.haveCustomModifierFlags = haveCustomModifierFlags;
            this.index = 0;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:10,代码来源:DynamicTypeDecoder.cs

示例13: DynamicTypeDecoder

        private DynamicTypeDecoder(ImmutableArray<bool> dynamicTransformFlags, bool haveCustomModifierFlags, bool checkLength, AssemblySymbol containingAssembly)
        {
            Debug.Assert(!dynamicTransformFlags.IsEmpty);
            Debug.Assert((object)containingAssembly != null);

            _dynamicTransformFlags = dynamicTransformFlags;
            _containingAssembly = containingAssembly;
            _haveCustomModifierFlags = haveCustomModifierFlags;
            _checkLength = checkLength;
            _index = 0;
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:11,代码来源:DynamicTypeDecoder.cs

示例14: NoPiaMissingCanonicalTypeSymbol

 public NoPiaMissingCanonicalTypeSymbol(
     AssemblySymbol embeddingAssembly,
     string fullTypeName,
     string guid,
     string scope,
     string identifier)
 {
     this.embeddingAssembly = embeddingAssembly;
     this.fullTypeName = fullTypeName;
     this.guid = guid;
     this.scope = scope;
     this.identifier = identifier;
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:13,代码来源:NoPiaMissingCanonicalTypeSymbol.cs

示例15: NoPiaMissingCanonicalTypeSymbol

 public NoPiaMissingCanonicalTypeSymbol(
     AssemblySymbol embeddingAssembly,
     string fullTypeName,
     string guid,
     string scope,
     string identifier)
 {
     _embeddingAssembly = embeddingAssembly;
     _fullTypeName = fullTypeName;
     _guid = guid;
     _scope = scope;
     _identifier = identifier;
 }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:13,代码来源:NoPiaMissingCanonicalTypeSymbol.cs


注:本文中的AssemblySymbol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。