projects
/
xynt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
915fee7
)
ExtendsInst function added to extends a previous object
author
Matteo Nastasi
<matteo.nastasi@lucinilucini.com>
Thu, 24 Nov 2011 17:59:52 +0000
(18:59 +0100)
committer
Matteo Nastasi
<matteo.nastasi@lucinilucini.com>
Thu, 24 Nov 2011 17:59:52 +0000
(18:59 +0100)
xynt-base.js
patch
|
blob
|
history
diff --git
a/xynt-base.js
b/xynt-base.js
index
157141b
..
a2cfd24
100644
(file)
--- a/
xynt-base.js
+++ b/
xynt-base.js
@@
-44,6
+44,19
@@
function Extends(sub)
}
multi(inh, sub, true);
}
multi(inh, sub, true);
+
+
+ inh.callSuper = function(fnc){
+ var len = this.xynt_sup_cl.length;
+ for ( var i=0 ; i<len ; i++) {
+ var super = this.xynt_sup_cl[i];
+ if( (fnc in super.prototype) && (typeof super.prototype[fnc] == "function") ){
+ return super.prototype[fnc].apply(this,[].splice.call(arguments,1));
+ }
+ }
+ return null;
+ }
+
/*
inh.superrr = function(cl, method) {
console.log("xyx "+cl);
/*
inh.superrr = function(cl, method) {
console.log("xyx "+cl);
@@
-76,8
+89,13
@@
function ExtendsInst(sub)
if (f == "xynt_sup" || f == "xynt_sup_cl")
continue;
if (f == "xynt_sup" || f == "xynt_sup_cl")
continue;
- if (typeof(sub[f]) != 'undefined')
+ console.log("ExtensInst::multi: "+f+" type: "+typeof(sub[f]));
+ if (typeof(sub[f]) != 'undefined') {
+ if (typeof(sub[f]) == typeof(proto[f]))
+ continue;
+ console.log("MULTI: false1");
return false;
return false;
+ }
console.log("LOOP: "+f);
if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){
console.log("LOOP: "+f);
if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){
@@
-117,6
+135,17
@@
function ExtendsInst(sub)
sub.xynt_sup_cl.push(cl);
}
sub.xynt_sup_cl.push(cl);
}
+ sub.callSuper = function(fnc){
+ var len = this.xynt_sup_cl.length;
+ for ( var i=0 ; i<len ; i++) {
+ var super = this.xynt_sup_cl[i];
+ if( (fnc in super.prototype) && (typeof super.prototype[fnc] == "function") ){
+ return super.prototype[fnc].apply(this,[].splice.call(arguments,1));
+ }
+ }
+ return null;
+ }
+
console.log("FINE EXT INST");
return true;
}
console.log("FINE EXT INST");
return true;
}
@@
-132,7
+161,7
@@
function show_class(cl) {
function show_inst(inst) {
console.log("Attributes Instance of "+inst);
for (f in inst) {
function show_inst(inst) {
console.log("Attributes Instance of "+inst);
for (f in inst) {
- console.log(
f+"
: ["+inst[f]+"]");
+ console.log(
"["+f+"]
: ["+inst[f]+"]");
}
console.log("---");
}
}
console.log("---");
}