deprecation functions. Close #31
This commit is contained in:
@@ -20,6 +20,15 @@ class FieldForms {
|
||||
public static function builtins() {
|
||||
var map:Map<String, FieldFormFunction> = [];
|
||||
|
||||
function renameAndDeprecate(oldName:String, newName:String) {
|
||||
var form = map[oldName];
|
||||
map[oldName] = (wholeExp, args, k) -> {
|
||||
CompileError.warnFromExp(wholeExp, '$oldName has been renamed to $newName and deprecated');
|
||||
form(wholeExp, args, k);
|
||||
}
|
||||
map[newName] = form;
|
||||
}
|
||||
|
||||
map["defvar"] = varOrProperty.bind("defvar");
|
||||
map["defprop"] = varOrProperty.bind("defprop");
|
||||
|
||||
|
@@ -22,6 +22,15 @@ class Macros {
|
||||
public static function builtins() {
|
||||
var macros:Map<String, MacroFunction> = [];
|
||||
|
||||
function renameAndDeprecate(oldName:String, newName:String) {
|
||||
var form = macros[oldName];
|
||||
macros[oldName] = (wholeExp, args, k) -> {
|
||||
CompileError.warnFromExp(wholeExp, '$oldName has been renamed to $newName and deprecated');
|
||||
form(wholeExp, args, k);
|
||||
}
|
||||
macros[newName] = form;
|
||||
}
|
||||
|
||||
macros["load"] = (wholeExp:ReaderExp, args:Array<ReaderExp>, k:KissState) -> {
|
||||
wholeExp.checkNumArgs(1, 1, '(load "[file]")');
|
||||
switch (args[0].def) {
|
||||
|
@@ -20,6 +20,15 @@ class SpecialForms {
|
||||
public static function builtins() {
|
||||
var map:Map<String, SpecialFormFunction> = [];
|
||||
|
||||
function renameAndDeprecate(oldName:String, newName:String) {
|
||||
var form = map[oldName];
|
||||
map[oldName] = (wholeExp, args, k) -> {
|
||||
CompileError.warnFromExp(wholeExp, '$oldName has been renamed to $newName and deprecated');
|
||||
form(wholeExp, args, k);
|
||||
}
|
||||
map[newName] = form;
|
||||
}
|
||||
|
||||
map["begin"] = (wholeExp:ReaderExp, args:Array<ReaderExp>, k:KissState) -> {
|
||||
// Sometimes empty blocks are useful, so a checkNumArgs() seems unnecessary here for now.
|
||||
|
||||
|
Reference in New Issue
Block a user