Kernel-Methods.deploy.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  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=_st(self)._defaultCategory();
  292. } else {
  293. $1=$2;
  294. };
  295. return $1;
  296. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.CompiledMethod)})},
  297. messageSends: ["ifNil:", "defaultCategory", "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. "_defaultCategory",
  325. smalltalk.method({
  326. selector: "defaultCategory",
  327. fn: function (){
  328. var self=this;
  329. return smalltalk.withContext(function($ctx1) { return "as yet unclassified";
  330. }, function($ctx1) {$ctx1.fill(self,"defaultCategory",{},smalltalk.CompiledMethod)})},
  331. messageSends: []}),
  332. smalltalk.CompiledMethod);
  333. smalltalk.addMethod(
  334. "_fn",
  335. smalltalk.method({
  336. selector: "fn",
  337. fn: function (){
  338. var self=this;
  339. return smalltalk.withContext(function($ctx1) { var $1;
  340. $1=_st(self)._basicAt_("fn");
  341. return $1;
  342. }, function($ctx1) {$ctx1.fill(self,"fn",{},smalltalk.CompiledMethod)})},
  343. messageSends: ["basicAt:"]}),
  344. smalltalk.CompiledMethod);
  345. smalltalk.addMethod(
  346. "_fn_",
  347. smalltalk.method({
  348. selector: "fn:",
  349. fn: function (aBlock){
  350. var self=this;
  351. return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("fn",aBlock);
  352. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},smalltalk.CompiledMethod)})},
  353. messageSends: ["basicAt:put:"]}),
  354. smalltalk.CompiledMethod);
  355. smalltalk.addMethod(
  356. "_messageSends",
  357. smalltalk.method({
  358. selector: "messageSends",
  359. fn: function (){
  360. var self=this;
  361. return smalltalk.withContext(function($ctx1) { var $1;
  362. $1=_st(self)._basicAt_("messageSends");
  363. return $1;
  364. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.CompiledMethod)})},
  365. messageSends: ["basicAt:"]}),
  366. smalltalk.CompiledMethod);
  367. smalltalk.addMethod(
  368. "_methodClass",
  369. smalltalk.method({
  370. selector: "methodClass",
  371. fn: function (){
  372. var self=this;
  373. return smalltalk.withContext(function($ctx1) { var $1;
  374. $1=_st(self)._basicAt_("methodClass");
  375. return $1;
  376. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},smalltalk.CompiledMethod)})},
  377. messageSends: ["basicAt:"]}),
  378. smalltalk.CompiledMethod);
  379. smalltalk.addMethod(
  380. "_protocol",
  381. smalltalk.method({
  382. selector: "protocol",
  383. fn: function (){
  384. var self=this;
  385. return smalltalk.withContext(function($ctx1) { var $1;
  386. $1=_st(self)._category();
  387. return $1;
  388. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.CompiledMethod)})},
  389. messageSends: ["category"]}),
  390. smalltalk.CompiledMethod);
  391. smalltalk.addMethod(
  392. "_referencedClasses",
  393. smalltalk.method({
  394. selector: "referencedClasses",
  395. fn: function (){
  396. var self=this;
  397. return smalltalk.withContext(function($ctx1) { var $1;
  398. $1=_st(self)._basicAt_("referencedClasses");
  399. return $1;
  400. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},smalltalk.CompiledMethod)})},
  401. messageSends: ["basicAt:"]}),
  402. smalltalk.CompiledMethod);
  403. smalltalk.addMethod(
  404. "_selector",
  405. smalltalk.method({
  406. selector: "selector",
  407. fn: function (){
  408. var self=this;
  409. return smalltalk.withContext(function($ctx1) { var $1;
  410. $1=_st(self)._basicAt_("selector");
  411. return $1;
  412. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.CompiledMethod)})},
  413. messageSends: ["basicAt:"]}),
  414. smalltalk.CompiledMethod);
  415. smalltalk.addMethod(
  416. "_selector_",
  417. smalltalk.method({
  418. selector: "selector:",
  419. fn: function (aString){
  420. var self=this;
  421. return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("selector",aString);
  422. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.CompiledMethod)})},
  423. messageSends: ["basicAt:put:"]}),
  424. smalltalk.CompiledMethod);
  425. smalltalk.addMethod(
  426. "_source",
  427. smalltalk.method({
  428. selector: "source",
  429. fn: function (){
  430. var self=this;
  431. return smalltalk.withContext(function($ctx1) { var $2,$1;
  432. $2=_st(self)._basicAt_("source");
  433. if(($receiver = $2) == nil || $receiver == undefined){
  434. $1="";
  435. } else {
  436. $1=$2;
  437. };
  438. return $1;
  439. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.CompiledMethod)})},
  440. messageSends: ["ifNil:", "basicAt:"]}),
  441. smalltalk.CompiledMethod);
  442. smalltalk.addMethod(
  443. "_source_",
  444. smalltalk.method({
  445. selector: "source:",
  446. fn: function (aString){
  447. var self=this;
  448. return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("source",aString);
  449. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.CompiledMethod)})},
  450. messageSends: ["basicAt:put:"]}),
  451. smalltalk.CompiledMethod);
  452. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  453. smalltalk.addMethod(
  454. "_addWorker",
  455. smalltalk.method({
  456. selector: "addWorker",
  457. fn: function (){
  458. var self=this;
  459. return smalltalk.withContext(function($ctx1) { _st(self["@worker"])._valueWithTimeout_((0));
  460. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  461. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},smalltalk.ForkPool)})},
  462. messageSends: ["valueWithTimeout:", "+"]}),
  463. smalltalk.ForkPool);
  464. smalltalk.addMethod(
  465. "_defaultMaxPoolSize",
  466. smalltalk.method({
  467. selector: "defaultMaxPoolSize",
  468. fn: function (){
  469. var self=this;
  470. return smalltalk.withContext(function($ctx1) { var $1;
  471. $1=_st(_st(self)._class())._defaultMaxPoolSize();
  472. return $1;
  473. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool)})},
  474. messageSends: ["defaultMaxPoolSize", "class"]}),
  475. smalltalk.ForkPool);
  476. smalltalk.addMethod(
  477. "_fork_",
  478. smalltalk.method({
  479. selector: "fork:",
  480. fn: function (aBlock){
  481. var self=this;
  482. return smalltalk.withContext(function($ctx1) { var $1;
  483. $1=_st(self["@poolSize"]).__lt(_st(self)._maxPoolSize());
  484. if(smalltalk.assert($1)){
  485. _st(self)._addWorker();
  486. };
  487. _st(self["@queue"])._back_(aBlock);
  488. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},smalltalk.ForkPool)})},
  489. messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "back:"]}),
  490. smalltalk.ForkPool);
  491. smalltalk.addMethod(
  492. "_initialize",
  493. smalltalk.method({
  494. selector: "initialize",
  495. fn: function (){
  496. var self=this;
  497. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  498. self["@poolSize"]=(0);
  499. self["@queue"]=_st((smalltalk.Queue || Queue))._new();
  500. self["@worker"]=_st(self)._makeWorker();
  501. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ForkPool)})},
  502. messageSends: ["initialize", "new", "makeWorker"]}),
  503. smalltalk.ForkPool);
  504. smalltalk.addMethod(
  505. "_makeWorker",
  506. smalltalk.method({
  507. selector: "makeWorker",
  508. fn: function (){
  509. var self=this;
  510. var sentinel;
  511. return smalltalk.withContext(function($ctx1) { var $2,$1;
  512. sentinel=_st((smalltalk.Object || Object))._new();
  513. $1=(function(){
  514. var block;
  515. return smalltalk.withContext(function($ctx2) { self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  516. self["@poolSize"];
  517. block=_st(self["@queue"])._frontIfAbsent_((function(){
  518. return smalltalk.withContext(function($ctx3) { return sentinel;
  519. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  520. block;
  521. $2=_st(block).__eq_eq(sentinel);
  522. if(! smalltalk.assert($2)){
  523. return _st((function(){
  524. return smalltalk.withContext(function($ctx3) { return _st(block)._value();
  525. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  526. return smalltalk.withContext(function($ctx3) { return _st(self)._addWorker();
  527. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  528. };
  529. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})});
  530. return $1;
  531. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},smalltalk.ForkPool)})},
  532. messageSends: ["new", "-", "frontIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="]}),
  533. smalltalk.ForkPool);
  534. smalltalk.addMethod(
  535. "_maxPoolSize",
  536. smalltalk.method({
  537. selector: "maxPoolSize",
  538. fn: function (){
  539. var self=this;
  540. return smalltalk.withContext(function($ctx1) { var $2,$1;
  541. $2=self["@maxPoolSize"];
  542. if(($receiver = $2) == nil || $receiver == undefined){
  543. $1=_st(self)._defaultMaxPoolSize();
  544. } else {
  545. $1=$2;
  546. };
  547. return $1;
  548. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},smalltalk.ForkPool)})},
  549. messageSends: ["ifNil:", "defaultMaxPoolSize"]}),
  550. smalltalk.ForkPool);
  551. smalltalk.addMethod(
  552. "_maxPoolSize_",
  553. smalltalk.method({
  554. selector: "maxPoolSize:",
  555. fn: function (anInteger){
  556. var self=this;
  557. return smalltalk.withContext(function($ctx1) { self["@maxPoolSize"]=anInteger;
  558. return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger},smalltalk.ForkPool)})},
  559. messageSends: []}),
  560. smalltalk.ForkPool);
  561. smalltalk.ForkPool.klass.iVarNames = ['default'];
  562. smalltalk.addMethod(
  563. "_default",
  564. smalltalk.method({
  565. selector: "default",
  566. fn: function (){
  567. var self=this;
  568. return smalltalk.withContext(function($ctx1) { var $2,$1;
  569. $2=self["@default"];
  570. if(($receiver = $2) == nil || $receiver == undefined){
  571. self["@default"]=_st(self)._new();
  572. $1=self["@default"];
  573. } else {
  574. $1=$2;
  575. };
  576. return $1;
  577. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ForkPool.klass)})},
  578. messageSends: ["ifNil:", "new"]}),
  579. smalltalk.ForkPool.klass);
  580. smalltalk.addMethod(
  581. "_defaultMaxPoolSize",
  582. smalltalk.method({
  583. selector: "defaultMaxPoolSize",
  584. fn: function (){
  585. var self=this;
  586. return smalltalk.withContext(function($ctx1) { return (100);
  587. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool.klass)})},
  588. messageSends: []}),
  589. smalltalk.ForkPool.klass);
  590. smalltalk.addMethod(
  591. "_resetDefault",
  592. smalltalk.method({
  593. selector: "resetDefault",
  594. fn: function (){
  595. var self=this;
  596. return smalltalk.withContext(function($ctx1) { self["@default"]=nil;
  597. return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{},smalltalk.ForkPool.klass)})},
  598. messageSends: []}),
  599. smalltalk.ForkPool.klass);
  600. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  601. smalltalk.addMethod(
  602. "_arguments",
  603. smalltalk.method({
  604. selector: "arguments",
  605. fn: function (){
  606. var self=this;
  607. return smalltalk.withContext(function($ctx1) { var $1;
  608. $1=self["@arguments"];
  609. return $1;
  610. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.Message)})},
  611. messageSends: []}),
  612. smalltalk.Message);
  613. smalltalk.addMethod(
  614. "_arguments_",
  615. smalltalk.method({
  616. selector: "arguments:",
  617. fn: function (anArray){
  618. var self=this;
  619. return smalltalk.withContext(function($ctx1) { self["@arguments"]=anArray;
  620. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray},smalltalk.Message)})},
  621. messageSends: []}),
  622. smalltalk.Message);
  623. smalltalk.addMethod(
  624. "_printString",
  625. smalltalk.method({
  626. selector: "printString",
  627. fn: function (){
  628. var self=this;
  629. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  630. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  631. return smalltalk.withContext(function($ctx2) { $2=aStream;
  632. _st($2)._nextPutAll_(smalltalk.Object.fn.prototype._printString.apply(_st(self), []));
  633. _st($2)._nextPutAll_("(");
  634. _st($2)._nextPutAll_(self["@selector"]);
  635. $3=_st($2)._nextPutAll_(")");
  636. return $3;
  637. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  638. return $1;
  639. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Message)})},
  640. messageSends: ["streamContents:", "nextPutAll:", "printString"]}),
  641. smalltalk.Message);
  642. smalltalk.addMethod(
  643. "_selector",
  644. smalltalk.method({
  645. selector: "selector",
  646. fn: function (){
  647. var self=this;
  648. return smalltalk.withContext(function($ctx1) { var $1;
  649. $1=self["@selector"];
  650. return $1;
  651. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.Message)})},
  652. messageSends: []}),
  653. smalltalk.Message);
  654. smalltalk.addMethod(
  655. "_selector_",
  656. smalltalk.method({
  657. selector: "selector:",
  658. fn: function (aString){
  659. var self=this;
  660. return smalltalk.withContext(function($ctx1) { self["@selector"]=aString;
  661. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.Message)})},
  662. messageSends: []}),
  663. smalltalk.Message);
  664. smalltalk.addMethod(
  665. "_sendTo_",
  666. smalltalk.method({
  667. selector: "sendTo:",
  668. fn: function (anObject){
  669. var self=this;
  670. return smalltalk.withContext(function($ctx1) { var $1;
  671. $1=_st(anObject)._perform_withArguments_(_st(self)._selector(),_st(self)._arguments());
  672. return $1;
  673. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},smalltalk.Message)})},
  674. messageSends: ["perform:withArguments:", "selector", "arguments"]}),
  675. smalltalk.Message);
  676. smalltalk.addMethod(
  677. "_selector_arguments_",
  678. smalltalk.method({
  679. selector: "selector:arguments:",
  680. fn: function (aString,anArray){
  681. var self=this;
  682. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  683. $2=_st(self)._new();
  684. _st($2)._selector_(aString);
  685. _st($2)._arguments_(anArray);
  686. $3=_st($2)._yourself();
  687. $1=$3;
  688. return $1;
  689. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},smalltalk.Message.klass)})},
  690. messageSends: ["selector:", "new", "arguments:", "yourself"]}),
  691. smalltalk.Message.klass);
  692. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  693. smalltalk.addMethod(
  694. "_asString",
  695. smalltalk.method({
  696. selector: "asString",
  697. fn: function (){
  698. var self=this;
  699. return smalltalk.withContext(function($ctx1) { var $2,$1;
  700. $2=_st(self)._isBlockContext();
  701. if(smalltalk.assert($2)){
  702. $1=_st(_st("a block (in ").__comma(_st(_st(_st(_st(self)._methodContext())._receiver())._class())._printString())).__comma(")");
  703. } else {
  704. $1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector());
  705. };
  706. return $1;
  707. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.MethodContext)})},
  708. messageSends: ["ifTrue:ifFalse:", ",", "printString", "class", "receiver", "methodContext", "selector", "isBlockContext"]}),
  709. smalltalk.MethodContext);
  710. smalltalk.addMethod(
  711. "_home",
  712. smalltalk.method({
  713. selector: "home",
  714. fn: function (){
  715. var self=this;
  716. return smalltalk.withContext(function($ctx1) { return self.methodContext || self.homeContext;
  717. return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})},
  718. messageSends: []}),
  719. smalltalk.MethodContext);
  720. smalltalk.addMethod(
  721. "_isBlockContext",
  722. smalltalk.method({
  723. selector: "isBlockContext",
  724. fn: function (){
  725. var self=this;
  726. return smalltalk.withContext(function($ctx1) { var $1;
  727. $1=_st(_st(self)._selector())._isNil();
  728. return $1;
  729. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.MethodContext)})},
  730. messageSends: ["isNil", "selector"]}),
  731. smalltalk.MethodContext);
  732. smalltalk.addMethod(
  733. "_locals",
  734. smalltalk.method({
  735. selector: "locals",
  736. fn: function (){
  737. var self=this;
  738. return smalltalk.withContext(function($ctx1) { return self.locals;
  739. return self}, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.MethodContext)})},
  740. messageSends: []}),
  741. smalltalk.MethodContext);
  742. smalltalk.addMethod(
  743. "_method",
  744. smalltalk.method({
  745. selector: "method",
  746. fn: function (){
  747. var self=this;
  748. return smalltalk.withContext(function($ctx1) { var $1;
  749. $1=_st(_st(_st(_st(self)._methodContext())._receiver())._class())._lookupSelector_(_st(_st(self)._methodContext())._selector());
  750. return $1;
  751. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodContext)})},
  752. messageSends: ["lookupSelector:", "selector", "methodContext", "class", "receiver"]}),
  753. smalltalk.MethodContext);
  754. smalltalk.addMethod(
  755. "_methodContext",
  756. smalltalk.method({
  757. selector: "methodContext",
  758. fn: function (){
  759. var self=this;
  760. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  761. $1=_st(self)._isBlockContext();
  762. if(! smalltalk.assert($1)){
  763. $2=self;
  764. return $2;
  765. };
  766. $3=_st(self)._home();
  767. return $3;
  768. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})},
  769. messageSends: ["ifFalse:", "isBlockContext", "home"]}),
  770. smalltalk.MethodContext);
  771. smalltalk.addMethod(
  772. "_outerContext",
  773. smalltalk.method({
  774. selector: "outerContext",
  775. fn: function (){
  776. var self=this;
  777. return smalltalk.withContext(function($ctx1) { return self.homeContext;
  778. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})},
  779. messageSends: []}),
  780. smalltalk.MethodContext);
  781. smalltalk.addMethod(
  782. "_pc",
  783. smalltalk.method({
  784. selector: "pc",
  785. fn: function (){
  786. var self=this;
  787. return smalltalk.withContext(function($ctx1) { return self.pc;
  788. return self}, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.MethodContext)})},
  789. messageSends: []}),
  790. smalltalk.MethodContext);
  791. smalltalk.addMethod(
  792. "_printString",
  793. smalltalk.method({
  794. selector: "printString",
  795. fn: function (){
  796. var self=this;
  797. return smalltalk.withContext(function($ctx1) { var $1;
  798. $1=_st(_st(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma("(")).__comma(_st(self)._asString())).__comma(")");
  799. return $1;
  800. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.MethodContext)})},
  801. messageSends: [",", "asString", "printString"]}),
  802. smalltalk.MethodContext);
  803. smalltalk.addMethod(
  804. "_receiver",
  805. smalltalk.method({
  806. selector: "receiver",
  807. fn: function (){
  808. var self=this;
  809. return smalltalk.withContext(function($ctx1) { return self.receiver;
  810. return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MethodContext)})},
  811. messageSends: []}),
  812. smalltalk.MethodContext);
  813. smalltalk.addMethod(
  814. "_selector",
  815. smalltalk.method({
  816. selector: "selector",
  817. fn: function (){
  818. var self=this;
  819. return smalltalk.withContext(function($ctx1) {
  820. if(self.selector) {
  821. return smalltalk.convertSelector(self.selector);
  822. } else {
  823. return nil;
  824. }
  825. ;
  826. return self}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodContext)})},
  827. messageSends: []}),
  828. smalltalk.MethodContext);
  829. smalltalk.addMethod(
  830. "_temps",
  831. smalltalk.method({
  832. selector: "temps",
  833. fn: function (){
  834. var self=this;
  835. return smalltalk.withContext(function($ctx1) { var $1;
  836. _st(self)._deprecatedAPI();
  837. $1=_st(self)._locals();
  838. return $1;
  839. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.MethodContext)})},
  840. messageSends: ["deprecatedAPI", "locals"]}),
  841. smalltalk.MethodContext);
  842. smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
  843. smalltalk.addMethod(
  844. "_constructor_",
  845. smalltalk.method({
  846. selector: "constructor:",
  847. fn: function (aString){
  848. var self=this;
  849. return smalltalk.withContext(function($ctx1) {
  850. var native=eval(aString);
  851. return new native();
  852. ;
  853. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},smalltalk.NativeFunction.klass)})},
  854. messageSends: []}),
  855. smalltalk.NativeFunction.klass);
  856. smalltalk.addMethod(
  857. "_constructor_value_",
  858. smalltalk.method({
  859. selector: "constructor:value:",
  860. fn: function (aString,anObject){
  861. var self=this;
  862. return smalltalk.withContext(function($ctx1) {
  863. var native=eval(aString);
  864. return new native(anObject);
  865. ;
  866. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},smalltalk.NativeFunction.klass)})},
  867. messageSends: []}),
  868. smalltalk.NativeFunction.klass);
  869. smalltalk.addMethod(
  870. "_constructor_value_value_",
  871. smalltalk.method({
  872. selector: "constructor:value:value:",
  873. fn: function (aString,anObject,anObject2){
  874. var self=this;
  875. return smalltalk.withContext(function($ctx1) {
  876. var native=eval(aString);
  877. return new native(anObject,anObject2);
  878. ;
  879. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},smalltalk.NativeFunction.klass)})},
  880. messageSends: []}),
  881. smalltalk.NativeFunction.klass);
  882. smalltalk.addMethod(
  883. "_constructor_value_value_value_",
  884. smalltalk.method({
  885. selector: "constructor:value:value:value:",
  886. fn: function (aString,anObject,anObject2,anObject3){
  887. var self=this;
  888. return smalltalk.withContext(function($ctx1) {
  889. var native=eval(aString);
  890. return new native(anObject,anObject2, anObject3);
  891. ;
  892. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.NativeFunction.klass)})},
  893. messageSends: []}),
  894. smalltalk.NativeFunction.klass);
  895. smalltalk.addMethod(
  896. "_exists_",
  897. smalltalk.method({
  898. selector: "exists:",
  899. fn: function (aString){
  900. var self=this;
  901. return smalltalk.withContext(function($ctx1) {
  902. if(aString in window) {
  903. return true
  904. } else {
  905. return false
  906. }
  907. ;
  908. return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},smalltalk.NativeFunction.klass)})},
  909. messageSends: []}),
  910. smalltalk.NativeFunction.klass);