arcticpackage
Version:
A library for making Arctic packages in typescript.
34 lines • 1.02 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = __importDefault(require("util"));
class Instance {
constructor(klass) {
this.fields = new Map();
this.methods = new Map();
this.klass = klass;
this.fields = this.klass.properties;
}
get(name) {
if (this.fields.has(name)) {
return this.fields.get(name);
}
let method = this.klass.findMethod(name);
if (method != null)
return method.bind(this);
throw new String(`Undefined property '${name}'.`);
}
set(name, value) {
this.fields.set(name, value);
}
toString() {
return this.klass.name + " instance";
}
[util_1.default.inspect.custom]() {
return this.toString();
}
}
exports.default = Instance;
//# sourceMappingURL=Instance.js.map