protected XVar getNonLocal(XTree tree, String name, XVarAccess access) {
		XScope scope = this;
		XVar var;
		while (scope != null) {
			if (access == XVarAccess.NONE || !(scope instanceof XClassScope)) {
				var = scope.locals.get(name);
				if (var != null) {
					return var;
				}
			}
			if (scope == base)
				break;
			scope = scope.parent;
		}
		if (base.parent == null) {
			return base == module ? module.getOrCreateGlobal(tree, name) : null;
		}
		var = base.parent.getNonLocal(tree, name, access);
		if (var instanceof XGlobal)
			return var;
		var = new XClosureVar(var);
		base.addClosure((XClosureVar) var);
		return var;
	}