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
77e7899e
Commit
77e7899e
authored
Nov 10, 2009
by
Roberto Raggi
Browse files
Removed StatementListAST
Done with Erik Verbruggen
parent
36a0ea2b
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/AST.cpp
View file @
77e7899e
...
...
@@ -401,22 +401,6 @@ unsigned ClassSpecifierAST::lastToken() const
return
classkey_token
+
1
;
}
unsigned
StatementListAST
::
firstToken
()
const
{
return
statement
->
firstToken
();
}
unsigned
StatementListAST
::
lastToken
()
const
{
for
(
const
StatementListAST
*
it
=
this
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
statement
->
lastToken
();
}
return
0
;
}
unsigned
CompoundStatementAST
::
firstToken
()
const
{
return
lbrace_token
;
...
...
@@ -429,7 +413,7 @@ unsigned CompoundStatementAST::lastToken() const
for
(
StatementListAST
*
it
=
statements
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
statement
->
lastToken
();
return
it
->
value
->
lastToken
();
}
return
lbrace_token
+
1
;
...
...
src/shared/cplusplus/AST.h
View file @
77e7899e
...
...
@@ -607,22 +607,6 @@ protected:
virtual
void
accept0
(
ASTVisitor
*
visitor
);
};
class
CPLUSPLUS_EXPORT
StatementListAST
:
public
AST
{
public:
StatementAST
*
statement
;
StatementListAST
*
next
;
public:
virtual
StatementListAST
*
asStatementList
()
{
return
this
;
}
virtual
unsigned
firstToken
()
const
;
virtual
unsigned
lastToken
()
const
;
protected:
virtual
void
accept0
(
ASTVisitor
*
visitor
);
};
class
CPLUSPLUS_EXPORT
CompoundStatementAST
:
public
StatementAST
{
public:
...
...
src/shared/cplusplus/ASTVisit.cpp
View file @
77e7899e
...
...
@@ -180,14 +180,6 @@ void CaseStatementAST::accept0(ASTVisitor *visitor)
visitor
->
endVisit
(
this
);
}
void
StatementListAST
::
accept0
(
ASTVisitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
accept
(
statement
,
visitor
);
}
visitor
->
endVisit
(
this
);
}
void
CompoundStatementAST
::
accept0
(
ASTVisitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
...
...
src/shared/cplusplus/ASTVisitor.h
View file @
77e7899e
...
...
@@ -171,7 +171,6 @@ public:
virtual
bool
visit
(
SimpleNameAST
*
)
{
return
true
;
}
virtual
bool
visit
(
SimpleSpecifierAST
*
)
{
return
true
;
}
virtual
bool
visit
(
SizeofExpressionAST
*
)
{
return
true
;
}
virtual
bool
visit
(
StatementListAST
*
)
{
return
true
;
}
virtual
bool
visit
(
StringLiteralAST
*
)
{
return
true
;
}
virtual
bool
visit
(
SwitchStatementAST
*
)
{
return
true
;
}
virtual
bool
visit
(
TemplateArgumentListAST
*
)
{
return
true
;
}
...
...
@@ -305,7 +304,6 @@ public:
virtual
void
endVisit
(
SimpleNameAST
*
)
{
}
virtual
void
endVisit
(
SimpleSpecifierAST
*
)
{
}
virtual
void
endVisit
(
SizeofExpressionAST
*
)
{
}
virtual
void
endVisit
(
StatementListAST
*
)
{
}
virtual
void
endVisit
(
StringLiteralAST
*
)
{
}
virtual
void
endVisit
(
SwitchStatementAST
*
)
{
}
virtual
void
endVisit
(
TemplateArgumentListAST
*
)
{
}
...
...
src/shared/cplusplus/ASTfwd.h
View file @
77e7899e
...
...
@@ -178,7 +178,6 @@ class SimpleSpecifierAST;
class
SizeofExpressionAST
;
class
SpecifierAST
;
class
StatementAST
;
class
StatementListAST
;
class
StringLiteralAST
;
class
SwitchStatementAST
;
class
TemplateArgumentListAST
;
...
...
@@ -202,6 +201,7 @@ class WhileStatementAST;
typedef
List
<
ExpressionAST
*>
ExpressionListAST
;
typedef
List
<
DeclarationAST
*>
DeclarationListAST
;
typedef
List
<
StatementAST
*>
StatementListAST
;
}
// end of namespace CPlusPlus
...
...
src/shared/cplusplus/CheckStatement.cpp
View file @
77e7899e
...
...
@@ -105,7 +105,7 @@ bool CheckStatement::visit(CompoundStatementAST *ast)
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
for
(
StatementListAST
*
it
=
ast
->
statements
;
it
;
it
=
it
->
next
)
{
semantic
()
->
check
(
it
->
statement
,
_scope
);
semantic
()
->
check
(
it
->
value
,
_scope
);
}
(
void
)
switchScope
(
previousScope
);
return
false
;
...
...
src/shared/cplusplus/Parser.cpp
View file @
77e7899e
...
...
@@ -2439,7 +2439,7 @@ bool Parser::parseCompoundStatement(StatementAST *&node)
skipUntilStatement
();
}
else
{
*
statement_ptr
=
new
(
_pool
)
StatementListAST
;
(
*
statement_ptr
)
->
statement
=
statement
;
(
*
statement_ptr
)
->
value
=
statement
;
statement_ptr
=
&
(
*
statement_ptr
)
->
next
;
}
}
...
...
tests/auto/cplusplus/ast/tst_ast.cpp
View file @
77e7899e
...
...
@@ -557,8 +557,8 @@ void tst_AST::normal_array_access()
QVERIFY
(
bodyStatements
);
QVERIFY
(
bodyStatements
->
next
);
QVERIFY
(
bodyStatements
->
next
->
next
);
QVERIFY
(
bodyStatements
->
next
->
next
->
statement
);
ExpressionAST
*
expr
=
bodyStatements
->
next
->
next
->
statement
->
asReturnStatement
()
->
expression
;
QVERIFY
(
bodyStatements
->
next
->
next
->
value
);
ExpressionAST
*
expr
=
bodyStatements
->
next
->
next
->
value
->
asReturnStatement
()
->
expression
;
QVERIFY
(
expr
);
PostfixExpressionAST
*
postfixExpr
=
expr
->
asPostfixExpression
();
...
...
@@ -598,8 +598,8 @@ void tst_AST::array_access_with_nested_expression()
QVERIFY
(
func
);
StatementListAST
*
bodyStatements
=
func
->
function_body
->
asCompoundStatement
()
->
statements
;
QVERIFY
(
bodyStatements
&&
bodyStatements
->
next
&&
bodyStatements
->
next
->
next
&&
bodyStatements
->
next
->
next
->
statement
);
ExpressionAST
*
expr
=
bodyStatements
->
next
->
next
->
statement
->
asReturnStatement
()
->
expression
;
QVERIFY
(
bodyStatements
&&
bodyStatements
->
next
&&
bodyStatements
->
next
->
next
&&
bodyStatements
->
next
->
next
->
value
);
ExpressionAST
*
expr
=
bodyStatements
->
next
->
next
->
value
->
asReturnStatement
()
->
expression
;
QVERIFY
(
expr
);
CastExpressionAST
*
castExpr
=
expr
->
asCastExpression
();
...
...
@@ -643,10 +643,10 @@ void tst_AST::objc_msg_send_expression()
QVERIFY
(
func
);
StatementListAST
*
bodyStatements
=
func
->
function_body
->
asCompoundStatement
()
->
statements
;
QVERIFY
(
bodyStatements
&&
bodyStatements
->
next
&&
!
bodyStatements
->
next
->
next
&&
bodyStatements
->
next
->
statement
);
QVERIFY
(
bodyStatements
&&
bodyStatements
->
next
&&
!
bodyStatements
->
next
->
next
&&
bodyStatements
->
next
->
value
);
{
// check the NSObject declaration
DeclarationStatementAST
*
firstStatement
=
bodyStatements
->
statement
->
asDeclarationStatement
();
DeclarationStatementAST
*
firstStatement
=
bodyStatements
->
value
->
asDeclarationStatement
();
QVERIFY
(
firstStatement
);
DeclarationAST
*
objDecl
=
firstStatement
->
declaration
;
QVERIFY
(
objDecl
);
...
...
@@ -692,7 +692,7 @@ void tst_AST::objc_msg_send_expression()
}
{
// check the return statement
ExpressionAST
*
expr
=
bodyStatements
->
next
->
statement
->
asReturnStatement
()
->
expression
;
ExpressionAST
*
expr
=
bodyStatements
->
next
->
value
->
asReturnStatement
()
->
expression
;
QVERIFY
(
expr
);
ObjCMessageExpressionAST
*
msgExpr
=
expr
->
asObjCMessageExpression
();
...
...
@@ -729,9 +729,9 @@ void tst_AST::objc_msg_send_expression_without_selector()
StatementListAST
*
bodyStatements
=
func
->
function_body
->
asCompoundStatement
()
->
statements
;
QVERIFY
(
bodyStatements
&&
bodyStatements
->
next
);
QVERIFY
(
bodyStatements
->
next
->
statement
);
QVERIFY
(
bodyStatements
->
next
->
statement
->
asReturnStatement
());
QVERIFY
(
!
bodyStatements
->
next
->
statement
->
asReturnStatement
()
->
expression
);
QVERIFY
(
bodyStatements
->
next
->
value
);
QVERIFY
(
bodyStatements
->
next
->
value
->
asReturnStatement
());
QVERIFY
(
!
bodyStatements
->
next
->
value
->
asReturnStatement
()
->
expression
);
}
QTEST_APPLESS_MAIN
(
tst_AST
)
...
...
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