From 8cbbb17f32e2c7af459e62b7b694b7edca1b5fc8 Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Tue, 12 Sep 2017 08:33:38 -0700 Subject: [PATCH] Add missing visitor for signed numerics. --- korman/plasma_attributes.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/korman/plasma_attributes.py b/korman/plasma_attributes.py index 478aedf..b2dfd34 100644 --- a/korman/plasma_attributes.py +++ b/korman/plasma_attributes.py @@ -92,6 +92,12 @@ class PlasmaAttributeVisitor(ast.NodeVisitor): def visit_NameConstant(self, node): return node.value + def visit_UnaryOp(self, node): + if type(node.op) == ast.USub: + return -self.visit(node.operand) + elif type(node.op) == ast.UAdd: + return self.visit(node.operand) + def generic_visit(self, node): ast.NodeVisitor.generic_visit(self, node)