Przeglądaj źródła

Improved some boolean test methods for nodes.

- Removed useless is_leaf check, since that is implicit in type checking.
Taddeus Kroes 14 lat temu
rodzic
commit
78227c8254
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      src/node.py

+ 4 - 4
src/node.py

@@ -110,16 +110,16 @@ class ExpressionBase(object):
         return not self.is_leaf() and self.op in [OP_ADD, OP_SUB, OP_MUL]
 
     def is_identifier(self):
-        return self.is_leaf() and self.type & TYPE_IDENTIFIER
+        return self.type == TYPE_IDENTIFIER
 
     def is_int(self):
-        return self.is_leaf() and self.type & TYPE_INTEGER
+        return self.type == TYPE_INTEGER
 
     def is_float(self):
-        return self.is_leaf() and self.type & TYPE_FLOAT
+        return self.type == TYPE_FLOAT
 
     def is_numeric(self):
-        return self.is_leaf() and self.type & (TYPE_FLOAT | TYPE_INTEGER)
+        return self.type & (TYPE_FLOAT | TYPE_INTEGER)
 
     def __add__(self, other):
         return ExpressionNode('+', self, to_expression(other))