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