mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 03:35:33 +00:00
Bug 1570881 - Update remaining BytecodeEmitter constructor to use FunctionBox line/column r=jimb
Differential Revision: https://phabricator.services.mozilla.com/D43390 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
06f159199b
commit
882574ba29
@ -333,6 +333,8 @@ JS::Result<FunctionNode*> BinASTParserPerTokenizer<Tok>::makeEmptyFunctionNode(
|
||||
|
||||
BINJS_TRY_DECL(result, handler_.newFunction(syntaxKind, pos));
|
||||
|
||||
funbox->setStart(start, 0, pos.begin);
|
||||
funbox->setEnd(pos.end);
|
||||
handler_.setFunctionBox(result, funbox);
|
||||
|
||||
return result;
|
||||
|
@ -5754,12 +5754,9 @@ MOZ_NEVER_INLINE bool BytecodeEmitter::emitFunction(
|
||||
fieldInitializers = setupFieldInitializers(classContentsIfConstructor);
|
||||
}
|
||||
|
||||
uint32_t innerScriptLine, innerScriptColumn;
|
||||
parser->errorReporter().lineAndColumnAt(
|
||||
funNode->pn_pos.begin, &innerScriptLine, &innerScriptColumn);
|
||||
BytecodeEmitter bce2(this, parser, funbox, innerScript,
|
||||
/* lazyScript = */ nullptr, innerScriptLine,
|
||||
innerScriptColumn, nestedMode, fieldInitializers);
|
||||
/* lazyScript = */ nullptr, funbox->startLine,
|
||||
funbox->startColumn, nestedMode, fieldInitializers);
|
||||
if (!bce2.init(funNode->pn_pos)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -272,7 +272,6 @@ def main(argv):
|
||||
# Prevent code coverage test that expects coverage
|
||||
# to be off when it starts.
|
||||
options.exclude += [os.path.join('debug', 'Script-getOffsetsCoverage-02.js')]
|
||||
options.exclude += [os.path.join('debug', 'Script-startColumn.js')]
|
||||
|
||||
# These tests expect functions to be parsed lazily, but lazy parsing
|
||||
# is disabled on coverage build.
|
||||
|
@ -2,20 +2,19 @@
|
||||
|
||||
const g = newGlobal({newCompartment: true, useWindowProxy: true});
|
||||
const dbg = Debugger(g);
|
||||
const obj = dbg.addDebuggee(g);
|
||||
const gw = dbg.addDebuggee(g);
|
||||
|
||||
function test(f, expected) {
|
||||
const object = obj.makeDebuggeeValue(f);
|
||||
assertEq(object.callable, true);
|
||||
console.log("object name: " + object.displayName);
|
||||
assertEq(object.script.startColumn, expected);
|
||||
const fw = gw.makeDebuggeeValue(f);
|
||||
assertEq(fw.callable, true);
|
||||
assertEq(fw.script.startColumn, expected);
|
||||
}
|
||||
|
||||
g.eval(`
|
||||
function f1() { }
|
||||
`);
|
||||
|
||||
test(g.f1, 11);
|
||||
|
||||
g.eval(`
|
||||
var f2 = function({ a, b, c }, d, e, ...more) { };
|
||||
`);
|
||||
@ -25,6 +24,7 @@ g.eval(`
|
||||
var f3 = function *() { };
|
||||
`);
|
||||
test(g.f3, 19);
|
||||
|
||||
g.eval(`
|
||||
var f4 = async function
|
||||
() { };
|
||||
@ -50,6 +50,16 @@ var myInstance = new MyClass();
|
||||
test(g.myInstance.method, 10);
|
||||
test(g.myInstance.constructor, 14);
|
||||
|
||||
const gEager = newGlobal({newCompartment: true, useWindowProxy: true, disableLazyParsing: true});
|
||||
const eagerDbg = Debugger(gEager);
|
||||
const gEagerWrapped = eagerDbg.addDebuggee(gEager);
|
||||
gEager.eval(`
|
||||
function f7() { }
|
||||
`);
|
||||
const f7w = gEagerWrapped.makeDebuggeeValue(gEager.f7);
|
||||
assertEq(f7w.callable, true);
|
||||
assertEq(f7w.script.startColumn, 11);
|
||||
|
||||
g.eval(`
|
||||
function f8() {
|
||||
return function f8Inner() { }
|
||||
@ -68,7 +78,7 @@ let column;
|
||||
dbg.onDebuggerStatement = function (frame) {
|
||||
column = frame.script.startColumn;
|
||||
hit += 1;
|
||||
}
|
||||
};
|
||||
|
||||
g.eval(` debugger;`);
|
||||
assertEq(column, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user