From: Erik Verbruggen Date: Tue, 2 Jul 2013 14:43:59 +0000 (+0200) Subject: Fix automatic semicolon insertion. Again. X-Git-Tag: upstream/5.2.1~669^2~89 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ba188dce0d04a7f53ba5ef89f1fcf16cfcdde42;p=platform%2Fupstream%2Fqtdeclarative.git 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 --- diff --git a/src/qml/qml/parser/qqmljslexer.cpp b/src/qml/qml/parser/qqmljslexer.cpp index a441504..5d9ca10 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 7c9f5b1..fe467b5 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); }