mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 776314 - Stub out genexp toSource. r=luke
This commit is contained in:
parent
da8f1d7883
commit
b4f0c450b3
7
js/src/jit-test/tests/basic/function-tosource-genexpr.js
Normal file
7
js/src/jit-test/tests/basic/function-tosource-genexpr.js
Normal file
@ -0,0 +1,7 @@
|
||||
function getgen() {
|
||||
gen = getgen.caller;
|
||||
}
|
||||
var gen;
|
||||
(getgen() for (x of [1])).next();
|
||||
assertEq(gen.toSource(), "function genexp() {\n [generator expression]\n}");
|
||||
assertEq(decompileBody(gen), "\n [generator expression]\n");
|
@ -577,6 +577,14 @@ JSFunction::toString(JSContext *cx, bool bodyOnly, bool lambdaParen)
|
||||
{
|
||||
StringBuffer out(cx);
|
||||
|
||||
if (isInterpreted() && script()->isGeneratorExp) {
|
||||
if ((!bodyOnly && !out.append("function genexp() {")) ||
|
||||
!out.append("\n [generator expression]\n") ||
|
||||
(!bodyOnly && !out.append("}"))) {
|
||||
return NULL;
|
||||
}
|
||||
return out.finishString();
|
||||
}
|
||||
if (!bodyOnly) {
|
||||
// If we're not in pretty mode, put parentheses around lambda functions.
|
||||
if (isInterpreted() && !lambdaParen && (flags & JSFUN_LAMBDA)) {
|
||||
|
Loading…
Reference in New Issue
Block a user