@@ -156,12 +156,14 @@ defmodule Membrane.Core.Parent.ChildLifeController.LinkUtils do
156156 links =
157157 Enum . map (
158158 links ,
159- & % Link {
160- & 1
161- | spec_ref: spec_ref ,
162- from: resolve_endpoint ( & 1 . from , state ) ,
163- to: resolve_endpoint ( & 1 . to , state )
164- }
159+ fn % Link { } = link ->
160+ % Link {
161+ link
162+ | spec_ref: spec_ref ,
163+ from: resolve_endpoint ( link . from , state ) ,
164+ to: resolve_endpoint ( link . to , state )
165+ }
166+ end
165167 )
166168
167169 :ok = validate_links ( links , state )
@@ -235,13 +237,12 @@ defmodule Membrane.Core.Parent.ChildLifeController.LinkUtils do
235237 end
236238 end
237239
238- defp resolve_endpoint ( endpoint , state ) do
239- % Endpoint { child: child , pad_spec: pad_spec } = endpoint
240- child_data = Parent.ChildrenModel . get_child_data! ( state , child )
241- pad_name = Pad . name_by_ref ( pad_spec )
240+ defp resolve_endpoint ( % Endpoint { } = endpoint , state ) do
241+ child_data = Parent.ChildrenModel . get_child_data! ( state , endpoint . child )
242+ pad_name = Pad . name_by_ref ( endpoint . pad_spec )
242243
243244 withl pad: { :ok , pad_info } <- Keyword . fetch ( child_data . module . membrane_pads ( ) , pad_name ) ,
244- ref: { :ok , ref } <- make_pad_ref ( pad_spec , pad_info . availability ) do
245+ ref: { :ok , ref } <- make_pad_ref ( endpoint . pad_spec , pad_info . availability ) do
245246 % Endpoint {
246247 endpoint
247248 | pid: child_data . pid ,
@@ -251,11 +252,12 @@ defmodule Membrane.Core.Parent.ChildLifeController.LinkUtils do
251252 }
252253 else
253254 pad: :error ->
254- raise LinkError , "Child #{ inspect ( child ) } does not have pad #{ inspect ( pad_spec ) } "
255+ raise LinkError ,
256+ "Child #{ inspect ( endpoint . child ) } does not have pad #{ inspect ( endpoint . pad_spec ) } "
255257
256258 ref: { :error , :invalid_availability } ->
257259 raise LinkError ,
258- "Dynamic pad ref #{ inspect ( pad_spec ) } passed for static pad of child #{ inspect ( child ) } "
260+ "Dynamic pad ref #{ inspect ( endpoint . pad_spec ) } passed for static pad of child #{ inspect ( endpoint . child ) } "
259261 end
260262 end
261263
0 commit comments