001package de.monochromata.ast;
002
003/**
004 * An interface to create AST transformations.
005 *
006 * @param <N>  The node type in the AST
007 * @param <E>  The expression type
008 * @param <T>  The type type
009 * @param <B>  The binding type
010 * @param <TB> The type binding type
011 * @param <S>  The scope type (optional)
012 * @param <I>  The type used to represent identifiers
013 * @param <QI> The type used to represent qualified identifiers
014 */
015public interface TransformationsApi<N, E, T, B, TB extends B, S, I, QI> {
016
017    /**
018     * @return {@literal true} if both nodes are contained in or are the same
019     *         invocable (i.e. initializer, constructor, method or lambda
020     *         expression).
021     */
022    public boolean partOfSameInvocable(N node, E expression);
023
024    /*
025     * TODO: Move logic from PublicDom to d.m.a to remove d.m.a types from the API
026     *
027     * Attempts to create a transformation that pass the given upstream node or a
028     * representation of it along the call chain from the invocable (i.e.
029     * initializer, constructor, method or lambda expression) containing the
030     * upstream node to the invocable containing the downstream node. <p> Such a
031     * transformation can only be constructed if there is a call chain connecting
032     * upstream and downstream nodes and if the chain is no longer than the
033     * implementation-specific analysis limits of the SPI implementation.
034     *
035     * @return a transformation if it can be constructed, or {@literal null}
036     * otherwise.
037     *
038     * public ASTTransformation<N, E, T, B, TB, S, I, QI, R, A> passAlongCallChain(N
039     * upstreamNode, E downstreamExpression, S scope);
040     */
041}