importWithDefAlias also define &ident alias

This commit is contained in:
2023-06-29 17:03:51 -06:00
parent 6ec8931b23
commit aa4328aabb
2 changed files with 5 additions and 3 deletions

View File

@@ -76,7 +76,6 @@ class Helpers {
return tokens.join("");
}
public static function parseComplexType(path:String, k:KissState, ?from:ReaderExp, mustResolve=false):ComplexType {
path = replaceTypeAliases(path, k);

View File

@@ -658,7 +658,7 @@ class Macros {
var extractString = false;
function getAliasName(k:KissState, nameExpWithMeta:ReaderExp, formName:String):String {
var error = KissError.fromExp(nameExpWithMeta, 'first argument to $formName should be &call [alias] or &ident [alias]');
var error = KissError.fromExp(nameExpWithMeta, 'first argument to $formName should be &call <alias> or &ident <alias> or &type <alias>');
var nameExp = switch (nameExpWithMeta.def) {
case MetaExp("call", nameExp):
extractString = false;
@@ -1478,7 +1478,10 @@ class Macros {
throw KissError.fromExp(wholeExp, "the only argument to (import) when using (importWithDefAlias) should be a symbol of a type path");
};
var baseType = type.split(".").pop();
b.callSymbol("defAlias", [b.meta("type", b.symbol(baseType)), args[0]]);
b.begin([
b.callSymbol("defAlias", [b.meta("type", b.symbol(baseType)), args[0]]),
b.callSymbol("defAlias", [b.meta("ident", b.symbol(baseType)), args[0]])
]);
};
null;
};