public static Type . Callable substitute ( Type . Callable fmp , Tuple < Template . Variable > templateParameters , Tuple < SyntacticItem > templateArguments ) { Function < Identifier , SyntacticItem > binding = WyilFile . bindingFunction ( templateParameters , templateArguments ) ; // Proceed with the potentially updated binding Tuple < Type > parameters = WyilFile . substitute ( fmp . getParameters ( ) , binding ) ; Tuple < Type > returns = WyilFile . substitute ( fmp . getReturns ( ) , binding ) ; // if ( fmp instanceof Type . Method ) { Type . Method m = ( Type . Method ) fmp ; // FIXME: this looks wrong!!! return new Type . Method ( parameters , returns , m . getCapturedLifetimes ( ) , new Tuple <> ( ) ) ; } else if ( fmp instanceof Type . Function ) { return new Type . Function ( parameters , returns ) ; } else { return new Type . Property ( parameters , returns ) ; } }
Apply an explicit binding to a given function method or property declaration via substitution . Observe we cannot just use the existing Type . substitute method as this accounts for lifetime captures . Therefore we first build the binding and then apply it to each of the parameters and returns .