"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/babel-traverse/src/path/replacement.js" between
babel-7.12.6.tar.gz and babel-7.12.7.tar.gz

About: Babel is a JavaScript compiler that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript. Hint: There exists a high-performance language interoperability tool also named "Babel".

replacement.js  (babel-7.12.6):replacement.js  (babel-7.12.7)
// This file contains methods responsible for replacing a node with another. // This file contains methods responsible for replacing a node with another.
import { codeFrameColumns } from "@babel/code-frame"; import { codeFrameColumns } from "@babel/code-frame";
import traverse from "../index"; import traverse from "../index";
import NodePath from "./index"; import NodePath from "./index";
import { path as pathCache } from "../cache";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import * as t from "@babel/types"; import * as t from "@babel/types";
const hoistVariablesVisitor = { const hoistVariablesVisitor = {
Function(path) { Function(path) {
path.skip(); path.skip();
}, },
VariableDeclaration(path) { VariableDeclaration(path) {
if (path.node.kind !== "var") return; if (path.node.kind !== "var") return;
skipping to change at line 52 skipping to change at line 53
* - Insert the provided nodes after the current node. * - Insert the provided nodes after the current node.
* - Remove the current node. * - Remove the current node.
*/ */
export function replaceWithMultiple(nodes: Array<Object>) { export function replaceWithMultiple(nodes: Array<Object>) {
this.resync(); this.resync();
nodes = this._verifyNodeList(nodes); nodes = this._verifyNodeList(nodes);
t.inheritLeadingComments(nodes[0], this.node); t.inheritLeadingComments(nodes[0], this.node);
t.inheritTrailingComments(nodes[nodes.length - 1], this.node); t.inheritTrailingComments(nodes[nodes.length - 1], this.node);
pathCache.get(this.parent).delete(this.node);
this.node = this.container[this.key] = null; this.node = this.container[this.key] = null;
const paths = this.insertAfter(nodes); const paths = this.insertAfter(nodes);
if (this.node) { if (this.node) {
this.requeue(); this.requeue();
} else { } else {
this.remove(); this.remove();
} }
return paths; return paths;
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)