update Scope arguments
This commit is contained in:
parent
71ad511322
commit
a90f133918
@ -55,7 +55,7 @@ function traverse(parent, callbacks, opts) {
|
||||
|
||||
//
|
||||
var opts2 = { scope: opts.scope, blacklist: opts.blacklist };
|
||||
if (t.isScope(node)) opts2.scope = new Scope(opts.scope, node);
|
||||
if (t.isScope(node)) opts2.scope = new Scope(node, opts.scope);
|
||||
|
||||
// enter
|
||||
if (callbacks.enter) {
|
||||
@ -89,9 +89,10 @@ function traverse(parent, callbacks, opts) {
|
||||
|
||||
traverse.removeProperties = function (tree) {
|
||||
var clear = function (node) {
|
||||
delete node._scopeReferences;
|
||||
delete node.extendedRange;
|
||||
delete node._scopeIds;
|
||||
delete node._parent;
|
||||
delete node._scope;
|
||||
delete node.tokens;
|
||||
delete node.range;
|
||||
delete node.start;
|
||||
|
||||
@ -10,11 +10,15 @@ var FOR_KEYS = ["left", "init"];
|
||||
* This searches the current "scope" and collects all references/declarations
|
||||
* within.
|
||||
*
|
||||
* @param {Scope} [parent]
|
||||
* @param {Node} block
|
||||
* @param {Scope} [parent]
|
||||
*/
|
||||
|
||||
function Scope(parent, block) {
|
||||
function Scope(block, parent) {
|
||||
if (!parent && block._parent) {
|
||||
parent = block._parent._scope;
|
||||
}
|
||||
|
||||
this.parent = parent;
|
||||
this.block = block;
|
||||
|
||||
@ -23,10 +27,10 @@ function Scope(parent, block) {
|
||||
|
||||
Scope.prototype.getReferences = function () {
|
||||
var block = this.block;
|
||||
if (block._scope) return block._scope;
|
||||
if (block._scopeReferences) return block._scopeReferences;
|
||||
|
||||
var self = this;
|
||||
var references = block._scope = {};
|
||||
var references = block._scopeReferences = {};
|
||||
|
||||
var add = function (node) {
|
||||
self.add(node, references);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user