diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-07-04 13:18:55 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-07-04 16:03:36 +0200 |
commit | 40ded579bd977dc8fc41aaa1cdfca36822d14fc6 (patch) | |
tree | 04069b8c15c05b2625dd45c869b45c37a6c62b3a /src/qml/jsruntime/qv4runtimecodegen.cpp | |
parent | c1546f8b7005a7cc0ed25f9dc1c762a9c929a25b (diff) |
Simplify codegen error handling
There can only ever be one error, either a syntax error or a reference
error. We record the error type as we want to get rid of the virtual
throw<X>Error methods in favor of an explicit compilation result.
Change-Id: Ie228490aad8efb7885083f6485f931299567f54c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtimecodegen.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4runtimecodegen.cpp | 12 |
1 files changed, 7 insertions, 5 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); } |