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

org.jruby.ir.operands.Self Maven / Gradle / Ivy

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

import org.jruby.ir.IRVisitor;
import org.jruby.ir.transformations.inlining.InlinerInfo;
import org.jruby.runtime.DynamicScope;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

public class Self extends LocalVariable {
    public static final Self SELF = new Self();

    private Self() {
        super("%self", 0, 0);
    }

    public boolean isSelf() {
        return true;
    }

    @Override
    public boolean equals(Object obj) {
        return obj == this;
    }

    @Override
    public Object retrieve(ThreadContext context, IRubyObject self, DynamicScope currDynScope, Object[] temp) {
        return self;
    }

    @Override
    public LocalVariable clone() {
        return this;
    }

    @Override
    public Operand cloneForInlining(InlinerInfo ii) {
        return ii.getSelfValue(this);
    }

    @Override
    public Variable cloneForCloningClosure(InlinerInfo ii) {
        return this;
    }

    @Override
    public void visit(IRVisitor visitor) {
        visitor.Self(this);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy