1
0

Kernel-Methods.deploy.js 28 KB

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