Type Alias AspectTyping<atom, runtime>

AspectTyping<atom, runtime>: {
    apply@around: {
        advice: ((state: runtime["State"], callee: runtime["StackValue"], this_: runtime["StackValue"], arguments_: runtime["StackValue"][], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    };
    await@after: {
        advice: ((state: runtime["State"], value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    };
    await@before: {
        advice: ((state: runtime["State"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    };
    block@declaration: {
        advice: ((state: runtime["State"], kind: ControlKind, frame: Frame<atom["Variable"], runtime["ScopeValue"]>, tag: atom["Tag"]) => void);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    };
    block@declaration-overwrite: {
        advice: (<kind>(state: runtime["State"], kind: kind, frame: Frame<atom["Variable"], runtime["ScopeValue"]>, tag: atom["Tag"]) => Frame<atom["Variable"], runtime["ScopeValue"]>);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    };
    block@setup: {
        advice: ((state: runtime["State"], kind: ControlKind, tag: atom["Tag"]) => runtime["State"]);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    };
    block@teardown: {
        advice: ((state: runtime["State"], kind: ControlKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    };
    block@throwing: {
        advice: ((state: runtime["State"], kind: ControlKind, value: runtime["OtherValue"], tag: atom["Tag"]) => void);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    };
    break@before: {
        advice: ((state: runtime["State"], label: atom["Label"], tag: atom["Tag"]) => void);
        pointcut: ((label: atom["Label"], tag: atom["Tag"]) => boolean);
    };
    closure-block@after: {
        advice: ((state: runtime["State"], kind: ClosureKind, value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((kind: ClosureKind, tag: atom["Tag"]) => boolean);
    };
    closure-block@before: {
        advice: ((state: runtime["State"], kind: ClosureKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: ClosureKind, tag: atom["Tag"]) => boolean);
    };
    closure@after: {
        advice: ((state: runtime["State"], kind: ClosureKind, closure: runtime["OtherValue"] & Function, tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((kind: ClosureKind, tag: atom["Tag"]) => boolean);
    };
    construct@around: {
        advice: ((state: runtime["State"], callee: runtime["StackValue"], arguments_: runtime["StackValue"][], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    };
    drop@before: {
        advice: ((state: runtime["State"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    };
    eval@after: {
        advice: ((state: runtime["State"], value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    };
    eval@before: {
        advice: ((state: runtime["State"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    };
    export@before: {
        advice: ((state: runtime["State"], specifier: atom["Specifier"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((specifier: atom["Specifier"], tag: atom["Tag"]) => boolean);
    };
    generator-block@resumption: {
        advice: ((state: runtime["State"], kind: GeneratorKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: GeneratorKind, tag: atom["Tag"]) => boolean);
    };
    generator-block@suspension: {
        advice: ((state: runtime["State"], kind: GeneratorKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: GeneratorKind, tag: atom["Tag"]) => boolean);
    };
    import@after: {
        advice: ((state: runtime["State"], source: atom["Source"], specifier: atom["Specifier"] | null, value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((source: atom["Source"], specifier: atom["Specifier"] | null, tag: atom["Tag"]) => boolean);
    };
    intrinsic@after: {
        advice: ((state: runtime["State"], name: Intrinsic, value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((name: Intrinsic, tag: atom["Tag"]) => boolean);
    };
    primitive@after: {
        advice: ((state: runtime["State"], value: RuntimePrimitive & runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((primitive: RuntimePrimitive, tag: atom["Tag"]) => boolean);
    };
    program-block@after: {
        advice: ((state: runtime["State"], kind: ProgramKind, value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((kind: ProgramKind, tag: atom["Tag"]) => boolean);
    };
    program-block@before: {
        advice: ((state: runtime["State"], kind: ProgramKind, head: Header[], tag: atom["Tag"]) => void);
        pointcut: ((kind: ProgramKind, tag: atom["Tag"]) => boolean);
    };
    read@after: {
        advice: ((state: runtime["State"], identifier: Parameter | atom["Variable"], value: runtime["ScopeValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((identifier: Parameter | atom["Variable"], tag: atom["Tag"]) => boolean);
    };
    segment-block@after: {
        advice: ((state: runtime["State"], kind: SegmentKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: SegmentKind, tag: atom["Tag"]) => boolean);
    };
    segment-block@before: {
        advice: ((state: runtime["State"], kind: SegmentKind, labels: atom["Label"][], tag: atom["Tag"]) => void);
        pointcut: ((kind: SegmentKind, tag: atom["Tag"]) => boolean);
    };
    test@before: {
        advice: ((state: runtime["State"], kind: TestKind, value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((kind: TestKind, tag: atom["Tag"]) => boolean);
    };
    write@before: {
        advice: ((state: runtime["State"], identifier: Parameter | atom["Variable"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["ScopeValue"]);
        pointcut: ((identifier: Parameter | atom["Variable"], tag: atom["Tag"]) => boolean);
    };
    yield@after: {
        advice: ((state: runtime["State"], delegate: boolean, value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((delegate: boolean, tag: atom["Tag"]) => boolean);
    };
    yield@before: {
        advice: ((state: runtime["State"], delegate: boolean, value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((delegate: boolean, tag: atom["Tag"]) => boolean);
    };
}

The standard weaving API expects a global value at config.advice_variable that holds all the advice functions. It is simpler to use than the flexible weaving API but it does let the user define the static information provided to the advice functions.

Type Parameters

Type declaration

  • apply@around: {
        advice: ((state: runtime["State"], callee: runtime["StackValue"], this_: runtime["StackValue"], arguments_: runtime["StackValue"][], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    }

    Called in place of a closure regular call. The this argument has been made explicit and the operation should be performed with Reflect.apply.

    • advice: ((state: runtime["State"], callee: runtime["StackValue"], this_: runtime["StackValue"], arguments_: runtime["StackValue"][], tag: atom["Tag"]) => runtime["StackValue"])
        • (state, callee, this_, arguments_, tag): runtime["StackValue"]
        • Parameters

          Returns runtime["StackValue"]

    • pointcut: ((tag: atom["Tag"]) => boolean)
        • (tag): boolean
        • Parameters

          Returns boolean

  • await@after: {
        advice: ((state: runtime["State"], value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    }

    Called right after a promise used inside an await expression successfully resolved. That is that the asynchronous closure stack will be restored.

    • advice: ((state: runtime["State"], value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"])
    • pointcut: ((tag: atom["Tag"]) => boolean)
        • (tag): boolean
        • Parameters

          Returns boolean

  • await@before: {
        advice: ((state: runtime["State"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    }

    Called right before a value will be used as a promise in a await expression. That is that all the asynchronous closures at the top of the callstack will be stashed away.

    • advice: ((state: runtime["State"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"])
    • pointcut: ((tag: atom["Tag"]) => boolean)
        • (tag): boolean
        • Parameters

          Returns boolean

  • block@declaration: {
        advice: ((state: runtime["State"], kind: ControlKind, frame: Frame<atom["Variable"], runtime["ScopeValue"]>, tag: atom["Tag"]) => void);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    }

    Called before entering any block. It provides the initial values of the scope frame of the current block. Parameters such as catch.error may have an arbitrary initial value but regular variables can initially only be undefined or the intrinsic symbol aran.deadzone_symbol.

  • block@declaration-overwrite: {
        advice: (<kind>(state: runtime["State"], kind: kind, frame: Frame<atom["Variable"], runtime["ScopeValue"]>, tag: atom["Tag"]) => Frame<atom["Variable"], runtime["ScopeValue"]>);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    }

    Same as block@declaration but it provides an opportunity to overwrite the initial values of the scope frame of the current block. The advice block@declaration does not provide this capability for performance reasons.

  • block@setup: {
        advice: ((state: runtime["State"], kind: ControlKind, tag: atom["Tag"]) => runtime["State"]);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    }

    The first advice called upon entering any block. It provides an oportunity to overwrite the state that other advices will receive. That is that it receives the state of the parent block and returns the state that will be passed to the other advice of this block. If the block is the root block -- ie a program block -- it will receive a clone of config.initial_state.

  • block@teardown: {
        advice: ((state: runtime["State"], kind: ControlKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    }

    Called right before leaving any block regardless of how it terminated.

  • block@throwing: {
        advice: ((state: runtime["State"], kind: ControlKind, value: runtime["OtherValue"], tag: atom["Tag"]) => void);
        pointcut: ((kind: ControlKind, tag: atom["Tag"]) => boolean);
    }

    Called before leaving any block only if an error was thrown.

  • break@before: {
        advice: ((state: runtime["State"], label: atom["Label"], tag: atom["Tag"]) => void);
        pointcut: ((label: atom["Label"], tag: atom["Tag"]) => boolean);
    }

    Called right before evaluating a break statement.

    • advice: ((state: runtime["State"], label: atom["Label"], tag: atom["Tag"]) => void)
        • (state, label, tag): void
        • Parameters

          Returns void

    • pointcut: ((label: atom["Label"], tag: atom["Tag"]) => boolean)
        • (label, tag): boolean
        • Parameters

          Returns boolean

  • closure-block@after: {
        advice: ((state: runtime["State"], kind: ClosureKind, value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((kind: ClosureKind, tag: atom["Tag"]) => boolean);
    }

    Called before leaving a closure block with its completion value. If an error was thrown, this advice will not be called.

  • closure-block@before: {
        advice: ((state: runtime["State"], kind: ClosureKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: ClosureKind, tag: atom["Tag"]) => boolean);
    }

    Called before entering a closure block.

  • closure@after: {
        advice: ((state: runtime["State"], kind: ClosureKind, closure: runtime["OtherValue"] & Function, tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((kind: ClosureKind, tag: atom["Tag"]) => boolean);
    }

    Called right after a closure was created. We use the term 'closure' because we reserve the term 'function' for actual regular functions.

  • construct@around: {
        advice: ((state: runtime["State"], callee: runtime["StackValue"], arguments_: runtime["StackValue"][], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    }

    Called in place of a closure construct call. The operation should be performed with Reflect.construct.

    • advice: ((state: runtime["State"], callee: runtime["StackValue"], arguments_: runtime["StackValue"][], tag: atom["Tag"]) => runtime["StackValue"])
        • (state, callee, arguments_, tag): runtime["StackValue"]
        • Parameters

          Returns runtime["StackValue"]

    • pointcut: ((tag: atom["Tag"]) => boolean)
        • (tag): boolean
        • Parameters

          Returns boolean

  • drop@before: {
        advice: ((state: runtime["State"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    }

    Called right after a value will actually not be used. For instance an expression statement will trigger this advice because the value of the expression has no use.

    • advice: ((state: runtime["State"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"])
    • pointcut: ((tag: atom["Tag"]) => boolean)
        • (tag): boolean
        • Parameters

          Returns boolean

  • eval@after: {
        advice: ((state: runtime["State"], value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    }

    Called right after returning from a direct eval call.

    • advice: ((state: runtime["State"], value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"])
    • pointcut: ((tag: atom["Tag"]) => boolean)
        • (tag): boolean
        • Parameters

          Returns boolean

  • eval@before: {
        advice: ((state: runtime["State"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((tag: atom["Tag"]) => boolean);
    }

    Called right before a value will be used as code to a direct eval call. Supporting direct eval calls entails instrumenting this value. Otherwise, this code will interact very poorly with the surrounding instrumented code.

    • advice: ((state: runtime["State"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"])
    • pointcut: ((tag: atom["Tag"]) => boolean)
        • (tag): boolean
        • Parameters

          Returns boolean

  • export@before: {
        advice: ((state: runtime["State"], specifier: atom["Specifier"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((specifier: atom["Specifier"], tag: atom["Tag"]) => boolean);
    }

    Called right before a value will be exported from the current module.

    • advice: ((state: runtime["State"], specifier: atom["Specifier"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"])
        • (state, specifier, value, tag): runtime["OtherValue"]
        • Parameters

          Returns runtime["OtherValue"]

    • pointcut: ((specifier: atom["Specifier"], tag: atom["Tag"]) => boolean)
        • (specifier, tag): boolean
        • Parameters

          • specifier: atom["Specifier"]
          • tag: atom["Tag"]

          Returns boolean

  • generator-block@resumption: {
        advice: ((state: runtime["State"], kind: GeneratorKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: GeneratorKind, tag: atom["Tag"]) => boolean);
    }

    Called right after the first call to the next method of the iterator returned by a generator. Note that the head and the body of a generator are considered to be part of the same block.

  • generator-block@suspension: {
        advice: ((state: runtime["State"], kind: GeneratorKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: GeneratorKind, tag: atom["Tag"]) => boolean);
    }

    Called right before leaving the head of a generator function. That is right before the generator returns its iterator. This advice will not be called if the head of the generator threw an error. Note that the head and the body of a generator are considered to be part of the same block.

  • import@after: {
        advice: ((state: runtime["State"], source: atom["Source"], specifier: atom["Specifier"] | null, value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((source: atom["Source"], specifier: atom["Specifier"] | null, tag: atom["Tag"]) => boolean);
    }

    Called right after a value was imported from another module.

    • advice: ((state: runtime["State"], source: atom["Source"], specifier: atom["Specifier"] | null, value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"])
        • (state, source, specifier, value, tag): runtime["StackValue"]
        • Parameters

          Returns runtime["StackValue"]

    • pointcut: ((source: atom["Source"], specifier: atom["Specifier"] | null, tag: atom["Tag"]) => boolean)
        • (source, specifier, tag): boolean
        • Parameters

          • source: atom["Source"]
          • specifier: atom["Specifier"] | null
          • tag: atom["Tag"]

          Returns boolean

  • intrinsic@after: {
        advice: ((state: runtime["State"], name: Intrinsic, value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((name: Intrinsic, tag: atom["Tag"]) => boolean);
    }

    Called right after an intrinsic value was read.

  • primitive@after: {
        advice: ((state: runtime["State"], value: RuntimePrimitive & runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((primitive: RuntimePrimitive, tag: atom["Tag"]) => boolean);
    }

    Called right after a primitive value was created.

  • program-block@after: {
        advice: ((state: runtime["State"], kind: ProgramKind, value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((kind: ProgramKind, tag: atom["Tag"]) => boolean);
    }

    Called before leaving a program block with its return value. If an error was thrown, this advice will not be called.

  • program-block@before: {
        advice: ((state: runtime["State"], kind: ProgramKind, head: Header[], tag: atom["Tag"]) => void);
        pointcut: ((kind: ProgramKind, tag: atom["Tag"]) => boolean);
    }

    Called before entering a program block with the headers of the program.

  • read@after: {
        advice: ((state: runtime["State"], identifier: Parameter | atom["Variable"], value: runtime["ScopeValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((identifier: Parameter | atom["Variable"], tag: atom["Tag"]) => boolean);
    }

    Called right after a value was read from the current scope. The variable is guaranteed to exist in the current scope.

  • segment-block@after: {
        advice: ((state: runtime["State"], kind: SegmentKind, tag: atom["Tag"]) => void);
        pointcut: ((kind: SegmentKind, tag: atom["Tag"]) => boolean);
    }

    Called before leaving a control block. If an error was thrown or if a label was broken onto, this advice will not be called.

  • segment-block@before: {
        advice: ((state: runtime["State"], kind: SegmentKind, labels: atom["Label"][], tag: atom["Tag"]) => void);
        pointcut: ((kind: SegmentKind, tag: atom["Tag"]) => boolean);
    }

    Called before entering a segment block with the labels of the current block.

  • test@before: {
        advice: ((state: runtime["State"], kind: TestKind, value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((kind: TestKind, tag: atom["Tag"]) => boolean);
    }

    Called right before using a value as a boolean to branch the control flow.

  • write@before: {
        advice: ((state: runtime["State"], identifier: Parameter | atom["Variable"], value: runtime["StackValue"], tag: atom["Tag"]) => runtime["ScopeValue"]);
        pointcut: ((identifier: Parameter | atom["Variable"], tag: atom["Tag"]) => boolean);
    }

    Called right before a value will be used to update the current scope. The variable is guaranteed to exist in the current scope.

  • yield@after: {
        advice: ((state: runtime["State"], delegate: boolean, value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"]);
        pointcut: ((delegate: boolean, tag: atom["Tag"]) => boolean);
    }

    Called right after calling the next method of the iterator returned by a generator. That is that the generator call will be restored.

    • advice: ((state: runtime["State"], delegate: boolean, value: runtime["OtherValue"], tag: atom["Tag"]) => runtime["StackValue"])
        • (state, delegate, value, tag): runtime["StackValue"]
        • Parameters

          Returns runtime["StackValue"]

    • pointcut: ((delegate: boolean, tag: atom["Tag"]) => boolean)
        • (delegate, tag): boolean
        • Parameters

          • delegate: boolean
          • tag: atom["Tag"]

          Returns boolean

  • yield@before: {
        advice: ((state: runtime["State"], delegate: boolean, value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"]);
        pointcut: ((delegate: boolean, tag: atom["Tag"]) => boolean);
    }

    Called right before a value will be used as an item in a yield expression. That is that the current call will be stashed away.

    • advice: ((state: runtime["State"], delegate: boolean, value: runtime["StackValue"], tag: atom["Tag"]) => runtime["OtherValue"])
        • (state, delegate, value, tag): runtime["OtherValue"]
        • Parameters

          Returns runtime["OtherValue"]

    • pointcut: ((delegate: boolean, tag: atom["Tag"]) => boolean)
        • (delegate, tag): boolean
        • Parameters

          • delegate: boolean
          • tag: atom["Tag"]

          Returns boolean