agsamantha/node_modules/jintr/dist/nodes/Identifier.js
2024-10-02 15:15:21 -05:00

14 lines
494 B
JavaScript

import BaseJSNode from './BaseJSNode.js';
export default class Identifier extends BaseJSNode {
run() {
if (this.visitor.listeners[this.node.name]) {
const cb = this.visitor.listeners[this.node.name](this.node, this.visitor);
if (cb !== '__continue_exec') {
return cb;
}
}
if (this.visitor.scope.has(this.node.name))
return this.visitor.scope.get(this.node.name);
return this.node.name;
}
}