Trapped-Backend.deploy.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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. self["@getBlock"]=aBlock;
  10. return self}
  11. }),
  12. smalltalk.EavModel);
  13. smalltalk.addMethod(
  14. "_initialize",
  15. smalltalk.method({
  16. selector: "initialize",
  17. fn: function (){
  18. var self=this;
  19. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  20. self["@getBlock"]=(function(){
  21. return smalltalk.send(self,"_error_",["No getter block."]);
  22. });
  23. self["@putBlock"]=(function(){
  24. return smalltalk.send(self,"_error_",["No putter block."]);
  25. });
  26. return self}
  27. }),
  28. smalltalk.EavModel);
  29. smalltalk.addMethod(
  30. "_on_",
  31. smalltalk.method({
  32. selector: "on:",
  33. fn: function (anObject){
  34. var self=this;
  35. var $1;
  36. $1=smalltalk.send(self["@getBlock"],"_value_",[anObject]);
  37. return $1;
  38. }
  39. }),
  40. smalltalk.EavModel);
  41. smalltalk.addMethod(
  42. "_on_put_",
  43. smalltalk.method({
  44. selector: "on:put:",
  45. fn: function (anObject,anObject2){
  46. var self=this;
  47. var $1;
  48. $1=smalltalk.send(self["@putBlock"],"_value_value_",[anObject,anObject2]);
  49. return $1;
  50. }
  51. }),
  52. smalltalk.EavModel);
  53. smalltalk.addMethod(
  54. "_putBlock_",
  55. smalltalk.method({
  56. selector: "putBlock:",
  57. fn: function (aBlock){
  58. var self=this;
  59. self["@putBlock"]=aBlock;
  60. return self}
  61. }),
  62. smalltalk.EavModel);
  63. smalltalk.addClass('Isolator', smalltalk.Object, ['root'], 'Trapped-Backend');
  64. smalltalk.addMethod(
  65. "_model_modify_",
  66. smalltalk.method({
  67. selector: "model:modify:",
  68. fn: function (anEavModel,aBlock){
  69. var self=this;
  70. var newValue;
  71. newValue=smalltalk.send(aBlock,"_value_",[smalltalk.send(anEavModel,"_on_",[self])]);
  72. smalltalk.send(anEavModel,"_on_put_",[self,smalltalk.send(newValue,"_deepCopy",[])]);
  73. return self}
  74. }),
  75. smalltalk.Isolator);
  76. smalltalk.addMethod(
  77. "_model_read_",
  78. smalltalk.method({
  79. selector: "model:read:",
  80. fn: function (anEavModel,aBlock){
  81. var self=this;
  82. smalltalk.send(aBlock,"_value_",[smalltalk.send(smalltalk.send(anEavModel,"_on_",[self]),"_deepCopy",[])]);
  83. return self}
  84. }),
  85. smalltalk.Isolator);
  86. smalltalk.addMethod(
  87. "_root",
  88. smalltalk.method({
  89. selector: "root",
  90. fn: function (){
  91. var self=this;
  92. return self["@root"];
  93. }
  94. }),
  95. smalltalk.Isolator);
  96. smalltalk.addMethod(
  97. "_root_",
  98. smalltalk.method({
  99. selector: "root:",
  100. fn: function (anObject){
  101. var self=this;
  102. self["@root"]=anObject;
  103. return self}
  104. }),
  105. smalltalk.Isolator);
  106. smalltalk.addMethod(
  107. "_on_",
  108. smalltalk.method({
  109. selector: "on:",
  110. fn: function (anObject){
  111. var self=this;
  112. var $1;
  113. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_root_",[anObject]);
  114. return $1;
  115. }
  116. }),
  117. smalltalk.Isolator.klass);
  118. smalltalk.addMethod(
  119. "_reverseTrapAt_",
  120. smalltalk.method({
  121. selector: "reverseTrapAt:",
  122. fn: function (anObject){
  123. var self=this;
  124. return nil;
  125. }
  126. }),
  127. smalltalk.Object);
  128. smalltalk.addMethod(
  129. "_reverseTrapAt_put_",
  130. smalltalk.method({
  131. selector: "reverseTrapAt:put:",
  132. fn: function (anObject,value){
  133. var self=this;
  134. smalltalk.send(self,"_error_",[smalltalk.send(smalltalk.send("Trapped cannot put at ","__comma",[smalltalk.send(smalltalk.send(self,"_class",[]),"_name",[])]),"__comma",[" type key."])]);
  135. return self}
  136. }),
  137. smalltalk.Object);
  138. smalltalk.addMethod(
  139. "_asEavModel",
  140. smalltalk.method({
  141. selector: "asEavModel",
  142. fn: function (){
  143. var self=this;
  144. var $1;
  145. var model;
  146. model=smalltalk.send((smalltalk.EavModel || EavModel),"_new",[]);
  147. smalltalk.send(model,"_getBlock_",[(function(anObject){
  148. return smalltalk.send(self,"_inject_into_",[anObject,(function(soFar,segment){
  149. if(($receiver = soFar) == nil || $receiver == undefined){
  150. return soFar;
  151. } else {
  152. return smalltalk.send(segment,"_reverseTrapAt_",[soFar]);
  153. };
  154. })]);
  155. })]);
  156. $1=smalltalk.send(self,"_isEmpty",[]);
  157. if(! smalltalk.assert($1)){
  158. smalltalk.send(model,"_putBlock_",[(function(anObject,value){
  159. var penultimate;
  160. penultimate=smalltalk.send(smalltalk.send(self,"_allButLast",[]),"_inject_into_",[anObject,(function(soFar,segment){
  161. if(($receiver = soFar) == nil || $receiver == undefined){
  162. return soFar;
  163. } else {
  164. return smalltalk.send(segment,"_reverseTrapAt_",[soFar]);
  165. };
  166. })]);
  167. penultimate;
  168. return smalltalk.send(smalltalk.send(self,"_last",[]),"_reverseTrapAt_put_",[penultimate,value]);
  169. })]);
  170. };
  171. return model;
  172. }
  173. }),
  174. smalltalk.SequenceableCollection);
  175. smalltalk.addMethod(
  176. "_reverseTrapAt_",
  177. smalltalk.method({
  178. selector: "reverseTrapAt:",
  179. fn: function (anObject){
  180. var self=this;
  181. var $1;
  182. $1=smalltalk.send(anObject,"_at_ifAbsent_",[self,(function(){
  183. return nil;
  184. })]);
  185. return $1;
  186. }
  187. }),
  188. smalltalk.String);
  189. smalltalk.addMethod(
  190. "_reverseTrapAt_put_",
  191. smalltalk.method({
  192. selector: "reverseTrapAt:put:",
  193. fn: function (anObject,value){
  194. var self=this;
  195. var $1;
  196. $1=smalltalk.send(anObject,"_at_put_",[self,value]);
  197. return $1;
  198. }
  199. }),
  200. smalltalk.String);
  201. smalltalk.addMethod(
  202. "_reverseTrapAt_",
  203. smalltalk.method({
  204. selector: "reverseTrapAt:",
  205. fn: function (anObject){
  206. var self=this;
  207. var $1;
  208. var $early={};
  209. try {
  210. $1=smalltalk.send((function(){
  211. return smalltalk.send(anObject,"_perform_",[self]);
  212. }),"_on_do_",[(smalltalk.MessageNotUnderstood || MessageNotUnderstood),(function(){
  213. throw $early=[nil];
  214. })]);
  215. return $1;
  216. }
  217. catch(e) {if(e===$early)return e[0]; throw e}
  218. }
  219. }),
  220. smalltalk.Symbol);
  221. smalltalk.addMethod(
  222. "_reverseTrapAt_put_",
  223. smalltalk.method({
  224. selector: "reverseTrapAt:put:",
  225. fn: function (anObject,value){
  226. var self=this;
  227. var $1;
  228. $1=smalltalk.send(anObject,"_perform_withArguments_",[smalltalk.send(smalltalk.send(self,"__comma",[":"]),"_asSymbol",[]),[value]]);
  229. return $1;
  230. }
  231. }),
  232. smalltalk.Symbol);
  233. smalltalk.addMethod(
  234. "_reverseTrapAt_",
  235. smalltalk.method({
  236. selector: "reverseTrapAt:",
  237. fn: function (anObject){
  238. var self=this;
  239. var $1;
  240. $1=smalltalk.send(anObject,"_at_ifAbsent_",[self,(function(){
  241. return nil;
  242. })]);
  243. return $1;
  244. }
  245. }),
  246. smalltalk.Number);
  247. smalltalk.addMethod(
  248. "_reverseTrapAt_put_",
  249. smalltalk.method({
  250. selector: "reverseTrapAt:put:",
  251. fn: function (anObject,value){
  252. var self=this;
  253. var $1;
  254. $1=smalltalk.send(anObject,"_at_put_",[self,value]);
  255. return $1;
  256. }
  257. }),
  258. smalltalk.Number);