Exemplo n.º 1
0
 def type(self, *moreargs):
     if moreargs:
         raise Exception('type() called with more than one argument')
     r = SomeType()
     bk = getbookkeeper()
     op = bk._find_current_op(opname="type", arity=1, pos=0, s_type=self)
     r.is_type_of = [op.args[0]]
     return r
Exemplo n.º 2
0
 def union((obj1, obj2)):
     result = SomeType()
     is_type_of1 = getattr(obj1, 'is_type_of', None)
     is_type_of2 = getattr(obj2, 'is_type_of', None)
     if obj1.is_immutable_constant() and obj2.is_immutable_constant() and obj1.const == obj2.const:
         result.const = obj1.const
         is_type_of = {}
         if is_type_of1:
             for v in is_type_of1:
                 is_type_of[v] = True
         if is_type_of2:
             for v in is_type_of2:
                 is_type_of[v] = True
         if is_type_of:
             result.is_type_of = is_type_of.keys()
     else:
         if is_type_of1 and is_type_of1 == is_type_of2:
             result.is_type_of = is_type_of1
     return result
Exemplo n.º 3
0
 def union((obj1, obj2)):
     result = SomeType()
     is_type_of1 = getattr(obj1, 'is_type_of', None)
     is_type_of2 = getattr(obj2, 'is_type_of', None)
     if obj1.is_immutable_constant() and obj2.is_immutable_constant(
     ) and obj1.const == obj2.const:
         result.const = obj1.const
         is_type_of = {}
         if is_type_of1:
             for v in is_type_of1:
                 is_type_of[v] = True
         if is_type_of2:
             for v in is_type_of2:
                 is_type_of[v] = True
         if is_type_of:
             result.is_type_of = is_type_of.keys()
     else:
         if is_type_of1 and is_type_of1 == is_type_of2:
             result.is_type_of = is_type_of1
     return result
Exemplo n.º 4
0
def type_SomeObject(annotator, arg):
    r = SomeType()
    r.is_type_of = [arg]
    return r
Exemplo n.º 5
0
def type_SomeObject(annotator, arg):
    r = SomeType()
    r.is_type_of = [arg]
    return r