Beispiel #1
0
        public override void LookupSymbolsInSingleBinder(LookupResult result, LookupConstraints constraints)
        {
            Debug.Assert(result.IsClear);

            if (IsSubmission)
            {
                this.LookupMembersInternal(result, constraints.WithQualifier(_container));
                return;
            }

            var imports = GetImports(constraints.BasesBeingResolved);

            // first lookup members of the namespace
            if ((constraints.Options & LookupOptions.NamespaceAliasesOnly) == 0 && _container != null)
            {
                this.LookupMembersInternal(result, constraints.WithQualifier(_container));

                if (result.IsMultiViable)
                {
                    // symbols cannot conflict with using alias names
                    if (constraints.MetadataName == constraints.Name && imports.IsUsingAlias(constraints.Name, constraints.OriginalBinder.IsSemanticModelBinder))
                    {
                        LanguageDiagnosticInfo diagInfo = new LanguageDiagnosticInfo(InternalErrorCode.ERR_ConflictAliasAndMember, constraints.Name, _container);
                        var error = new ExtendedErrorTypeSymbol((NamespaceOrTypeSymbol)null, constraints.Name, constraints.MetadataName, diagInfo, unreported: true);
                        result.SetFrom(LookupResult.Good(error)); // force lookup to be done w/ error symbol as result
                    }

                    return;
                }
            }

            // next try using aliases or symbols in imported namespaces
            imports.LookupSymbol(result, constraints);
        }
        protected override LookupConstraints AdjustConstraints(LookupConstraints constraints)
        {
            LookupConstraints result = base.AdjustConstraints(constraints);

            if (!result.IsMemberLookup && _attributeTypeOnly)
            {
                result = result.WithOptions(result.Options | LookupOptions.AttributeTypeOnly);
            }
            return(result);
        }
Beispiel #3
0
        public override void LookupSymbolsInSingleBinder(LookupResult result, LookupConstraints constraints)
        {
            Debug.Assert(result.IsClear);

            var specialSymbol = Compilation.GetSpecialSymbol(constraints.MetadataName);

            if (specialSymbol.Kind != LanguageSymbolKind.ErrorType)
            {
                result.SetFrom(LookupResult.Good(specialSymbol));
            }
        }
        public override void LookupSymbolsInSingleBinder(LookupResult result, LookupConstraints constraints)
        {
            var hostObjectType = GetHostObjectType();

            if (hostObjectType.Kind == LanguageSymbolKind.ErrorType)
            {
                // The name '{0}' does not exist in the current context (are you missing a reference to assembly '{1}'?)
                result.SetFrom(new LanguageDiagnosticInfo(
                                   InternalErrorCode.ERR_NameNotInContextPossibleMissingReference,
                                   new object[] { constraints.Name, ((MissingMetadataTypeSymbol)hostObjectType).ContainingAssembly.Identity },
                                   ImmutableArray <Symbol> .Empty,
                                   ImmutableArray <Location> .Empty
                                   ));
            }
            else
            {
                LookupMembersInternal(result, constraints.WithQualifier(hostObjectType));
            }
        }
Beispiel #5
0
        public override void LookupSymbolsInSingleBinder(LookupResult result, LookupConstraints constraints)
        {
            Debug.Assert(result.IsClear);

            if (this.ContainingSymbol == null)
            {
                return;
            }

            if (IsSubmission)
            {
                this.LookupMembersInternal(result, constraints.WithQualifier(this.ContainingSymbol));
                return;
            }

            // first lookup members of the namespace
            if ((constraints.Options & LookupOptions.NamespaceAliasesOnly) == 0)
            {
                this.LookupMembersInternal(result, constraints.WithQualifier(this.ContainingSymbol));
            }
        }
Beispiel #6
0
 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupConstraints constraints)
 {
     if (this.ContainingSymbol != null)
     {
         this.AddMemberLookupSymbolsInfo(result, constraints.WithQualifier(this.ContainingSymbol));
     }
 }
Beispiel #7
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);
            }
        }
Beispiel #8
0
 protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupConstraints constraints)
 {
     foreach (var symbol in Compilation.SourceAssembly.SpecialSymbols)
     {
         result.AddSymbol(symbol, symbol.Name, symbol.MetadataName);
     }
 }
        protected override void AddLookupSymbolsInfoInSingleBinder(LookupSymbolsInfo result, LookupConstraints constraints)
        {
            var hostObjectType = GetHostObjectType();

            if (hostObjectType.Kind != LanguageSymbolKind.ErrorType)
            {
                AddMemberLookupSymbolsInfo(result, constraints.WithQualifier(hostObjectType));
            }
        }