protected int getActualArgsCount(StaticScope scope) { if (shouldUseBoxedArgs(scope)) { return 1; // use IRubyObject[] } else { return scope.getRequiredArgs(); // specific arity } }
protected int getActualArgsCount(StaticScope scope) { if (shouldUseBoxedArgs(scope)) { return 1; // use IRubyObject[] } else { return scope.getRequiredArgs(); // specific arity } }
private Arity calculateArity() { StaticScope s = scope; if (s.getOptionalArgs() > 0 || s.getRestArg() >= 0) return Arity.required(s.getRequiredArgs()); return Arity.createArity(s.getRequiredArgs()); }
@Override public IRubyObject[] getArgValues() { // if we're not the "argument scope" for zsuper, try our parent if (!staticScope.isArgumentScope()) { return parent.getArgValues(); } int totalArgs = staticScope.getRequiredArgs() + staticScope.getOptionalArgs(); assert totalArgs == 0 : this.getClass().getSimpleName() + " only supports scopes with no variables"; return IRubyObject.NULL_ARRAY; } }
@Override public IRubyObject[] getArgValues() { // if we're not the "argument scope" for zsuper, try our parent if (!staticScope.isArgumentScope()) { return parent.getArgValues(); } int totalArgs = staticScope.getRequiredArgs() + staticScope.getOptionalArgs(); assert totalArgs == 0 : this.getClass().getSimpleName() + " only supports scopes with no variables"; return IRubyObject.NULL_ARRAY; } }
private Arity calculateArity() { StaticScope s = scope; if (s.getOptionalArgs() > 0 || s.getRestArg() >= 0) return Arity.required(s.getRequiredArgs()); return Arity.createArity(s.getRequiredArgs()); }
private Arity calculateArity() { StaticScope s = method.getStaticScope(); if (s.getOptionalArgs() > 0 || s.getRestArg() >= 0) return Arity.required(s.getRequiredArgs()); return Arity.createArity(s.getRequiredArgs()); }
private Arity calculateArity() { StaticScope s = method.getStaticScope(); if (s.getOptionalArgs() > 0 || s.getRestArg() >= 0) return Arity.required(s.getRequiredArgs()); return Arity.createArity(s.getRequiredArgs()); }
protected boolean shouldUseBoxedArgs(StaticScope scope) { return scope.getRestArg() >= 0 || scope.getRestArg() == -2 || scope.getOptionalArgs() > 0 || scope.getRequiredArgs() > 3; }
protected boolean shouldUseBoxedArgs(StaticScope scope) { return scope.getRestArg() >= 0 || scope.getRestArg() == -2 || scope.getOptionalArgs() > 0 || scope.getRequiredArgs() > 3; }
public void emit(IRModuleBody method) { String name = method.getName(); if (name.indexOf("DUMMY_MC") != -1) { name = "METACLASS"; } name = emitScope(method, name, 0); // push a method handle for binding purposes jvm.method().pushHandle(jvm.clsData().clsName, name, method.getStaticScope().getRequiredArgs()); }
public void emit(IRModuleBody method) { String name = method.getName(); if (name.indexOf("DUMMY_MC") != -1) { name = "METACLASS"; } name = emitScope(method, name, 0); // push a method handle for binding purposes jvm.method().pushHandle(jvm.clsData().clsName, name, method.getStaticScope().getRequiredArgs()); }
@Override public String getSignature() { if (shouldUseBoxedArgs(scope)) { specificArity = false; return StandardASMCompiler.getStaticMethodSignature(script.getClassname(), 4); } else { specificArity = true; return StandardASMCompiler.getStaticMethodSignature(script.getClassname(), scope.getRequiredArgs()); } }
public String getSignature() { if (shouldUseBoxedArgs(scope)) { specificArity = false; return StandardASMCompiler.getStaticMethodSignature(script.getClassname(), 4); } else { specificArity = true; return StandardASMCompiler.getStaticMethodSignature(script.getClassname(), scope.getRequiredArgs()); } }
public String getSignature() { if (shouldUseBoxedArgs(scope)) { specificArity = false; return StandardASMCompiler.getStaticMethodSignature(script.getClassname(), 4); } else { specificArity = true; return StandardASMCompiler.getStaticMethodSignature(script.getClassname(), scope.getRequiredArgs()); } }
@Override public String getSignature() { if (shouldUseBoxedArgs(scope)) { specificArity = false; return StandardASMCompiler.getStaticMethodSignature(script.getClassname(), 4); } else { specificArity = true; return StandardASMCompiler.getStaticMethodSignature(script.getClassname(), scope.getRequiredArgs()); } }
public void beginClass(StaticScope scope) { assert scope != null : "compiling a class body with no scope"; // fill in all vars with nil so compiler is happy about future accesses if (scope.getNumberOfVariables() > 0) { // if we don't have opt args, start after args (they will be assigned later) // this is for crap like def foo(a = (b = true; 1)) which numbers b before a // FIXME: only starting after required args, since opt args may access others // and rest args conflicts with compileRoot using "0" to indicate [] signature. int start = scope.getRequiredArgs(); for (int i = start; i < scope.getNumberOfVariables(); i++) { methodCompiler.loadNil(); assignLocalVariable(i, false); } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); } }
public void beginClass(StaticScope scope) { assert scope != null : "compiling a class body with no scope"; // fill in all vars with nil so compiler is happy about future accesses if (scope.getNumberOfVariables() > 0) { // if we don't have opt args, start after args (they will be assigned later) // this is for crap like def foo(a = (b = true; 1)) which numbers b before a // FIXME: only starting after required args, since opt args may access others // and rest args conflicts with compileRoot using "0" to indicate [] signature. int start = scope.getRequiredArgs(); for (int i = start; i < scope.getNumberOfVariables(); i++) { methodCompiler.loadNil(); assignLocalVariable(i, false); } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); } }
public void emit(IRMethod method) { String name = emitScope(method, method.getName(), method.getCallArgs().length); // push a method handle for binding purposes jvm.method().pushHandle(jvm.clsData().clsName, name, method.getStaticScope().getRequiredArgs()); }
public void emit(IRMethod method) { String name = emitScope(method, method.getName(), method.getCallArgs().length); // push a method handle for binding purposes jvm.method().pushHandle(jvm.clsData().clsName, name, method.getStaticScope().getRequiredArgs()); }