simc-ast-builder
Version:
Parser and AST generator for SimulationCraft files
25 lines • 943 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleActiveDot = void 0;
const SimCVisitorError_1 = require("../../errors/SimCVisitorError");
const fieldMaps_1 = require("../../utils/fieldMaps");
/**
* Handler for active_dot access contexts
*/
const handleActiveDot = ({ ctx, parts, }) => {
if (parts.length < 2) {
throw new SimCVisitorError_1.SimCVisitorError("Active dot access requires a dot name", ctx);
}
const dotName = parts[1]; // Non-null assertion since we check parts.length above
// active_dot always returns a numeric value (count of active dots)
const fieldDef = (0, fieldMaps_1.getFieldDef)("value");
return {
dotName,
expressionType: "numeric", // Always numeric
field: "",
kind: "expression",
nodeType: "active_dot",
};
};
exports.handleActiveDot = handleActiveDot;
//# sourceMappingURL=ActiveDotHandler.js.map