diff options
author | Mike Gerwitz <mike.gerwitz@rtspecialty.com> | 2018-03-20 15:32:46 -0400 |
---|---|---|
committer | Mike Gerwitz <mike.gerwitz@rtspecialty.com> | 2018-09-11 09:30:53 -0400 |
commit | 247ade8f1ac575b86075c5b16c0e45e590de312e (patch) | |
tree | 306c883cd3395472b9882d30ce83577649a8831e /core | |
parent | 92ab072fbdfa45b1adae4ac9fbc795f55b9532f3 (diff) | |
download | tame-247ade8f1ac575b86075c5b16c0e45e590de312e.tar.gz tame-247ade8f1ac575b86075c5b16c0e45e590de312e.tar.bz2 tame-247ade8f1ac575b86075c5b16c0e45e590de312e.zip |
alias: Do not generate alias if name matches source
* alias.xml (_classify-alias_, _rate-alias_, _rate-each-alias_): Generate
nothing if source matches alias name.
Diffstat (limited to 'core')
-rw-r--r-- | core/alias.xml | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/core/alias.xml b/core/alias.xml index 7dc7259..7564f1a 100644 --- a/core/alias.xml +++ b/core/alias.xml @@ -25,6 +25,12 @@ These alias templates allow giving a new name to existing values. They are most useful for avoiding too many template-generated variables. + If an alias name matches the name of the source, + then no alias will be generated; + this behavior is useful when generating aliases in templates where the + caller may or may not choose a name that would otherwise conflict with + its internal representation. + If no description is provided, aliases will inherit the description from the source symbol. @@ -46,9 +52,11 @@ </param> - <classify as="@as@" desc="@desc@" yields="@yields@"> - <match on="@__src_yields@" /> - </classify> + <unless name="@as@" eq="@from@"> + <classify as="@as@" desc="@desc@" yields="@yields@"> + <match on="@__src_yields@" /> + </classify> + </unless> </template> @@ -58,9 +66,11 @@ <param name="@from@" desc="Source name" /> - <rate yields="@yields@"> - <c:value-of name="@from@" /> - </rate> + <unless name="@from@" eq="@yields@"> + <rate yields="@yields@"> + <c:value-of name="@from@" /> + </rate> + </unless> </template> @@ -70,7 +80,7 @@ <param name="@from@" desc="Source generator" /> <param name="@desc@" desc="Generator alias description"> - <param-sym-value name="@from@" value="desc" /> + <param-sym-value name="@from@" value="desc" /> </param> <param name="@yields@" desc="Yield alias name"> @@ -79,10 +89,12 @@ </param> - <rate yields="@yields@"> - <c:sum of="@from@" desc="@desc@" generates="@generates@" index="k"> - <c:value-of name="@from@" index="k" /> - </c:sum> - </rate> + <unless name="@generates@" eq="@from@"> + <rate yields="@yields@"> + <c:sum of="@from@" desc="@desc@" generates="@generates@" index="k"> + <c:value-of name="@from@" index="k" /> + </c:sum> + </rate> + </unless> </template> </package> |