Reformatting.

This commit is contained in:
hns 2004-01-14 16:34:03 +00:00
parent 68891eeb95
commit a70cf2feaf

View file

@ -16,10 +16,9 @@
package helma.scripting.rhino.debug; package helma.scripting.rhino.debug;
import helma.framework.ResponseTrans;
import org.mozilla.javascript.*; import org.mozilla.javascript.*;
import org.mozilla.javascript.debug.*; import org.mozilla.javascript.debug.*;
import helma.framework.ResponseTrans;
public class Tracer implements Debugger { public class Tracer implements Debugger {
@ -32,11 +31,12 @@ public class Tracer implements Debugger {
this.res = res; this.res = res;
} }
/** /**
* Implementws handleCompilationDone in interface org.mozilla.javascript.debug.Debugger * Implementws handleCompilationDone in interface org.mozilla.javascript.debug.Debugger
*/ */
public void handleCompilationDone(Context cx, DebuggableScript script, String source) { public void handleCompilationDone(Context cx, DebuggableScript script,
String source) {
// res.debug("CompilationDone: "+toString(script)); // res.debug("CompilationDone: "+toString(script));
} }
@ -44,22 +44,29 @@ public class Tracer implements Debugger {
* Implementws getFrame in interface org.mozilla.javascript.debug.Debugger * Implementws getFrame in interface org.mozilla.javascript.debug.Debugger
*/ */
public DebugFrame getFrame(Context cx, DebuggableScript script) { public DebugFrame getFrame(Context cx, DebuggableScript script) {
// res.debug("getFrame: "+toString(script)); // res.debug("getFrame: "+toString(script));
if (script.isFunction()) { if (script.isFunction()) {
return new TracerFrame(script); return new TracerFrame(script);
} }
return null; return null;
} }
static String toString(DebuggableScript script) { static String toString(DebuggableScript script) {
if (script.isFunction()) { if (script.isFunction()) {
return script.getSourceName() + ": " + script.getFunctionName(); return script.getSourceName() + ": " + script.getFunctionName();
} else { } else {
return script.getSourceName(); return script.getSourceName();
} }
} }
class TracerFrame implements DebugFrame { class TracerFrame
implements DebugFrame {
DebuggableScript script; DebuggableScript script;
@ -73,15 +80,19 @@ class TracerFrame implements DebugFrame {
*/ */
public void onEnter(Context cx, Scriptable activation, public void onEnter(Context cx, Scriptable activation,
Scriptable thisObj, Object[] args) { Scriptable thisObj, Object[] args) {
StringBuffer b = new StringBuffer("Trace: "); StringBuffer b = new StringBuffer("Trace: ");
b.append(Tracer.toString(script)); b.append(Tracer.toString(script));
b.append("("); b.append("(");
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
b.append(args[i]); b.append(args[i]);
if (i < args.length - 1) { if (i < args.length - 1) {
b.append(", "); b.append(", ");
} }
} }
b.append(")"); b.append(")");
res.debug(b.toString()); res.debug(b.toString());
} }
@ -96,7 +107,9 @@ class TracerFrame implements DebugFrame {
/** /**
* Called when the function or script for this frame is about to return. * Called when the function or script for this frame is about to return.
*/ */
public void onExit(Context cx, boolean byThrow, Object resultOrException) { public void onExit(Context cx, boolean byThrow,
Object resultOrException) {
// res.debug("Exit: "+Tracer.toString(script)); // res.debug("Exit: "+Tracer.toString(script));
} }
@ -104,6 +117,7 @@ class TracerFrame implements DebugFrame {
* Called when executed code reaches new line in the source. * Called when executed code reaches new line in the source.
*/ */
public void onLineChange(Context cx, int lineNumber) { public void onLineChange(Context cx, int lineNumber) {
// res.debug("LineChange: "+Tracer.toString(script)); // res.debug("LineChange: "+Tracer.toString(script));
} }