Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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