diff options
author | Erik Verbruggen <erik.verbruggen@me.com> | 2013-07-02 16:43:59 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-02 20:57:15 +0200 |
commit | 2ba188dce0d04a7f53ba5ef89f1fcf16cfcdde42 (patch) | |
tree | 2122094f9561ccee7c25f5bc0607cc9d5c37ed0b | |
parent | d7134b8b68f0b3530269f7d087bdecfc8986be6b (diff) |
Fix automatic semicolon insertion. Again.
After a do-token, no automatic semicolon can be inserted, because that
would result in an empty statement. The issue was that the correct state
was set when a do-token was found, but the state updating logic would
immediately reset it back, resulting in a semicolon insertion.
Change-Id: If867510dfaa182d0fe8b73a5bb1cab299c4faecc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/qml/parser/qqmljslexer.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qml/qjsengine/tst_qjsengine.cpp | 4 |
2 files changed, 2 insertions, 5 deletions
diff --git a/src/qml/qml/parser/qqmljslexer.cpp b/src/qml/qml/parser/qqmljslexer.cpp index a441504ee3..5d9ca1036f 100644 --- a/src/qml/qml/parser/qqmljslexer.cpp +++ b/src/qml/qml/parser/qqmljslexer.cpp @@ -287,7 +287,8 @@ int Lexer::lex() break; case BalancedParentheses: - _parenthesesState = IgnoreParentheses; + if (_tokenKind != T_DO) + _parenthesesState = IgnoreParentheses; break; } // switch diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 7c9f5b106c..fe467b5ac0 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -1541,16 +1541,12 @@ void tst_QJSEngine::automaticSemicolonInsertion() } { QJSValue ret = eng.evaluate("n = 5; i = 0; do\n ++n; while (++i < 10); n"); - QEXPECT_FAIL("", "Known issue with automatic semicolon insertion. Regression from V8", Continue); QVERIFY(ret.isNumber()); - QEXPECT_FAIL("", "Known issue with automatic semicolon insertion. Regression from V8", Continue); QCOMPARE(ret.toInt(), 15); } { QJSValue ret = eng.evaluate("n = 20; i = 0; do\n --n; while (++i < 10); n"); - QEXPECT_FAIL("", "Known issue with automatic semicolon insertion. Regression from V8", Continue); QVERIFY(ret.isNumber()); - QEXPECT_FAIL("", "Known issue with automatic semicolon insertion. Regression from V8", Continue); QCOMPARE(ret.toInt(), 10); } |