rev 539 - in trunk: pr/test src
SVN User <[email protected]> Sun, 23 May 2004 19:51:21 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-05-23 19:51:18 -0400 (Sun, 23 May 2004)
New Revision: 539
Modified:
trunk/pr/test/test.pr
trunk/src/interp.c
trunk/src/object.c
Log:
fixed bug in gen keyword
Modified: trunk/pr/test/test.pr
===================================================================
--- trunk/pr/test/test.pr 2004-05-23 22:36:07 UTC (rev 538)
+++ trunk/pr/test/test.pr 2004-05-23 23:51:18 UTC (rev 539)
@@ -1,31 +1,8 @@
#!/usr/bin/env prothon
-Animal = Object()
-with Animal:
- def describe():
- print "I am an animal."
- self.make_noise()
- def make_noise():
- print "I make animal noise."
-
-Mammal = Animal()
-with Mammal:
- def describe():
- print "I am a mammal."
- ante.describe()
- self.make_noise()
- def make_noise():
- print "I make mammal noise."
-
-Cat = Mammal()
-with Cat:
- def describe():
- print "I am a cat."
- Mammal.describe{self}()
- self.make_noise()
- def make_noise():
- print "meow"
-
-c = Cat()
-c.describe()
-
+gen foo():
+ for i in 10:
+ yield i
+
+for n in foo():
+ print n
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-05-23 22:36:07 UTC (rev 538)
+++ trunk/src/interp.c 2004-05-23 23:51:18 UTC (rev 539)
@@ -1032,8 +1032,9 @@
frame->dyn_locals, frame->locals,
func, NULL );
new_frame->gen_marker = TRUE;
- func->data.ptr = new_frame;
+ func->data.ptr = NULL;
switch_proto(ist, func, OBJ(GEN_PROTO));
+ func->data.ptr = new_frame;
}
set_item(ist, fr_stack[fr_sp], fr_stack[fr_sp+1], func);
} break;
Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c 2004-05-23 22:36:07 UTC (rev 538)
+++ trunk/src/object.c 2004-05-23 23:51:18 UTC (rev 539)
@@ -223,11 +223,11 @@
OBJ(PR_TRUE) = NEW_OBJ(NULL);
OBJ(NONE) = NEW_OBJ(NULL);
OBJ(EXCEPTION) = NEW_OBJ(NULL);
+ OBJ(FUNC_PROTO) = NEW_OBJ(NULL);
OBJ(GEN_PROTO) = NEW_OBJ(NULL);
OBJ(INT_PROTO) = NEW_OBJ(NULL);
OBJ(STRING_PROTO) = NEW_OBJ(OBJ(SEQ_PROTO));
OBJ(DICT_PROTO) = NEW_OBJ(NULL);
- OBJ(FUNC_PROTO) = NEW_OBJ(NULL);
OBJ(METHOD_PROTO) = NEW_OBJ(OBJ(FUNC_PROTO));
OBJ(SYMBOLS) = NEW_DICT(SYM_ENUM_COUNT+100);