aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compilercontext_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-07-03 08:45:20 +0200
committerLars Knoll <lars.knoll@qt.io>2017-07-04 10:22:30 +0000
commit968033e33ba2d7d9dd614994ecfca8b68f972032 (patch)
tree03b73b72890cac1a4f5fca978537233719a6e862 /src/qml/compiler/qv4compilercontext_p.h
parent1283f7c3b34ebd441b9679ce3981d216ba530e98 (diff)
Properly calculate escaping variables
Change-Id: Ia9f0b6d3f31bd3a7bd4316ee3f3e9ff977f973b7 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilercontext_p.h')
-rw-r--r--src/qml/compiler/qv4compilercontext_p.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h
index a924d087c0..87202089c5 100644
--- a/src/qml/compiler/qv4compilercontext_p.h
+++ b/src/qml/compiler/qv4compilercontext_p.h
@@ -123,6 +123,7 @@ struct Context {
typedef QMap<QString, Member> MemberMap;
MemberMap members;
+ QSet<QString> usedVariables;
QQmlJS::AST::FormalParameterList *formals = 0;
QStringList arguments;
QStringList locals;
@@ -216,26 +217,21 @@ struct Context {
usesArgumentsObject == ArgumentsObjectNotUsed && !hasDirectEval;
}
- int findArgument(const QString &name, bool canEscape)
+ int findArgument(const QString &name)
{
// search backwards to handle duplicate argument names correctly
for (int i = arguments.size() - 1; i >= 0; --i) {
- if (arguments.at(i) == name) {
- if (canEscape)
- argumentsCanEscape = true;
+ if (arguments.at(i) == name)
return i;
- }
}
return -1;
}
- int findMember(const QString &name, bool canEscape) const
+ int findMember(const QString &name) const
{
MemberMap::const_iterator it = members.find(name);
if (it == members.end())
return -1;
- if (canEscape)
- (*it).canEscape = true;
Q_ASSERT((*it).index != -1 || !parent);
return (*it).index;
}
@@ -252,6 +248,10 @@ struct Context {
return true;
}
+ void addUsedVariable(const QString &name) {
+ usedVariables.insert(name);
+ }
+
void addLocalVar(const QString &name, MemberType type, QQmlJS::AST::VariableDeclaration::VariableScope scope, QQmlJS::AST::FunctionExpression *function = 0)
{
if (! name.isEmpty()) {