mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 676936 - Rewrite InitGeneratorClass to be much clearer and simpler. r=luke
This commit is contained in:
parent
2639d4438d
commit
9e604da3b5
@ -1433,8 +1433,15 @@ static bool
|
||||
InitGeneratorClass(JSContext *cx, GlobalObject *global)
|
||||
{
|
||||
#if JS_HAS_GENERATORS
|
||||
return js_InitClass(cx, global, NULL, &js_GeneratorClass, NULL, 0,
|
||||
NULL, generator_methods, NULL, NULL);
|
||||
JSObject *proto = global->createBlankPrototype(cx, &js_GeneratorClass);
|
||||
if (!proto)
|
||||
return false;
|
||||
|
||||
if (!DefinePropertiesAndBrand(cx, proto, NULL, generator_methods))
|
||||
return false;
|
||||
|
||||
/* This should use a non-JSProtoKey'd slot, but this is easier for now. */
|
||||
return DefineConstructorAndPrototype(cx, global, JSProto_Generator, proto, proto);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
|
@ -1373,7 +1373,7 @@ CopyInitializerObject(JSContext *cx, JSObject *baseobj)
|
||||
|
||||
inline bool
|
||||
DefineConstructorAndPrototype(JSContext *cx, GlobalObject *global,
|
||||
JSProtoKey key, JSFunction *ctor, JSObject *proto)
|
||||
JSProtoKey key, JSObject *ctor, JSObject *proto)
|
||||
{
|
||||
JS_ASSERT(!global->nativeEmpty()); /* reserved slots already allocated */
|
||||
JS_ASSERT(ctor);
|
||||
|
Loading…
Reference in New Issue
Block a user