New public API Context.getDebuggableView to extract DebuggableScript implementation.

This commit is contained in:
igor%mir2.org 2004-10-15 18:27:38 +00:00
Родитель 09e98b2a17
Коммит c12fda22c3
3 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -2123,6 +2123,19 @@ public class Context
debuggerData = contextData;
}
/**
* Return DebuggableScript instance if any associated with the script.
* If callable supports DebuggableScript implementation, the method
* returns it. Otherwise null is returned.
*/
public static DebuggableScript getDebuggableView(Script script)
{
if (script instanceof NativeFunction) {
return ((NativeFunction)script).getDebuggableView();
}
return null;
}
/**
* Controls certain aspects of script semantics.
* Should be overwritten to alter default behavior.

Просмотреть файл

@ -36,6 +36,8 @@
package org.mozilla.javascript;
import org.mozilla.javascript.debug.DebuggableScript;
final class InterpretedFunction extends NativeFunction implements Script
{
InterpreterData idata;
@ -153,5 +155,10 @@ final class InterpretedFunction extends NativeFunction implements Script
{
return Interpreter.getEncodedSource(idata);
}
public DebuggableScript getDebuggableView()
{
return idata;
}
}

Просмотреть файл

@ -38,6 +38,8 @@
package org.mozilla.javascript;
import org.mozilla.javascript.debug.DebuggableScript;
/**
* This class implements the Function native object.
* See ECMA 15.3.
@ -137,6 +139,11 @@ public class NativeFunction extends BaseFunction
return null;
}
public DebuggableScript getDebuggableView()
{
return null;
}
/**
* The "argsNames" array has the following information:
* argNames[0] through argNames[argCount - 1]: the names of the parameters