@Override
	public int setup(XTreeCompiler compiler, XCodeGen codeGen) {
		result = scope.get(ident, ident.name, access);
		switch(result.r){
		case DUPLICATED:
			compiler.addDiagnostic(ident, "duplicated.var", ident.name, result.var.t.position.position.line);
			break;
		case FOUND:
			break;
		case DECLARED:
			if(result.var.getClass()==XVar.class){
				codeGen.addInstruction(t, XOpcode.LOADN);
				codeGen.addInstruction(t, result.var);
			}
			break;
		case NOT_FOUND:
			compiler.addDiagnostic(ident, "var.not.found", ident.name);
			return 0;
		default:
			break;
		}
		if(result.var instanceof XClassAttr){
			XVar var = ((XClassAttr)result.var).getAccess();
			getVar(t, var, codeGen);
			//codeGen.addInstruction(t, XOpcode.GETBOTTOM1, 0);
			return 1;
		}else if(result.var instanceof XClosureVar){
			XVar base = ((XClosureVar)result.var).base;
			if(base instanceof XClassAttr){
				if(base == ((XClosureVar)result.var).var){
					codeGen.addInstructionB(t, XOpcode.GETBOTTOM1, 0);
				}else{
					codeGen.addInstruction2(t, XOpcode.GET_CLOSURE, result.var);
				}
			}
			return 1;
		}
		return 0;
	}