Kernel-Methods.deploy.js 28 KB

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