add utility.removeClass tests and move parentPath setting to setContext - fixes #967

This commit is contained in:
Sebastian McKenzie 2015-03-08 02:49:58 +11:00
parent 70cd650e10
commit 9c9af6dbbd
6 changed files with 23 additions and 12 deletions

View File

@ -4,11 +4,10 @@ import Scope from "./scope";
import t from "../types";
export default class TraversalPath {
constructor(parentPath, parent, container) {
this.parentPath = parentPath;
this.container = container;
this.parent = parent;
this.data = {};
constructor(parent, container) {
this.container = container;
this.parent = parent;
this.data = {};
}
static get(parentPath, context, parent, container, key) {
@ -25,11 +24,11 @@ export default class TraversalPath {
}
if (!path) {
path = new TraversalPath(parentPath, parent, container);
path = new TraversalPath(parent, container);
paths.push(path);
}
path.setContext(context, key);
path.setContext(parentPath, context, key);
return path;
}
@ -57,15 +56,16 @@ export default class TraversalPath {
this.scope = TraversalPath.getScope(this.node, this.parent, this.context.scope);
}
setContext(context, key) {
setContext(parentPath, context, key) {
this.shouldRemove = false;
this.shouldSkip = false;
this.shouldStop = false;
this.context = context;
this.state = context.state;
this.opts = context.opts;
this.key = key;
this.parentPath = parentPath;
this.context = context;
this.state = context.state;
this.opts = context.opts;
this.key = key;
this.setScope();
}

View File

@ -0,0 +1,3 @@
function foo() {
console.log("foo");
}

View File

@ -0,0 +1,3 @@
"use strict";
function foo() {}

View File

@ -0,0 +1,3 @@
{
"optional": ["utility.removeConsole"]
}

View File

@ -0,0 +1 @@
console.log("foo");

View File

@ -0,0 +1 @@
"use strict";