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


C# SyntaxReference类代码示例

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


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

示例1: SourceStrictComplexParameterSymbol

 internal SourceStrictComplexParameterSymbol(
     DiagnosticBag diagnostics,
     Binder binder,
     Symbol owner,
     int ordinal,
     TypeSymbol parameterType,
     RefKind refKind,
     string name,
     ImmutableArray<Location> locations,
     SyntaxReference syntaxRef,
     ConstantValue defaultSyntaxValue,
     bool isParams,
     bool isExtensionMethodThis)
 : base(
     owner: owner,
     ordinal: ordinal,
     parameterType: parameterType,
     refKind: refKind,
     name: name,
     locations: locations,
     syntaxRef: syntaxRef,
     defaultSyntaxValue: defaultSyntaxValue,
     isParams: isParams,
     isExtensionMethodThis: isExtensionMethodThis)
 {
     _tempBinder = binder;
     var unused = GetAttributesBag(diagnostics);
     _lazyDefaultSyntaxValue = MakeDefaultExpression(diagnostics, binder);
     _tempBinder = null; // no need to keep it around anymore, just uses up a lot of memory
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:30,代码来源:SourceStrictComplexParameterSymbol.cs

示例2: GetOrComputeDeclarationAnalysisData

            internal DeclarationAnalysisData GetOrComputeDeclarationAnalysisData(
                SyntaxReference declaration,
                Func<Func<DeclarationAnalysisData>, DeclarationAnalysisData> computeDeclarationAnalysisData,
                bool cacheAnalysisData)
            {
                if (!cacheAnalysisData)
                {
                    return computeDeclarationAnalysisData(_declarationAnalysisDataPool.Allocate);
                }

                DeclarationAnalysisData data;
                lock (_declarationAnalysisDataMap)
                {
                    if (_declarationAnalysisDataMap.TryGetValue(declaration, out data))
                    {
                        return data;
                    }
                }

                data = computeDeclarationAnalysisData(_declarationAnalysisDataPool.Allocate);

                lock (_declarationAnalysisDataMap)
                {
                    _declarationAnalysisDataMap[declaration] = data;
                }

                return data;
            }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:28,代码来源:AnalyzerDriver.CompilationData.cs

示例3: TypeParameterBuilder

 internal TypeParameterBuilder(SyntaxReference syntaxRef, SourceNamedTypeSymbol owner, Location location)
 {
     this.syntaxRef = syntaxRef;
     Debug.Assert(syntaxRef.GetSyntax().IsKind(SyntaxKind.TypeParameter));
     this.owner = owner;
     this.location = location;
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:7,代码来源:TypeParameterBuilder.cs

示例4: SourceAttributeData

        internal SourceAttributeData(
            SyntaxReference applicationNode,
            NamedTypeSymbol attributeClass,
            MethodSymbol attributeConstructor,
            ImmutableArray<TypedConstant> constructorArguments,
            ImmutableArray<int> constructorArgumentsSourceIndices,
            ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments,
            bool hasErrors,
            bool isConditionallyOmitted)
        {
            Debug.Assert(!isConditionallyOmitted || (object)attributeClass != null && attributeClass.IsConditional);
            Debug.Assert(!constructorArguments.IsDefault);
            Debug.Assert(!namedArguments.IsDefault);
            Debug.Assert(constructorArgumentsSourceIndices.IsDefault ||
                constructorArgumentsSourceIndices.Any() && constructorArgumentsSourceIndices.Length == constructorArguments.Length);

            this.attributeClass = attributeClass;
            this.attributeConstructor = attributeConstructor;
            this.constructorArguments = constructorArguments;
            this.constructorArgumentsSourceIndices = constructorArgumentsSourceIndices;
            this.namedArguments = namedArguments;
            this.isConditionallyOmitted = isConditionallyOmitted;
            this.hasErrors = hasErrors;
            this.applicationNode = applicationNode;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:25,代码来源:SourceAttributeData.cs

示例5: SingleNamespaceOrTypeDeclaration

 protected SingleNamespaceOrTypeDeclaration(
     string name,
     SyntaxReference syntaxReference,
     SourceLocation nameLocation)
     : base(name)
 {
     this.syntaxReference = syntaxReference;
     this.nameLocation = nameLocation;
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:9,代码来源:SingleNamespaceOrTypeDeclaration.cs

示例6: SourceEventAccessorSymbol

 public SourceEventAccessorSymbol(
     SourceEventSymbol @event,
     SyntaxReference syntaxReference,
     SyntaxReference blockSyntaxReference,
     ImmutableArray<Location> locations)
     : base(@event.containingType, syntaxReference, blockSyntaxReference, locations)
 {
     [email protected] = @event;
 }
开发者ID:riversky,项目名称:roslyn,代码行数:9,代码来源:SourceEventAccessorSymbol.cs

示例7: SingleNamespaceDeclaration

 protected SingleNamespaceDeclaration(
     string name,
     SyntaxReference syntaxReference,
     SourceLocation nameLocation,
     ImmutableArray<SingleNamespaceOrTypeDeclaration> children)
     : base(name, syntaxReference, nameLocation)
 {
     this.children = children;
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:9,代码来源:SingleNamespaceDeclaration.cs

示例8: SourceMemberFieldSymbol

 internal SourceMemberFieldSymbol(
     SourceMemberContainerTypeSymbol containingType,
     DeclarationModifiers modifiers,
     string name,
     SyntaxReference syntax, 
     Location location)
     : base(containingType, name, syntax, location)
 {
     _modifiers = modifiers;
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:10,代码来源:SourceMemberFieldSymbol.cs

示例9: GlobalExpressionVariable

 internal GlobalExpressionVariable(
     SourceMemberContainerTypeSymbol containingType,
     DeclarationModifiers modifiers,
     TypeSyntax typeSyntax,
     string name,
     SyntaxReference syntax,
     Location location)
     : base(containingType, modifiers, name, syntax, location)
 {
     Debug.Assert(DeclaredAccessibility == Accessibility.Private);
     _typeSyntax = typeSyntax.GetReference();
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:12,代码来源:GlobalExpressionVariable.cs

示例10: SourceFieldSymbol

        protected SourceFieldSymbol(SourceMemberContainerTypeSymbol containingType, string name, SyntaxReference syntax, Location location)
        {
            Debug.Assert((object)containingType != null);
            Debug.Assert(name != null);
            Debug.Assert(syntax != null);
            Debug.Assert(location != null);

            this.containingType = containingType;
            this.name = name;
            this.syntaxReference = syntax;
            this.location = location;
        }
开发者ID:riversky,项目名称:roslyn,代码行数:12,代码来源:SourceFieldSymbol.cs

示例11: ImplicitTypeDeclaration

 /// <summary>
 /// Script class declaration constructor.
 /// </summary>
 internal ImplicitTypeDeclaration(SyntaxReference memberContainer, ReadOnlyArray<SingleTypeDeclaration> children, ISet<string> memberNames, string name) :
     base(
     kind: DeclarationKind.Class,
     name: name,
     arity: 0,
     modifiers: DeclarationModifiers.Internal | DeclarationModifiers.Partial | DeclarationModifiers.Sealed,
     syntaxReference: memberContainer,
     nameLocation: new SourceLocation(memberContainer),
     memberNames: memberNames,
     children: children)
 {
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:15,代码来源:ImplicitTypeDeclaration.cs

示例12: RetargetingAttributeData

 internal RetargetingAttributeData(
     SyntaxReference applicationNode,
     NamedTypeSymbol attributeClass,
     MethodSymbol attributeConstructor,
     ImmutableArray<TypedConstant> constructorArguments,
     ImmutableArray<int> constructorArgumentsSourceIndices,
     ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments,
     bool hasErrors,
     bool isConditionallyOmitted)
     : base(applicationNode, attributeClass, attributeConstructor, constructorArguments, constructorArgumentsSourceIndices, namedArguments, hasErrors, isConditionallyOmitted)
 {
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:12,代码来源:RetargetingAttributeData.cs

示例13: Translate

        protected override SyntaxNode Translate(SyntaxReference reference, CancellationToken cancellationToken)
        {
            var node = (CSharpSyntaxNode)reference.GetSyntax(cancellationToken);

            // If the node is a name syntax, it's something like "X" or "X.Y" in :
            //    namespace X.Y.Z
            // We want to return the full NamespaceDeclarationSyntax.
            while (node is NameSyntax)
            {
                node = node.Parent;
            }

            Debug.Assert(node is CompilationUnitSyntax || node is NamespaceDeclarationSyntax);

            return node;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:16,代码来源:NamespaceDeclarationSyntaxReference.cs

示例14: EvaluateFieldConstant

        public static EvaluatedConstant EvaluateFieldConstant(this FieldSymbol symbol, SyntaxReference equalsValueNodeRef, ConstantFieldsInProgress inProgress)
        {
            Debug.Assert(inProgress != null);
            var diagnostics = DiagnosticBag.GetInstance();
            try
            {
                ConstantValue value;
                if (inProgress.Contains(symbol))
                {
                    var errorField = inProgress.ErrorField;
                    diagnostics.Add(ErrorCode.ERR_CircConstValue, errorField.Locations[0], errorField);
                    value = Roslyn.Compilers.ConstantValue.Bad;
                }
                else
                {
                    var compilation = ((SourceAssemblySymbol)symbol.ContainingAssembly).Compilation;
                    var binderFactory = compilation.GetBinderFactory(equalsValueNodeRef.SyntaxTree);

                    var newInProgress = inProgress.Add(symbol);

                    var equalsValueNode = (EqualsValueClauseSyntax)equalsValueNodeRef.GetSyntax();

                    var binder = binderFactory.GetBinder(equalsValueNode);
                    var inProgressBinder = new ConstantFieldsInProgressBinder(newInProgress, binder);

                    // CONSIDER: Compiler.BindFieldInitializer will make this same call on this same syntax node
                    // to determine the bound value for itself.  We expect this binding to be fairly cheap 
                    // (since constants tend to be simple) and it should only happen twice (regardless of the
                    // number of references to this constant).  If this becomes a performance bottleneck,
                    // the re-binding can be eliminated by caching the BoundNode on this SourceFieldSymbol and
                    // checking for a cached value before binding (here and in Compiler.BindFieldInitializer).
                    var boundValue = inProgressBinder.BindVariableInitializer(equalsValueNode, symbol.Type, diagnostics);
                    var initValueNodeLocation = inProgressBinder.Location(equalsValueNode.Value);

                    value = ConstantValueUtils.GetAndValidateConstantValue(boundValue, symbol, symbol.Type, initValueNodeLocation, diagnostics);
                }
                return new EvaluatedConstant(value, diagnostics.Seal());
            }
            finally
            {
                diagnostics.Free();
            }
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:43,代码来源:FieldSymbolExtensions.cs

示例15: RootSingleNamespaceDeclaration

        public RootSingleNamespaceDeclaration(
            bool hasUsings,
            bool hasExternAliases,
            SyntaxReference treeNode,
            ImmutableArray<SingleNamespaceOrTypeDeclaration> children,
            ImmutableArray<ReferenceDirective> referenceDirectives,
            bool hasAssemblyAttributes)
            : base(string.Empty,
                   treeNode,
                   nameLocation: new SourceLocation(treeNode),
                   children: children)
        {
            Debug.Assert(!referenceDirectives.IsDefault);

            _referenceDirectives = referenceDirectives;
            _hasAssemblyAttributes = hasAssemblyAttributes;
            _hasUsings = hasUsings;
            _hasExternAliases = hasExternAliases;
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:19,代码来源:RootSingleNamespaceDeclaration.cs


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