Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Hunger
qt-creator
Commits
f6ac9bd2
Commit
f6ac9bd2
authored
Aug 13, 2010
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Process switch statements and handle Q/D pointers.
parent
f2372257
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
10 deletions
+35
-10
src/shared/cplusplus/Bind.cpp
src/shared/cplusplus/Bind.cpp
+35
-10
No files found.
src/shared/cplusplus/Bind.cpp
View file @
f6ac9bd2
...
...
@@ -1088,18 +1088,38 @@ FullySpecifiedType Bind::trailingReturnType(TrailingReturnTypeAST *ast, const Fu
// StatementAST
bool
Bind
::
visit
(
QtMemberDeclarationAST
*
ast
)
{
// unsigned q_token = ast->q_token;
// unsigned lparen_token = ast->lparen_token;
ExpressionTy
type_id
=
this
->
expression
(
ast
->
type_id
);
// unsigned rparen_token = ast->rparen_token;
const
Name
*
name
=
0
;
if
(
tokenKind
(
ast
->
q_token
)
==
T_Q_D
)
name
=
control
()
->
nameId
(
control
()
->
identifier
(
"d"
));
else
name
=
control
()
->
nameId
(
control
()
->
identifier
(
"q"
));
FullySpecifiedType
declTy
=
this
->
expression
(
ast
->
type_id
);
if
(
tokenKind
(
ast
->
q_token
)
==
T_Q_D
)
{
if
(
NamedType
*
namedTy
=
declTy
->
asNamedType
())
{
if
(
const
NameId
*
nameId
=
namedTy
->
name
()
->
asNameId
())
{
std
::
string
privateClass
;
privateClass
+=
nameId
->
identifier
()
->
chars
();
privateClass
+=
"Private"
;
const
Name
*
privName
=
control
()
->
nameId
(
control
()
->
identifier
(
privateClass
.
c_str
(),
privateClass
.
size
()));
declTy
.
setType
(
control
()
->
namedType
(
privName
));
}
}
}
Declaration
*
symbol
=
control
()
->
newDeclaration
(
/*generated*/
0
,
name
);
symbol
->
setType
(
control
()
->
pointerType
(
declTy
));
_scope
->
addMember
(
symbol
);
return
false
;
}
bool
Bind
::
visit
(
CaseStatementAST
*
ast
)
{
// unsigned case_token = ast->case_token;
ExpressionTy
expression
=
this
->
expression
(
ast
->
expression
);
// unsigned colon_token = ast->colon_token;
this
->
statement
(
ast
->
statement
);
return
false
;
}
...
...
@@ -1257,12 +1277,17 @@ bool Bind::visit(ReturnStatementAST *ast)
bool
Bind
::
visit
(
SwitchStatementAST
*
ast
)
{
// unsigned switch_token = ast->switch_token;
// unsigned lparen_token = ast->lparen_token;
Block
*
block
=
control
()
->
newBlock
(
ast
->
firstToken
());
const
unsigned
startScopeToken
=
ast
->
lparen_token
?
ast
->
lastToken
()
:
ast
->
firstToken
();
block
->
setStartOffset
(
tokenAt
(
startScopeToken
).
end
());
block
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()
-
1
).
end
());
_scope
->
addMember
(
block
);
ast
->
symbol
=
block
;
Scope
*
previousScope
=
switchScope
(
block
);
ExpressionTy
condition
=
this
->
expression
(
ast
->
condition
);
// unsigned rparen_token = ast->rparen_token;
this
->
statement
(
ast
->
statement
);
// Block *symbol = ast->symbol
;
(
void
)
switchScope
(
previousScope
)
;
return
false
;
}
...
...
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