diff options
author | Walter Bender <walter@sugarlabs.org> | 2013-11-26 09:55:02 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2013-11-26 09:55:02 (GMT) |
commit | 770864358ab20d94288ad95ef7f8fb4d4ea7e062 (patch) | |
tree | 4a09cc001ab6934157e13ac5e644502d735ef473 /TurtleArt/taprimitive.py | |
parent | 6675f1181529a6c893ee5c6f3244e73801f93f26 (diff) |
resync with 194
Diffstat (limited to 'TurtleArt/taprimitive.py')
-rw-r--r-- | TurtleArt/taprimitive.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/TurtleArt/taprimitive.py b/TurtleArt/taprimitive.py index b689de5..197a8d8 100644 --- a/TurtleArt/taprimitive.py +++ b/TurtleArt/taprimitive.py @@ -373,7 +373,15 @@ class Primitive(object): loop_ast = ast.While(test=condition_ast, body=new_arg_asts[1], orelse=[]) - return loop_ast + # Until always executes its body once. + if controller == Primitive.controller_until: + loop_list = [] + for arg_ast in new_arg_asts[1]: + loop_list.append(arg_ast) + loop_list.append(loop_ast) + return loop_list + else: + return loop_ast # conditionals elif self in (LogoCode.prim_if, LogoCode.prim_ifelse): @@ -494,6 +502,10 @@ class Primitive(object): return [get_call_ast('logo.prim_turtle', new_arg_asts), ast_extensions.ExtraCode(text)] + elif self == LogoCode.active_turtle: + text = 'turtle = turtles.get_active_turtle()' + return ast_extensions.ExtraCode(text) + # comment elif self == Primitive.comment: if isinstance(new_arg_asts[0], ast.Str): |