protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder) { if (options.CanConsiderMembers()) { foreach (var kvp in _parameterMap) { result.AddSymbol(null, kvp.Key, 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); } } }
protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder) { if (CanConsiderTypeParameters(options)) { foreach (var parameter in this.methodSymbol.TypeParameters) { if (originalBinder.CanAddLookupSymbolInfo(parameter, options, null)) { result.AddSymbol(parameter, parameter.Name, 0); } } } }
protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder) { if (options.CanConsiderMembers()) { foreach (var parameter in lambdaSymbol.Parameters) { if (originalBinder.CanAddLookupSymbolInfo(parameter, options, null)) { result.AddSymbol(parameter, parameter.Name, 0); } } } }
internal override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder) { if (options.CanConsiderLocals()) { foreach (var parameter in _parameters) { if (originalBinder.CanAddLookupSymbolInfo(parameter, options, result, null)) { result.AddSymbol(parameter, parameter.Name, 0); } } } }
protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder) { Debug.Assert(options.AreValid()); if ((options & LookupOptions.LabelsOnly) != 0) { if (this.LabelsMap != null) { foreach (var label in this.LabelsMap) { result.AddSymbol(label.Value, label.Key, 0); } } } if (options.CanConsiderLocals()) { if (this.LocalsMap != null) { foreach (var local in this.LocalsMap) { if (originalBinder.CanAddLookupSymbolInfo(local.Value, options, result, null)) { result.AddSymbol(local.Value, local.Key, 0); } } } if (this.LocalFunctionsMap != null) { foreach (var local in this.LocalFunctionsMap) { if (originalBinder.CanAddLookupSymbolInfo(local.Value, options, result, null)) { result.AddSymbol(local.Value, local.Key, 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); } } } }
// 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.GetAliasTarget(basesBeingResolved: null); if (binder.CanAddLookupSymbolInfo(usingAliasSymbol, options, null)) { result.AddSymbol(usingAlias.Alias, usingAlias.Alias.Name, 0); } } } // TODO (tomat): extern aliases? }
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()); } } } }
protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupOptions options, Binder originalBinder) { // If we are looking only for labels we do not need to search through the imports. if ((options & LookupOptions.LabelsOnly) == 0) { // Add types within namespaces imported through usings, but don't add nested namespaces. options = (options & ~(LookupOptions.NamespaceAliasesOnly | LookupOptions.NamespacesOrTypesOnly)) | LookupOptions.MustNotBeNamespace; // look in all using namespaces foreach (var namespaceSymbol in this.GetUsings(basesBeingResolved: null)) { foreach (var member in namespaceSymbol.NamespaceOrType.GetMembersUnordered()) { if (IsValidLookupCandidateInUsings(member) && originalBinder.CanAddLookupSymbolInfo(member, options, result, null)) { result.AddSymbol(member, member.Name, member.GetArity()); } } } } }
private static void AddLookupSymbolsInfoInUsings( ImmutableArray <NamespaceOrTypeAndUsingDirective> usings, LookupSymbolsInfo result, LookupOptions options, Binder originalBinder) { if (originalBinder.Flags.Includes(BinderFlags.InScriptUsing)) { return; } Debug.Assert(!options.CanConsiderNamespaces()); // look in all using namespaces foreach (var namespaceSymbol in usings) { foreach (var member in namespaceSymbol.NamespaceOrType.GetMembersUnordered()) { if (IsValidLookupCandidateInUsings(member) && originalBinder.CanAddLookupSymbolInfo(member, options, result, null)) { result.AddSymbol(member, member.Name, member.GetArity()); } } } }
private static void AddAliasSymbolToResult( LookupSymbolsInfo result, AliasSymbol aliasSymbol, LookupOptions options, Binder originalBinder ) { var targetSymbol = aliasSymbol.GetAliasTarget(basesBeingResolved: null); if ( originalBinder.CanAddLookupSymbolInfo( targetSymbol, options, result, accessThroughType: null, aliasSymbol: aliasSymbol ) ) { result.AddSymbol(aliasSymbol, aliasSymbol.Name, 0); } }