зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1055472 - Part 8 prelim: Rename InitializeRegExp to RegExpObject::initFromAtom for readability. (r=Waldo)
This commit is contained in:
Родитель
1bb9132df9
Коммит
99dabe46d9
|
@ -185,7 +185,7 @@ RegExpInitialize(JSContext* cx, Handle<RegExpObject*> obj, HandleValue patternVa
|
|||
}
|
||||
|
||||
/* Steps 11-15. */
|
||||
if (!InitializeRegExp(cx, obj, pattern, flags))
|
||||
if (!RegExpObject::initFromAtom(cx, obj, pattern, flags))
|
||||
return false;
|
||||
|
||||
/* Step 16. */
|
||||
|
@ -268,7 +268,7 @@ regexp_compile_impl(JSContext* cx, const CallArgs& args)
|
|||
}
|
||||
|
||||
// Step 5.
|
||||
if (!InitializeRegExp(cx, regexp, sourceAtom, flags))
|
||||
if (!RegExpObject::initFromAtom(cx, regexp, sourceAtom, flags))
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*regexp);
|
||||
|
@ -373,7 +373,7 @@ js::regexp_construct(JSContext* cx, unsigned argc, Value* vp)
|
|||
return false;
|
||||
|
||||
// Step 10.
|
||||
if (!InitializeRegExp(cx, regexp, sourceAtom, flags))
|
||||
if (!RegExpObject::initFromAtom(cx, regexp, sourceAtom, flags))
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*regexp);
|
||||
|
@ -701,7 +701,9 @@ js::CreateRegExpPrototype(JSContext* cx, JSProtoKey key)
|
|||
proto->NativeObject::setPrivate(nullptr);
|
||||
|
||||
RootedAtom source(cx, cx->names().empty);
|
||||
return InitializeRegExp(cx, proto, source, RegExpFlag(0));
|
||||
if (!RegExpObject::initFromAtom(cx, proto, source, RegExpFlag(0)))
|
||||
return nullptr;
|
||||
return proto;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -53,13 +53,6 @@ js::RegExpAlloc(ExclusiveContext* cx)
|
|||
return regexp;
|
||||
}
|
||||
|
||||
RegExpObject*
|
||||
js::InitializeRegExp(ExclusiveContext* cx, Handle<RegExpObject*> regexp, HandleAtom source,
|
||||
RegExpFlag flags)
|
||||
{
|
||||
return regexp->init(cx, source, flags) ? regexp : nullptr;
|
||||
}
|
||||
|
||||
/* MatchPairs */
|
||||
|
||||
bool
|
||||
|
@ -155,6 +148,13 @@ RegExpObject::trace(JSTracer* trc, JSObject* obj)
|
|||
}
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
RegExpObject::initFromAtom(ExclusiveContext* cx, Handle<RegExpObject*> regexp, HandleAtom source,
|
||||
RegExpFlag flags)
|
||||
{
|
||||
return regexp->init(cx, source, flags);
|
||||
}
|
||||
|
||||
const Class RegExpObject::class_ = {
|
||||
js_RegExp_str,
|
||||
JSCLASS_HAS_PRIVATE |
|
||||
|
@ -224,7 +224,10 @@ RegExpObject::createNoStatics(ExclusiveContext* cx, HandleAtom source, RegExpFla
|
|||
if (!regexp)
|
||||
return nullptr;
|
||||
|
||||
return InitializeRegExp(cx, regexp, source, flags);
|
||||
if (!RegExpObject::initFromAtom(cx, regexp, source, flags))
|
||||
return nullptr;
|
||||
|
||||
return regexp;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -894,7 +897,10 @@ js::CloneRegExpObject(JSContext* cx, JSObject* obj_)
|
|||
if (!clone)
|
||||
return nullptr;
|
||||
|
||||
return InitializeRegExp(cx, clone, source, RegExpFlag(origFlags | staticsFlags));
|
||||
if (!RegExpObject::initFromAtom(cx, clone, source, RegExpFlag(origFlags | staticsFlags)))
|
||||
return nullptr;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
// Otherwise, the clone can use |regexp|'s RegExpShared.
|
||||
|
@ -911,7 +917,7 @@ js::CloneRegExpObject(JSContext* cx, JSObject* obj_)
|
|||
if (!regex->getShared(cx, &g))
|
||||
return nullptr;
|
||||
|
||||
if (!InitializeRegExp(cx, clone, source, g->getFlags()))
|
||||
if (!RegExpObject::initFromAtom(cx, clone, source, g->getFlags()))
|
||||
return nullptr;
|
||||
|
||||
clone->setShared(*g.re());
|
||||
|
|
|
@ -66,10 +66,6 @@ enum RegExpRunStatus
|
|||
extern RegExpObject*
|
||||
RegExpAlloc(ExclusiveContext* cx);
|
||||
|
||||
extern RegExpObject*
|
||||
InitializeRegExp(ExclusiveContext* cx, Handle<RegExpObject*> regexp, HandleAtom source,
|
||||
RegExpFlag flags);
|
||||
|
||||
// |regexp| is under-typed because this function's used in the JIT.
|
||||
extern JSObject*
|
||||
CloneRegExpObject(JSContext* cx, JSObject* regexp);
|
||||
|
@ -447,11 +443,10 @@ class RegExpObject : public NativeObject
|
|||
|
||||
static void trace(JSTracer* trc, JSObject* obj);
|
||||
|
||||
private:
|
||||
friend RegExpObject*
|
||||
InitializeRegExp(ExclusiveContext* cx, Handle<RegExpObject*> regexp, HandleAtom source,
|
||||
RegExpFlag flags);
|
||||
static bool initFromAtom(ExclusiveContext* cx, Handle<RegExpObject*> regexp, HandleAtom source,
|
||||
RegExpFlag flags);
|
||||
|
||||
private:
|
||||
bool init(ExclusiveContext* cx, HandleAtom source, RegExpFlag flags);
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче