Changeset 4320:6a40b2bd478d in livinglogic.python.xist

Show
Ignore:
Timestamp:
02/08/11 13:16:52 (9 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

misc.javaexpr() can now handle large integers.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/misc.py

    r4319 r4320  
    530530    elif isinstance(obj, color.Color): 
    531531        return "new com.livinglogic.ul4.Color({}, {}, {}, {})".format(*obj) 
    532     elif isinstance(obj, (int, long, float)): 
     532    elif isinstance(obj, (int, float)): 
     533        return repr(obj) 
     534    elif isinstance(obj, long): 
     535        if -0x8000000 <= obj <= 0xffffffff: 
     536            return repr(obj).rstrip("lL") 
     537        elif -0x800000000000000 <= obj <= 0xffffffffffffffff: 
     538            return repr(obj) 
     539        else: 
     540            return 'new BigInteger("{}")'.format(obj) 
    533541        return repr(obj) 
    534542    elif isinstance(obj, collections.Sequence):