fix issues with builtin_function()

This does several things. It fixes `builtin_function()` so that errors it
emits are displayed. As part of doing that I've removed the unnecessary
`out_err` parameter to make the interface like every other builtin.

This also fixes a regression introduced by #4000 which was attempting to
fix a bug introduced by #3649.

Fixes #4139
This commit is contained in:
Kurtis Rader
2017-06-17 22:36:56 -07:00
parent 0e954e4764
commit 385e40540c
7 changed files with 38 additions and 45 deletions

View File

@@ -29,13 +29,13 @@ static bool production_is_empty(const production_element_t *production) {
/// Returns a string description of this parse error.
wcstring parse_error_t::describe_with_prefix(const wcstring &src, const wcstring &prefix,
bool is_interactive, bool skip_caret) const {
if (skip_caret || source_start >= src.size() || source_start + source_length > src.size()) {
return L"";
}
wcstring result = prefix;
result.append(this->text);
if (skip_caret || source_start >= src.size() || source_start + source_length > src.size()) {
return result;
}
// Locate the beginning of this line of source.
size_t line_start = 0;
@@ -69,7 +69,7 @@ wcstring parse_error_t::describe_with_prefix(const wcstring &src, const wcstring
}
// Append the line of text.
result.push_back(L'\n');
if (!result.empty()) result.push_back(L'\n');
result.append(src, line_start, line_end - line_start);
// Append the caret line. The input source may include tabs; for that reason we