Trapped-Backend.js 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500
  1. define("trapped/Trapped-Backend", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Collections"], function($boot){
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Trapped-Backend');
  4. $core.packages["Trapped-Backend"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Trapped-Backend"].transport = {"type":"amd","amdNamespace":"trapped"};
  6. $core.addClass('EavModel', $globals.Object, ['getBlock', 'putBlock'], 'Trapped-Backend');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.EavModel.comment="External actor value model.";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "getBlock:",
  13. protocol: 'accessing',
  14. fn: function (aBlock){
  15. var self=this;
  16. self["@getBlock"]=aBlock;
  17. return self;
  18. },
  19. //>>excludeStart("ide", pragmas.excludeIdeData);
  20. args: ["aBlock"],
  21. source: "getBlock: aBlock\x0a\x0agetBlock := aBlock",
  22. referencedClasses: [],
  23. //>>excludeEnd("ide");
  24. messageSends: []
  25. }),
  26. $globals.EavModel);
  27. $core.addMethod(
  28. $core.method({
  29. selector: "initialize",
  30. protocol: 'initialization',
  31. fn: function (){
  32. var self=this;
  33. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34. return $core.withContext(function($ctx1) {
  35. //>>excludeEnd("ctx");
  36. (
  37. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38. $ctx1.supercall = true,
  39. //>>excludeEnd("ctx");
  40. $globals.EavModel.superclass.fn.prototype._initialize.apply($recv(self), []));
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. $ctx1.supercall = false;
  43. //>>excludeEnd("ctx");;
  44. self["@getBlock"]=(function(){
  45. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46. return $core.withContext(function($ctx2) {
  47. //>>excludeEnd("ctx");
  48. return self._error_("No getter block.");
  49. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  50. $ctx2.sendIdx["error:"]=1;
  51. //>>excludeEnd("ctx");
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54. //>>excludeEnd("ctx");
  55. });
  56. self["@putBlock"]=(function(){
  57. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58. return $core.withContext(function($ctx2) {
  59. //>>excludeEnd("ctx");
  60. return self._error_("No putter block.");
  61. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63. //>>excludeEnd("ctx");
  64. });
  65. return self;
  66. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.EavModel)});
  68. //>>excludeEnd("ctx");
  69. },
  70. //>>excludeStart("ide", pragmas.excludeIdeData);
  71. args: [],
  72. source: "initialize\x0a\x09super initialize.\x0a\x09getBlock := [ self error: 'No getter block.' ].\x0a\x09putBlock := [ self error: 'No putter block.' ].",
  73. referencedClasses: [],
  74. //>>excludeEnd("ide");
  75. messageSends: ["initialize", "error:"]
  76. }),
  77. $globals.EavModel);
  78. $core.addMethod(
  79. $core.method({
  80. selector: "on:",
  81. protocol: 'accessing',
  82. fn: function (anObject){
  83. var self=this;
  84. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  85. return $core.withContext(function($ctx1) {
  86. //>>excludeEnd("ctx");
  87. var $1;
  88. $1=$recv(self["@getBlock"])._value_(anObject);
  89. return $1;
  90. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  91. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.EavModel)});
  92. //>>excludeEnd("ctx");
  93. },
  94. //>>excludeStart("ide", pragmas.excludeIdeData);
  95. args: ["anObject"],
  96. source: "on: anObject\x0a\x22Returns value of model applied on object\x22\x0a\x0a^getBlock value: anObject",
  97. referencedClasses: [],
  98. //>>excludeEnd("ide");
  99. messageSends: ["value:"]
  100. }),
  101. $globals.EavModel);
  102. $core.addMethod(
  103. $core.method({
  104. selector: "on:put:",
  105. protocol: 'accessing',
  106. fn: function (anObject,anObject2){
  107. var self=this;
  108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  109. return $core.withContext(function($ctx1) {
  110. //>>excludeEnd("ctx");
  111. var $1;
  112. $1=$recv(self["@putBlock"])._value_value_(anObject,anObject2);
  113. return $1;
  114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  115. }, function($ctx1) {$ctx1.fill(self,"on:put:",{anObject:anObject,anObject2:anObject2},$globals.EavModel)});
  116. //>>excludeEnd("ctx");
  117. },
  118. //>>excludeStart("ide", pragmas.excludeIdeData);
  119. args: ["anObject", "anObject2"],
  120. source: "on: anObject put: anObject2\x0a\x22Puts a value via model applied on object\x22\x0a\x0a^putBlock value: anObject value: anObject2",
  121. referencedClasses: [],
  122. //>>excludeEnd("ide");
  123. messageSends: ["value:value:"]
  124. }),
  125. $globals.EavModel);
  126. $core.addMethod(
  127. $core.method({
  128. selector: "putBlock:",
  129. protocol: 'accessing',
  130. fn: function (aBlock){
  131. var self=this;
  132. self["@putBlock"]=aBlock;
  133. return self;
  134. },
  135. //>>excludeStart("ide", pragmas.excludeIdeData);
  136. args: ["aBlock"],
  137. source: "putBlock: aBlock\x0a\x0aputBlock := aBlock",
  138. referencedClasses: [],
  139. //>>excludeEnd("ide");
  140. messageSends: []
  141. }),
  142. $globals.EavModel);
  143. $core.addClass('Isolator', $globals.Object, ['root'], 'Trapped-Backend');
  144. $core.addMethod(
  145. $core.method({
  146. selector: "model:modify:",
  147. protocol: 'action',
  148. fn: function (anEavModel,aBlock){
  149. var self=this;
  150. var newValue;
  151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  152. return $core.withContext(function($ctx1) {
  153. //>>excludeEnd("ctx");
  154. newValue=$recv(aBlock)._value_($recv(anEavModel)._on_(self));
  155. $recv(anEavModel)._on_put_(self,$recv(newValue)._deepCopy());
  156. return self;
  157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  158. }, function($ctx1) {$ctx1.fill(self,"model:modify:",{anEavModel:anEavModel,aBlock:aBlock,newValue:newValue},$globals.Isolator)});
  159. //>>excludeEnd("ctx");
  160. },
  161. //>>excludeStart("ide", pragmas.excludeIdeData);
  162. args: ["anEavModel", "aBlock"],
  163. source: "model: anEavModel modify: aBlock\x0a\x0a| newValue |\x0anewValue := aBlock value: (anEavModel on: self).\x0aanEavModel on: self put: newValue deepCopy",
  164. referencedClasses: [],
  165. //>>excludeEnd("ide");
  166. messageSends: ["value:", "on:", "on:put:", "deepCopy"]
  167. }),
  168. $globals.Isolator);
  169. $core.addMethod(
  170. $core.method({
  171. selector: "model:read:",
  172. protocol: 'action',
  173. fn: function (anEavModel,aBlock){
  174. var self=this;
  175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  176. return $core.withContext(function($ctx1) {
  177. //>>excludeEnd("ctx");
  178. $recv(aBlock)._value_($recv($recv(anEavModel)._on_(self))._deepCopy());
  179. return self;
  180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  181. }, function($ctx1) {$ctx1.fill(self,"model:read:",{anEavModel:anEavModel,aBlock:aBlock},$globals.Isolator)});
  182. //>>excludeEnd("ctx");
  183. },
  184. //>>excludeStart("ide", pragmas.excludeIdeData);
  185. args: ["anEavModel", "aBlock"],
  186. source: "model: anEavModel read: aBlock\x0a\x0aaBlock value: (anEavModel on: self) deepCopy",
  187. referencedClasses: [],
  188. //>>excludeEnd("ide");
  189. messageSends: ["value:", "deepCopy", "on:"]
  190. }),
  191. $globals.Isolator);
  192. $core.addMethod(
  193. $core.method({
  194. selector: "root",
  195. protocol: 'accessing',
  196. fn: function (){
  197. var self=this;
  198. var $1;
  199. $1=self["@root"];
  200. return $1;
  201. },
  202. //>>excludeStart("ide", pragmas.excludeIdeData);
  203. args: [],
  204. source: "root\x0a\x0a^root",
  205. referencedClasses: [],
  206. //>>excludeEnd("ide");
  207. messageSends: []
  208. }),
  209. $globals.Isolator);
  210. $core.addMethod(
  211. $core.method({
  212. selector: "root:",
  213. protocol: 'accessing',
  214. fn: function (anObject){
  215. var self=this;
  216. self["@root"]=anObject;
  217. return self;
  218. },
  219. //>>excludeStart("ide", pragmas.excludeIdeData);
  220. args: ["anObject"],
  221. source: "root: anObject\x0a\x0aroot := anObject",
  222. referencedClasses: [],
  223. //>>excludeEnd("ide");
  224. messageSends: []
  225. }),
  226. $globals.Isolator);
  227. $core.addMethod(
  228. $core.method({
  229. selector: "on:",
  230. protocol: 'instance creation',
  231. fn: function (anObject){
  232. var self=this;
  233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  234. return $core.withContext(function($ctx1) {
  235. //>>excludeEnd("ctx");
  236. var $1;
  237. $1=$recv(self._new())._root_(anObject);
  238. return $1;
  239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  240. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Isolator.klass)});
  241. //>>excludeEnd("ctx");
  242. },
  243. //>>excludeStart("ide", pragmas.excludeIdeData);
  244. args: ["anObject"],
  245. source: "on: anObject\x0a^self new root: anObject",
  246. referencedClasses: [],
  247. //>>excludeEnd("ide");
  248. messageSends: ["root:", "new"]
  249. }),
  250. $globals.Isolator.klass);
  251. $core.addClass('KeyedPubSubBase', $globals.Object, ['factory'], 'Trapped-Backend');
  252. //>>excludeStart("ide", pragmas.excludeIdeData);
  253. $globals.KeyedPubSubBase.comment="I represent a pub-sub based on a key.\x0aI manage key-block subscriptions as well as running blocks that are dirty.\x0aThe subscription objects are reponsible of decision if the change is relevant for them.\x0aSubscription object must be subclasses of KeyedSubscriptionBase.\x0a\x0aMy subclasses must provide implementation for:\x0a\x09add:\x0a do:\x0a clean\x0a (optionally) run\x0a\x0aand issue this call before actual use:\x0a\x09subscritionFactory: (setting [:key:block|...] factory that creates appropriate subscription)";
  254. //>>excludeEnd("ide");
  255. $core.addMethod(
  256. $core.method({
  257. selector: "changed:",
  258. protocol: 'action',
  259. fn: function (key){
  260. var self=this;
  261. var needsToRun;
  262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  263. return $core.withContext(function($ctx1) {
  264. //>>excludeEnd("ctx");
  265. var $1;
  266. needsToRun=false;
  267. self._do_((function(each){
  268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  269. return $core.withContext(function($ctx2) {
  270. //>>excludeEnd("ctx");
  271. $1=$recv(each)._accepts_(key);
  272. if($core.assert($1)){
  273. $recv(each)._flag();
  274. needsToRun=true;
  275. return needsToRun;
  276. };
  277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  279. //>>excludeEnd("ctx");
  280. }));
  281. self._dirty_(needsToRun);
  282. return self;
  283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  284. }, function($ctx1) {$ctx1.fill(self,"changed:",{key:key,needsToRun:needsToRun},$globals.KeyedPubSubBase)});
  285. //>>excludeEnd("ctx");
  286. },
  287. //>>excludeStart("ide", pragmas.excludeIdeData);
  288. args: ["key"],
  289. source: "changed: key\x0a\x09| needsToRun |\x0a needsToRun := false.\x0a\x09self do: [ :each |\x0a\x09\x09(each accepts: key) ifTrue: [\x0a\x09\x09\x09each flag.\x0a needsToRun := true.\x0a\x09\x09]\x0a\x09].\x0a\x09self dirty: needsToRun",
  290. referencedClasses: [],
  291. //>>excludeEnd("ide");
  292. messageSends: ["do:", "ifTrue:", "accepts:", "flag", "dirty:"]
  293. }),
  294. $globals.KeyedPubSubBase);
  295. $core.addMethod(
  296. $core.method({
  297. selector: "dirty:",
  298. protocol: 'action',
  299. fn: function (aBoolean){
  300. var self=this;
  301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  302. return $core.withContext(function($ctx1) {
  303. //>>excludeEnd("ctx");
  304. if($core.assert(aBoolean)){
  305. $recv((function(){
  306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  307. return $core.withContext(function($ctx2) {
  308. //>>excludeEnd("ctx");
  309. return self._run();
  310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  312. //>>excludeEnd("ctx");
  313. }))._fork();
  314. };
  315. return self;
  316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  317. }, function($ctx1) {$ctx1.fill(self,"dirty:",{aBoolean:aBoolean},$globals.KeyedPubSubBase)});
  318. //>>excludeEnd("ctx");
  319. },
  320. //>>excludeStart("ide", pragmas.excludeIdeData);
  321. args: ["aBoolean"],
  322. source: "dirty: aBoolean\x0a\x09aBoolean ifTrue: [[ self run ] fork]",
  323. referencedClasses: [],
  324. //>>excludeEnd("ide");
  325. messageSends: ["ifTrue:", "fork", "run"]
  326. }),
  327. $globals.KeyedPubSubBase);
  328. $core.addMethod(
  329. $core.method({
  330. selector: "on:hook:",
  331. protocol: 'action',
  332. fn: function (key,aBlock){
  333. var self=this;
  334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  335. return $core.withContext(function($ctx1) {
  336. //>>excludeEnd("ctx");
  337. self._add_($recv($recv(self["@factory"])._value_value_(key,aBlock))._flag());
  338. self._dirty_(true);
  339. return self;
  340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  341. }, function($ctx1) {$ctx1.fill(self,"on:hook:",{key:key,aBlock:aBlock},$globals.KeyedPubSubBase)});
  342. //>>excludeEnd("ctx");
  343. },
  344. //>>excludeStart("ide", pragmas.excludeIdeData);
  345. args: ["key", "aBlock"],
  346. source: "on: key hook: aBlock\x0a\x09self add: (factory value: key value: aBlock) flag.\x0a \x09self dirty: true",
  347. referencedClasses: [],
  348. //>>excludeEnd("ide");
  349. messageSends: ["add:", "flag", "value:value:", "dirty:"]
  350. }),
  351. $globals.KeyedPubSubBase);
  352. $core.addMethod(
  353. $core.method({
  354. selector: "run",
  355. protocol: 'action',
  356. fn: function (){
  357. var self=this;
  358. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  360. return $core.withContext(function($ctx1) {
  361. //>>excludeEnd("ctx");
  362. var $1,$2,$3;
  363. $recv((function(){
  364. var needsClean;
  365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  366. return $core.withContext(function($ctx2) {
  367. //>>excludeEnd("ctx");
  368. needsClean=false;
  369. needsClean;
  370. self._do_((function(each){
  371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  372. return $core.withContext(function($ctx3) {
  373. //>>excludeEnd("ctx");
  374. $1=$recv(each)._isFlagged();
  375. if($core.assert($1)){
  376. $recv(each)._run();
  377. };
  378. $2=$recv(each)._isEnabled();
  379. if(!$core.assert($2)){
  380. needsClean=true;
  381. return needsClean;
  382. };
  383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  384. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  385. //>>excludeEnd("ctx");
  386. }));
  387. $3=needsClean;
  388. if($core.assert($3)){
  389. return self._clean();
  390. };
  391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  392. }, function($ctx2) {$ctx2.fillBlock({needsClean:needsClean},$ctx1,1)});
  393. //>>excludeEnd("ctx");
  394. }))._on_do_($Error(),(function(){
  395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  396. return $core.withContext(function($ctx2) {
  397. //>>excludeEnd("ctx");
  398. return self._dirty_(true);
  399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  401. //>>excludeEnd("ctx");
  402. }));
  403. return self;
  404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  405. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.KeyedPubSubBase)});
  406. //>>excludeEnd("ctx");
  407. },
  408. //>>excludeStart("ide", pragmas.excludeIdeData);
  409. args: [],
  410. source: "run\x0a\x09[\x0a\x09\x09| needsClean |\x0a\x09 needsClean := false.\x0a\x09\x09self do: [ :each |\x0a\x09\x09\x09each isFlagged ifTrue: [ each run ].\x0a\x09 each isEnabled ifFalse: [ needsClean := true ]\x0a\x09\x09].\x0a \x09needsClean ifTrue: [ self clean ]\x0a\x09] on: Error do: [ self dirty: true ]",
  411. referencedClasses: ["Error"],
  412. //>>excludeEnd("ide");
  413. messageSends: ["on:do:", "do:", "ifTrue:", "isFlagged", "run", "ifFalse:", "isEnabled", "clean", "dirty:"]
  414. }),
  415. $globals.KeyedPubSubBase);
  416. $core.addMethod(
  417. $core.method({
  418. selector: "subscriptionFactory:",
  419. protocol: 'action',
  420. fn: function (aBlock){
  421. var self=this;
  422. self["@factory"]=aBlock;
  423. return self;
  424. },
  425. //>>excludeStart("ide", pragmas.excludeIdeData);
  426. args: ["aBlock"],
  427. source: "subscriptionFactory: aBlock\x0a factory := aBlock",
  428. referencedClasses: [],
  429. //>>excludeEnd("ide");
  430. messageSends: []
  431. }),
  432. $globals.KeyedPubSubBase);
  433. $core.addClass('SimpleKeyedPubSub', $globals.KeyedPubSubBase, ['queue'], 'Trapped-Backend');
  434. $core.addMethod(
  435. $core.method({
  436. selector: "add:",
  437. protocol: 'accessing',
  438. fn: function (aSubscription){
  439. var self=this;
  440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  441. return $core.withContext(function($ctx1) {
  442. //>>excludeEnd("ctx");
  443. $recv(self["@queue"])._add_(aSubscription);
  444. return self;
  445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  446. }, function($ctx1) {$ctx1.fill(self,"add:",{aSubscription:aSubscription},$globals.SimpleKeyedPubSub)});
  447. //>>excludeEnd("ctx");
  448. },
  449. //>>excludeStart("ide", pragmas.excludeIdeData);
  450. args: ["aSubscription"],
  451. source: "add: aSubscription\x0a\x09queue add: aSubscription.",
  452. referencedClasses: [],
  453. //>>excludeEnd("ide");
  454. messageSends: ["add:"]
  455. }),
  456. $globals.SimpleKeyedPubSub);
  457. $core.addMethod(
  458. $core.method({
  459. selector: "clean",
  460. protocol: 'bookkeeping',
  461. fn: function (){
  462. var self=this;
  463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  464. return $core.withContext(function($ctx1) {
  465. //>>excludeEnd("ctx");
  466. self["@queue"]=$recv(self["@queue"])._select_((function(each){
  467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  468. return $core.withContext(function($ctx2) {
  469. //>>excludeEnd("ctx");
  470. return $recv(each)._isEnabled();
  471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  472. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  473. //>>excludeEnd("ctx");
  474. }));
  475. return self;
  476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  477. }, function($ctx1) {$ctx1.fill(self,"clean",{},$globals.SimpleKeyedPubSub)});
  478. //>>excludeEnd("ctx");
  479. },
  480. //>>excludeStart("ide", pragmas.excludeIdeData);
  481. args: [],
  482. source: "clean\x0a\x09queue := queue select: [ :each | each isEnabled ]",
  483. referencedClasses: [],
  484. //>>excludeEnd("ide");
  485. messageSends: ["select:", "isEnabled"]
  486. }),
  487. $globals.SimpleKeyedPubSub);
  488. $core.addMethod(
  489. $core.method({
  490. selector: "do:",
  491. protocol: 'enumeration',
  492. fn: function (aBlock){
  493. var self=this;
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. return $core.withContext(function($ctx1) {
  496. //>>excludeEnd("ctx");
  497. $recv(self["@queue"])._do_(aBlock);
  498. return self;
  499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  500. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SimpleKeyedPubSub)});
  501. //>>excludeEnd("ctx");
  502. },
  503. //>>excludeStart("ide", pragmas.excludeIdeData);
  504. args: ["aBlock"],
  505. source: "do: aBlock\x0a\x09queue do: aBlock",
  506. referencedClasses: [],
  507. //>>excludeEnd("ide");
  508. messageSends: ["do:"]
  509. }),
  510. $globals.SimpleKeyedPubSub);
  511. $core.addMethod(
  512. $core.method({
  513. selector: "initialize",
  514. protocol: 'initialization',
  515. fn: function (){
  516. var self=this;
  517. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  519. return $core.withContext(function($ctx1) {
  520. //>>excludeEnd("ctx");
  521. (
  522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  523. $ctx1.supercall = true,
  524. //>>excludeEnd("ctx");
  525. $globals.SimpleKeyedPubSub.superclass.fn.prototype._initialize.apply($recv(self), []));
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. $ctx1.supercall = false;
  528. //>>excludeEnd("ctx");;
  529. self["@queue"]=$recv($OrderedCollection())._new();
  530. return self;
  531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  532. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.SimpleKeyedPubSub)});
  533. //>>excludeEnd("ctx");
  534. },
  535. //>>excludeStart("ide", pragmas.excludeIdeData);
  536. args: [],
  537. source: "initialize\x0a super initialize.\x0a\x09queue := OrderedCollection new",
  538. referencedClasses: ["OrderedCollection"],
  539. //>>excludeEnd("ide");
  540. messageSends: ["initialize", "new"]
  541. }),
  542. $globals.SimpleKeyedPubSub);
  543. $core.addClass('KeyedPubSubUnsubscribe', $globals.Error, [], 'Trapped-Backend');
  544. //>>excludeStart("ide", pragmas.excludeIdeData);
  545. $globals.KeyedPubSubUnsubscribe.comment="SIgnal me from the subscription block to unsubscribe it.";
  546. //>>excludeEnd("ide");
  547. $core.addClass('KeyedSubscriptionBase', $globals.Object, ['key', 'actionBlock', 'flagged'], 'Trapped-Backend');
  548. $core.addMethod(
  549. $core.method({
  550. selector: "accepts:",
  551. protocol: 'testing',
  552. fn: function (aKey){
  553. var self=this;
  554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  555. return $core.withContext(function($ctx1) {
  556. //>>excludeEnd("ctx");
  557. self._subclassResponsibility();
  558. return self;
  559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  560. }, function($ctx1) {$ctx1.fill(self,"accepts:",{aKey:aKey},$globals.KeyedSubscriptionBase)});
  561. //>>excludeEnd("ctx");
  562. },
  563. //>>excludeStart("ide", pragmas.excludeIdeData);
  564. args: ["aKey"],
  565. source: "accepts: aKey\x0a \x22Should return true if change for aKey is relevant for this subscription\x22\x0a self subclassResponsibility",
  566. referencedClasses: [],
  567. //>>excludeEnd("ide");
  568. messageSends: ["subclassResponsibility"]
  569. }),
  570. $globals.KeyedSubscriptionBase);
  571. $core.addMethod(
  572. $core.method({
  573. selector: "flag",
  574. protocol: 'accessing',
  575. fn: function (){
  576. var self=this;
  577. self["@flagged"]=true;
  578. return self;
  579. },
  580. //>>excludeStart("ide", pragmas.excludeIdeData);
  581. args: [],
  582. source: "flag\x0a\x09flagged := true",
  583. referencedClasses: [],
  584. //>>excludeEnd("ide");
  585. messageSends: []
  586. }),
  587. $globals.KeyedSubscriptionBase);
  588. $core.addMethod(
  589. $core.method({
  590. selector: "initialize",
  591. protocol: 'initialization',
  592. fn: function (){
  593. var self=this;
  594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  595. return $core.withContext(function($ctx1) {
  596. //>>excludeEnd("ctx");
  597. (
  598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  599. $ctx1.supercall = true,
  600. //>>excludeEnd("ctx");
  601. $globals.KeyedSubscriptionBase.superclass.fn.prototype._initialize.apply($recv(self), []));
  602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  603. $ctx1.supercall = false;
  604. //>>excludeEnd("ctx");;
  605. self["@key"]=nil;
  606. self["@actionBlock"]=nil;
  607. self["@flagged"]=false;
  608. return self;
  609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  610. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.KeyedSubscriptionBase)});
  611. //>>excludeEnd("ctx");
  612. },
  613. //>>excludeStart("ide", pragmas.excludeIdeData);
  614. args: [],
  615. source: "initialize\x0a\x09super initialize.\x0a key := nil.\x0a actionBlock := nil.\x0a flagged := false.",
  616. referencedClasses: [],
  617. //>>excludeEnd("ide");
  618. messageSends: ["initialize"]
  619. }),
  620. $globals.KeyedSubscriptionBase);
  621. $core.addMethod(
  622. $core.method({
  623. selector: "isEnabled",
  624. protocol: 'testing',
  625. fn: function (){
  626. var self=this;
  627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  628. return $core.withContext(function($ctx1) {
  629. //>>excludeEnd("ctx");
  630. var $1;
  631. $1=$recv(self["@actionBlock"])._notNil();
  632. return $1;
  633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  634. }, function($ctx1) {$ctx1.fill(self,"isEnabled",{},$globals.KeyedSubscriptionBase)});
  635. //>>excludeEnd("ctx");
  636. },
  637. //>>excludeStart("ide", pragmas.excludeIdeData);
  638. args: [],
  639. source: "isEnabled\x0a\x09^actionBlock notNil",
  640. referencedClasses: [],
  641. //>>excludeEnd("ide");
  642. messageSends: ["notNil"]
  643. }),
  644. $globals.KeyedSubscriptionBase);
  645. $core.addMethod(
  646. $core.method({
  647. selector: "isFlagged",
  648. protocol: 'testing',
  649. fn: function (){
  650. var self=this;
  651. var $1;
  652. $1=self["@flagged"];
  653. return $1;
  654. },
  655. //>>excludeStart("ide", pragmas.excludeIdeData);
  656. args: [],
  657. source: "isFlagged\x0a\x09^flagged",
  658. referencedClasses: [],
  659. //>>excludeEnd("ide");
  660. messageSends: []
  661. }),
  662. $globals.KeyedSubscriptionBase);
  663. $core.addMethod(
  664. $core.method({
  665. selector: "key:block:",
  666. protocol: 'accessing',
  667. fn: function (anObject,aBlock){
  668. var self=this;
  669. self["@key"]=anObject;
  670. self["@actionBlock"]=aBlock;
  671. return self;
  672. },
  673. //>>excludeStart("ide", pragmas.excludeIdeData);
  674. args: ["anObject", "aBlock"],
  675. source: "key: anObject block: aBlock\x0a\x09key := anObject.\x0a actionBlock := aBlock",
  676. referencedClasses: [],
  677. //>>excludeEnd("ide");
  678. messageSends: []
  679. }),
  680. $globals.KeyedSubscriptionBase);
  681. $core.addMethod(
  682. $core.method({
  683. selector: "run",
  684. protocol: 'action',
  685. fn: function (){
  686. var self=this;
  687. function $KeyedPubSubUnsubscribe(){return $globals.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  689. return $core.withContext(function($ctx1) {
  690. //>>excludeEnd("ctx");
  691. $recv((function(){
  692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  693. return $core.withContext(function($ctx2) {
  694. //>>excludeEnd("ctx");
  695. self["@flagged"]=false;
  696. self["@flagged"];
  697. return $recv(self["@actionBlock"])._value();
  698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  700. //>>excludeEnd("ctx");
  701. }))._on_do_($KeyedPubSubUnsubscribe(),(function(){
  702. self["@actionBlock"]=nil;
  703. return self["@actionBlock"];
  704. }));
  705. return self;
  706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  707. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.KeyedSubscriptionBase)});
  708. //>>excludeEnd("ctx");
  709. },
  710. //>>excludeStart("ide", pragmas.excludeIdeData);
  711. args: [],
  712. source: "run\x0a\x09[ flagged := false. actionBlock value ]\x0a on: KeyedPubSubUnsubscribe do: [ actionBlock := nil ]",
  713. referencedClasses: ["KeyedPubSubUnsubscribe"],
  714. //>>excludeEnd("ide");
  715. messageSends: ["on:do:", "value"]
  716. }),
  717. $globals.KeyedSubscriptionBase);
  718. $core.addClass('ListKeyedSubscription', $globals.KeyedSubscriptionBase, [], 'Trapped-Backend');
  719. $core.addMethod(
  720. $core.method({
  721. selector: "accepts:",
  722. protocol: 'testing',
  723. fn: function (aKey){
  724. var self=this;
  725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  726. return $core.withContext(function($ctx1) {
  727. //>>excludeEnd("ctx");
  728. var $3,$4,$2,$1;
  729. $3=$recv(aKey)._size();
  730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  731. $ctx1.sendIdx["size"]=1;
  732. //>>excludeEnd("ctx");
  733. $4=$recv(self["@key"])._size();
  734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  735. $ctx1.sendIdx["size"]=2;
  736. //>>excludeEnd("ctx");
  737. $2=$recv($3).__lt_eq($4);
  738. $1=$recv($2)._and_((function(){
  739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  740. return $core.withContext(function($ctx2) {
  741. //>>excludeEnd("ctx");
  742. return $recv(aKey).__eq($recv(self["@key"])._copyFrom_to_((1),$recv(aKey)._size()));
  743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  745. //>>excludeEnd("ctx");
  746. }));
  747. return $1;
  748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  749. }, function($ctx1) {$ctx1.fill(self,"accepts:",{aKey:aKey},$globals.ListKeyedSubscription)});
  750. //>>excludeEnd("ctx");
  751. },
  752. //>>excludeStart("ide", pragmas.excludeIdeData);
  753. args: ["aKey"],
  754. source: "accepts: aKey\x0a ^aKey size <= key size and: [aKey = (key copyFrom: 1 to: aKey size)]",
  755. referencedClasses: [],
  756. //>>excludeEnd("ide");
  757. messageSends: ["and:", "<=", "size", "=", "copyFrom:to:"]
  758. }),
  759. $globals.ListKeyedSubscription);
  760. $core.addClass('TwoWayListKeyedSubscription', $globals.KeyedSubscriptionBase, [], 'Trapped-Backend');
  761. $core.addMethod(
  762. $core.method({
  763. selector: "accepts:",
  764. protocol: 'testing',
  765. fn: function (aKey){
  766. var self=this;
  767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  768. return $core.withContext(function($ctx1) {
  769. //>>excludeEnd("ctx");
  770. var $3,$4,$2,$6,$7,$5,$1;
  771. $3=$recv(aKey)._size();
  772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  773. $ctx1.sendIdx["size"]=1;
  774. //>>excludeEnd("ctx");
  775. $4=$recv(self["@key"])._size();
  776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  777. $ctx1.sendIdx["size"]=2;
  778. //>>excludeEnd("ctx");
  779. $2=$recv($3).__lt_eq($4);
  780. if($core.assert($2)){
  781. $6=self["@key"];
  782. $7=$recv(aKey)._size();
  783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  784. $ctx1.sendIdx["size"]=3;
  785. //>>excludeEnd("ctx");
  786. $5=$recv($6)._copyFrom_to_((1),$7);
  787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  788. $ctx1.sendIdx["copyFrom:to:"]=1;
  789. //>>excludeEnd("ctx");
  790. $1=$recv(aKey).__eq($5);
  791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  792. $ctx1.sendIdx["="]=1;
  793. //>>excludeEnd("ctx");
  794. } else {
  795. $1=$recv(self["@key"]).__eq($recv(aKey)._copyFrom_to_((1),$recv(self["@key"])._size()));
  796. };
  797. return $1;
  798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  799. }, function($ctx1) {$ctx1.fill(self,"accepts:",{aKey:aKey},$globals.TwoWayListKeyedSubscription)});
  800. //>>excludeEnd("ctx");
  801. },
  802. //>>excludeStart("ide", pragmas.excludeIdeData);
  803. args: ["aKey"],
  804. source: "accepts: aKey\x0a ^aKey size <= key size\x0a\x09\x09ifTrue: [aKey = (key copyFrom: 1 to: aKey size)]\x0a\x09\x09ifFalse: [key = (aKey copyFrom: 1 to: key size)]",
  805. referencedClasses: [],
  806. //>>excludeEnd("ide");
  807. messageSends: ["ifTrue:ifFalse:", "<=", "size", "=", "copyFrom:to:"]
  808. }),
  809. $globals.TwoWayListKeyedSubscription);
  810. $core.addClass('ListKeyedEntity', $globals.Object, ['dispatcher', 'payload'], 'Trapped-Backend');
  811. //>>excludeStart("ide", pragmas.excludeIdeData);
  812. $globals.ListKeyedEntity.comment="I am base class for #('string-at-index' #selector numeric-at-index)-array-path-keyed entities,\x0athat moderate access to the wrapped model object via read;do and modify:do:\x0aand allow pub-sub via watch:do:.\x0aThis wrapped model can be any smalltalk object.\x0a\x0aMy subclasses need to provide implementation for:\x0a\x09read:do:\x0a modify:do:\x0a\x0aand must issue these calls when initializing:\x0a\x09model: (with a wrapped object)\x0a\x09dispatcher: (with a subclass of KeyedPubSubBase)";
  813. //>>excludeEnd("ide");
  814. $core.addMethod(
  815. $core.method({
  816. selector: "dispatcher",
  817. protocol: 'accessing',
  818. fn: function (){
  819. var self=this;
  820. var $1;
  821. $1=self["@dispatcher"];
  822. return $1;
  823. },
  824. //>>excludeStart("ide", pragmas.excludeIdeData);
  825. args: [],
  826. source: "dispatcher\x0a\x09^dispatcher",
  827. referencedClasses: [],
  828. //>>excludeEnd("ide");
  829. messageSends: []
  830. }),
  831. $globals.ListKeyedEntity);
  832. $core.addMethod(
  833. $core.method({
  834. selector: "dispatcher:",
  835. protocol: 'accessing',
  836. fn: function (aDispatcher){
  837. var self=this;
  838. function $TwoWayListKeyedSubscription(){return $globals.TwoWayListKeyedSubscription||(typeof TwoWayListKeyedSubscription=="undefined"?nil:TwoWayListKeyedSubscription)}
  839. function $ListKeyedSubscription(){return $globals.ListKeyedSubscription||(typeof ListKeyedSubscription=="undefined"?nil:ListKeyedSubscription)}
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. return $core.withContext(function($ctx1) {
  842. //>>excludeEnd("ctx");
  843. var $1,$2,$3,$4,$5,$6;
  844. $recv(aDispatcher)._subscriptionFactory_((function(key,block){
  845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  846. return $core.withContext(function($ctx2) {
  847. //>>excludeEnd("ctx");
  848. $1=$recv($recv(key)._notEmpty())._and_((function(){
  849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  850. return $core.withContext(function($ctx3) {
  851. //>>excludeEnd("ctx");
  852. return $recv($recv(key)._last())._isNil();
  853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  854. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  855. //>>excludeEnd("ctx");
  856. }));
  857. if($core.assert($1)){
  858. $2=$recv($TwoWayListKeyedSubscription())._new();
  859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  860. $ctx2.sendIdx["new"]=1;
  861. //>>excludeEnd("ctx");
  862. $recv($2)._key_block_($recv(key)._allButLast(),block);
  863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  864. $ctx2.sendIdx["key:block:"]=1;
  865. //>>excludeEnd("ctx");
  866. $3=$recv($2)._yourself();
  867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  868. $ctx2.sendIdx["yourself"]=1;
  869. //>>excludeEnd("ctx");
  870. return $3;
  871. } else {
  872. $4=$recv($ListKeyedSubscription())._new();
  873. $recv($4)._key_block_(key,block);
  874. $5=$recv($4)._yourself();
  875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  876. $ctx2.sendIdx["yourself"]=2;
  877. //>>excludeEnd("ctx");
  878. return $5;
  879. };
  880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  881. }, function($ctx2) {$ctx2.fillBlock({key:key,block:block},$ctx1,1)});
  882. //>>excludeEnd("ctx");
  883. }));
  884. $6=$recv(aDispatcher)._yourself();
  885. self["@dispatcher"]=$6;
  886. return self;
  887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  888. }, function($ctx1) {$ctx1.fill(self,"dispatcher:",{aDispatcher:aDispatcher},$globals.ListKeyedEntity)});
  889. //>>excludeEnd("ctx");
  890. },
  891. //>>excludeStart("ide", pragmas.excludeIdeData);
  892. args: ["aDispatcher"],
  893. source: "dispatcher: aDispatcher\x0a\x09dispatcher := aDispatcher\x0a subscriptionFactory: [ :key :block |\x0a\x09\x09\x09(key notEmpty and: [ key last isNil ])\x0a\x09\x09\x09\x09ifTrue: [ TwoWayListKeyedSubscription new key: key allButLast block: block; yourself ]\x0a\x09\x09\x09\x09ifFalse: [ ListKeyedSubscription new key: key block: block; yourself ]];\x0a yourself",
  894. referencedClasses: ["TwoWayListKeyedSubscription", "ListKeyedSubscription"],
  895. //>>excludeEnd("ide");
  896. messageSends: ["subscriptionFactory:", "ifTrue:ifFalse:", "and:", "notEmpty", "isNil", "last", "key:block:", "new", "allButLast", "yourself"]
  897. }),
  898. $globals.ListKeyedEntity);
  899. $core.addMethod(
  900. $core.method({
  901. selector: "model:",
  902. protocol: 'accessing',
  903. fn: function (anObject){
  904. var self=this;
  905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  906. return $core.withContext(function($ctx1) {
  907. //>>excludeEnd("ctx");
  908. self["@payload"]=anObject;
  909. $recv(self._dispatcher())._changed_([]);
  910. return self;
  911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  912. }, function($ctx1) {$ctx1.fill(self,"model:",{anObject:anObject},$globals.ListKeyedEntity)});
  913. //>>excludeEnd("ctx");
  914. },
  915. //>>excludeStart("ide", pragmas.excludeIdeData);
  916. args: ["anObject"],
  917. source: "model: anObject\x0a\x09payload := anObject.\x0a self dispatcher changed: #()",
  918. referencedClasses: [],
  919. //>>excludeEnd("ide");
  920. messageSends: ["changed:", "dispatcher"]
  921. }),
  922. $globals.ListKeyedEntity);
  923. $core.addMethod(
  924. $core.method({
  925. selector: "watch:do:",
  926. protocol: 'action',
  927. fn: function (path,aBlock){
  928. var self=this;
  929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  930. return $core.withContext(function($ctx1) {
  931. //>>excludeEnd("ctx");
  932. $recv(self._dispatcher())._on_hook_(path,(function(){
  933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  934. return $core.withContext(function($ctx2) {
  935. //>>excludeEnd("ctx");
  936. return self._read_do_(path,aBlock);
  937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  939. //>>excludeEnd("ctx");
  940. }));
  941. return self;
  942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  943. }, function($ctx1) {$ctx1.fill(self,"watch:do:",{path:path,aBlock:aBlock},$globals.ListKeyedEntity)});
  944. //>>excludeEnd("ctx");
  945. },
  946. //>>excludeStart("ide", pragmas.excludeIdeData);
  947. args: ["path", "aBlock"],
  948. source: "watch: path do: aBlock\x0a\x09self dispatcher on: path hook: [ self read: path do: aBlock ]",
  949. referencedClasses: [],
  950. //>>excludeEnd("ide");
  951. messageSends: ["on:hook:", "dispatcher", "read:do:"]
  952. }),
  953. $globals.ListKeyedEntity);
  954. $core.addClass('ListKeyedDirectEntity', $globals.ListKeyedEntity, [], 'Trapped-Backend');
  955. //>>excludeStart("ide", pragmas.excludeIdeData);
  956. $globals.ListKeyedDirectEntity.comment="I am ListKeyedEntity that directly manipulate\x0athe wrapped model object.";
  957. //>>excludeEnd("ide");
  958. $core.addMethod(
  959. $core.method({
  960. selector: "modify:do:",
  961. protocol: 'action',
  962. fn: function (path,aBlock){
  963. var self=this;
  964. var newValue,eavModel;
  965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  966. return $core.withContext(function($ctx1) {
  967. //>>excludeEnd("ctx");
  968. eavModel=$recv(path)._asEavModel();
  969. newValue=$recv(aBlock)._value_($recv(eavModel)._on_(self["@payload"]));
  970. $recv((function(){
  971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  972. return $core.withContext(function($ctx2) {
  973. //>>excludeEnd("ctx");
  974. return $recv(eavModel)._on_put_(self["@payload"],newValue);
  975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  977. //>>excludeEnd("ctx");
  978. }))._ensure_((function(){
  979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  980. return $core.withContext(function($ctx2) {
  981. //>>excludeEnd("ctx");
  982. return $recv(self._dispatcher())._changed_(path);
  983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  985. //>>excludeEnd("ctx");
  986. }));
  987. return self;
  988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  989. }, function($ctx1) {$ctx1.fill(self,"modify:do:",{path:path,aBlock:aBlock,newValue:newValue,eavModel:eavModel},$globals.ListKeyedDirectEntity)});
  990. //>>excludeEnd("ctx");
  991. },
  992. //>>excludeStart("ide", pragmas.excludeIdeData);
  993. args: ["path", "aBlock"],
  994. source: "modify: path do: aBlock\x0a | newValue eavModel |\x0a eavModel := path asEavModel.\x0a newValue := aBlock value: (eavModel on: payload).\x0a [ eavModel on: payload put: newValue ] ensure: [ self dispatcher changed: path ]",
  995. referencedClasses: [],
  996. //>>excludeEnd("ide");
  997. messageSends: ["asEavModel", "value:", "on:", "ensure:", "on:put:", "changed:", "dispatcher"]
  998. }),
  999. $globals.ListKeyedDirectEntity);
  1000. $core.addMethod(
  1001. $core.method({
  1002. selector: "read:do:",
  1003. protocol: 'action',
  1004. fn: function (path,aBlock){
  1005. var self=this;
  1006. var eavModel;
  1007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1008. return $core.withContext(function($ctx1) {
  1009. //>>excludeEnd("ctx");
  1010. eavModel=$recv(path)._asEavModel();
  1011. $recv(aBlock)._value_($recv(eavModel)._on_(self["@payload"]));
  1012. return self;
  1013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1014. }, function($ctx1) {$ctx1.fill(self,"read:do:",{path:path,aBlock:aBlock,eavModel:eavModel},$globals.ListKeyedDirectEntity)});
  1015. //>>excludeEnd("ctx");
  1016. },
  1017. //>>excludeStart("ide", pragmas.excludeIdeData);
  1018. args: ["path", "aBlock"],
  1019. source: "read: path do: aBlock\x0a | eavModel |\x0a eavModel := path asEavModel.\x0a aBlock value: (eavModel on: payload)",
  1020. referencedClasses: [],
  1021. //>>excludeEnd("ide");
  1022. messageSends: ["asEavModel", "value:", "on:"]
  1023. }),
  1024. $globals.ListKeyedDirectEntity);
  1025. $core.addClass('ListKeyedIsolatedEntity', $globals.ListKeyedEntity, [], 'Trapped-Backend');
  1026. //>>excludeStart("ide", pragmas.excludeIdeData);
  1027. $globals.ListKeyedIsolatedEntity.comment="I am ListKeyedEntity that guards access\x0ato the wrapped model object via Isolator.";
  1028. //>>excludeEnd("ide");
  1029. $core.addMethod(
  1030. $core.method({
  1031. selector: "model:",
  1032. protocol: 'accessing',
  1033. fn: function (anObject){
  1034. var self=this;
  1035. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  1036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1037. return $core.withContext(function($ctx1) {
  1038. //>>excludeEnd("ctx");
  1039. (
  1040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1041. $ctx1.supercall = true,
  1042. //>>excludeEnd("ctx");
  1043. $globals.ListKeyedIsolatedEntity.superclass.fn.prototype._model_.apply($recv(self), [$recv($Isolator())._on_(anObject)]));
  1044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1045. $ctx1.supercall = false;
  1046. //>>excludeEnd("ctx");;
  1047. return self;
  1048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1049. }, function($ctx1) {$ctx1.fill(self,"model:",{anObject:anObject},$globals.ListKeyedIsolatedEntity)});
  1050. //>>excludeEnd("ctx");
  1051. },
  1052. //>>excludeStart("ide", pragmas.excludeIdeData);
  1053. args: ["anObject"],
  1054. source: "model: anObject\x0a\x09super model: (Isolator on: anObject)",
  1055. referencedClasses: ["Isolator"],
  1056. //>>excludeEnd("ide");
  1057. messageSends: ["model:", "on:"]
  1058. }),
  1059. $globals.ListKeyedIsolatedEntity);
  1060. $core.addMethod(
  1061. $core.method({
  1062. selector: "modify:do:",
  1063. protocol: 'action',
  1064. fn: function (path,aBlock){
  1065. var self=this;
  1066. var eavModel;
  1067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1068. return $core.withContext(function($ctx1) {
  1069. //>>excludeEnd("ctx");
  1070. eavModel=$recv($recv([["root"]]).__comma(path))._asEavModel();
  1071. $recv((function(){
  1072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1073. return $core.withContext(function($ctx2) {
  1074. //>>excludeEnd("ctx");
  1075. return $recv(self["@payload"])._model_modify_(eavModel,aBlock);
  1076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1078. //>>excludeEnd("ctx");
  1079. }))._ensure_((function(){
  1080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1081. return $core.withContext(function($ctx2) {
  1082. //>>excludeEnd("ctx");
  1083. return $recv(self._dispatcher())._changed_(path);
  1084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1085. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1086. //>>excludeEnd("ctx");
  1087. }));
  1088. return self;
  1089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1090. }, function($ctx1) {$ctx1.fill(self,"modify:do:",{path:path,aBlock:aBlock,eavModel:eavModel},$globals.ListKeyedIsolatedEntity)});
  1091. //>>excludeEnd("ctx");
  1092. },
  1093. //>>excludeStart("ide", pragmas.excludeIdeData);
  1094. args: ["path", "aBlock"],
  1095. source: "modify: path do: aBlock\x0a | eavModel |\x0a eavModel := ({{#root}},path) asEavModel.\x0a [ payload model: eavModel modify: aBlock ] ensure: [ self dispatcher changed: path ]",
  1096. referencedClasses: [],
  1097. //>>excludeEnd("ide");
  1098. messageSends: ["asEavModel", ",", "ensure:", "model:modify:", "changed:", "dispatcher"]
  1099. }),
  1100. $globals.ListKeyedIsolatedEntity);
  1101. $core.addMethod(
  1102. $core.method({
  1103. selector: "read:do:",
  1104. protocol: 'action',
  1105. fn: function (path,aBlock){
  1106. var self=this;
  1107. var eavModel;
  1108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1109. return $core.withContext(function($ctx1) {
  1110. //>>excludeEnd("ctx");
  1111. eavModel=$recv($recv([["root"]]).__comma(path))._asEavModel();
  1112. $recv(self["@payload"])._model_read_(eavModel,aBlock);
  1113. return self;
  1114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1115. }, function($ctx1) {$ctx1.fill(self,"read:do:",{path:path,aBlock:aBlock,eavModel:eavModel},$globals.ListKeyedIsolatedEntity)});
  1116. //>>excludeEnd("ctx");
  1117. },
  1118. //>>excludeStart("ide", pragmas.excludeIdeData);
  1119. args: ["path", "aBlock"],
  1120. source: "read: path do: aBlock\x0a | eavModel |\x0a eavModel := ({{#root}},path) asEavModel.\x0a payload model: eavModel read: aBlock",
  1121. referencedClasses: [],
  1122. //>>excludeEnd("ide");
  1123. messageSends: ["asEavModel", ",", "model:read:"]
  1124. }),
  1125. $globals.ListKeyedIsolatedEntity);
  1126. $core.addMethod(
  1127. $core.method({
  1128. selector: "asTrapAtPut:sendTo:",
  1129. protocol: '*Trapped-Backend',
  1130. fn: function (value,anObject){
  1131. var self=this;
  1132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1133. return $core.withContext(function($ctx1) {
  1134. //>>excludeEnd("ctx");
  1135. var $1;
  1136. $1=$recv(anObject)._perform_withArguments_($recv($recv(self._first()).__comma(":"))._asSymbol(),[value]);
  1137. return $1;
  1138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1139. }, function($ctx1) {$ctx1.fill(self,"asTrapAtPut:sendTo:",{value:value,anObject:anObject},$globals.Array)});
  1140. //>>excludeEnd("ctx");
  1141. },
  1142. //>>excludeStart("ide", pragmas.excludeIdeData);
  1143. args: ["value", "anObject"],
  1144. source: "asTrapAtPut: value sendTo: anObject\x0a ^anObject perform: (self first, ':') asSymbol withArguments: { value }",
  1145. referencedClasses: [],
  1146. //>>excludeEnd("ide");
  1147. messageSends: ["perform:withArguments:", "asSymbol", ",", "first"]
  1148. }),
  1149. $globals.Array);
  1150. $core.addMethod(
  1151. $core.method({
  1152. selector: "asTrapAtSendTo:",
  1153. protocol: '*Trapped-Backend',
  1154. fn: function (anObject){
  1155. var self=this;
  1156. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1158. return $core.withContext(function($ctx1) {
  1159. //>>excludeEnd("ctx");
  1160. var $1;
  1161. var $early={};
  1162. try {
  1163. $1=$recv((function(){
  1164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1165. return $core.withContext(function($ctx2) {
  1166. //>>excludeEnd("ctx");
  1167. return $recv(anObject)._perform_(self._first());
  1168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1170. //>>excludeEnd("ctx");
  1171. }))._on_do_($MessageNotUnderstood(),(function(){
  1172. throw $early=[nil];
  1173. }));
  1174. return $1;
  1175. }
  1176. catch(e) {if(e===$early)return e[0]; throw e}
  1177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1178. }, function($ctx1) {$ctx1.fill(self,"asTrapAtSendTo:",{anObject:anObject},$globals.Array)});
  1179. //>>excludeEnd("ctx");
  1180. },
  1181. //>>excludeStart("ide", pragmas.excludeIdeData);
  1182. args: ["anObject"],
  1183. source: "asTrapAtSendTo: anObject\x0a\x09^[anObject perform: self first] on: MessageNotUnderstood do: [^nil]",
  1184. referencedClasses: ["MessageNotUnderstood"],
  1185. //>>excludeEnd("ide");
  1186. messageSends: ["on:do:", "perform:", "first"]
  1187. }),
  1188. $globals.Array);
  1189. $core.addMethod(
  1190. $core.method({
  1191. selector: "asTrapAtPut:sendTo:",
  1192. protocol: '*Trapped-Backend',
  1193. fn: function (value,anObject){
  1194. var self=this;
  1195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1196. return $core.withContext(function($ctx1) {
  1197. //>>excludeEnd("ctx");
  1198. var $1;
  1199. $1=$recv(anObject)._at_put_(self,value);
  1200. return $1;
  1201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1202. }, function($ctx1) {$ctx1.fill(self,"asTrapAtPut:sendTo:",{value:value,anObject:anObject},$globals.Number)});
  1203. //>>excludeEnd("ctx");
  1204. },
  1205. //>>excludeStart("ide", pragmas.excludeIdeData);
  1206. args: ["value", "anObject"],
  1207. source: "asTrapAtPut: value sendTo: anObject\x0a\x09^anObject at: self put: value",
  1208. referencedClasses: [],
  1209. //>>excludeEnd("ide");
  1210. messageSends: ["at:put:"]
  1211. }),
  1212. $globals.Number);
  1213. $core.addMethod(
  1214. $core.method({
  1215. selector: "asTrapAtSendTo:",
  1216. protocol: '*Trapped-Backend',
  1217. fn: function (anObject){
  1218. var self=this;
  1219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1220. return $core.withContext(function($ctx1) {
  1221. //>>excludeEnd("ctx");
  1222. var $1,$receiver;
  1223. if(($receiver = anObject) == null || $receiver.isNil){
  1224. $1=anObject;
  1225. } else {
  1226. $1=$recv(anObject)._at_ifAbsent_(self,(function(){
  1227. return nil;
  1228. }));
  1229. };
  1230. return $1;
  1231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1232. }, function($ctx1) {$ctx1.fill(self,"asTrapAtSendTo:",{anObject:anObject},$globals.Number)});
  1233. //>>excludeEnd("ctx");
  1234. },
  1235. //>>excludeStart("ide", pragmas.excludeIdeData);
  1236. args: ["anObject"],
  1237. source: "asTrapAtSendTo: anObject\x0a\x09^anObject ifNotNil: [ anObject at: self ifAbsent: [nil] ]",
  1238. referencedClasses: [],
  1239. //>>excludeEnd("ide");
  1240. messageSends: ["ifNotNil:", "at:ifAbsent:"]
  1241. }),
  1242. $globals.Number);
  1243. $core.addMethod(
  1244. $core.method({
  1245. selector: "asTrapAtPut:sendTo:",
  1246. protocol: '*Trapped-Backend',
  1247. fn: function (value,anObject){
  1248. var self=this;
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. return $core.withContext(function($ctx1) {
  1251. //>>excludeEnd("ctx");
  1252. var $1;
  1253. $1=$recv("Trapped cannot put at ".__comma($recv(self._class())._name())).__comma(" type key.");
  1254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1255. $ctx1.sendIdx[","]=1;
  1256. //>>excludeEnd("ctx");
  1257. self._error_($1);
  1258. return self;
  1259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1260. }, function($ctx1) {$ctx1.fill(self,"asTrapAtPut:sendTo:",{value:value,anObject:anObject},$globals.Object)});
  1261. //>>excludeEnd("ctx");
  1262. },
  1263. //>>excludeStart("ide", pragmas.excludeIdeData);
  1264. args: ["value", "anObject"],
  1265. source: "asTrapAtPut: value sendTo: anObject\x0a\x09self error: 'Trapped cannot put at ', self class name, ' type key.'",
  1266. referencedClasses: [],
  1267. //>>excludeEnd("ide");
  1268. messageSends: ["error:", ",", "name", "class"]
  1269. }),
  1270. $globals.Object);
  1271. $core.addMethod(
  1272. $core.method({
  1273. selector: "asTrapAtSendTo:",
  1274. protocol: '*Trapped-Backend',
  1275. fn: function (anObject){
  1276. var self=this;
  1277. return nil;
  1278. },
  1279. //>>excludeStart("ide", pragmas.excludeIdeData);
  1280. args: ["anObject"],
  1281. source: "asTrapAtSendTo: anObject\x0a\x09^nil",
  1282. referencedClasses: [],
  1283. //>>excludeEnd("ide");
  1284. messageSends: []
  1285. }),
  1286. $globals.Object);
  1287. $core.addMethod(
  1288. $core.method({
  1289. selector: "asEavModel",
  1290. protocol: '*Trapped-Backend',
  1291. fn: function (){
  1292. var self=this;
  1293. var model;
  1294. function $EavModel(){return $globals.EavModel||(typeof EavModel=="undefined"?nil:EavModel)}
  1295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1296. return $core.withContext(function($ctx1) {
  1297. //>>excludeEnd("ctx");
  1298. var $1,$2,$receiver;
  1299. model=$recv($EavModel())._new();
  1300. $recv(model)._getBlock_((function(anObject){
  1301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1302. return $core.withContext(function($ctx2) {
  1303. //>>excludeEnd("ctx");
  1304. return self._inject_into_(anObject,(function(soFar,segment){
  1305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1306. return $core.withContext(function($ctx3) {
  1307. //>>excludeEnd("ctx");
  1308. return $recv(segment)._asTrapAtSendTo_(soFar);
  1309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1310. $ctx3.sendIdx["asTrapAtSendTo:"]=1;
  1311. //>>excludeEnd("ctx");
  1312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1313. }, function($ctx3) {$ctx3.fillBlock({soFar:soFar,segment:segment},$ctx2,2)});
  1314. //>>excludeEnd("ctx");
  1315. }));
  1316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1317. $ctx2.sendIdx["inject:into:"]=1;
  1318. //>>excludeEnd("ctx");
  1319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1320. }, function($ctx2) {$ctx2.fillBlock({anObject:anObject},$ctx1,1)});
  1321. //>>excludeEnd("ctx");
  1322. }));
  1323. $1=self._isEmpty();
  1324. if(!$core.assert($1)){
  1325. $recv(model)._putBlock_((function(anObject,value){
  1326. var penultimate;
  1327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1328. return $core.withContext(function($ctx2) {
  1329. //>>excludeEnd("ctx");
  1330. penultimate=$recv(self._allButLast())._inject_into_(anObject,(function(soFar,segment){
  1331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1332. return $core.withContext(function($ctx3) {
  1333. //>>excludeEnd("ctx");
  1334. if(($receiver = soFar) == null || $receiver.isNil){
  1335. return soFar;
  1336. } else {
  1337. return $recv(segment)._asTrapAtSendTo_(soFar);
  1338. };
  1339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1340. }, function($ctx3) {$ctx3.fillBlock({soFar:soFar,segment:segment},$ctx2,5)});
  1341. //>>excludeEnd("ctx");
  1342. }));
  1343. penultimate;
  1344. return $recv(self._last())._asTrapAtPut_sendTo_(value,penultimate);
  1345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1346. }, function($ctx2) {$ctx2.fillBlock({anObject:anObject,value:value,penultimate:penultimate},$ctx1,4)});
  1347. //>>excludeEnd("ctx");
  1348. }));
  1349. };
  1350. $2=model;
  1351. return $2;
  1352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1353. }, function($ctx1) {$ctx1.fill(self,"asEavModel",{model:model},$globals.SequenceableCollection)});
  1354. //>>excludeEnd("ctx");
  1355. },
  1356. //>>excludeStart("ide", pragmas.excludeIdeData);
  1357. args: [],
  1358. source: "asEavModel\x0a | model |\x0a model := EavModel new.\x0a model getBlock: [ :anObject |\x0a self inject: anObject into: [ :soFar :segment |\x0a segment asTrapAtSendTo: soFar ]].\x0a self isEmpty ifFalse: [\x0a model putBlock: [ :anObject :value | | penultimate |\x0a penultimate := self allButLast inject: anObject into: [ :soFar :segment |\x0a soFar ifNotNil: [ segment asTrapAtSendTo: soFar ]].\x0a self last asTrapAtPut:value sendTo: penultimate ]].\x0a ^model",
  1359. referencedClasses: ["EavModel"],
  1360. //>>excludeEnd("ide");
  1361. messageSends: ["new", "getBlock:", "inject:into:", "asTrapAtSendTo:", "ifFalse:", "isEmpty", "putBlock:", "allButLast", "ifNotNil:", "asTrapAtPut:sendTo:", "last"]
  1362. }),
  1363. $globals.SequenceableCollection);
  1364. $core.addMethod(
  1365. $core.method({
  1366. selector: "asTrapAtPut:sendTo:",
  1367. protocol: '*Trapped-Backend',
  1368. fn: function (value,anObject){
  1369. var self=this;
  1370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1371. return $core.withContext(function($ctx1) {
  1372. //>>excludeEnd("ctx");
  1373. var $1;
  1374. $1=$recv(anObject)._at_put_(self,value);
  1375. return $1;
  1376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1377. }, function($ctx1) {$ctx1.fill(self,"asTrapAtPut:sendTo:",{value:value,anObject:anObject},$globals.String)});
  1378. //>>excludeEnd("ctx");
  1379. },
  1380. //>>excludeStart("ide", pragmas.excludeIdeData);
  1381. args: ["value", "anObject"],
  1382. source: "asTrapAtPut: value sendTo: anObject\x0a\x09^anObject at: self put: value",
  1383. referencedClasses: [],
  1384. //>>excludeEnd("ide");
  1385. messageSends: ["at:put:"]
  1386. }),
  1387. $globals.String);
  1388. $core.addMethod(
  1389. $core.method({
  1390. selector: "asTrapAtSendTo:",
  1391. protocol: '*Trapped-Backend',
  1392. fn: function (anObject){
  1393. var self=this;
  1394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1395. return $core.withContext(function($ctx1) {
  1396. //>>excludeEnd("ctx");
  1397. var $1,$receiver;
  1398. if(($receiver = anObject) == null || $receiver.isNil){
  1399. $1=anObject;
  1400. } else {
  1401. $1=$recv(anObject)._at_ifAbsent_(self,(function(){
  1402. return nil;
  1403. }));
  1404. };
  1405. return $1;
  1406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1407. }, function($ctx1) {$ctx1.fill(self,"asTrapAtSendTo:",{anObject:anObject},$globals.String)});
  1408. //>>excludeEnd("ctx");
  1409. },
  1410. //>>excludeStart("ide", pragmas.excludeIdeData);
  1411. args: ["anObject"],
  1412. source: "asTrapAtSendTo: anObject\x0a\x09^anObject ifNotNil: [ anObject at: self ifAbsent: [nil] ]",
  1413. referencedClasses: [],
  1414. //>>excludeEnd("ide");
  1415. messageSends: ["ifNotNil:", "at:ifAbsent:"]
  1416. }),
  1417. $globals.String);
  1418. });