Bug 895728 part 1. Introduce "boolean" and "numeric" types, since those will be treated differently for purposes of distinguishability and overload resolution. r=khuey

This commit is contained in:
Boris Zbarsky 2013-07-30 10:39:34 -07:00
parent 1b619da690
commit a3425171f3

View File

@ -1257,6 +1257,12 @@ class IDLType(IDLObject):
def isPrimitive(self):
return False
def isBoolean(self):
return False
def isNumeric(self):
return False
def isString(self):
return False
@ -1411,6 +1417,12 @@ class IDLNullableType(IDLType):
def isPrimitive(self):
return self.inner.isPrimitive()
def isBoolean(self):
return self.inner.isBoolean()
def isNumeric(self):
return self.inner.isNumeric()
def isString(self):
return self.inner.isString()
@ -1805,6 +1817,12 @@ class IDLTypedefType(IDLType, IDLObjectWithIdentifier):
def isPrimitive(self):
return self.inner.isPrimitive()
def isBoolean(self):
return self.inner.isBoolean()
def isNumeric(self):
return self.inner.isNumeric()
def isString(self):
return self.inner.isString()
@ -2084,6 +2102,12 @@ class IDLBuiltinType(IDLType):
def isPrimitive(self):
return self._typeTag <= IDLBuiltinType.Types.double
def isBoolean(self):
return self._typeTag == IDLBuiltinType.Types.boolean
def isNumeric(self):
return self.isPrimitive() and not self.isBoolean()
def isString(self):
return self._typeTag == IDLBuiltinType.Types.domstring or \
self._typeTag == IDLBuiltinType.Types.bytestring