All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jruby.compiler.ir.operands.RenamedVariable Maven / Gradle / Ivy

There is a newer version: 9.4.7.0
Show newest version
package org.jruby.compiler.ir.operands;

import org.jruby.interpreter.InterpreterContext;

/**
 * Generic variable with a custom prefix -- mostly used during optimization passes
 * where we need to rename existing variables
 */
public class RenamedVariable extends TemporaryVariable {
    final String prefix;

    public RenamedVariable(String prefix, int offset) {
        super(offset);
		  this.prefix = prefix;
    }

    @Override
    public String getPrefix() {
        return this.prefix + "_";
    }

    @Override
    public Object retrieve(InterpreterContext interp) {
        return interp.getRenamedVariable(offset);
    }

    @Override
    public Object store(InterpreterContext interp, Object value) {
        return interp.setRenamedVariable(offset, value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy