properly macroExpand localFunction
This commit is contained in:
@@ -691,6 +691,11 @@ class SpecialForms {
|
||||
b.callSymbol("let", [newBindings].concat(Lambda.map(args.slice(1), macroExpand)));
|
||||
};
|
||||
|
||||
map["localFunction"] = (wholeExp:ReaderExp, args:Array<ReaderExp>, k:KissState) -> {
|
||||
var b = wholeExp.expBuilder();
|
||||
b.callSymbol("localFunction", [expandTypeAliases(args[0])].concat(args.slice(1).map(macroExpand)));
|
||||
};
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,16 @@
|
||||
expanded ,(printExp (macroExpand expression))]
|
||||
,@b))
|
||||
|
||||
(defMacro makeExampleNoValues [expression]
|
||||
(defMacro makeExampleNoValues [expression &opt body1 body2]
|
||||
`{
|
||||
,(printExp expression)
|
||||
,(printExp (macroExpand expression))
|
||||
{
|
||||
,(printExp expression)
|
||||
,(or body1 `{})
|
||||
}
|
||||
{
|
||||
,(printExp (macroExpand expression))
|
||||
,(or body2 `{})
|
||||
}
|
||||
})
|
||||
|
||||
(function _testAllForms []
|
||||
@@ -44,4 +50,12 @@
|
||||
Stream (Stream.fromString "")]
|
||||
null))
|
||||
|
||||
// localFunction
|
||||
(makeExampleNoValues
|
||||
(localFunction Stream [] (Stream.fromString "")))
|
||||
|
||||
(makeExampleNoValues
|
||||
(localFunction :Stream s [] (Stream.fromString "")))
|
||||
|
||||
|
||||
)
|
||||
Reference in New Issue
Block a user