Skip to content

Commit 21921dc

Browse files
committed
Simplify escaping logic by reducing the number of vars
1 parent a4429ac commit 21921dc

File tree

4 files changed

+96
-99
lines changed

4 files changed

+96
-99
lines changed

lib/elixir/lib/kernel/utils.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ defmodule Kernel.Utils do
120120
mapper = fn
121121
{key, val} when is_atom(key) ->
122122
try do
123-
:elixir_quote.escape(val, false, :none)
123+
:elixir_quote.escape(val, :none, false)
124124
rescue
125125
e in [ArgumentError] ->
126126
raise ArgumentError, "invalid value for struct field #{key}, " <> Exception.message(e)

lib/elixir/lib/macro/env.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ defmodule Macro.Env do
103103

104104
# Define the __struct__ callbacks by hand for bootstrap reasons.
105105
{struct, [], kv, body} = Kernel.Utils.defstruct(__MODULE__, fields, false, __ENV__)
106-
def __struct__(), do: unquote(:elixir_quote.escape(struct, false, :none))
106+
def __struct__(), do: unquote(:elixir_quote.escape(struct, :none, false))
107107
def __struct__(unquote(kv)), do: unquote(body)
108108

109109
@doc """

lib/elixir/src/elixir_expand.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ expand({quote, Meta, [Opts, Do]}, S, E) when is_list(Do) ->
207207
Unquote = proplists:get_value(unquote, EOpts, DefaultUnquote),
208208
Generated = proplists:get_value(generated, EOpts, false),
209209

210-
{Q, Prelude} = elixir_quote:build(Meta, Line, File, Context, Unquote, Generated),
211-
Quoted = elixir_quote:quote(Meta, Exprs, Binding, Q, Prelude, ET),
210+
{Q, Prelude} = elixir_quote:build(Meta, Line, File, Context, Unquote, Generated, ET),
211+
Quoted = elixir_quote:quote(Meta, Exprs, Binding, Q, Prelude),
212212
expand(Quoted, ST, ET);
213213

214214
expand({quote, Meta, [_, _]}, _S, E) ->

0 commit comments

Comments
 (0)