File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1597,9 +1597,22 @@ defmodule Macro do
1597
1597
1598
1598
@ doc """
1599
1599
Returns `true` if the given name and arity is an operator.
1600
+
1601
+ ## Examples
1602
+
1603
+ iex> Macro.operator?(:not_an_operator, 3)
1604
+ false
1605
+ iex> Macro.operator?(:+, 1)
1606
+ true
1607
+ iex> Macro.operator?(:++, 2)
1608
+ true
1609
+ iex> Macro.operator?(:..//, 3)
1610
+ true
1611
+
1600
1612
"""
1601
1613
@ doc since: "1.7.0"
1602
1614
@ spec operator? ( name :: atom ( ) , arity ( ) ) :: boolean ( )
1615
+ def operator? ( :"..//" , 3 ) , do: true
1603
1616
def operator? ( name , 2 ) when is_atom ( name ) , do: Identifier . binary_op ( name ) != :error
1604
1617
def operator? ( name , 1 ) when is_atom ( name ) , do: Identifier . unary_op ( name ) != :error
1605
1618
def operator? ( name , arity ) when is_atom ( name ) and is_integer ( arity ) , do: false
You can’t perform that action at this time.
0 commit comments