diff options
author | Sérgio Martins <sergio.martins@kdab.com> | 2015-05-08 20:10:06 +0100 |
---|---|---|
committer | Sérgio Martins <sergio.martins@kdab.com> | 2015-05-09 08:41:54 +0000 |
commit | 35bb082b2522262261858b685b7ebeb8c79cc189 (patch) | |
tree | 6c8a0ae4645f4e6aaba558f456f8e0a48e6c8a72 /tools | |
parent | a690648c215128d6e0ffe709be08a334f39554e0 (diff) |
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 <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmllint/main.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
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 <private/qqmljslexer_p.h> #include <private/qqmljsparser_p.h> #include <private/qqmljsengine_p.h> -#include <private/qqmlirbuilder_p.h> 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(); |