/** * Checks if the given variable name is defined in this scope or its parents. * * @param name name of variable to be checked * @return true, if given name is defined in this or one of the parents' scope */ public boolean containsDefinition(String name) { for (Variable v : variables) { if (v.getName().equals(name)) { return true; } } if (this != GLOBAL) { return parent.containsDefinition(name); } else { return false; } }