diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2011-11-10 16:36:54 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-14 16:39:25 +0100 |
commit | fff130ee6c4b4a06d0f90fa8ed8c3a6c4218035f (patch) | |
tree | 5a8f1f23253b110cdec03def8e50678d5eb5b31d /tests/auto/declarative/qdeclarativeecmascript | |
parent | 2ad0e1978347dd7c1782a9edb5047351c3fb6706 (diff) |
Fix parsing of unary expressions.
Prohibit the lexer to synthesize a semicolon token after the
colon-sign of a binding declaration.
The parser internally was rewriting the following bindings
Component.onCompleted:
++foo
as
Component.onCompleted: ;
++foo
Task-number: QTBUG-21310
Change-Id: I0558d17fd81b5abac81fb990502d49767ea40730
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript')
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/unaryExpression.qml | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/unaryExpression.qml b/tests/auto/declarative/qdeclarativeecmascript/data/unaryExpression.qml new file mode 100644 index 0000000000..0d40bec710 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/unaryExpression.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +Item { + + Component.onCompleted: +++bar + + property int bar: 0 +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 492ed739b2..11e33bec1d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -227,6 +227,7 @@ private slots: void revision(); void automaticSemicolon(); + void unaryExpression(); private: static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -5050,6 +5051,13 @@ void tst_qdeclarativeecmascript::automaticSemicolon() QVERIFY(object != 0); } +void tst_qdeclarativeecmascript::unaryExpression() +{ + QDeclarativeComponent component(&engine, TEST_FILE("unaryExpression.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); +} + // Makes sure that a binding isn't double re-evaluated when it depends on the same variable twice void tst_qdeclarativeecmascript::doubleEvaluate() { |