forked from qt-creator/qt-creator
Get rid of PostfixExpressionAST and store the base expression together with the PostfixAST nodes.
This commit is contained in:
@@ -287,6 +287,9 @@ unsigned QtInterfacesDeclarationAST::lastToken() const
|
||||
|
||||
unsigned ArrayAccessAST::firstToken() const
|
||||
{
|
||||
if (base_expression)
|
||||
return base_expression->firstToken();
|
||||
|
||||
return lbracket_token;
|
||||
}
|
||||
|
||||
@@ -296,7 +299,9 @@ unsigned ArrayAccessAST::lastToken() const
|
||||
return rbracket_token + 1;
|
||||
else if (expression)
|
||||
return expression->lastToken();
|
||||
return lbracket_token + 1;
|
||||
if (lbracket_token)
|
||||
return lbracket_token + 1;
|
||||
return base_expression->lastToken();
|
||||
}
|
||||
|
||||
|
||||
@@ -474,6 +479,9 @@ unsigned BreakStatementAST::lastToken() const
|
||||
|
||||
unsigned CallAST::firstToken() const
|
||||
{
|
||||
if (base_expression)
|
||||
return base_expression->firstToken();
|
||||
|
||||
return lparen_token;
|
||||
}
|
||||
|
||||
@@ -485,7 +493,10 @@ unsigned CallAST::lastToken() const
|
||||
else if (expression_list)
|
||||
return expression_list->lastToken();
|
||||
|
||||
return lparen_token + 1;
|
||||
if (lparen_token)
|
||||
return lparen_token + 1;
|
||||
|
||||
return base_expression->lastToken();
|
||||
}
|
||||
|
||||
|
||||
@@ -1183,6 +1194,8 @@ unsigned MemInitializerAST::lastToken() const
|
||||
|
||||
unsigned MemberAccessAST::firstToken() const
|
||||
{
|
||||
if (base_expression)
|
||||
return base_expression->firstToken();
|
||||
return access_token;
|
||||
}
|
||||
|
||||
@@ -1192,7 +1205,9 @@ unsigned MemberAccessAST::lastToken() const
|
||||
return member_name->lastToken();
|
||||
else if (template_token)
|
||||
return template_token + 1;
|
||||
return access_token + 1;
|
||||
else if (access_token)
|
||||
return access_token + 1;
|
||||
return base_expression->lastToken();
|
||||
}
|
||||
|
||||
|
||||
@@ -1488,24 +1503,15 @@ unsigned PointerToMemberAST::lastToken() const
|
||||
|
||||
unsigned PostIncrDecrAST::firstToken() const
|
||||
{
|
||||
if (base_expression)
|
||||
return base_expression->firstToken();
|
||||
return incr_decr_token;
|
||||
}
|
||||
|
||||
unsigned PostIncrDecrAST::lastToken() const
|
||||
{
|
||||
return incr_decr_token + 1;
|
||||
}
|
||||
|
||||
|
||||
unsigned PostfixExpressionAST::firstToken() const
|
||||
{
|
||||
return base_expression->firstToken();
|
||||
}
|
||||
|
||||
unsigned PostfixExpressionAST::lastToken() const
|
||||
{
|
||||
if (postfix_expression_list)
|
||||
return postfix_expression_list->lastToken();
|
||||
if (incr_decr_token)
|
||||
return incr_decr_token + 1;
|
||||
return base_expression->lastToken();
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,6 @@ public:
|
||||
virtual PostIncrDecrAST *asPostIncrDecr() { return 0; }
|
||||
virtual PostfixAST *asPostfix() { return 0; }
|
||||
virtual PostfixDeclaratorAST *asPostfixDeclarator() { return 0; }
|
||||
virtual PostfixExpressionAST *asPostfixExpression() { return 0; }
|
||||
virtual PtrOperatorAST *asPtrOperator() { return 0; }
|
||||
virtual QtEnumDeclarationAST *asQtEnumDeclaration() { return 0; }
|
||||
virtual QtFlagsDeclarationAST *asQtFlagsDeclaration() { return 0; }
|
||||
@@ -375,7 +374,7 @@ public:
|
||||
virtual PtrOperatorAST *clone(MemoryPool *pool) const = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PostfixAST: public AST
|
||||
class CPLUSPLUS_EXPORT PostfixAST: public ExpressionAST
|
||||
{
|
||||
public:
|
||||
PostfixAST()
|
||||
@@ -2503,13 +2502,15 @@ protected:
|
||||
class CPLUSPLUS_EXPORT CallAST: public PostfixAST
|
||||
{
|
||||
public:
|
||||
ExpressionAST *base_expression;
|
||||
unsigned lparen_token;
|
||||
ExpressionListAST *expression_list;
|
||||
unsigned rparen_token;
|
||||
|
||||
public:
|
||||
CallAST()
|
||||
: lparen_token(0)
|
||||
: base_expression(0)
|
||||
, lparen_token(0)
|
||||
, expression_list(0)
|
||||
, rparen_token(0)
|
||||
{}
|
||||
@@ -2529,13 +2530,15 @@ protected:
|
||||
class CPLUSPLUS_EXPORT ArrayAccessAST: public PostfixAST
|
||||
{
|
||||
public:
|
||||
ExpressionAST *base_expression;
|
||||
unsigned lbracket_token;
|
||||
ExpressionAST *expression;
|
||||
unsigned rbracket_token;
|
||||
|
||||
public:
|
||||
ArrayAccessAST()
|
||||
: lbracket_token(0)
|
||||
: base_expression(0)
|
||||
, lbracket_token(0)
|
||||
, expression(0)
|
||||
, rbracket_token(0)
|
||||
{}
|
||||
@@ -2555,11 +2558,13 @@ protected:
|
||||
class CPLUSPLUS_EXPORT PostIncrDecrAST: public PostfixAST
|
||||
{
|
||||
public:
|
||||
ExpressionAST *base_expression;
|
||||
unsigned incr_decr_token;
|
||||
|
||||
public:
|
||||
PostIncrDecrAST()
|
||||
: incr_decr_token(0)
|
||||
: base_expression(0)
|
||||
, incr_decr_token(0)
|
||||
{}
|
||||
|
||||
virtual PostIncrDecrAST *asPostIncrDecr() { return this; }
|
||||
@@ -2577,13 +2582,15 @@ protected:
|
||||
class CPLUSPLUS_EXPORT MemberAccessAST: public PostfixAST
|
||||
{
|
||||
public:
|
||||
ExpressionAST *base_expression;
|
||||
unsigned access_token;
|
||||
unsigned template_token;
|
||||
NameAST *member_name;
|
||||
|
||||
public:
|
||||
MemberAccessAST()
|
||||
: access_token(0)
|
||||
: base_expression(0)
|
||||
, access_token(0)
|
||||
, template_token(0)
|
||||
, member_name(0)
|
||||
{}
|
||||
@@ -2686,30 +2693,6 @@ protected:
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PostfixExpressionAST: public ExpressionAST
|
||||
{
|
||||
public:
|
||||
ExpressionAST *base_expression;
|
||||
PostfixListAST *postfix_expression_list;
|
||||
|
||||
public:
|
||||
PostfixExpressionAST()
|
||||
: base_expression(0)
|
||||
, postfix_expression_list(0)
|
||||
{}
|
||||
|
||||
virtual PostfixExpressionAST *asPostfixExpression() { return this; }
|
||||
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual PostfixExpressionAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PointerToMemberAST: public PtrOperatorAST
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -928,6 +928,8 @@ ParameterDeclarationClauseAST *ParameterDeclarationClauseAST::clone(MemoryPool *
|
||||
CallAST *CallAST::clone(MemoryPool *pool) const
|
||||
{
|
||||
CallAST *ast = new (pool) CallAST;
|
||||
if (base_expression)
|
||||
ast->base_expression = base_expression->clone(pool);
|
||||
ast->lparen_token = lparen_token;
|
||||
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
|
||||
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
|
||||
@@ -939,6 +941,8 @@ CallAST *CallAST::clone(MemoryPool *pool) const
|
||||
ArrayAccessAST *ArrayAccessAST::clone(MemoryPool *pool) const
|
||||
{
|
||||
ArrayAccessAST *ast = new (pool) ArrayAccessAST;
|
||||
if (base_expression)
|
||||
ast->base_expression = base_expression->clone(pool);
|
||||
ast->lbracket_token = lbracket_token;
|
||||
if (expression)
|
||||
ast->expression = expression->clone(pool);
|
||||
@@ -949,6 +953,8 @@ ArrayAccessAST *ArrayAccessAST::clone(MemoryPool *pool) const
|
||||
PostIncrDecrAST *PostIncrDecrAST::clone(MemoryPool *pool) const
|
||||
{
|
||||
PostIncrDecrAST *ast = new (pool) PostIncrDecrAST;
|
||||
if (base_expression)
|
||||
ast->base_expression = base_expression->clone(pool);
|
||||
ast->incr_decr_token = incr_decr_token;
|
||||
return ast;
|
||||
}
|
||||
@@ -956,6 +962,8 @@ PostIncrDecrAST *PostIncrDecrAST::clone(MemoryPool *pool) const
|
||||
MemberAccessAST *MemberAccessAST::clone(MemoryPool *pool) const
|
||||
{
|
||||
MemberAccessAST *ast = new (pool) MemberAccessAST;
|
||||
if (base_expression)
|
||||
ast->base_expression = base_expression->clone(pool);
|
||||
ast->access_token = access_token;
|
||||
ast->template_token = template_token;
|
||||
if (member_name)
|
||||
@@ -1002,17 +1010,6 @@ TypeConstructorCallAST *TypeConstructorCallAST::clone(MemoryPool *pool) const
|
||||
return ast;
|
||||
}
|
||||
|
||||
PostfixExpressionAST *PostfixExpressionAST::clone(MemoryPool *pool) const
|
||||
{
|
||||
PostfixExpressionAST *ast = new (pool) PostfixExpressionAST;
|
||||
if (base_expression)
|
||||
ast->base_expression = base_expression->clone(pool);
|
||||
for (PostfixListAST *iter = postfix_expression_list, **ast_iter = &ast->postfix_expression_list;
|
||||
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
|
||||
*ast_iter = new (pool) PostfixListAST((iter->value) ? iter->value->clone(pool) : 0);
|
||||
return ast;
|
||||
}
|
||||
|
||||
PointerToMemberAST *PointerToMemberAST::clone(MemoryPool *pool) const
|
||||
{
|
||||
PointerToMemberAST *ast = new (pool) PointerToMemberAST;
|
||||
|
||||
@@ -689,14 +689,6 @@ bool TypeConstructorCallAST::match0(AST *pattern, ASTMatcher *matcher)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PostfixExpressionAST::match0(AST *pattern, ASTMatcher *matcher)
|
||||
{
|
||||
if (PostfixExpressionAST *_other = pattern->asPostfixExpression())
|
||||
return matcher->match(this, _other);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PointerToMemberAST::match0(AST *pattern, ASTMatcher *matcher)
|
||||
{
|
||||
if (PointerToMemberAST *_other = pattern->asPointerToMember())
|
||||
|
||||
@@ -1560,6 +1560,11 @@ bool ASTMatcher::match(CallAST *node, CallAST *pattern)
|
||||
(void) node;
|
||||
(void) pattern;
|
||||
|
||||
if (! pattern->base_expression)
|
||||
pattern->base_expression = node->base_expression;
|
||||
else if (! AST::match(node->base_expression, pattern->base_expression, this))
|
||||
return false;
|
||||
|
||||
pattern->lparen_token = node->lparen_token;
|
||||
|
||||
if (! pattern->expression_list)
|
||||
@@ -1577,6 +1582,11 @@ bool ASTMatcher::match(ArrayAccessAST *node, ArrayAccessAST *pattern)
|
||||
(void) node;
|
||||
(void) pattern;
|
||||
|
||||
if (! pattern->base_expression)
|
||||
pattern->base_expression = node->base_expression;
|
||||
else if (! AST::match(node->base_expression, pattern->base_expression, this))
|
||||
return false;
|
||||
|
||||
pattern->lbracket_token = node->lbracket_token;
|
||||
|
||||
if (! pattern->expression)
|
||||
@@ -1594,6 +1604,11 @@ bool ASTMatcher::match(PostIncrDecrAST *node, PostIncrDecrAST *pattern)
|
||||
(void) node;
|
||||
(void) pattern;
|
||||
|
||||
if (! pattern->base_expression)
|
||||
pattern->base_expression = node->base_expression;
|
||||
else if (! AST::match(node->base_expression, pattern->base_expression, this))
|
||||
return false;
|
||||
|
||||
pattern->incr_decr_token = node->incr_decr_token;
|
||||
|
||||
return true;
|
||||
@@ -1604,6 +1619,11 @@ bool ASTMatcher::match(MemberAccessAST *node, MemberAccessAST *pattern)
|
||||
(void) node;
|
||||
(void) pattern;
|
||||
|
||||
if (! pattern->base_expression)
|
||||
pattern->base_expression = node->base_expression;
|
||||
else if (! AST::match(node->base_expression, pattern->base_expression, this))
|
||||
return false;
|
||||
|
||||
pattern->access_token = node->access_token;
|
||||
|
||||
pattern->template_token = node->template_token;
|
||||
@@ -1681,24 +1701,6 @@ bool ASTMatcher::match(TypeConstructorCallAST *node, TypeConstructorCallAST *pat
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(PostfixExpressionAST *node, PostfixExpressionAST *pattern)
|
||||
{
|
||||
(void) node;
|
||||
(void) pattern;
|
||||
|
||||
if (! pattern->base_expression)
|
||||
pattern->base_expression = node->base_expression;
|
||||
else if (! AST::match(node->base_expression, pattern->base_expression, this))
|
||||
return false;
|
||||
|
||||
if (! pattern->postfix_expression_list)
|
||||
pattern->postfix_expression_list = node->postfix_expression_list;
|
||||
else if (! AST::match(node->postfix_expression_list, pattern->postfix_expression_list, this))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(PointerToMemberAST *node, PointerToMemberAST *pattern)
|
||||
{
|
||||
(void) node;
|
||||
|
||||
@@ -115,7 +115,6 @@ public:
|
||||
virtual bool match(PointerAST *node, PointerAST *pattern);
|
||||
virtual bool match(PointerToMemberAST *node, PointerToMemberAST *pattern);
|
||||
virtual bool match(PostIncrDecrAST *node, PostIncrDecrAST *pattern);
|
||||
virtual bool match(PostfixExpressionAST *node, PostfixExpressionAST *pattern);
|
||||
virtual bool match(QualifiedNameAST *node, QualifiedNameAST *pattern);
|
||||
virtual bool match(ReferenceAST *node, ReferenceAST *pattern);
|
||||
virtual bool match(ReturnStatementAST *node, ReturnStatementAST *pattern);
|
||||
|
||||
@@ -531,13 +531,6 @@ public:
|
||||
return __ast;
|
||||
}
|
||||
|
||||
PostfixExpressionAST *PostfixExpression(ExpressionAST *base_expression = 0)
|
||||
{
|
||||
PostfixExpressionAST *__ast = new (&pool) PostfixExpressionAST;
|
||||
__ast->base_expression = base_expression;
|
||||
return __ast;
|
||||
}
|
||||
|
||||
PointerToMemberAST *PointerToMember()
|
||||
{
|
||||
PointerToMemberAST *__ast = new (&pool) PointerToMemberAST;
|
||||
|
||||
@@ -680,6 +680,7 @@ void ParameterDeclarationClauseAST::accept0(ASTVisitor *visitor)
|
||||
void CallAST::accept0(ASTVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
accept(base_expression, visitor);
|
||||
accept(expression_list, visitor);
|
||||
}
|
||||
visitor->endVisit(this);
|
||||
@@ -688,6 +689,7 @@ void CallAST::accept0(ASTVisitor *visitor)
|
||||
void ArrayAccessAST::accept0(ASTVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
accept(base_expression, visitor);
|
||||
accept(expression, visitor);
|
||||
}
|
||||
visitor->endVisit(this);
|
||||
@@ -696,6 +698,7 @@ void ArrayAccessAST::accept0(ASTVisitor *visitor)
|
||||
void PostIncrDecrAST::accept0(ASTVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
accept(base_expression, visitor);
|
||||
}
|
||||
visitor->endVisit(this);
|
||||
}
|
||||
@@ -703,6 +706,7 @@ void PostIncrDecrAST::accept0(ASTVisitor *visitor)
|
||||
void MemberAccessAST::accept0(ASTVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
accept(base_expression, visitor);
|
||||
accept(member_name, visitor);
|
||||
}
|
||||
visitor->endVisit(this);
|
||||
@@ -734,15 +738,6 @@ void TypeConstructorCallAST::accept0(ASTVisitor *visitor)
|
||||
visitor->endVisit(this);
|
||||
}
|
||||
|
||||
void PostfixExpressionAST::accept0(ASTVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
accept(base_expression, visitor);
|
||||
accept(postfix_expression_list, visitor);
|
||||
}
|
||||
visitor->endVisit(this);
|
||||
}
|
||||
|
||||
void PointerToMemberAST::accept0(ASTVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
|
||||
@@ -176,7 +176,6 @@ public:
|
||||
virtual bool visit(PointerAST *) { return true; }
|
||||
virtual bool visit(PointerToMemberAST *) { return true; }
|
||||
virtual bool visit(PostIncrDecrAST *) { return true; }
|
||||
virtual bool visit(PostfixExpressionAST *) { return true; }
|
||||
virtual bool visit(QualifiedNameAST *) { return true; }
|
||||
virtual bool visit(ReferenceAST *) { return true; }
|
||||
virtual bool visit(ReturnStatementAST *) { return true; }
|
||||
@@ -319,7 +318,6 @@ public:
|
||||
virtual void endVisit(PointerAST *) { }
|
||||
virtual void endVisit(PointerToMemberAST *) { }
|
||||
virtual void endVisit(PostIncrDecrAST *) { }
|
||||
virtual void endVisit(PostfixExpressionAST *) { }
|
||||
virtual void endVisit(QualifiedNameAST *) { }
|
||||
virtual void endVisit(ReferenceAST *) { }
|
||||
virtual void endVisit(ReturnStatementAST *) { }
|
||||
|
||||
@@ -165,7 +165,6 @@ class PointerToMemberAST;
|
||||
class PostIncrDecrAST;
|
||||
class PostfixAST;
|
||||
class PostfixDeclaratorAST;
|
||||
class PostfixExpressionAST;
|
||||
class PtrOperatorAST;
|
||||
class QtEnumDeclarationAST;
|
||||
class QtFlagsDeclarationAST;
|
||||
|
||||
@@ -248,15 +248,6 @@ bool CheckExpression::visit(TypeConstructorCallAST *ast)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckExpression::visit(PostfixExpressionAST *ast)
|
||||
{
|
||||
FullySpecifiedType exprTy = semantic()->check(ast->base_expression, _scope);
|
||||
for (PostfixListAST *it = ast->postfix_expression_list; it; it = it->next) {
|
||||
accept(it->value); // ### not exactly.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckExpression::visit(SizeofExpressionAST *ast)
|
||||
{
|
||||
FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
|
||||
@@ -348,6 +339,7 @@ bool CheckExpression::visit(CompoundLiteralAST *ast)
|
||||
|
||||
bool CheckExpression::visit(CallAST *ast)
|
||||
{
|
||||
FullySpecifiedType baseTy = semantic()->check(ast->base_expression, _scope);
|
||||
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
|
||||
FullySpecifiedType exprTy = semantic()->check(it->value, _scope);
|
||||
}
|
||||
@@ -356,18 +348,22 @@ bool CheckExpression::visit(CallAST *ast)
|
||||
|
||||
bool CheckExpression::visit(ArrayAccessAST *ast)
|
||||
{
|
||||
FullySpecifiedType baseTy = semantic()->check(ast->base_expression, _scope);
|
||||
FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckExpression::visit(PostIncrDecrAST *)
|
||||
bool CheckExpression::visit(PostIncrDecrAST *ast)
|
||||
{
|
||||
FullySpecifiedType baseTy = semantic()->check(ast->base_expression, _scope);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckExpression::visit(MemberAccessAST *ast)
|
||||
{
|
||||
(void) semantic()->check(ast->member_name, _scope);
|
||||
FullySpecifiedType baseTy = semantic()->check(ast->base_expression, _scope);
|
||||
const Name *memberName = semantic()->check(ast->member_name, _scope);
|
||||
(void) memberName;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,6 @@ protected:
|
||||
virtual bool visit(TypeidExpressionAST *ast);
|
||||
virtual bool visit(TypenameCallExpressionAST *ast);
|
||||
virtual bool visit(TypeConstructorCallAST *ast);
|
||||
virtual bool visit(PostfixExpressionAST *ast);
|
||||
virtual bool visit(SizeofExpressionAST *ast);
|
||||
virtual bool visit(NumericLiteralAST *ast);
|
||||
virtual bool visit(BoolLiteralAST *ast);
|
||||
|
||||
@@ -4325,28 +4325,26 @@ bool Parser::parsePostfixExpression(ExpressionAST *&node)
|
||||
{
|
||||
DEBUG_THIS_RULE();
|
||||
if (parseCorePostfixExpression(node)) {
|
||||
PostfixListAST *postfix_expressions = 0,
|
||||
**postfix_ptr = &postfix_expressions;
|
||||
while (LA()) {
|
||||
if (LA() == T_LPAREN) {
|
||||
CallAST *ast = new (_pool) CallAST;
|
||||
ast->lparen_token = consumeToken();
|
||||
parseExpressionList(ast->expression_list);
|
||||
match(T_RPAREN, &ast->rparen_token);
|
||||
*postfix_ptr = new (_pool) PostfixListAST(ast);
|
||||
postfix_ptr = &(*postfix_ptr)->next;
|
||||
ast->base_expression = node;
|
||||
node = ast;
|
||||
} else if (LA() == T_LBRACKET) {
|
||||
ArrayAccessAST *ast = new (_pool) ArrayAccessAST;
|
||||
ast->lbracket_token = consumeToken();
|
||||
parseExpression(ast->expression);
|
||||
match(T_RBRACKET, &ast->rbracket_token);
|
||||
*postfix_ptr = new (_pool) PostfixListAST(ast);
|
||||
postfix_ptr = &(*postfix_ptr)->next;
|
||||
ast->base_expression = node;
|
||||
node = ast;
|
||||
} else if (LA() == T_PLUS_PLUS || LA() == T_MINUS_MINUS) {
|
||||
PostIncrDecrAST *ast = new (_pool) PostIncrDecrAST;
|
||||
ast->incr_decr_token = consumeToken();
|
||||
*postfix_ptr = new (_pool) PostfixListAST(ast);
|
||||
postfix_ptr = &(*postfix_ptr)->next;
|
||||
ast->base_expression = node;
|
||||
node = ast;
|
||||
} else if (LA() == T_DOT || LA() == T_ARROW) {
|
||||
MemberAccessAST *ast = new (_pool) MemberAccessAST;
|
||||
ast->access_token = consumeToken();
|
||||
@@ -4355,17 +4353,11 @@ bool Parser::parsePostfixExpression(ExpressionAST *&node)
|
||||
if (! parseNameId(ast->member_name))
|
||||
_translationUnit->error(cursor(), "expected unqualified-id before token `%s'",
|
||||
tok().spell());
|
||||
*postfix_ptr = new (_pool) PostfixListAST(ast);
|
||||
postfix_ptr = &(*postfix_ptr)->next;
|
||||
ast->base_expression = node;
|
||||
node = ast;
|
||||
} else break;
|
||||
} // while
|
||||
|
||||
if (postfix_expressions) {
|
||||
PostfixExpressionAST *ast = new (_pool) PostfixExpressionAST;
|
||||
ast->base_expression = node;
|
||||
ast->postfix_expression_list = postfix_expressions;
|
||||
node = ast;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user