Confirmed users
497
edits
(Add Debugger.Object.prototype.makeDebuggeeValue.) |
(Document Debugger.Script.prototype.staticLevel accessor. https://github.com/jimblandy/DebuggerDocs/commit/67f5de5f3d9948e8e354ccfd6211c8b98a055b58) |
||
| Line 511: | Line 511: | ||
<dt>lineCount | <dt>lineCount | ||
<dd>The number of lines this script's code occupies, within the file or document named by <code>url</code>. | <dd>The number of lines this script's code occupies, within the file or document named by <code>url</code>. | ||
<dt>staticLevel | |||
<dd>The number of function bodies enclosing this script's code. | |||
Global code is at level zero; bodies of functions defined at the top level in global code are at level one; bodies of functions nested within those are at level two; and so on. | |||
A script for code passed to direct <code>eval</code> is at a static level one greater than that of the script containing the call to <code>eval</code>, because direct eval code runs within the caller's scope. However, a script for code passed to an indirect <code>eval</code> call is at static level zero, since it is evaluated in the global scope. | |||
Note that a generator's expressions are considered to be part of the body of a synthetic function, produced by the compiler. | |||
Scripts' static level be useful in deciding where to set breakpoints. For example, a breakpoint set on line 3 in this code: | |||
function f() { | |||
x = function g() { // line 2 | |||
// line 3; no code here | |||
...; | |||
} | |||
} | |||
should be set in <code>g</code>'s script, not in <code>f</code>'s, even though neither script contains code at that line. In such a case, the most deeply nested script—the one with the highest static level—should receive the breakpoint. | |||
<dt>strictMode | <dt>strictMode | ||