Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
ac4afcaa
Commit
ac4afcaa
authored
Dec 01, 2010
by
Thomas Hartmann
Browse files
QmlDesigner.rewriter: exposing lookupContext and document
We need this for the new AST based meta info system
parent
4ce19d4b
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/designercore/include/rewriterview.h
View file @
ac4afcaa
...
...
@@ -44,7 +44,10 @@
#include
<QScopedPointer>
namespace
QmlJS
{
class
DiagnosticMessage
;
class
LookupContext
;
class
Document
;
}
...
...
@@ -166,6 +169,9 @@ public:
bool
renameId
(
const
QString
&
oldId
,
const
QString
&
newId
);
QmlJS
::
LookupContext
*
lookupContext
()
const
;
QmlJS
::
Document
*
document
()
const
;
signals:
void
errorsChanged
(
const
QList
<
RewriterView
::
Error
>
&
errors
);
...
...
src/plugins/qmldesigner/designercore/model/rewriterview.cpp
View file @
ac4afcaa
...
...
@@ -567,6 +567,16 @@ bool RewriterView::renameId(const QString& oldId, const QString& newId)
return
false
;
}
QmlJS
::
LookupContext
*
RewriterView
::
lookupContext
()
const
{
return
textToModelMerger
()
->
lookupContext
();
}
QmlJS
::
Document
*
RewriterView
::
document
()
const
{
return
textToModelMerger
()
->
document
();
}
void
RewriterView
::
qmlTextChanged
()
{
if
(
inErrorState
())
...
...
src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
View file @
ac4afcaa
...
...
@@ -225,6 +225,7 @@ public:
:
m_snapshot
(
snapshot
)
,
m_doc
(
doc
)
,
m_context
(
new
Interpreter
::
Context
)
,
m_lookupContext
(
LookupContext
::
create
(
doc
,
snapshot
,
QList
<
AST
::
Node
*>
()))
,
m_link
(
m_context
,
doc
,
snapshot
,
importPaths
)
,
m_scopeBuilder
(
m_context
,
doc
,
snapshot
)
{
...
...
@@ -478,10 +479,15 @@ public:
return
QVariant
();
}
LookupContext
::
Ptr
lookupContext
()
const
{
return
m_lookupContext
;
}
private:
Snapshot
m_snapshot
;
Document
::
Ptr
m_doc
;
Interpreter
::
Context
*
m_context
;
LookupContext
::
Ptr
m_lookupContext
;
Link
m_link
;
ScopeBuilder
m_scopeBuilder
;
};
...
...
@@ -581,6 +587,8 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
snapshot
.
insert
(
doc
);
ReadingContext
ctxt
(
snapshot
,
doc
,
importPaths
);
m_lookupContext
=
ctxt
.
lookupContext
();
m_document
=
doc
;
setupImports
(
doc
,
differenceHandler
);
...
...
src/plugins/qmldesigner/designercore/model/texttomodelmerger.h
View file @
ac4afcaa
...
...
@@ -35,7 +35,9 @@
#include
"nodelistproperty.h"
#include
"modelnode.h"
#include
<qmljs/qmljslookupcontext.h>
#include
<qmljs/qmljsdocument.h>
#include
<qmljs/qmljslookupcontext.h>
#include
<QtCore/QStringList>
...
...
@@ -63,6 +65,12 @@ public:
RewriterView
*
view
()
const
{
return
m_rewriterView
;
}
QmlJS
::
LookupContext
*
lookupContext
()
const
{
return
m_lookupContext
.
data
();
}
QmlJS
::
Document
*
document
()
const
{
return
m_document
.
data
();
}
protected:
void
setActive
(
bool
active
);
...
...
@@ -122,6 +130,8 @@ private:
private:
RewriterView
*
m_rewriterView
;
bool
m_isActive
;
QmlJS
::
LookupContext
::
Ptr
m_lookupContext
;
QmlJS
::
Document
::
Ptr
m_document
;
};
class
DifferenceHandler
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment