pmake/src/js/core.js

39 lines
682 B
JavaScript
Raw Normal View History

2026-05-08 05:18:35 +09:00
const pmake = {
2026-05-08 19:07:45 +09:00
VERSION : "0.0",
actions : {},
compilers : {}
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) {
2026-05-08 19:07:45 +09:00
if(pmake.inherited(base, pmake.Compiler)) {
pmake.compilers[base.target] = base;
} else if(pmake.inherited(base, pmake.Action)) {
pmake.actions[base.target] = base;
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 19:07:45 +09:00
pmake.Compiler = function() {
};
pmake.Action = function() {
};