Commit 112b7133 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Fixed test after changing the AST representation of the postfix expression.

parent db9e6104
...@@ -810,22 +810,20 @@ void tst_AST::normal_array_access() ...@@ -810,22 +810,20 @@ void tst_AST::normal_array_access()
ExpressionAST *expr = bodyStatements->next->next->value->asReturnStatement()->expression; ExpressionAST *expr = bodyStatements->next->next->value->asReturnStatement()->expression;
QVERIFY(expr); QVERIFY(expr);
PostfixExpressionAST *postfixExpr = expr->asPostfixExpression(); ArrayAccessAST *arrayExpr = expr->asArrayAccess();
QVERIFY(postfixExpr); QVERIFY(arrayExpr);
{ { // check the left-hand side:
ExpressionAST *lhs = postfixExpr->base_expression; ExpressionAST *lhs = arrayExpr->base_expression;
QVERIFY(lhs); QVERIFY(lhs);
SimpleNameAST *a = lhs->asSimpleName(); SimpleNameAST *a = lhs->asSimpleName();
QVERIFY(a); QVERIFY(a);
QCOMPARE(QLatin1String(unit->identifier(a->identifier_token)->chars()), QLatin1String("a")); QCOMPARE(QLatin1String(unit->identifier(a->identifier_token)->chars()), QLatin1String("a"));
} }
{ { // check the right-hand side:
QVERIFY(postfixExpr->postfix_expression_list && !postfixExpr->postfix_expression_list->next); QVERIFY(arrayExpr->expression);
ArrayAccessAST *rhs = postfixExpr->postfix_expression_list->value->asArrayAccess(); SimpleNameAST *b = arrayExpr->expression->asSimpleName();
QVERIFY(rhs && rhs->expression);
SimpleNameAST *b = rhs->expression->asSimpleName();
QVERIFY(b); QVERIFY(b);
QCOMPARE(QLatin1String(unit->identifier(b->identifier_token)->chars()), QLatin1String("b")); QCOMPARE(QLatin1String(unit->identifier(b->identifier_token)->chars()), QLatin1String("b"));
} }
...@@ -854,11 +852,11 @@ void tst_AST::array_access_with_nested_expression() ...@@ -854,11 +852,11 @@ void tst_AST::array_access_with_nested_expression()
CastExpressionAST *castExpr = expr->asCastExpression(); CastExpressionAST *castExpr = expr->asCastExpression();
QVERIFY(!castExpr); QVERIFY(!castExpr);
PostfixExpressionAST *postfixExpr = expr->asPostfixExpression(); ArrayAccessAST *arrayExpr = expr->asArrayAccess();
QVERIFY(postfixExpr); QVERIFY(arrayExpr);
{ { // check the LHS:
ExpressionAST *lhs = postfixExpr->base_expression; ExpressionAST *lhs = arrayExpr->base_expression;
QVERIFY(lhs); QVERIFY(lhs);
NestedExpressionAST *nested_a = lhs->asNestedExpression(); NestedExpressionAST *nested_a = lhs->asNestedExpression();
QVERIFY(nested_a && nested_a->expression); QVERIFY(nested_a && nested_a->expression);
...@@ -867,11 +865,9 @@ void tst_AST::array_access_with_nested_expression() ...@@ -867,11 +865,9 @@ void tst_AST::array_access_with_nested_expression()
QCOMPARE(QLatin1String(unit->identifier(a->identifier_token)->chars()), QLatin1String("a")); QCOMPARE(QLatin1String(unit->identifier(a->identifier_token)->chars()), QLatin1String("a"));
} }
{ { // check the RHS:
QVERIFY(postfixExpr->postfix_expression_list && !postfixExpr->postfix_expression_list->next); QVERIFY(arrayExpr->expression);
ArrayAccessAST *rhs = postfixExpr->postfix_expression_list->value->asArrayAccess(); SimpleNameAST *b = arrayExpr->expression->asSimpleName();
QVERIFY(rhs && rhs->expression);
SimpleNameAST *b = rhs->expression->asSimpleName();
QVERIFY(b); QVERIFY(b);
QCOMPARE(QLatin1String(unit->identifier(b->identifier_token)->chars()), QLatin1String("b")); QCOMPARE(QLatin1String(unit->identifier(b->identifier_token)->chars()), QLatin1String("b"));
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment