Given the following code and result from Code.string_to_quoted/2
iex(4)> Code.string_to_quoted(~S'''
...(4)> defmodule Foo do
...(4)> use AnotherMod.Nested,
...(4)> some: :option
...(4)>
...(4)> def run(arg) do
...(4)> bar()
...(4)> :ok
...(4)> end
...(4)> end
...(4)> ''', columns: true, token_metadata: true)
{:ok,
{:defmodule,
[do: [line: 1, column: 21], end: [line: 9, column: 7], line: 1, column: 7],
[
{:__aliases__, [last: [line: 1, column: 17], line: 1, column: 17], [:Foo]},
[
do: {:__block__, [],
[
{:use,
[
end_of_expression: [newlines: 2, line: 3, column: 24],
line: 2,
column: 9
],
[
{:__aliases__, [last: [line: 2, column: 24], line: 2, column: 13],
[:AnotherMod, :Nested]},
[some: :option]
]},
{:def,
[
do: [line: 5, column: 22],
end: [line: 8, column: 9],
line: 5,
column: 9
],
[
{:run, [closing: [line: 5, column: 20], line: 5, column: 13],
[{:arg, [line: 5, column: 17], nil}]},
[
do: {:__block__, [],
[
{:bar,
[
end_of_expression: [newlines: 1, line: 6, column: 17],
closing: [line: 6, column: 15],
line: 6,
column: 11
], []},
:ok
]}
]
]}
]}
]
]}}
I am wondering what is the criteria that makes the use
call and the bar()
function call get an :end_of_expression
metadata, but not any of the other expressions?
I am not hoping for any particular answer, just want to know exactly how it works so I can reproduce it in Spitfire.
Thanks @josevalim.