jintr
Version:
A tiny JavaScript interpreter written in TypeScript.
15 lines (14 loc) • 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;
}
}