Check if a variable is unique.
<p>
@param var the variable
491949
private void checkUnique(Variable var) {
		if (inputs.containsKey(var.getName())) {
			throw new FuzzerException(var.getName() + ": already defined");
		}
		if (outputs.containsKey(var.getName())) {
			throw new FuzzerException(var.getName() + ": already defined");
		}
	}
466943
function isUsedVariable(variable) {
            const functionNodes = getFunctionDefinitions(variable),
                isFunctionDefinition = functionNodes.length > 0;
            let rhsNode = null;

            return variable.references.some(ref => {
                if (isForInRef(ref)) {
                    return true;
                }

                const forItself = isReadForItself(ref, rhsNode);

                rhsNode = getRhsNode(ref, rhsNode);

                return (
                    isReadRef(ref) &&
                    !forItself &&
                    !(isFunctionDefinition && isSelfReference(ref, functionNodes))
                );
            });
        }
1120505
public static boolean isVariable(String s) {
        if (s == null ||
                s.length() < 3 ||
                !s.startsWith("$") ||
                !Character.isLetter(s.charAt(1))) {
            return false;
        }

        // check that the rest of the string is comprised of letters and digits only:
        for (int i = 2; i < s.length(); i++) {
            char c = s.charAt(i);
            if (!Character.isLetterOrDigit(c)) {
                return false;
            }
        }

        return true;
    }
1165708
public boolean containsKey(Object key) {
    if(wrappedBindings.containsKey(key)) {
      return true;
    }
    if (key instanceof String) {
      return variableContext.containsVariable((String) key);
    }
    else {
      return false;
    }
  }
398758
public void checkStaticVariableDeclaration(Decl.StaticVariable decl) {
		Environment environment = new Environment();
		// Check type not void
		checkVariableDeclaration(decl, environment);
	}
203361
public Variable getDeclaredVariable(String name, boolean publicOnly) {
        //private Set mPrivateVars;

        Variable var = mDeclared.get(name);
        if (var != null) {
            // If its okay to be private or its public then...
            if (!publicOnly || mPrivateVars == null ||
                !mPrivateVars.contains(var)) {
                return var;
            }
        }
        
        if (mParent != null) {
            return mParent.getDeclaredVariable(name);
        }
        
        return null;
    }
569218
@Override
    public boolean isConstructed(Variable variable) {
        return getVariables().contains(variable) && getRootNode().isConstructed(variable, getChildren());
    }
670380
public void declareVariables(Variable[] vars) {
        for (int i=0; i<vars.length; i++) {
            vars[i] = declareVariable(vars[i]);
        }
    }
1276047
private boolean eachVariableOccursOnlyOnce() {
        int lit;
        for (int i = 0; i < this.addedlits.size(); i++) {
            lit = this.addedlits.get(i);
            assert marked(lit) == 0;
            assert marked(-lit) == 0;
        }
        boolean res = true;
        for (int i = 0; i < this.addedlits.size(); i++) {
            lit = this.addedlits.get(i);
            if (marked(lit) != 0 || marked(-lit) != 0) { res = false; } else { mark(lit); }
        }
        unmark();
        return res;
    }
1369372
private final void addVariableValue(String value, String variableName) {
		if (StringUtils.isNotEmpty(variableName)) {
			JMeterVariables vars = getVariables();
			if (vars != null) {
				vars.put(variableName, value);
			}
		}
	}
41168
function(var_name)
    {
        for (var i=0; i<this._features.length; i++)
        {
             if (this._features[i] == var_name)
                 return false;
        }
        this._features.push(var_name);
        return true;
    }
1288264
private boolean isGlobalVarReference(String name, Scope s) {
    Var v = s.getVar(name);
    if (v == null && externsScope != null) {
      v = externsScope.getVar(name);
    }
    return v != null && !v.isLocal();
  }
530957
public static boolean isVariableNamePartValid( String namePart, Scope scope ) {
        if ( DIGITS_PATTERN.matcher(namePart).matches() ) {
            return true;
        }
        if ( REUSABLE_KEYWORDS.contains(namePart) ) {
            return scope.followUp(namePart, true);
        }
        return isVariableNameValid(namePart);
    }
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;
	}
    }
376926
public int getState(Var var) {
        Integer state = config.get(var);
        if (state == null) {
            throw new RuntimeException("VarConfig does not contain var: " + var);
        }
        return state;
    }
61380
public int getID(Variable var) {
		Variable[] vars = this.getVariables();
		for (int i = 0; i < vars.length; i++) {
			if (vars[i].equals(var)) return i;
		}
		return -1;
	}
606874
public static final VariableNumMap singleton(int varNum, String varName, Variable variable) {
    return new VariableNumMap(new int[] {varNum}, new String[] {varName}, new Variable[] {variable});
  }