KADABRA API

LARA API

LARA Common Language API

(.js)
laraImport("lara.mutation.Mutator");

(.lara)
import lara.mutation.Mutator;

Mutator

Constructor

Mutator

new Mutator([name = "<unnamed mutator>"])

Base class that represents a code mutator.

This should not be instantiated directly, instead it should be extended.

Parameters

name: String - the name of the mutator (optional)

Instance Members

addJp

addJp($joinpoint)

Adds a join point to this Mutator. Is only added if the Mutator can be applied over this join point, otherwise it will be ignored.

Parameters

$joinpoint: any

getCurrentMutation

getCurrentMutation()

Returns

$jp - the point with currently mutated code, or undefined if this concept is not applicable to this mutator.

getMutationPoint

getMutationPoint()

Returns

$jp - the point in the code where the mutation will occur or his occurring, or undefined if there are not more mutations left, or if this concept is not applicable to this mutator.

getName

getName()

Returns

String - the name of this mutator

getType

getType()

This function is deprecated. use getName() instead

Returns

String - the name of this Mutator

hasMutations

hasMutations()

Returns

boolean - true, if the Mutator still has mutations left to do, false otherwise.

mutate

mutate()

Introduces a single mutation to the code.
If the code has been mutated already, restores the code before mutating again.
If there are no mutations left, does nothing.


restore

restore()

If the code has been mutated, restores the code to its original state. If not, does nothing.


setAutomaticRestore

setAutomaticRestore([value = true])

Enables/disables automatic restore. Is enabled by default.

If enabled, before each call to .mutate() will check if the code is already mutated, and call restore before the mutation is applied.

Parameters

value: boolean - true to enable, false to disable (optional)