Skip to content
v2.274.0

Shims Class ​

Converts between Mixins and Aspects.

Since Mixins and Aspects are both implementations of the visitor pattern, they can be converted from each other. Mixins are applied immediately (imperative), while Aspects are applied during synthesis (declarative).

Methods ​

asAspect(mixin: IMixin): IAspect@staticmethod def as_aspect(mixin: IMixin) -> IAspectpublic static IAspect asAspect(IMixin mixin)public static IAspect AsAspect(IMixin mixin)func AsAspect(Mixin IMixin) IAspectstatic#
Wraps a Mixin as an Aspect.

The resulting Aspect defers the Mixin's application to the synthesis phase. The Mixin's supports() method is used to filter which constructs are visited.

1 parameter

Parameters

  • mixinmixinmixinmixinMixin — The Mixin to wrap.
asMixin(aspect: IAspect): IMixin@staticmethod def as_mixin(aspect: IAspect) -> IMixinpublic static IMixin asMixin(IAspect aspect)public static IMixin AsMixin(IAspect aspect)func AsMixin(Aspect IAspect) IMixinstatic#
Wraps an Aspect as a Mixin.

The resulting Mixin applies the Aspect's visit() immediately to every node. The Aspect is applied to all constructs since Aspects don't have a supports() filter.

1 parameter

Parameters

  • aspectaspectaspectaspectAspect — The Aspect to wrap.