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
Tobias Hunger
qt-creator
Commits
30c67f43
Commit
30c67f43
authored
Nov 10, 2009
by
Roberto Raggi
Browse files
Cleanup Catch clause
parent
380bce45
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/AST.cpp
View file @
30c67f43
...
...
@@ -1616,12 +1616,10 @@ unsigned TryBlockStatementAST::firstToken() const
unsigned
TryBlockStatementAST
::
lastToken
()
const
{
for
(
CatchClauseAST
*
it
=
catch_clause_seq
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
lastToken
();
}
if
(
catch_clause_list
)
return
catch_clause_list
->
lastToken
();
if
(
statement
)
else
if
(
statement
)
return
statement
->
lastToken
();
return
try_token
+
1
;
...
...
src/shared/cplusplus/AST.h
View file @
30c67f43
...
...
@@ -1899,7 +1899,7 @@ class CPLUSPLUS_EXPORT TryBlockStatementAST: public StatementAST
public:
unsigned
try_token
;
StatementAST
*
statement
;
CatchClauseAST
*
catch_clause_
seq
;
CatchClause
List
AST
*
catch_clause_
list
;
public:
virtual
TryBlockStatementAST
*
asTryBlockStatement
()
{
return
this
;
}
...
...
@@ -1919,7 +1919,6 @@ public:
ExceptionDeclarationAST
*
exception_declaration
;
unsigned
rparen_token
;
StatementAST
*
statement
;
CatchClauseAST
*
next
;
public:
// annotations
Block
*
symbol
;
...
...
src/shared/cplusplus/ASTVisit.cpp
View file @
30c67f43
...
...
@@ -804,8 +804,7 @@ void TryBlockStatementAST::accept0(ASTVisitor *visitor)
{
if
(
visitor
->
visit
(
this
))
{
accept
(
statement
,
visitor
);
for
(
CatchClauseAST
*
it
=
catch_clause_seq
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
accept
(
catch_clause_list
,
visitor
);
}
visitor
->
endVisit
(
this
);
}
...
...
src/shared/cplusplus/ASTfwd.h
View file @
30c67f43
...
...
@@ -203,6 +203,7 @@ typedef List<PostfixAST *> PostfixListAST;
typedef
List
<
PostfixDeclaratorAST
*>
PostfixDeclaratorListAST
;
typedef
List
<
AttributeAST
*>
AttributeListAST
;
typedef
List
<
NestedNameSpecifierAST
*>
NestedNameSpecifierListAST
;
typedef
List
<
CatchClauseAST
*>
CatchClauseListAST
;
typedef
List
<
NameAST
*>
ObjCIdentifierListAST
;
typedef
List
<
ObjCMessageArgumentAST
*>
ObjCMessageArgumentListAST
;
...
...
src/shared/cplusplus/CheckStatement.cpp
View file @
30c67f43
...
...
@@ -273,8 +273,8 @@ bool CheckStatement::visit(SwitchStatementAST *ast)
bool
CheckStatement
::
visit
(
TryBlockStatementAST
*
ast
)
{
semantic
()
->
check
(
ast
->
statement
,
_scope
);
for
(
CatchClauseAST
*
c
=
ast
->
catch_clause_
seq
;
c
;
c
=
c
->
next
)
{
semantic
()
->
check
(
c
,
_scope
);
for
(
CatchClause
List
AST
*
it
=
ast
->
catch_clause_
list
;
it
;
it
=
it
->
next
)
{
semantic
()
->
check
(
it
->
value
,
_scope
);
}
return
false
;
}
...
...
src/shared/cplusplus/Parser.cpp
View file @
30c67f43
...
...
@@ -2949,7 +2949,7 @@ bool Parser::parseTryBlockStatement(StatementAST *&node)
TryBlockStatementAST
*
ast
=
new
(
_pool
)
TryBlockStatementAST
;
ast
->
try_token
=
consumeToken
();
parseCompoundStatement
(
ast
->
statement
);
CatchClauseAST
**
catch_clause_ptr
=
&
ast
->
catch_clause_
seq
;
CatchClause
List
AST
**
catch_clause_ptr
=
&
ast
->
catch_clause_
list
;
while
(
parseCatchClause
(
*
catch_clause_ptr
))
catch_clause_ptr
=
&
(
*
catch_clause_ptr
)
->
next
;
node
=
ast
;
...
...
@@ -2958,7 +2958,7 @@ bool Parser::parseTryBlockStatement(StatementAST *&node)
return
false
;
}
bool
Parser
::
parseCatchClause
(
CatchClauseAST
*&
node
)
bool
Parser
::
parseCatchClause
(
CatchClause
List
AST
*&
node
)
{
DEBUG_THIS_RULE
();
if
(
LA
()
==
T_CATCH
)
{
...
...
@@ -2968,7 +2968,7 @@ bool Parser::parseCatchClause(CatchClauseAST *&node)
parseExceptionDeclaration
(
ast
->
exception_declaration
);
match
(
T_RPAREN
,
&
ast
->
rparen_token
);
parseCompoundStatement
(
ast
->
statement
);
node
=
ast
;
node
=
new
(
_pool
)
CatchClauseListAST
(
ast
)
;
return
true
;
}
return
false
;
...
...
src/shared/cplusplus/Parser.h
View file @
30c67f43
...
...
@@ -181,7 +181,7 @@ public:
bool
parseTemplateParameterList
(
DeclarationListAST
*&
node
);
bool
parseThrowExpression
(
ExpressionAST
*&
node
);
bool
parseTryBlockStatement
(
StatementAST
*&
node
);
bool
parseCatchClause
(
CatchClauseAST
*&
node
);
bool
parseCatchClause
(
CatchClause
List
AST
*&
node
);
bool
parseTypeId
(
ExpressionAST
*&
node
);
bool
parseTypeIdList
(
ExpressionListAST
*&
node
);
bool
parseTypenameTypeParameter
(
DeclarationAST
*&
node
);
...
...
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