From 224316b515ed42411c43e1be8997c2d8faedc45e Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 22 Nov 2012 09:39:22 +0100 Subject: Accept missing semicolon after do-while statement. Although not valid according to ECMA 5.1, both JSC and V8 accept a missing semicolon after a do-while loop. (Both JSC and V8 do not do this through automatic semicolon insertion, but handle it as a special case.) Change-Id: Iff2b07b894564740d2dcbf9b1d46bc279d30b9e3 Reviewed-by: Alan Alpert --- tools/qmlmin/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tools/qmlmin') diff --git a/tools/qmlmin/main.cpp b/tools/qmlmin/main.cpp index 192a17af32..0d6950360f 100644 --- a/tools/qmlmin/main.cpp +++ b/tools/qmlmin/main.cpp @@ -394,7 +394,8 @@ bool Minify::parse(int startToken) const int yyerrorstate = _stateStack[yytos]; // automatic insertion of `;' - if (yytoken != -1 && t_action(yyerrorstate, T_AUTOMATIC_SEMICOLON) && canInsertAutomaticSemicolon(yytoken)) { + if (yytoken != -1 && ((t_action(yyerrorstate, T_AUTOMATIC_SEMICOLON) && canInsertAutomaticSemicolon(yytoken)) + || t_action(yyerrorstate, T_COMPATIBILITY_SEMICOLON))) { _tokens.prepend(yytoken); _tokenStrings.prepend(yytokentext); yyaction = yyerrorstate; @@ -509,7 +510,8 @@ bool Tokenize::parse(int startToken) const int yyerrorstate = _stateStack[yytos]; // automatic insertion of `;' - if (yytoken != -1 && t_action(yyerrorstate, T_AUTOMATIC_SEMICOLON) && canInsertAutomaticSemicolon(yytoken)) { + if (yytoken != -1 && ((t_action(yyerrorstate, T_AUTOMATIC_SEMICOLON) && canInsertAutomaticSemicolon(yytoken)) + || t_action(yyerrorstate, T_COMPATIBILITY_SEMICOLON))) { _tokens.prepend(yytoken); _tokenStrings.prepend(yytokentext); yyaction = yyerrorstate; -- cgit v1.2.3