@Override
 public void visitAssignmentStatement(AssignmentStatement assignmentStatement) {
   LocalReference localReference = assignmentStatement.getLocalReference();
   String referenceName = localReference.getName();
   if (!localReference.isModuleState()) {
     if (!stack.isEmpty()) {
       assignmentStatement.setLocalReference(
           context().referenceTableStack.peek().get(referenceName));
     }
     if (assignmentStatement.isDeclaring()) {
       locallyDeclared(referenceName);
     }
   } else {
     locallyDeclared(referenceName);
   }
   locallyAssigned(referenceName);
   assignmentStatement.getExpressionStatement().accept(this);
   if (assignmentStatement.getExpressionStatement() instanceof ClosureReference) {
     ClosureReference closure = (ClosureReference) assignmentStatement.getExpressionStatement();
     GoloFunction target = closure.getTarget();
     if (target.getSyntheticParameterNames().contains(referenceName)) {
       target.removeSyntheticParameter(referenceName);
       target.setSyntheticSelfName(referenceName);
     }
   }
 }
 private void makeArguments(GoloFunction function, Set<String> refs) {
   Set<String> existing = new HashSet<>(function.getParameterNames());
   for (String ref : refs) {
     if (!existing.contains(ref) && !ref.equals(function.getSyntheticSelfName())) {
       function.addSyntheticParameter(ref);
     }
   }
 }
 @Override
 public void visitFunction(GoloFunction function) {
   if (function.isSynthetic()) {
     newContext();
     declaredParameters(function.getParameterNames());
     function.getBlock().internReferenceTable();
     function.getBlock().accept(this);
     makeArguments(function, context().shouldBeArguments());
     dropUnused(context().shouldBeRemoved());
     dropContext();
   } else {
     function.getBlock().accept(this);
   }
 }
 @Override
 public void visitModule(GoloModule module) {
   for (GoloFunction function : module.getFunctions()) {
     function.accept(this);
   }
   for (Collection<GoloFunction> functions : module.getAugmentations().values()) {
     for (GoloFunction function : functions) {
       function.accept(this);
     }
   }
   for (Collection<GoloFunction> functions : module.getNamedAugmentations().values()) {
     for (GoloFunction function : functions) {
       function.accept(this);
     }
   }
 }