diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-04-04 00:18:44 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-04-04 00:18:44 -0700 |
commit | e62aa7e305a0ea8ae2c79522588c3bbc80fa4dc3 (patch) | |
tree | aaaf4d8d0010b338fdb59d6eb843fb4b09244dec /040brace.cc | |
parent | 2b37bbeae29e55f1456a4540741ceefdb5a0aa4b (diff) | |
download | mu-e62aa7e305a0ea8ae2c79522588c3bbc80fa4dc3.tar.gz |
3810
Stop naming 'jump' instructions in their errors since they're so often rewritten from 'break' or 'loop' instructions. Thanks Lakshman Swaminathan for running into this issue.
Diffstat (limited to '040brace.cc')
-rw-r--r-- | 040brace.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/040brace.cc b/040brace.cc index cf9a401c..e6afce89 100644 --- a/040brace.cc +++ b/040brace.cc @@ -60,7 +60,7 @@ void transform_braces(const recipe_ordinal r) { } if (inst.label == "}") { if (open_braces.empty()) { - raise << "missing '{' in '" << get(Recipe, r).name << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "missing '{' in '" << get(Recipe, r).name << "'\n" << end(); return; } open_braces.pop(); @@ -79,7 +79,7 @@ void transform_braces(const recipe_ordinal r) { // check for errors if (inst.name.find("-if") != string::npos || inst.name.find("-unless") != string::npos) { if (inst.ingredients.empty()) { - raise << "'" << inst.name << "' expects 1 or 2 ingredients, but got none\n" << end(); + raise << maybe(get(Recipe, r).name) << "'" << inst.name << "' expects 1 or 2 ingredients, but got none\n" << end(); continue; } } @@ -117,7 +117,7 @@ void transform_braces(const recipe_ordinal r) { target.type = new type_tree("offset"); target.set_value(0); if (open_braces.empty()) - raise << "'" << old_name << "' needs a '{' before\n" << end(); + raise << maybe(get(Recipe, r).name) << "'" << old_name << "' needs a '{' before\n" << end(); else if (old_name.find("loop") != string::npos) target.set_value(open_braces.top()-index); else // break instruction @@ -350,7 +350,7 @@ def test-factorial [ def main [ break ] -+error: 'break' needs a '{' before ++error: main: 'break' needs a '{' before :(scenario break_conditional_without_ingredient_fails) % Hide_errors = true; @@ -359,7 +359,7 @@ def main [ break-if } ] -+error: 'break-if' expects 1 or 2 ingredients, but got none ++error: main: 'break-if' expects 1 or 2 ingredients, but got none //: Using break we can now implement conditional returns. |