aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-10-15 14:43:17 +0200
committerLars Knoll <lars.knoll@qt.io>2018-11-16 09:17:09 +0000
commita7948a7519c3b0d4660637e8697311bd8abdc85d (patch)
treeba88e66af6997bc6b1b29cb601c67dfb1f0dd121
parente7c316504770ce357b2c73be485cdd8c1da9c4c1 (diff)
Properly mark variables as unresolved when accessed from eval
If we can't resolve the variable and are executing eval code, we need to look it up by name, and not generate a lookup in the global object. Change-Id: I693b3b714651911f72620160bfc463d6dbb00820 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/compiler/qv4compilercontext.cpp2
-rw-r--r--tests/auto/qml/ecmascripttests/TestExpectations1
2 files changed, 1 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp
index ca4cbfc4fc..5772bff7bf 100644
--- a/src/qml/compiler/qv4compilercontext.cpp
+++ b/src/qml/compiler/qv4compilercontext.cpp
@@ -187,7 +187,7 @@ Context::ResolvedName Context::resolveName(const QString &name, const QQmlJS::AS
}
// ### can we relax the restrictions here?
- if (contextType == ContextType::Eval || c->contextType == ContextType::Binding)
+ if (c->contextType == ContextType::Eval || c->contextType == ContextType::Binding)
return result;
result.type = ResolvedName::Global;
diff --git a/tests/auto/qml/ecmascripttests/TestExpectations b/tests/auto/qml/ecmascripttests/TestExpectations
index 81f9318cdc..02cb6acf99 100644
--- a/tests/auto/qml/ecmascripttests/TestExpectations
+++ b/tests/auto/qml/ecmascripttests/TestExpectations
@@ -567,7 +567,6 @@ language/expressions/prefix-increment/S11.4.4_A5_T3.js sloppyFails
language/expressions/prefix-increment/S11.4.4_A5_T4.js sloppyFails
language/expressions/prefix-increment/S11.4.4_A5_T5.js fails
language/expressions/prefix-increment/S11.4.4_A6_T3.js fails
-language/expressions/tagged-template/cache-eval-inner-function.js strictFails
language/expressions/tagged-template/invalid-escape-sequences.js fails
language/expressions/tagged-template/tco-member.js strictFails
language/function-code/each-param-has-own-non-shared-eval-scope.js sloppyFails