From 35bb082b2522262261858b685b7ebeb8c79cc189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 8 May 2015 20:10:06 +0100 Subject: qmllint: Fix parsing js files with .import directives For .pragmas we removed them explicitly but the correct fix is to not use "qmlMode" when setting code in the lexer. Change-Id: I6ffc0ca9e7ebab09fbf91e647d292ff0a3a1fd7d Task-number: QTBUG-45916 Reviewed-by: Simon Hausmann --- tools/qmllint/main.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp index 3b412b03cf..cd81a5bad6 100644 --- a/tools/qmllint/main.cpp +++ b/tools/qmllint/main.cpp @@ -41,7 +41,6 @@ #include #include #include -#include static bool lint_file(const QString &filename, bool silent) { @@ -59,10 +58,7 @@ static bool lint_file(const QString &filename, bool silent) QFileInfo info(filename); bool isJavaScript = info.suffix().toLower() == QLatin1String("js"); - if (isJavaScript) - QmlIR::Document::removeScriptPragmas(/*by-ref*/code); - - lexer.setCode(code, /*line = */ 1, true); + lexer.setCode(code, /*line = */ 1, /*qmlMode=*/ !isJavaScript); QQmlJS::Parser parser(&engine); bool success = isJavaScript ? parser.parseProgram() : parser.parse(); -- cgit v1.2.3