calcium-lang
Version:
Calcium language interpreter
27 lines • 850 B
JavaScript
import { AttributeNotFound } from "../error";
import { default as Sym } from "../symbol";
/**
*
* @param value
* @returns an internal type of an integer value
*/
export default function createInt(value) {
const self = new Proxy({}, {
get(target, property, receiver) {
if (property === Sym.description)
return value.toString();
else if (property === Sym.value)
return value;
else if (property === Sym.evaluate)
return (env) => self;
else if (property === Symbol.toPrimitive)
return (_) => value;
else if (property === Sym.class)
return "int";
else
throw new AttributeNotFound(property.toString());
},
});
return self;
}
//# sourceMappingURL=int.js.map