diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-03-22 14:45:37 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-03-30 12:56:43 +0000 |
commit | 84b72c51382ae861b5815f174cb482d0461c7955 (patch) | |
tree | 611d95a457469a8fa275c0566bf99ab0915065b2 /src/qml/compiler/qv4ssa.cpp | |
parent | c0c369efb3e5ecd9d4b6224267fa213de523ea17 (diff) |
V4: prevent re-adding currentStmt to the worklist in type inference.
Adding the statement that is currently inferred to the worklist can
happen when it's a member access where the base is discovered due to
static QML lookup.
Change-Id: I0e1b7011c4cfd691320d9b8dbcc660a65a558853
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/compiler/qv4ssa.cpp')
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 45ab6be84e..39f23ffc71 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -2194,6 +2194,7 @@ class TypeInference: public StmtVisitor, public ExprVisitor {} }; TypingResult _ty; + Stmt *_currentStmt; public: TypeInference(QQmlEnginePrivate *qmlEngine, const DefUses &defUses) @@ -2202,6 +2203,7 @@ public: , _tempTypes(_defUses.tempCount()) , _worklist(0) , _ty(UnknownType) + , _currentStmt(nullptr) {} void run(StatementWorklist &w) { @@ -2266,7 +2268,9 @@ private: bool run(Stmt *s) { TypingResult ty; std::swap(_ty, ty); - s->accept(this); + std::swap(_currentStmt, s); + _currentStmt->accept(this); + std::swap(_currentStmt, s); std::swap(_ty, ty); return ty.fullyTyped; } @@ -2305,7 +2309,11 @@ private: } } - *_worklist += _defUses.uses(*t); + for (Stmt *s : qAsConst(_defUses.uses(*t))) { + if (s != _currentStmt) { + *_worklist += s; + } + } } } else { e->type = (Type) ty.type; |