Kernel-Methods.deploy.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  1. smalltalk.addPackage('Kernel-Methods');
  2. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "applyTo:arguments:",
  6. fn: function (anObject,aCollection){
  7. var self=this;
  8. return smalltalk.withContext(function($ctx1) {
  9. return self.apply(anObject, aCollection);
  10. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.BlockClosure)})},
  11. messageSends: []}),
  12. smalltalk.BlockClosure);
  13. smalltalk.addMethod(
  14. smalltalk.method({
  15. selector: "asCompiledMethod:",
  16. fn: function (aString){
  17. var self=this;
  18. return smalltalk.withContext(function($ctx1) {
  19. return smalltalk.method({selector:aString, fn:self});;
  20. return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},smalltalk.BlockClosure)})},
  21. messageSends: []}),
  22. smalltalk.BlockClosure);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "compiledSource",
  26. fn: function (){
  27. var self=this;
  28. return smalltalk.withContext(function($ctx1) {
  29. return self.toString();
  30. return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.BlockClosure)})},
  31. messageSends: []}),
  32. smalltalk.BlockClosure);
  33. smalltalk.addMethod(
  34. smalltalk.method({
  35. selector: "currySelf",
  36. fn: function (){
  37. var self=this;
  38. return smalltalk.withContext(function($ctx1) {
  39. return function () {
  40. var args = [ this ];
  41. args.push.apply(args, arguments);
  42. return self.apply(null, args);
  43. }
  44. ;
  45. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},smalltalk.BlockClosure)})},
  46. messageSends: []}),
  47. smalltalk.BlockClosure);
  48. smalltalk.addMethod(
  49. smalltalk.method({
  50. selector: "ensure:",
  51. fn: function (aBlock){
  52. var self=this;
  53. return smalltalk.withContext(function($ctx1) {
  54. try{return self()}finally{aBlock._value()};
  55. return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  56. messageSends: []}),
  57. smalltalk.BlockClosure);
  58. smalltalk.addMethod(
  59. smalltalk.method({
  60. selector: "fork",
  61. fn: function (){
  62. var self=this;
  63. function $ForkPool(){return smalltalk.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  64. return smalltalk.withContext(function($ctx1) {
  65. _st(_st($ForkPool())._default())._fork_(self);
  66. return self}, function($ctx1) {$ctx1.fill(self,"fork",{},smalltalk.BlockClosure)})},
  67. messageSends: ["fork:", "default"]}),
  68. smalltalk.BlockClosure);
  69. smalltalk.addMethod(
  70. smalltalk.method({
  71. selector: "new",
  72. fn: function (){
  73. var self=this;
  74. return smalltalk.withContext(function($ctx1) {
  75. return new self();
  76. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.BlockClosure)})},
  77. messageSends: []}),
  78. smalltalk.BlockClosure);
  79. smalltalk.addMethod(
  80. smalltalk.method({
  81. selector: "newValue:",
  82. fn: function (anObject){
  83. var self=this;
  84. return smalltalk.withContext(function($ctx1) {
  85. return new self(anObject);
  86. return self}, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},smalltalk.BlockClosure)})},
  87. messageSends: []}),
  88. smalltalk.BlockClosure);
  89. smalltalk.addMethod(
  90. smalltalk.method({
  91. selector: "newValue:value:",
  92. fn: function (anObject,anObject2){
  93. var self=this;
  94. return smalltalk.withContext(function($ctx1) {
  95. return new self(anObject, anObject2);
  96. return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},smalltalk.BlockClosure)})},
  97. messageSends: []}),
  98. smalltalk.BlockClosure);
  99. smalltalk.addMethod(
  100. smalltalk.method({
  101. selector: "newValue:value:value:",
  102. fn: function (anObject,anObject2,anObject3){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) {
  105. return new self(anObject, anObject2,anObject3);
  106. return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.BlockClosure)})},
  107. messageSends: []}),
  108. smalltalk.BlockClosure);
  109. smalltalk.addMethod(
  110. smalltalk.method({
  111. selector: "numArgs",
  112. fn: function (){
  113. var self=this;
  114. return smalltalk.withContext(function($ctx1) {
  115. return self.length;
  116. return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.BlockClosure)})},
  117. messageSends: []}),
  118. smalltalk.BlockClosure);
  119. smalltalk.addMethod(
  120. smalltalk.method({
  121. selector: "on:do:",
  122. fn: function (anErrorClass,aBlock){
  123. var self=this;
  124. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  125. return smalltalk.withContext(function($ctx1) {
  126. var $2,$1;
  127. $1=_st(self)._try_catch_(self,(function(error){
  128. var smalltalkError;
  129. return smalltalk.withContext(function($ctx2) {
  130. smalltalkError=_st(_st($Smalltalk())._current())._asSmalltalkException_(error);
  131. smalltalkError;
  132. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  133. if(smalltalk.assert($2)){
  134. return _st(aBlock)._value_(smalltalkError);
  135. } else {
  136. return _st(smalltalkError)._signal();
  137. };
  138. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1)})}));
  139. return $1;
  140. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},smalltalk.BlockClosure)})},
  141. messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"]}),
  142. smalltalk.BlockClosure);
  143. smalltalk.addMethod(
  144. smalltalk.method({
  145. selector: "timeToRun",
  146. fn: function (){
  147. var self=this;
  148. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  149. return smalltalk.withContext(function($ctx1) {
  150. var $1;
  151. $1=_st($Date())._millisecondsToRun_(self);
  152. return $1;
  153. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},smalltalk.BlockClosure)})},
  154. messageSends: ["millisecondsToRun:"]}),
  155. smalltalk.BlockClosure);
  156. smalltalk.addMethod(
  157. smalltalk.method({
  158. selector: "value",
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. return self();;
  163. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.BlockClosure)})},
  164. messageSends: []}),
  165. smalltalk.BlockClosure);
  166. smalltalk.addMethod(
  167. smalltalk.method({
  168. selector: "value:",
  169. fn: function (anArg){
  170. var self=this;
  171. return smalltalk.withContext(function($ctx1) {
  172. return self(anArg);;
  173. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},smalltalk.BlockClosure)})},
  174. messageSends: []}),
  175. smalltalk.BlockClosure);
  176. smalltalk.addMethod(
  177. smalltalk.method({
  178. selector: "value:value:",
  179. fn: function (firstArg,secondArg){
  180. var self=this;
  181. return smalltalk.withContext(function($ctx1) {
  182. return self(firstArg, secondArg);;
  183. return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},smalltalk.BlockClosure)})},
  184. messageSends: []}),
  185. smalltalk.BlockClosure);
  186. smalltalk.addMethod(
  187. smalltalk.method({
  188. selector: "value:value:value:",
  189. fn: function (firstArg,secondArg,thirdArg){
  190. var self=this;
  191. return smalltalk.withContext(function($ctx1) {
  192. return self(firstArg, secondArg, thirdArg);;
  193. return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},smalltalk.BlockClosure)})},
  194. messageSends: []}),
  195. smalltalk.BlockClosure);
  196. smalltalk.addMethod(
  197. smalltalk.method({
  198. selector: "valueWithInterval:",
  199. fn: function (aNumber){
  200. var self=this;
  201. return smalltalk.withContext(function($ctx1) {
  202. var interval = setInterval(self, aNumber);
  203. return smalltalk.Timeout._on_(interval);
  204. ;
  205. return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  206. messageSends: []}),
  207. smalltalk.BlockClosure);
  208. smalltalk.addMethod(
  209. smalltalk.method({
  210. selector: "valueWithPossibleArguments:",
  211. fn: function (aCollection){
  212. var self=this;
  213. return smalltalk.withContext(function($ctx1) {
  214. return self.apply(null, aCollection);;
  215. return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.BlockClosure)})},
  216. messageSends: []}),
  217. smalltalk.BlockClosure);
  218. smalltalk.addMethod(
  219. smalltalk.method({
  220. selector: "valueWithTimeout:",
  221. fn: function (aNumber){
  222. var self=this;
  223. return smalltalk.withContext(function($ctx1) {
  224. var timeout = setTimeout(self, aNumber);
  225. return smalltalk.Timeout._on_(timeout);
  226. ;
  227. return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  228. messageSends: []}),
  229. smalltalk.BlockClosure);
  230. smalltalk.addMethod(
  231. smalltalk.method({
  232. selector: "whileFalse",
  233. fn: function (){
  234. var self=this;
  235. return smalltalk.withContext(function($ctx1) {
  236. _st(self)._whileFalse_((function(){
  237. return smalltalk.withContext(function($ctx2) {
  238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  239. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},smalltalk.BlockClosure)})},
  240. messageSends: ["whileFalse:"]}),
  241. smalltalk.BlockClosure);
  242. smalltalk.addMethod(
  243. smalltalk.method({
  244. selector: "whileFalse:",
  245. fn: function (aBlock){
  246. var self=this;
  247. return smalltalk.withContext(function($ctx1) {
  248. while(!self()) {aBlock()};
  249. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  250. messageSends: []}),
  251. smalltalk.BlockClosure);
  252. smalltalk.addMethod(
  253. smalltalk.method({
  254. selector: "whileTrue",
  255. fn: function (){
  256. var self=this;
  257. return smalltalk.withContext(function($ctx1) {
  258. _st(self)._whileTrue_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  261. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},smalltalk.BlockClosure)})},
  262. messageSends: ["whileTrue:"]}),
  263. smalltalk.BlockClosure);
  264. smalltalk.addMethod(
  265. smalltalk.method({
  266. selector: "whileTrue:",
  267. fn: function (aBlock){
  268. var self=this;
  269. return smalltalk.withContext(function($ctx1) {
  270. while(self()) {aBlock()};
  271. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  272. messageSends: []}),
  273. smalltalk.BlockClosure);
  274. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  275. smalltalk.addMethod(
  276. smalltalk.method({
  277. selector: "arguments",
  278. fn: function (){
  279. var self=this;
  280. return smalltalk.withContext(function($ctx1) {
  281. return self.args || [];
  282. return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.CompiledMethod)})},
  283. messageSends: []}),
  284. smalltalk.CompiledMethod);
  285. smalltalk.addMethod(
  286. smalltalk.method({
  287. selector: "category",
  288. fn: function (){
  289. var self=this;
  290. return smalltalk.withContext(function($ctx1) {
  291. var $2,$1;
  292. $2=_st(self)._basicAt_("category");
  293. if(($receiver = $2) == nil || $receiver == undefined){
  294. $1=_st(self)._defaultCategory();
  295. } else {
  296. $1=$2;
  297. };
  298. return $1;
  299. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.CompiledMethod)})},
  300. messageSends: ["ifNil:", "defaultCategory", "basicAt:"]}),
  301. smalltalk.CompiledMethod);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "category:",
  305. fn: function (aString){
  306. var self=this;
  307. var oldCategory;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. oldCategory=_st(self)._category();
  311. _st(self)._basicAt_put_("category",aString);
  312. $1=_st(self)._methodClass();
  313. if(($receiver = $1) == nil || $receiver == undefined){
  314. $1;
  315. } else {
  316. _st(_st(_st(self)._methodClass())._organization())._addElement_(aString);
  317. _st(_st(_st(_st(self)._methodClass())._methods())._select_((function(each){
  318. return smalltalk.withContext(function($ctx2) {
  319. return _st(_st(each)._category()).__eq(oldCategory);
  320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._ifEmpty_((function(){
  321. return smalltalk.withContext(function($ctx2) {
  322. return _st(_st(_st(self)._methodClass())._organization())._removeElement_(oldCategory);
  323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  324. };
  325. return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldCategory:oldCategory},smalltalk.CompiledMethod)})},
  326. messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"]}),
  327. smalltalk.CompiledMethod);
  328. smalltalk.addMethod(
  329. smalltalk.method({
  330. selector: "defaultCategory",
  331. fn: function (){
  332. var self=this;
  333. return smalltalk.withContext(function($ctx1) {
  334. return "as yet unclassified";
  335. }, function($ctx1) {$ctx1.fill(self,"defaultCategory",{},smalltalk.CompiledMethod)})},
  336. messageSends: []}),
  337. smalltalk.CompiledMethod);
  338. smalltalk.addMethod(
  339. smalltalk.method({
  340. selector: "fn",
  341. fn: function (){
  342. var self=this;
  343. return smalltalk.withContext(function($ctx1) {
  344. var $1;
  345. $1=_st(self)._basicAt_("fn");
  346. return $1;
  347. }, function($ctx1) {$ctx1.fill(self,"fn",{},smalltalk.CompiledMethod)})},
  348. messageSends: ["basicAt:"]}),
  349. smalltalk.CompiledMethod);
  350. smalltalk.addMethod(
  351. smalltalk.method({
  352. selector: "fn:",
  353. fn: function (aBlock){
  354. var self=this;
  355. return smalltalk.withContext(function($ctx1) {
  356. _st(self)._basicAt_put_("fn",aBlock);
  357. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},smalltalk.CompiledMethod)})},
  358. messageSends: ["basicAt:put:"]}),
  359. smalltalk.CompiledMethod);
  360. smalltalk.addMethod(
  361. smalltalk.method({
  362. selector: "isCompiledMethod",
  363. fn: function (){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) {
  366. return true;
  367. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.CompiledMethod)})},
  368. messageSends: []}),
  369. smalltalk.CompiledMethod);
  370. smalltalk.addMethod(
  371. smalltalk.method({
  372. selector: "messageSends",
  373. fn: function (){
  374. var self=this;
  375. return smalltalk.withContext(function($ctx1) {
  376. var $1;
  377. $1=_st(self)._basicAt_("messageSends");
  378. return $1;
  379. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.CompiledMethod)})},
  380. messageSends: ["basicAt:"]}),
  381. smalltalk.CompiledMethod);
  382. smalltalk.addMethod(
  383. smalltalk.method({
  384. selector: "methodClass",
  385. fn: function (){
  386. var self=this;
  387. return smalltalk.withContext(function($ctx1) {
  388. var $1;
  389. $1=_st(self)._basicAt_("methodClass");
  390. return $1;
  391. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},smalltalk.CompiledMethod)})},
  392. messageSends: ["basicAt:"]}),
  393. smalltalk.CompiledMethod);
  394. smalltalk.addMethod(
  395. smalltalk.method({
  396. selector: "protocol",
  397. fn: function (){
  398. var self=this;
  399. return smalltalk.withContext(function($ctx1) {
  400. var $1;
  401. $1=_st(self)._category();
  402. return $1;
  403. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.CompiledMethod)})},
  404. messageSends: ["category"]}),
  405. smalltalk.CompiledMethod);
  406. smalltalk.addMethod(
  407. smalltalk.method({
  408. selector: "referencedClasses",
  409. fn: function (){
  410. var self=this;
  411. return smalltalk.withContext(function($ctx1) {
  412. var $1;
  413. $1=_st(self)._basicAt_("referencedClasses");
  414. return $1;
  415. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},smalltalk.CompiledMethod)})},
  416. messageSends: ["basicAt:"]}),
  417. smalltalk.CompiledMethod);
  418. smalltalk.addMethod(
  419. smalltalk.method({
  420. selector: "selector",
  421. fn: function (){
  422. var self=this;
  423. return smalltalk.withContext(function($ctx1) {
  424. var $1;
  425. $1=_st(self)._basicAt_("selector");
  426. return $1;
  427. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.CompiledMethod)})},
  428. messageSends: ["basicAt:"]}),
  429. smalltalk.CompiledMethod);
  430. smalltalk.addMethod(
  431. smalltalk.method({
  432. selector: "selector:",
  433. fn: function (aString){
  434. var self=this;
  435. return smalltalk.withContext(function($ctx1) {
  436. _st(self)._basicAt_put_("selector",aString);
  437. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.CompiledMethod)})},
  438. messageSends: ["basicAt:put:"]}),
  439. smalltalk.CompiledMethod);
  440. smalltalk.addMethod(
  441. smalltalk.method({
  442. selector: "source",
  443. fn: function (){
  444. var self=this;
  445. return smalltalk.withContext(function($ctx1) {
  446. var $2,$1;
  447. $2=_st(self)._basicAt_("source");
  448. if(($receiver = $2) == nil || $receiver == undefined){
  449. $1="";
  450. } else {
  451. $1=$2;
  452. };
  453. return $1;
  454. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.CompiledMethod)})},
  455. messageSends: ["ifNil:", "basicAt:"]}),
  456. smalltalk.CompiledMethod);
  457. smalltalk.addMethod(
  458. smalltalk.method({
  459. selector: "source:",
  460. fn: function (aString){
  461. var self=this;
  462. return smalltalk.withContext(function($ctx1) {
  463. _st(self)._basicAt_put_("source",aString);
  464. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.CompiledMethod)})},
  465. messageSends: ["basicAt:put:"]}),
  466. smalltalk.CompiledMethod);
  467. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  468. smalltalk.addMethod(
  469. smalltalk.method({
  470. selector: "addWorker",
  471. fn: function (){
  472. var self=this;
  473. return smalltalk.withContext(function($ctx1) {
  474. _st(self["@worker"])._valueWithTimeout_((0));
  475. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  476. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},smalltalk.ForkPool)})},
  477. messageSends: ["valueWithTimeout:", "+"]}),
  478. smalltalk.ForkPool);
  479. smalltalk.addMethod(
  480. smalltalk.method({
  481. selector: "defaultMaxPoolSize",
  482. fn: function (){
  483. var self=this;
  484. return smalltalk.withContext(function($ctx1) {
  485. var $1;
  486. $1=_st(_st(self)._class())._defaultMaxPoolSize();
  487. return $1;
  488. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool)})},
  489. messageSends: ["defaultMaxPoolSize", "class"]}),
  490. smalltalk.ForkPool);
  491. smalltalk.addMethod(
  492. smalltalk.method({
  493. selector: "fork:",
  494. fn: function (aBlock){
  495. var self=this;
  496. return smalltalk.withContext(function($ctx1) {
  497. var $1;
  498. $1=_st(self["@poolSize"]).__lt(_st(self)._maxPoolSize());
  499. if(smalltalk.assert($1)){
  500. _st(self)._addWorker();
  501. };
  502. _st(self["@queue"])._nextPut_(aBlock);
  503. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},smalltalk.ForkPool)})},
  504. messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "nextPut:"]}),
  505. smalltalk.ForkPool);
  506. smalltalk.addMethod(
  507. smalltalk.method({
  508. selector: "initialize",
  509. fn: function (){
  510. var self=this;
  511. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  512. return smalltalk.withContext(function($ctx1) {
  513. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  514. self["@poolSize"]=(0);
  515. self["@queue"]=_st($Queue())._new();
  516. self["@worker"]=_st(self)._makeWorker();
  517. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ForkPool)})},
  518. messageSends: ["initialize", "new", "makeWorker"]}),
  519. smalltalk.ForkPool);
  520. smalltalk.addMethod(
  521. smalltalk.method({
  522. selector: "makeWorker",
  523. fn: function (){
  524. var self=this;
  525. var sentinel;
  526. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  527. return smalltalk.withContext(function($ctx1) {
  528. var $2,$1;
  529. sentinel=_st($Object())._new();
  530. $1=(function(){
  531. var block;
  532. return smalltalk.withContext(function($ctx2) {
  533. self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  534. self["@poolSize"];
  535. block=_st(self["@queue"])._nextIfAbsent_((function(){
  536. return smalltalk.withContext(function($ctx3) {
  537. return sentinel;
  538. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  539. block;
  540. $2=_st(block).__eq_eq(sentinel);
  541. if(! smalltalk.assert($2)){
  542. return _st((function(){
  543. return smalltalk.withContext(function($ctx3) {
  544. return _st(block)._value();
  545. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  546. return smalltalk.withContext(function($ctx3) {
  547. return _st(self)._addWorker();
  548. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  549. };
  550. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})});
  551. return $1;
  552. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},smalltalk.ForkPool)})},
  553. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="]}),
  554. smalltalk.ForkPool);
  555. smalltalk.addMethod(
  556. smalltalk.method({
  557. selector: "maxPoolSize",
  558. fn: function (){
  559. var self=this;
  560. return smalltalk.withContext(function($ctx1) {
  561. var $2,$1;
  562. $2=self["@maxPoolSize"];
  563. if(($receiver = $2) == nil || $receiver == undefined){
  564. $1=_st(self)._defaultMaxPoolSize();
  565. } else {
  566. $1=$2;
  567. };
  568. return $1;
  569. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},smalltalk.ForkPool)})},
  570. messageSends: ["ifNil:", "defaultMaxPoolSize"]}),
  571. smalltalk.ForkPool);
  572. smalltalk.addMethod(
  573. smalltalk.method({
  574. selector: "maxPoolSize:",
  575. fn: function (anInteger){
  576. var self=this;
  577. return smalltalk.withContext(function($ctx1) {
  578. self["@maxPoolSize"]=anInteger;
  579. return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger},smalltalk.ForkPool)})},
  580. messageSends: []}),
  581. smalltalk.ForkPool);
  582. smalltalk.ForkPool.klass.iVarNames = ['default'];
  583. smalltalk.addMethod(
  584. smalltalk.method({
  585. selector: "default",
  586. fn: function (){
  587. var self=this;
  588. return smalltalk.withContext(function($ctx1) {
  589. var $2,$1;
  590. $2=self["@default"];
  591. if(($receiver = $2) == nil || $receiver == undefined){
  592. self["@default"]=_st(self)._new();
  593. $1=self["@default"];
  594. } else {
  595. $1=$2;
  596. };
  597. return $1;
  598. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ForkPool.klass)})},
  599. messageSends: ["ifNil:", "new"]}),
  600. smalltalk.ForkPool.klass);
  601. smalltalk.addMethod(
  602. smalltalk.method({
  603. selector: "defaultMaxPoolSize",
  604. fn: function (){
  605. var self=this;
  606. return smalltalk.withContext(function($ctx1) {
  607. var $1;
  608. $1=(100);
  609. return $1;
  610. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool.klass)})},
  611. messageSends: []}),
  612. smalltalk.ForkPool.klass);
  613. smalltalk.addMethod(
  614. smalltalk.method({
  615. selector: "resetDefault",
  616. fn: function (){
  617. var self=this;
  618. return smalltalk.withContext(function($ctx1) {
  619. self["@default"]=nil;
  620. return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{},smalltalk.ForkPool.klass)})},
  621. messageSends: []}),
  622. smalltalk.ForkPool.klass);
  623. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  624. smalltalk.addMethod(
  625. smalltalk.method({
  626. selector: "arguments",
  627. fn: function (){
  628. var self=this;
  629. return smalltalk.withContext(function($ctx1) {
  630. var $1;
  631. $1=self["@arguments"];
  632. return $1;
  633. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.Message)})},
  634. messageSends: []}),
  635. smalltalk.Message);
  636. smalltalk.addMethod(
  637. smalltalk.method({
  638. selector: "arguments:",
  639. fn: function (anArray){
  640. var self=this;
  641. return smalltalk.withContext(function($ctx1) {
  642. self["@arguments"]=anArray;
  643. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray},smalltalk.Message)})},
  644. messageSends: []}),
  645. smalltalk.Message);
  646. smalltalk.addMethod(
  647. smalltalk.method({
  648. selector: "printOn:",
  649. fn: function (aStream){
  650. var self=this;
  651. return smalltalk.withContext(function($ctx1) {
  652. var $1,$2;
  653. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  654. $1=aStream;
  655. _st($1)._nextPutAll_("(");
  656. _st($1)._nextPutAll_(_st(self)._selector());
  657. $2=_st($1)._nextPutAll_(")");
  658. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Message)})},
  659. messageSends: ["printOn:", "nextPutAll:", "selector"]}),
  660. smalltalk.Message);
  661. smalltalk.addMethod(
  662. smalltalk.method({
  663. selector: "selector",
  664. fn: function (){
  665. var self=this;
  666. return smalltalk.withContext(function($ctx1) {
  667. var $1;
  668. $1=self["@selector"];
  669. return $1;
  670. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.Message)})},
  671. messageSends: []}),
  672. smalltalk.Message);
  673. smalltalk.addMethod(
  674. smalltalk.method({
  675. selector: "selector:",
  676. fn: function (aString){
  677. var self=this;
  678. return smalltalk.withContext(function($ctx1) {
  679. self["@selector"]=aString;
  680. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.Message)})},
  681. messageSends: []}),
  682. smalltalk.Message);
  683. smalltalk.addMethod(
  684. smalltalk.method({
  685. selector: "sendTo:",
  686. fn: function (anObject){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. var $1;
  690. $1=_st(anObject)._perform_withArguments_(_st(self)._selector(),_st(self)._arguments());
  691. return $1;
  692. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},smalltalk.Message)})},
  693. messageSends: ["perform:withArguments:", "selector", "arguments"]}),
  694. smalltalk.Message);
  695. smalltalk.addMethod(
  696. smalltalk.method({
  697. selector: "selector:arguments:",
  698. fn: function (aString,anArray){
  699. var self=this;
  700. return smalltalk.withContext(function($ctx1) {
  701. var $2,$3,$1;
  702. $2=_st(self)._new();
  703. _st($2)._selector_(aString);
  704. _st($2)._arguments_(anArray);
  705. $3=_st($2)._yourself();
  706. $1=$3;
  707. return $1;
  708. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},smalltalk.Message.klass)})},
  709. messageSends: ["selector:", "new", "arguments:", "yourself"]}),
  710. smalltalk.Message.klass);
  711. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  712. smalltalk.addMethod(
  713. smalltalk.method({
  714. selector: "asString",
  715. fn: function (){
  716. var self=this;
  717. return smalltalk.withContext(function($ctx1) {
  718. var $2,$1;
  719. $2=_st(self)._isBlockContext();
  720. if(smalltalk.assert($2)){
  721. $1=_st(_st("a block (in ").__comma(_st(_st(_st(_st(self)._methodContext())._receiver())._class())._printString())).__comma(")");
  722. } else {
  723. $1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector());
  724. };
  725. return $1;
  726. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.MethodContext)})},
  727. messageSends: ["ifTrue:ifFalse:", ",", "printString", "class", "receiver", "methodContext", "selector", "isBlockContext"]}),
  728. smalltalk.MethodContext);
  729. smalltalk.addMethod(
  730. smalltalk.method({
  731. selector: "home",
  732. fn: function (){
  733. var self=this;
  734. return smalltalk.withContext(function($ctx1) {
  735. return self.methodContext || self.homeContext;
  736. return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})},
  737. messageSends: []}),
  738. smalltalk.MethodContext);
  739. smalltalk.addMethod(
  740. smalltalk.method({
  741. selector: "isBlockContext",
  742. fn: function (){
  743. var self=this;
  744. return smalltalk.withContext(function($ctx1) {
  745. var $1;
  746. $1=_st(_st(self)._selector())._isNil();
  747. return $1;
  748. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.MethodContext)})},
  749. messageSends: ["isNil", "selector"]}),
  750. smalltalk.MethodContext);
  751. smalltalk.addMethod(
  752. smalltalk.method({
  753. selector: "locals",
  754. fn: function (){
  755. var self=this;
  756. return smalltalk.withContext(function($ctx1) {
  757. return self.locals;
  758. return self}, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.MethodContext)})},
  759. messageSends: []}),
  760. smalltalk.MethodContext);
  761. smalltalk.addMethod(
  762. smalltalk.method({
  763. selector: "method",
  764. fn: function (){
  765. var self=this;
  766. return smalltalk.withContext(function($ctx1) {
  767. var $1;
  768. $1=_st(_st(_st(_st(self)._methodContext())._receiver())._class())._lookupSelector_(_st(_st(self)._methodContext())._selector());
  769. return $1;
  770. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodContext)})},
  771. messageSends: ["lookupSelector:", "selector", "methodContext", "class", "receiver"]}),
  772. smalltalk.MethodContext);
  773. smalltalk.addMethod(
  774. smalltalk.method({
  775. selector: "methodContext",
  776. fn: function (){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) {
  779. var $1,$2,$3;
  780. $1=_st(self)._isBlockContext();
  781. if(! smalltalk.assert($1)){
  782. $2=self;
  783. return $2;
  784. };
  785. $3=_st(self)._home();
  786. return $3;
  787. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})},
  788. messageSends: ["ifFalse:", "isBlockContext", "home"]}),
  789. smalltalk.MethodContext);
  790. smalltalk.addMethod(
  791. smalltalk.method({
  792. selector: "outerContext",
  793. fn: function (){
  794. var self=this;
  795. return smalltalk.withContext(function($ctx1) {
  796. return self.homeContext;
  797. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})},
  798. messageSends: []}),
  799. smalltalk.MethodContext);
  800. smalltalk.addMethod(
  801. smalltalk.method({
  802. selector: "pc",
  803. fn: function (){
  804. var self=this;
  805. return smalltalk.withContext(function($ctx1) {
  806. return self.pc;
  807. return self}, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.MethodContext)})},
  808. messageSends: []}),
  809. smalltalk.MethodContext);
  810. smalltalk.addMethod(
  811. smalltalk.method({
  812. selector: "printOn:",
  813. fn: function (aStream){
  814. var self=this;
  815. return smalltalk.withContext(function($ctx1) {
  816. var $1,$2;
  817. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  818. $1=aStream;
  819. _st($1)._nextPutAll_("(");
  820. _st($1)._nextPutAll_(_st(self)._asString());
  821. $2=_st($1)._nextPutAll_(")");
  822. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MethodContext)})},
  823. messageSends: ["printOn:", "nextPutAll:", "asString"]}),
  824. smalltalk.MethodContext);
  825. smalltalk.addMethod(
  826. smalltalk.method({
  827. selector: "receiver",
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. return self.receiver;
  832. return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MethodContext)})},
  833. messageSends: []}),
  834. smalltalk.MethodContext);
  835. smalltalk.addMethod(
  836. smalltalk.method({
  837. selector: "selector",
  838. fn: function (){
  839. var self=this;
  840. return smalltalk.withContext(function($ctx1) {
  841. if(self.selector) {
  842. return smalltalk.convertSelector(self.selector);
  843. } else {
  844. return nil;
  845. }
  846. ;
  847. return self}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodContext)})},
  848. messageSends: []}),
  849. smalltalk.MethodContext);
  850. smalltalk.addMethod(
  851. smalltalk.method({
  852. selector: "temps",
  853. fn: function (){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. var $1;
  857. _st(self)._deprecatedAPI();
  858. $1=_st(self)._locals();
  859. return $1;
  860. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.MethodContext)})},
  861. messageSends: ["deprecatedAPI", "locals"]}),
  862. smalltalk.MethodContext);
  863. smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
  864. smalltalk.addMethod(
  865. smalltalk.method({
  866. selector: "constructor:",
  867. fn: function (aString){
  868. var self=this;
  869. return smalltalk.withContext(function($ctx1) {
  870. var native=eval(aString);
  871. return new native();
  872. ;
  873. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},smalltalk.NativeFunction.klass)})},
  874. messageSends: []}),
  875. smalltalk.NativeFunction.klass);
  876. smalltalk.addMethod(
  877. smalltalk.method({
  878. selector: "constructor:value:",
  879. fn: function (aString,anObject){
  880. var self=this;
  881. return smalltalk.withContext(function($ctx1) {
  882. var native=eval(aString);
  883. return new native(anObject);
  884. ;
  885. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},smalltalk.NativeFunction.klass)})},
  886. messageSends: []}),
  887. smalltalk.NativeFunction.klass);
  888. smalltalk.addMethod(
  889. smalltalk.method({
  890. selector: "constructor:value:value:",
  891. fn: function (aString,anObject,anObject2){
  892. var self=this;
  893. return smalltalk.withContext(function($ctx1) {
  894. var native=eval(aString);
  895. return new native(anObject,anObject2);
  896. ;
  897. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},smalltalk.NativeFunction.klass)})},
  898. messageSends: []}),
  899. smalltalk.NativeFunction.klass);
  900. smalltalk.addMethod(
  901. smalltalk.method({
  902. selector: "constructor:value:value:value:",
  903. fn: function (aString,anObject,anObject2,anObject3){
  904. var self=this;
  905. return smalltalk.withContext(function($ctx1) {
  906. var native=eval(aString);
  907. return new native(anObject,anObject2, anObject3);
  908. ;
  909. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.NativeFunction.klass)})},
  910. messageSends: []}),
  911. smalltalk.NativeFunction.klass);
  912. smalltalk.addMethod(
  913. smalltalk.method({
  914. selector: "exists:",
  915. fn: function (aString){
  916. var self=this;
  917. return smalltalk.withContext(function($ctx1) {
  918. if(aString in window) {
  919. return true
  920. } else {
  921. return false
  922. }
  923. ;
  924. return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},smalltalk.NativeFunction.klass)})},
  925. messageSends: []}),
  926. smalltalk.NativeFunction.klass);