@specs-feup/lara
Version:
A js port of the popular framework for building source-to-source compilers
53 lines • 2.05 kB
TypeScript
import { LaraJoinPoint } from "../../LaraJoinPoint.js";
import TraversalType from "../../weaver/TraversalType.js";
import SimplePass from "./SimplePass.js";
import AggregatePassResult from "./results/AggregatePassResult.js";
/**
* Helper class to wrap existing code into a Lara transformation pass.
*/
declare class AdapterPass extends SimplePass {
protected _name: string;
private matchJp;
private transformJp;
/**
* @param includeDescendants - Apply pass to the join point's descendents
* @param definition - Definition for the Pass
*/
constructor(includeDescendants?: boolean, definition?: AdapterPass.AdapterPassDefinition);
/**
* @returns Name of the pass
* @override
*/
get name(): string;
/**
* Predicate that informs the pass whether a certain joinpoint should be transformed
* @override
* @param $jp - Join point to match
* @returns Returns true if the joint point matches the predicate for this pass
*/
matchJoinpoint($jp: LaraJoinPoint): boolean;
/**
* Transformation to be applied to matching joinpoints
* @override
* @param $jp - Join point to transform
* @throws A PassTransformationError if the transformation fails
* @returns The result of the transformation
*/
transformJoinpoint($jp: LaraJoinPoint): ReturnType<AdapterPass["transformJp"]>;
}
declare namespace AdapterPass {
/**
* @param name - Name of the pass
* @param traversalType - Order in which the join point's descendants should be visited
* @param matchJp - Predicate that informs the pass whether a certain joinpoint should be transformed
* @param transformJp - Transformation to be applied to matching joinpoints
*/
interface AdapterPassDefinition {
name: string;
traversalType: TraversalType;
matchJp: (jp: LaraJoinPoint) => boolean;
transformJp: (jp: LaraJoinPoint) => AggregatePassResult | never;
}
}
export default AdapterPass;
//# sourceMappingURL=AdapterPass.d.ts.map