Trapped-Backend.deploy.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. smalltalk.addPackage('Trapped-Backend', {});
  2. smalltalk.addClass('EavModel', smalltalk.Object, ['getBlock', 'putBlock'], 'Trapped-Backend');
  3. smalltalk.addMethod(
  4. "_getBlock_",
  5. smalltalk.method({
  6. selector: "getBlock:",
  7. fn: function (aBlock){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { self["@getBlock"]=aBlock;
  10. return self}, function($ctx1) {$ctx1.fill(self,"getBlock:",{aBlock:aBlock}, smalltalk.EavModel)})}
  11. }),
  12. smalltalk.EavModel);
  13. smalltalk.addMethod(
  14. "_initialize",
  15. smalltalk.method({
  16. selector: "initialize",
  17. fn: function (){
  18. var self=this;
  19. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  20. self["@getBlock"]=(function(){
  21. return smalltalk.withContext(function($ctx2) { return _st(self)._error_("No getter block.");
  22. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  23. self["@putBlock"]=(function(){
  24. return smalltalk.withContext(function($ctx2) { return _st(self)._error_("No putter block.");
  25. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  26. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.EavModel)})}
  27. }),
  28. smalltalk.EavModel);
  29. smalltalk.addMethod(
  30. "_on_",
  31. smalltalk.method({
  32. selector: "on:",
  33. fn: function (anObject){
  34. var self=this;
  35. return smalltalk.withContext(function($ctx1) { var $1;
  36. $1=_st(self["@getBlock"])._value_(anObject);
  37. return $1;
  38. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject}, smalltalk.EavModel)})}
  39. }),
  40. smalltalk.EavModel);
  41. smalltalk.addMethod(
  42. "_on_put_",
  43. smalltalk.method({
  44. selector: "on:put:",
  45. fn: function (anObject,anObject2){
  46. var self=this;
  47. return smalltalk.withContext(function($ctx1) { var $1;
  48. $1=_st(self["@putBlock"])._value_value_(anObject,anObject2);
  49. return $1;
  50. }, function($ctx1) {$ctx1.fill(self,"on:put:",{anObject:anObject,anObject2:anObject2}, smalltalk.EavModel)})}
  51. }),
  52. smalltalk.EavModel);
  53. smalltalk.addMethod(
  54. "_putBlock_",
  55. smalltalk.method({
  56. selector: "putBlock:",
  57. fn: function (aBlock){
  58. var self=this;
  59. return smalltalk.withContext(function($ctx1) { self["@putBlock"]=aBlock;
  60. return self}, function($ctx1) {$ctx1.fill(self,"putBlock:",{aBlock:aBlock}, smalltalk.EavModel)})}
  61. }),
  62. smalltalk.EavModel);
  63. smalltalk.addClass('Isolator', smalltalk.Object, ['root'], 'Trapped-Backend');
  64. smalltalk.addMethod(
  65. "_model_modify_",
  66. smalltalk.method({
  67. selector: "model:modify:",
  68. fn: function (anEavModel,aBlock){
  69. var self=this;
  70. var newValue;
  71. return smalltalk.withContext(function($ctx1) { newValue=_st(aBlock)._value_(_st(anEavModel)._on_(self));
  72. _st(anEavModel)._on_put_(self,_st(newValue)._deepCopy());
  73. return self}, function($ctx1) {$ctx1.fill(self,"model:modify:",{anEavModel:anEavModel,aBlock:aBlock,newValue:newValue}, smalltalk.Isolator)})}
  74. }),
  75. smalltalk.Isolator);
  76. smalltalk.addMethod(
  77. "_model_read_",
  78. smalltalk.method({
  79. selector: "model:read:",
  80. fn: function (anEavModel,aBlock){
  81. var self=this;
  82. return smalltalk.withContext(function($ctx1) { _st(aBlock)._value_(_st(_st(anEavModel)._on_(self))._deepCopy());
  83. return self}, function($ctx1) {$ctx1.fill(self,"model:read:",{anEavModel:anEavModel,aBlock:aBlock}, smalltalk.Isolator)})}
  84. }),
  85. smalltalk.Isolator);
  86. smalltalk.addMethod(
  87. "_root",
  88. smalltalk.method({
  89. selector: "root",
  90. fn: function (){
  91. var self=this;
  92. return smalltalk.withContext(function($ctx1) { var $1;
  93. $1=self["@root"];
  94. return $1;
  95. }, function($ctx1) {$ctx1.fill(self,"root",{}, smalltalk.Isolator)})}
  96. }),
  97. smalltalk.Isolator);
  98. smalltalk.addMethod(
  99. "_root_",
  100. smalltalk.method({
  101. selector: "root:",
  102. fn: function (anObject){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) { self["@root"]=anObject;
  105. return self}, function($ctx1) {$ctx1.fill(self,"root:",{anObject:anObject}, smalltalk.Isolator)})}
  106. }),
  107. smalltalk.Isolator);
  108. smalltalk.addMethod(
  109. "_on_",
  110. smalltalk.method({
  111. selector: "on:",
  112. fn: function (anObject){
  113. var self=this;
  114. return smalltalk.withContext(function($ctx1) { var $1;
  115. $1=_st(_st(self)._new())._root_(anObject);
  116. return $1;
  117. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject}, smalltalk.Isolator.klass)})}
  118. }),
  119. smalltalk.Isolator.klass);
  120. smalltalk.addClass('KeyedPubSubBase', smalltalk.Object, ['factory'], 'Trapped-Backend');
  121. smalltalk.addMethod(
  122. "_changed_",
  123. smalltalk.method({
  124. selector: "changed:",
  125. fn: function (key){
  126. var self=this;
  127. var needsToRun;
  128. return smalltalk.withContext(function($ctx1) { var $1,$3,$2;
  129. needsToRun=false;
  130. $1=self;
  131. $2=(function(each){
  132. return smalltalk.withContext(function($ctx2) { $3=_st(each)._accepts_(key);
  133. if(smalltalk.assert($3)){
  134. _st(each)._flag();
  135. needsToRun=true;
  136. return needsToRun;
  137. };
  138. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  139. _st($1)._do_($2);
  140. _st(self)._dirty_(needsToRun);
  141. return self}, function($ctx1) {$ctx1.fill(self,"changed:",{key:key,needsToRun:needsToRun}, smalltalk.KeyedPubSubBase)})}
  142. }),
  143. smalltalk.KeyedPubSubBase);
  144. smalltalk.addMethod(
  145. "_dirty_",
  146. smalltalk.method({
  147. selector: "dirty:",
  148. fn: function (aBoolean){
  149. var self=this;
  150. return smalltalk.withContext(function($ctx1) { var $1;
  151. $1=aBoolean;
  152. if(smalltalk.assert($1)){
  153. _st((function(){
  154. return smalltalk.withContext(function($ctx2) { return _st(self)._run();
  155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._fork();
  156. };
  157. return self}, function($ctx1) {$ctx1.fill(self,"dirty:",{aBoolean:aBoolean}, smalltalk.KeyedPubSubBase)})}
  158. }),
  159. smalltalk.KeyedPubSubBase);
  160. smalltalk.addMethod(
  161. "_on_hook_",
  162. smalltalk.method({
  163. selector: "on:hook:",
  164. fn: function (key,aBlock){
  165. var self=this;
  166. return smalltalk.withContext(function($ctx1) { _st(self)._add_(_st(_st(self["@factory"])._value_value_(key,aBlock))._flag());
  167. _st(self)._dirty_(true);
  168. return self}, function($ctx1) {$ctx1.fill(self,"on:hook:",{key:key,aBlock:aBlock}, smalltalk.KeyedPubSubBase)})}
  169. }),
  170. smalltalk.KeyedPubSubBase);
  171. smalltalk.addMethod(
  172. "_run",
  173. smalltalk.method({
  174. selector: "run",
  175. fn: function (){
  176. var self=this;
  177. var needsClean;
  178. return smalltalk.withContext(function($ctx1) { var $1,$3,$5,$4,$2,$6;
  179. needsClean=false;
  180. $1=self;
  181. $2=(function(each){
  182. return smalltalk.withContext(function($ctx2) { $3=_st(each)._isFlagged();
  183. $4=(function(){
  184. return smalltalk.withContext(function($ctx3) { _st(each)._run();
  185. $5=_st(each)._isEnabled();
  186. if(! smalltalk.assert($5)){
  187. needsClean=true;
  188. return needsClean;
  189. };
  190. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  191. return _st($3)._ifTrue_($4);
  192. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  193. _st($1)._do_($2);
  194. $6=needsClean;
  195. if(smalltalk.assert($6)){
  196. _st(self)._clean();
  197. };
  198. return self}, function($ctx1) {$ctx1.fill(self,"run",{needsClean:needsClean}, smalltalk.KeyedPubSubBase)})}
  199. }),
  200. smalltalk.KeyedPubSubBase);
  201. smalltalk.addMethod(
  202. "_subscriptionFactory_",
  203. smalltalk.method({
  204. selector: "subscriptionFactory:",
  205. fn: function (aBlock){
  206. var self=this;
  207. return smalltalk.withContext(function($ctx1) { self["@factory"]=aBlock;
  208. return self}, function($ctx1) {$ctx1.fill(self,"subscriptionFactory:",{aBlock:aBlock}, smalltalk.KeyedPubSubBase)})}
  209. }),
  210. smalltalk.KeyedPubSubBase);
  211. smalltalk.addClass('SimpleKeyedPubSub', smalltalk.KeyedPubSubBase, ['queue'], 'Trapped-Backend');
  212. smalltalk.addMethod(
  213. "_add_",
  214. smalltalk.method({
  215. selector: "add:",
  216. fn: function (aSubscription){
  217. var self=this;
  218. return smalltalk.withContext(function($ctx1) { _st(self["@queue"])._add_(aSubscription);
  219. return self}, function($ctx1) {$ctx1.fill(self,"add:",{aSubscription:aSubscription}, smalltalk.SimpleKeyedPubSub)})}
  220. }),
  221. smalltalk.SimpleKeyedPubSub);
  222. smalltalk.addMethod(
  223. "_clean",
  224. smalltalk.method({
  225. selector: "clean",
  226. fn: function (){
  227. var self=this;
  228. return smalltalk.withContext(function($ctx1) { self["@queue"]=_st(self["@queue"])._select_((function(each){
  229. return smalltalk.withContext(function($ctx2) { return _st(each)._isEnabled();
  230. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  231. return self}, function($ctx1) {$ctx1.fill(self,"clean",{}, smalltalk.SimpleKeyedPubSub)})}
  232. }),
  233. smalltalk.SimpleKeyedPubSub);
  234. smalltalk.addMethod(
  235. "_do_",
  236. smalltalk.method({
  237. selector: "do:",
  238. fn: function (aBlock){
  239. var self=this;
  240. return smalltalk.withContext(function($ctx1) { _st(self["@queue"])._do_(aBlock);
  241. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.SimpleKeyedPubSub)})}
  242. }),
  243. smalltalk.SimpleKeyedPubSub);
  244. smalltalk.addMethod(
  245. "_initialize",
  246. smalltalk.method({
  247. selector: "initialize",
  248. fn: function (){
  249. var self=this;
  250. return smalltalk.withContext(function($ctx1) { smalltalk.KeyedPubSubBase.fn.prototype._initialize.apply(_st(self), []);
  251. self["@queue"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  252. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.SimpleKeyedPubSub)})}
  253. }),
  254. smalltalk.SimpleKeyedPubSub);
  255. smalltalk.addClass('KeyedPubSubUnsubscribe', smalltalk.Error, [], 'Trapped-Backend');
  256. smalltalk.addClass('KeyedSubscriptionBase', smalltalk.Object, ['key', 'actionBlock', 'flagged'], 'Trapped-Backend');
  257. smalltalk.addMethod(
  258. "_accepts_",
  259. smalltalk.method({
  260. selector: "accepts:",
  261. fn: function (aKey){
  262. var self=this;
  263. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  264. return self}, function($ctx1) {$ctx1.fill(self,"accepts:",{aKey:aKey}, smalltalk.KeyedSubscriptionBase)})}
  265. }),
  266. smalltalk.KeyedSubscriptionBase);
  267. smalltalk.addMethod(
  268. "_flag",
  269. smalltalk.method({
  270. selector: "flag",
  271. fn: function (){
  272. var self=this;
  273. return smalltalk.withContext(function($ctx1) { self["@flagged"]=true;
  274. return self}, function($ctx1) {$ctx1.fill(self,"flag",{}, smalltalk.KeyedSubscriptionBase)})}
  275. }),
  276. smalltalk.KeyedSubscriptionBase);
  277. smalltalk.addMethod(
  278. "_initialize",
  279. smalltalk.method({
  280. selector: "initialize",
  281. fn: function (){
  282. var self=this;
  283. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  284. self["@key"]=nil;
  285. self["@actionBlock"]=nil;
  286. self["@flagged"]=false;
  287. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.KeyedSubscriptionBase)})}
  288. }),
  289. smalltalk.KeyedSubscriptionBase);
  290. smalltalk.addMethod(
  291. "_isEnabled",
  292. smalltalk.method({
  293. selector: "isEnabled",
  294. fn: function (){
  295. var self=this;
  296. return smalltalk.withContext(function($ctx1) { var $1;
  297. $1=_st(self["@actionBlock"])._notNil();
  298. return $1;
  299. }, function($ctx1) {$ctx1.fill(self,"isEnabled",{}, smalltalk.KeyedSubscriptionBase)})}
  300. }),
  301. smalltalk.KeyedSubscriptionBase);
  302. smalltalk.addMethod(
  303. "_isFlagged",
  304. smalltalk.method({
  305. selector: "isFlagged",
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) { var $1;
  309. $1=self["@flagged"];
  310. return $1;
  311. }, function($ctx1) {$ctx1.fill(self,"isFlagged",{}, smalltalk.KeyedSubscriptionBase)})}
  312. }),
  313. smalltalk.KeyedSubscriptionBase);
  314. smalltalk.addMethod(
  315. "_key_block_",
  316. smalltalk.method({
  317. selector: "key:block:",
  318. fn: function (anObject,aBlock){
  319. var self=this;
  320. return smalltalk.withContext(function($ctx1) { self["@key"]=anObject;
  321. self["@actionBlock"]=aBlock;
  322. return self}, function($ctx1) {$ctx1.fill(self,"key:block:",{anObject:anObject,aBlock:aBlock}, smalltalk.KeyedSubscriptionBase)})}
  323. }),
  324. smalltalk.KeyedSubscriptionBase);
  325. smalltalk.addMethod(
  326. "_run",
  327. smalltalk.method({
  328. selector: "run",
  329. fn: function (){
  330. var self=this;
  331. return smalltalk.withContext(function($ctx1) { _st((function(){
  332. return smalltalk.withContext(function($ctx2) { return _st((function(){
  333. return smalltalk.withContext(function($ctx3) { return _st(self["@actionBlock"])._value();
  334. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  335. return smalltalk.withContext(function($ctx3) { self["@flagged"]=false;
  336. return self["@flagged"];
  337. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.KeyedPubSubUnsubscribe || KeyedPubSubUnsubscribe),(function(){
  339. return smalltalk.withContext(function($ctx2) { self["@actionBlock"]=nil;
  340. return self["@actionBlock"];
  341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  342. return self}, function($ctx1) {$ctx1.fill(self,"run",{}, smalltalk.KeyedSubscriptionBase)})}
  343. }),
  344. smalltalk.KeyedSubscriptionBase);
  345. smalltalk.addClass('ListKeyedSubscription', smalltalk.KeyedSubscriptionBase, [], 'Trapped-Backend');
  346. smalltalk.addMethod(
  347. "_accepts_",
  348. smalltalk.method({
  349. selector: "accepts:",
  350. fn: function (aKey){
  351. var self=this;
  352. return smalltalk.withContext(function($ctx1) { var $1;
  353. $1=_st(_st(_st(aKey)._size()).__lt_eq(_st(self["@key"])._size()))._and_((function(){
  354. return smalltalk.withContext(function($ctx2) { return _st(aKey).__eq(_st(self["@key"])._copyFrom_to_((1),_st(aKey)._size()));
  355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  356. return $1;
  357. }, function($ctx1) {$ctx1.fill(self,"accepts:",{aKey:aKey}, smalltalk.ListKeyedSubscription)})}
  358. }),
  359. smalltalk.ListKeyedSubscription);
  360. smalltalk.addClass('ListKeyedEntity', smalltalk.Object, ['dispatcher', 'payload'], 'Trapped-Backend');
  361. smalltalk.addMethod(
  362. "_dispatcher",
  363. smalltalk.method({
  364. selector: "dispatcher",
  365. fn: function (){
  366. var self=this;
  367. return smalltalk.withContext(function($ctx1) { var $1;
  368. $1=self["@dispatcher"];
  369. return $1;
  370. }, function($ctx1) {$ctx1.fill(self,"dispatcher",{}, smalltalk.ListKeyedEntity)})}
  371. }),
  372. smalltalk.ListKeyedEntity);
  373. smalltalk.addMethod(
  374. "_dispatcher_",
  375. smalltalk.method({
  376. selector: "dispatcher:",
  377. fn: function (aDispatcher){
  378. var self=this;
  379. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  380. $1=aDispatcher;
  381. _st($1)._subscriptionFactory_((function(key,block){
  382. return smalltalk.withContext(function($ctx2) { $2=_st((smalltalk.ListKeyedSubscription || ListKeyedSubscription))._new();
  383. _st($2)._key_block_(key,block);
  384. $3=_st($2)._yourself();
  385. return $3;
  386. }, function($ctx2) {$ctx2.fillBlock({key:key,block:block},$ctx1)})}));
  387. $4=_st($1)._yourself();
  388. self["@dispatcher"]=$4;
  389. return self}, function($ctx1) {$ctx1.fill(self,"dispatcher:",{aDispatcher:aDispatcher}, smalltalk.ListKeyedEntity)})}
  390. }),
  391. smalltalk.ListKeyedEntity);
  392. smalltalk.addMethod(
  393. "_model_",
  394. smalltalk.method({
  395. selector: "model:",
  396. fn: function (anObject){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) { self["@payload"]=anObject;
  399. _st(_st(self)._dispatcher())._changed_([]);
  400. return self}, function($ctx1) {$ctx1.fill(self,"model:",{anObject:anObject}, smalltalk.ListKeyedEntity)})}
  401. }),
  402. smalltalk.ListKeyedEntity);
  403. smalltalk.addMethod(
  404. "_watch_do_",
  405. smalltalk.method({
  406. selector: "watch:do:",
  407. fn: function (path,aBlock){
  408. var self=this;
  409. return smalltalk.withContext(function($ctx1) { _st(_st(self)._dispatcher())._on_hook_(path,(function(){
  410. return smalltalk.withContext(function($ctx2) { return _st(self)._read_do_(path,aBlock);
  411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  412. return self}, function($ctx1) {$ctx1.fill(self,"watch:do:",{path:path,aBlock:aBlock}, smalltalk.ListKeyedEntity)})}
  413. }),
  414. smalltalk.ListKeyedEntity);
  415. smalltalk.addClass('ListKeyedDirectEntity', smalltalk.ListKeyedEntity, [], 'Trapped-Backend');
  416. smalltalk.addMethod(
  417. "_modify_do_",
  418. smalltalk.method({
  419. selector: "modify:do:",
  420. fn: function (path,aBlock){
  421. var self=this;
  422. var newValue,eavModel;
  423. return smalltalk.withContext(function($ctx1) { eavModel=_st(path)._asEavModel();
  424. newValue=_st(aBlock)._value_(_st(eavModel)._on_(self["@payload"]));
  425. _st((function(){
  426. return smalltalk.withContext(function($ctx2) { return _st(eavModel)._on_put_(self["@payload"],newValue);
  427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  428. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._dispatcher())._changed_(path);
  429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  430. return self}, function($ctx1) {$ctx1.fill(self,"modify:do:",{path:path,aBlock:aBlock,newValue:newValue,eavModel:eavModel}, smalltalk.ListKeyedDirectEntity)})}
  431. }),
  432. smalltalk.ListKeyedDirectEntity);
  433. smalltalk.addMethod(
  434. "_read_do_",
  435. smalltalk.method({
  436. selector: "read:do:",
  437. fn: function (path,aBlock){
  438. var self=this;
  439. var eavModel;
  440. return smalltalk.withContext(function($ctx1) { eavModel=_st(path)._asEavModel();
  441. _st(aBlock)._value_(_st(eavModel)._on_(self["@payload"]));
  442. return self}, function($ctx1) {$ctx1.fill(self,"read:do:",{path:path,aBlock:aBlock,eavModel:eavModel}, smalltalk.ListKeyedDirectEntity)})}
  443. }),
  444. smalltalk.ListKeyedDirectEntity);
  445. smalltalk.addClass('ListKeyedIsolatedEntity', smalltalk.ListKeyedEntity, [], 'Trapped-Backend');
  446. smalltalk.addMethod(
  447. "_model_",
  448. smalltalk.method({
  449. selector: "model:",
  450. fn: function (anObject){
  451. var self=this;
  452. return smalltalk.withContext(function($ctx1) { smalltalk.ListKeyedEntity.fn.prototype._model_.apply(_st(self), [_st((smalltalk.Isolator || Isolator))._on_(anObject)]);
  453. return self}, function($ctx1) {$ctx1.fill(self,"model:",{anObject:anObject}, smalltalk.ListKeyedIsolatedEntity)})}
  454. }),
  455. smalltalk.ListKeyedIsolatedEntity);
  456. smalltalk.addMethod(
  457. "_modify_do_",
  458. smalltalk.method({
  459. selector: "modify:do:",
  460. fn: function (path,aBlock){
  461. var self=this;
  462. var eavModel;
  463. return smalltalk.withContext(function($ctx1) { eavModel=_st(_st([smalltalk.symbolFor("root")]).__comma(path))._asEavModel();
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) { return _st(self["@payload"])._model_modify_(eavModel,aBlock);
  466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  467. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._dispatcher())._changed_(path);
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  469. return self}, function($ctx1) {$ctx1.fill(self,"modify:do:",{path:path,aBlock:aBlock,eavModel:eavModel}, smalltalk.ListKeyedIsolatedEntity)})}
  470. }),
  471. smalltalk.ListKeyedIsolatedEntity);
  472. smalltalk.addMethod(
  473. "_read_do_",
  474. smalltalk.method({
  475. selector: "read:do:",
  476. fn: function (path,aBlock){
  477. var self=this;
  478. var eavModel;
  479. return smalltalk.withContext(function($ctx1) { eavModel=_st(_st([smalltalk.symbolFor("root")]).__comma(path))._asEavModel();
  480. _st(self["@payload"])._model_read_(eavModel,aBlock);
  481. return self}, function($ctx1) {$ctx1.fill(self,"read:do:",{path:path,aBlock:aBlock,eavModel:eavModel}, smalltalk.ListKeyedIsolatedEntity)})}
  482. }),
  483. smalltalk.ListKeyedIsolatedEntity);
  484. smalltalk.addMethod(
  485. "_reverseTrapAt_",
  486. smalltalk.method({
  487. selector: "reverseTrapAt:",
  488. fn: function (anObject){
  489. var self=this;
  490. return smalltalk.withContext(function($ctx1) { return nil;
  491. }, function($ctx1) {$ctx1.fill(self,"reverseTrapAt:",{anObject:anObject}, smalltalk.Object)})}
  492. }),
  493. smalltalk.Object);
  494. smalltalk.addMethod(
  495. "_reverseTrapAt_put_",
  496. smalltalk.method({
  497. selector: "reverseTrapAt:put:",
  498. fn: function (anObject,value){
  499. var self=this;
  500. return smalltalk.withContext(function($ctx1) { _st(self)._error_(_st(_st("Trapped cannot put at ").__comma(_st(_st(self)._class())._name())).__comma(" type key."));
  501. return self}, function($ctx1) {$ctx1.fill(self,"reverseTrapAt:put:",{anObject:anObject,value:value}, smalltalk.Object)})}
  502. }),
  503. smalltalk.Object);
  504. smalltalk.addMethod(
  505. "_asEavModel",
  506. smalltalk.method({
  507. selector: "asEavModel",
  508. fn: function (){
  509. var self=this;
  510. var model;
  511. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$6,$5,$2,$7,$9,$11,$12,$14,$13,$10,$8,$15;
  512. model=_st((smalltalk.EavModel || EavModel))._new();
  513. $1=model;
  514. $2=(function(anObject){
  515. return smalltalk.withContext(function($ctx2) { $3=self;
  516. $4=anObject;
  517. $5=(function(soFar,segment){
  518. return smalltalk.withContext(function($ctx3) { $6=soFar;
  519. if(($receiver = $6) == nil || $receiver == undefined){
  520. return $6;
  521. } else {
  522. return _st(segment)._reverseTrapAt_(soFar);
  523. };
  524. }, function($ctx3) {$ctx3.fillBlock({soFar:soFar,segment:segment},$ctx1)})});
  525. return _st($3)._inject_into_($4,$5);
  526. }, function($ctx2) {$ctx2.fillBlock({anObject:anObject},$ctx1)})});
  527. _st($1)._getBlock_($2);
  528. $7=_st(self)._isEmpty();
  529. $8=(function(){
  530. return smalltalk.withContext(function($ctx2) { $9=model;
  531. $10=(function(anObject,value){
  532. var penultimate;
  533. return smalltalk.withContext(function($ctx3) { $11=_st(self)._allButLast();
  534. $12=anObject;
  535. $13=(function(soFar,segment){
  536. return smalltalk.withContext(function($ctx4) { $14=soFar;
  537. if(($receiver = $14) == nil || $receiver == undefined){
  538. return $14;
  539. } else {
  540. return _st(segment)._reverseTrapAt_(soFar);
  541. };
  542. }, function($ctx4) {$ctx4.fillBlock({soFar:soFar,segment:segment},$ctx1)})});
  543. penultimate=_st($11)._inject_into_($12,$13);
  544. penultimate;
  545. return _st(_st(self)._last())._reverseTrapAt_put_(penultimate,value);
  546. }, function($ctx3) {$ctx3.fillBlock({anObject:anObject,value:value,penultimate:penultimate},$ctx1)})});
  547. return _st($9)._putBlock_($10);
  548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  549. _st($7)._ifFalse_($8);
  550. $15=model;
  551. return $15;
  552. }, function($ctx1) {$ctx1.fill(self,"asEavModel",{model:model}, smalltalk.SequenceableCollection)})}
  553. }),
  554. smalltalk.SequenceableCollection);
  555. smalltalk.addMethod(
  556. "_reverseTrapAt_",
  557. smalltalk.method({
  558. selector: "reverseTrapAt:",
  559. fn: function (anObject){
  560. var self=this;
  561. return smalltalk.withContext(function($ctx1) { var $1;
  562. $1=_st(anObject)._at_ifAbsent_(self,(function(){
  563. return smalltalk.withContext(function($ctx2) { return nil;
  564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  565. return $1;
  566. }, function($ctx1) {$ctx1.fill(self,"reverseTrapAt:",{anObject:anObject}, smalltalk.String)})}
  567. }),
  568. smalltalk.String);
  569. smalltalk.addMethod(
  570. "_reverseTrapAt_put_",
  571. smalltalk.method({
  572. selector: "reverseTrapAt:put:",
  573. fn: function (anObject,value){
  574. var self=this;
  575. return smalltalk.withContext(function($ctx1) { var $1;
  576. $1=_st(anObject)._at_put_(self,value);
  577. return $1;
  578. }, function($ctx1) {$ctx1.fill(self,"reverseTrapAt:put:",{anObject:anObject,value:value}, smalltalk.String)})}
  579. }),
  580. smalltalk.String);
  581. smalltalk.addMethod(
  582. "_reverseTrapAt_",
  583. smalltalk.method({
  584. selector: "reverseTrapAt:",
  585. fn: function (anObject){
  586. var self=this;
  587. return smalltalk.withContext(function($ctx1) { var $1;
  588. var $early={};
  589. try {
  590. $1=_st((function(){
  591. return smalltalk.withContext(function($ctx2) { return _st(anObject)._perform_(self);
  592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.MessageNotUnderstood || MessageNotUnderstood),(function(){
  593. return smalltalk.withContext(function($ctx2) { throw $early=[nil];
  594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  595. return $1;
  596. }
  597. catch(e) {if(e===$early)return e[0]; throw e}
  598. }, function($ctx1) {$ctx1.fill(self,"reverseTrapAt:",{anObject:anObject}, smalltalk.Symbol)})}
  599. }),
  600. smalltalk.Symbol);
  601. smalltalk.addMethod(
  602. "_reverseTrapAt_put_",
  603. smalltalk.method({
  604. selector: "reverseTrapAt:put:",
  605. fn: function (anObject,value){
  606. var self=this;
  607. return smalltalk.withContext(function($ctx1) { var $1;
  608. $1=_st(anObject)._perform_withArguments_(_st(_st(self).__comma(":"))._asSymbol(),[value]);
  609. return $1;
  610. }, function($ctx1) {$ctx1.fill(self,"reverseTrapAt:put:",{anObject:anObject,value:value}, smalltalk.Symbol)})}
  611. }),
  612. smalltalk.Symbol);
  613. smalltalk.addMethod(
  614. "_reverseTrapAt_",
  615. smalltalk.method({
  616. selector: "reverseTrapAt:",
  617. fn: function (anObject){
  618. var self=this;
  619. return smalltalk.withContext(function($ctx1) { var $1;
  620. $1=_st(anObject)._at_ifAbsent_(self,(function(){
  621. return smalltalk.withContext(function($ctx2) { return nil;
  622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  623. return $1;
  624. }, function($ctx1) {$ctx1.fill(self,"reverseTrapAt:",{anObject:anObject}, smalltalk.Number)})}
  625. }),
  626. smalltalk.Number);
  627. smalltalk.addMethod(
  628. "_reverseTrapAt_put_",
  629. smalltalk.method({
  630. selector: "reverseTrapAt:put:",
  631. fn: function (anObject,value){
  632. var self=this;
  633. return smalltalk.withContext(function($ctx1) { var $1;
  634. $1=_st(anObject)._at_put_(self,value);
  635. return $1;
  636. }, function($ctx1) {$ctx1.fill(self,"reverseTrapAt:put:",{anObject:anObject,value:value}, smalltalk.Number)})}
  637. }),
  638. smalltalk.Number);