macroExpand the expressions
This commit is contained in:
@@ -955,4 +955,13 @@ class Helpers {
|
||||
expMap(exp, expandTypeAliases.bind(_, k));
|
||||
};
|
||||
}
|
||||
|
||||
public static function expandTypeSymbol(exp:ReaderExp, k:KissState) {
|
||||
return switch (exp.def) {
|
||||
case Symbol(path):
|
||||
Symbol(replaceTypeAliases(path, k)).withPosOf(exp);
|
||||
default:
|
||||
exp;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -707,6 +707,12 @@ class SpecialForms {
|
||||
forExpander("for");
|
||||
forExpander("doFor");
|
||||
|
||||
map["the"] = (wholeExp:ReaderExp, args:Array<ReaderExp>, k:KissState) -> {
|
||||
var b = wholeExp.expBuilder();
|
||||
|
||||
b.callSymbol("the", [Helpers.expandTypeSymbol(args[0], k), macroExpand(args[1])]);
|
||||
};
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@@ -71,4 +71,10 @@
|
||||
(doFor [:Texty t1 :Texty t2 :Texty t3] lol
|
||||
null))
|
||||
|
||||
// the
|
||||
(makeExample
|
||||
.content (the Stream (Stream.fromString "hey"))
|
||||
(Assert.equals normal "hey\n")
|
||||
(Assert.equals expanded "hey\n"))
|
||||
|
||||
)
|
Reference in New Issue
Block a user