Filter out falsy nodes in blocks#85
Conversation
|
Hi @motiz88, Thanks for the fix. I've digged into the issue, it's caused by this code : https://github.com/glayzzle/php-parser/blob/master/src/parser/statement.js#L317 It can also be reproduced by this code : <?php if (true): ; ; ?>
<?php endif; ?>The actual fix works on every case, but may slow down a bit the AST building process. I'm looking at a more early filtering solution. On the other hand, the bracket I've also found a helper here https://github.com/glayzzle/php-parser/blob/master/src/parser/utils.js#L15 used on loops (could be fixed and used with multiple tokens) Do you want to digg more ? If you don't have the time I can merge the fix and continue to correct accordingly. |
Fixes #84 and adds a regression test. This is perhaps a crude fix, as I chose not to hunt down the specific
null-producing cases in e.g.parser/if.js, but rather to remove them after the fact in theBlockconstructor.