in packages/sqrl/src/ast/AstExpr.ts [122:142]
function slotExpr(state: AstExprState, name: string): Expr {
const slot = state.getSlot(name);
// Reduce references to a constant slot to just that slot (if the value is simple)
const slotExpr = state.exprForSlot(name);
if (
slotExpr.type === "constant" &&
(slotExpr.value === null ||
typeof slotExpr.value === "boolean" ||
typeof slotExpr.value === "string" ||
typeof slotExpr.value === "number" ||
(Array.isArray(slotExpr.value) && !slotExpr.value.length))
) {
return slotExpr;
}
return {
type: "value",
load: [slot],
slot,
};
}