Resolve a pipe expression `$input |> callable(...)` to the callable's return type. The pipe operator passes `$input` as the first argument to `callable` and returns its result. Chains like `$a |> f(...) |> g(...)` are nested: the outer pipe's input is the inner pipe expression. Currently handles function-level callables (e.g. `createDate(...)`). Method and static method callables are not yet su
(pipe: &Pipe<'_>, ctx: &VarResolutionCtx<'_>)
| 657 | /// Currently handles function-level callables (e.g. `createDate(...)`). |
| 658 | /// Method and static method callables are not yet supported. |
| 659 | fn resolve_rhs_pipe(pipe: &Pipe<'_>, ctx: &VarResolutionCtx<'_>) -> Vec<ResolvedType> { |
| 660 | // The callable determines the result type. |
| 661 | // For `PartialApplication::Function`, extract the function name |
| 662 | // and look up its return type. |
| 663 | match pipe.callable { |
| 664 | Expression::PartialApplication(PartialApplication::Function(fpa)) => { |
| 665 | let func_name = match fpa.function { |
| 666 | Expression::Identifier(ident) => ident.value().to_string(), |
| 667 | _ => return vec![], |
| 668 | }; |
| 669 | if let Some(fl) = ctx.function_loader() |
| 670 | && let Some(func_info) = fl(&func_name) |
| 671 | && let Some(ref ret) = func_info.return_type |
| 672 | { |
| 673 | return ResolvedType::from_classes_with_hint( |
| 674 | crate::completion::type_resolution::type_hint_to_classes_typed( |
| 675 | ret, |
| 676 | &ctx.current_class.name, |
| 677 | ctx.all_classes, |
| 678 | ctx.class_loader, |
| 679 | ), |
| 680 | ret.clone(), |
| 681 | ); |
| 682 | } |
| 683 | vec![] |
| 684 | } |
| 685 | // Method callable: `$input |> $obj->method(...)` |
| 686 | // Static callable: `$input |> Class::method(...)` |
| 687 | // Not yet supported — fall back to empty. |
| 688 | _ => vec![], |
| 689 | } |
| 690 | } |
| 691 | |
| 692 | /// Resolve `new ClassName(…)` to the instantiated class. |
| 693 | fn resolve_rhs_instantiation( |
no test coverage detected