calcium-lang
Version:
Calcium language interpreter
25 lines • 780 B
JavaScript
import { default as Sym } from "../symbol";
import { AttributeNotFound } from "../error";
/**
*
* @param value
* @returns the internal representation of a boolean value
*/
export default function createBool(value) {
const self = new Proxy({}, {
get(target, property, receiver) {
if (property === Sym.description)
return value ? "True" : "False";
else if (property === Sym.value)
return value;
else if (property === Sym.evaluate)
return (env) => self;
else if (property === Sym.class)
return "bool";
else
throw new AttributeNotFound(property.toString());
},
});
return self;
}
//# sourceMappingURL=bool.js.map