agsamantha/node_modules/jintr/dist/nodes/ConditionalExpression.js

12 lines
373 B
JavaScript
Raw Normal View History

2024-10-02 15:15:21 -05:00
import BaseJSNode from './BaseJSNode.js';
export default class ConditionalExpression extends BaseJSNode {
run() {
const { test, consequent, alternate } = this.node;
const check = this.visitor.visitNode(test);
if (check) {
return this.visitor.visitNode(consequent);
}
return this.visitor.visitNode(alternate);
}
}