commit a5cd69a3a9473d7bb5275cafa68fba9c40368092
parent da2aa867b2ecfd62b8f7cdf5f24e703026369617
Author: Alexey Yerin <yyp@disroot.org>
Date: Mon, 13 Sep 2021 23:23:00 +0300
cmd/haredoc: error out on non-existent declarations
This allows to quickly see what's the problem instead of just getting
nothing in return.
Signed-off-by: Alexey Yerin <yyp@disroot.org>
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/cmd/haredoc/main.ha b/cmd/haredoc/main.ha
@@ -5,6 +5,7 @@ use hare::ast;
use hare::lex;
use hare::module;
use hare::parse;
+use hare::unparse;
use io;
use os;
use path;
@@ -130,6 +131,10 @@ export fn main() void = {
ast::decl_free(decls[i]);
};
};
+ if (len(new) == 0) {
+ fmt::fatal("Could not find {}::{}",
+ unparse::identstr(dirname), decl);
+ };
free(decls);
decls = new;
};