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:
@@ -194,27 +194,12 @@ bool FindUsages::visit(MemInitializerAST *ast)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindUsages::visit(PostfixExpressionAST *ast)
|
|
||||||
{
|
|
||||||
_postfixExpressionStack.append(ast);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FindUsages::endVisit(PostfixExpressionAST *)
|
|
||||||
{
|
|
||||||
_postfixExpressionStack.removeLast();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FindUsages::visit(MemberAccessAST *ast)
|
bool FindUsages::visit(MemberAccessAST *ast)
|
||||||
{
|
{
|
||||||
if (ast->member_name) {
|
if (ast->member_name) {
|
||||||
if (SimpleNameAST *simple = ast->member_name->asSimpleName()) {
|
if (SimpleNameAST *simple = ast->member_name->asSimpleName()) {
|
||||||
if (identifier(simple->identifier_token) == _id) {
|
if (identifier(simple->identifier_token) == _id) {
|
||||||
Q_ASSERT(! _postfixExpressionStack.isEmpty());
|
checkExpression(ast->firstToken(), simple->identifier_token);
|
||||||
|
|
||||||
checkExpression(_postfixExpressionStack.last()->firstToken(),
|
|
||||||
simple->identifier_token);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,8 +83,6 @@ protected:
|
|||||||
void ensureNameIsValid(NameAST *ast);
|
void ensureNameIsValid(NameAST *ast);
|
||||||
|
|
||||||
virtual bool visit(MemInitializerAST *ast);
|
virtual bool visit(MemInitializerAST *ast);
|
||||||
virtual bool visit(PostfixExpressionAST *ast);
|
|
||||||
virtual void endVisit(PostfixExpressionAST *);
|
|
||||||
virtual bool visit(MemberAccessAST *ast);
|
virtual bool visit(MemberAccessAST *ast);
|
||||||
virtual bool visit(QualifiedNameAST *ast);
|
virtual bool visit(QualifiedNameAST *ast);
|
||||||
virtual bool visit(EnumeratorAST *ast);
|
virtual bool visit(EnumeratorAST *ast);
|
||||||
@@ -116,7 +114,6 @@ private:
|
|||||||
QByteArray _source;
|
QByteArray _source;
|
||||||
Document::Ptr _exprDoc;
|
Document::Ptr _exprDoc;
|
||||||
Semantic _sem;
|
Semantic _sem;
|
||||||
QList<PostfixExpressionAST *> _postfixExpressionStack;
|
|
||||||
QList<QualifiedNameAST *> _qualifiedNameStack;
|
QList<QualifiedNameAST *> _qualifiedNameStack;
|
||||||
QList<TemplateDeclarationAST *> _templateDeclarationStack;
|
QList<TemplateDeclarationAST *> _templateDeclarationStack;
|
||||||
QList<int> _references;
|
QList<int> _references;
|
||||||
|
|||||||
@@ -244,16 +244,6 @@ bool ResolveExpression::visit(TypeConstructorCallAST *)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ResolveExpression::visit(PostfixExpressionAST *ast)
|
|
||||||
{
|
|
||||||
accept(ast->base_expression);
|
|
||||||
|
|
||||||
for (PostfixListAST *it = ast->postfix_expression_list; it; it = it->next)
|
|
||||||
accept(it->value);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ResolveExpression::visit(SizeofExpressionAST *)
|
bool ResolveExpression::visit(SizeofExpressionAST *)
|
||||||
{
|
{
|
||||||
FullySpecifiedType ty(control()->integerType(IntegerType::Int));
|
FullySpecifiedType ty(control()->integerType(IntegerType::Int));
|
||||||
@@ -468,8 +458,7 @@ bool ResolveExpression::maybeValidPrototype(Function *funTy, unsigned actualArgu
|
|||||||
|
|
||||||
bool ResolveExpression::visit(CallAST *ast)
|
bool ResolveExpression::visit(CallAST *ast)
|
||||||
{
|
{
|
||||||
const QList<LookupItem> baseResults = _results;
|
const QList<LookupItem> baseResults = resolve(ast->base_expression, _scope);
|
||||||
_results.clear();
|
|
||||||
|
|
||||||
// Compute the types of the actual arguments.
|
// Compute the types of the actual arguments.
|
||||||
int actualArgumentCount = 0;
|
int actualArgumentCount = 0;
|
||||||
@@ -514,9 +503,7 @@ bool ResolveExpression::visit(CallAST *ast)
|
|||||||
|
|
||||||
bool ResolveExpression::visit(ArrayAccessAST *ast)
|
bool ResolveExpression::visit(ArrayAccessAST *ast)
|
||||||
{
|
{
|
||||||
const QList<LookupItem> baseResults = _results;
|
const QList<LookupItem> baseResults = resolve(ast->base_expression, _scope);
|
||||||
_results.clear();
|
|
||||||
|
|
||||||
const QList<LookupItem> indexResults = resolve(ast->expression);
|
const QList<LookupItem> indexResults = resolve(ast->expression);
|
||||||
|
|
||||||
const Name *arrayAccessOp = control()->operatorNameId(OperatorNameId::ArrayAccessOp);
|
const Name *arrayAccessOp = control()->operatorNameId(OperatorNameId::ArrayAccessOp);
|
||||||
@@ -551,8 +538,7 @@ bool ResolveExpression::visit(MemberAccessAST *ast)
|
|||||||
{
|
{
|
||||||
// The candidate types for the base expression are stored in
|
// The candidate types for the base expression are stored in
|
||||||
// _results.
|
// _results.
|
||||||
const QList<LookupItem> baseResults = _results;
|
const QList<LookupItem> baseResults = resolve(ast->base_expression, _scope);
|
||||||
_results.clear();
|
|
||||||
|
|
||||||
// Evaluate the expression-id that follows the access operator.
|
// Evaluate the expression-id that follows the access operator.
|
||||||
const Name *memberName = 0;
|
const Name *memberName = 0;
|
||||||
@@ -644,8 +630,10 @@ FullySpecifiedType ResolveExpression::instantiate(const Name *className, Symbol
|
|||||||
return DeprecatedGenTemplateInstance::instantiate(className, candidate, _context.control());
|
return DeprecatedGenTemplateInstance::instantiate(className, candidate, _context.control());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ResolveExpression::visit(PostIncrDecrAST *)
|
bool ResolveExpression::visit(PostIncrDecrAST *ast)
|
||||||
{
|
{
|
||||||
|
const QList<LookupItem> baseResults = resolve(ast->base_expression, _scope);
|
||||||
|
_results = baseResults;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ protected:
|
|||||||
virtual bool visit(TypeidExpressionAST *ast);
|
virtual bool visit(TypeidExpressionAST *ast);
|
||||||
virtual bool visit(TypenameCallExpressionAST *ast);
|
virtual bool visit(TypenameCallExpressionAST *ast);
|
||||||
virtual bool visit(TypeConstructorCallAST *ast);
|
virtual bool visit(TypeConstructorCallAST *ast);
|
||||||
virtual bool visit(PostfixExpressionAST *ast);
|
|
||||||
virtual bool visit(SizeofExpressionAST *ast);
|
virtual bool visit(SizeofExpressionAST *ast);
|
||||||
virtual bool visit(NumericLiteralAST *ast);
|
virtual bool visit(NumericLiteralAST *ast);
|
||||||
virtual bool visit(BoolLiteralAST *ast);
|
virtual bool visit(BoolLiteralAST *ast);
|
||||||
|
|||||||
@@ -346,15 +346,11 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool visit(PostfixExpressionAST *ast)
|
virtual bool visit(MemberAccessAST *ast)
|
||||||
{
|
{
|
||||||
|
// accept only the base expression
|
||||||
accept(ast->base_expression);
|
accept(ast->base_expression);
|
||||||
for (PostfixListAST *it = ast->postfix_expression_list; it; it = it->next) {
|
// and ignore the member name.
|
||||||
PostfixAST *fx = it->value;
|
|
||||||
if (fx->asMemberAccess() != 0)
|
|
||||||
continue; // skip members
|
|
||||||
accept(fx);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -783,40 +783,32 @@ public:
|
|||||||
|
|
||||||
virtual int match(const QList<AST *> &path)
|
virtual int match(const QList<AST *> &path)
|
||||||
{
|
{
|
||||||
|
stringLiteral = 0;
|
||||||
|
isObjCStringLiteral = false;
|
||||||
|
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
|
return -1; // nothing to do
|
||||||
|
|
||||||
|
stringLiteral = path.last()->asStringLiteral();
|
||||||
|
|
||||||
|
if (! stringLiteral)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int index = path.size() - 1;
|
else if (path.size() > 1) {
|
||||||
stringLiteral = path[index]->asStringLiteral();
|
if (CallAST *call = path.at(path.size() - 2)->asCall()) {
|
||||||
|
if (call->base_expression) {
|
||||||
|
if (SimpleNameAST *functionName = call->base_expression->asSimpleName()) {
|
||||||
|
const QByteArray id(tokenAt(functionName->identifier_token).identifier->chars());
|
||||||
|
|
||||||
if (!stringLiteral)
|
if (id == "QLatin1String" || id == "QLatin1Literal")
|
||||||
return -1;
|
return -1; // skip it
|
||||||
|
}
|
||||||
isObjCStringLiteral = charAt(startOf(stringLiteral)) == QLatin1Char('@');
|
}
|
||||||
|
}
|
||||||
// check if it is already wrapped in QLatin1String or -Literal
|
|
||||||
if (index-2 < 0)
|
|
||||||
return index;
|
|
||||||
|
|
||||||
CallAST *call = path[index-1]->asCall();
|
|
||||||
PostfixExpressionAST *postfixExp = path[index-2]->asPostfixExpression();
|
|
||||||
if (call && postfixExp
|
|
||||||
&& postfixExp->base_expression
|
|
||||||
&& postfixExp->postfix_expression_list
|
|
||||||
&& postfixExp->postfix_expression_list->value == call)
|
|
||||||
{
|
|
||||||
NameAST *callName = postfixExp->base_expression->asName();
|
|
||||||
if (!callName)
|
|
||||||
return index;
|
|
||||||
|
|
||||||
QByteArray callNameString(tokenAt(callName->firstToken()).spell());
|
|
||||||
if (callNameString == "QLatin1String"
|
|
||||||
|| callNameString == "QLatin1Literal"
|
|
||||||
)
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return index;
|
isObjCStringLiteral = charAt(startOf(stringLiteral)) == QLatin1Char('@');
|
||||||
|
return path.size() - 1; // very high priority
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void createChanges()
|
virtual void createChanges()
|
||||||
@@ -845,7 +837,9 @@ class CStringToNSString: public CppQuickFixOperation
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CStringToNSString(TextEditor::BaseTextEditor *editor)
|
CStringToNSString(TextEditor::BaseTextEditor *editor)
|
||||||
: CppQuickFixOperation(editor), stringLiteral(0), qlatin1Call(0)
|
: CppQuickFixOperation(editor)
|
||||||
|
, stringLiteral(0)
|
||||||
|
, qlatin1Call(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual QString description() const
|
virtual QString description() const
|
||||||
@@ -855,43 +849,34 @@ public:
|
|||||||
|
|
||||||
virtual int match(const QList<AST *> &path)
|
virtual int match(const QList<AST *> &path)
|
||||||
{
|
{
|
||||||
|
stringLiteral = 0;
|
||||||
|
qlatin1Call = 0;
|
||||||
|
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
|
return -1; // nothing to do
|
||||||
|
|
||||||
|
stringLiteral = path.last()->asStringLiteral();
|
||||||
|
|
||||||
|
if (! stringLiteral)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int index = path.size() - 1;
|
else if (charAt(startOf(stringLiteral)) == QLatin1Char('@'))
|
||||||
stringLiteral = path[index]->asStringLiteral();
|
return -1; // it's already an objc string literal.
|
||||||
|
|
||||||
if (!stringLiteral)
|
else if (path.size() > 1) {
|
||||||
return -1;
|
if (CallAST *call = path.at(path.size() - 2)->asCall()) {
|
||||||
|
if (call->base_expression) {
|
||||||
|
if (SimpleNameAST *functionName = call->base_expression->asSimpleName()) {
|
||||||
|
const QByteArray id(tokenAt(functionName->identifier_token).identifier->chars());
|
||||||
|
|
||||||
if (charAt(startOf(stringLiteral)) == QLatin1Char('@'))
|
if (id == "QLatin1String" || id == "QLatin1Literal")
|
||||||
return -1;
|
qlatin1Call = call;
|
||||||
|
}
|
||||||
// check if it is already wrapped in QLatin1String or -Literal
|
}
|
||||||
if (index-2 < 0)
|
|
||||||
return index;
|
|
||||||
|
|
||||||
CallAST *call = path[index-1]->asCall();
|
|
||||||
PostfixExpressionAST *postfixExp = path[index-2]->asPostfixExpression();
|
|
||||||
if (call && postfixExp
|
|
||||||
&& postfixExp->base_expression
|
|
||||||
&& postfixExp->postfix_expression_list
|
|
||||||
&& postfixExp->postfix_expression_list->value == call)
|
|
||||||
{
|
|
||||||
NameAST *callName = postfixExp->base_expression->asName();
|
|
||||||
if (!callName)
|
|
||||||
return index;
|
|
||||||
|
|
||||||
if (!(postfixExp->postfix_expression_list->next)) {
|
|
||||||
QByteArray callNameString(tokenAt(callName->firstToken()).spell());
|
|
||||||
if (callNameString == "QLatin1String"
|
|
||||||
|| callNameString == "QLatin1Literal"
|
|
||||||
)
|
|
||||||
qlatin1Call = postfixExp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return index;
|
return path.size() - 1; // very high priority
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void createChanges()
|
virtual void createChanges()
|
||||||
@@ -910,7 +895,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
StringLiteralAST *stringLiteral;
|
StringLiteralAST *stringLiteral;
|
||||||
PostfixExpressionAST *qlatin1Call;
|
CallAST *qlatin1Call;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
|
|||||||
@@ -287,6 +287,9 @@ unsigned QtInterfacesDeclarationAST::lastToken() const
|
|||||||
|
|
||||||
unsigned ArrayAccessAST::firstToken() const
|
unsigned ArrayAccessAST::firstToken() const
|
||||||
{
|
{
|
||||||
|
if (base_expression)
|
||||||
|
return base_expression->firstToken();
|
||||||
|
|
||||||
return lbracket_token;
|
return lbracket_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +299,9 @@ unsigned ArrayAccessAST::lastToken() const
|
|||||||
return rbracket_token + 1;
|
return rbracket_token + 1;
|
||||||
else if (expression)
|
else if (expression)
|
||||||
return expression->lastToken();
|
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
|
unsigned CallAST::firstToken() const
|
||||||
{
|
{
|
||||||
|
if (base_expression)
|
||||||
|
return base_expression->firstToken();
|
||||||
|
|
||||||
return lparen_token;
|
return lparen_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,7 +493,10 @@ unsigned CallAST::lastToken() const
|
|||||||
else if (expression_list)
|
else if (expression_list)
|
||||||
return expression_list->lastToken();
|
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
|
unsigned MemberAccessAST::firstToken() const
|
||||||
{
|
{
|
||||||
|
if (base_expression)
|
||||||
|
return base_expression->firstToken();
|
||||||
return access_token;
|
return access_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1192,7 +1205,9 @@ unsigned MemberAccessAST::lastToken() const
|
|||||||
return member_name->lastToken();
|
return member_name->lastToken();
|
||||||
else if (template_token)
|
else if (template_token)
|
||||||
return template_token + 1;
|
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
|
unsigned PostIncrDecrAST::firstToken() const
|
||||||
{
|
{
|
||||||
|
if (base_expression)
|
||||||
|
return base_expression->firstToken();
|
||||||
return incr_decr_token;
|
return incr_decr_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned PostIncrDecrAST::lastToken() const
|
unsigned PostIncrDecrAST::lastToken() const
|
||||||
{
|
{
|
||||||
return incr_decr_token + 1;
|
if (incr_decr_token)
|
||||||
}
|
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();
|
|
||||||
return base_expression->lastToken();
|
return base_expression->lastToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -258,7 +258,6 @@ public:
|
|||||||
virtual PostIncrDecrAST *asPostIncrDecr() { return 0; }
|
virtual PostIncrDecrAST *asPostIncrDecr() { return 0; }
|
||||||
virtual PostfixAST *asPostfix() { return 0; }
|
virtual PostfixAST *asPostfix() { return 0; }
|
||||||
virtual PostfixDeclaratorAST *asPostfixDeclarator() { return 0; }
|
virtual PostfixDeclaratorAST *asPostfixDeclarator() { return 0; }
|
||||||
virtual PostfixExpressionAST *asPostfixExpression() { return 0; }
|
|
||||||
virtual PtrOperatorAST *asPtrOperator() { return 0; }
|
virtual PtrOperatorAST *asPtrOperator() { return 0; }
|
||||||
virtual QtEnumDeclarationAST *asQtEnumDeclaration() { return 0; }
|
virtual QtEnumDeclarationAST *asQtEnumDeclaration() { return 0; }
|
||||||
virtual QtFlagsDeclarationAST *asQtFlagsDeclaration() { return 0; }
|
virtual QtFlagsDeclarationAST *asQtFlagsDeclaration() { return 0; }
|
||||||
@@ -375,7 +374,7 @@ public:
|
|||||||
virtual PtrOperatorAST *clone(MemoryPool *pool) const = 0;
|
virtual PtrOperatorAST *clone(MemoryPool *pool) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT PostfixAST: public AST
|
class CPLUSPLUS_EXPORT PostfixAST: public ExpressionAST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PostfixAST()
|
PostfixAST()
|
||||||
@@ -2503,13 +2502,15 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT CallAST: public PostfixAST
|
class CPLUSPLUS_EXPORT CallAST: public PostfixAST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ExpressionAST *base_expression;
|
||||||
unsigned lparen_token;
|
unsigned lparen_token;
|
||||||
ExpressionListAST *expression_list;
|
ExpressionListAST *expression_list;
|
||||||
unsigned rparen_token;
|
unsigned rparen_token;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CallAST()
|
CallAST()
|
||||||
: lparen_token(0)
|
: base_expression(0)
|
||||||
|
, lparen_token(0)
|
||||||
, expression_list(0)
|
, expression_list(0)
|
||||||
, rparen_token(0)
|
, rparen_token(0)
|
||||||
{}
|
{}
|
||||||
@@ -2529,13 +2530,15 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT ArrayAccessAST: public PostfixAST
|
class CPLUSPLUS_EXPORT ArrayAccessAST: public PostfixAST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ExpressionAST *base_expression;
|
||||||
unsigned lbracket_token;
|
unsigned lbracket_token;
|
||||||
ExpressionAST *expression;
|
ExpressionAST *expression;
|
||||||
unsigned rbracket_token;
|
unsigned rbracket_token;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArrayAccessAST()
|
ArrayAccessAST()
|
||||||
: lbracket_token(0)
|
: base_expression(0)
|
||||||
|
, lbracket_token(0)
|
||||||
, expression(0)
|
, expression(0)
|
||||||
, rbracket_token(0)
|
, rbracket_token(0)
|
||||||
{}
|
{}
|
||||||
@@ -2555,11 +2558,13 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT PostIncrDecrAST: public PostfixAST
|
class CPLUSPLUS_EXPORT PostIncrDecrAST: public PostfixAST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ExpressionAST *base_expression;
|
||||||
unsigned incr_decr_token;
|
unsigned incr_decr_token;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PostIncrDecrAST()
|
PostIncrDecrAST()
|
||||||
: incr_decr_token(0)
|
: base_expression(0)
|
||||||
|
, incr_decr_token(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual PostIncrDecrAST *asPostIncrDecr() { return this; }
|
virtual PostIncrDecrAST *asPostIncrDecr() { return this; }
|
||||||
@@ -2577,13 +2582,15 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT MemberAccessAST: public PostfixAST
|
class CPLUSPLUS_EXPORT MemberAccessAST: public PostfixAST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ExpressionAST *base_expression;
|
||||||
unsigned access_token;
|
unsigned access_token;
|
||||||
unsigned template_token;
|
unsigned template_token;
|
||||||
NameAST *member_name;
|
NameAST *member_name;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MemberAccessAST()
|
MemberAccessAST()
|
||||||
: access_token(0)
|
: base_expression(0)
|
||||||
|
, access_token(0)
|
||||||
, template_token(0)
|
, template_token(0)
|
||||||
, member_name(0)
|
, member_name(0)
|
||||||
{}
|
{}
|
||||||
@@ -2686,30 +2693,6 @@ protected:
|
|||||||
virtual bool match0(AST *, ASTMatcher *);
|
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
|
class CPLUSPLUS_EXPORT PointerToMemberAST: public PtrOperatorAST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -928,6 +928,8 @@ ParameterDeclarationClauseAST *ParameterDeclarationClauseAST::clone(MemoryPool *
|
|||||||
CallAST *CallAST::clone(MemoryPool *pool) const
|
CallAST *CallAST::clone(MemoryPool *pool) const
|
||||||
{
|
{
|
||||||
CallAST *ast = new (pool) CallAST;
|
CallAST *ast = new (pool) CallAST;
|
||||||
|
if (base_expression)
|
||||||
|
ast->base_expression = base_expression->clone(pool);
|
||||||
ast->lparen_token = lparen_token;
|
ast->lparen_token = lparen_token;
|
||||||
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
|
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
|
||||||
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
|
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 *ArrayAccessAST::clone(MemoryPool *pool) const
|
||||||
{
|
{
|
||||||
ArrayAccessAST *ast = new (pool) ArrayAccessAST;
|
ArrayAccessAST *ast = new (pool) ArrayAccessAST;
|
||||||
|
if (base_expression)
|
||||||
|
ast->base_expression = base_expression->clone(pool);
|
||||||
ast->lbracket_token = lbracket_token;
|
ast->lbracket_token = lbracket_token;
|
||||||
if (expression)
|
if (expression)
|
||||||
ast->expression = expression->clone(pool);
|
ast->expression = expression->clone(pool);
|
||||||
@@ -949,6 +953,8 @@ ArrayAccessAST *ArrayAccessAST::clone(MemoryPool *pool) const
|
|||||||
PostIncrDecrAST *PostIncrDecrAST::clone(MemoryPool *pool) const
|
PostIncrDecrAST *PostIncrDecrAST::clone(MemoryPool *pool) const
|
||||||
{
|
{
|
||||||
PostIncrDecrAST *ast = new (pool) PostIncrDecrAST;
|
PostIncrDecrAST *ast = new (pool) PostIncrDecrAST;
|
||||||
|
if (base_expression)
|
||||||
|
ast->base_expression = base_expression->clone(pool);
|
||||||
ast->incr_decr_token = incr_decr_token;
|
ast->incr_decr_token = incr_decr_token;
|
||||||
return ast;
|
return ast;
|
||||||
}
|
}
|
||||||
@@ -956,6 +962,8 @@ PostIncrDecrAST *PostIncrDecrAST::clone(MemoryPool *pool) const
|
|||||||
MemberAccessAST *MemberAccessAST::clone(MemoryPool *pool) const
|
MemberAccessAST *MemberAccessAST::clone(MemoryPool *pool) const
|
||||||
{
|
{
|
||||||
MemberAccessAST *ast = new (pool) MemberAccessAST;
|
MemberAccessAST *ast = new (pool) MemberAccessAST;
|
||||||
|
if (base_expression)
|
||||||
|
ast->base_expression = base_expression->clone(pool);
|
||||||
ast->access_token = access_token;
|
ast->access_token = access_token;
|
||||||
ast->template_token = template_token;
|
ast->template_token = template_token;
|
||||||
if (member_name)
|
if (member_name)
|
||||||
@@ -1002,17 +1010,6 @@ TypeConstructorCallAST *TypeConstructorCallAST::clone(MemoryPool *pool) const
|
|||||||
return ast;
|
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 *PointerToMemberAST::clone(MemoryPool *pool) const
|
||||||
{
|
{
|
||||||
PointerToMemberAST *ast = new (pool) PointerToMemberAST;
|
PointerToMemberAST *ast = new (pool) PointerToMemberAST;
|
||||||
|
|||||||
@@ -689,14 +689,6 @@ bool TypeConstructorCallAST::match0(AST *pattern, ASTMatcher *matcher)
|
|||||||
return false;
|
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)
|
bool PointerToMemberAST::match0(AST *pattern, ASTMatcher *matcher)
|
||||||
{
|
{
|
||||||
if (PointerToMemberAST *_other = pattern->asPointerToMember())
|
if (PointerToMemberAST *_other = pattern->asPointerToMember())
|
||||||
|
|||||||
@@ -1560,6 +1560,11 @@ bool ASTMatcher::match(CallAST *node, CallAST *pattern)
|
|||||||
(void) node;
|
(void) node;
|
||||||
(void) pattern;
|
(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;
|
pattern->lparen_token = node->lparen_token;
|
||||||
|
|
||||||
if (! pattern->expression_list)
|
if (! pattern->expression_list)
|
||||||
@@ -1577,6 +1582,11 @@ bool ASTMatcher::match(ArrayAccessAST *node, ArrayAccessAST *pattern)
|
|||||||
(void) node;
|
(void) node;
|
||||||
(void) pattern;
|
(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;
|
pattern->lbracket_token = node->lbracket_token;
|
||||||
|
|
||||||
if (! pattern->expression)
|
if (! pattern->expression)
|
||||||
@@ -1594,6 +1604,11 @@ bool ASTMatcher::match(PostIncrDecrAST *node, PostIncrDecrAST *pattern)
|
|||||||
(void) node;
|
(void) node;
|
||||||
(void) pattern;
|
(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;
|
pattern->incr_decr_token = node->incr_decr_token;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1604,6 +1619,11 @@ bool ASTMatcher::match(MemberAccessAST *node, MemberAccessAST *pattern)
|
|||||||
(void) node;
|
(void) node;
|
||||||
(void) pattern;
|
(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->access_token = node->access_token;
|
||||||
|
|
||||||
pattern->template_token = node->template_token;
|
pattern->template_token = node->template_token;
|
||||||
@@ -1681,24 +1701,6 @@ bool ASTMatcher::match(TypeConstructorCallAST *node, TypeConstructorCallAST *pat
|
|||||||
return true;
|
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)
|
bool ASTMatcher::match(PointerToMemberAST *node, PointerToMemberAST *pattern)
|
||||||
{
|
{
|
||||||
(void) node;
|
(void) node;
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ public:
|
|||||||
virtual bool match(PointerAST *node, PointerAST *pattern);
|
virtual bool match(PointerAST *node, PointerAST *pattern);
|
||||||
virtual bool match(PointerToMemberAST *node, PointerToMemberAST *pattern);
|
virtual bool match(PointerToMemberAST *node, PointerToMemberAST *pattern);
|
||||||
virtual bool match(PostIncrDecrAST *node, PostIncrDecrAST *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(QualifiedNameAST *node, QualifiedNameAST *pattern);
|
||||||
virtual bool match(ReferenceAST *node, ReferenceAST *pattern);
|
virtual bool match(ReferenceAST *node, ReferenceAST *pattern);
|
||||||
virtual bool match(ReturnStatementAST *node, ReturnStatementAST *pattern);
|
virtual bool match(ReturnStatementAST *node, ReturnStatementAST *pattern);
|
||||||
|
|||||||
@@ -531,13 +531,6 @@ public:
|
|||||||
return __ast;
|
return __ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
PostfixExpressionAST *PostfixExpression(ExpressionAST *base_expression = 0)
|
|
||||||
{
|
|
||||||
PostfixExpressionAST *__ast = new (&pool) PostfixExpressionAST;
|
|
||||||
__ast->base_expression = base_expression;
|
|
||||||
return __ast;
|
|
||||||
}
|
|
||||||
|
|
||||||
PointerToMemberAST *PointerToMember()
|
PointerToMemberAST *PointerToMember()
|
||||||
{
|
{
|
||||||
PointerToMemberAST *__ast = new (&pool) PointerToMemberAST;
|
PointerToMemberAST *__ast = new (&pool) PointerToMemberAST;
|
||||||
|
|||||||
@@ -680,6 +680,7 @@ void ParameterDeclarationClauseAST::accept0(ASTVisitor *visitor)
|
|||||||
void CallAST::accept0(ASTVisitor *visitor)
|
void CallAST::accept0(ASTVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
|
accept(base_expression, visitor);
|
||||||
accept(expression_list, visitor);
|
accept(expression_list, visitor);
|
||||||
}
|
}
|
||||||
visitor->endVisit(this);
|
visitor->endVisit(this);
|
||||||
@@ -688,6 +689,7 @@ void CallAST::accept0(ASTVisitor *visitor)
|
|||||||
void ArrayAccessAST::accept0(ASTVisitor *visitor)
|
void ArrayAccessAST::accept0(ASTVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
|
accept(base_expression, visitor);
|
||||||
accept(expression, visitor);
|
accept(expression, visitor);
|
||||||
}
|
}
|
||||||
visitor->endVisit(this);
|
visitor->endVisit(this);
|
||||||
@@ -696,6 +698,7 @@ void ArrayAccessAST::accept0(ASTVisitor *visitor)
|
|||||||
void PostIncrDecrAST::accept0(ASTVisitor *visitor)
|
void PostIncrDecrAST::accept0(ASTVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
|
accept(base_expression, visitor);
|
||||||
}
|
}
|
||||||
visitor->endVisit(this);
|
visitor->endVisit(this);
|
||||||
}
|
}
|
||||||
@@ -703,6 +706,7 @@ void PostIncrDecrAST::accept0(ASTVisitor *visitor)
|
|||||||
void MemberAccessAST::accept0(ASTVisitor *visitor)
|
void MemberAccessAST::accept0(ASTVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
|
accept(base_expression, visitor);
|
||||||
accept(member_name, visitor);
|
accept(member_name, visitor);
|
||||||
}
|
}
|
||||||
visitor->endVisit(this);
|
visitor->endVisit(this);
|
||||||
@@ -734,15 +738,6 @@ void TypeConstructorCallAST::accept0(ASTVisitor *visitor)
|
|||||||
visitor->endVisit(this);
|
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)
|
void PointerToMemberAST::accept0(ASTVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ public:
|
|||||||
virtual bool visit(PointerAST *) { return true; }
|
virtual bool visit(PointerAST *) { return true; }
|
||||||
virtual bool visit(PointerToMemberAST *) { return true; }
|
virtual bool visit(PointerToMemberAST *) { return true; }
|
||||||
virtual bool visit(PostIncrDecrAST *) { return true; }
|
virtual bool visit(PostIncrDecrAST *) { return true; }
|
||||||
virtual bool visit(PostfixExpressionAST *) { return true; }
|
|
||||||
virtual bool visit(QualifiedNameAST *) { return true; }
|
virtual bool visit(QualifiedNameAST *) { return true; }
|
||||||
virtual bool visit(ReferenceAST *) { return true; }
|
virtual bool visit(ReferenceAST *) { return true; }
|
||||||
virtual bool visit(ReturnStatementAST *) { return true; }
|
virtual bool visit(ReturnStatementAST *) { return true; }
|
||||||
@@ -319,7 +318,6 @@ public:
|
|||||||
virtual void endVisit(PointerAST *) { }
|
virtual void endVisit(PointerAST *) { }
|
||||||
virtual void endVisit(PointerToMemberAST *) { }
|
virtual void endVisit(PointerToMemberAST *) { }
|
||||||
virtual void endVisit(PostIncrDecrAST *) { }
|
virtual void endVisit(PostIncrDecrAST *) { }
|
||||||
virtual void endVisit(PostfixExpressionAST *) { }
|
|
||||||
virtual void endVisit(QualifiedNameAST *) { }
|
virtual void endVisit(QualifiedNameAST *) { }
|
||||||
virtual void endVisit(ReferenceAST *) { }
|
virtual void endVisit(ReferenceAST *) { }
|
||||||
virtual void endVisit(ReturnStatementAST *) { }
|
virtual void endVisit(ReturnStatementAST *) { }
|
||||||
|
|||||||
@@ -165,7 +165,6 @@ class PointerToMemberAST;
|
|||||||
class PostIncrDecrAST;
|
class PostIncrDecrAST;
|
||||||
class PostfixAST;
|
class PostfixAST;
|
||||||
class PostfixDeclaratorAST;
|
class PostfixDeclaratorAST;
|
||||||
class PostfixExpressionAST;
|
|
||||||
class PtrOperatorAST;
|
class PtrOperatorAST;
|
||||||
class QtEnumDeclarationAST;
|
class QtEnumDeclarationAST;
|
||||||
class QtFlagsDeclarationAST;
|
class QtFlagsDeclarationAST;
|
||||||
|
|||||||
@@ -248,15 +248,6 @@ bool CheckExpression::visit(TypeConstructorCallAST *ast)
|
|||||||
return false;
|
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)
|
bool CheckExpression::visit(SizeofExpressionAST *ast)
|
||||||
{
|
{
|
||||||
FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
|
FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
|
||||||
@@ -348,6 +339,7 @@ bool CheckExpression::visit(CompoundLiteralAST *ast)
|
|||||||
|
|
||||||
bool CheckExpression::visit(CallAST *ast)
|
bool CheckExpression::visit(CallAST *ast)
|
||||||
{
|
{
|
||||||
|
FullySpecifiedType baseTy = semantic()->check(ast->base_expression, _scope);
|
||||||
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
|
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
|
||||||
FullySpecifiedType exprTy = semantic()->check(it->value, _scope);
|
FullySpecifiedType exprTy = semantic()->check(it->value, _scope);
|
||||||
}
|
}
|
||||||
@@ -356,18 +348,22 @@ bool CheckExpression::visit(CallAST *ast)
|
|||||||
|
|
||||||
bool CheckExpression::visit(ArrayAccessAST *ast)
|
bool CheckExpression::visit(ArrayAccessAST *ast)
|
||||||
{
|
{
|
||||||
|
FullySpecifiedType baseTy = semantic()->check(ast->base_expression, _scope);
|
||||||
FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
|
FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckExpression::visit(PostIncrDecrAST *)
|
bool CheckExpression::visit(PostIncrDecrAST *ast)
|
||||||
{
|
{
|
||||||
|
FullySpecifiedType baseTy = semantic()->check(ast->base_expression, _scope);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckExpression::visit(MemberAccessAST *ast)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ protected:
|
|||||||
virtual bool visit(TypeidExpressionAST *ast);
|
virtual bool visit(TypeidExpressionAST *ast);
|
||||||
virtual bool visit(TypenameCallExpressionAST *ast);
|
virtual bool visit(TypenameCallExpressionAST *ast);
|
||||||
virtual bool visit(TypeConstructorCallAST *ast);
|
virtual bool visit(TypeConstructorCallAST *ast);
|
||||||
virtual bool visit(PostfixExpressionAST *ast);
|
|
||||||
virtual bool visit(SizeofExpressionAST *ast);
|
virtual bool visit(SizeofExpressionAST *ast);
|
||||||
virtual bool visit(NumericLiteralAST *ast);
|
virtual bool visit(NumericLiteralAST *ast);
|
||||||
virtual bool visit(BoolLiteralAST *ast);
|
virtual bool visit(BoolLiteralAST *ast);
|
||||||
|
|||||||
@@ -4325,28 +4325,26 @@ bool Parser::parsePostfixExpression(ExpressionAST *&node)
|
|||||||
{
|
{
|
||||||
DEBUG_THIS_RULE();
|
DEBUG_THIS_RULE();
|
||||||
if (parseCorePostfixExpression(node)) {
|
if (parseCorePostfixExpression(node)) {
|
||||||
PostfixListAST *postfix_expressions = 0,
|
|
||||||
**postfix_ptr = &postfix_expressions;
|
|
||||||
while (LA()) {
|
while (LA()) {
|
||||||
if (LA() == T_LPAREN) {
|
if (LA() == T_LPAREN) {
|
||||||
CallAST *ast = new (_pool) CallAST;
|
CallAST *ast = new (_pool) CallAST;
|
||||||
ast->lparen_token = consumeToken();
|
ast->lparen_token = consumeToken();
|
||||||
parseExpressionList(ast->expression_list);
|
parseExpressionList(ast->expression_list);
|
||||||
match(T_RPAREN, &ast->rparen_token);
|
match(T_RPAREN, &ast->rparen_token);
|
||||||
*postfix_ptr = new (_pool) PostfixListAST(ast);
|
ast->base_expression = node;
|
||||||
postfix_ptr = &(*postfix_ptr)->next;
|
node = ast;
|
||||||
} else if (LA() == T_LBRACKET) {
|
} else if (LA() == T_LBRACKET) {
|
||||||
ArrayAccessAST *ast = new (_pool) ArrayAccessAST;
|
ArrayAccessAST *ast = new (_pool) ArrayAccessAST;
|
||||||
ast->lbracket_token = consumeToken();
|
ast->lbracket_token = consumeToken();
|
||||||
parseExpression(ast->expression);
|
parseExpression(ast->expression);
|
||||||
match(T_RBRACKET, &ast->rbracket_token);
|
match(T_RBRACKET, &ast->rbracket_token);
|
||||||
*postfix_ptr = new (_pool) PostfixListAST(ast);
|
ast->base_expression = node;
|
||||||
postfix_ptr = &(*postfix_ptr)->next;
|
node = ast;
|
||||||
} else if (LA() == T_PLUS_PLUS || LA() == T_MINUS_MINUS) {
|
} else if (LA() == T_PLUS_PLUS || LA() == T_MINUS_MINUS) {
|
||||||
PostIncrDecrAST *ast = new (_pool) PostIncrDecrAST;
|
PostIncrDecrAST *ast = new (_pool) PostIncrDecrAST;
|
||||||
ast->incr_decr_token = consumeToken();
|
ast->incr_decr_token = consumeToken();
|
||||||
*postfix_ptr = new (_pool) PostfixListAST(ast);
|
ast->base_expression = node;
|
||||||
postfix_ptr = &(*postfix_ptr)->next;
|
node = ast;
|
||||||
} else if (LA() == T_DOT || LA() == T_ARROW) {
|
} else if (LA() == T_DOT || LA() == T_ARROW) {
|
||||||
MemberAccessAST *ast = new (_pool) MemberAccessAST;
|
MemberAccessAST *ast = new (_pool) MemberAccessAST;
|
||||||
ast->access_token = consumeToken();
|
ast->access_token = consumeToken();
|
||||||
@@ -4355,17 +4353,11 @@ bool Parser::parsePostfixExpression(ExpressionAST *&node)
|
|||||||
if (! parseNameId(ast->member_name))
|
if (! parseNameId(ast->member_name))
|
||||||
_translationUnit->error(cursor(), "expected unqualified-id before token `%s'",
|
_translationUnit->error(cursor(), "expected unqualified-id before token `%s'",
|
||||||
tok().spell());
|
tok().spell());
|
||||||
*postfix_ptr = new (_pool) PostfixListAST(ast);
|
ast->base_expression = node;
|
||||||
postfix_ptr = &(*postfix_ptr)->next;
|
node = ast;
|
||||||
} else break;
|
} else break;
|
||||||
} // while
|
} // while
|
||||||
|
|
||||||
if (postfix_expressions) {
|
|
||||||
PostfixExpressionAST *ast = new (_pool) PostfixExpressionAST;
|
|
||||||
ast->base_expression = node;
|
|
||||||
ast->postfix_expression_list = postfix_expressions;
|
|
||||||
node = ast;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user