X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=xynt-base.js;h=de7cd258db2047e851bee47d36426b0511779306;hb=64ddd66d9f8fb0906630c6a9fa7d961866f3e1cf;hp=a2cfd245d748ed1319e4ab02a70ce6deafad2969;hpb=7d3763202c13153dcfcc72570d7f69af52aea9fa;p=xynt.git diff --git a/xynt-base.js b/xynt-base.js index a2cfd24..de7cd25 100644 --- a/xynt-base.js +++ b/xynt-base.js @@ -1,7 +1,3 @@ -/* - * TODO - * super methods caller - */ function Extends(sub) { @@ -11,7 +7,7 @@ function Extends(sub) inh.xynt_sup = []; inh.xynt_sup_cl = []; - console.log("INIZIO EXT"); + console.log("EXT START"); var multi = function(sub, super, is_last) { @@ -23,10 +19,11 @@ function Extends(sub) console.log("LOOP: "+f); if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){ - console.log("M_FU: "+proto['name']+" F: "+f); + console.log("M_FU: "+proto[f]+" F: "+f); // sub[f] = proto[f]; - sub[f] = function(){ - console.log("INFU PR: " + proto['name'] + " FUNC: "+f+" THIS: " + this); + sub[f] = function() { + // console.log("INFU PR: " + proto[f] + " FUNC: "+f+" THIS: " + this); + console.log("SIMPLE LOG"); return proto[f].apply(this,arguments); } } @@ -66,8 +63,7 @@ function Extends(sub) */ sub.prototype = inh; - console.log(sub.prototype.xynt_sup); - console.log(sub.prototype.xynt_sup_cl); + console.log("EXT FINISH"); } function ExtendsInst(sub) @@ -80,12 +76,28 @@ function ExtendsInst(sub) { var proto = super.prototype; + var single = function(sub, fun) { + var cur_fun = fun; + + sub[cur_fun] = function(){ + // console.log("INFU PR: " + proto[f] + " FUNC: "+f+" THIS: " + this); + console.log("SIMPLE LOG INST: "+cur_fun); + console.log(proto[cur_fun]); + console.log(sub); + console.log(arguments); + return proto[cur_fun].apply(this, arguments); + } + }; + if (typeof(sub.xynt_sup) == 'undefined') sub.xynt_sup = new Array(); if (typeof(sub.xynt_sup_cl) == 'undefined') sub.xynt_sup_cl = new Array(); for (var f in proto) { + /* NOTE: this allow potentially TO BREAK by the extending class + if we disable it we don't have a reason to keep the callSuper function, + I need to meditate on it */ if (f == "xynt_sup" || f == "xynt_sup_cl") continue; @@ -99,11 +111,8 @@ function ExtendsInst(sub) console.log("LOOP: "+f); if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){ - console.log("M_FU: "+proto['name']+" F: "+f); - sub[f] = function(){ - console.log("INFU PR: " + proto[f] + " FUNC: "+f+" THIS: " + this); - return proto[f].apply(this, arguments); - } + console.log("M_FU: "+proto[f]+" F: "+f); + single(sub, f); } else { console.log("M_PR: "+proto.name+" A: "+f+" FUN: "+proto[f]); @@ -111,7 +120,7 @@ function ExtendsInst(sub) } } return true; - } + }; console.log("POST FUNC"); @@ -153,7 +162,8 @@ function ExtendsInst(sub) function show_class(cl) { console.log("Attributes Class of "+cl); for (f in cl.prototype) { - console.log(f+": ["+cl.prototype[f]+"]"); + console.log(f+"-v"); + console.log(cl.prototype[f]); } console.log("---"); } @@ -161,7 +171,8 @@ function show_class(cl) { function show_inst(inst) { console.log("Attributes Instance of "+inst); for (f in inst) { - console.log("["+f+"]: ["+inst[f]+"]"); + console.log(f+"-v"); + // console.log(inst[f]); } console.log("---"); }