diff options
author | Marion <marion.zepf@gmail.com> | 2013-09-05 21:59:04 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-09-05 21:59:04 (GMT) |
commit | 5066005a384b8f3ea2baa4dbf18d10b9c491e843 (patch) | |
tree | 5058a8015d3927e6d6836e3cf15e67f1a5246a8e | |
parent | 90dad2ec57b9110b1e2ec6f46539edf41cfe2e99 (diff) |
add ord() and chr() to Call ASTs recognized by get_type(...)
-rw-r--r-- | TurtleArt/tatype.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/TurtleArt/tatype.py b/TurtleArt/tatype.py index cf75e44..055fc2f 100644 --- a/TurtleArt/tatype.py +++ b/TurtleArt/tatype.py @@ -122,8 +122,10 @@ def get_type(x): if isinstance(x.func, ast.Name): if x.func.id == 'float': return (TYPE_FLOAT, True) - if x.func.id == 'int': + elif x.func.id in ('int', 'ord'): return (TYPE_INT, True) + elif x.func.id == 'chr': + return (TYPE_CHAR, True) elif x.func.id in ('repr', 'str', 'unicode'): return (TYPE_STRING, True) # unary operands never change the type of their argument |