Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add generators support#177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
php-pulls merged 74 commits intophp:masterfromnikic:addGeneratorsSupport
Sep 1, 2012
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
74 commits
Select commitHold shift + click to select a range
9b101ac
Add T_YIELD "yield" keyword
nikicMay 15, 2012
252f623
Add flag for generator functions
nikicMay 19, 2012
9b51a3b
Minor code cleanup
nikicMay 19, 2012
fd2a109
Add error if yield is used outside a generator
nikicMay 19, 2012
e14cfaf
Add zend_do_suspend_if_generator calls
nikicMay 19, 2012
1cec3f1
Add ZEND_SUSPEND_AND_RETURN_GENERATOR opcode
nikicMay 19, 2012
ca59e54
Add empty Generator class
nikicMay 19, 2012
40b7533
Add some boilerplate code for Generator class
nikicMay 20, 2012
46fa26a
Make generator functions return a Generator object
nikicMay 20, 2012
5e763d9
Allocate execute_data using malloc for generators
nikicMay 22, 2012
9ce9a7e
Add initial code for suspending execution
nikicMay 23, 2012
2c5ecb4
Add dummy Iterator implementation
nikicMay 23, 2012
ececcbc
Allow calling zend_vm_gen from everywhere
nikicMay 23, 2012
f627be5
Add support for executing a zend_execute_data
nikicMay 26, 2012
1a99d1c
Add way to pass generator object to opcode handlers
nikicMay 26, 2012
fafce58
Add YIELD opcode implementation
nikicMay 26, 2012
5bb3a99
Implement return for generators
nikicMay 26, 2012
d49d397
Close generator on return
nikicMay 26, 2012
cbfa96c
Remove wrong dtor call
nikicMay 26, 2012
39d3d5e
Add first real generator test
nikicMay 26, 2012
247bb73
Add support for generator methods
nikicMay 27, 2012
64a643a
Free loop variables
nikicMay 27, 2012
9f52c5c
Fix generator creation when execute_data is not nested
nikicMay 27, 2012
bcc7d97
Set EG(current_execute_data)
nikicMay 27, 2012
4aab08b
Properly free resources when generator return value not used
nikicMay 28, 2012
b770b22
Make the GOTO and SWITCH VMs work again
nikicMay 29, 2012
3600914
Add support for $generator->send()
nikicMay 29, 2012
ad525c2
Allow to use yield without value
nikicMay 29, 2012
12e9283
Fix segfault when send()ing to a closed generator
nikicMay 29, 2012
72a91d0
Add $generator->close() method
nikicMay 29, 2012
bc08c2c
Add support for yielding keys
nikicMay 30, 2012
8790160
Add auto-increment keys
nikicMay 30, 2012
0033a52
Allow throwing exceptions from generators
nikicMay 30, 2012
ee89e22
Allow yielding during function calls
nikicMay 30, 2012
1477be9
Make $generator->send() return the current value
nikicMay 31, 2012
6117f4c
Add cloning support for generators
nikicJun 2, 2012
7b3bfa5
Improve backtraces from generators
nikicJun 3, 2012
bf82f46
Properly handle yield during method calls
nikicJun 3, 2012
40760ec
Fix cloning of generator methods
nikicJun 3, 2012
f169b26
Fix backtraces and func_get_args()
nikicJun 8, 2012
d939d2d
Add sceleton for yield* expression
nikicJun 11, 2012
6233408
Fix thread safe build
nikicJun 20, 2012
1d3f37d
Fix segfault in method test
nikicJun 22, 2012
04e781f
Implement get_iterator
nikicJun 22, 2012
14766e1
Pass zend_generator directly to Zend VM
nikicJun 23, 2012
ab75ed6
Disallow closing a generator during its execution
nikicJun 23, 2012
5a9bddb
Forgot to git add two tests
nikicJun 25, 2012
85f077c
Add support by yielding by-reference
nikicJul 17, 2012
c9709bf
Remove asterix modifier (*) for generators
nikicJul 19, 2012
612c249
Move a variable
nikicJul 20, 2012
1f70a4c
Add some more tests
nikicJul 20, 2012
8074863
Require parenthesis around yield expressions
nikicJul 21, 2012
de80e3c
Remove reference restrictions from foreach
nikicJul 22, 2012
94b2cca
Fix throwing of exceptions within a generator
nikicJul 22, 2012
1340893
Throw error also for return occuring before yield
nikicJul 22, 2012
99f93dd
Add T_YIELD in tokenizer_data.c
nikicJul 22, 2012
268740d
Fix implementation of Iterator interface
nikicJul 26, 2012
f4ce364
Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport
nikicAug 13, 2012
ae71693
Support trivial finally in generators (no yield, no return)
nikicAug 13, 2012
7195a5b
Forgot to add test
nikicAug 13, 2012
05f1048
Drop Generator::close() method
nikicAug 20, 2012
9003cd1
Fix zts build (typo)
nikicAug 20, 2012
1823b16
Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport
nikicAug 20, 2012
f45a0f3
Disallow serialization and unserialization
nikicAug 20, 2012
6517ed0
Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport
nikicAug 24, 2012
68c1e1c
Add dedicated opcode for returns from a generator
nikicAug 24, 2012
7cdf636
Finally with return now works in generators too
nikicAug 24, 2012
4d8edda
Run finally if generator is closed before finishing
nikicAug 24, 2012
f53225a
Fix several issues and allow rewind only at/before first yield
nikicAug 25, 2012
bd70d15
Remove implementation stubs for yield delegation
nikicAug 25, 2012
d60e3c6
Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport
nikicAug 25, 2012
cc07038
Make sure that exception is thrown on rewind() after closing too
nikicAug 29, 2012
bef7958
Fix segfault when traversing a by-ref generator twice
nikicAug 29, 2012
dbc7809
Fix typos
nikicAug 29, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Fix segfault when send()ing to a closed generator
  • Loading branch information
@nikic
nikic committedMay 29, 2012
commit12e928314fb270db31adc361ac4993b4f0fe000a
14 changes: 14 additions & 0 deletionsZend/tests/generators/send_after_close.phpt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
--TEST--
Calls to send() after close should do nothing
--FILE--
<?php

function *gen() { }

$gen = gen();
$gen->send("Test");

?>
===DONE===
--EXPECT--
===DONE===
5 changes: 5 additions & 0 deletionsZend/zend_generators.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -308,6 +308,11 @@ ZEND_METHOD(Generator, send)

zend_generator_ensure_initialized(object, generator TSRMLS_CC);

/* The generator is already closed, thus can't send anything */
if (!generator->execute_data) {
return;
}

/* The sent value was initialized to NULL, so dtor that */
zval_ptr_dtor(generator->send_target->var.ptr_ptr);

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp