aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2021-07-09 10:44:28 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2021-07-13 11:07:19 +0200
commit31032a26311fe1582af75357d7990601696eb122 (patch)
treee7581e906054cfac8fbf4510c3e343cd07dfe323 /src/qml/compiler/qv4codegen.cpp
parent675f3d0082a4a069ed84c7b3edb14d95aeed1417 (diff)
qv4bytecodegenerator: Supply SourceLocations in compiler context
This is required for better warnings in qmlcompiler's type propagator. Remains optional as to not consume superfluous memory when not needed (during normal QML engine operation). Change-Id: I50293f878e4f6659935925f5f2266427d2f64d7b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 548b8e7548..7787f1541a 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -3246,9 +3246,8 @@ static bool endsWithReturn(Module *module, Node *node)
return false;
}
-int Codegen::defineFunction(const QString &name, AST::Node *ast,
- AST::FormalParameterList *formals,
- AST::StatementList *body)
+int Codegen::defineFunction(const QString &name, AST::Node *ast, AST::FormalParameterList *formals,
+ AST::StatementList *body, bool storeSourceLocation)
{
enterContext(ast);
@@ -3280,7 +3279,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
// AOT compilation, so mark the surrounding function as only-returning-a-closure.
_context->returnsClosure = body && body->statement && cast<ExpressionStatement *>(body->statement) && cast<FunctionExpression *>(cast<ExpressionStatement *>(body->statement)->expression);
- BytecodeGenerator bytecode(_context->line, _module->debugMode);
+ BytecodeGenerator bytecode(_context->line, _module->debugMode, storeSourceLocation);
BytecodeGenerator *savedBytecodeGenerator;
savedBytecodeGenerator = bytecodeGenerator;
bytecodeGenerator = &bytecode;