• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LookupOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: LookupSymbolsInSingleBinder

        internal sealed override void LookupSymbolsInSingleBinder(
            LookupResult result,
            string name,
            int arity,
            ConsList<Symbol> basesBeingResolved,
            LookupOptions options,
            Binder originalBinder,
            bool diagnose,
            ref HashSet<DiagnosticInfo> useSiteDiagnostics)
        {
            if ((options & (LookupOptions.NamespaceAliasesOnly | LookupOptions.NamespacesOrTypesOnly | LookupOptions.LabelsOnly)) != 0)
            {
                return;
            }

            var local = this.LookupPlaceholder(name);
            if ((object)local == null)
            {
                base.LookupSymbolsInSingleBinder(result, name, arity, basesBeingResolved, options, originalBinder, diagnose, ref useSiteDiagnostics);
            }
            else
            {
                result.MergeEqual(this.CheckViability(local, arity, options, null, diagnose, ref useSiteDiagnostics, basesBeingResolved));
            }
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:25,代码来源:PlaceholderLocalBinder.cs


示例2: LookupSymbolsInSingleBinder

        protected override void LookupSymbolsInSingleBinder(
            LookupResult result, string name, int arity, ConsList<Symbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
        {
            if ((options & (LookupOptions.NamespaceAliasesOnly | LookupOptions.MustBeInvocableIfMember)) != 0)
            {
                return;
            }

            Debug.Assert(result.IsClear);

            var count = parameterMap.GetCountForKey(name);
            if (count == 1)
            {
                ParameterSymbol p;
                parameterMap.TryGetSingleValue(name, out p);
                result.MergeEqual(originalBinder.CheckViability(p, arity, options, null, diagnose, ref useSiteDiagnostics));
            }
            else if (count > 1)
            {
                var parameters = parameterMap[name];
                foreach (var sym in parameters)
                {
                    result.MergeEqual(originalBinder.CheckViability(sym, arity, options, null, diagnose, ref useSiteDiagnostics));
                }
            }
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:26,代码来源:WithPrimaryConstructorParametersBinder.cs


示例3: AddLookupSymbolsInfoInSingleBinder

        protected override void AddLookupSymbolsInfoInSingleBinder(
            LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
        {
            // Add types within namespaces imported through usings, but don't add nested namespaces.
            LookupOptions usingOptions = (options & ~(LookupOptions.NamespaceAliasesOnly | LookupOptions.NamespacesOrTypesOnly)) | LookupOptions.MustNotBeNamespace;

            Imports.AddLookupSymbolsInfoInUsings(ConsolidatedUsings, this, result, usingOptions);
        }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:8,代码来源:UsingsBinder.cs


示例4: LookupService

        public LookupService(Stream stream, LookupOptions options)
        {
            _dbReader = options == LookupOptions.GEOIP_MEMORY_CACHE
                ? new StreamDbReader(stream)
                : new CachedDbReader(stream);

            Init();
        }
开发者ID:baluubas,项目名称:geoip-api-csharp2,代码行数:8,代码来源:LookupService.cs


示例5: AddLookupSymbolsInfoInSingleBinder

 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
 {
     var hostObjectType = GetHostObjectType();
     if (hostObjectType.Kind != SymbolKind.ErrorType)
     {
         AddMemberLookupSymbolsInfo(result, hostObjectType, options, originalBinder);
     }
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:HostObjectModeBinder.cs


示例6: AddLookupSymbolsInfoInSingleBinder

 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
 {
     if (CanConsiderTypeParameters(options))
     {
         foreach (var parameter in _namedType.TypeParameters)
         {
             if (originalBinder.CanAddLookupSymbolInfo(parameter, options, null))
             {
                 result.AddSymbol(parameter, parameter.Name, 0);
             }
         }
     }
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:13,代码来源:WithClassTypeParametersBinder.cs


示例7: AddLookupSymbolsInfoInSingleBinder

 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
 {
     if (options.CanConsiderLocals())
     {
         foreach (var parameter in primaryCtor.Parameters)
         {
             if (originalBinder.CanAddLookupSymbolInfo(parameter, options, null))
             {
                 result.AddSymbol(parameter, parameter.Name, 0);
             }
         }
     }
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:13,代码来源:WithPrimaryConstructorParametersBinder.cs


示例8: LookupSymbolsInSingleBinder

        internal override void LookupSymbolsInSingleBinder(LookupResult result, string name, int arity, ConsList<Symbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
        {
            _sourceBinder.LookupSymbolsInSingleBinder(result, name, arity, basesBeingResolved, options, this, diagnose, ref useSiteDiagnostics);

            var symbols = result.Symbols;
            for (int i = 0; i < symbols.Count; i++)
            {
                // Type parameters requiring mapping to the target type and
                // should be found by WithMethodTypeParametersBinder instead.
                var parameter = (ParameterSymbol)symbols[i];
                Debug.Assert(parameter.ContainingSymbol == _sourceBinder.ContainingMemberOrLambda);
                symbols[i] = _targetParameters[parameter.Ordinal + _parameterOffset];
            }
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:14,代码来源:EEMethodBinder.cs


示例9: Lookup

		public DicResult Lookup(LangPair lang, string text, string ui = null, LookupOptions flags = 0)
		{
			RestRequest request = new RestRequest("lookup");
			request.AddParameter("key", _key);
			request.AddParameter("lang", lang.ToString().ToLowerInvariant());
			request.AddParameter("text", text);
			
			if (!string.IsNullOrEmpty(ui))
				request.AddParameter("ui", ui);
			if (flags != 0)
				request.AddParameter("flags", (int)flags);

			return SendRequest<DicResult>(request);
		}
开发者ID:nus-ii,项目名称:Yandex-Linguistics.NET,代码行数:14,代码来源:Dictionary.cs


示例10: LookupSymbolsInSingleBinder

        internal override void LookupSymbolsInSingleBinder(
            LookupResult result, string name, int arity, ConsList<Symbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
        {
            Debug.Assert(result.IsClear);

            if ((options & LookupOptions.NamespaceAliasesOnly) != 0)
            {
                return;
            }

            foreach (var parameterSymbol in parameterMap[name])
            {
                result.MergeEqual(originalBinder.CheckViability(parameterSymbol, arity, options, null, diagnose, ref useSiteDiagnostics));
            }
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:15,代码来源:WithLambdaParametersBinder.cs


示例11: LookupSymbolsInSingleBinder

        protected override void LookupSymbolsInSingleBinder(
            LookupResult result, string name, int arity, ConsList<Symbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
        {
            if ((options & (LookupOptions.NamespaceAliasesOnly | LookupOptions.MustBeInvocableIfMember)) != 0)
            {
                return;
            }

            Debug.Assert(result.IsClear);

            foreach (ParameterSymbol parameter in parameters)
            {
                if (parameter.Name == name)
                {
                    result.MergeEqual(originalBinder.CheckViability(parameter, arity, options, null, diagnose, ref useSiteDiagnostics));
                }
            }
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:18,代码来源:WithParametersBinder.cs


示例12: GetCandidateExtensionMethods

 internal override void GetCandidateExtensionMethods(
     bool searchUsingsNotNamespace,
     ArrayBuilder<MethodSymbol> methods,
     string name,
     int arity,
     LookupOptions options,
     bool isCallerSemanticModel)
 {
     if (searchUsingsNotNamespace)
     {
         foreach (var nsOrType in ConsolidatedUsings)
         {
             if (nsOrType.NamespaceOrType.Kind == SymbolKind.Namespace)
             {
                 ((NamespaceSymbol)nsOrType.NamespaceOrType).GetExtensionMethods(methods, name, arity, options);
             }
         }
     }
 }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:19,代码来源:UsingsBinder.cs


示例13: LookupSymbolsInSingleBinder

 internal override void LookupSymbolsInSingleBinder(
     LookupResult result, string name, int arity, ConsList<Symbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
 {
     var hostObjectType = GetHostObjectType();
     if (hostObjectType.Kind == SymbolKind.ErrorType)
     {
         // The name '{0}' does not exist in the current context (are you missing a reference to assembly '{1}'?)
         result.SetFrom(new CSDiagnosticInfo(
             ErrorCode.ERR_NameNotInContextPossibleMissingReference,
             new object[] { name, ((MissingMetadataTypeSymbol)hostObjectType).ContainingAssembly.Identity },
             ImmutableArray<Symbol>.Empty,
             ImmutableArray<Location>.Empty
         ));
     }
     else
     {
         LookupMembersInternal(result, hostObjectType, name, arity, basesBeingResolved, options, originalBinder, diagnose, ref useSiteDiagnostics);
     }
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:19,代码来源:HostObjectModeBinder.cs


示例14: LookupSymbolsInSingleBinder

        internal override void LookupSymbolsInSingleBinder(
            LookupResult result, string name, int arity, ConsList<Symbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
        {
            if (!ShouldLookInUsings(options))
            {
                return;
            }

            LookupResult tmp = LookupResult.GetInstance();

            // usings:
            Imports.Empty.LookupSymbolInUsings(ConsolidatedUsings, originalBinder, tmp, name, arity, basesBeingResolved, options, diagnose, ref useSiteDiagnostics);

            // if we found a viable result in imported namespaces, use it instead of unviable symbols found in source:
            if (tmp.IsMultiViable)
            {
                result.MergeEqual(tmp);
            }

            tmp.Free();
        }
开发者ID:GeertVL,项目名称:roslyn,代码行数:21,代码来源:UsingsBinder.cs


示例15: LookupSymbolsInSingleBinder

        internal sealed override void LookupSymbolsInSingleBinder(
            LookupResult result,
            string name,
            int arity,
            ConsList<Symbol> basesBeingResolved,
            LookupOptions options,
            Binder originalBinder,
            bool diagnose,
            ref HashSet<DiagnosticInfo> useSiteDiagnostics)
        {
            if ((options & (LookupOptions.NamespaceAliasesOnly | LookupOptions.NamespacesOrTypesOnly | LookupOptions.LabelsOnly)) != 0)
            {
                return;
            }

            if (name.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
            {
                var valueText = name.Substring(2);
                ulong address;
                if (!ulong.TryParse(valueText, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out address))
                {
                    // Invalid value should have been caught by Lexer.
                    throw ExceptionUtilities.UnexpectedValue(valueText);
                }
                var local = new ObjectAddressLocalSymbol(_containingMethod, name, this.Compilation.GetSpecialType(SpecialType.System_Object), address);
                result.MergeEqual(this.CheckViability(local, arity, options, null, diagnose, ref useSiteDiagnostics, basesBeingResolved));
            }
            else
            {
                LocalSymbol lowercaseReturnValueAlias;
                if (_lowercaseReturnValueAliases.TryGetValue(name, out lowercaseReturnValueAlias))
                {
                    result.MergeEqual(this.CheckViability(lowercaseReturnValueAlias, arity, options, null, diagnose, ref useSiteDiagnostics, basesBeingResolved));
                }
                else
                {
                    base.LookupSymbolsInSingleBinder(result, name, arity, basesBeingResolved, options, originalBinder, diagnose, ref useSiteDiagnostics);
                }
            }
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:40,代码来源:PlaceholderLocalBinder.cs


示例16: AppendSymbolsWithNameAndArity

        private void AppendSymbolsWithNameAndArity(
            ArrayBuilder<Symbol> results,
            string name,
            int arity,
            Binder binder,
            NamespaceOrTypeSymbol container,
            LookupOptions options)
        {
            Debug.Assert(results != null);

            // Don't need to de-dup since AllMethodsOnArityZero can't be set at this point (not exposed in CommonLookupOptions).
            Debug.Assert((options & LookupOptions.AllMethodsOnArityZero) == 0);

            var lookupResult = LookupResult.GetInstance();

            HashSet<DiagnosticInfo> useSiteDiagnostics = null;
            binder.LookupSymbolsSimpleName(
                lookupResult,
                container,
                name,
                arity,
                basesBeingResolved: null,
                options: options & ~LookupOptions.IncludeExtensionMethods,
                diagnose: false,
                useSiteDiagnostics: ref useSiteDiagnostics);

            if (lookupResult.IsMultiViable)
            {
                if (lookupResult.Symbols.Any(t => t.Kind == SymbolKind.NamedType || t.Kind == SymbolKind.Namespace || t.Kind == SymbolKind.ErrorType))
                {
                    // binder.ResultSymbol is defined only for type/namespace lookups
                    bool wasError;
                    var diagnostics = DiagnosticBag.GetInstance();  // client code never expects a null diagnostic bag.
                    Symbol singleSymbol = binder.ResultSymbol(lookupResult, name, arity, this.Root, diagnostics, true, out wasError, container, options);
                    diagnostics.Free();

                    if (!wasError)
                    {
                        results.Add(singleSymbol);
                    }
                    else
                    {
                        results.AddRange(lookupResult.Symbols);
                    }
                }
                else
                {
                    results.AddRange(lookupResult.Symbols);
                }
            }

            lookupResult.Free();
        }
开发者ID:,项目名称:,代码行数:53,代码来源:


示例17: AppendSymbolsWithName

        private void AppendSymbolsWithName(ArrayBuilder<Symbol> results, string name, Binder binder, NamespaceOrTypeSymbol container, LookupOptions options, LookupSymbolsInfo info)
        {
            LookupSymbolsInfo.IArityEnumerable arities;
            Symbol uniqueSymbol;

            if (info.TryGetAritiesAndUniqueSymbol(name, out arities, out uniqueSymbol))
            {
                if ((object)uniqueSymbol != null)
                {
                    // This name mapped to something unique.  We don't need to proceed
                    // with a costly lookup.  Just add it straight to the results.
                    results.Add(uniqueSymbol);
                }
                else
                {
                    // The name maps to multiple symbols. Actually do a real lookup so 
                    // that we will properly figure out hiding and whatnot.
                    if (arities != null)
                    {
                        foreach (var arity in arities)
                        {
                            this.AppendSymbolsWithNameAndArity(results, name, arity, binder, container, options);
                        }
                    }
                    else
                    {
                        //non-unique symbol with non-zero arity doesn't seem possible.
                        this.AppendSymbolsWithNameAndArity(results, name, 0, binder, container, options);
                    }
                }
            }
        }
开发者ID:,项目名称:,代码行数:32,代码来源:


示例18: LookupSymbolsInternal

        /// <summary>
        /// Gets the available named symbols in the context of the specified location and optional
        /// container. Only symbols that are accessible and visible from the given location are
        /// returned.
        /// </summary>
        /// <param name="position">The character position for determining the enclosing declaration
        /// scope and accessibility.</param>
        /// <param name="container">The container to search for symbols within. If null then the
        /// enclosing declaration scope around position is used.</param>
        /// <param name="name">The name of the symbol to find. If null is specified then symbols
        /// with any names are returned.</param>
        /// <param name="options">Additional options that affect the lookup process.</param>
        /// <param name="useBaseReferenceAccessibility">Ignore 'throughType' in accessibility checking. 
        /// Used in checking accessibility of symbols accessed via 'MyBase' or 'base'.</param>
        /// <remarks>
        /// The "position" is used to determine what variables are visible and accessible. Even if
        /// "container" is specified, the "position" location is significant for determining which
        /// members of "containing" are accessible. 
        /// </remarks>
        /// <exception cref="ArgumentException">Throws an argument exception if the passed lookup options are invalid.</exception>
        private ImmutableArray<Symbol> LookupSymbolsInternal(
            int position,
            NamespaceOrTypeSymbol container,
            string name,
            LookupOptions options,
            bool useBaseReferenceAccessibility)
        {
            Debug.Assert((options & LookupOptions.UseBaseReferenceAccessibility) == 0, "Use the useBaseReferenceAccessibility parameter.");
            if (useBaseReferenceAccessibility)
            {
                options |= LookupOptions.UseBaseReferenceAccessibility;
            }
            Debug.Assert(!options.IsAttributeTypeLookup()); // Not exposed publicly.

            options.ThrowIfInvalid();

            SyntaxToken token;
            position = CheckAndAdjustPosition(position, out token);

            if ((object)container == null || container.Kind == SymbolKind.Namespace)
            {
                options &= ~LookupOptions.IncludeExtensionMethods;
            }

            var binder = GetEnclosingBinder(position);
            if (binder == null)
            {
                return ImmutableArray<Symbol>.Empty;
            }

            if (useBaseReferenceAccessibility)
            {
                Debug.Assert((object)container == null);
                TypeSymbol containingType = binder.ContainingType;
                TypeSymbol baseType = null;

                // For a script class or a submission class base should have no members.
                if ((object)containingType != null && containingType.Kind == SymbolKind.NamedType && ((NamedTypeSymbol)containingType).IsScriptClass)
                {
                    return ImmutableArray<Symbol>.Empty;
                }

                if ((object)containingType == null || (object)(baseType = containingType.BaseTypeNoUseSiteDiagnostics) == null)
                {
                    throw new ArgumentException(
                        "Not a valid position for a call to LookupBaseMembers (must be in a type with a base type)",
                        nameof(position));
                }
                container = baseType;
            }

            if (!binder.IsInMethodBody &&
                (options & (LookupOptions.NamespaceAliasesOnly | LookupOptions.NamespacesOrTypesOnly | LookupOptions.LabelsOnly)) == 0)
            {
                // Method type parameters are not in scope outside a method
                // body unless the position is either:
                // a) in a type-only context inside an expression, or
                // b) inside of an XML name attribute in an XML doc comment.
                var parentExpr = token.Parent as ExpressionSyntax;
                if (parentExpr != null && !(parentExpr.Parent is XmlNameAttributeSyntax) && !SyntaxFacts.IsInTypeOnlyContext(parentExpr))
                {
                    options |= LookupOptions.MustNotBeMethodTypeParameter;
                }
            }

            var info = LookupSymbolsInfo.GetInstance();

            if ((object)container == null)
            {
                binder.AddLookupSymbolsInfo(info, options);
            }
            else
            {
                binder.AddMemberLookupSymbolsInfo(info, container, options, binder);
            }

            var results = ArrayBuilder<Symbol>.GetInstance(info.Count);

            if (name == null)
            {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


示例19: AddLookupSymbolsInfoInSingleBinder

        protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
        {
            if (_container != null)
            {
                this.AddMemberLookupSymbolsInfo(result, _container, options, originalBinder);
            }

            // If we are looking only for labels we do not need to search through the imports.
            // Submission imports are handled by AddMemberLookupSymbolsInfo (above).
            if (!IsSubmissionClass && ((options & LookupOptions.LabelsOnly) == 0))
            {
                var imports = GetImports(basesBeingResolved: null);
                imports.AddLookupSymbolsInfo(result, options, originalBinder);
            }
        }
开发者ID:hcn0843,项目名称:roslyn,代码行数:15,代码来源:InContainerBinder.cs


示例20: GetCandidateExtensionMethods

 internal override void GetCandidateExtensionMethods(
     bool searchUsingsNotNamespace,
     ArrayBuilder<MethodSymbol> methods,
     string name,
     int arity,
     LookupOptions options,
     Binder originalBinder)
 {
     if (searchUsingsNotNamespace)
     {
         this.GetImports(basesBeingResolved: null).LookupExtensionMethodsInUsings(methods, name, arity, options, originalBinder);
     }
     else if (_container?.Kind == SymbolKind.Namespace)
     {
         ((NamespaceSymbol)_container).GetExtensionMethods(methods, name, arity, options);
     }
     else if (IsSubmissionClass)
     {
         for (var submission = this.Compilation; submission != null; submission = submission.PreviousSubmission)
         {
             submission.ScriptClass?.GetExtensionMethods(methods, name, arity, options);
         }
     }
 }
开发者ID:hcn0843,项目名称:roslyn,代码行数:24,代码来源:InContainerBinder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LookupResultKind类代码示例发布时间:2022-05-24
下一篇:
C# LookupMode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap