Kernel-Methods.deploy.js 31 KB

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