A template can call itself, but such a template should contain some kind of criteria or scope change to avoid an infinite loop.
Example |
---|
Class C1 is inner to class C2,
which is in turn inner to C3. The template
%topContainerCode% tests whether the present
classifier is inner to another, and if so, calls itself on the
container classifier to perfom the same test until it reaches a
classifier that is not inner, at which point it prints the code of
the top
container:.if (%isInner%) %ContainerClassifier.topContainerCode% .else %Code% .endifResult: C3 |