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
aff9a743
Commit
aff9a743
authored
Nov 10, 2009
by
Roberto Raggi
Browse files
Cleanup NewArrayDeclaratorAST
parent
73a4f297
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/AST.cpp
View file @
aff9a743
...
...
@@ -1175,10 +1175,8 @@ unsigned NewTypeIdAST::firstToken() const
unsigned
NewTypeIdAST
::
lastToken
()
const
{
for
(
NewArrayDeclaratorAST
*
it
=
new_array_declarators
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
lastToken
();
}
if
(
new_array_declarators
)
return
new_array_declarators
->
lastToken
();
for
(
PtrOperatorAST
*
it
=
ptr_operators
;
it
;
it
=
it
->
next
)
{
if
(
it
->
next
)
...
...
src/shared/cplusplus/AST.h
View file @
aff9a743
...
...
@@ -1333,7 +1333,6 @@ public:
unsigned
lbracket_token
;
ExpressionAST
*
expression
;
unsigned
rbracket_token
;
NewArrayDeclaratorAST
*
next
;
public:
virtual
NewArrayDeclaratorAST
*
asNewArrayDeclarator
()
{
return
this
;
}
...
...
@@ -1392,7 +1391,7 @@ class CPLUSPLUS_EXPORT NewTypeIdAST: public AST
public:
SpecifierAST
*
type_specifier
;
PtrOperatorAST
*
ptr_operators
;
NewArrayDeclaratorAST
*
new_array_declarators
;
NewArrayDeclarator
List
AST
*
new_array_declarators
;
public:
virtual
NewTypeIdAST
*
asNewTypeId
()
{
return
this
;
}
...
...
src/shared/cplusplus/ASTVisit.cpp
View file @
aff9a743
...
...
@@ -565,8 +565,7 @@ void NewTypeIdAST::accept0(ASTVisitor *visitor)
accept
(
it
,
visitor
);
for
(
PtrOperatorAST
*
it
=
ptr_operators
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
for
(
NewArrayDeclaratorAST
*
it
=
new_array_declarators
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
accept
(
new_array_declarators
,
visitor
);
}
visitor
->
endVisit
(
this
);
}
...
...
src/shared/cplusplus/ASTfwd.h
View file @
aff9a743
...
...
@@ -198,6 +198,7 @@ typedef List<DeclaratorAST *> DeclaratorListAST;
typedef
List
<
BaseSpecifierAST
*>
BaseSpecifierListAST
;
typedef
List
<
EnumeratorAST
*>
EnumeratorListAST
;
typedef
List
<
MemInitializerAST
*>
MemInitializerListAST
;
typedef
List
<
NewArrayDeclaratorAST
*>
NewArrayDeclaratorListAST
;
typedef
List
<
NameAST
*>
ObjCIdentifierListAST
;
typedef
List
<
ObjCMessageArgumentAST
*>
ObjCMessageArgumentListAST
;
...
...
src/shared/cplusplus/CheckExpression.cpp
View file @
aff9a743
...
...
@@ -207,8 +207,10 @@ bool CheckExpression::visit(NewExpressionAST *ast)
if
(
ast
->
new_type_id
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
new_type_id
->
type_specifier
,
_scope
);
for
(
NewArrayDeclaratorAST
*
it
=
ast
->
new_type_id
->
new_array_declarators
;
it
;
it
=
it
->
next
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
expression
,
_scope
);
for
(
NewArrayDeclaratorListAST
*
it
=
ast
->
new_type_id
->
new_array_declarators
;
it
;
it
=
it
->
next
)
{
if
(
NewArrayDeclaratorAST
*
declarator
=
it
->
value
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
declarator
->
expression
,
_scope
);
}
}
}
...
...
src/shared/cplusplus/Parser.cpp
View file @
aff9a743
...
...
@@ -3810,7 +3810,7 @@ bool Parser::parseNewTypeId(NewTypeIdAST *&node)
PtrOperatorAST
**
ptrop_it
=
&
ast
->
ptr_operators
;
while
(
parsePtrOperator
(
*
ptrop_it
))
ptrop_it
=
&
(
*
ptrop_it
)
->
next
;
NewArrayDeclaratorAST
**
it
=
&
ast
->
new_array_declarators
;
NewArrayDeclarator
List
AST
**
it
=
&
ast
->
new_array_declarators
;
while
(
parseNewArrayDeclarator
(
*
it
))
it
=
&
(
*
it
)
->
next
;
node
=
ast
;
...
...
@@ -3818,7 +3818,7 @@ bool Parser::parseNewTypeId(NewTypeIdAST *&node)
}
bool
Parser
::
parseNewArrayDeclarator
(
NewArrayDeclaratorAST
*&
node
)
bool
Parser
::
parseNewArrayDeclarator
(
NewArrayDeclarator
List
AST
*&
node
)
{
DEBUG_THIS_RULE
();
if
(
LA
()
!=
T_LBRACKET
)
...
...
@@ -3828,7 +3828,9 @@ bool Parser::parseNewArrayDeclarator(NewArrayDeclaratorAST *&node)
ast
->
lbracket_token
=
consumeToken
();
parseExpression
(
ast
->
expression
);
match
(
T_RBRACKET
,
&
ast
->
rbracket_token
);
node
=
ast
;
node
=
new
(
_pool
)
NewArrayDeclaratorListAST
;
node
->
value
=
ast
;
return
true
;
}
...
...
src/shared/cplusplus/Parser.h
View file @
aff9a743
...
...
@@ -146,7 +146,7 @@ public:
bool
parseNestedNameSpecifierOpt
(
NestedNameSpecifierAST
*&
name
,
bool
acceptTemplateId
);
bool
parseNamespace
(
DeclarationAST
*&
node
);
bool
parseNamespaceAliasDefinition
(
DeclarationAST
*&
node
);
bool
parseNewArrayDeclarator
(
NewArrayDeclaratorAST
*&
node
);
bool
parseNewArrayDeclarator
(
NewArrayDeclarator
List
AST
*&
node
);
bool
parseNewExpression
(
ExpressionAST
*&
node
);
bool
parseNewPlacement
(
NewPlacementAST
*&
node
);
bool
parseNewInitializer
(
NewInitializerAST
*&
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