Trapped-Backend.deploy.js 24 KB

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