зеркало из https://github.com/mozilla/gecko-dev.git
Bug 885219 - Assertion failure: !exprBody, at jsfun.cpp. r=till.
This commit is contained in:
Родитель
2d582f4b6e
Коммит
2618d89e0e
|
@ -0,0 +1,2 @@
|
|||
if (typeof disassemble === "function")
|
||||
disassemble("-r", Function("()=>e,d"));
|
|
@ -628,12 +628,19 @@ js::FunctionToString(JSContext *cx, HandleFunction fun, bool bodyOnly, bool lamb
|
|||
|
||||
StableCharPtr chars = src->chars();
|
||||
bool exprBody = fun->isExprClosure();
|
||||
// The source data for functions created by calling the Function
|
||||
// constructor is only the function's body.
|
||||
bool funCon = script->sourceStart == 0 && script->scriptSource()->argumentsNotIncluded();
|
||||
|
||||
// Functions created with the constructor should not be using the
|
||||
// expression body extension.
|
||||
// The source data for functions created by calling the Function
|
||||
// constructor is only the function's body. This depends on the fact,
|
||||
// asserted below, that in Function("function f() {}"), the inner
|
||||
// function's sourceStart points to the '(', not the 'f'.
|
||||
bool funCon = !fun->isArrow() &&
|
||||
script->sourceStart == 0 &&
|
||||
script->sourceEnd == script->scriptSource()->length() &&
|
||||
script->scriptSource()->argumentsNotIncluded();
|
||||
|
||||
// Functions created with the constructor can't be arrow functions or
|
||||
// expression closures.
|
||||
JS_ASSERT_IF(funCon, !fun->isArrow());
|
||||
JS_ASSERT_IF(funCon, !exprBody);
|
||||
JS_ASSERT_IF(!funCon && !fun->isArrow(), src->length() > 0 && chars[0] == '(');
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче