js: support writing debugger statement in JSBody

Fix #974
This commit is contained in:
Alexey Andreev 2024-11-30 19:26:11 +01:00
parent 4e3cb5628f
commit bf15f0e299
2 changed files with 8 additions and 0 deletions

View File

@ -291,6 +291,9 @@ public class AstWriter {
case Token.WHILE:
print((WhileLoop) node);
break;
case Token.DEBUGGER:
writer.append("debugger;");
break;
default:
if (node instanceof InfixExpression) {
printInfix((InfixExpression) node, precedence);

View File

@ -255,6 +255,11 @@ public class AstWriterTest {
assertEquals("delete a.b;", transform("delete a.b;"));
}
@Test
public void writesDebugger() throws IOException {
assertEquals("debugger;debugger;", transform("debugger; debugger;"));
}
@Test
public void writesGlobalRef() throws IOException {
assertEquals(