Class TracingUtil


  • public final class TracingUtil
    extends Object
    Mechanism Generator uses to keep trace of origin for transformed nodes. As the package name suggests, it's rather part of [debuginfo-api] module, however, generated code uses this class in runtime, and as long as [debuginfo-api] is auxiliary (not part of the [kernel]/mps-core), it's better to keep this class here. After all, [debuginfo-api] is not the only client of the trace. Perhaps, shall push this class even further, down to [smodel], as it's quite generic. Meanwhile, there's CopyUtil that got quite some dependencies to [kernel]. Once either CopyUtil's dependencies are in [smodel], or there's simplified alternative (I don't need too much from CopyUtil here, in fact), consider moving the class further.
    • Constructor Detail

      • TracingUtil

        public TracingUtil()
    • Method Detail

      • copyWithTrace

        public static SNode copyWithTrace​(SNode node)
      • fillOriginalNode

        @Deprecated
        public static void fillOriginalNode​(@NotNull
                                            SNode inputNode,
                                            @NotNull
                                            SNode outputNode,
                                            boolean originalInput)
        Deprecated.
        code branching done with boolean flag.
      • deriveOriginalNode

        public static void deriveOriginalNode​(SNode inputNode,
                                              SNode outputNode)
        Derive original input node from a transient input node, if any. Doesn't override origin trace if already set
        Parameters:
        inputNode - shall never be null, the one we take origin from
        outputNode - node to receive same origin as the inputNode (unless already has one), not null.
      • deriveOriginalNode

        public static void deriveOriginalNode​(SNode inputNode,
                                              Collection<SNode> outputNodes,
                                              boolean force)
        Derive original input node from a transient input node, if any. Optionally doesn't override origin trace if already set
        Parameters:
        inputNode - shall never be null, the one we take origin from
        outputNodes - nodes to receive same origin as the inputNode (unless they already has one)