From 6d9dda6c93a0ad45607e682261d09856442cf4ba Mon Sep 17 00:00:00 2001 From: muji Date: Tue, 29 Mar 2016 13:20:33 +0800 Subject: [PATCH] Expose read-write accessors. For lastLineBlank, htmlBlockType and a `data` property which allows AST consumers to associate arbitrary data with an AST node. --- lib/node.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/node.js b/lib/node.js index 4e2bd82a..78c048c5 100644 --- a/lib/node.js +++ b/lib/node.js @@ -181,6 +181,21 @@ Object.defineProperty(proto, 'onExit', { set: function(s) { this._onExit = s; } }); +Object.defineProperty(proto, 'lastLineBlank', { + get: function() { return this._lastLineBlank; }, + set: function(val) { this._lastLineBlank = val; } +}); + +Object.defineProperty(proto, 'htmlBlockType', { + get: function() { return this._htmlBlockType; }, + set: function(val) { this._htmlBlockType = val; } +}); + +Object.defineProperty(proto, 'data', { + get: function() { return this._data; }, + set: function(val) { this._data = val; } +}); + Node.prototype.appendChild = function(child) { child.unlink(); child._parent = this;