mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2026-01-25 21:17:11 +00:00
result / optional return type modifiers for functions (one for all returns)
This commit is contained in:
parent
68463509d8
commit
195a26f9b7
10 changed files with 74 additions and 36 deletions
|
|
@ -16,15 +16,18 @@ inline void print_position(std::ostream &out,
|
|||
<< ']';
|
||||
}
|
||||
|
||||
inline void
|
||||
handle_internal_error(const std::string &message,
|
||||
std::optional<const nodes::Node *> node = std::nullopt) {
|
||||
std::cerr << "\x1b[1;31mInternal Error:\x1b[0m " << message;
|
||||
if (node.has_value()) {
|
||||
std::cerr << " at ";
|
||||
print_position(std::cerr, node.value()->get_start_position(),
|
||||
node.value()->get_end_position());
|
||||
}
|
||||
inline void handle_internal_error(const std::string &message,
|
||||
const nodes::Node &node) {
|
||||
std::cerr << "\x1b[1;31mInternal Error:\x1b[0m " << message << " at ";
|
||||
print_position(std::cerr, node.get_start_position(), node.get_end_position());
|
||||
std::cerr << ".\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
inline void handle_internal_error(const std::string &message,
|
||||
parser::ParseTree::Node node) {
|
||||
std::cerr << "\x1b[1;31mInternal Error:\x1b[0m " << message << " at ";
|
||||
print_position(std::cerr, node.get_start_point(), node.get_end_point());
|
||||
std::cerr << ".\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue