Lyst.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  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 receiver,selector,result;
  211. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  213. return $core.withContext(function($ctx1) {
  214. //>>excludeEnd("ctx");
  215. var $5,$4,$3,$2,$1,$6,$7;
  216. var $early={};
  217. try {
  218. selector=self._first();
  219. receiver=$recv(anObject)._yourself();
  220. $recv((function(){
  221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  222. return $core.withContext(function($ctx2) {
  223. //>>excludeEnd("ctx");
  224. result=$recv(receiver)._perform_(selector);
  225. return result;
  226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  228. //>>excludeEnd("ctx");
  229. }))._on_do_($MessageNotUnderstood(),(function(mnu){
  230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  231. return $core.withContext(function($ctx2) {
  232. //>>excludeEnd("ctx");
  233. $5=$recv(mnu)._message();
  234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  235. $ctx2.sendIdx["message"]=1;
  236. //>>excludeEnd("ctx");
  237. $4=$recv($5)._selector();
  238. $3=$recv($4).__eq(selector);
  239. $2=$recv($3)._and_((function(){
  240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  241. return $core.withContext(function($ctx3) {
  242. //>>excludeEnd("ctx");
  243. return $recv($recv(mnu)._receiver()).__eq_eq(receiver);
  244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  245. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  246. //>>excludeEnd("ctx");
  247. }));
  248. $1=$recv($2)._and_((function(){
  249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  250. return $core.withContext(function($ctx3) {
  251. //>>excludeEnd("ctx");
  252. return $recv($recv($recv(mnu)._message())._arguments())._isEmpty();
  253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  254. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  255. //>>excludeEnd("ctx");
  256. }));
  257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  258. $ctx2.sendIdx["and:"]=1;
  259. //>>excludeEnd("ctx");
  260. if(!$core.assert($1)){
  261. $recv(mnu)._resignal();
  262. };
  263. $6=$recv(aBlock)._value();
  264. throw $early=[$6];
  265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  266. }, function($ctx2) {$ctx2.fillBlock({mnu:mnu},$ctx1,2)});
  267. //>>excludeEnd("ctx");
  268. }));
  269. $7=result;
  270. return $7;
  271. }
  272. catch(e) {if(e===$early)return e[0]; throw e}
  273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  274. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:",{anObject:anObject,aBlock:aBlock,receiver:receiver,selector:selector,result:result},$globals.Array)});
  275. //>>excludeEnd("ctx");
  276. },
  277. //>>excludeStart("ide", pragmas.excludeIdeData);
  278. args: ["anObject", "aBlock"],
  279. source: "atYndexIn: anObject ifAbsent: aBlock\x0a\x09| receiver selector result |\x0a\x09selector := self first.\x0a\x09receiver := anObject yourself. \x22JSObjectProxy hack\x22\x0a\x09\x0a\x09[ result := receiver perform: selector ]\x0a\x09on: MessageNotUnderstood do: [ :mnu |\x0a\x09\x09((mnu message selector = selector\x0a\x09\x09\x09and: [ mnu receiver == receiver ])\x0a\x09\x09\x09and: [ mnu message arguments isEmpty ])\x0a\x09\x09\x09ifFalse: [ mnu resignal ].\x0a\x09\x09^ aBlock value ].\x0a\x09^ result",
  280. referencedClasses: ["MessageNotUnderstood"],
  281. //>>excludeEnd("ide");
  282. messageSends: ["first", "yourself", "on:do:", "perform:", "ifFalse:", "and:", "=", "selector", "message", "==", "receiver", "isEmpty", "arguments", "resignal", "value"]
  283. }),
  284. $globals.Array);
  285. $core.addMethod(
  286. $core.method({
  287. selector: "atYndexIn:ifAbsent:put:",
  288. protocol: '*Lyst',
  289. fn: function (anObject,aBlock,anotherObject){
  290. var self=this;
  291. var receiver,selector,arguments_,result;
  292. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  294. return $core.withContext(function($ctx1) {
  295. //>>excludeEnd("ctx");
  296. var $5,$4,$3,$2,$1,$6,$7;
  297. var $early={};
  298. try {
  299. selector=$recv(self._first())._asMutator();
  300. receiver=$recv(anObject)._yourself();
  301. arguments_=[anotherObject];
  302. $recv((function(){
  303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  304. return $core.withContext(function($ctx2) {
  305. //>>excludeEnd("ctx");
  306. result=$recv(receiver)._perform_withArguments_(selector,arguments_);
  307. return result;
  308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  310. //>>excludeEnd("ctx");
  311. }))._on_do_($MessageNotUnderstood(),(function(mnu){
  312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  313. return $core.withContext(function($ctx2) {
  314. //>>excludeEnd("ctx");
  315. $5=$recv(mnu)._message();
  316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  317. $ctx2.sendIdx["message"]=1;
  318. //>>excludeEnd("ctx");
  319. $4=$recv($5)._selector();
  320. $3=$recv($4).__eq(selector);
  321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  322. $ctx2.sendIdx["="]=1;
  323. //>>excludeEnd("ctx");
  324. $2=$recv($3)._and_((function(){
  325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  326. return $core.withContext(function($ctx3) {
  327. //>>excludeEnd("ctx");
  328. return $recv($recv(mnu)._receiver()).__eq_eq(receiver);
  329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  330. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  331. //>>excludeEnd("ctx");
  332. }));
  333. $1=$recv($2)._and_((function(){
  334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  335. return $core.withContext(function($ctx3) {
  336. //>>excludeEnd("ctx");
  337. return $recv($recv($recv(mnu)._message())._arguments()).__eq(arguments_);
  338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  339. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  340. //>>excludeEnd("ctx");
  341. }));
  342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  343. $ctx2.sendIdx["and:"]=1;
  344. //>>excludeEnd("ctx");
  345. if(!$core.assert($1)){
  346. $recv(mnu)._resignal();
  347. };
  348. $6=$recv(aBlock)._value();
  349. throw $early=[$6];
  350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  351. }, function($ctx2) {$ctx2.fillBlock({mnu:mnu},$ctx1,2)});
  352. //>>excludeEnd("ctx");
  353. }));
  354. $7=result;
  355. return $7;
  356. }
  357. catch(e) {if(e===$early)return e[0]; throw e}
  358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  359. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:put:",{anObject:anObject,aBlock:aBlock,anotherObject:anotherObject,receiver:receiver,selector:selector,arguments_:arguments_,result:result},$globals.Array)});
  360. //>>excludeEnd("ctx");
  361. },
  362. //>>excludeStart("ide", pragmas.excludeIdeData);
  363. args: ["anObject", "aBlock", "anotherObject"],
  364. source: "atYndexIn: anObject ifAbsent: aBlock put: anotherObject\x0a\x09| receiver selector arguments result |\x0a\x09selector := self first asMutator.\x0a\x09receiver := anObject yourself. \x22JSObjectProxy hack\x22\x0a\x09arguments := { anotherObject }.\x0a\x09\x0a\x09[ result := receiver perform: selector withArguments: arguments ]\x0a\x09on: MessageNotUnderstood do: [ :mnu |\x0a\x09\x09((mnu message selector = selector\x0a\x09\x09\x09and: [ mnu receiver == receiver ])\x0a\x09\x09\x09and: [ mnu message arguments = arguments ])\x0a\x09\x09\x09ifFalse: [ mnu resignal ].\x0a\x09\x09^ aBlock value ].\x0a\x09^ result",
  365. referencedClasses: ["MessageNotUnderstood"],
  366. //>>excludeEnd("ide");
  367. messageSends: ["asMutator", "first", "yourself", "on:do:", "perform:withArguments:", "ifFalse:", "and:", "=", "selector", "message", "==", "receiver", "arguments", "resignal", "value"]
  368. }),
  369. $globals.Array);
  370. $core.addMethod(
  371. $core.method({
  372. selector: "atYndexIn:ifAbsent:",
  373. protocol: '*Lyst',
  374. fn: function (anObject,aBlock){
  375. var self=this;
  376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  377. return $core.withContext(function($ctx1) {
  378. //>>excludeEnd("ctx");
  379. var $1,$2;
  380. var $early={};
  381. try {
  382. $1=$recv(anObject)._respondsTo_("at:ifAbsent:");
  383. $recv($1)._ifTrue_ifFalse_((function(){
  384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  385. return $core.withContext(function($ctx2) {
  386. //>>excludeEnd("ctx");
  387. $2=$recv(anObject)._at_ifAbsent_(self,aBlock);
  388. throw $early=[$2];
  389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  391. //>>excludeEnd("ctx");
  392. }),aBlock);
  393. return self;
  394. }
  395. catch(e) {if(e===$early)return e[0]; throw e}
  396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  397. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Number)});
  398. //>>excludeEnd("ctx");
  399. },
  400. //>>excludeStart("ide", pragmas.excludeIdeData);
  401. args: ["anObject", "aBlock"],
  402. source: "atYndexIn: anObject ifAbsent: aBlock\x0a\x09(anObject respondsTo: #at:ifAbsent:)\x0a\x09\x09ifTrue: [ ^ anObject at: self ifAbsent: aBlock ]\x0a\x09\x09ifFalse: aBlock",
  403. referencedClasses: [],
  404. //>>excludeEnd("ide");
  405. messageSends: ["ifTrue:ifFalse:", "respondsTo:", "at:ifAbsent:"]
  406. }),
  407. $globals.Number);
  408. $core.addMethod(
  409. $core.method({
  410. selector: "atYndexIn:ifAbsent:put:",
  411. protocol: '*Lyst',
  412. fn: function (anObject,aBlock,anotherObject){
  413. var self=this;
  414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  415. return $core.withContext(function($ctx1) {
  416. //>>excludeEnd("ctx");
  417. var $1,$2;
  418. var $early={};
  419. try {
  420. $1=$recv(anObject)._respondsTo_("at:put:");
  421. $recv($1)._ifTrue_ifFalse_((function(){
  422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  423. return $core.withContext(function($ctx2) {
  424. //>>excludeEnd("ctx");
  425. $2=$recv(anObject)._at_put_(self,anotherObject);
  426. throw $early=[$2];
  427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  429. //>>excludeEnd("ctx");
  430. }),aBlock);
  431. return self;
  432. }
  433. catch(e) {if(e===$early)return e[0]; throw e}
  434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  435. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:put:",{anObject:anObject,aBlock:aBlock,anotherObject:anotherObject},$globals.Number)});
  436. //>>excludeEnd("ctx");
  437. },
  438. //>>excludeStart("ide", pragmas.excludeIdeData);
  439. args: ["anObject", "aBlock", "anotherObject"],
  440. 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",
  441. referencedClasses: [],
  442. //>>excludeEnd("ide");
  443. messageSends: ["ifTrue:ifFalse:", "respondsTo:", "at:put:"]
  444. }),
  445. $globals.Number);
  446. $core.addMethod(
  447. $core.method({
  448. selector: "atLyst:ifAbsent:",
  449. protocol: '*Lyst',
  450. fn: function (aCollection,aBlock){
  451. var self=this;
  452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  453. return $core.withContext(function($ctx1) {
  454. //>>excludeEnd("ctx");
  455. var $2,$1;
  456. var $early={};
  457. try {
  458. $1=$recv(aCollection)._inject_into_(self,(function(soFar,segment){
  459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  460. return $core.withContext(function($ctx2) {
  461. //>>excludeEnd("ctx");
  462. return $recv(segment)._atYndexIn_ifAbsent_(soFar,(function(){
  463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  464. return $core.withContext(function($ctx3) {
  465. //>>excludeEnd("ctx");
  466. $2=$recv(aBlock)._value();
  467. throw $early=[$2];
  468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  469. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  470. //>>excludeEnd("ctx");
  471. }));
  472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  473. }, function($ctx2) {$ctx2.fillBlock({soFar:soFar,segment:segment},$ctx1,1)});
  474. //>>excludeEnd("ctx");
  475. }));
  476. return $1;
  477. }
  478. catch(e) {if(e===$early)return e[0]; throw e}
  479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  480. }, function($ctx1) {$ctx1.fill(self,"atLyst:ifAbsent:",{aCollection:aCollection,aBlock:aBlock},$globals.Object)});
  481. //>>excludeEnd("ctx");
  482. },
  483. //>>excludeStart("ide", pragmas.excludeIdeData);
  484. args: ["aCollection", "aBlock"],
  485. source: "atLyst: aCollection ifAbsent: aBlock\x0a\x09^ aCollection inject: self into: [ :soFar :segment |\x0a\x09\x09segment atYndexIn: soFar ifAbsent: [ ^ aBlock value ]]",
  486. referencedClasses: [],
  487. //>>excludeEnd("ide");
  488. messageSends: ["inject:into:", "atYndexIn:ifAbsent:", "value"]
  489. }),
  490. $globals.Object);
  491. $core.addMethod(
  492. $core.method({
  493. selector: "atYndexIn:ifAbsent:",
  494. protocol: '*Lyst',
  495. fn: function (anObject,aBlock){
  496. var self=this;
  497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  498. return $core.withContext(function($ctx1) {
  499. //>>excludeEnd("ctx");
  500. var $1;
  501. $1=$recv(aBlock)._value();
  502. return $1;
  503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  504. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Object)});
  505. //>>excludeEnd("ctx");
  506. },
  507. //>>excludeStart("ide", pragmas.excludeIdeData);
  508. args: ["anObject", "aBlock"],
  509. source: "atYndexIn: anObject ifAbsent: aBlock\x0a\x09^ aBlock value",
  510. referencedClasses: [],
  511. //>>excludeEnd("ide");
  512. messageSends: ["value"]
  513. }),
  514. $globals.Object);
  515. $core.addMethod(
  516. $core.method({
  517. selector: "atYndexIn:ifAbsent:put:",
  518. protocol: '*Lyst',
  519. fn: function (anObject,aBlock,anotherObject){
  520. var self=this;
  521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  522. return $core.withContext(function($ctx1) {
  523. //>>excludeEnd("ctx");
  524. var $1;
  525. $1=$recv(aBlock)._value();
  526. return $1;
  527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  528. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:put:",{anObject:anObject,aBlock:aBlock,anotherObject:anotherObject},$globals.Object)});
  529. //>>excludeEnd("ctx");
  530. },
  531. //>>excludeStart("ide", pragmas.excludeIdeData);
  532. args: ["anObject", "aBlock", "anotherObject"],
  533. source: "atYndexIn: anObject ifAbsent: aBlock put: anotherObject\x0a\x09^ aBlock value",
  534. referencedClasses: [],
  535. //>>excludeEnd("ide");
  536. messageSends: ["value"]
  537. }),
  538. $globals.Object);
  539. $core.addMethod(
  540. $core.method({
  541. selector: "atYndexIn:ifAbsent:",
  542. protocol: '*Lyst',
  543. fn: function (anObject,aBlock){
  544. var self=this;
  545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  546. return $core.withContext(function($ctx1) {
  547. //>>excludeEnd("ctx");
  548. var $1,$2;
  549. var $early={};
  550. try {
  551. $1=$recv(anObject)._respondsTo_("at:ifAbsent:");
  552. $recv($1)._ifTrue_ifFalse_((function(){
  553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  554. return $core.withContext(function($ctx2) {
  555. //>>excludeEnd("ctx");
  556. $2=$recv(anObject)._at_ifAbsent_(self,aBlock);
  557. throw $early=[$2];
  558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  560. //>>excludeEnd("ctx");
  561. }),aBlock);
  562. return self;
  563. }
  564. catch(e) {if(e===$early)return e[0]; throw e}
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  567. //>>excludeEnd("ctx");
  568. },
  569. //>>excludeStart("ide", pragmas.excludeIdeData);
  570. args: ["anObject", "aBlock"],
  571. source: "atYndexIn: anObject ifAbsent: aBlock\x0a\x09(anObject respondsTo: #at:ifAbsent:)\x0a\x09\x09ifTrue: [ ^ anObject at: self ifAbsent: aBlock ]\x0a\x09\x09ifFalse: aBlock",
  572. referencedClasses: [],
  573. //>>excludeEnd("ide");
  574. messageSends: ["ifTrue:ifFalse:", "respondsTo:", "at:ifAbsent:"]
  575. }),
  576. $globals.String);
  577. $core.addMethod(
  578. $core.method({
  579. selector: "atYndexIn:ifAbsent:put:",
  580. protocol: '*Lyst',
  581. fn: function (anObject,aBlock,anotherObject){
  582. var self=this;
  583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  584. return $core.withContext(function($ctx1) {
  585. //>>excludeEnd("ctx");
  586. var $1,$2;
  587. var $early={};
  588. try {
  589. $1=$recv(anObject)._respondsTo_("at:put:");
  590. $recv($1)._ifTrue_ifFalse_((function(){
  591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  592. return $core.withContext(function($ctx2) {
  593. //>>excludeEnd("ctx");
  594. $2=$recv(anObject)._at_put_(self,anotherObject);
  595. throw $early=[$2];
  596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  598. //>>excludeEnd("ctx");
  599. }),aBlock);
  600. return self;
  601. }
  602. catch(e) {if(e===$early)return e[0]; throw e}
  603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  604. }, function($ctx1) {$ctx1.fill(self,"atYndexIn:ifAbsent:put:",{anObject:anObject,aBlock:aBlock,anotherObject:anotherObject},$globals.String)});
  605. //>>excludeEnd("ctx");
  606. },
  607. //>>excludeStart("ide", pragmas.excludeIdeData);
  608. args: ["anObject", "aBlock", "anotherObject"],
  609. 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",
  610. referencedClasses: [],
  611. //>>excludeEnd("ide");
  612. messageSends: ["ifTrue:ifFalse:", "respondsTo:", "at:put:"]
  613. }),
  614. $globals.String);
  615. });