From 8a4e9b2d4637da1312ca5dbf6068de3f4e0d01e1 Mon Sep 17 00:00:00 2001 From: "nboyd%atg.com" Date: Wed, 18 Apr 2007 17:08:42 +0000 Subject: [PATCH] Add -debug flag to shell. Will cause it to generate debug for compiled class files. git-svn-id: svn://10.0.0.236/trunk@224694 18797224-902f-48f8-a5cc-f745e15eee43 --- .../mozilla/javascript/tools/resources/Messages.properties | 3 ++- .../toolsrc/org/mozilla/javascript/tools/shell/Main.java | 4 ++++ .../mozilla/javascript/tools/shell/ShellContextFactory.java | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/resources/Messages.properties b/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/resources/Messages.properties index bf6ee90644d..6e605e7273a 100644 --- a/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/resources/Messages.properties +++ b/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/resources/Messages.properties @@ -59,7 +59,8 @@ msg.shell.usage =\ \ -version 100|110|120|130|140|150|160\n\ \ -opt [-1|0-9]\n\ \ -f script-filename\n\ - \ -e script-source + \ -e script-source\n\ + \ -debug msg.help =\ diff --git a/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Main.java b/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Main.java index 44e615bb246..ba821e14419 100644 --- a/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Main.java +++ b/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Main.java @@ -280,6 +280,10 @@ public class Main global.setSealedStdLib(true); continue; } + if (arg.equals("-debug")) { + shellContextFactory.setGeneratingDebug(true); + continue; + } usageError = arg; break goodUsage; } diff --git a/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/ShellContextFactory.java b/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/ShellContextFactory.java index 569f4bf1165..ed8cfa43029 100644 --- a/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/ShellContextFactory.java +++ b/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/ShellContextFactory.java @@ -45,6 +45,7 @@ public class ShellContextFactory extends ContextFactory private boolean strictMode; private int languageVersion; private int optimizationLevel; + private boolean generatingDebug; private ErrorReporter errorReporter; protected boolean hasFeature(Context cx, int featureIndex) @@ -64,6 +65,7 @@ public class ShellContextFactory extends ContextFactory if (errorReporter != null) { cx.setErrorReporter(errorReporter); } + cx.setGeneratingDebug(generatingDebug); super.onContextCreated(cx); } @@ -93,4 +95,8 @@ public class ShellContextFactory extends ContextFactory this.errorReporter = errorReporter; } + public void setGeneratingDebug(boolean generatingDebug) + { + this.generatingDebug = generatingDebug; + } }