pmake/src/js/core.js

31 lines
477 B
JavaScript
Raw Normal View History

2026-05-08 05:18:35 +09:00
const pmake = {
2026-05-08 05:35:07 +09:00
VERSION : "0.0"
2026-05-08 05:18:35 +09:00
};
2026-05-08 05:35:07 +09:00
pmake.inherit = function(base) {
const func = function() {};
2026-05-08 05:18:35 +09:00
Object.setPrototypeOf(func.prototype, base.prototype);
return func;
};
2026-05-08 05:35:07 +09:00
pmake.inherited = function(base, parent) {
2026-05-08 05:18:35 +09:00
var proto = base.prototype;
2026-05-08 05:35:07 +09:00
while(proto) {
2026-05-08 05:18:35 +09:00
if(proto == parent.prototype) return true;
proto = Object.getPrototypeOf(proto);
}
return false;
2026-05-08 05:35:07 +09:00
};
2026-05-08 05:18:35 +09:00
2026-05-08 05:35:07 +09:00
pmake.register = function(base) {
if(pmake.inherited(base, Compiler)) {
2026-05-08 05:18:35 +09:00
}
2026-05-08 05:35:07 +09:00
};
2026-05-08 05:18:35 +09:00
2026-05-08 05:35:07 +09:00
function Compiler() {
2026-05-08 05:18:35 +09:00
}