From 9d7b27f5bf44a46707e6d50ebf51ecf73f91dd1b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 5 Dec 2014 16:32:56 +0100 Subject: Clean up JS .import/.pragma directive scanning There's a scanner in QQmlJS::Lexer::scanDirectives that can parse those, so let's get rid of extra parser that operates on a string. Instead this way we can do the scanning all in one shot, avoid detaching a copy of the source code string and (most importantly) bring the parser closer to the copy in Qt Creator, which uses the directives approach to extract imports and pragma. Change-Id: Iff6eb8d91a45d8a70f383f953115692be48259de Reviewed-by: Fawzi Mohamed --- src/qml/jsruntime/qv4script_p.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4script_p.h') diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h index 467e8af3e5..894859ce5e 100644 --- a/src/qml/jsruntime/qv4script_p.h +++ b/src/qml/jsruntime/qv4script_p.h @@ -43,6 +43,10 @@ QT_BEGIN_NAMESPACE class QQmlContextData; +namespace QQmlJS { +class Directives; +} + namespace QV4 { struct ContextStateSaver { @@ -137,7 +141,8 @@ struct Q_QML_EXPORT Script { Function *function(); - static QQmlRefPointer precompile(IR::Module *module, Compiler::JSUnitGenerator *unitGenerator, ExecutionEngine *engine, const QUrl &url, const QString &source, QList *reportedErrors = 0); + static QQmlRefPointer precompile(IR::Module *module, Compiler::JSUnitGenerator *unitGenerator, ExecutionEngine *engine, const QUrl &url, const QString &source, + QList *reportedErrors = 0, QQmlJS::Directives *directivesCollector = 0); static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, Object *scopeObject); }; -- cgit v1.2.3