diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-21 09:27:57 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-11-18 14:01:44 +0100 |
commit | 41bbf7e376d0e374dc7c4e2a5ed4157a1b880b4a (patch) | |
tree | 36e009e5850fe7fbd980faa249d7fc9702c48cbf /src/qml/parser/qqmljsast_p.h | |
parent | 355fd4bf5cd0a83b52b37c2a905cee867f9af4d6 (diff) |
QML: Consider the semicolon as part of expression statements
When asked for lastSourceLocation() we should always return the
semicolon token. In order for that to work, the semicolon token needs to
be valid in all cases. In the case of object literals as expressions for
properties we neither accepted nor synthesized a semicolon as delimiter.
Add an optional semicolon that we can then also use as end of the
expression statement.
Furthermore, this triggered a silent rule conflict for ImportSpecifier, which
for some reason did not arise before:
IdentifierReference could resolve to both ImpordBinding and IdentifierName,
causing ambiguity in the grammar, and ultimately caused parse failues
when parsing an import statement.
This is now resolved by explicitly telling the parser to prefer
shifting.
Initial-patch-by: Ulf Hermann <ulf.hermann@qt.io>
Change-Id: Iaec29c452b577312248a17cb48f005f4fc0bd8c4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsast_p.h')
-rw-r--r-- | src/qml/parser/qqmljsast_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index e436c4673d..fcf9933e67 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -1782,7 +1782,7 @@ public: { return expression->firstSourceLocation(); } SourceLocation lastSourceLocation() const override - { return expression->lastSourceLocation(); } + { return semicolonToken; } // attributes ExpressionNode *expression; |