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
78dbeb4f
Commit
78dbeb4f
authored
Sep 22, 2009
by
Erik Verbruggen
Browse files
Initial groundwork for the QML context lookups.
parent
baf7003b
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/plugins/duieditor/duieditor.pro
View file @
78dbeb4f
...
...
@@ -4,7 +4,8 @@ include(../../qtcreatorplugin.pri)
include
(
duieditor_dependencies
.
pri
)
include
(
parser
/
parser
.
pri
)
include
(
rewriter
/
rewriter
.
pri
)
DEFINES
+=
DUIEDITOR_LIBRARY
QT_CREATOR
DEFINES
+=
DUIEDITOR_LIBRARY
\
QT_CREATOR
INCLUDEPATH
+=
parser
\
rewriter
HEADERS
+=
duieditor
.
h
\
...
...
@@ -22,7 +23,10 @@ HEADERS += duieditor.h \
duimodelmanager
.
h
\
duicodeformatter
.
h
\
navigationtokenfinder
.
h
\
idcollector
.
h
idcollector
.
h
\
qmlexpressionundercursor
.
h
\
qmllookupcontext
.
h
\
resolveqmlexpression
.
h
SOURCES
+=
duieditor
.
cpp
\
duieditorfactory
.
cpp
\
duieditorplugin
.
cpp
\
...
...
@@ -36,5 +40,8 @@ SOURCES += duieditor.cpp \
duimodelmanager
.
cpp
\
duicodeformatter
.
cpp
\
navigationtokenfinder
.
cpp
\
idcollector
.
cpp
idcollector
.
cpp
\
qmlexpressionundercursor
.
cpp
\
qmllookupcontext
.
cpp
\
resolveqmlexpression
.
cpp
RESOURCES
+=
duieditor
.
qrc
src/plugins/duieditor/qmlexpressionundercursor.cpp
0 → 100644
View file @
78dbeb4f
#include
"qmljsast_p.h"
#include
"qmljsengine_p.h"
#include
"qmlexpressionundercursor.h"
using
namespace
DuiEditor
;
using
namespace
DuiEditor
::
Internal
;
using
namespace
QmlJS
;
using
namespace
QmlJS
::
AST
;
QmlExpressionUnderCursor
::
QmlExpressionUnderCursor
()
{
}
void
QmlExpressionUnderCursor
::
operator
()(
const
QTextCursor
&
cursor
)
{
_pos
=
cursor
.
position
();
}
bool
QmlExpressionUnderCursor
::
visit
(
QmlJS
::
AST
::
Block
*
ast
)
{
_scopes
.
push
(
ast
);
return
true
;
}
void
QmlExpressionUnderCursor
::
endVisit
(
QmlJS
::
AST
::
Block
*
)
{
_scopes
.
pop
();
}
bool
QmlExpressionUnderCursor
::
visit
(
QmlJS
::
AST
::
UiObjectBinding
*
ast
)
{
_scopes
.
push
(
ast
);
return
true
;
}
void
QmlExpressionUnderCursor
::
endVisit
(
QmlJS
::
AST
::
UiObjectBinding
*
)
{
_scopes
.
pop
();
}
bool
QmlExpressionUnderCursor
::
visit
(
QmlJS
::
AST
::
UiObjectDefinition
*
ast
)
{
_scopes
.
push
(
ast
);
return
true
;
}
void
QmlExpressionUnderCursor
::
endVisit
(
QmlJS
::
AST
::
UiObjectDefinition
*
)
{
_scopes
.
pop
();
}
bool
QmlExpressionUnderCursor
::
visit
(
QmlJS
::
AST
::
UiScriptBinding
*
ast
)
{
if
(
ast
->
firstSourceLocation
().
offset
<=
_pos
&&
_pos
<=
ast
->
lastSourceLocation
().
end
())
{
_expressionNode
=
ast
;
_expressionScopes
=
_scopes
;
}
return
false
;
}
src/plugins/duieditor/qmlexpressionundercursor.h
0 → 100644
View file @
78dbeb4f
#ifndef QMLEXPRESSIONUNDERCURSOR_H
#define QMLEXPRESSIONUNDERCURSOR_H
#include
<QStack>
#include
<QTextCursor>
#include
"qmljsastvisitor_p.h"
namespace
DuiEditor
{
namespace
Internal
{
class
QmlExpressionUnderCursor
:
protected
QmlJS
::
AST
::
Visitor
{
public:
QmlExpressionUnderCursor
();
void
operator
()(
const
QTextCursor
&
cursor
);
QStack
<
QmlJS
::
AST
::
Node
*>
expressionScopes
()
const
{
return
_expressionScopes
;
}
QmlJS
::
AST
::
Node
*
expressionNode
()
const
{
return
_expressionNode
;
}
protected:
virtual
bool
visit
(
QmlJS
::
AST
::
Block
*
ast
);
virtual
bool
visit
(
QmlJS
::
AST
::
UiObjectBinding
*
ast
);
virtual
bool
visit
(
QmlJS
::
AST
::
UiObjectDefinition
*
ast
);
virtual
bool
visit
(
QmlJS
::
AST
::
UiScriptBinding
*
ast
);
virtual
void
endVisit
(
QmlJS
::
AST
::
Block
*
);
virtual
void
endVisit
(
QmlJS
::
AST
::
UiObjectBinding
*
);
virtual
void
endVisit
(
QmlJS
::
AST
::
UiObjectDefinition
*
);
private:
QStack
<
QmlJS
::
AST
::
Node
*>
_scopes
;
QStack
<
QmlJS
::
AST
::
Node
*>
_expressionScopes
;
QmlJS
::
AST
::
Node
*
_expressionNode
;
quint32
_pos
;
};
}
// namespace Internal
}
// namespace DuiEditor
#endif // QMLEXPRESSIONUNDERCURSOR_H
src/plugins/duieditor/qmllookupcontext.cpp
0 → 100644
View file @
78dbeb4f
#include
"qmljsast_p.h"
#include
"qmljsengine_p.h"
#include
"qmlexpressionundercursor.h"
#include
"qmllookupcontext.h"
#include
"resolveqmlexpression.h"
using
namespace
DuiEditor
;
using
namespace
DuiEditor
::
Internal
;
using
namespace
QmlJS
;
using
namespace
QmlJS
::
AST
;
QmlLookupContext
::
QmlLookupContext
(
const
QStack
<
QmlJS
::
AST
::
Node
*>
&
scopes
,
QmlJS
::
AST
::
Node
*
expressionNode
,
const
DuiDocument
::
Ptr
&
doc
,
const
Snapshot
&
snapshot
)
:
_scopes
(
scopes
),
_expressionNode
(
expressionNode
),
_doc
(
doc
),
_snapshot
(
snapshot
)
{
}
src/plugins/duieditor/qmllookupcontext.h
0 → 100644
View file @
78dbeb4f
#ifndef QMLLOOKUPCONTEXT_H
#define QMLLOOKUPCONTEXT_H
#include
<QStack>
#include
"duidocument.h"
#include
"qmljsastvisitor_p.h"
namespace
DuiEditor
{
namespace
Internal
{
class
QmlLookupContext
{
public:
QmlLookupContext
(
const
QStack
<
QmlJS
::
AST
::
Node
*>
&
scopes
,
QmlJS
::
AST
::
Node
*
expressionNode
,
const
DuiDocument
::
Ptr
&
doc
,
const
Snapshot
&
snapshot
);
private:
QStack
<
QmlJS
::
AST
::
Node
*>
_scopes
;
QmlJS
::
AST
::
Node
*
_expressionNode
;
DuiDocument
::
Ptr
_doc
;
Snapshot
_snapshot
;
};
}
// namespace Internal
}
// namespace DuiEditor
#endif // QMLLOOKUPCONTEXT_H
src/plugins/duieditor/resolveqmlexpression.cpp
0 → 100644
View file @
78dbeb4f
#include
"qmljsast_p.h"
#include
"qmljsengine_p.h"
#include
"resolveqmlexpression.h"
using
namespace
DuiEditor
;
using
namespace
DuiEditor
::
Internal
;
using
namespace
QmlJS
;
using
namespace
QmlJS
::
AST
;
ResolveQmlExpression
::
ResolveQmlExpression
()
{
}
src/plugins/duieditor/resolveqmlexpression.h
0 → 100644
View file @
78dbeb4f
#ifndef RESOLVEQMLEXPRESSION_H
#define RESOLVEQMLEXPRESSION_H
#include
"qmljsastvisitor_p.h"
namespace
DuiEditor
{
namespace
Internal
{
class
ResolveQmlExpression
:
protected
QmlJS
::
AST
::
Visitor
{
public:
ResolveQmlExpression
();
protected:
private:
};
}
// namespace Internal
}
// namespace DuiEditor
#endif // RESOLVEQMLEXPRESSION_H
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