зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1383174 - Make GetNonSyntacticGlobalThis return void. r=jandem
This method always returns true. Also, get rid of the unused return statement at the end of the method. The loop is a while(true) and it has no break statements. MozReview-Commit-ID: 5hxfSkq6ZUD --HG-- extra : rebase_source : 9caa8e84d487a44aa10dd73a9266845bd5cda98f
This commit is contained in:
Родитель
0322c56145
Коммит
88d9fadf79
|
@ -1545,7 +1545,7 @@ BaselineCompiler::emit_JSOP_FUNCTIONTHIS()
|
|||
return true;
|
||||
}
|
||||
|
||||
typedef bool (*GetNonSyntacticGlobalThisFn)(JSContext*, HandleObject, MutableHandleValue);
|
||||
typedef void (*GetNonSyntacticGlobalThisFn)(JSContext*, HandleObject, MutableHandleValue);
|
||||
static const VMFunction GetNonSyntacticGlobalThisInfo =
|
||||
FunctionInfo<GetNonSyntacticGlobalThisFn>(js::GetNonSyntacticGlobalThis,
|
||||
"GetNonSyntacticGlobalThis");
|
||||
|
|
|
@ -3247,7 +3247,8 @@ js::GetThisValueForDebuggerMaybeOptimizedOut(JSContext* cx, AbstractFramePtr fra
|
|||
MOZ_CRASH("'this' binding must be found");
|
||||
}
|
||||
|
||||
return GetNonSyntacticGlobalThis(cx, scopeChain, res);
|
||||
GetNonSyntacticGlobalThis(cx, scopeChain, res);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -129,26 +129,24 @@ js::GetFunctionThis(JSContext* cx, AbstractFramePtr frame, MutableHandleValue re
|
|||
return BoxNonStrictThis(cx, thisv, res);
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
js::GetNonSyntacticGlobalThis(JSContext* cx, HandleObject envChain, MutableHandleValue res)
|
||||
{
|
||||
RootedObject env(cx, envChain);
|
||||
while (true) {
|
||||
if (IsExtensibleLexicalEnvironment(env)) {
|
||||
res.set(env->as<LexicalEnvironmentObject>().thisValue());
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (!env->enclosingEnvironment()) {
|
||||
// This can only happen in Debugger eval frames: in that case we
|
||||
// don't always have a global lexical env, see EvaluateInEnv.
|
||||
MOZ_ASSERT(env->is<GlobalObject>());
|
||||
res.set(GetThisValue(env));
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
env = env->enclosingEnvironment();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -2725,8 +2723,7 @@ CASE(JSOP_GLOBALTHIS)
|
|||
{
|
||||
if (script->hasNonSyntacticScope()) {
|
||||
PUSH_NULL();
|
||||
if (!GetNonSyntacticGlobalThis(cx, REGS.fp()->environmentChain(), REGS.stackHandleAt(-1)))
|
||||
goto error;
|
||||
GetNonSyntacticGlobalThis(cx, REGS.fp()->environmentChain(), REGS.stackHandleAt(-1));
|
||||
} else {
|
||||
PUSH_COPY(cx->global()->lexicalEnvironment().thisValue());
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ BoxNonStrictThis(JSContext* cx, HandleValue thisv, MutableHandleValue vp);
|
|||
extern bool
|
||||
GetFunctionThis(JSContext* cx, AbstractFramePtr frame, MutableHandleValue res);
|
||||
|
||||
extern bool
|
||||
extern void
|
||||
GetNonSyntacticGlobalThis(JSContext* cx, HandleObject envChain, MutableHandleValue res);
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче