12
12
import java .util .ArrayList ;
13
13
import java .util .List ;
14
14
15
- import com .oracle .truffle .api .CompilerDirectives ;
16
15
import com .oracle .truffle .api .exception .AbstractTruffleException ;
17
- import com .oracle .truffle .api .interop .InteropLibrary ;
18
- import com .oracle .truffle .api .interop .UnsupportedMessageException ;
19
16
import org .truffleruby .RubyContext ;
20
17
import org .truffleruby .RubyLanguage ;
21
18
import org .truffleruby .core .array .ArrayHelpers ;
32
29
import com .oracle .truffle .api .TruffleStackTraceElement ;
33
30
import com .oracle .truffle .api .nodes .Node ;
34
31
import com .oracle .truffle .api .nodes .RootNode ;
35
- import com .oracle .truffle .api .source .SourceSection ;
36
32
import org .truffleruby .language .objects .AllocationTracing ;
37
33
38
34
/** Represents a backtrace: a list of activations (~ call sites).
@@ -75,7 +71,6 @@ public class Backtrace {
75
71
// See accessors for info on most undocumented fields.
76
72
77
73
private final Node location ;
78
- private final SourceSection sourceLocation ;
79
74
private final int omitted ;
80
75
private RaiseException raiseException ;
81
76
private final Throwable javaThrowable ;
@@ -86,25 +81,17 @@ public class Backtrace {
86
81
// region Constructors
87
82
88
83
/** Fully explicit constructor. */
89
- public Backtrace (Node location , SourceSection sourceLocation , int omitted , Throwable javaThrowable ) {
84
+ public Backtrace (Node location , int omitted , Throwable javaThrowable ) {
90
85
this .location = location ;
91
- this .sourceLocation = sourceLocation ;
92
86
this .omitted = omitted ;
93
87
this .javaThrowable = javaThrowable ;
94
88
}
95
89
96
- /** Creates a backtrace for the given foreign exception, setting the {@link #getLocation() location} and
97
- * {@link #getSourceLocation() source location} accordingly, and computing the activations eagerly (since the
98
- * exception itself is not retained). */
90
+ /** Creates a backtrace for the given foreign exception, setting the {@link #getLocation() location} accordingly,
91
+ * and computing the activations eagerly (since the exception itself is not retained). */
99
92
public Backtrace (AbstractTruffleException exception ) {
100
93
assert !(exception instanceof RaiseException );
101
94
this .location = exception .getLocation ();
102
- try {
103
- final InteropLibrary interop = InteropLibrary .getUncached ();
104
- this .sourceLocation = interop .hasSourceLocation (exception ) ? interop .getSourceLocation (exception ) : null ;
105
- } catch (UnsupportedMessageException e ) {
106
- throw CompilerDirectives .shouldNotReachHere (e );
107
- }
108
95
this .omitted = 0 ;
109
96
this .javaThrowable = null ;
110
97
this .stackTrace = getStackTrace (exception );
@@ -114,7 +101,6 @@ public Backtrace(AbstractTruffleException exception) {
114
101
* retrieved. The activations are computed eagerly, since the exception itself is not retained. */
115
102
public Backtrace (Throwable exception ) {
116
103
this .location = null ;
117
- this .sourceLocation = null ;
118
104
this .omitted = 0 ;
119
105
this .javaThrowable = null ;
120
106
this .stackTrace = getStackTrace (exception );
@@ -128,12 +114,6 @@ public Node getLocation() {
128
114
return location ;
129
115
}
130
116
131
- /** Only set for {@code SyntaxError}, where it represents where the error occurred (while {@link #getLocation()}
132
- * does not). */
133
- public SourceSection getSourceLocation () {
134
- return sourceLocation ;
135
- }
136
-
137
117
/** Returns the wrapper for the Ruby exception associated with this backtrace, if any, and null otherwise. */
138
118
public RaiseException getRaiseException () {
139
119
return raiseException ;
@@ -192,7 +172,7 @@ private static String getRootName(RootNode root) {
192
172
/** Used to copy the backtrace when copying {@code exception}. */
193
173
@ TruffleBoundary
194
174
public Backtrace copy (RubyContext context , RubyException exception ) {
195
- Backtrace copy = new Backtrace (location , sourceLocation , omitted , javaThrowable );
175
+ Backtrace copy = new Backtrace (location , omitted , javaThrowable );
196
176
// A Backtrace is 1-1-1 with a RaiseException and a Ruby exception.
197
177
// Copy the RaiseException
198
178
RaiseException newRaiseException = new RaiseException (this .raiseException , exception );
0 commit comments