You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`Invalid rule "${rule}"\n| ${dewildcard(expr).toString()}\n| A rule should be of the form:\n| <match> -> <replace>; <condition>`
528
+
);
526
529
}
527
-
thrownewError(
528
-
`Invalid rule "${rule}"\n| ${dewildcard(expr).toString()}\n| A rule should be of the form:\n| <match> -> <replace>; <condition>`
529
-
);
530
-
}
531
530
532
-
if(!isFunction(expr)){
533
-
if(systemScope){
534
-
ce.popScope();
531
+
if(!isFunction(expr)){
532
+
thrownewError(`Invalid rule "${rule}"`);
535
533
}
536
-
thrownewError(`Invalid rule "${rule}"`);
537
-
}
538
-
const[match_,replace_,condition]=expr.ops;
534
+
const[match_,replace_,condition]=expr.ops;
539
535
540
-
letmatch=match_;
541
-
letreplace=replace_;
542
-
if(canonical){
543
-
match=match.canonical;
544
-
replace=replace.canonical;
545
-
}
546
-
547
-
// Pop the clean scope AFTER canonicalization to avoid pollution
548
-
if(systemScope){
549
-
ce.popScope();
550
-
}
551
-
552
-
// Check that all the wildcards in the replace also appear in the match
553
-
if(!includesWildcards(replace,match))
554
-
thrownewError(
555
-
`Invalid rule "${rule}"\n| The replace expression contains wildcards not present in the match expression`
556
-
);
536
+
letmatch=match_;
537
+
letreplace=replace_;
538
+
if(canonical){
539
+
match=match.canonical;
540
+
replace=replace.canonical;
541
+
}
557
542
558
-
if(match.isSame(replace)){
559
-
thrownewError(
560
-
`Invalid rule "${rule}"\n| The match and replace expressions are the same.\n| This may be because the rule is not necessary due to canonical simplification`
561
-
);
562
-
}
543
+
// Check that all the wildcards in the replace also appear in the match
544
+
if(!includesWildcards(replace,match))
545
+
thrownewError(
546
+
`Invalid rule "${rule}"\n| The replace expression contains wildcards not present in the match expression`
// Verify that all the wildcards in the condition also appear in the match
567
-
if(!includesWildcards(condition,match))
549
+
if(match.isSame(replace)){
568
550
thrownewError(
569
-
`Invalid rule "${rule}"\n| The condition expression contains wildcards not present in the match expression`
551
+
`Invalid rule "${rule}"\n| The match and replace expressions are the same.\n| This may be because the rule is not necessary due to canonical simplification`
0 commit comments