Created
June 13, 2021 08:18
-
-
Save isidentical/820863d5e97576c8bc06ca4fd8fefc28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Query: | |
FunctionDef(body=[*..., Return(Call())]) | |
AST: | |
Match( | |
name="FunctionDef", | |
filters={ | |
"body": List( | |
items=[ | |
Expand, | |
Match( | |
name="Return", | |
filters={ | |
"value": Match( | |
name="Call", | |
filters={}, | |
positional=True, | |
) | |
}, | |
positional=True, | |
), | |
] | |
) | |
}, | |
positional=True, | |
) | |
Generated IR: | |
SELECT ast::FunctionDef | |
FILTER ( | |
WITH | |
sequence_f1e35975 := array_agg(( | |
SELECT .body | |
ORDER BY @index | |
)) | |
SELECT sequence_f1e35975[-1][IS ast::Return].value IS ast::Call AND len(sequence_f1e35975) >= 1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment