add _declarations and _scopeInfo to t.inherits

This commit is contained in:
Sebastian McKenzie
2015-02-08 20:21:15 +11:00
parent 606f813822
commit de6b608dda
2 changed files with 9 additions and 5 deletions

View File

@@ -27,7 +27,8 @@ exports.ForOfStatement = function (node, parent, scope, file) {
// push the rest of the original loop body onto our new body
block.body = block.body.concat(node.body.body);
block._declarations = node.body._declarations;
t.inherits(loop, node);
// todo: find out why this is necessary? #538
loop._scopeInfo = node._scopeInfo;

View File

@@ -6,6 +6,7 @@ var isString = require("lodash/lang/isString");
var compact = require("lodash/array/compact");
var esutils = require("esutils");
var object = require("../helpers/object");
var merge = require("lodash/object/merge");
var Node = require("./node");
var each = require("lodash/collection/each");
var uniq = require("lodash/array/uniq");
@@ -690,10 +691,12 @@ t.inheritsComments = function (child, parent) {
*/
t.inherits = function (child, parent) {
child.range = parent.range;
child.start = parent.start;
child.loc = parent.loc;
child.end = parent.end;
child._declarations = parent._declarations;
child._scopeInfo = parent._scopeInfo;
child.range = parent.range;
child.start = parent.start;
child.loc = parent.loc;
child.end = parent.end;
t.inheritsComments(child, parent);
return child;
};