diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-04-06 10:20:08 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-02 14:17:51 +0000 |
commit | 922e6f42b4fa9b9fa87246c577c13bb945bd4bc4 (patch) | |
tree | 182cf430b7340c4f34c0cb350af1c15fd41b6648 /src/qml/compiler/qv4compiler.cpp | |
parent | 20d30b6b3a253eebedc927dbb91685bbec52cfee (diff) |
Rework catch context handling
Remove the need for a specialized catch context, instead
use a regular block context, that also captures the
catched variable.
This also removes the need to do lookups by name inside
a catch expression.
Change-Id: I8b037add7f423922e2a76b4c0da646ca7e25813a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compiler.cpp')
-rw-r--r-- | src/qml/compiler/qv4compiler.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index d5b77f61cb..cca4c01be6 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -321,8 +321,8 @@ void QV4::Compiler::JSUnitGenerator::writeFunction(char *f, QV4::Compiler::Conte function->flags |= CompiledData::Function::IsArrowFunction; if (irFunction->isGenerator) function->flags |= CompiledData::Function::IsGenerator; - if (irFunction->hasTry || irFunction->hasWith) - function->flags |= CompiledData::Function::HasCatchOrWith; + if (irFunction->hasWith) + function->flags |= CompiledData::Function::HasWith; function->nestedFunctionIndex = irFunction->returnsClosure ? quint32(module->functions.indexOf(irFunction->nestedContexts.first())) : std::numeric_limits<uint32_t>::max(); @@ -421,6 +421,14 @@ void QV4::Compiler::JSUnitGenerator::writeBlock(char *b, QV4::Compiler::Context quint32_le *locals = (quint32_le *)(b + block->localsOffset); for (int i = 0; i < irBlock->locals.size(); ++i) locals[i] = getStringId(irBlock->locals.at(i)); + + static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_BYTECODE"); + if (showCode) { + qDebug() << "=== Variables for block" << irBlock->blockIndex; + for (int i = 0; i < irBlock->locals.size(); ++i) + qDebug() << " " << i << ":" << locals[i]; + qDebug(); + } } QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Compiler::JSUnitGenerator::GeneratorOption option, quint32_le *blockAndFunctionOffsets, uint *jsClassDataOffset) |