Esempio n. 1
0
 def load_static_int(self, value: int) -> Value:
     """Loads a static integer Python 'int' object into a register."""
     if abs(value) > MAX_LITERAL_SHORT_INT:
         identifier = self.literal_static_name(value)
         return self.add(LoadGlobal(int_rprimitive, identifier, ann=value))
     else:
         return self.add(LoadInt(value))
Esempio n. 2
0
    def load_static_unicode(self, value: str) -> Value:
        """Loads a static unicode value into a register.

        This is useful for more than just unicode literals; for example, method calls
        also require a PyObject * form for the name of the method.
        """
        identifier = self.literal_static_name(value)
        return self.add(LoadGlobal(str_rprimitive, identifier, ann=value))
Esempio n. 3
0
 def load_static_complex(self, value: complex) -> Value:
     """Loads a static complex value into a register."""
     identifier = self.literal_static_name(value)
     return self.add(LoadGlobal(object_rprimitive, identifier, ann=value))
Esempio n. 4
0
 def load_static_float(self, value: float) -> Value:
     """Loads a static float value into a register."""
     identifier = self.literal_static_name(value)
     return self.add(LoadGlobal(float_rprimitive, identifier, ann=value))