aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@me.com>2013-11-11 16:13:00 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-12 14:40:22 +0100
commit2e8dfb5d5cd02cf2ca281f19bfb9966c97f35db7 (patch)
treec08f57ed339a1a39e747352c370e87c07aead6d4 /src
parentff306b7829a6fcf1e1c28c3b0934ecebccd9e67d (diff)
V4 IR: scan arguments when entering function scope in QML.
When doing IR generation for a function declaration in a QML object, call through the helper methods to check for forbidden names, and most importantly, also checks if the function has parameters. If the latter is the case, they need to be added as a member for the current scope in order to get IR generation correct. Task-number: QTBUG-34493 Change-Id: I0ade15ee19e1b1ac8ee2f2d3fa186d1551800199 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp6
-rw-r--r--src/qml/compiler/qv4codegen_p.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index c2f2feb6bf..19264493be 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -1236,7 +1236,11 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<AST::N
Q_ASSERT(node != qmlRoot);
AST::FunctionDeclaration *function = AST::cast<AST::FunctionDeclaration*>(node);
- scan.enterEnvironment(node, function ? FunctionCode : QmlBinding);
+ if (function)
+ scan.enterQmlFunction(function);
+ else
+ scan.enterEnvironment(node, QmlBinding);
+
scan(function ? function->body : node);
scan.leaveEnvironment();
}
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index b20db26467..0bac996349 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -476,6 +476,9 @@ protected:
void enterQmlScope(AST::Node *ast, const QString &name)
{ enterFunction(ast, name, /*formals*/0, /*body*/0, /*expr*/0, /*isExpression*/false); }
+ void enterQmlFunction(AST::FunctionDeclaration *ast)
+ { enterFunction(ast, false, false); }
+
protected:
using Visitor::visit;
using Visitor::endVisit;