Esempio n. 1
0
 def getruntime(self, expected_type):
     if expected_type == ootype.Class:
         rinstance = getinstancerepr(self.rtyper, self.classdef)
         return ootype.runtimeClass(rinstance.lowleveltype)
     else:
         assert ootype.isSubclass(expected_type, META)
         meta = self.get_meta_instance(cast_to_root_meta=False)
         return ootype.ooupcast(expected_type, meta)
Esempio n. 2
0
File: rclass.py Progetto: sota/pypy
 def getruntime(self, expected_type):
     if expected_type == ootype.Class:
         rinstance = getinstancerepr(self.rtyper, self.classdef)
         return ootype.runtimeClass(rinstance.lowleveltype)
     else:
         assert ootype.isSubclass(expected_type, META)
         meta = self.get_meta_instance(cast_to_root_meta=False)
         return ootype.ooupcast(expected_type, meta)
Esempio n. 3
0
    def get_meta_instance(self, cast_to_root_meta=True):
        if self.lowleveltype == ootype.Class:
            raise TyperError("no meta-instance for class %r" %
                             (self.classdef, ))
        if self.meta_instance is None:
            self.meta_instance = ootype.new(self.lowleveltype)
            self.setup_meta_instance(self.meta_instance, self)

        meta_instance = self.meta_instance
        if cast_to_root_meta:
            meta_instance = ootype.ooupcast(META, meta_instance)
        return meta_instance
Esempio n. 4
0
File: rclass.py Progetto: sota/pypy
 def get_meta_instance(self, cast_to_root_meta=True):
     if self.lowleveltype == ootype.Class:
         raise TyperError("no meta-instance for class %r" % 
                          (self.classdef,))
     if self.meta_instance is None:
         self.meta_instance = ootype.new(self.lowleveltype) 
         self.setup_meta_instance(self.meta_instance, self)
     
     meta_instance = self.meta_instance
     if cast_to_root_meta:
         meta_instance = ootype.ooupcast(META, meta_instance)
     return meta_instance
Esempio n. 5
0
 def upcast(self, result):
     return ootype.ooupcast(self.lowleveltype, result)
Esempio n. 6
0
File: rclass.py Progetto: sota/pypy
 def upcast(self, result):
     return ootype.ooupcast(self.lowleveltype, result)
Esempio n. 7
0
def op_ooupcast(INST, inst):
    return ootype.ooupcast(INST, inst)
Esempio n. 8
0
 def cast_exception(self, TYPE, value):
     return ootype.ooupcast(TYPE, value)
Esempio n. 9
0
 def cast_exception(self, TYPE, value):
     return ootype.ooupcast(TYPE, value)
Esempio n. 10
0
 def convert_pbc(self, pbc):
     if ootype.typeOf(pbc) != PBCROOT:
         pbc = ootype.ooupcast(PBCROOT, pbc)
     return pbc
Esempio n. 11
0
File: rpbc.py Progetto: sota/pypy
 def convert_pbc(self, pbc):
     if ootype.typeOf(pbc) != PBCROOT:
         pbc = ootype.ooupcast(PBCROOT, pbc)
     return pbc
Esempio n. 12
0
def op_ooupcast(INST, inst):
    return ootype.ooupcast(INST, inst)