Lyst.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. define("lyst/Lyst", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Lyst');
  4. $core.packages["Lyst"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Lyst"].transport = {"type":"amd","amdNamespace":"lyst"};
  6. $core.addClass('Lyst', $globals.Object, [], 'Lyst');
  7. $core.addMethod(
  8. $core.method({
  9. selector: "parse:",
  10. protocol: 'parsing',
  11. fn: function (message){
  12. var self=this;
  13. var result,stack,anArray;
  14. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15. return $core.withContext(function($ctx1) {
  16. //>>excludeEnd("ctx");
  17. var $1,$2,$3,$5,$4,$6,$7,$8,$9,$10,$11,$12;
  18. anArray=$recv(message)._tokenize_(" ");
  19. result=[];
  20. stack=[result];
  21. $recv(anArray)._do_((function(each){
  22. var asNum,inner,close;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. return $core.withContext(function($ctx2) {
  25. //>>excludeEnd("ctx");
  26. close=(0);
  27. close;
  28. inner=each;
  29. inner;
  30. $recv((function(){
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. return $core.withContext(function($ctx3) {
  33. //>>excludeEnd("ctx");
  34. $1=$recv(inner)._notEmpty();
  35. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36. $ctx3.sendIdx["notEmpty"]=1;
  37. //>>excludeEnd("ctx");
  38. return $recv($1)._and_((function(){
  39. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40. return $core.withContext(function($ctx4) {
  41. //>>excludeEnd("ctx");
  42. $2=$recv(inner)._first();
  43. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44. $ctx4.sendIdx["first"]=1;
  45. //>>excludeEnd("ctx");
  46. return $recv($2).__eq("(");
  47. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48. $ctx4.sendIdx["="]=1;
  49. //>>excludeEnd("ctx");
  50. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  51. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  52. //>>excludeEnd("ctx");
  53. }));
  54. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55. $ctx3.sendIdx["and:"]=1;
  56. //>>excludeEnd("ctx");
  57. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59. //>>excludeEnd("ctx");
  60. }))._whileTrue_((function(){
  61. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62. return $core.withContext(function($ctx3) {
  63. //>>excludeEnd("ctx");
  64. inner=$recv(inner)._allButFirst();
  65. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66. $ctx3.sendIdx["allButFirst"]=1;
  67. //>>excludeEnd("ctx");
  68. inner;
  69. $3=stack;
  70. $5=$recv(stack)._last();
  71. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72. $ctx3.sendIdx["last"]=1;
  73. //>>excludeEnd("ctx");
  74. $4=$recv($5)._add_([]);
  75. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76. $ctx3.sendIdx["add:"]=2;
  77. //>>excludeEnd("ctx");
  78. return $recv($3)._add_($4);
  79. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80. $ctx3.sendIdx["add:"]=1;
  81. //>>excludeEnd("ctx");
  82. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  83. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  84. //>>excludeEnd("ctx");
  85. }));
  86. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  87. $ctx2.sendIdx["whileTrue:"]=1;
  88. //>>excludeEnd("ctx");
  89. $recv((function(){
  90. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  91. return $core.withContext(function($ctx3) {
  92. //>>excludeEnd("ctx");
  93. $6=$recv(inner)._notEmpty();
  94. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  95. $ctx3.sendIdx["notEmpty"]=2;
  96. //>>excludeEnd("ctx");
  97. return $recv($6)._and_((function(){
  98. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  99. return $core.withContext(function($ctx4) {
  100. //>>excludeEnd("ctx");
  101. $7=$recv(inner)._last();
  102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  103. $ctx4.sendIdx["last"]=2;
  104. //>>excludeEnd("ctx");
  105. return $recv($7).__eq(")");
  106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  107. $ctx4.sendIdx["="]=2;
  108. //>>excludeEnd("ctx");
  109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  110. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  111. //>>excludeEnd("ctx");
  112. }));
  113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  114. $ctx3.sendIdx["and:"]=2;
  115. //>>excludeEnd("ctx");
  116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  117. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  118. //>>excludeEnd("ctx");
  119. }))._whileTrue_((function(){
  120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  121. return $core.withContext(function($ctx3) {
  122. //>>excludeEnd("ctx");
  123. inner=$recv(inner)._allButLast();
  124. inner;
  125. close=$recv(close).__plus((1));
  126. return close;
  127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  128. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  129. //>>excludeEnd("ctx");
  130. }));
  131. $8=$recv($recv(inner)._notEmpty())._and_((function(){
  132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  133. return $core.withContext(function($ctx3) {
  134. //>>excludeEnd("ctx");
  135. return $recv($recv(inner)._first()).__eq("#");
  136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  137. $ctx3.sendIdx["="]=3;
  138. //>>excludeEnd("ctx");
  139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  140. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,8)});
  141. //>>excludeEnd("ctx");
  142. }));
  143. if($core.assert($8)){
  144. inner=[$recv(inner)._allButFirst()];
  145. inner;
  146. };
  147. $9=$recv(inner)._isString();
  148. if($core.assert($9)){
  149. asNum=$recv($recv(inner)._ifEmpty_((function(){
  150. return "NaN";
  151. })))._asNumber();
  152. } else {
  153. asNum=inner;
  154. };
  155. asNum;
  156. $10=$recv(asNum).__eq(asNum);
  157. if($core.assert($10)){
  158. $11=$recv(stack)._last();
  159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  160. $ctx2.sendIdx["last"]=3;
  161. //>>excludeEnd("ctx");
  162. $recv($11)._add_(asNum);
  163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  164. $ctx2.sendIdx["add:"]=3;
  165. //>>excludeEnd("ctx");
  166. } else {
  167. $recv(inner)._ifNotEmpty_((function(){
  168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  169. return $core.withContext(function($ctx3) {
  170. //>>excludeEnd("ctx");
  171. return $recv($recv(stack)._last())._add_(inner);
  172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  173. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,15)});
  174. //>>excludeEnd("ctx");
  175. }));
  176. };
  177. return $recv(close)._timesRepeat_((function(){
  178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  179. return $core.withContext(function($ctx3) {
  180. //>>excludeEnd("ctx");
  181. return $recv(stack)._removeLast();
  182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  183. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,16)});
  184. //>>excludeEnd("ctx");
  185. }));
  186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  187. }, function($ctx2) {$ctx2.fillBlock({each:each,asNum:asNum,inner:inner,close:close},$ctx1,1)});
  188. //>>excludeEnd("ctx");
  189. }));
  190. $12=result;
  191. return $12;
  192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  193. }, function($ctx1) {$ctx1.fill(self,"parse:",{message:message,result:result,stack:stack,anArray:anArray},$globals.Lyst.klass)});
  194. //>>excludeEnd("ctx");
  195. },
  196. //>>excludeStart("ide", pragmas.excludeIdeData);
  197. args: ["message"],
  198. source: "parse: message\x0a\x09| result stack anArray |\x0a\x09anArray := message tokenize: ' '.\x0a\x09result := #().\x0a\x09stack := { result }.\x0a\x09anArray do: [ :each |\x0a\x09\x09| asNum inner close |\x0a\x09\x09close := 0.\x0a\x09\x09inner := each.\x0a\x09\x09[ inner notEmpty and: [ inner first = '(' ]] whileTrue: [ inner := inner allButFirst. stack add: (stack last add: #()) ].\x0a\x09\x09[ inner notEmpty and: [ inner last = ')' ]] whileTrue: [ inner := inner allButLast. close := close + 1 ].\x0a\x09\x09(inner notEmpty and: [ inner first = '#' ]) ifTrue: [ inner := { inner allButFirst } ].\x0a\x09\x09asNum := inner isString ifTrue: [ (inner ifEmpty: [ 'NaN' ]) asNumber ] ifFalse: [ inner ].\x0a\x09\x09asNum = asNum ifTrue: [ stack last add: asNum ] ifFalse: [\x0a\x09\x09\x09inner ifNotEmpty: [ stack last add: inner ] ].\x0a\x09\x09close timesRepeat: [ stack removeLast ] ].\x0a\x09^ result",
  199. referencedClasses: [],
  200. //>>excludeEnd("ide");
  201. messageSends: ["tokenize:", "do:", "whileTrue:", "and:", "notEmpty", "=", "first", "allButFirst", "add:", "last", "allButLast", "+", "ifTrue:", "ifTrue:ifFalse:", "isString", "asNumber", "ifEmpty:", "ifNotEmpty:", "timesRepeat:", "removeLast"]
  202. }),
  203. $globals.Lyst.klass);
  204. $core.addMethod(
  205. $core.method({
  206. selector: "atYndexIn:ifAbsent:",
  207. protocol: '*Lyst',
  208. fn: function (anObject,aBlock){
  209. var self=this;
  210. var selector;
  211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  212. return $core.withContext(function($ctx1) {
  213. //>>excludeEnd("ctx");
  214. var $1,$2;
  215. var $early={};
  216. try {
  217. selector=self._first();
  218. $1=$recv(anObject)._respondsTo_(selector);
  219. $recv($1)._ifTrue_ifFalse_((function(){
  220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  221. return $core.withContext(function($ctx2) {
  222. //>>excludeEnd("ctx");
  223. $2=$recv(anObject)._perform_(selector);
  224. throw $early=[$2];
  225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  227. //>>excludeEnd("ctx");
  228. }),aBlock);
  229. return self;
  230. }
  231. catch(e) {if(e===$early)return e[0]; throw e}
  232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  233. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:",{anObject:anObject,aBlock:aBlock,selector:selector},$globals.Array)});
  234. //>>excludeEnd("ctx");
  235. },
  236. //>>excludeStart("ide", pragmas.excludeIdeData);
  237. args: ["anObject", "aBlock"],
  238. source: "atYndexIn: anObject ifAbsent: aBlock\x0a\x09| selector |\x0a\x09selector := self first.\x0a\x09(anObject respondsTo: selector)\x0a\x09\x09ifTrue: [ ^ anObject perform: selector ]\x0a\x09\x09ifFalse: aBlock",
  239. referencedClasses: [],
  240. //>>excludeEnd("ide");
  241. messageSends: ["first", "ifTrue:ifFalse:", "respondsTo:", "perform:"]
  242. }),
  243. $globals.Array);
  244. $core.addMethod(
  245. $core.method({
  246. selector: "atYndexIn:ifAbsent:put:",
  247. protocol: '*Lyst',
  248. fn: function (anObject,aBlock,anotherObject){
  249. var self=this;
  250. var selector;
  251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  252. return $core.withContext(function($ctx1) {
  253. //>>excludeEnd("ctx");
  254. var $1,$2;
  255. var $early={};
  256. try {
  257. selector=$recv(self._first())._asMutator();
  258. $1=$recv(anObject)._respondsTo_(selector);
  259. $recv($1)._ifTrue_ifFalse_((function(){
  260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  261. return $core.withContext(function($ctx2) {
  262. //>>excludeEnd("ctx");
  263. $2=$recv(anObject)._perform_withArguments_(selector,[anotherObject]);
  264. throw $early=[$2];
  265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  267. //>>excludeEnd("ctx");
  268. }),aBlock);
  269. return self;
  270. }
  271. catch(e) {if(e===$early)return e[0]; throw e}
  272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  273. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:put:",{anObject:anObject,aBlock:aBlock,anotherObject:anotherObject,selector:selector},$globals.Array)});
  274. //>>excludeEnd("ctx");
  275. },
  276. //>>excludeStart("ide", pragmas.excludeIdeData);
  277. args: ["anObject", "aBlock", "anotherObject"],
  278. source: "atYndexIn: anObject ifAbsent: aBlock put: anotherObject\x0a\x09| selector |\x0a\x09selector := self first asMutator.\x0a\x09(anObject respondsTo: selector)\x0a\x09\x09ifTrue: [ ^ anObject perform: selector withArguments: { anotherObject } ]\x0a\x09\x09ifFalse: aBlock",
  279. referencedClasses: [],
  280. //>>excludeEnd("ide");
  281. messageSends: ["asMutator", "first", "ifTrue:ifFalse:", "respondsTo:", "perform:withArguments:"]
  282. }),
  283. $globals.Array);
  284. $core.addMethod(
  285. $core.method({
  286. selector: "atYndexIn:ifAbsent:",
  287. protocol: '*Lyst',
  288. fn: function (anObject,aBlock){
  289. var self=this;
  290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  291. return $core.withContext(function($ctx1) {
  292. //>>excludeEnd("ctx");
  293. var $1,$2;
  294. var $early={};
  295. try {
  296. $1=$recv(anObject)._respondsTo_("at:ifAbsent:");
  297. $recv($1)._ifTrue_ifFalse_((function(){
  298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  299. return $core.withContext(function($ctx2) {
  300. //>>excludeEnd("ctx");
  301. $2=$recv(anObject)._at_ifAbsent_(self,aBlock);
  302. throw $early=[$2];
  303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  305. //>>excludeEnd("ctx");
  306. }),aBlock);
  307. return self;
  308. }
  309. catch(e) {if(e===$early)return e[0]; throw e}
  310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  311. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Number)});
  312. //>>excludeEnd("ctx");
  313. },
  314. //>>excludeStart("ide", pragmas.excludeIdeData);
  315. args: ["anObject", "aBlock"],
  316. source: "atYndexIn: anObject ifAbsent: aBlock\x0a\x09(anObject respondsTo: #at:ifAbsent:)\x0a\x09\x09ifTrue: [ ^ anObject at: self ifAbsent: aBlock ]\x0a\x09\x09ifFalse: aBlock",
  317. referencedClasses: [],
  318. //>>excludeEnd("ide");
  319. messageSends: ["ifTrue:ifFalse:", "respondsTo:", "at:ifAbsent:"]
  320. }),
  321. $globals.Number);
  322. $core.addMethod(
  323. $core.method({
  324. selector: "atYndexIn:ifAbsent:put:",
  325. protocol: '*Lyst',
  326. fn: function (anObject,aBlock,anotherObject){
  327. var self=this;
  328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  329. return $core.withContext(function($ctx1) {
  330. //>>excludeEnd("ctx");
  331. var $1,$2;
  332. var $early={};
  333. try {
  334. $1=$recv(anObject)._respondsTo_("at:put:");
  335. $recv($1)._ifTrue_ifFalse_((function(){
  336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  337. return $core.withContext(function($ctx2) {
  338. //>>excludeEnd("ctx");
  339. $2=$recv(anObject)._at_put_(self,anotherObject);
  340. throw $early=[$2];
  341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  343. //>>excludeEnd("ctx");
  344. }),aBlock);
  345. return self;
  346. }
  347. catch(e) {if(e===$early)return e[0]; throw e}
  348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  349. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:put:",{anObject:anObject,aBlock:aBlock,anotherObject:anotherObject},$globals.Number)});
  350. //>>excludeEnd("ctx");
  351. },
  352. //>>excludeStart("ide", pragmas.excludeIdeData);
  353. args: ["anObject", "aBlock", "anotherObject"],
  354. source: "atYndexIn: anObject ifAbsent: aBlock put: anotherObject\x0a\x09(anObject respondsTo: #at:put:)\x0a\x09\x09ifTrue: [ ^ anObject at: self put: anotherObject ]\x0a\x09\x09ifFalse: aBlock",
  355. referencedClasses: [],
  356. //>>excludeEnd("ide");
  357. messageSends: ["ifTrue:ifFalse:", "respondsTo:", "at:put:"]
  358. }),
  359. $globals.Number);
  360. $core.addMethod(
  361. $core.method({
  362. selector: "atLyst:ifAbsent:",
  363. protocol: '*Lyst',
  364. fn: function (aCollection,aBlock){
  365. var self=this;
  366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  367. return $core.withContext(function($ctx1) {
  368. //>>excludeEnd("ctx");
  369. var $2,$1;
  370. var $early={};
  371. try {
  372. $1=$recv(aCollection)._inject_into_(self,(function(soFar,segment){
  373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  374. return $core.withContext(function($ctx2) {
  375. //>>excludeEnd("ctx");
  376. return $recv(segment)._atYndexIn_ifAbsent_(soFar,(function(){
  377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  378. return $core.withContext(function($ctx3) {
  379. //>>excludeEnd("ctx");
  380. $2=$recv(aBlock)._value();
  381. throw $early=[$2];
  382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  383. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  384. //>>excludeEnd("ctx");
  385. }));
  386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  387. }, function($ctx2) {$ctx2.fillBlock({soFar:soFar,segment:segment},$ctx1,1)});
  388. //>>excludeEnd("ctx");
  389. }));
  390. return $1;
  391. }
  392. catch(e) {if(e===$early)return e[0]; throw e}
  393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  394. }, function($ctx1) {$ctx1.fill(self,"atLyst:ifAbsent:",{aCollection:aCollection,aBlock:aBlock},$globals.Object)});
  395. //>>excludeEnd("ctx");
  396. },
  397. //>>excludeStart("ide", pragmas.excludeIdeData);
  398. args: ["aCollection", "aBlock"],
  399. source: "atLyst: aCollection ifAbsent: aBlock\x0a\x09^ aCollection inject: self into: [ :soFar :segment |\x0a\x09\x09segment atYndexIn: soFar ifAbsent: [ ^ aBlock value ]]",
  400. referencedClasses: [],
  401. //>>excludeEnd("ide");
  402. messageSends: ["inject:into:", "atYndexIn:ifAbsent:", "value"]
  403. }),
  404. $globals.Object);
  405. $core.addMethod(
  406. $core.method({
  407. selector: "atYndexIn:ifAbsent:",
  408. protocol: '*Lyst',
  409. fn: function (anObject,aBlock){
  410. var self=this;
  411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  412. return $core.withContext(function($ctx1) {
  413. //>>excludeEnd("ctx");
  414. var $1;
  415. $1=$recv(aBlock)._value();
  416. return $1;
  417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  418. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Object)});
  419. //>>excludeEnd("ctx");
  420. },
  421. //>>excludeStart("ide", pragmas.excludeIdeData);
  422. args: ["anObject", "aBlock"],
  423. source: "atYndexIn: anObject ifAbsent: aBlock\x0a\x09^ aBlock value",
  424. referencedClasses: [],
  425. //>>excludeEnd("ide");
  426. messageSends: ["value"]
  427. }),
  428. $globals.Object);
  429. $core.addMethod(
  430. $core.method({
  431. selector: "atYndexIn:ifAbsent:put:",
  432. protocol: '*Lyst',
  433. fn: function (anObject,aBlock,anotherObject){
  434. var self=this;
  435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  436. return $core.withContext(function($ctx1) {
  437. //>>excludeEnd("ctx");
  438. var $1;
  439. $1=$recv(aBlock)._value();
  440. return $1;
  441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  442. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:put:",{anObject:anObject,aBlock:aBlock,anotherObject:anotherObject},$globals.Object)});
  443. //>>excludeEnd("ctx");
  444. },
  445. //>>excludeStart("ide", pragmas.excludeIdeData);
  446. args: ["anObject", "aBlock", "anotherObject"],
  447. source: "atYndexIn: anObject ifAbsent: aBlock put: anotherObject\x0a\x09^ aBlock value",
  448. referencedClasses: [],
  449. //>>excludeEnd("ide");
  450. messageSends: ["value"]
  451. }),
  452. $globals.Object);
  453. $core.addMethod(
  454. $core.method({
  455. selector: "atYndexIn:ifAbsent:",
  456. protocol: '*Lyst',
  457. fn: function (anObject,aBlock){
  458. var self=this;
  459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  460. return $core.withContext(function($ctx1) {
  461. //>>excludeEnd("ctx");
  462. var $1,$2;
  463. var $early={};
  464. try {
  465. $1=$recv(anObject)._respondsTo_("at:ifAbsent:");
  466. $recv($1)._ifTrue_ifFalse_((function(){
  467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  468. return $core.withContext(function($ctx2) {
  469. //>>excludeEnd("ctx");
  470. $2=$recv(anObject)._at_ifAbsent_(self,aBlock);
  471. throw $early=[$2];
  472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  474. //>>excludeEnd("ctx");
  475. }),aBlock);
  476. return self;
  477. }
  478. catch(e) {if(e===$early)return e[0]; throw e}
  479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  480. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  481. //>>excludeEnd("ctx");
  482. },
  483. //>>excludeStart("ide", pragmas.excludeIdeData);
  484. args: ["anObject", "aBlock"],
  485. source: "atYndexIn: anObject ifAbsent: aBlock\x0a\x09(anObject respondsTo: #at:ifAbsent:)\x0a\x09\x09ifTrue: [ ^ anObject at: self ifAbsent: aBlock ]\x0a\x09\x09ifFalse: aBlock",
  486. referencedClasses: [],
  487. //>>excludeEnd("ide");
  488. messageSends: ["ifTrue:ifFalse:", "respondsTo:", "at:ifAbsent:"]
  489. }),
  490. $globals.String);
  491. $core.addMethod(
  492. $core.method({
  493. selector: "atYndexIn:ifAbsent:put:",
  494. protocol: '*Lyst',
  495. fn: function (anObject,aBlock,anotherObject){
  496. var self=this;
  497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  498. return $core.withContext(function($ctx1) {
  499. //>>excludeEnd("ctx");
  500. var $1,$2;
  501. var $early={};
  502. try {
  503. $1=$recv(anObject)._respondsTo_("at:put:");
  504. $recv($1)._ifTrue_ifFalse_((function(){
  505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  506. return $core.withContext(function($ctx2) {
  507. //>>excludeEnd("ctx");
  508. $2=$recv(anObject)._at_put_(self,anotherObject);
  509. throw $early=[$2];
  510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  512. //>>excludeEnd("ctx");
  513. }),aBlock);
  514. return self;
  515. }
  516. catch(e) {if(e===$early)return e[0]; throw e}
  517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  518. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:put:",{anObject:anObject,aBlock:aBlock,anotherObject:anotherObject},$globals.String)});
  519. //>>excludeEnd("ctx");
  520. },
  521. //>>excludeStart("ide", pragmas.excludeIdeData);
  522. args: ["anObject", "aBlock", "anotherObject"],
  523. source: "atYndexIn: anObject ifAbsent: aBlock put: anotherObject\x0a\x09(anObject respondsTo: #at:put:)\x0a\x09\x09ifTrue: [ ^ anObject at: self put: anotherObject ]\x0a\x09\x09ifFalse: aBlock",
  524. referencedClasses: [],
  525. //>>excludeEnd("ide");
  526. messageSends: ["ifTrue:ifFalse:", "respondsTo:", "at:put:"]
  527. }),
  528. $globals.String);
  529. });