Reputation: 2518
Given this macro
macro type {
case {_ $attr } =>
{
return #{
var a = obj.some$attr
}
}
}
type Attr
I'm trying to get this output:
var a = obj.someAttr;
But what I get is
var a = obj.some$attr;
Adding any non alphanumeric character between some
and $attr
correctly outputs the bound value.
Upvotes: 0
Views: 21
Reputation: 2518
Ok just figured out how to do this
enter code here
macro type {
case { $mName $attr } =>
{
var wrapperName = makeIdent('some' + unwrapSyntax(#{$attr}), #{$mName});
letstx $x = [wrapperName];
return #{
var a = obj.$x
}
}
}
Upvotes: 0