示例#1
0
	def get_type(self):
		if self.coerce_type == self.GENERALIZE:
			return PyObjectType.common_base([c.get_type() for c in self.children])()
		elif self.coerce_type == self.OVERRIDE:
			return self.children[-1].get_type()
		elif self.coerce_type == self.INPLACE:
			return self.children[0].get_type()
		else:
			raise NotImplementedError
示例#2
0
	def get_type(self):
		'''
		Query the type list to find the most appropriate type for this name.
		'''
		# if we have only one type assigned, just use it
		if len(self.types) == 1:
			return self.types[0]
		# if we have no types, then we just use the most generic possible type
		if not len(self.types):
			return PyObjectType()

		# otherwise, we have to find a common base
		base = PyObjectType.common_base(self.types)

		#print("RET: {} for {} types".format(base, self.types))
		return base()
示例#3
0
	def get_type(self):
		return PyObjectType.common_base(self.types)()