Comparing version 1.7.3 to 1.7.4
@@ -30,7 +30,7 @@ /* | ||
},{}],3:[function(_dereq_,module,exports){ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}();function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var ASTYMerge=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"merge",value:function(e){var r=this,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return this;if(!this.ctx.isA(e))throw new Error("merge: invalid AST node argument");if(t){var a=e.pos();this.pos(a.L,a.C,a.O)}return e.attrs().forEach(function(t){var a=void 0!==n[t]?n[t]:t;null!==a&&r.set(a,e.get(t))}),e.childs().forEach(function(e){r.add(e)}),this}}]),e}();exports.default=ASTYMerge; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}();function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var ASTYMerge=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"merge",value:function(e){var r=this,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return this;if(!this.ctx.isA(e))throw new Error("merge: invalid AST node argument");if(t){var a=e.pos();this.pos(a.line,a.column,a.offset)}e.attrs().forEach(function(t){var a=void 0!==n[t]?n[t]:t;null!==a&&r.set(a,e.get(t))}),e.childs().forEach(function(t){e.del(t),r.add(t)});var i=e.parent();return null!==i&&i.del(e),this}}]),e}();exports.default=ASTYMerge; | ||
},{}],4:[function(_dereq_,module,exports){ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var ASTYSerialize=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"serialize",value:function(e,t){if(!e.isA(t))throw new Error("serialize: not an ASTy node");return JSON.stringify({ASTy:function e(t){var n={T:t.T,L:{L:t.L.L,C:t.L.C,O:t.L.O}},r=Object.keys(t.A);return r.length>0&&(n.A={},r.forEach(function(e){var r=t.A[e];switch(void 0===r?"undefined":_typeof(r)){case"boolean":case"number":case"string":n.A[e]=r;break;default:n.A[e]=JSON.parse(JSON.stringify(r))}})),t.C.length>0&&(n.C=t.C.map(function(t){return e(t)})),n}(t)})}},{key:"unserialize",value:function(e,t){var n=JSON.parse(t);if("object"!==(void 0===n?"undefined":_typeof(n))||"object"!==_typeof(n.ASTy))throw new Error("unserialize: not an ASTy JSON export");return function t(n){var r=e.create(n.T);return r.pos(n.L.L,n.L.C,n.L.O),"object"===_typeof(n.A)&&Object.keys(n.A).forEach(function(e){var t=n.A[e];switch(void 0===t?"undefined":_typeof(t)){case"boolean":case"number":case"string":r.set(e,t);break;default:r.set(e,JSON.parse(JSON.stringify(t)))}}),"object"===_typeof(n.C)&&n.C instanceof Array&&r.add(n.C.map(function(e){return t(e)})),r}(n.ASTy)}}]),e}();exports.default=ASTYSerialize; | ||
},{}],5:[function(_dereq_,module,exports){ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:7,micro:3,date:20180328};exports.default=version; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:7,micro:4,date:20180330};exports.default=version; | ||
},{}],6:[function(_dereq_,module,exports){ | ||
@@ -37,0 +37,0 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,n){for(var r=0;r<n.length;r++){var t=n[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}return function(n,r,t){return r&&e(n.prototype,r),t&&e(n,t),n}}();function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var ASTYWalk=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"walk",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"downward";return function r(t,a,o){"downward"!==n&&"both"!==n||e(t,a,o,"downward"),t.C.forEach(function(e){r(e,a+1,t)}),"upward"!==n&&"both"!==n||e(t,a,o,"upward")}(this,0,null),this}}]),e}();exports.default=ASTYWalk; |
@@ -520,3 +520,3 @@ /* | ||
var pos = node.pos(); | ||
this.pos(pos.L, pos.C, pos.O); | ||
this.pos(pos.line, pos.column, pos.offset); | ||
} | ||
@@ -528,4 +528,7 @@ node.attrs().forEach(function (attrSource) { | ||
node.childs().forEach(function (child) { | ||
node.del(child); | ||
_this.add(child); | ||
}); | ||
var parent = node.parent(); | ||
if (parent !== null) parent.del(node); | ||
return this; | ||
@@ -689,4 +692,4 @@ } | ||
/* global 7: false */ | ||
/* global 3: false */ | ||
/* global 20180328: false */ | ||
/* global 4: false */ | ||
/* global 20180330: false */ | ||
@@ -696,4 +699,4 @@ var version = { | ||
minor: 7, | ||
micro: 3, | ||
date: 20180328 | ||
micro: 4, | ||
date: 20180330 | ||
}; | ||
@@ -700,0 +703,0 @@ |
{ | ||
"name": "asty", | ||
"version": "1.7.3", | ||
"version": "1.7.4", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -33,3 +33,3 @@ "keywords": [ "ast", "abstract", "syntax", "tree", "data", "structure" ], | ||
"eslint-plugin-promise": "3.7.0", | ||
"eslint-plugin-import": "2.9.0", | ||
"eslint-plugin-import": "2.10.0", | ||
"eslint-plugin-node": "6.0.1", | ||
@@ -36,0 +36,0 @@ "mocha": "5.0.5", |
@@ -29,3 +29,3 @@ | ||
to carry the results of the parsing step and to provide the vehicle | ||
for further processing of those results. | ||
for further processing those results. | ||
@@ -32,0 +32,0 @@ Usage |
@@ -34,3 +34,3 @@ /* | ||
let pos = node.pos() | ||
this.pos(pos.L, pos.C, pos.O) | ||
this.pos(pos.line, pos.column, pos.offset) | ||
} | ||
@@ -44,4 +44,8 @@ node.attrs().forEach((attrSource) => { | ||
node.childs().forEach((child) => { | ||
node.del(child) | ||
this.add(child) | ||
}) | ||
let parent = node.parent() | ||
if (parent !== null) | ||
parent.del(node) | ||
return this | ||
@@ -48,0 +52,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117592
1702