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


C# SpeculativeBindingOption类代码示例

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


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

示例1: SpeculativeSyntaxTreeSemanticModel

 private SpeculativeSyntaxTreeSemanticModel(CSharpSemanticModel parentSemanticModel, CSharpSyntaxNode root, Binder rootBinder, int position, SpeculativeBindingOption bindingOption)
     : base(parentSemanticModel.Compilation, parentSemanticModel.SyntaxTree, root.SyntaxTree)
 {
     this.parentSemanticModel = parentSemanticModel;
     this.root = root;
     this.rootBinder = rootBinder;
     this.position = position;
     this.bindingOption = bindingOption;
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:9,代码来源:SpeculativeSyntaxTreeSemanticModel.cs

示例2: CreateCore

        private static SpeculativeSyntaxTreeSemanticModel CreateCore(CSharpSemanticModel parentSemanticModel, CSharpSyntaxNode root, Binder rootBinder, int position, SpeculativeBindingOption bindingOption)
        {
            Debug.Assert(parentSemanticModel is SyntaxTreeSemanticModel);
            Debug.Assert(root != null);
            Debug.Assert(root is TypeSyntax || root is CrefSyntax);
            Debug.Assert(rootBinder != null);
            Debug.Assert(rootBinder.IsSemanticModelBinder);

            var speculativeModel = new SpeculativeSyntaxTreeSemanticModel(parentSemanticModel, root, rootBinder, position, bindingOption);
            return speculativeModel;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:11,代码来源:SpeculativeSyntaxTreeSemanticModel.cs

示例3: TestGetSpeculativeSemanticModelForTypeSyntax_Common

        private static void TestGetSpeculativeSemanticModelForTypeSyntax_Common(
            SemanticModel model,
            int position,
            TypeSyntax speculatedTypeSyntax,
            SpeculativeBindingOption bindingOption,
            SymbolKind expectedSymbolKind,
            string expectedTypeDislayString)
        {
            Assert.False(model.IsSpeculativeSemanticModel);
            Assert.Null(model.ParentModel);
            Assert.Equal(0, model.OriginalPositionForSpeculation);

            SemanticModel speculativeModel;
            var success = model.TryGetSpeculativeSemanticModel(position, speculatedTypeSyntax, out speculativeModel, bindingOption);
            Assert.True(success);
            Assert.NotNull(speculativeModel);

            Assert.True(speculativeModel.IsSpeculativeSemanticModel);
            Assert.Equal(model, speculativeModel.ParentModel);
            Assert.NotNull(speculativeModel);
            Assert.Equal(position, speculativeModel.OriginalPositionForSpeculation);

            var symbol = speculativeModel.GetSymbolInfo(speculatedTypeSyntax).Symbol;
            Assert.NotNull(symbol);
            Assert.Equal(expectedSymbolKind, symbol.Kind);
            Assert.Equal(expectedTypeDislayString, symbol.ToDisplayString());

            var typeSymbol = speculativeModel.GetTypeInfo(speculatedTypeSyntax).Type;
            Assert.NotNull(symbol);
            Assert.Equal(expectedSymbolKind, symbol.Kind);
            Assert.Equal(expectedTypeDislayString, symbol.ToDisplayString());

            if (speculatedTypeSyntax.Kind == SyntaxKind.QualifiedName)
            {
                var right = ((QualifiedNameSyntax)speculatedTypeSyntax).Right;

                symbol = speculativeModel.GetSymbolInfo(right).Symbol;
                Assert.NotNull(symbol);
                Assert.Equal(expectedSymbolKind, symbol.Kind);
                Assert.Equal(expectedTypeDislayString, symbol.ToDisplayString());

                typeSymbol = speculativeModel.GetTypeInfo(right).Type;
                Assert.NotNull(symbol);
                Assert.Equal(expectedSymbolKind, symbol.Kind);
                Assert.Equal(expectedTypeDislayString, symbol.ToDisplayString());
            }
        }
开发者ID:riversky,项目名称:roslyn,代码行数:47,代码来源:SemanticModelAPITests.cs

示例4: GetSpeculativeSymbolInfo

 /// <summary>
 /// Binds the node in the context of the specified location and get semantic information
 /// such as type, symbols and diagnostics. This method is used to get semantic information
 /// about an expression that did not actually appear in the source code.
 /// </summary>
 /// <param name="semanticModel"></param>
 /// <param name="position">A character position used to identify a declaration scope and
 /// accessibility. This character position must be within the FullSpan of the Root syntax
 /// node in this SemanticModel.
 /// </param>
 /// <param name="expression">A syntax node that represents a parsed expression. This syntax
 /// node need not and typically does not appear in the source code referred to  SemanticModel
 /// instance.</param>
 /// <param name="bindingOption">Indicates whether to binding the expression as a full expressions,
 /// or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then
 /// expression should derive from TypeSyntax.</param>
 /// <returns>The semantic information for the topmost node of the expression.</returns>
 /// <remarks>The passed in expression is interpreted as a stand-alone expression, as if it
 /// appeared by itself somewhere within the scope that encloses "position".</remarks>
 public static SymbolInfo GetSpeculativeSymbolInfo(this SemanticModel semanticModel, int position, SyntaxNode expression, SpeculativeBindingOption bindingOption)
 {
     return semanticModel.GetSpeculativeSymbolInfo(position, expression, bindingOption);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:23,代码来源:Extensions.cs

示例5: GetSpeculativeAliasInfoCore

 /// <summary>
 /// Binds the name in the context of the specified location and sees if it resolves to an
 /// alias name. If it does, return the AliasSymbol corresponding to it. Otherwise, return null.
 /// </summary>
 /// <param name="position">A character position used to identify a declaration scope and
 /// accessibility. This character position must be within the FullSpan of the Root syntax
 /// node in this SemanticModel.
 /// </param>
 /// <param name="nameSyntax">A syntax node that represents a name. This syntax
 /// node need not and typically does not appear in the source code referred to by the
 /// SemanticModel instance.</param>
 /// <param name="bindingOption">Indicates whether to binding the name as a full expression,
 /// or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then
 /// expression should derive from TypeSyntax.</param>
 /// <remarks>The passed in name is interpreted as a stand-alone name, as if it
 /// appeared by itself somewhere within the scope that encloses "position".</remarks>
 protected abstract IAliasSymbol GetSpeculativeAliasInfoCore(int position, SyntaxNode nameSyntax, SpeculativeBindingOption bindingOption);
开发者ID:GloryChou,项目名称:roslyn,代码行数:17,代码来源:SemanticModel.cs

示例6: GetSpeculativeTypeInfoCore

 /// <summary>
 /// Binds the node in the context of the specified location and get semantic information
 /// such as type, symbols and diagnostics. This method is used to get semantic information
 /// about an expression that did not actually appear in the source code.
 /// </summary>
 /// <param name="position">A character position used to identify a declaration scope and
 /// accessibility. This character position must be within the FullSpan of the Root syntax
 /// node in this SemanticModel.
 /// </param>
 /// <param name="expression">A syntax node that represents a parsed expression. This syntax
 /// node need not and typically does not appear in the source code referred to  SemanticModel
 /// instance.</param>
 /// <param name="bindingOption">Indicates whether to binding the expression as a full expressions,
 /// or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then
 /// expression should derive from TypeSyntax.</param>
 /// <returns>The semantic information for the topmost node of the expression.</returns>
 /// <remarks>The passed in expression is interpreted as a stand-alone expression, as if it
 /// appeared by itself somewhere within the scope that encloses "position".</remarks>
 protected abstract TypeInfo GetSpeculativeTypeInfoCore(int position, SyntaxNode expression, SpeculativeBindingOption bindingOption);
开发者ID:GloryChou,项目名称:roslyn,代码行数:19,代码来源:SemanticModel.cs

示例7: GetSpeculativeTypeInfo

 /// <summary>
 /// Binds the node in the context of the specified location and get semantic information
 /// such as type, symbols and diagnostics. This method is used to get semantic information
 /// about an expression that did not actually appear in the source code.
 /// </summary>
 /// <param name="position">A character position used to identify a declaration scope and
 /// accessibility. This character position must be within the FullSpan of the Root syntax
 /// node in this SemanticModel.
 /// </param>
 /// <param name="expression">A syntax node that represents a parsed expression. This syntax
 /// node need not and typically does not appear in the source code referred to  SemanticModel
 /// instance.</param>
 /// <param name="bindingOption">Indicates whether to binding the expression as a full expressions,
 /// or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then
 /// expression should derive from TypeSyntax.</param>
 /// <returns>The semantic information for the topmost node of the expression.</returns>
 /// <remarks>The passed in expression is interpreted as a stand-alone expression, as if it
 /// appeared by itself somewhere within the scope that encloses "position".</remarks>
 internal TypeInfo GetSpeculativeTypeInfo(int position, SyntaxNode expression, SpeculativeBindingOption bindingOption)
 {
     return GetSpeculativeTypeInfoCore(position, expression, bindingOption);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:22,代码来源:SemanticModel.cs

示例8: GetSpeculativeAliasInfo

 /// <summary>
 /// Binds the name in the context of the specified location and sees if it resolves to an
 /// alias name. If it does, return the AliasSymbol corresponding to it. Otherwise, return null.
 /// </summary>
 /// <param name="position">A character position used to identify a declaration scope and
 /// accessibility. This character position must be within the FullSpan of the Root syntax
 /// node in this SemanticModel.
 /// </param>
 /// <param name="nameSyntax">A syntax node that represents a name. This syntax
 /// node need not and typically does not appear in the source code referred to by the
 /// SemanticModel instance.</param>
 /// <param name="bindingOption">Indicates whether to binding the name as a full expression,
 /// or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then
 /// expression should derive from TypeSyntax.</param>
 /// <remarks>The passed in name is interpreted as a stand-alone name, as if it
 /// appeared by itself somewhere within the scope that encloses "position".</remarks>
 internal IAliasSymbol GetSpeculativeAliasInfo(int position, SyntaxNode nameSyntax, SpeculativeBindingOption bindingOption)
 {
     return GetSpeculativeAliasInfoCore(position, nameSyntax, bindingOption);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:20,代码来源:SemanticModel.cs

示例9: TryGetSpeculativeSemanticModelCore

        internal sealed override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, TypeSyntax type, SpeculativeBindingOption bindingOption, out SemanticModel speculativeModel)
        {
            var expression = SyntaxFactory.GetStandaloneExpression(type);

            var binder = this.GetSpeculativeBinder(position, expression, bindingOption);
            if (binder != null)
            {
                speculativeModel = new SpeculativeMemberSemanticModel(parentModel, _memberSymbol, type, binder, position);
                return true;
            }

            speculativeModel = null;
            return false;
        }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:14,代码来源:MemberSemanticModel.cs

示例10: GetSpeculativeAliasInfo

 /// <summary>
 /// Binds the name in the context of the specified location and sees if it resolves to an
 /// alias name. If it does, return the AliasSymbol corresponding to it. Otherwise, return null.
 /// </summary>
 /// <param name="semanticModel"></param>
 /// <param name="position">A character position used to identify a declaration scope and
 /// accessibility. This character position must be within the FullSpan of the Root syntax
 /// node in this SemanticModel.
 /// </param>
 /// <param name="nameSyntax">A syntax node that represents a name. This syntax
 /// node need not and typically does not appear in the source code referred to by the
 /// SemanticModel instance.</param>
 /// <param name="bindingOption">Indicates whether to binding the name as a full expression,
 /// or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then
 /// expression should derive from TypeSyntax.</param>
 /// <remarks>The passed in name is interpreted as a stand-alone name, as if it
 /// appeared by itself somewhere within the scope that encloses "position".</remarks>
 public static IAliasSymbol GetSpeculativeAliasInfo(this SemanticModel semanticModel, int position, SyntaxNode nameSyntax, SpeculativeBindingOption bindingOption)
 {
     return semanticModel.GetSpeculativeAliasInfo(position, nameSyntax, bindingOption);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:21,代码来源:Extensions.cs

示例11: TryGetSpeculativeSemanticModelCore

        internal sealed override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, TypeSyntax type, SpeculativeBindingOption bindingOption, out SemanticModel speculativeModel)
        {
            position = CheckAndAdjustPosition(position);

            var model = this.GetMemberModel(position);
            if (model != null)
            {
                return model.TryGetSpeculativeSemanticModelCore(parentModel, position, type, bindingOption, out speculativeModel);
            }

            Binder binder = GetSpeculativeBinder(position, type, bindingOption);
            if (binder != null)
            {
                speculativeModel = SpeculativeSyntaxTreeSemanticModel.Create(parentModel, type, binder, position, bindingOption);
                return true;
            }

            speculativeModel = null;
            return false;
        }
开发者ID:nileshjagtap,项目名称:roslyn,代码行数:20,代码来源:SyntaxTreeSemanticModel.cs

示例12: Create

 public static SpeculativeSyntaxTreeSemanticModel Create(CSharpSemanticModel parentSemanticModel, TypeSyntax root, Binder rootBinder, int position, SpeculativeBindingOption bindingOption)
 {
     return CreateCore(parentSemanticModel, root, rootBinder, position, bindingOption);
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:4,代码来源:SpeculativeSyntaxTreeSemanticModel.cs


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