Permalink
Browse files

[1.9] Fix Method#parameters for AOT-compiled methods.

  • Loading branch information...
1 parent 9e73f72 commit 89857bd92a74db6b84c9b2e3d57dae94b106df61 @headius headius committed with yokolet Jan 8, 2011
@@ -37,11 +37,13 @@
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.Block;
import org.jruby.runtime.MethodFactory;
+import org.jruby.runtime.PositionAware;
-public abstract class CompiledMethod extends JavaMethod implements Cloneable {
+public abstract class CompiledMethod extends JavaMethod implements Cloneable, PositionAware {
protected Object $scriptObject;
+ protected ISourcePosition position;
- public static class LazyCompiledMethod extends DynamicMethod implements Cloneable {
+ public static class LazyCompiledMethod extends DynamicMethod implements Cloneable, PositionAware {
private final String method;
private final Arity arity;
private final StaticScope scope;
@@ -198,13 +200,24 @@ public DynamicMethod dup() {
if (compiledMethod == null) initializeMethod();
return compiledMethod.dup();
}
+
+ public String getFile() {
+ if (compiledMethod == null) initializeMethod();
+ return position.getFile();
+ }
+
+ public int getLine() {
+ if (compiledMethod == null) initializeMethod();
+ return position.getStartLine();
+ }
}
protected CompiledMethod() {}
- protected void init(RubyModule implementationClass, Arity arity, Visibility visibility, StaticScope staticScope, Object scriptObject, CallConfiguration callConfig) {
+ protected void init(RubyModule implementationClass, Arity arity, Visibility visibility, StaticScope staticScope, Object scriptObject, CallConfiguration callConfig, ISourcePosition position) {
this.$scriptObject = scriptObject;
+ this.position = position;
super.init(implementationClass, arity, visibility, staticScope, callConfig);
}
@@ -242,4 +255,12 @@ public DynamicMethod dup() {
public boolean isNative() {
return false;
}
+
+ public String getFile() {
+ return position.getFile();
+ }
+
+ public int getLine() {
+ return position.getStartLine();
+ }
}// SimpleInvocationMethod
@@ -221,7 +221,7 @@ public DynamicMethod getCompiledMethod(
}
CompiledMethod compiledMethod = (CompiledMethod)generatedClass.newInstance();
- compiledMethod.init(implementationClass, arity, visibility, scope, scriptObject, callConfig);
+ compiledMethod.init(implementationClass, arity, visibility, scope, scriptObject, callConfig, position);
return compiledMethod;
} catch(Exception e) {
e.printStackTrace();
@@ -50,7 +50,7 @@
public ReflectedCompiledMethod(RubyModule implementationClass, Arity arity,
Visibility visibility, StaticScope staticScope, Object scriptObject, Method method, CallConfiguration callConfig, ISourcePosition position) {
super();
- init(implementationClass, arity, visibility, staticScope, scriptObject, callConfig);
+ init(implementationClass, arity, visibility, staticScope, scriptObject, callConfig, position);
this.method = method;
this.position = position;

0 comments on commit 89857bd

Please sign in to comment.