@Test public void test_arrow_function() throws Exception { highlight("<?php $a = 1; $b = 2; $f = fn($b) => $a + $b; foo($a); foo($b);"); checkSymbolReferences(1, 6, ImmutableList.of( textRange(1, 37, 1, 39), textRange(1, 50, 1, 52) )); checkSymbolReferences(1, 14, ImmutableList.of( textRange(1, 59, 1, 61) )); checkSymbolReferences(1, 30, ImmutableList.of( textRange(1, 42, 1, 44) )); }
public void highlight(SymbolTable symbolTable, NewSymbolTable newSymbolTable) { for (Symbol symbol : ((SymbolTableImpl) symbolTable).getSymbols()) { SyntaxToken token = symbol.declaration().token(); NewSymbol newSymbol = newSymbolTable.newSymbol(token.line(), token.column(), token.endLine(), token.endColumn()); for (SyntaxToken usageToken : symbol.usages()) { newSymbol.newReference(usageToken.line(), usageToken.column(), usageToken.endLine(), usageToken.endColumn()); } } }
SymbolHighlighter { public void highlight(SymbolTable symbolTable, NewSymbolTable newSymbolTable) { for (Symbol symbol : ((SymbolTableImpl) symbolTable).getSymbols()) { SyntaxToken token = symbol.declaration().token(); NewSymbol newSymbol = newSymbolTable.newSymbol(token.line(), token.column(), token.endLine(), token.endColumn()); for (SyntaxToken usageToken : symbol.usages()) { newSymbol.newReference(usageToken.line(), usageToken.column(), usageToken.endLine(), usageToken.endColumn()); } } } }
SymbolHighlighter { public void highlight(SymbolTable symbolTable, NewSymbolTable newSymbolTable) { for (Symbol symbol : ((SymbolTableImpl) symbolTable).getSymbols()) { SyntaxToken token = symbol.declaration().token(); NewSymbol newSymbol = newSymbolTable.newSymbol(token.line(), token.column(), token.endLine(), token.endColumn()); for (SyntaxToken usageToken : symbol.usages()) { newSymbol.newReference(usageToken.line(), usageToken.column(), usageToken.endLine(), usageToken.endColumn()); } } }  }
SymbolHighlighter { public void highlight(SymbolTable symbolTable, NewSymbolTable newSymbolTable) { for (Symbol symbol : ((SymbolTableImpl) symbolTable).getSymbols()) { SyntaxToken token = symbol.declaration().token(); NewSymbol newSymbol = newSymbolTable.newSymbol(token.line(), token.column(), token.endLine(), token.endColumn()); for (SyntaxToken usageToken : symbol.usages()) { newSymbol.newReference(usageToken.line(), usageToken.column(), usageToken.endLine(), usageToken.endColumn()); } } }  void highlight(SymbolTable symbolTable, NewSymbolTable newSymbolTable); }
SymbolHighlighter { public void highlight(SymbolTable symbolTable, NewSymbolTable newSymbolTable) { for (Symbol symbol : ((SymbolTableImpl) symbolTable).getSymbols()) { SyntaxToken token = symbol.declaration().token(); NewSymbol newSymbol = newSymbolTable.newSymbol(token.line(), token.column(), token.endLine(), token.endColumn()); for (SyntaxToken usageToken : symbol.usages()) { newSymbol.newReference(usageToken.line(), usageToken.column(), usageToken.endLine(), usageToken.endColumn()); } } }  void highlight(SymbolTable symbolTable, NewSymbolTable newSymbolTable);  }