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

17 lines
704 B
JavaScript

import BaseJSNode from './BaseJSNode.js';
export default class MemberExpression extends BaseJSNode {
run() {
const { object, property, computed } = this.node;
const obj = this.visitor.visitNode(object);
const prop = computed ? this.visitor.visitNode(property) : this.visitor.getName(property);
if (prop !== undefined || prop !== null) {
if (this.visitor.listeners[prop]) {
const cb = this.visitor.listeners[prop](this.node, this.visitor);
if (cb !== '__continue_exec') {
return cb;
}
}
return obj === null || obj === void 0 ? void 0 : obj[prop];
}
}
}