Trapped-Backend.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  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('TrappedDispatcher', smalltalk.Object, [], 'Trapped-Backend');
  170. smalltalk.TrappedDispatcher.comment="I am base class for change event dispatchers.\x0aI manage changed path - action block subscriptions.\x0aThese subscription must be three-element arrays\x0a\x09{ dirty. path. block }\x0a\x0aMy subclasses need to provide implementation for:\x0a\x09add:\x0a do:\x0a clean\x0a (optionally) run\x0a"
  171. smalltalk.addMethod(
  172. "_changed_",
  173. smalltalk.method({
  174. selector: "changed:",
  175. category: 'action',
  176. fn: function (path){
  177. var self=this;
  178. var $1;
  179. var needsToRun;
  180. needsToRun=false;
  181. smalltalk.send(self,"_do_",[(function(each){
  182. $1=smalltalk.send(each,"_accepts_",[path]);
  183. if(smalltalk.assert($1)){
  184. smalltalk.send(each,"_flag",[]);
  185. needsToRun=true;
  186. return needsToRun;
  187. };
  188. })]);
  189. smalltalk.send(self,"_dirty_",[needsToRun]);
  190. return self},
  191. args: ["path"],
  192. source: "changed: path\x0a\x09| needsToRun |\x0a needsToRun := false.\x0a\x09self do: [ :each |\x0a\x09\x09(each accepts: path) ifTrue: [\x0a\x09\x09\x09each flag.\x0a needsToRun := true.\x0a\x09\x09]\x0a\x09].\x0a\x09self dirty: needsToRun",
  193. messageSends: ["do:", "ifTrue:", "flag", "accepts:", "dirty:"],
  194. referencedClasses: []
  195. }),
  196. smalltalk.TrappedDispatcher);
  197. smalltalk.addMethod(
  198. "_dirty_",
  199. smalltalk.method({
  200. selector: "dirty:",
  201. category: 'action',
  202. fn: function (aBoolean){
  203. var self=this;
  204. if(smalltalk.assert(aBoolean)){
  205. smalltalk.send((function(){
  206. return smalltalk.send(self,"_run",[]);
  207. }),"_fork",[]);
  208. };
  209. return self},
  210. args: ["aBoolean"],
  211. source: "dirty: aBoolean\x0a\x09aBoolean ifTrue: [[ self run ] fork]",
  212. messageSends: ["ifTrue:", "fork", "run"],
  213. referencedClasses: []
  214. }),
  215. smalltalk.TrappedDispatcher);
  216. smalltalk.addMethod(
  217. "_on_hook_",
  218. smalltalk.method({
  219. selector: "on:hook:",
  220. category: 'action',
  221. fn: function (path,aBlock){
  222. var self=this;
  223. smalltalk.send(self,"_add_",[smalltalk.send(smalltalk.send((smalltalk.TrappedSubscription || TrappedSubscription),"_path_action_",[path,aBlock]),"_flag",[])]);
  224. smalltalk.send(self,"_dirty_",[true]);
  225. return self},
  226. args: ["path", "aBlock"],
  227. source: "on: path hook: aBlock\x0a\x09self add: (TrappedSubscription path: path action: aBlock) flag.\x0a \x09self dirty: true",
  228. messageSends: ["add:", "flag", "path:action:", "dirty:"],
  229. referencedClasses: ["TrappedSubscription"]
  230. }),
  231. smalltalk.TrappedDispatcher);
  232. smalltalk.addMethod(
  233. "_run",
  234. smalltalk.method({
  235. selector: "run",
  236. category: 'action',
  237. fn: function (){
  238. var self=this;
  239. var $1,$2;
  240. var needsClean;
  241. needsClean=false;
  242. smalltalk.send(self,"_do_",[(function(each){
  243. $1=smalltalk.send(each,"_isFlagged",[]);
  244. if(smalltalk.assert($1)){
  245. smalltalk.send(each,"_run",[]);
  246. $2=smalltalk.send(each,"_isEnabled",[]);
  247. if(! smalltalk.assert($2)){
  248. needsClean=true;
  249. return needsClean;
  250. };
  251. };
  252. })]);
  253. if(smalltalk.assert(needsClean)){
  254. smalltalk.send(self,"_clean",[]);
  255. };
  256. return self},
  257. args: [],
  258. 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 ]",
  259. messageSends: ["do:", "ifTrue:", "run", "ifFalse:", "isEnabled", "isFlagged", "clean"],
  260. referencedClasses: []
  261. }),
  262. smalltalk.TrappedDispatcher);
  263. smalltalk.addClass('TrappedSubscription', smalltalk.Object, ['path', 'actionBlock', 'flagged'], 'Trapped-Backend');
  264. smalltalk.addMethod(
  265. "_accepts_",
  266. smalltalk.method({
  267. selector: "accepts:",
  268. category: 'testing',
  269. fn: function (aPath){
  270. var self=this;
  271. var $1;
  272. $1=smalltalk.send(smalltalk.send(smalltalk.send(aPath,"_size",[]),"__lt_eq",[smalltalk.send(self["@path"],"_size",[])]),"_and_",[(function(){
  273. return smalltalk.send(aPath,"__eq",[smalltalk.send(self["@path"],"_copyFrom_to_",[(1),smalltalk.send(aPath,"_size",[])])]);
  274. })]);
  275. return $1;
  276. },
  277. args: ["aPath"],
  278. source: "accepts: aPath\x0a ^aPath size <= path size and: [aPath = (path copyFrom: 1 to: aPath size)]",
  279. messageSends: ["and:", "=", "copyFrom:to:", "size", "<="],
  280. referencedClasses: []
  281. }),
  282. smalltalk.TrappedSubscription);
  283. smalltalk.addMethod(
  284. "_flag",
  285. smalltalk.method({
  286. selector: "flag",
  287. category: 'accessing',
  288. fn: function (){
  289. var self=this;
  290. self["@flagged"]=true;
  291. return self},
  292. args: [],
  293. source: "flag\x0a\x09flagged := true",
  294. messageSends: [],
  295. referencedClasses: []
  296. }),
  297. smalltalk.TrappedSubscription);
  298. smalltalk.addMethod(
  299. "_initialize",
  300. smalltalk.method({
  301. selector: "initialize",
  302. category: 'initialization',
  303. fn: function (){
  304. var self=this;
  305. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  306. self["@path"]=nil;
  307. self["@actionBlock"]=nil;
  308. self["@flagged"]=false;
  309. return self},
  310. args: [],
  311. source: "initialize\x0a\x09super initialize.\x0a path := nil.\x0a actionBlock := nil.\x0a flagged := false.",
  312. messageSends: ["initialize"],
  313. referencedClasses: []
  314. }),
  315. smalltalk.TrappedSubscription);
  316. smalltalk.addMethod(
  317. "_isEnabled",
  318. smalltalk.method({
  319. selector: "isEnabled",
  320. category: 'testing',
  321. fn: function (){
  322. var self=this;
  323. var $1;
  324. $1=smalltalk.send(self["@actionBlock"],"_notNil",[]);
  325. return $1;
  326. },
  327. args: [],
  328. source: "isEnabled\x0a\x09^actionBlock notNil",
  329. messageSends: ["notNil"],
  330. referencedClasses: []
  331. }),
  332. smalltalk.TrappedSubscription);
  333. smalltalk.addMethod(
  334. "_isFlagged",
  335. smalltalk.method({
  336. selector: "isFlagged",
  337. category: 'testing',
  338. fn: function (){
  339. var self=this;
  340. return self["@flagged"];
  341. },
  342. args: [],
  343. source: "isFlagged\x0a\x09^flagged",
  344. messageSends: [],
  345. referencedClasses: []
  346. }),
  347. smalltalk.TrappedSubscription);
  348. smalltalk.addMethod(
  349. "_path_actionBlock_",
  350. smalltalk.method({
  351. selector: "path:actionBlock:",
  352. category: 'accessing',
  353. fn: function (anArray,aBlock){
  354. var self=this;
  355. self["@path"]=anArray;
  356. self["@actionBlock"]=aBlock;
  357. return self},
  358. args: ["anArray", "aBlock"],
  359. source: "path: anArray actionBlock: aBlock\x0a\x09path := anArray.\x0a actionBlock := aBlock",
  360. messageSends: [],
  361. referencedClasses: []
  362. }),
  363. smalltalk.TrappedSubscription);
  364. smalltalk.addMethod(
  365. "_run",
  366. smalltalk.method({
  367. selector: "run",
  368. category: 'action',
  369. fn: function (){
  370. var self=this;
  371. smalltalk.send((function(){
  372. return smalltalk.send((function(){
  373. return smalltalk.send(self["@actionBlock"],"_value",[]);
  374. }),"_ensure_",[(function(){
  375. self["@flagged"]=false;
  376. return self["@flagged"];
  377. })]);
  378. }),"_on_do_",[(smalltalk.TrappedUnwatch || TrappedUnwatch),(function(){
  379. self["@actionBlock"]=nil;
  380. return self["@actionBlock"];
  381. })]);
  382. return self},
  383. args: [],
  384. source: "run\x0a\x09[[ actionBlock value ] ensure: [ flagged := false ]]\x0a on: TrappedUnwatch do: [ actionBlock := nil ]",
  385. messageSends: ["on:do:", "ensure:", "value"],
  386. referencedClasses: ["TrappedUnwatch"]
  387. }),
  388. smalltalk.TrappedSubscription);
  389. smalltalk.addMethod(
  390. "_new",
  391. smalltalk.method({
  392. selector: "new",
  393. category: 'instance creation',
  394. fn: function (){
  395. var self=this;
  396. smalltalk.send(self,"_shouldNotImplement",[]);
  397. return self},
  398. args: [],
  399. source: "new\x0a\x09self shouldNotImplement",
  400. messageSends: ["shouldNotImplement"],
  401. referencedClasses: []
  402. }),
  403. smalltalk.TrappedSubscription.klass);
  404. smalltalk.addMethod(
  405. "_path_action_",
  406. smalltalk.method({
  407. selector: "path:action:",
  408. category: 'instance creation',
  409. fn: function (anArray,aBlock){
  410. var self=this;
  411. var $1;
  412. $1=smalltalk.send(smalltalk.send(self,"_new",[],smalltalk.Object.klass),"_path_actionBlock_",[anArray,aBlock]);
  413. return $1;
  414. },
  415. args: ["anArray", "aBlock"],
  416. source: "path: anArray action: aBlock\x0a\x09^super new path: anArray actionBlock: aBlock",
  417. messageSends: ["path:actionBlock:", "new"],
  418. referencedClasses: []
  419. }),
  420. smalltalk.TrappedSubscription.klass);
  421. smalltalk.addClass('TrappedUnwatch', smalltalk.Error, [], 'Trapped-Backend');
  422. smalltalk.TrappedUnwatch.comment="SIgnal me from the watch: block to unwatch it."
  423. smalltalk.addMethod(
  424. "_reverseTrapAt_",
  425. smalltalk.method({
  426. selector: "reverseTrapAt:",
  427. category: '*Trapped-Backend',
  428. fn: function (anObject){
  429. var self=this;
  430. return nil;
  431. },
  432. args: ["anObject"],
  433. source: "reverseTrapAt: anObject\x0a\x09^nil",
  434. messageSends: [],
  435. referencedClasses: []
  436. }),
  437. smalltalk.Object);
  438. smalltalk.addMethod(
  439. "_reverseTrapAt_put_",
  440. smalltalk.method({
  441. selector: "reverseTrapAt:put:",
  442. category: '*Trapped-Backend',
  443. fn: function (anObject,value){
  444. var self=this;
  445. smalltalk.send(self,"_error_",[smalltalk.send(smalltalk.send("Trapped cannot put at ","__comma",[smalltalk.send(smalltalk.send(self,"_class",[]),"_name",[])]),"__comma",[" type key."])]);
  446. return self},
  447. args: ["anObject", "value"],
  448. source: "reverseTrapAt: anObject put: value\x0a\x09self error: 'Trapped cannot put at ', self class name, ' type key.'",
  449. messageSends: ["error:", ",", "name", "class"],
  450. referencedClasses: []
  451. }),
  452. smalltalk.Object);
  453. smalltalk.addMethod(
  454. "_asEavModel",
  455. smalltalk.method({
  456. selector: "asEavModel",
  457. category: '*Trapped-Backend',
  458. fn: function (){
  459. var self=this;
  460. var $1;
  461. var model;
  462. model=smalltalk.send((smalltalk.EavModel || EavModel),"_new",[]);
  463. smalltalk.send(model,"_getBlock_",[(function(anObject){
  464. return smalltalk.send(self,"_inject_into_",[anObject,(function(soFar,segment){
  465. if(($receiver = soFar) == nil || $receiver == undefined){
  466. return soFar;
  467. } else {
  468. return smalltalk.send(segment,"_reverseTrapAt_",[soFar]);
  469. };
  470. })]);
  471. })]);
  472. $1=smalltalk.send(self,"_isEmpty",[]);
  473. if(! smalltalk.assert($1)){
  474. smalltalk.send(model,"_putBlock_",[(function(anObject,value){
  475. var penultimate;
  476. penultimate=smalltalk.send(smalltalk.send(self,"_allButLast",[]),"_inject_into_",[anObject,(function(soFar,segment){
  477. if(($receiver = soFar) == nil || $receiver == undefined){
  478. return soFar;
  479. } else {
  480. return smalltalk.send(segment,"_reverseTrapAt_",[soFar]);
  481. };
  482. })]);
  483. penultimate;
  484. return smalltalk.send(smalltalk.send(self,"_last",[]),"_reverseTrapAt_put_",[penultimate,value]);
  485. })]);
  486. };
  487. return model;
  488. },
  489. args: [],
  490. 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",
  491. messageSends: ["new", "getBlock:", "inject:into:", "ifNotNil:", "reverseTrapAt:", "ifFalse:", "putBlock:", "allButLast", "reverseTrapAt:put:", "last", "isEmpty"],
  492. referencedClasses: ["EavModel"]
  493. }),
  494. smalltalk.SequenceableCollection);
  495. smalltalk.addMethod(
  496. "_reverseTrapAt_",
  497. smalltalk.method({
  498. selector: "reverseTrapAt:",
  499. category: '*Trapped-Backend',
  500. fn: function (anObject){
  501. var self=this;
  502. var $1;
  503. $1=smalltalk.send(anObject,"_at_ifAbsent_",[self,(function(){
  504. return nil;
  505. })]);
  506. return $1;
  507. },
  508. args: ["anObject"],
  509. source: "reverseTrapAt: anObject\x0a\x09^anObject at: self ifAbsent: [nil]",
  510. messageSends: ["at:ifAbsent:"],
  511. referencedClasses: []
  512. }),
  513. smalltalk.String);
  514. smalltalk.addMethod(
  515. "_reverseTrapAt_put_",
  516. smalltalk.method({
  517. selector: "reverseTrapAt:put:",
  518. category: '*Trapped-Backend',
  519. fn: function (anObject,value){
  520. var self=this;
  521. var $1;
  522. $1=smalltalk.send(anObject,"_at_put_",[self,value]);
  523. return $1;
  524. },
  525. args: ["anObject", "value"],
  526. source: "reverseTrapAt: anObject put: value\x0a\x09^anObject at: self put: value",
  527. messageSends: ["at:put:"],
  528. referencedClasses: []
  529. }),
  530. smalltalk.String);
  531. smalltalk.addMethod(
  532. "_reverseTrapAt_",
  533. smalltalk.method({
  534. selector: "reverseTrapAt:",
  535. category: '*Trapped-Backend',
  536. fn: function (anObject){
  537. var self=this;
  538. var $1;
  539. var $early={};
  540. try {
  541. $1=smalltalk.send((function(){
  542. return smalltalk.send(anObject,"_perform_",[self]);
  543. }),"_on_do_",[(smalltalk.MessageNotUnderstood || MessageNotUnderstood),(function(){
  544. throw $early=[nil];
  545. })]);
  546. return $1;
  547. }
  548. catch(e) {if(e===$early)return e[0]; throw e}
  549. },
  550. args: ["anObject"],
  551. source: "reverseTrapAt: anObject\x0a\x09^[anObject perform: self] on: MessageNotUnderstood do: [^nil]",
  552. messageSends: ["on:do:", "perform:"],
  553. referencedClasses: ["MessageNotUnderstood"]
  554. }),
  555. smalltalk.Symbol);
  556. smalltalk.addMethod(
  557. "_reverseTrapAt_put_",
  558. smalltalk.method({
  559. selector: "reverseTrapAt:put:",
  560. category: '*Trapped-Backend',
  561. fn: function (anObject,value){
  562. var self=this;
  563. var $1;
  564. $1=smalltalk.send(anObject,"_perform_withArguments_",[smalltalk.send(smalltalk.send(self,"__comma",[":"]),"_asSymbol",[]),[value]]);
  565. return $1;
  566. },
  567. args: ["anObject", "value"],
  568. source: "reverseTrapAt: anObject put: value\x0a ^anObject perform: (self, ':') asSymbol withArguments: { value }",
  569. messageSends: ["perform:withArguments:", "asSymbol", ","],
  570. referencedClasses: []
  571. }),
  572. smalltalk.Symbol);
  573. smalltalk.addMethod(
  574. "_reverseTrapAt_",
  575. smalltalk.method({
  576. selector: "reverseTrapAt:",
  577. category: '*Trapped-Backend',
  578. fn: function (anObject){
  579. var self=this;
  580. var $1;
  581. $1=smalltalk.send(anObject,"_at_ifAbsent_",[self,(function(){
  582. return nil;
  583. })]);
  584. return $1;
  585. },
  586. args: ["anObject"],
  587. source: "reverseTrapAt: anObject\x0a\x09^anObject at: self ifAbsent: [nil]",
  588. messageSends: ["at:ifAbsent:"],
  589. referencedClasses: []
  590. }),
  591. smalltalk.Number);
  592. smalltalk.addMethod(
  593. "_reverseTrapAt_put_",
  594. smalltalk.method({
  595. selector: "reverseTrapAt:put:",
  596. category: '*Trapped-Backend',
  597. fn: function (anObject,value){
  598. var self=this;
  599. var $1;
  600. $1=smalltalk.send(anObject,"_at_put_",[self,value]);
  601. return $1;
  602. },
  603. args: ["anObject", "value"],
  604. source: "reverseTrapAt: anObject put: value\x0a\x09^anObject at: self put: value",
  605. messageSends: ["at:put:"],
  606. referencedClasses: []
  607. }),
  608. smalltalk.Number);