Esempio n. 1
0
        protected override LookupResult Lookup(IdentifierNameSyntax name, Package fromPackage)
        {
            var identifier = name.Identifier.ValueText;

            // First look in the current container
            var result = Resolve(mergedContainer.GetMembers(identifier), fromPackage);

            if (!result.IsEmpty)
            {
                return(result);
            }

            // Then look in the imported names
            var importedSymbols = imports[identifier].Select(x => x.Reference).ToList();

            result = Resolve(importedSymbols, fromPackage);
            if (!result.IsEmpty)
            {
                return(result);
            }

            // Then look in containing scopes
            if (ContainingScope != null)
            {
                return(ContainingScope.Lookup(name, fromPackage));
            }

            return(LookupResult.Empty);
        }
Esempio n. 2
0
        protected override bool LookupWithoutNumber(Name name, [NotNullWhen(true)] out VariableBinding?binding)
        {
            if (VariableBinding.Name != name)
            {
                return(ContainingScope.Lookup(name, out binding));
            }

            binding = VariableBinding;
            return(true);
        }
        protected override bool LookupWithoutNumber(SimpleName name, out VariableBinding binding)
        {
            if (VariableBinding.Name == name)
            {
                binding = VariableBinding;
                return(true);
            }

            return(ContainingScope.Lookup(name, out binding));
        }
 public FixedList <ISymbol> LookupInContainingScope()
 {
     return(ContainingScope.Lookup(Name));
 }