Open MrMugame opened 1 week ago
I'm ok with this. I added it to make the transition from handlebars easier, but that happened a while ago now so maybe it's time to drop it.
I don't have access to a proper device for a while (vacation), so a few things are harder to check:
So looks like you found some uses. Which means practically all people will have broken templates if they don't reimport the Core library. Really need a way a solution to library updates or rather lack thereof before merging this I fear.
Actually we can partially keep the old syntax. I haven't found any occurences of the old call syntax in the library, where arguments were passed. Only without arguments and that is already not handled as a call.
let attrVal = attributeVal[val[1]];
const func = functionMap[val[1]];
if (attrVal === undefined && func !== undefined) {
// Fallback to function call, if one is defined with this name
attrVal = func(variables);
}
return attrVal;
So we can keep that and only remove the syntax with arguments, which actually seems like a pretty good way. (Just noticed that now, that's why Im reverting)
I'll probably merge this when I come home next week. Would like to test it a bit first and make sure we understand all implications.
Do we want to add a null coalesce operator (??
) ?
I don't have anything against it. Why not
This fixes #894. I also removed the legacy call syntax handling, because it caused problems where an expression like this
a or b
was turned intoa (or b)
, which just doesn't make sense. Personally I'm for deprecating that call syntax as I don't really see a reason to keep it. If it should stay I would add it directly into the grammar to avoid any ambiguities like that.