File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2856,10 +2856,55 @@ nodes:
28562856 fields :
28572857 - name : value
28582858 type : node
2859+ comment : |
2860+ Represents the left-hand side of the operator, and can be any kind of Ruby expression.
2861+
2862+ foo => bar
2863+ ^^^
28592864 - name : pattern
28602865 type : node
2866+ comment : |
2867+ Represents the right-hand side of the operator. The type of the node depends on the expression.
2868+
2869+ Anything that looks like a local variable name (including `_`) will result in a `LocalVariableTargetNode`.
2870+
2871+ foo => a # This is equivalent to writing `a = foo`
2872+ ^
2873+
2874+ Using an explicit `Array` or combining expressions with `,` will result in a `ArrayPatternNode`. This can be preceded by a constant.
2875+
2876+ foo => [a]
2877+ ^^^
2878+
2879+ foo => a, b
2880+ ^^^^
2881+
2882+ foo => Bar[a, b]
2883+ ^^^^^^^^^
2884+
2885+ If the array pattern contains at least two wildcard matches, a `FindPatternNode` is created instead.
2886+
2887+ foo => *, *a
2888+ ^^^^^
2889+
2890+ Using an explicit `Hash` or a constant with square brackets and hash keys in the square brackets will result in a `HashPatternNode`.
2891+
2892+ foo => { a: 1, b: }
2893+
2894+ foo => Bar[a: 1, b:]
2895+
2896+ foo => Bar[**]
2897+
2898+ Anything else will result in the regular node for that expression, for example a `ConstantReadNode`.
2899+
2900+ foo => CONST
28612901 - name : operator_loc
28622902 type : location
2903+ comment : |
2904+ The location of the operator.
2905+
2906+ foo => bar
2907+ ^^
28632908 comment : |
28642909 Represents the use of the `=>` operator.
28652910
You can’t perform that action at this time.
0 commit comments