Determine all free variables which are used within the given expression. A
free variable is one which is not bound within the expression itself.

@param e
@param freeVars
978225
public void freeVariables(SyntacticItem e, Set<WyalFile.VariableDeclaration> freeVars) {
		if (e instanceof Expr.VariableAccess) {
			Expr.VariableAccess va = (Expr.VariableAccess) e;
			freeVars.add(va.getVariableDeclaration());
		} else if (e instanceof Expr.Quantifier) {
			Expr.Quantifier q = (Expr.Quantifier) e;
			freeVariables(q.getBody(), freeVars);
			// Remove any bound variables
			for (WyalFile.VariableDeclaration vd : q.getParameters()) {
				freeVars.remove(vd);
			}
		} else {
			for (int i = 0; i != e.size(); ++i) {
				SyntacticItem item = e.get(i);
				if (item != null) {
					freeVariables(item, freeVars);
				}
			}
		}
	}
1019959
static String getTypeVariableDefinition(TypeVariable variable)
      throws NoSourceNameException {
    Type[] bounds = variable.getBounds();
    if (bounds.length == 0 || (bounds.length == 1 && bounds[0].equals(Object.class))) {
      return variable.getName();
    }
    return getBoundedSourceName(variable.getName(), bounds, "extends");
  }
1091141
public boolean arrayAlreadyExistsForVarName(String varName) {
        SDVariable var = getVariable(varName);
        switch(var.getVariableType()){
            case VARIABLE:
                return variablesArrays.containsKey(varName);
            case ARRAY:
                long tid = Thread.currentThread().getId();
                return sessions.containsKey(tid) && sessions.get(tid).contains(varName, InferenceSession.OUTER_FRAME, 0, null);
            case CONSTANT:
                return constantArrays.containsKey(varName);
            case PLACEHOLDER:
                return placeholdersPerThread.containsKey(Thread.currentThread().getId()) &&
                        placeholdersPerThread.get(Thread.currentThread().getId()).containsKey(varName);
            default:
                throw new RuntimeException("Unknown variable type: " + var.getVariableType());
        }
    }
911405
public void setVariables(final Map<String,Object> variables) {
        if (variables == null) {
            return;
        }
        this.variables.putAll(variables);
    }
818456
private void checkForUnknownVariables(TokenList tokens) {
        TokenList.Token t = tokens.getFirst();
        while( t != null ) {
            if( t.getType() == Type.WORD )
                throw new ParseError("Unknown variable on right side. "+t.getWord());
            t = t.next;
        }
    }
1366408
final List<Type> freeVarsIn(Type t) {
        ListBuffer<Type> buf = new ListBuffer<>();
        for (Type iv : inferenceVars()) {
            if (t.contains(iv)) {
                buf.add(iv);
            }
        }
        return buf.toList();
    }
505225
public List<Variable> getUsedVariables() {
        ArrayList<Variable> vars = new ArrayList<Variable>();

        for (Operand o : getOperands()) {
            o.addUsedVariables(vars);
        }

        return vars;
    }
1009174
private static String typeVariableToString(final TypeVariable<?> v) {
        final StringBuilder buf = new StringBuilder(v.getName());
        final Type[] bounds = v.getBounds();
        if (bounds.length > 0 && !(bounds.length == 1 && Object.class.equals(bounds[0]))) {
            buf.append(" extends ");
            appendAllTo(buf, " & ", v.getBounds());
        }
        return buf.toString();
    }
598802
private boolean vForVariable(String loopVariablesDefinition, TemplateParserContext context) {
    Matcher matcher = VFOR_VARIABLE.matcher(loopVariablesDefinition);
    if (matcher.matches()) {
      initLoopVariable(matcher.group(1), matcher.group(2), context);
      indexVariableInfo = null;
      return true;
    }

    return false;
  }
420033
protected static Variable findTargetVariable(VariableExpression ve) {
        final Variable accessedVariable = ve.getAccessedVariable() != null ? ve.getAccessedVariable() : ve;
        if (accessedVariable != ve) {
            if (accessedVariable instanceof VariableExpression)
                return findTargetVariable((VariableExpression) accessedVariable);
        }
        return accessedVariable;
    }
1238578
@Override
	public LexNameSet caseASeqMultipleBind(ASeqMultipleBind node, FreeVarInfo info) throws AnalysisException
	{
		return node.getSeq().apply(this, info);
	}
590341
protected void initializeVariable(HistoricVariableInstanceEntity e) {
    if (Context.getCommandContext() != null && e != null && e.getVariableType() != null) {
      e.getValue();

      // make sure JPA entities are cached for later retrieval
      if (JPAEntityVariableType.TYPE_NAME.equals(e.getVariableType().getTypeName()) || JPAEntityListVariableType.TYPE_NAME.equals(e.getVariableType().getTypeName())) {
        ((CacheableVariable) e.getVariableType()).setForceCacheable(true);
      }
    }
  }
1104803
def contains_variables_from_set(expression, variables):
    """"""
    if hasattr(expression, 'variable_name') and expression.variable_name in variables:
        return True
    if isinstance(expression, Operation):
        return any(contains_variables_from_set(o, variables) for o in op_iter(expression))
    return False
354884
@Override
    public R visitVariableAsResourceVariable(VariableElement e, P p) {
        return defaultAction(e, p);
    }
63905
public void setTemplateVars(List<TemplateVar> templateVars) {
		this.templateVars.clear();
		if(templateVars != null && !templateVars.isEmpty()) {
			this.templateVars.addAll(templateVars);
		}
	}
573768
@Override
    public void setVariablesScope(Variables variables) {
	this.variables = variables;
	undefinedScope().setVariableScope(variables);

	if (variables instanceof ClosureScope) {
	    variables = ((ClosureScope) variables).getVariables();
	}
	if (variables instanceof StaticScope) {
	    activeComponent = ((StaticScope) variables).getComponent();
	}
	else if (variables instanceof ComponentScope) {
	    activeComponent = ((ComponentScope) variables).getComponent();
	}
	else {
	    activeComponent = null;
	}
    }
577567
private boolean isDefinedInSources(NodeTraversal t, String varName) {
    Var objectVar = t.getScope().getVar(varName);
    return objectVar != null && !objectVar.isExtern();
  }