diff options
author | Marco Benelli <[email protected]> | 2017-10-19 17:14:12 +0200 |
---|---|---|
committer | Marco Benelli <[email protected]> | 2018-04-12 10:49:46 +0000 |
commit | d7f431482db086652e3840cebfe92d5c5aa9fab6 (patch) | |
tree | d8bf4355e4f75dec16fbf13ce634b4cba4e1b759 /src/libs/qmljs/qmljsdocument.h | |
parent | c637c66ebb06eaec1fff5ec94402d27a55b63dd8 (diff) |
qmljs: handle js directives .pragma and .import
The directives .pragma and .import are not included in the AST.
Their source code locations are not stored in any other place.
As a result, when reformatting the source, they simply disappear.
This patch keep track of their source code locations, so they are
not removed when reformatting the source code.
This patch contains also some modification in the lexer that should
probably be ported to the qtdeclarative version.
Task-number: QTCREATORBUG-13038
Change-Id: I5d568abf02d37a584d4d246939736aaec5af5053
Reviewed-by: Thomas Hartmann <[email protected]>
Diffstat (limited to 'src/libs/qmljs/qmljsdocument.h')
-rw-r--r-- | src/libs/qmljs/qmljsdocument.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h index 5328fbe609f..937c7635736 100644 --- a/src/libs/qmljs/qmljsdocument.h +++ b/src/libs/qmljs/qmljsdocument.h @@ -97,6 +97,8 @@ public: QString path() const; QString componentName() const; + QList<AST::SourceLocation> jsDirectives() const; + private: bool parse_helper(int kind); @@ -109,6 +111,7 @@ private: QString _path; QString _componentName; QString _source; + QList<AST::SourceLocation> _jsdirectives; QWeakPointer<Document> _ptr; QByteArray _fingerprint; int _editorRevision; |