Mailing List Archive

python/dist/src/Python symtable.c,2.10.8.8,2.10.8.9
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv9716/Python

Modified Files:
Tag: ast-branch
symtable.c
Log Message:
Experimental change: Add Param to expr_context.

It's convenient to represent a function's parameter list as a sequence
of expressions, because they can contain names or tuples. Rather than
re-using an existing expr_context for the names, make one explicitly
for this purpose.

There are some downsides: Must cover Param in all switch statements.
Param isn't used directly by the AST.


Index: symtable.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v
retrieving revision 2.10.8.8
retrieving revision 2.10.8.9
diff -C2 -d -r2.10.8.8 -r2.10.8.9
*** symtable.c 27 Sep 2002 23:13:38 -0000 2.10.8.8
--- symtable.c 2 Oct 2002 11:50:14 -0000 2.10.8.9
***************
*** 612,616 ****
symtable_visit_stmt(struct symtable *st, stmt_ty s)
{
- fprintf(stderr, "symtable %d %d\n", s->kind, s->lineno);
switch (s->kind) {
case FunctionDef_kind:
--- 612,615 ----
***************
*** 838,842 ****
expr_ty arg = asdl_seq_GET(args, i);
if (arg->kind == Name_kind) {
! assert(arg->v.Name.ctx == Load);
if (!symtable_add_def(st, arg->v.Name.id, DEF_PARAM))
return 0;
--- 837,841 ----
expr_ty arg = asdl_seq_GET(args, i);
if (arg->kind == Name_kind) {
! assert(arg->v.Name.ctx == Param);
if (!symtable_add_def(st, arg->v.Name.id, DEF_PARAM))
return 0;
***************
*** 853,859 ****
else {
/* syntax error */
return 0;
}
! }

return 1;
--- 852,859 ----
else {
/* syntax error */
+ fprintf(stderr, "unexpected expr in parameter list\n");
return 0;
}
! }

return 1;
***************
*** 872,876 ****
if (a->kwarg && !symtable_add_def(st, a->kwarg, DEF_PARAM))
return 0;
-
return 1;
}
--- 872,875 ----