コード例 #1
0
ファイル: bookkeeper.py プロジェクト: TheDunn/flex-pypy
 def see_mutable(self, x):
     if x in self.seen_mutable:
         return
     clsdef = self.getuniqueclassdef(x.__class__)        
     self.seen_mutable[x] = True
     self.event('mutable', x)
     source = InstanceSource(self, x)
     for attr in source.all_instance_attributes():
         clsdef.add_source_for_attribute(attr, source) # can trigger reflowing
コード例 #2
0
ファイル: bookkeeper.py プロジェクト: griels/pypy-sc
 def see_mutable(self, x):
     if x in self.seen_mutable:
         return
     clsdef = self.getuniqueclassdef(x.__class__)        
     self.seen_mutable[x] = True
     self.event('mutable', x)
     source = InstanceSource(self, x)
     for attr in source.all_instance_attributes():
         clsdef.add_source_for_attribute(attr, source) # can trigger reflowing
コード例 #3
0
 def event(pol, bookkeeper, what, x):
     from pypy.objspace.std import typeobject
     if isinstance(x, typeobject.W_TypeObject):
         from pypy.annotation.classdef import InstanceSource
         clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject)
         pol.pypytypes[x] = True
         #print "TYPE", x
         for attr in pol.lookups:
             if attr and pol.attach_lookup(x, attr):
                 cached = "cached_%s" % attr
                 source = InstanceSource(bookkeeper, x)
                 clsdef.add_source_for_attribute(cached, source)
         for attr in pol.lookups_where:
             if attr and pol.attach_lookup_in_type_where(x, attr):
                 cached = "cached_where_%s" % attr
                 source = InstanceSource(bookkeeper, x)
                 clsdef.add_source_for_attribute(cached, source)
     return
コード例 #4
0
 def consider_lookup(pol, bookkeeper, attr):
     from pypy.annotation.classdef import InstanceSource
     assert attr not in pol.lookups
     from pypy.objspace.std import typeobject
     cached = "cached_%s" % attr
     clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject)
     classdesc = clsdef.classdesc
     classdesc.classdict[cached] = Constant(None)
     clsdef.add_source_for_attribute(cached, classdesc)
     for t in pol.pypytypes:
         if pol.attach_lookup(t, attr):
             source = InstanceSource(bookkeeper, t)
             clsdef.add_source_for_attribute(cached, source)
     pol.lookups[attr] = True