jintr
Version:
A tiny JavaScript interpreter written in TypeScript.
16 lines (15 loc) • 468 B
JavaScript
import BaseJSNode from './BaseJSNode.js';
export default class ObjectExpression extends BaseJSNode {
run() {
let result = {};
for (const prop of this.node.properties) {
if (prop.type === 'Property') {
result = { ...result, ...this.visitor.visitNode(prop) };
}
else {
throw new Error(`Unhandled property type: ${prop.type}`);
}
}
return result;
}
}