Commit 8a8a1551 authored by frmdstryr's avatar frmdstryr Committed by Sven Brauch
Browse files

Apply Sven's patch

parent 36564459
......@@ -603,7 +603,7 @@ NumberAst::NumberAst(Ast* parent): ExpressionAst(parent, Ast::NumberAstType), va
QString NumberAst::dump() const
{
if (isInt)
return "Number()";
return QString::fromLatin1("Number(%1)").arg(value);
else
return "Float()";
}
......@@ -741,6 +741,14 @@ UnaryOperationAst::UnaryOperationAst(Ast* parent): ExpressionAst(parent, Ast::Un
}
QString UnaryOperationAst::dump() const {
QString r;
r.append("Unary(");
dumpNode(r, "value=", operand);
r.append(")");
return r;
}
TryAst::TryAst(Ast* parent): StatementAst(parent, Ast::TryAstType)
{
......
......@@ -546,6 +546,8 @@ public:
UnaryOperationAst(Ast* parent);
Ast::UnaryOperatorTypes type;
ExpressionAst* operand;
QString dump() const override;
};
class KDEVPYTHONPARSER_EXPORT LambdaAst : public ExpressionAst {
......
......@@ -374,9 +374,9 @@ Ast* AstTransformer::visitExprNode(PyObject* node, Ast* parent)
v->type = Ast::UnaryOperatorInvalid;
else if (PyObject_IsInstance(node, grammar.ast_Not))
v->type = Ast::UnaryOperatorNot;
else if (PyObject_IsInstance(node, grammar.ast_Add))
else if (PyObject_IsInstance(node, grammar.ast_UAdd))
v->type = Ast::UnaryOperatorAdd;
else if (PyObject_IsInstance(node, grammar.ast_Sub))
else if (PyObject_IsInstance(node, grammar.ast_USub))
v->type = Ast::UnaryOperatorSub;
else
v->type = Ast::UnaryOperatorInvalid;
......@@ -668,7 +668,7 @@ Ast* AstTransformer::visitExprNode(PyObject* node, Ast* parent)
v->identifier->startCol = getattr<int>(node, "col_offset");
v->identifier->startLine = tline(getattr<int>(node, "lineno"));
v->identifier->endCol = v->identifier->startCol + id.size() - 1;
v->identifier->endLine = v->identifier->endLine;
v->identifier->endLine = v->identifier->startLine;
v->startCol = v->identifier->startCol;
v->startLine = v->identifier->startLine;
v->endCol = v->identifier->endCol;
......
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