------------------------ ------------------------
[x:int][y:int] ⊢ y:int [x:int][y:int] ⊢ x:int
-------------------------------------------------------
[x:int][y:int] ⊢ (y = x;): unit
----------------------------------
[x:int] ⊢ (int y; y = x;): unit Γ[I:int] ⊢ (S): unit
----------------------------------- ---------------------------
⊢ (int x; int y; y = x;): unit # Goal Γ ⊢ (int I; S): unit
class Visitor extends ASTVisitor {
...
public boolean visit(final VariableDeclarationStatement node) {
final VariableDeclarationFragment vdf = (VariableDeclarationFragment) node.fragments().get(0);
final String name = vdf.getName().getIdentifier();
if (this.nameMap.containsKey(name)) {
throw new Error(...);
}
this.nameMap.put(name, node);
return false;
}
...
}