| 99 | } |
| 100 | |
| 101 | void 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 |
no test coverage detected