From 9b9daea70ef6883b6fcdc0bfc69d5f429546f4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Tue, 6 Mar 2018 19:47:43 +0000 Subject: [PATCH] Fix `spawn` macro for call with receiver --- spec/std/concurrent_spec.cr | 4 ++++ src/concurrent.cr | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/std/concurrent_spec.cr b/spec/std/concurrent_spec.cr index 5623c3117e02..1fd0a67c1799 100644 --- a/spec/std/concurrent_spec.cr +++ b/spec/std/concurrent_spec.cr @@ -41,4 +41,8 @@ describe "concurrent" do spawn method_named("foo"), name: "foo" Fiber.yield end + + it "accepts method call with receiver" do + typeof(spawn String.new) + end end diff --git a/src/concurrent.cr b/src/concurrent.cr index fb52a3a46335..20680ccefb29 100644 --- a/src/concurrent.cr +++ b/src/concurrent.cr @@ -105,7 +105,7 @@ macro spawn(call, *, name = nil) {% end %} ) { spawn(name: {{name}}) do - {{call.name}}( + {% if call.receiver %}{{ call.receiver }}.{% end %}{{call.name}}( {% for arg, i in call.args %} __arg{{i}}, {% end %}