Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
88601712
Commit
88601712
authored
Aug 30, 2010
by
Christian Kamm
Browse files
QmlJS: Make ScopeChain more const-correct.
We don't want people modifying the shared component chain on a const Context *.
parent
f49a8595
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljsinterpreter.cpp
View file @
88601712
...
...
@@ -1370,10 +1370,10 @@ void ScopeChain::QmlComponentChain::clear()
document
=
Document
::
Ptr
(
0
);
}
void
ScopeChain
::
QmlComponentChain
::
add
(
QList
<
const
ObjectValue
*>
*
list
)
const
void
ScopeChain
::
QmlComponentChain
::
collect
(
QList
<
const
ObjectValue
*>
*
list
)
const
{
foreach
(
QmlComponentChain
*
parent
,
instantiatingComponents
)
parent
->
add
(
list
);
foreach
(
const
QmlComponentChain
*
parent
,
instantiatingComponents
)
parent
->
collect
(
list
);
if
(
!
document
)
return
;
...
...
@@ -1393,8 +1393,8 @@ void ScopeChain::update()
// the root scope in js files doesn't see instantiating components
if
(
jsScopes
.
count
()
!=
1
||
!
qmlScopeObjects
.
isEmpty
())
{
if
(
qmlComponentScope
)
{
foreach
(
QmlComponentChain
*
parent
,
qmlComponentScope
->
instantiatingComponents
)
parent
->
add
(
&
_all
);
foreach
(
const
QmlComponentChain
*
parent
,
qmlComponentScope
->
instantiatingComponents
)
parent
->
collect
(
&
_all
);
}
}
...
...
src/libs/qmljs/qmljsinterpreter.h
View file @
88601712
...
...
@@ -249,15 +249,15 @@ public:
QmlComponentChain
();
~
QmlComponentChain
();
QList
<
QmlComponentChain
*>
instantiatingComponents
;
QList
<
const
QmlComponentChain
*>
instantiatingComponents
;
Document
::
Ptr
document
;
void
add
(
QList
<
const
ObjectValue
*>
*
list
)
const
;
void
collect
(
QList
<
const
ObjectValue
*>
*
list
)
const
;
void
clear
();
};
const
ObjectValue
*
globalScope
;
QSharedPointer
<
QmlComponentChain
>
qmlComponentScope
;
QSharedPointer
<
const
QmlComponentChain
>
qmlComponentScope
;
QList
<
const
ObjectValue
*>
qmlScopeObjects
;
const
ObjectValue
*
qmlTypes
;
QList
<
const
ObjectValue
*>
jsScopes
;
...
...
src/libs/qmljs/qmljslink.cpp
View file @
88601712
...
...
@@ -83,10 +83,11 @@ void Link::initializeScopeChain()
Bind
*
bind
=
_doc
->
bind
();
QHash
<
Document
*
,
ScopeChain
::
QmlComponentChain
*>
componentScopes
;
scopeChain
.
qmlComponentScope
=
QSharedPointer
<
ScopeChain
::
QmlComponentChain
>
(
new
ScopeChain
::
QmlComponentChain
());
ScopeChain
::
QmlComponentChain
*
chain
=
new
ScopeChain
::
QmlComponentChain
;
scopeChain
.
qmlComponentScope
=
QSharedPointer
<
const
ScopeChain
::
QmlComponentChain
>
(
chain
);
if
(
_doc
->
qmlProgram
())
{
componentScopes
.
insert
(
_doc
.
data
(),
scopeChain
.
qmlComponentScope
.
data
()
);
makeComponentChain
(
_doc
,
scopeChain
.
qmlComponentScope
.
data
()
,
&
componentScopes
);
componentScopes
.
insert
(
_doc
.
data
(),
chain
);
makeComponentChain
(
_doc
,
chain
,
&
componentScopes
);
if
(
const
ObjectValue
*
typeEnvironment
=
_context
->
typeEnvironment
(
_doc
.
data
()))
scopeChain
.
qmlTypes
=
typeEnvironment
;
...
...
@@ -97,7 +98,7 @@ void Link::initializeScopeChain()
if
(
_doc
->
fileName
()
==
fileImport
.
name
)
{
ScopeChain
::
QmlComponentChain
*
component
=
new
ScopeChain
::
QmlComponentChain
;
componentScopes
.
insert
(
otherDoc
.
data
(),
component
);
scopeChain
.
qmlComponentScope
->
instantiatingComponents
+=
component
;
chain
->
instantiatingComponents
+=
component
;
makeComponentChain
(
otherDoc
,
component
,
&
componentScopes
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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