Trapped-Backend.deploy.js 24 KB

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