UNPKG

simc-ast-builder

Version:

Parser and AST generator for SimulationCraft files

60 lines 2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.handleRelease = exports.handleEvoker = exports.handleEmpowering = void 0; const SimCVisitorError_1 = require("../../../errors/SimCVisitorError"); const fieldMaps_1 = require("../../../utils/fieldMaps"); /** * Handler for evoker access contexts * This handles access to evoker-specific properties */ const handleEvoker = ({ ctx, parts, }) => { if (parts.length < 2) { throw new SimCVisitorError_1.SimCVisitorError("Evoker 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: "evoker", }; }; exports.handleEvoker = handleEvoker; /** * Handler for empowering access contexts * This handles access to empowering spells for Evoker */ const handleEmpowering = ({ ctx, parts, }) => { if (parts.length < 2) { throw new SimCVisitorError_1.SimCVisitorError("Empowering 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: "empowering", }; }; exports.handleEmpowering = handleEmpowering; /** * Handler for release access contexts * This handles access to release-specific properties for Evoker */ const handleRelease = ({ ctx, parts, }) => { if (parts.length < 2) { throw new SimCVisitorError_1.SimCVisitorError("Release 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: "release", }; }; exports.handleRelease = handleRelease; //# sourceMappingURL=EvokerHandler.js.map