-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrhino.fixups.js
More file actions
26 lines (25 loc) · 823 Bytes
/
rhino.fixups.js
File metadata and controls
26 lines (25 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var rhino = {};
rhino.base = function(caller, me, opt_methodName, var_args) {
if(caller.superClass_) {
return caller.superClass_.constructor.apply(
me, Array.prototype.slice.call(arguments, 2))
}
var args = Array.prototype.slice.call(arguments, 3);
var foundCaller = false;
for(var ctor = me.constructor;
ctor; ctor = ctor.superClass_ && ctor.superClass_.constructor) {
if(ctor.prototype[opt_methodName] === caller) {
foundCaller = true
}else {
if(foundCaller) {
return ctor.prototype[opt_methodName].apply(me, args)
}
}
}
if(me[opt_methodName] === caller) {
return me.constructor.prototype[opt_methodName].apply(me, args)
}else {
throw Error("goog.base called from a method of one name " +
"to a method of a different name");
}
};