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
0f031609
Commit
0f031609
authored
Feb 01, 2010
by
Roberto Raggi
Browse files
Cleanup.
parent
2fd8b2d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljsbind.cpp
View file @
0f031609
...
...
@@ -95,6 +95,21 @@ ObjectValue *Bind::scopeChainAt(Document::Ptr currentDocument, const Snapshot &s
return
scope
;
}
QString
Bind
::
toString
(
UiQualifiedId
*
qualifiedId
,
QChar
delimiter
)
{
QString
result
;
for
(
UiQualifiedId
*
iter
=
qualifiedId
;
iter
;
iter
=
iter
->
next
)
{
if
(
iter
!=
qualifiedId
)
result
+=
delimiter
;
if
(
iter
->
name
)
result
+=
iter
->
name
->
asString
();
}
return
result
;
}
void
Bind
::
accept
(
Node
*
node
)
{
Node
::
accept
(
node
,
this
);
...
...
@@ -110,21 +125,6 @@ bool Bind::visit(UiImportList *)
return
true
;
}
static
QString
serialize
(
UiQualifiedId
*
qualifiedId
,
QChar
delimiter
)
{
QString
result
;
for
(
UiQualifiedId
*
iter
=
qualifiedId
;
iter
;
iter
=
iter
->
next
)
{
if
(
iter
!=
qualifiedId
)
result
+=
delimiter
;
if
(
iter
->
name
)
result
+=
iter
->
name
->
asString
();
}
return
result
;
}
/*
import Qt 4.6
import Qt 4.6 as Xxx
...
...
@@ -161,7 +161,7 @@ bool Bind::visit(UiImport *ast)
// else try the metaobject system
if
(
ast
->
importUri
)
{
const
QString
package
=
serialize
(
ast
->
importUri
,
'/'
);
const
QString
package
=
toString
(
ast
->
importUri
,
'/'
);
int
majorVersion
=
-
1
;
// ### TODO: Check these magic version numbers
int
minorVersion
=
-
1
;
// ### TODO: Check these magic version numbers
...
...
@@ -208,9 +208,7 @@ ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitia
{
ObjectValue
*
parentObjectValue
;
if
(
qualifiedTypeNameId
&&
!
qualifiedTypeNameId
->
next
&&
qualifiedTypeNameId
->
name
->
asString
()
==
QLatin1String
(
"Script"
)
)
{
if
(
toString
(
qualifiedTypeNameId
)
==
QLatin1String
(
"Script"
))
{
// Script blocks all contribute to the same scope
parentObjectValue
=
switchObjectValue
(
_functionEnvironment
);
}
else
{
// normal component instance
...
...
@@ -253,11 +251,12 @@ bool Bind::visit(UiObjectInitializer *)
bool
Bind
::
visit
(
UiScriptBinding
*
ast
)
{
if
(
!
(
ast
->
qualifiedId
->
next
)
&&
ast
->
qualifiedId
->
name
->
as
String
(
)
==
"id"
)
if
(
toString
(
ast
->
qualifiedId
)
==
QLatin1
String
(
"id"
)
)
{
if
(
ExpressionStatement
*
e
=
cast
<
ExpressionStatement
*>
(
ast
->
statement
))
if
(
IdentifierExpression
*
i
=
cast
<
IdentifierExpression
*>
(
e
->
expression
))
if
(
i
->
name
)
_idEnvironment
->
setProperty
(
i
->
name
->
asString
(),
_currentObjectValue
);
}
return
false
;
}
...
...
src/libs/qmljs/qmljsbind.h
View file @
0f031609
...
...
@@ -56,6 +56,10 @@ public:
AST
::
UiObjectMember
*
currentObject
);
protected:
using
AST
::
Visitor
::
visit
;
QString
toString
(
AST
::
UiQualifiedId
*
qualifiedId
,
QChar
delimiter
=
QChar
(
'.'
));
void
accept
(
AST
::
Node
*
node
);
// Ui
...
...
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