Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / lang / functional / tailrec.js @ 13

History | View | Annotate | Download (1.2 KB)

1 9 andrej.cim
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6
7
8
if(!dojo._hasResource["dojox.lang.functional.tailrec"]){
9
dojo._hasResource["dojox.lang.functional.tailrec"]=true;
10
dojo.provide("dojox.lang.functional.tailrec");
11
dojo.require("dojox.lang.functional.lambda");
12
dojo.require("dojox.lang.functional.util");
13
(function(){
14
var df=dojox.lang.functional,_1=df.inlineLambda,_2="_x";
15
df.tailrec=function(_3,_4,_5){
16
var c,t,b,cs,ts,bs,_6={},_7={},_8=function(x){
17
_6[x]=1;
18
};
19
if(typeof _3=="string"){
20
cs=_1(_3,_2,_8);
21
}else{
22
c=df.lambda(_3);
23
cs="_c.apply(this, _x)";
24
_7["_c=_t.c"]=1;
25
}
26
if(typeof _4=="string"){
27
ts=_1(_4,_2,_8);
28
}else{
29
t=df.lambda(_4);
30
ts="_t.t.apply(this, _x)";
31
}
32
if(typeof _5=="string"){
33
bs=_1(_5,_2,_8);
34
}else{
35
b=df.lambda(_5);
36
bs="_b.apply(this, _x)";
37
_7["_b=_t.b"]=1;
38
}
39
var _9=df.keys(_6),_a=df.keys(_7),f=new Function([],"var _x=arguments,_t=_x.callee,_c=_t.c,_b=_t.b".concat(_9.length?","+_9.join(","):"",_a.length?",_t=_x.callee,"+_a.join(","):t?",_t=_x.callee":"",";for(;!",cs,";_x=",bs,");return ",ts));
40
if(c){
41
f.c=c;
42
}
43
if(t){
44
f.t=t;
45
}
46
if(b){
47
f.b=b;
48
}
49
return f;
50
};
51
})();
52
}