def getBindingLocal(self, index): assert index >= 0, "Frame index was negative!?" assert index < len(self.local), "Frame index out-of-bounds :c" if self.local[index] is None: print "Warning: Use-before-define on local index", index print "Expect an imminent crash." from typhon.objects.refs import UnconnectedRef return UnconnectedRef(StrObject( u"Local index %d used before definition" % index)) assert self.local[index] is not None, "Local binding use-before-define" return self.local[index]
def commit(self): if self.committed: raise userError(u"already commited") self.committed = True if isinstance(self.resolutionBox, FinalSlot): res = self.resolutionBox.get() else: res = UnconnectedRef( StrObject(u"Resolution promise of a proxy handled by " + self.handler.toString() + u" didn't resolve to a FinalSlot, but " + self.resolutionBox.toString() + u" instead.")) self.resolutionBox = FinalSlot(res, anyGuard) self.handler = None return res
def __init__(self, vat, handler, resolutionIdentity, problem): UnconnectedRef.__init__(self, vat, problem) self.handler = handler self.resolutionIdentity = resolutionIdentity
def __init__(self, handler, resolutionIdentity, problem): UnconnectedRef.__init__(self, problem) self.handler = handler self.resolutionIdentity = resolutionIdentity
unboxedStrategies = [ makeUnboxedListStrategy(cls, box, unbox, exemplar) for (cls, box, unbox, exemplar) in [ # Chars. (CharObject, CharObject, unwrapChar, CharObject(u'▲')), # Small ints. (IntObject, IntObject, unwrapInt, IntObject(42)), # Unicode strings. (StrObject, StrObject, unwrapStr, StrObject(u"▲")), # Bytestrings. (BytesObject, BytesObject, unwrapBytes, BytesObject("M")), # _booleanFlow-generated lists of unconnected refs. (UnconnectedRef, UnconnectedRef, unboxUnconnectedRef, UnconnectedRef(StrObject(u"Implementation detail leaked"))), ] ] @rstrategies.strategy(generalize=[NullListStrategy] + unboxedStrategies + [GenericListStrategy]) class EmptyListStrategy(Strategy): """ A list with no elements. """ import_from_mixin(rstrategies.EmptyStrategy) class StrategyFactory(rstrategies.StrategyFactory):
def wrap(self, value): return UnconnectedRef(value)
def default_value(self): return UnconnectedRef(StrObject(u"Implementation detail leaked"))