IIFE

因为引入AST原因, IIFE立即执行函数成为合法语法:


$gen = (function() { yield; }) ();
var_dump($gen);
Output for hhvm-3.12.14 - 3.18.1, 7.0.0 - 7.1.3
object(Generator)#2 (0) {
}
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '(' in /in/KRjVD on line 3

Process exited with code 255.

results matching ""

    No results matching ""