diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-10-11 13:50:23 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-11 19:38:47 +0200 |
commit | 6adb0693a2e408c388a0939e0a3d711da7b651df (patch) | |
tree | 3f7a2c2d1cf53d8079f5ac8c2e4c6e4e11d69edf /src/qml/compiler/qqmlcodegenerator.cpp | |
parent | a4449295c3051e42b1aa80a1c7cc91671ad05765 (diff) |
Fix determination of lookup mode in V4 code generator
In order to determine the type of lookup we need (name or directly in
environment members), we used Codegen::_mode, which is set to the currently
suitable mode depending on the function (parameter to defineFunction). However
that's not quite correct, the look-up mode depends on the function itself, not
where it was called from. This patch corrects that by moving the compilation
mode into the Environment itself.
This is needed by follow-up patches.
Additionally the "bool deletable" parameter to the builtin_declare_vars was
always set to false, because it used mode instead of _mode, which was never set
to Eval or QmlBinding. This will be cleaned up in a future patch.
Change-Id: I878f187945e5de091689ab5d70a0f33eb5a9e38f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator.cpp')
-rw-r--r-- | src/qml/compiler/qqmlcodegenerator.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp index fb2ca7c14e..83f3dfe84a 100644 --- a/src/qml/compiler/qqmlcodegenerator.cpp +++ b/src/qml/compiler/qqmlcodegenerator.cpp @@ -1161,20 +1161,20 @@ void JSCodeGen::generateJSCodeForFunctionsAndBindings(const QString &fileName, P _module->setFileName(fileName); QmlScanner scan(this, output->code); - scan.begin(output->program); + scan.begin(output->program, QmlBinding); foreach (AST::Node *node, output->functions) { if (node == output->program) continue; AST::FunctionDeclaration *function = AST::cast<AST::FunctionDeclaration*>(node); - scan.enterEnvironment(node); + scan.enterEnvironment(node, function ? FunctionCode : QmlBinding); scan(function ? function->body : node); scan.leaveEnvironment(); } scan.end(); _env = 0; - _function = defineFunction(QString("context scope"), output->program, 0, 0, QmlBinding); + _function = defineFunction(QString("context scope"), output->program, 0, 0); foreach (AST::Node *node, output->functions) { if (node == output->program) @@ -1201,7 +1201,7 @@ void JSCodeGen::generateJSCodeForFunctionsAndBindings(const QString &fileName, P defineFunction(name, node, function ? function->formals : 0, - body, function ? FunctionCode : QmlBinding); + body); } @@ -1210,9 +1210,9 @@ void JSCodeGen::generateJSCodeForFunctionsAndBindings(const QString &fileName, P } -void JSCodeGen::QmlScanner::begin(AST::Node *rootNode) +void JSCodeGen::QmlScanner::begin(AST::Node *rootNode, CompilationMode compilationMode) { - enterEnvironment(0); + enterEnvironment(0, compilationMode); enterFunction(rootNode, "context scope", 0, 0, 0, /*isExpression*/false); } |