diff options
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 76ff7b7b4a..8b08e926ad 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -52,6 +52,7 @@ #include <private/qv4string_p.h> #include <private/qv4value_p.h> #include <private/qv4bytecodegenerator_p.h> +#include <private/qv4isel_moth_p.h> #ifndef V4_BOOTSTRAP #include <qv4context_p.h> @@ -3205,6 +3206,30 @@ QList<QQmlJS::DiagnosticMessage> Codegen::errors() const return _errors; } +QQmlRefPointer<CompiledData::CompilationUnit> Codegen::generateCompilationUnit(bool generateUnitData) +{ + Moth::CompilationUnit *compilationUnit = new Moth::CompilationUnit; + compilationUnit->codeRefs.resize(_module->functions.size()); + int i = 0; + for (IR::Function *irFunction : qAsConst(_module->functions)) + compilationUnit->codeRefs[i++] = irFunction->code; + + if (generateUnitData) + compilationUnit->data = jsUnitGenerator->generateUnit(); + + QQmlRefPointer<CompiledData::CompilationUnit> unit; + unit.adopt(compilationUnit); + return unit; +} + +QQmlRefPointer<CompiledData::CompilationUnit> Codegen::createUnitForLoading() +{ + QQmlRefPointer<CompiledData::CompilationUnit> result; + result.adopt(new Moth::CompilationUnit); + return result; +} + + #ifndef V4_BOOTSTRAP QList<QQmlError> Codegen::qmlErrors() const |