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;
|
||||
}
|
||||
|
||||
bool FindUsages::visit(PostfixExpressionAST *ast)
|
||||
{
|
||||
_postfixExpressionStack.append(ast);
|
||||
return true;
|
||||
}
|
||||
|
||||
void FindUsages::endVisit(PostfixExpressionAST *)
|
||||
{
|
||||
_postfixExpressionStack.removeLast();
|
||||
}
|
||||
|
||||
bool FindUsages::visit(MemberAccessAST *ast)
|
||||
{
|
||||
if (ast->member_name) {
|
||||
if (SimpleNameAST *simple = ast->member_name->asSimpleName()) {
|
||||
if (identifier(simple->identifier_token) == _id) {
|
||||
Q_ASSERT(! _postfixExpressionStack.isEmpty());
|
||||
|
||||
checkExpression(_postfixExpressionStack.last()->firstToken(),
|
||||
simple->identifier_token);
|
||||
|
||||
checkExpression(ast->firstToken(), simple->identifier_token);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,8 +83,6 @@ protected:
|
||||
void ensureNameIsValid(NameAST *ast);
|
||||
|
||||
virtual bool visit(MemInitializerAST *ast);
|
||||
virtual bool visit(PostfixExpressionAST *ast);
|
||||
virtual void endVisit(PostfixExpressionAST *);
|
||||
virtual bool visit(MemberAccessAST *ast);
|
||||
virtual bool visit(QualifiedNameAST *ast);
|
||||
virtual bool visit(EnumeratorAST *ast);
|
||||
@@ -116,7 +114,6 @@ private:
|
||||
QByteArray _source;
|
||||
Document::Ptr _exprDoc;
|
||||
Semantic _sem;
|
||||
QList<PostfixExpressionAST *> _postfixExpressionStack;
|
||||
QList<QualifiedNameAST *> _qualifiedNameStack;
|
||||
QList<TemplateDeclarationAST *> _templateDeclarationStack;
|
||||
QList<int> _references;
|
||||
|
||||
@@ -244,16 +244,6 @@ bool ResolveExpression::visit(TypeConstructorCallAST *)
|
||||
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 *)
|
||||
{
|
||||
FullySpecifiedType ty(control()->integerType(IntegerType::Int));
|
||||
@@ -468,8 +458,7 @@ bool ResolveExpression::maybeValidPrototype(Function *funTy, unsigned actualArgu
|
||||
|
||||
bool ResolveExpression::visit(CallAST *ast)
|
||||
{
|
||||
const QList<LookupItem> baseResults = _results;
|
||||
_results.clear();
|
||||
const QList<LookupItem> baseResults = resolve(ast->base_expression, _scope);
|
||||
|
||||
// Compute the types of the actual arguments.
|
||||
int actualArgumentCount = 0;
|
||||
@@ -514,9 +503,7 @@ bool ResolveExpression::visit(CallAST *ast)
|
||||
|
||||
bool ResolveExpression::visit(ArrayAccessAST *ast)
|
||||
{
|
||||
const QList<LookupItem> baseResults = _results;
|
||||
_results.clear();
|
||||
|
||||
const QList<LookupItem> baseResults = resolve(ast->base_expression, _scope);
|
||||
const QList<LookupItem> indexResults = resolve(ast->expression);
|
||||
|
||||
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
|
||||
// _results.
|
||||
const QList<LookupItem> baseResults = _results;
|
||||
_results.clear();
|
||||
const QList<LookupItem> baseResults = resolve(ast->base_expression, _scope);
|
||||
|
||||
// Evaluate the expression-id that follows the access operator.
|
||||
const Name *memberName = 0;
|
||||
@@ -644,8 +630,10 @@ FullySpecifiedType ResolveExpression::instantiate(const Name *className, Symbol
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,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);
|
||||
|
||||
Reference in New Issue
Block a user