Exemple #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)
Exemple #2
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)
Exemple #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
Exemple #4
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
Exemple #5
0
 def upcast(self, result):
     return ootype.ooupcast(self.lowleveltype, result)
Exemple #6
0
 def upcast(self, result):
     return ootype.ooupcast(self.lowleveltype, result)
Exemple #7
0
def op_ooupcast(INST, inst):
    return ootype.ooupcast(INST, inst)
Exemple #8
0
 def cast_exception(self, TYPE, value):
     return ootype.ooupcast(TYPE, value)
Exemple #9
0
 def cast_exception(self, TYPE, value):
     return ootype.ooupcast(TYPE, value)
Exemple #10
0
 def convert_pbc(self, pbc):
     if ootype.typeOf(pbc) != PBCROOT:
         pbc = ootype.ooupcast(PBCROOT, pbc)
     return pbc
Exemple #11
0
 def convert_pbc(self, pbc):
     if ootype.typeOf(pbc) != PBCROOT:
         pbc = ootype.ooupcast(PBCROOT, pbc)
     return pbc
Exemple #12
0
def op_ooupcast(INST, inst):
    return ootype.ooupcast(INST, inst)