js-slang
Version:
Javascript-based implementations of Source, written in Typescript
17 lines (16 loc) • 745 B
TypeScript
import type es from 'estree';
/**
* Strips out extra properties from an AST and converts Nodes to regular
* javascript objects
*
* The local imports test suites only care about the structure of the
* transformed AST. The line & column numbers, as well as the character
* offsets of each node in the ASTs derived from parsing the pre-transform
* code & the equivalent post-transform code will not be the same.
* Note that it is insufficient to pass in 'locations: false' into the acorn
* parser as there will still be 'start' & 'end' properties attached to nodes
* which represent character offsets.
*
* @param node The AST which should be stripped of extra properties
*/
export declare function sanitizeAST(node: es.Node): es.Node;