зеркало из https://github.com/mozilla/gecko-dev.git
Bug 908472 - make JSFunction::generatorKind() treat lazy self-hosted functions as non-generators. r=jwalden
--HG-- extra : rebase_source : bc946eb476b6ba6dc98ea01b76c8aefc8827ddc5
This commit is contained in:
Родитель
93f594fc7a
Коммит
589fb2423f
|
@ -281,7 +281,12 @@ class JSFunction : public JSObject
|
|||
js::GeneratorKind generatorKind() const {
|
||||
if (!isInterpreted())
|
||||
return js::NotGenerator;
|
||||
return hasScript() ? nonLazyScript()->generatorKind() : lazyScript()->generatorKind();
|
||||
if (hasScript())
|
||||
return nonLazyScript()->generatorKind();
|
||||
if (js::LazyScript *lazy = lazyScriptOrNull())
|
||||
return lazy->generatorKind();
|
||||
JS_ASSERT(isSelfHostedBuiltin());
|
||||
return js::NotGenerator;
|
||||
}
|
||||
|
||||
bool isGenerator() const { return generatorKind() != js::NotGenerator; }
|
||||
|
|
|
@ -936,6 +936,9 @@ JSRuntime::cloneSelfHostedFunctionScript(JSContext *cx, Handle<PropertyName*> na
|
|||
return false;
|
||||
|
||||
RootedFunction sourceFun(cx, &funVal.toObject().as<JSFunction>());
|
||||
// JSFunction::generatorKind can't handle lazy self-hosted functions, so we make sure there
|
||||
// aren't any.
|
||||
JS_ASSERT(!sourceFun->isGenerator());
|
||||
RootedScript sourceScript(cx, sourceFun->nonLazyScript());
|
||||
JS_ASSERT(!sourceScript->enclosingStaticScope());
|
||||
JSScript *cscript = CloneScript(cx, NullPtr(), targetFun, sourceScript);
|
||||
|
|
Загрузка…
Ссылка в новой задаче