diff --git a/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java b/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java index db975549ed9a..25cb501ccf7e 100644 --- a/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java +++ b/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java @@ -16,6 +16,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.enso.interpreter.node.expression.builtin.debug.DebugBreakpointNode; import org.enso.interpreter.node.expression.builtin.text.util.ToJavaStringNode; import org.enso.interpreter.node.expression.debug.CaptureResultScopeNode; import org.enso.interpreter.node.expression.debug.EvalNode; @@ -38,8 +39,6 @@ /** The Instrument implementation for the interactive debugger REPL. */ @TruffleInstrument.Registration(id = DebugServerInfo.INSTRUMENT_NAME) public class ReplDebuggerInstrument extends TruffleInstrument { - private Env env; - /** * Called by Truffle when this instrument is installed. * @@ -49,7 +48,6 @@ public class ReplDebuggerInstrument extends TruffleInstrument { protected void onCreate(Env env) { SourceSectionFilter filter = SourceSectionFilter.newBuilder().tagIs(DebuggerTags.AlwaysHalt.class).build(); - this.env = env; DebuggerMessageHandler handler = new DebuggerMessageHandler(); try { @@ -60,8 +58,10 @@ protected void onCreate(Env env) { instrumenter.attachExecutionEventFactory( filter, ctx -> - new ReplExecutionEventNodeImpl( - ctx, handler, env.getLogger(ReplExecutionEventNodeImpl.class))); + ctx.getInstrumentedNode() instanceof DebugBreakpointNode + ? new ReplExecutionEventNodeImpl( + ctx, handler, env.getLogger(ReplExecutionEventNodeImpl.class)) + : null); } else { env.getLogger(ReplDebuggerInstrument.class) .warning("ReplDebuggerInstrument was initialized, " + "but no client connected"); diff --git a/test/Tests/src/Semantic/Js_Interop_Spec.enso b/test/Tests/src/Semantic/Js_Interop_Spec.enso index 1a200129519e..2d80904ca8ed 100644 --- a/test/Tests/src/Semantic/Js_Interop_Spec.enso +++ b/test/Tests/src/Semantic/Js_Interop_Spec.enso @@ -5,6 +5,9 @@ import Standard.Test foreign js my_method a b = """ return a + b; +foreign js debug = """ + debugger; + type My_Type type My_Type a b @@ -179,4 +182,7 @@ spec = Test.group "Polyglot JS" <| error = Error.throw 42 here.my_method error 0 . should_fail_with Integer + Test.specify "allow use of JavaScript debugger statement" <| + here.debug + main = Test.Suite.run_main here.spec