コード例 #1
0
 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupConstraints constraints)
 {
     if (this.ContainingSymbol != null)
     {
         this.AddMemberLookupSymbolsInfo(result, constraints.WithQualifier(this.ContainingSymbol));
     }
 }
コード例 #2
0
 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupConstraints constraints)
 {
     foreach (var symbol in Compilation.SourceAssembly.SpecialSymbols)
     {
         result.AddSymbol(symbol, symbol.Name, symbol.MetadataName);
     }
 }
コード例 #3
0
 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
 {
     var hostObjectType = GetHostObjectType();
     if (hostObjectType.Kind != SymbolKind.ErrorType)
     {
         AddMemberLookupSymbolsInfo(result, hostObjectType, options, originalBinder);
     }
 }
コード例 #4
0
ファイル: UsingsBinder.cs プロジェクト: jerriclynsjohn/roslyn
        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);
        }
コード例 #5
0
 protected sealed override void AddLookupSymbolsInfoInSingleBinder(
     LookupSymbolsInfo info,
     LookupOptions options,
     Binder originalBinder
     )
 {
     throw new NotImplementedException();
 }
コード例 #6
0
        protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupConstraints constraints)
        {
            var hostObjectType = GetHostObjectType();

            if (hostObjectType.Kind != LanguageSymbolKind.ErrorType)
            {
                AddMemberLookupSymbolsInfo(result, constraints.WithQualifier(hostObjectType));
            }
        }
コード例 #7
0
 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);
             }
         }
     }
 }
コード例 #8
0
 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);
             }
         }
     }
 }
コード例 #9
0
 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
 {
     if (CanConsiderTypeParameters(options))
     {
         foreach (var parameter in _typeArguments)
         {
             if (originalBinder.CanAddLookupSymbolInfo(parameter, options, result, null))
             {
                 result.AddSymbol(parameter, parameter.Name, 0);
             }
         }
     }
 }
コード例 #10
0
        protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupConstraints constraints)
        {
            if (_container != null)
            {
                this.AddMemberLookupSymbolsInfo(result, constraints.WithQualifier(_container));
            }

            // If we are looking only for labels we do not need to search through the imports.
            // Submission imports are handled by AddMemberLookupSymbolsInfo (above).
            if (!IsSubmission && ((constraints.Options & LookupOptions.LabelsOnly) == 0))
            {
                var imports = GetImports(basesBeingResolved: null);
                imports.AddLookupSymbolsInfo(result, constraints);
            }
        }
コード例 #11
0
        protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
        {
            this.AddMemberLookupSymbolsInfo(result, _container, options, originalBinder);

            // if we are looking only for labels we do not need to search through the imports
            if (!_container.IsSubmissionClass && ((options & LookupOptions.LabelsOnly) == 0))
            {
                var imports = GetImports(basesBeingResolved: null);

                imports.AddLookupSymbolsInfoInAliases(this, result, options);

                // Add types within namespaces imported through usings, but don't add nested namespaces.
                LookupOptions usingOptions = (options & ~(LookupOptions.NamespaceAliasesOnly | LookupOptions.NamespacesOrTypesOnly)) | LookupOptions.MustNotBeNamespace;
                Imports.AddLookupSymbolsInfoInUsings(imports.Usings, this, result, usingOptions);
            }
        }
コード例 #12
0
        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);
                    }
                }
            }
        }
コード例 #13
0
ファイル: InContainerBinder.cs プロジェクト: hcn0843/roslyn
        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);
            }
        }
コード例 #14
0
 protected sealed override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo info, LookupOptions options, Binder originalBinder)
 {
     throw new NotImplementedException();
 }
コード例 #15
0
 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
 {
     if (options.CanConsiderMembers())
     {
         foreach (var kvp in _parameterMap)
         {
             result.AddSymbol(null, kvp.Key, 0);
         }
     }
 }
コード例 #16
0
 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
 {
     if (options.CanConsiderMembers())
     {
         foreach (var rangeVariableName in parameterMap.Keys)
         {
             result.AddSymbol(null, rangeVariableName, 0);
         }
     }
 }
コード例 #17
0
ファイル: Imports.cs プロジェクト: daking2014/roslyn
        // Note: we do not mark nodes when looking up arities or names.  This is because these two
        // types of lookup are only around to make the public
        // SemanticModel.LookupNames/LookupSymbols work and do not count as usages of the directives
        // when the actual code is bound.

        internal void AddLookupSymbolsInfoInAliases(Binder binder, LookupSymbolsInfo result, LookupOptions options)
        {
            if (this.UsingAliases != null)
            {
                foreach (var usingAlias in this.UsingAliases.Values)
                {
                    var usingAliasSymbol = usingAlias.Alias;
                    var usingAliasTargetSymbol = usingAliasSymbol.GetAliasTarget(basesBeingResolved: null);
                    if (binder.CanAddLookupSymbolInfo(usingAliasTargetSymbol, options, null))
                    {
                        result.AddSymbol(usingAliasSymbol, usingAliasSymbol.Name, 0);
                    }
                }
            }

            if (this.ExternAliases != null)
            {
                foreach (var externAlias in this.ExternAliases)
                {
                    var externAliasSymbol = externAlias.Alias;
                    var externAliasTargetSymbol = externAliasSymbol.GetAliasTarget(basesBeingResolved: null);
                    if (binder.CanAddLookupSymbolInfo(externAliasTargetSymbol, options, null))
                    {
                        result.AddSymbol(externAliasSymbol, externAliasSymbol.Name, 0);
                    }
                }
            }
        }
コード例 #18
0
        protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder)
        {
            if (CanConsiderTypeParameters(options))
            {
                foreach (var kvp in TypeParameterMap)
                {
                    foreach (TypeParameterSymbol typeParameter in kvp.Value)
                    {
                        // In any context where this binder applies, the type parameters are always viable/speakable.
                        Debug.Assert(originalBinder.CanAddLookupSymbolInfo(typeParameter, options, null));

                        result.AddSymbol(typeParameter, kvp.Key, 0);
                    }
                }
            }
        }
コード例 #19
0
ファイル: Imports.cs プロジェクト: daking2014/roslyn
        internal static void AddLookupSymbolsInfoInUsings(
            ImmutableArray<NamespaceOrTypeAndUsingDirective> usings, Binder binder, LookupSymbolsInfo result, LookupOptions options)
        {
            Debug.Assert(!options.CanConsiderNamespaces());

            // look in all using namespaces
            foreach (var namespaceSymbol in usings)
            {
                foreach (var member in namespaceSymbol.NamespaceOrType.GetMembersUnordered())
                {
                    if (binder.CanAddLookupSymbolInfo(member, options, null))
                    {
                        result.AddSymbol(member, member.Name, member.GetArity());
                    }
                }
            }
        }