From 85257585836b7062e3d6d0ddd29fb3d5f6570b49 Mon Sep 17 00:00:00 2001 From: syeopite Date: Wed, 8 Nov 2023 00:19:24 -0800 Subject: [PATCH 1/3] Use #splat method for macro expressions --- src/invidious/helpers/errors.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index 6e5a975d..a94a1991 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -3,7 +3,7 @@ # ------------------- macro error_template(*args) - error_template_helper(env, {{*args}}) + error_template_helper(env, {{args.splat}}) end def github_details(summary : String, content : String) From 8ce91166d66ff93a0ef791fcc7f53f7ae94f8271 Mon Sep 17 00:00:00 2001 From: syeopite Date: Wed, 8 Nov 2023 00:42:46 -0800 Subject: [PATCH 2/3] Remove instance of the * operator in macro expr --- src/invidious/helpers/errors.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index a94a1991..70850063 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -121,7 +121,7 @@ end # ------------------- macro error_json(*args) - error_json_helper(env, {{*args}}) + error_json_helper(env, {{args.splat}}) end def error_json_helper( From ed8b84ed15616cd269ff5759fcc1fa5150259db8 Mon Sep 17 00:00:00 2001 From: syeopite Date: Wed, 8 Nov 2023 00:49:37 -0800 Subject: [PATCH 3/3] Replace more * in macro with #splat --- src/invidious/channels/channels.cr | 2 +- src/invidious/config.cr | 2 +- src/invidious/helpers/errors.cr | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr index c3d6124f..be739673 100644 --- a/src/invidious/channels/channels.cr +++ b/src/invidious/channels/channels.cr @@ -93,7 +93,7 @@ struct ChannelVideo def to_tuple {% begin %} { - {{*@type.instance_vars.map(&.name)}} + {{@type.instance_vars.map(&.name).splat}} } {% end %} end diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 429d9246..d5d5f2f2 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -48,7 +48,7 @@ struct ConfigPreferences def to_tuple {% begin %} { - {{*@type.instance_vars.map { |var| "#{var.name}: #{var.name}".id }}} + {{(@type.instance_vars.map { |var| "#{var.name}: #{var.name}".id }).splat}} } {% end %} end diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index 70850063..21b789bc 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -95,7 +95,7 @@ end # ------------------- macro error_atom(*args) - error_atom_helper(env, {{*args}}) + error_atom_helper(env, {{args.splat}}) end def error_atom_helper(env : HTTP::Server::Context, status_code : Int32, exception : Exception)