@Test public void shouldGetNothingWhenQualifyingQualifiedSymbolThatHasUnimportedModuleName() { assertThat(moduleScope.qualify(qualified("scotch.external", "fn")), is(Optional.empty())); }
@Override public Optional<Symbol> qualify(Symbol symbol) { Optional<Symbol> optionalSymbol = importScopes.stream() .map(importScope -> importScope.qualify_(symbol)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); if (optionalSymbol.isPresent()) { return optionalSymbol; } else { return parent.qualify(symbol); } }
ModuleScope extends BlockScope { @Override public Optional<Symbol> qualify(Symbol symbol) { Optional<Symbol> optionalSymbol = importScopes.stream() .map(importScope -> importScope.qualify_(symbol)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); if (optionalSymbol.isPresent()) { return optionalSymbol; } else { return parent.qualify(symbol); } } }
ModuleScope extends BlockScope { @Override public Optional<Symbol> qualify(Symbol symbol) { Optional<Symbol> optionalSymbol = importScopes.stream() .map(importScope -> importScope.qualify_(symbol)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); if (optionalSymbol.isPresent()) { return optionalSymbol; } else { return parent.qualify(symbol); } } ModuleScope(Scope parent, TypeScope types, SymbolResolver resolver, SymbolGenerator symbolGenerator, String moduleName); }
ModuleScope extends BlockScope { @Override public Optional<Symbol> qualify(Symbol symbol) { Optional<Symbol> optionalSymbol = importScopes.stream() .map(importScope -> importScope.qualify_(symbol)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); if (optionalSymbol.isPresent()) { return optionalSymbol; } else { return parent.qualify(symbol); } } ModuleScope(Scope parent, TypeScope types, SymbolResolver resolver, SymbolGenerator symbolGenerator, String moduleName); @Override Scope enterScope(List<Import> imports); @Override Set<Symbol> getContext(Type type); @Override Optional<TypeClassDescriptor> getMemberOf(ValueReference valueRef); @Override Optional<Operator> getOperator(Symbol symbol); @Override Optional<Type> getRawValue(Symbol symbol); @Override Optional<SymbolEntry> getSiblingEntry(Symbol symbol); @Override boolean isDefined(Symbol symbol); @Override Optional<Symbol> qualify(Symbol symbol); }
ModuleScope extends BlockScope { @Override public Optional<Symbol> qualify(Symbol symbol) { Optional<Symbol> optionalSymbol = importScopes.stream() .map(importScope -> importScope.qualify_(symbol)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); if (optionalSymbol.isPresent()) { return optionalSymbol; } else { return parent.qualify(symbol); } } ModuleScope(Scope parent, TypeScope types, SymbolResolver resolver, SymbolGenerator symbolGenerator, String moduleName); @Override Scope enterScope(List<Import> imports); @Override Set<Symbol> getContext(Type type); @Override Optional<TypeClassDescriptor> getMemberOf(ValueReference valueRef); @Override Optional<Operator> getOperator(Symbol symbol); @Override Optional<Type> getRawValue(Symbol symbol); @Override Optional<SymbolEntry> getSiblingEntry(Symbol symbol); @Override boolean isDefined(Symbol symbol); @Override Optional<Symbol> qualify(Symbol symbol);  }