зеркало из https://github.com/mozilla/pjs.git
Add JSRESOLVE_DETECTING (246964, r=shaver).
This commit is contained in:
Родитель
7009ec7807
Коммит
9abe53acce
15
js/src/js.c
15
js/src/js.c
|
@ -1775,11 +1775,15 @@ its_enumerate(JSContext *cx, JSObject *obj)
|
|||
}
|
||||
|
||||
static JSBool
|
||||
its_resolve(JSContext *cx, JSObject *obj, jsval id)
|
||||
its_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
|
||||
JSObject **objp)
|
||||
{
|
||||
if (its_noisy) {
|
||||
fprintf(gOutFile, "resolving its property %s\n",
|
||||
JS_GetStringBytes(JS_ValueToString(cx, id)));
|
||||
fprintf(gOutFile, "resolving its property %s, flags {%s,%s,%s}\n",
|
||||
JS_GetStringBytes(JS_ValueToString(cx, id)),
|
||||
(flags & JSRESOLVE_QUALIFIED) ? "qualified" : "",
|
||||
(flags & JSRESOLVE_ASSIGNING) ? "assigning" : "",
|
||||
(flags & JSRESOLVE_DETECTING) ? "detecting" : "");
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -1800,9 +1804,10 @@ its_finalize(JSContext *cx, JSObject *obj)
|
|||
}
|
||||
|
||||
static JSClass its_class = {
|
||||
"It", 0,
|
||||
"It", JSCLASS_NEW_RESOLVE,
|
||||
its_addProperty, its_delProperty, its_getProperty, its_setProperty,
|
||||
its_enumerate, its_resolve, its_convert, its_finalize
|
||||
its_enumerate, (JSResolveOp)its_resolve,
|
||||
its_convert, its_finalize
|
||||
};
|
||||
|
||||
JSErrorFormatString jsShell_ErrorFormatString[JSErr_Limit] = {
|
||||
|
|
|
@ -826,6 +826,7 @@ JS_IdToValue(JSContext *cx, jsid id, jsval *vp);
|
|||
|
||||
#define JSRESOLVE_QUALIFIED 0x01 /* resolve a qualified property id */
|
||||
#define JSRESOLVE_ASSIGNING 0x02 /* resolve on the left of assignment */
|
||||
#define JSRESOLVE_DETECTING 0x04 /* 'if (o.p)...' or '(o.p) ?...:...' */
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_PropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
|
||||
|
|
|
@ -2400,6 +2400,8 @@ js_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
|
|||
uint32 generation;
|
||||
JSNewResolveOp newresolve;
|
||||
uintN flags;
|
||||
jsbytecode *pc;
|
||||
const JSCodeSpec *cs;
|
||||
uint32 format;
|
||||
JSBool ok;
|
||||
|
||||
|
@ -2454,13 +2456,20 @@ js_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
|
|||
if (clasp->flags & JSCLASS_NEW_RESOLVE) {
|
||||
newresolve = (JSNewResolveOp)resolve;
|
||||
flags = 0;
|
||||
if (cx->fp && cx->fp->pc) {
|
||||
format = js_CodeSpec[*cx->fp->pc].format;
|
||||
if (cx->fp && (pc = cx->fp->pc)) {
|
||||
cs = &js_CodeSpec[*pc];
|
||||
format = cs->format;
|
||||
if ((format & JOF_MODEMASK) != JOF_NAME)
|
||||
flags |= JSRESOLVE_QUALIFIED;
|
||||
if ((format & JOF_ASSIGNING) ||
|
||||
(cx->fp->flags & JSFRAME_ASSIGNING)) {
|
||||
flags |= JSRESOLVE_ASSIGNING;
|
||||
} else {
|
||||
pc += cs->length;
|
||||
while (*pc == JSOP_GROUP)
|
||||
pc++;
|
||||
if (*pc == JSOP_IFEQ)
|
||||
flags |= JSRESOLVE_DETECTING;
|
||||
}
|
||||
}
|
||||
obj2 = (clasp->flags & JSCLASS_NEW_RESOLVE_GETS_START)
|
||||
|
|
Загрузка…
Ссылка в новой задаче