simc-ast-builder
Version:
Parser and AST generator for SimulationCraft files
42 lines • 1.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.handlePaladin = exports.handleConsecration = void 0;
const SimCVisitorError_1 = require("../../../errors/SimCVisitorError");
const fieldMaps_1 = require("../../../utils/fieldMaps");
/**
* Handler for paladin access contexts
* This handles access to paladin-specific properties
*/
const handlePaladin = ({ ctx, parts, }) => {
if (parts.length < 2) {
throw new SimCVisitorError_1.SimCVisitorError("Paladin 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: "paladin",
};
};
exports.handlePaladin = handlePaladin;
/**
* Handler for consecration access contexts
* This handles access to consecration-specific properties for Paladin
*/
const handleConsecration = ({ ctx, parts, }) => {
if (parts.length < 2) {
throw new SimCVisitorError_1.SimCVisitorError("Consecration 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: "consecration",
};
};
exports.handleConsecration = handleConsecration;
//# sourceMappingURL=PaladinHandler.js.map