UNPKG

simc-ast-builder

Version:

Parser and AST generator for SimulationCraft files

23 lines 745 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.handleStat = void 0; const SimCVisitorError_1 = require("../../errors/SimCVisitorError"); const fieldMaps_1 = require("../../utils/fieldMaps"); /** * Handler for stat access contexts */ const handleStat = ({ ctx, parts }) => { if (parts.length < 2) { throw new SimCVisitorError_1.SimCVisitorError("Stat access requires a field", ctx); } const field = parts[1] || ""; const fieldDef = (0, fieldMaps_1.getFieldDef)(field); return { expressionType: fieldDef.type, field: fieldDef, kind: "expression", nodeType: "stat", }; }; exports.handleStat = handleStat; //# sourceMappingURL=StatHandler.js.map