aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-07-08 11:36:14 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-07-08 11:36:14 +0200
commit9c5af084a9c2665d0d6c1f55f39170ac6ae8e335 (patch)
tree7729e55e1b1d88f9cf601b3b3ab0cc5aee6a8cd8 /src/qml/jsruntime
parent1c5c5f7aadc2dcc73a21eeb818e95c4e1b7de70f (diff)
parentef8a27544ac47b0ec2fc8c058d32c5b22650b359 (diff)
Merge remote-tracking branch 'origin/dev' into wip/qt6
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4runtimecodegen.cpp12
-rw-r--r--src/qml/jsruntime/qv4script.cpp19
2 files changed, 15 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4runtimecodegen.cpp b/src/qml/jsruntime/qv4runtimecodegen.cpp
index 99d0de5ec6..8d324acbd0 100644
--- a/src/qml/jsruntime/qv4runtimecodegen.cpp
+++ b/src/qml/jsruntime/qv4runtimecodegen.cpp
@@ -59,7 +59,7 @@ void RuntimeCodegen::generateFromFunctionExpression(const QString &fileName,
scan(ast);
scan.leaveEnvironment();
- if (hasError)
+ if (hasError())
return;
int index = defineFunction(ast->name.toString(), ast, ast->formals, ast->body);
@@ -68,17 +68,19 @@ void RuntimeCodegen::generateFromFunctionExpression(const QString &fileName,
void RuntimeCodegen::throwSyntaxError(const AST::SourceLocation &loc, const QString &detail)
{
- if (hasError)
+ if (hasError())
return;
- hasError = true;
+
+ Codegen::throwSyntaxError(loc, detail);
engine->throwSyntaxError(detail, _module->fileName, loc.startLine, loc.startColumn);
}
void RuntimeCodegen::throwReferenceError(const AST::SourceLocation &loc, const QString &detail)
{
- if (hasError)
+ if (hasError())
return;
- hasError = true;
+
+ Codegen::throwReferenceError(loc, detail);
engine->throwReferenceError(detail, _module->fileName, loc.startLine, loc.startColumn);
}
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 4dc5030fb0..c463812590 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -203,18 +203,15 @@ QV4::CompiledData::CompilationUnit Script::precompile(
Codegen cg(unitGenerator, /*strict mode*/false);
cg.generateFromProgram(fileName, finalUrl, source, program, module, contextType);
- const auto v4Errors = cg.errors();
- if (!v4Errors.isEmpty()) {
- const QUrl url = cg.url();
+ if (cg.hasError()) {
if (reportedErrors) {
- for (const auto &v4Error : v4Errors) {
- QQmlError error;
- error.setUrl(url);
- error.setLine(v4Error.line);
- error.setColumn(v4Error.column);
- error.setDescription(v4Error.message);
- reportedErrors->append(error);
- }
+ const auto v4Error = cg.error();
+ QQmlError error;
+ error.setUrl(cg.url());
+ error.setLine(v4Error.line);
+ error.setColumn(v4Error.column);
+ error.setDescription(v4Error.message);
+ reportedErrors->append(error);
}
return nullptr;
}