Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jruby.ir.instructions.calladapter;
 
 import java.util.List;
AttrAssign is weird. self[i] = 1 is treated as a functional call and it also returns no result.
public class AttrAssignCallAdapter extends CallAdapter {
    private String name;
    private Operand[] args;
    public AttrAssignCallAdapter(CallSite callSiteString nameOperand[] args) {
        super(callSite);
        this. = args;
        this. = name;
    }
    @Override
    public Object call(ThreadContext contextIRubyObject selfIRubyObject receiverDynamicScope currDynScopeObject[] temp) {
        IRubyObject[] values = prepareArguments(contextselfcurrDynScopetemp);
        if ( == null) {
            CallType callType = self == receiver ? . : .;
            Helpers.invoke(contextreceivervaluescallType.);
        } else {
            .call(contextselfreceivervalues);
        }
        return null;
    }
    protected IRubyObject[] prepareArguments(ThreadContext contextIRubyObject selfOperand[] argsDynamicScope currDynScopeObject[] temp) {
        List<IRubyObjectargList = new ArrayList<IRubyObject>();
        for (int i = 0; i < args.lengthi++) {
            IRubyObject rArg = (IRubyObjectargs[i].retrieve(contextselfcurrDynScopetemp);
            if (args[iinstanceof Splat) {
                argList.addAll(Arrays.asList(((RubyArrayrArg).toJavaArray()));
            } else {
                argList.add(rArg);
            }
        }
        return argList.toArray(new IRubyObject[argList.size()]);
    }
New to GrepCode? Check out our FAQ X