String name = _name.getLocalPart(); name = name.replace('.', '_'); name = name.replace('-', '_');
final String name = getVariable();
    public void translate(ClassGenerator classGen, MethodGenerator methodGen) {	final ConstantPoolGen cpg = classGen.getConstantPool();	final InstructionList il = methodGen.getInstructionList();	String name = _name.getLocalPart();	name = name.replace('.', '_');        name = name.replace('-', '_');	// Make sure that a variable instance is only compiled once	if (_compiled) return;	_compiled = true;	if (isLocal()) {	    // Push args to call addVariable()	    if (_escapes) {		il.append(classGen.loadTranslet());		il.append(new PUSH(cpg, _stackIndex));	    }	    // Compile variable value computation	    translateValue(classGen, methodGen);	    // Dup value only when needed	    if (_escapes) {		il.append(_type.DUP());	    }	    // Add a new local variable and store value	    if (_refs.isEmpty()) { // Remove it if nobody uses the value		il.append(_type.POP());		_local = null;	    }	    else {		   // Store in local var slot if referenced		if (_local == null) mapRegister(methodGen);		il.append(_type.STORE(_local.getIndex()));	    }	    // Store boxed value into the template's variable stack	    if (_escapes) {		_type.translateBox(classGen, methodGen);		il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS,							     ADD_VARIABLE,							     ADD_VARIABLE_SIG)));	    }	}	else {	    String signature = _type.toSignature();	    // Global variables are store in class fields	    if (classGen.containsField(name) == null) {		classGen.addField(new Field(ACC_PUBLIC, 					    cpg.addUtf8(name),					    cpg.addUtf8(signature),					    null, cpg.getConstantPool()));		// Push a reference to "this" for putfield		il.append(classGen.loadTranslet());		// Compile variable value computation		translateValue(classGen, methodGen);		// Store the variable in the allocated field		il.append(new PUTFIELD(cpg.addFieldref(classGen.getClassName(),						       name, signature)));	    }	}    }