eval(...) doesn't match but var $X = eval(...) does
See https://sgrep.live/KA5 has no matches but https://sgrep.live/WG2 does
Started working after removing ; after exec()
https://sgrep.live/oZ0
Still confusing behavior so we should either have a clearer debug message in the AST tree dump or warn about this @mschwager
Yes, it's because without the ';' it's parsed as an expression pattern, and the visitor looks for every expressions, including expressions nested inside var defs.
With the ';' it's parsed as an expression statement (ExprStmt), and even though we do implicitely deep expression matching for ExprStmt, we do not go in VarDef (I'll fix that).
Note that you will now need eval(..., <... $REQ ...>, ...) though because we don't do implicit deep expression matching (except for ExmtStmt).
This makes me think that a very nice feature would be to tell people about partial match when they don't find anything. This can help them refine the rule.
Most helpful comment
This makes me think that a very nice feature would be to tell people about partial match when they don't find anything. This can help them refine the rule.