diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-09-18 21:37:35 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 14:27:31 +0200 |
commit | 4d0812e4bda7d978ef2054e2f067ee15071a7cef (patch) | |
tree | 10cdabb63c820674cbf020c85a1ab8ffe699d127 /src/qml/compiler/qv4codegen.cpp | |
parent | 6c461e9c8c5816776f98ebc2c28180e990cfce03 (diff) |
[new compiler] Fix crash with empty function bodies
Change defineFunction back to taking AST::SourceElements for the body (how it
was originally)
Then in the new compiler, do the same "function->body ? function->body->elements
: 0" dance for function expressions and for binding expressions, synthesize the
AST::SourceElements.
Change-Id: Iaedb15925a6bb8482cde2b371a6e781477252435
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index bd4b1f2c9d..303d001246 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -1746,7 +1746,7 @@ bool Codegen::visit(FunctionDeclaration * ast) V4IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast, AST::FormalParameterList *formals, - AST::Node *body, Mode mode, + AST::SourceElements *body, Mode mode, const QStringList &inheritedLocals) { qSwap(_mode, mode); // enter function code. @@ -1852,13 +1852,7 @@ V4IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast, ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn), 0)); } - if (AST::SourceElements *elements = AST::cast<AST::SourceElements*>(body)) - sourceElements(elements); - else if (body) { - Q_ASSERT(_mode == QmlBinding); - _block->nextLocation = ast->firstSourceLocation(); - accept(body); - } + sourceElements(body); _function->insertBasicBlock(_exitBlock); |