diff Python/ast.c @ 35759:d91ed7107fd2 legacy-trunk

ANSI-C-ify the placement of local var declarations.
author Armin Rigo <arigo@tunes.org>
date Fri, 21 Oct 2005 12:57:31 +0000
parents 25ba2f3313c9
children 044d8e0f65f2
line wrap: on
line diff
--- a/Python/ast.c	Fri Oct 21 11:45:01 2005 +0000
+++ b/Python/ast.c	Fri Oct 21 12:57:31 2005 +0000
@@ -512,14 +512,14 @@
 seq_for_testlist(struct compiling *c, const node *n)
 {
     /* testlist: test (',' test)* [','] */
+    asdl_seq *seq;
+    expr_ty expression;
+    int i;
     assert(TYPE(n) == testlist
 	   || TYPE(n) == listmaker
 	   || TYPE(n) == testlist_gexp
 	   || TYPE(n) == testlist_safe
 	   );
-    asdl_seq *seq;
-    expr_ty expression;
-    int i;
 
     seq = asdl_seq_new((NCH(n) + 1) / 2);
     if (!seq)
@@ -641,12 +641,13 @@
                                     compiler_complex_args(CHILD(ch, 1))); 
 		}
                 else if (TYPE(CHILD(ch, 0)) == NAME) {
+		    expr_ty name;
 		    if (!strcmp(STR(CHILD(ch, 0)), "None")) {
 			    ast_error(CHILD(ch, 0), "assignment to None");
 			    goto error;
 		    }
-                    expr_ty name = Name(NEW_IDENTIFIER(CHILD(ch, 0)),
-                                        Param, LINENO(ch));
+                    name = Name(NEW_IDENTIFIER(CHILD(ch, 0)),
+                                Param, LINENO(ch));
                     if (!name)
                         goto error;
                     asdl_seq_APPEND(args, name);
@@ -1897,12 +1898,13 @@
 	if (!targets)
 	    return NULL;
 	for (i = 0; i < NCH(n) - 2; i += 2) {
+	    expr_ty e;
 	    node *ch = CHILD(n, i);
 	    if (TYPE(ch) == yield_expr) {
 		ast_error(ch, "assignment to yield expression not possible");
 		goto error;
 	    }
-	    expr_ty e = ast_for_testlist(c, ch, 0);
+	    e = ast_for_testlist(c, ch, 0);
 
 	    /* set context to assign */
 	    if (!e)