You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
799 B

export default class Context {
setResult(result) {
this.result = result;
this.hasResult = true;
return this;
}
exit() {
this.exiting = true;
return this;
}
push(child, name) {
child.parent = this;
if (typeof name !== 'undefined') {
child.childName = name;
}
child.root = this.root || this;
child.options = child.options || this.options;
if (!this.children) {
this.children = [child];
this.nextAfterChildren = this.next || null;
this.next = child;
}
else {
this.children[this.children.length - 1].next = child;
this.children.push(child);
}
child.next = this;
return this;
}
}