MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / format_error

Method format_error

Source/Misc/luabind/src/function.cpp:101–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void invoke_context::format_error(
102 lua_State* L, function_object const* overloads) const
103{
104 char const* function_name =
105 overloads->name.empty() ? "<unknown>" : overloads->name.c_str();
106
107 if (candidate_index == 0)
108 {
109 lua_pushliteral(L, "No matching overload found, candidates:");
110 for (function_object const* f = overloads; f != 0; f = f->next)
111 {
112 lua_pushliteral(L, "\n");
113 f->format_signature(L, function_name);
114 lua_concat(L, 3); // Inefficient, but does not use up the stack.
115 }
116 }
117 else
118 {
119 // Ambiguous
120 lua_pushliteral(L, "Ambiguous, candidates:");
121 for (int i = 0; i < candidate_index; ++i)
122 {
123 lua_pushliteral(L, "\n");
124 candidates[i]->format_signature(L, function_name);
125 lua_concat(L, 3); // Inefficient, but does not use up the stack.
126 }
127 if (additional_candidates)
128 {
129 BOOST_ASSERT(candidate_index == max_candidates);
130 lua_pushfstring(L, "\nand %d additional overload(s) not shown",
131 additional_candidates);
132 lua_concat(L, 2);
133 }
134 }
135}
136
137}} // namespace luabind::detail

Callers 1

entry_pointMethod · 0.80

Calls 4

lua_concatFunction · 0.85
lua_pushfstringFunction · 0.85
format_signatureMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected