SVN commit 758230 by apaku: I should really do a compile before comitting things. M +12 -10 astbuilder.cpp M +0 -1 astbuilder.h --- trunk/playground/devtools/kdevelop4-extra-plugins/python/parser/astbuilder.cpp #758229:758230 @@ -1122,9 +1122,9 @@ { qDebug() << "visitPower start"; visitNode( node->atom ); - AtomAst* atomast = safeNodeCast( ast ); + AtomAst* atomast = safeNodeCast( mNodeStack.pop() ); mNodeStack.push( atomast ); - count = node->trailerSequence.count(); + int count = node->trailerSequence->count(); if( count > 0 ) { for( int i = 0; i < count; i++ ) @@ -1134,21 +1134,21 @@ PrimaryAst* prim = safeNodeCast( mNodeStack.pop() ); switch( ast->astType ) { - case CallAst: - static_cast( ast )->primary = prim; + case Ast::CallAst: + static_cast( ast )->callable = prim; break; case Ast::ExtendedSliceAst: case Ast::SimpleSliceAst: - static_cast( ast )->primary = prim; + static_cast( ast )->primary = prim; break; case Ast::AttributeReferenceAst: - static_cast( ast )->primary = prim; + static_cast( ast )->primary = prim; break; case Ast::SubscriptAst: - static_cast( ast )->primary = prim; + static_cast( ast )->primary = prim; break; default: - Q_ASSERT_X(false, "OOOPS visitTrailer returned a PrimaryAst that is not known to have a primary in front of it, like an AtomAst or something new."); + Q_ASSERT_X(false, "visitTrailer", "OOOPS visitTrailer returned a PrimaryAst that is not known to have a primary in front of it, like an AtomAst or something new."); break; } mNodeStack.push( ast ); @@ -1263,12 +1263,12 @@ { qDebug() << "visitShiftExpr start"; visitNode( node->arithExpr ); + int count = node->shiftOpListSequence->count(); if( count > 0 ) { Q_ASSERT( count == node->arithExprListSequence->count() ); BinaryExpressionAst* ast = createAst( node ); ast->lhs = safeNodeCast( mNodeStack.pop() ); - count = node->shiftOpListSequence->count(); BinaryExpressionAst* cur = ast; for( int i = 0; i < count; i++ ) { @@ -1280,6 +1280,8 @@ case PythonParser::RightShiftOp: cur->opType = ArithmeticExpressionAst::BinaryRightShift; break; + default: + Q_ASSERT_X(false, "visitShiftExpr", "OOOPS, shift operator was something other than left or right shifting!"); } visitNode( node->arithExprListSequence->at( i )->element ); if( i == count - 1 ) @@ -1288,7 +1290,7 @@ }else { cur->rhs = createAst( node->arithExprListSequence->at( i )->element ); - cur = cur->rhs; + cur = safeNodeCast( cur->rhs ); cur->lhs = safeNodeCast( mNodeStack.pop() ); } } --- trunk/playground/devtools/kdevelop4-extra-plugins/python/parser/astbuilder.h #758229:758230 @@ -100,7 +100,6 @@ virtual void visitRaiseStmt(PythonParser::RaiseStmtAst *node); virtual void visitReturnStmt(PythonParser::ReturnStmtAst *node); virtual void visitShiftExpr(PythonParser::ShiftExprAst *node); - virtual void visitShiftOp(PythonParser::ShiftOpAst *node); virtual void visitSimpleStmt(PythonParser::SimpleStmtAst *node); virtual void visitSliceop(PythonParser::SliceopAst *node); virtual void visitSmallStmt(PythonParser::SmallStmtAst *node);