UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

19 lines (18 loc) 699 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tree_1 = require("./../tree"); var getNewReplacementSourceFile_1 = require("./../getNewReplacementSourceFile"); function insertSyntaxList(opts) { var insertPos = opts.insertPos, newText = opts.newText, parent = opts.parent; var tempSourceFile = getNewReplacementSourceFile_1.getNewReplacementSourceFile({ sourceFile: parent.getSourceFile(), insertPos: insertPos, newText: newText }); tree_1.replaceTreeCreatingSyntaxList({ parent: parent, replacementSourceFile: tempSourceFile, insertPos: insertPos }); } exports.insertSyntaxList = insertSyntaxList;