aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java b/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
index 173f2f7ec9..c76de98bc7 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
@@ -110,18 +110,24 @@ public class EvalExceptionWithStackTrace extends EvalException {
addStackFrame(funcallDescription, location, false);
}
- /**
- * Adds a line for the given frame.
- */
+ /** Adds a line for the given frame. */
private void addStackFrame(String label, Location location, boolean canPrint) {
- // We have to watch out for duplicate since ExpressionStatements add themselves twice:
- // Statement#exec() calls Expression#eval(), both of which call this method.
+ // TODO(bazel-team): This check was originally created to weed out duplicates in case the same
+ // node is added twice, but it's not clear if that is still a possibility. In any case, it would
+ // be better to eliminate the check and not create unwanted duplicates in the first place.
+ //
+ // The check is problematic because it suppresses tracebacks in the REPL, where line numbers
+ // can be reset within a single session.
if (mostRecentElement != null && isSameLocation(location, mostRecentElement.getLocation())) {
return;
}
mostRecentElement = new StackFrame(label, location, mostRecentElement, canPrint);
}
+ private void addStackFrame(String label, Location location) {
+ addStackFrame(label, location, true);
+ }
+
/**
* Checks two locations for equality in paths and start offsets.
*
@@ -136,10 +142,6 @@ public class EvalExceptionWithStackTrace extends EvalException {
}
}
- private void addStackFrame(String label, Location location) {
- addStackFrame(label, location, true);
- }
-
/**
* Returns the exception message without the stack trace.
*/