| 807 | } |
| 808 | |
| 809 | void BindingsGenerator::_append_text_method(StringBuilder &p_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts) { |
| 810 | if (p_link_target_parts[0] == name_cache.type_at_GlobalScope) { |
| 811 | if (OS::get_singleton()->is_stdout_verbose()) { |
| 812 | OS::get_singleton()->print("Cannot resolve @GlobalScope method reference in documentation: %s\n", p_link_target.utf8().get_data()); |
| 813 | } |
| 814 | |
| 815 | /// @todo Map what we can |
| 816 | _append_text_undeclared(p_output, p_link_target); |
| 817 | } else if (!p_target_itype || !p_target_itype->is_object_type) { |
| 818 | if (OS::get_singleton()->is_stdout_verbose()) { |
| 819 | if (p_target_itype) { |
| 820 | OS::get_singleton()->print("Cannot resolve method reference for non-GodotObject type in documentation: %s\n", p_link_target.utf8().get_data()); |
| 821 | } else { |
| 822 | OS::get_singleton()->print("Cannot resolve type from method reference in documentation: %s\n", p_link_target.utf8().get_data()); |
| 823 | } |
| 824 | } |
| 825 | |
| 826 | /// @todo Map what we can |
| 827 | _append_text_undeclared(p_output, p_link_target); |
| 828 | } else { |
| 829 | if (p_target_cname == "_init") { |
| 830 | // The _init method is not declared in C#, reference the constructor instead |
| 831 | p_output.append("'new " BINDINGS_NAMESPACE "."); |
| 832 | p_output.append(p_target_itype->proxy_name); |
| 833 | p_output.append("()'"); |
| 834 | } else { |
| 835 | const MethodInterface *target_imethod = p_target_itype->find_method_by_name(p_target_cname); |
| 836 | |
| 837 | if (target_imethod) { |
| 838 | p_output.append("'" BINDINGS_NAMESPACE "."); |
| 839 | p_output.append(p_target_itype->proxy_name); |
| 840 | p_output.append("."); |
| 841 | p_output.append(target_imethod->proxy_name); |
| 842 | p_output.append("("); |
| 843 | bool first_key = true; |
| 844 | for (const ArgumentInterface &iarg : target_imethod->arguments) { |
| 845 | const TypeInterface *arg_type = _get_type_or_null(iarg.type); |
| 846 | |
| 847 | if (first_key) { |
| 848 | first_key = false; |
| 849 | } else { |
| 850 | p_output.append(", "); |
| 851 | } |
| 852 | if (!arg_type) { |
| 853 | ERR_PRINT("Cannot resolve argument type in documentation: '" + p_link_target + "'."); |
| 854 | p_output.append(iarg.type.cname); |
| 855 | continue; |
| 856 | } |
| 857 | if (iarg.def_param_mode == ArgumentInterface::NULLABLE_VAL) { |
| 858 | p_output.append("Nullable<"); |
| 859 | } |
| 860 | String arg_cs_type = arg_type->cs_type + _get_generic_type_parameters(*arg_type, iarg.type.generic_type_parameters); |
| 861 | p_output.append(arg_cs_type.replacen("params ", "")); |
| 862 | if (iarg.def_param_mode == ArgumentInterface::NULLABLE_VAL) { |
| 863 | p_output.append(">"); |
| 864 | } |
| 865 | } |
| 866 | p_output.append(")'"); |
nothing calls this directly
no test coverage detected