Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tatype.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/tatype.py')
-rw-r--r--TurtleArt/tatype.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/TurtleArt/tatype.py b/TurtleArt/tatype.py
index 86119b6..0fcd74c 100644
--- a/TurtleArt/tatype.py
+++ b/TurtleArt/tatype.py
@@ -77,6 +77,9 @@ TYPE_STRING = Type('string', 9)
# TODO add list types
+BOX_AST = ast.Name(id='BOX', ctx=ast.Load)
+ACTION_AST = ast.Name(id='ACTION', ctx=ast.Load)
+
def get_type(x):
""" Return the most specific type in the type hierarchy that applies to x
and a boolean indicating whether x is an AST. If the type cannot be
@@ -113,6 +116,12 @@ def get_type(x):
return (TYPE_OBJECT, True)
else:
return (get_type(value)[0], True)
+ elif isinstance(x, ast.Subscript):
+ if x.value == BOX_AST:
+ return (TypeDisjunction((TYPE_OBJECT, TYPE_STRING, TYPE_NUMBER,
+ TYPE_FLOAT, TYPE_INT, TYPE_NUMERIC_STRING, TYPE_CHAR,
+ TYPE_COLOR)), True)
+ # TODO elif x.value == ACTION_AST:
elif isinstance(x, ast.Call):
if isinstance(x.func, ast.Name):
if x.func.id == 'float':