@Test public void unknown_function() { FunctionSymbolData a = data("a"); FunctionSymbolIndex index = index(a); FunctionSymbol result = index.get(qualifiedName("unknown")); assertThat(result.isUnknownSymbol()).isTrue(); assertThat(result.location()).isInstanceOf(UnknownLocationInFile.class); assertThat(result.hasReturn()).isFalse(); assertThat(result.hasFuncGetArgs()).isFalse(); }
public FunctionSymbol get(QualifiedName qualifiedName) { return symbolsByQualifiedName.computeIfAbsent(qualifiedName, qn -> { List<FunctionSymbolData> all = projectSymbolData.functionSymbolData(qn); if (all.size() == 1) { return new FunctionSymbolImpl(all.get(0)); } else { return new UnknownFunctionSymbol(qualifiedName); } }); }
FunctionSymbolIndex { public FunctionSymbol get(QualifiedName qualifiedName) { return symbolsByQualifiedName.computeIfAbsent(qualifiedName, qn -> { List<FunctionSymbolData> all = projectSymbolData.functionSymbolData(qn); if (all.size() == 1) { return new FunctionSymbolImpl(all.get(0)); } else { return new UnknownFunctionSymbol(qualifiedName); } }); } }
FunctionSymbolIndex { public FunctionSymbol get(QualifiedName qualifiedName) { return symbolsByQualifiedName.computeIfAbsent(qualifiedName, qn -> { List<FunctionSymbolData> all = projectSymbolData.functionSymbolData(qn); if (all.size() == 1) { return new FunctionSymbolImpl(all.get(0)); } else { return new UnknownFunctionSymbol(qualifiedName); } }); } FunctionSymbolIndex(ProjectSymbolData projectSymbolData); }
FunctionSymbolIndex { public FunctionSymbol get(QualifiedName qualifiedName) { return symbolsByQualifiedName.computeIfAbsent(qualifiedName, qn -> { List<FunctionSymbolData> all = projectSymbolData.functionSymbolData(qn); if (all.size() == 1) { return new FunctionSymbolImpl(all.get(0)); } else { return new UnknownFunctionSymbol(qualifiedName); } }); } FunctionSymbolIndex(ProjectSymbolData projectSymbolData); static FunctionSymbolIndex create(Set<FunctionSymbolData> fileDeclarations, ProjectSymbolData projectSymbolData); FunctionSymbol get(QualifiedName qualifiedName); FunctionSymbol get(FunctionSymbolData symbolData); }
FunctionSymbolIndex { public FunctionSymbol get(QualifiedName qualifiedName) { return symbolsByQualifiedName.computeIfAbsent(qualifiedName, qn -> { List<FunctionSymbolData> all = projectSymbolData.functionSymbolData(qn); if (all.size() == 1) { return new FunctionSymbolImpl(all.get(0)); } else { return new UnknownFunctionSymbol(qualifiedName); } }); } FunctionSymbolIndex(ProjectSymbolData projectSymbolData); static FunctionSymbolIndex create(Set<FunctionSymbolData> fileDeclarations, ProjectSymbolData projectSymbolData); FunctionSymbol get(QualifiedName qualifiedName); FunctionSymbol get(FunctionSymbolData symbolData);  }