File tree Expand file tree Collapse file tree 3 files changed +11
-36
lines changed
spec/truffle/tags/core/kernel
java/org/jruby/truffle/nodes/core Expand file tree Collapse file tree 3 files changed +11
-36
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -297,40 +297,6 @@ public RubySymbol calleeName(VirtualFrame frame) {
297
297
}
298
298
}
299
299
300
- @ CoreMethod (names = "caller" , isModuleFunction = true , optional = 1 )
301
- public abstract static class CallerNode extends CoreMethodArrayArgumentsNode {
302
-
303
- public CallerNode (RubyContext context , SourceSection sourceSection ) {
304
- super (context , sourceSection );
305
- }
306
-
307
- @ Specialization
308
- public Object caller (UndefinedPlaceholder omit ) {
309
- return caller (1 );
310
- }
311
-
312
- @ Specialization
313
- public Object caller (int omit ) {
314
- notDesignedForCompilation ();
315
-
316
- omit += 1 ; // Always ignore this node
317
-
318
- Backtrace backtrace = RubyCallStack .getBacktrace (this );
319
- List <Activation > activations = backtrace .getActivations ();
320
- int size = activations .size () - omit ;
321
-
322
- if (size < 0 ) {
323
- return nil ();
324
- }
325
-
326
- Object [] callers = new Object [size ];
327
- for (int n = 0 ; n < size ; n ++) {
328
- callers [n ] = getContext ().makeString (MRIBacktraceFormatter .formatCallerLine (activations , n + omit ));
329
- }
330
- return new RubyArray (getContext ().getCoreLibrary ().getArrayClass (), callers , callers .length );
331
- }
332
- }
333
-
334
300
@ CoreMethod (names = "caller_locations" , isModuleFunction = true , optional = 2 )
335
301
public abstract static class CallerLocationsNode extends CoreMethodArrayArgumentsNode {
336
302
Original file line number Diff line number Diff line change @@ -13,9 +13,19 @@ def printf(*args)
13
13
end
14
14
module_function :printf
15
15
16
-
17
16
alias_method :trust , :untaint
18
17
alias_method :untrust , :taint
19
18
alias_method :untrusted? , :tainted?
20
19
20
+ def caller ( start = 1 , limit = nil )
21
+ start += 1
22
+ if limit . nil?
23
+ args = [ start ]
24
+ else
25
+ args = [ start , limit ]
26
+ end
27
+ caller_locations ( *args ) . map ( &:inspect )
28
+ end
29
+ module_function :caller
30
+
21
31
end
You can’t perform that action at this time.
0 commit comments