NodePattern Debugger
Pattern
(begin ... $(ivasgn $_ivar (send (const nil? :T) :let (ivar _ivar) (send (const nil? :T) :nilable $_ivar_type))) $(or-asgn (ivasgn _ivar) $_initialization_expr) ... )
not matched
matched
not tested
argument
Matches
Current location set!
Make Permalink
Ruby Code
def foo some other code @foo = T.let(@foo, T.nilable(Foo)) @foo ||= Foo.new end
match
additional matches
closest non-match
Ruby AST
Quick
reference
(type child ...)
matches the type and the children of a node with the given patterns
$pat
captures the match
_
wildcard, matches anything
^pat
matches the pattern against the parent
_named
first is a wildcard, others must match
`pat
matches the pattern against the descendants
...
matches any number of children
predicate?(...)
calls `predicate?` on the element to match
int
calls `int_type?` on the element
#method(...)
calls `method` with element as first argument
pat* pat+ pat ?
matches a variable number of children
%1
matches sequential argument with `=== element`
<pat pat2>
matches the patterns in any order
%named_param
matches named argument with `=== element`
{pat pat2 | pat3}
matches either `pat pat2` or `pat 3`
%CONST
matches the constant with `=== element`
{pat pat2}
shortcut for "{pat | pat2}"
# comment
comment
[pat pat2]
matches all patterns