Kernel-Methods.deploy.js 31 KB

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