make deprecated specialForms errors

This commit is contained in:
2024-02-17 10:14:18 -07:00
parent 92d9f42388
commit d126b793b3

View File

@@ -26,11 +26,16 @@ class SpecialForms {
var compileTimeResolveToString = Helpers.compileTimeResolveToString;
function renameAndDeprecate(oldName:String, newName:String) {
function renameAndDeprecate(oldName:String, newName:String, full = true) {
var form = map[oldName];
map[oldName] = (wholeExp, args, k) -> {
KissError.warnFromExp(wholeExp, '$oldName has been renamed to $newName and deprecated');
form(wholeExp, args, k);
if (full) {
throw KissError.fromExp(wholeExp, '$oldName has been renamed to $newName and removed from kisslang');
}
else {
KissError.warnFromExp(wholeExp, '$oldName has been renamed to $newName and deprecated');
form(wholeExp, args, k);
}
}
map[newName] = form;
k.formDocs[newName] = k.formDocs[oldName];