diff options
7 files changed, 33 insertions, 0 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g index 28566e21ea..b10063c7a5 100644 --- a/src/qml/parser/qqmljs.g +++ b/src/qml/parser/qqmljs.g @@ -1515,6 +1515,15 @@ Type: UiQualifiedId T_LT TypeArguments T_GT; } break; ./ +Type: T_RESERVED_WORD; +/. + case $rule_number: { + AST::UiQualifiedId *id = new (pool) AST::UiQualifiedId(stringRef(1)); + id->identifierToken = loc(1); + sym(1).Type = new (pool) AST::Type(id->finish()); + } break; +./ + Type: UiQualifiedId; /. case $rule_number: { diff --git a/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_bool.qml b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_bool.qml new file mode 100644 index 0000000000..79a9ede3d4 --- /dev/null +++ b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_bool.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 +QtObject { + function test() : bool { return true; } +} diff --git a/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_double.qml b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_double.qml new file mode 100644 index 0000000000..f58e4b92d9 --- /dev/null +++ b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_double.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 +QtObject { + function test() : double { return 0; } +} diff --git a/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_int.qml b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_int.qml new file mode 100644 index 0000000000..267ad7191f --- /dev/null +++ b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_int.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 +QtObject { + function test() : int { return 0; } +} diff --git a/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_real.qml b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_real.qml new file mode 100644 index 0000000000..9973819ad2 --- /dev/null +++ b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_real.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 +QtObject { + function test() : real { return 0; } +} diff --git a/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_string.qml b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_string.qml new file mode 100644 index 0000000000..e632ec7154 --- /dev/null +++ b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_string.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 +QtObject { + function test(s: string) {} +} diff --git a/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_url.qml b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_url.qml new file mode 100644 index 0000000000..ebf3f32561 --- /dev/null +++ b/tests/auto/qml/qqmlparser/data/typeannotations/basic_qmltypes_url.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 +QtObject { + function test(u: url) {} +} |