aboutsummaryrefslogtreecommitdiffstats
path: root/src/v4/qv4codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/v4/qv4codegen.cpp')
-rw-r--r--src/v4/qv4codegen.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/v4/qv4codegen.cpp b/src/v4/qv4codegen.cpp
index df931fd767..c91458282f 100644
--- a/src/v4/qv4codegen.cpp
+++ b/src/v4/qv4codegen.cpp
@@ -1959,7 +1959,7 @@ V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
V4IR::Function *f = _function;
while (f && e->parent) {
- if ((f->usesArgumentsObject && name == "arguments") || (!f->isStrict && f->hasDirectEval) || f->insideWithOrCatch)
+ if ((f->usesArgumentsObject && name == "arguments") || (!f->isStrict && f->hasDirectEval) || f->insideWithOrCatch || (f->isNamedExpression && f->name == name))
break;
int index = e->findMember(name);
assert (index < e->members.size());
@@ -1974,6 +1974,9 @@ V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
f = f->outer;
}
+ if (!e->parent && (!f || !f->insideWithOrCatch) && _mode != EvalCode && (!f || f->name != name))
+ return _block->GLOBALNAME(name, line, col);
+
// global context or with. Lookup by name
return _block->NAME(name, line, col);