Closed IagoAbal closed 2 years ago
This mimics what our tree-sitter front-end does, so both pattern and code result in Generic ASTs that can be matched.
It's OK-ish to use an unsafe fake token because we only use Pfff to parse patterns.
Helps PA-1149
test plan:
% cat pa1149.sgrep ({$VAR} : $REQ) => {...} % pfff -dump_ts pa1149.sgrep [(ExprStmt ( (Fun ( { f_kind = (AST_generic_.Arrow, ()); f_attrs = []; f_params = [(ParamPattern (Cast ( (Obj ((), [(FieldColon { fld_name = (PN ("$VAR", ())); fld_attrs = []; fld_type = None; fld_body = (Some (Id ("$VAR", ()))) }) ], ())), (), (TyName [("$REQ", ())])))) ]; f_rettype = None; f_body = (Block ((), [(ExprStmt ((Ellipsis ()), ()))], ())) }, None)), ())) ]
This mimics what our tree-sitter front-end does, so both pattern and code result in Generic ASTs that can be matched.
It's OK-ish to use an unsafe fake token because we only use Pfff to parse patterns.
Helps PA-1149
test plan:
Security