UNPKG

simc-ast-builder

Version:

Parser and AST generator for SimulationCraft files

26 lines 952 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.handleSettings = void 0; const SimCVisitorError_1 = require("../../errors/SimCVisitorError"); const fieldMaps_1 = require("../../utils/fieldMaps"); /** * Handler for settings access contexts */ const handleSettings = ({ ctx, parts, }) => { if (parts.length < 2) { throw new SimCVisitorError_1.SimCVisitorError("Settings access requires a name", ctx); } const name = parts[1]; // Non-null assertion since we check parts.length above // Settings don't have fields like other access types // They just return their value directly const fieldDef = (0, fieldMaps_1.getFieldDef)("value"); return { expressionType: fieldDef.type, field: "", kind: "expression", nodeType: "settings", settingName: name, }; }; exports.handleSettings = handleSettings; //# sourceMappingURL=SettingsHandler.js.map