@@ -897,7 +897,7 @@ RuleMap LoadTgtFromIR(const std::filesystem::path &json_path) {
897897 Rule rule;
898898 if (name[0 ] == ' f' ) {
899899 rule.tgt = ParseExprTgtJSON (*obj);
900- std::get<ExprTgt>(rule.tgt ).name = name;
900+ std::get<ExprTgt>(rule.tgt ).validate (json_path. string () + " : " + name) ;
901901 } else if (name[0 ] == ' t' ) {
902902 rule.tgt = ParseTypeTgtJSON (*obj);
903903 } else {
@@ -1039,8 +1039,6 @@ void ExprTgt::validate(const std::string &context) const {
10391039 ValidateConsecutiveKeys (params, ' a' , 0 , context + " params" );
10401040 ValidateConsecutiveKeys (generics, ' T' , 1 , context + " generics" );
10411041 assert (!body.empty () && " ExprTgt body must not be empty" );
1042- assert (!name.empty () && " ExprTgt name must not be empty" );
1043- assert (!module .empty () && " ExprTgt module must not be empty" );
10441042}
10451043
10461044std::vector<Rule> Load (const std::filesystem::path &path, Model model) {
@@ -1063,9 +1061,6 @@ std::vector<Rule> Load(const std::filesystem::path &path, Model model) {
10631061 }
10641062 for (auto &[name, src_rule] : src_rules) {
10651063 rules.at (name).src = std::move (src_rule.src );
1066- if (auto *expr_tgt = std::get_if<ExprTgt>(&rules.at (name).tgt )) {
1067- expr_tgt->module = dir.filename ().string ();
1068- }
10691064 }
10701065
10711066 std::vector<Rule> result;
@@ -1080,9 +1075,6 @@ std::vector<Rule> Load(const std::filesystem::path &path, Model model) {
10801075 }
10811076 }
10821077 assert (!rule.src .empty () && " Rule loaded from IR but has no src" );
1083- if (auto *expr_tgt = std::get_if<ExprTgt>(&rule.tgt )) {
1084- expr_tgt->validate (path.string () + ' :' + name);
1085- }
10861078 result.push_back (std::move (rule));
10871079 }
10881080 return result;
0 commit comments