[Python-checkins] python/dist/src/Python newcompile.c,1.1.2.33,1.1.2.34
nnorwitz@users.sourceforge.net
nnorwitz@users.sourceforge.net
Tue, 25 Mar 2003 12:18:01 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv3835/Python
Modified Files:
Tag: ast-branch
newcompile.c
Log Message:
implement simple import stmt
Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.33
retrieving revision 1.1.2.34
diff -C2 -d -r1.1.2.33 -r1.1.2.34
*** newcompile.c 25 Mar 2003 19:57:40 -0000 1.1.2.33
--- newcompile.c 25 Mar 2003 20:17:57 -0000 1.1.2.34
***************
*** 818,821 ****
--- 818,841 ----
static int
+ compiler_import(struct compiler *c, stmt_ty s)
+ {
+ int i, n = asdl_seq_LEN(s->v.Import.names);
+ for (i = 0; i < n; i++) {
+ alias_ty alias = asdl_seq_GET(s->v.Import.names, i);
+ identifier store_name;
+ ADDOP_O(c, LOAD_CONST, Py_None, consts);
+ ADDOP_O(c, IMPORT_NAME, alias->name, varnames);
+
+ store_name = alias->name;
+ if (alias->asname)
+ store_name = alias->asname;
+
+ if (!compiler_nameop(c, store_name, Store))
+ return 0;
+ }
+ return 1;
+ }
+
+ static int
compiler_assert(struct compiler *c, stmt_ty s)
{
***************
*** 923,927 ****
return compiler_assert(c, s);
case Import_kind:
! break;
case ImportFrom_kind:
break;
--- 943,947 ----
return compiler_assert(c, s);
case Import_kind:
! return compiler_import(c, s);
case ImportFrom_kind:
break;