diff options
author | Walter Bender <walter@sugarlabs.org> | 2013-11-25 08:52:11 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2013-11-25 08:52:11 (GMT) |
commit | e4eb6a3bcd543ec93baa26eb616347ae4bf18d73 (patch) | |
tree | f490f23c9445150fbaf59e787fb93f42b55e69be | |
parent | 83bd51b4a33c023dd9b4056a00b049065e89a9a5 (diff) |
fix problem with until in exported Python code
-rw-r--r-- | TurtleArt/taprimitive.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/TurtleArt/taprimitive.py b/TurtleArt/taprimitive.py index 99b1236..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): @@ -486,12 +494,6 @@ class Primitive(object): new_ast = value_to_ast(prim) if isinstance(new_ast, ast.AST): ast_list.append(new_ast) - ''' - # Fix Me: only needed for clean group - if self == Primitive.group: - text = 'turtle = turtles.get_active_turtle()' - ast_list.append(ast_extensions.ExtraCode(text)) - ''' return ast_list # set turtle |