@specs-feup/lara
Version:
A js port of the popular framework for building source-to-source compilers
44 lines • 1.7 kB
TypeScript
import { LaraJoinPoint } from "../../LaraJoinPoint.js";
import Mutation from "./Mutation.js";
import MutationResult from "./MutationResult.js";
import Mutator from "./Mutator.js";
/**
* Iterative mutator, allows to perform one mutation at a time, and restore the code before each mutation.
*
*/
export default class IterativeMutator extends Mutator {
joinPoints: LaraJoinPoint[];
mutations: Mutation[];
mutantIterator: Generator<MutationResult, void, unknown> | undefined;
currentOriginalPoint: LaraJoinPoint | undefined;
currentMutatedPoint: LaraJoinPoint | undefined;
hasFinished: boolean;
constructor(...mutations: Mutation[]);
/**
* Introduces a single mutation to the code.
* If there are no mutations left, does nothing.
*
* @returns True if a mutation occurred, false otherwise
*/
mutateSource(): boolean;
protected mutatePrivate(): void;
/**
* If the code has been mutated, restores the code to its original state. If not, does nothing.
*/
restoreSource(): void;
protected restorePrivate(): void;
/**
* @returns The point in the code where the mutation is occurring, or undefined if there are not more mutations left.
*/
getMutationPoint(): LaraJoinPoint | undefined;
/**
* @returns The point with currently mutated code, or undefined if the code is not currently mutated.
*/
getMutatedPoint(): LaraJoinPoint | undefined;
private generator;
addJp($joinpoint: LaraJoinPoint): void;
addJps(...jps: LaraJoinPoint[]): void;
hasMutations(): boolean;
getCurrentMutation(): LaraJoinPoint | undefined;
}
//# sourceMappingURL=IterativeMutator.d.ts.map