diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-03-26 22:59:28 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-02 14:17:46 +0000 |
commit | 20d30b6b3a253eebedc927dbb91685bbec52cfee (patch) | |
tree | 0e91a6c519829bd279258f3fe807519e6c8a1e3d /src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp | |
parent | d499a995292629d3522f5e77b7c958bacdf5d0ae (diff) |
Add support for proper lexical scoping
This is still to some extend work in progress as
lexically scoped for loops won't yet do the right
thing.
let and const variables are still accessible before
they are declared, and the global scope doesn't yet
have a proper context for lexically declared variables.
Change-Id: Ie39f74a8fccdaead437fbf07f9fc228a444c26ed
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index c33d0026d5..99d106d5f6 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -81,8 +81,9 @@ QV4::Heap::CallContext *QV4DataCollector::findScope(QV4::Heap::ExecutionContext for (; scope > 0 && ctx; --scope) ctx = ctx->outer; - return (ctx && ctx->type == QV4::Heap::ExecutionContext::Type_CallContext) ? - static_cast<QV4::Heap::CallContext *>(ctx) : nullptr; + if (!ctx || (ctx->type != QV4::Heap::ExecutionContext::Type_CallContext && ctx->type != QV4::Heap::ExecutionContext::Type_BlockContext)) + return nullptr; + return static_cast<QV4::Heap::CallContext *>(ctx); } QVector<QV4::Heap::ExecutionContext::ContextType> QV4DataCollector::getScopeTypes(int frame) @@ -108,8 +109,9 @@ int QV4DataCollector::encodeScopeType(QV4::Heap::ExecutionContext::ContextType s return 2; case QV4::Heap::ExecutionContext::Type_CallContext: return 1; - case QV4::Heap::ExecutionContext::Type_QmlContext: - default: + case QV4::Heap::ExecutionContext::Type_BlockContext: + return 3; + default: // QV4::Heap::ExecutionContext::Type_QmlContext: return -1; } } |