Trapped-Backend.js 17 KB

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