From 128485ccdb4f1c6f1bf1ebea85c5bed749cacd7a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 4 May 2018 10:56:19 +0200 Subject: Add some basic support for for-of loops The support is basically at the same level as for for-in at the moment. Currently unimplemented: * Destructuring * Proper lexical scoping * calling iterator.throw()/return() when required Change-Id: If193ce0b054c4315fc16b7e174334a31b2730dcf Reviewed-by: Simon Hausmann --- src/qml/parser/qqmljskeywords_p.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/qml/parser/qqmljskeywords_p.h') diff --git a/src/qml/parser/qqmljskeywords_p.h b/src/qml/parser/qqmljskeywords_p.h index 9cc47469e5..40094ecdf8 100644 --- a/src/qml/parser/qqmljskeywords_p.h +++ b/src/qml/parser/qqmljskeywords_p.h @@ -76,10 +76,13 @@ static inline int classify2(const QChar *s, int parseModeFlags) { return Lexer::T_IN; } } - else if ((parseModeFlags & Lexer::QmlMode) && s[0].unicode() == 'o') { + else if (s[0].unicode() == 'o') { if (s[1].unicode() == 'n') { return (parseModeFlags & Lexer::QmlMode) ? Lexer::T_ON : Lexer::T_IDENTIFIER; } + else if (s[1].unicode() == 'f') { + return Lexer::T_OF; + } } return Lexer::T_IDENTIFIER; } -- cgit v1.2.3