Bug 1354529: Don't set constructor-flag for generator functions created through GeneratorFunction intrinsic. r=arai

This commit is contained in:
André Bargull 2017-04-07 15:21:45 +02:00
parent b719cb0993
commit f97c82453a

View File

@ -1762,9 +1762,12 @@ FunctionConstructor(JSContext* cx, const CallArgs& args, GeneratorKind generator
// Step 25-32 (reordered).
RootedObject globalLexical(cx, &global->lexicalEnvironment());
JSFunction::Flags flags = (isStarGenerator || isAsync)
? JSFunction::INTERPRETED_LAMBDA_GENERATOR_OR_ASYNC
: JSFunction::INTERPRETED_LAMBDA;
AllocKind allocKind = isAsync ? AllocKind::FUNCTION_EXTENDED : AllocKind::FUNCTION;
RootedFunction fun(cx, NewFunctionWithProto(cx, nullptr, 0,
JSFunction::INTERPRETED_LAMBDA, globalLexical,
flags, globalLexical,
anonymousAtom, proto,
allocKind, TenuredObject));
if (!fun)