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

org.jruby.runtime.callsite.XorCallSite Maven / Gradle / Ivy

There is a newer version: 9.4.7.0
Show newest version
package org.jruby.runtime.callsite;

import org.jruby.RubyFixnum;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

public class XorCallSite extends NormalCachingCallSite {
    public XorCallSite() {
        super("^");
    }

    public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, long fixnum) {
        if (self instanceof RubyFixnum && !context.runtime.isFixnumReopened()) {
            return ((RubyFixnum) self).op_xor(context, fixnum);
        }
        return super.call(context, caller, self, fixnum);
    }

    @Override
    public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg) {
        if (self instanceof RubyFixnum && !context.runtime.isFixnumReopened()) {
            return ((RubyFixnum) self).op_xor(context, arg);
        }
        return super.call(context, caller, self, arg);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy