Trapped.deploy.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. smalltalk.addPackage('Trapped', {});
  2. smalltalk.addClass('EavModel', smalltalk.Object, ['getBlock', 'putBlock'], 'Trapped');
  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. self["@getBlock"]=(function(){
  20. return smalltalk.send(self,"_error_",["No getter block."]);
  21. });
  22. self["@putBlock"]=(function(){
  23. return smalltalk.send(self,"_error_",["No putter block."]);
  24. });
  25. return self}
  26. }),
  27. smalltalk.EavModel);
  28. smalltalk.addMethod(
  29. "_on_",
  30. smalltalk.method({
  31. selector: "on:",
  32. fn: function (anObject){
  33. var self=this;
  34. var $1;
  35. $1=smalltalk.send(self["@getBlock"],"_value_",[anObject]);
  36. return $1;
  37. }
  38. }),
  39. smalltalk.EavModel);
  40. smalltalk.addMethod(
  41. "_on_put_",
  42. smalltalk.method({
  43. selector: "on:put:",
  44. fn: function (anObject,anObject2){
  45. var self=this;
  46. var $1;
  47. $1=smalltalk.send(self["@putBlock"],"_value_value_",[anObject,anObject2]);
  48. return $1;
  49. }
  50. }),
  51. smalltalk.EavModel);
  52. smalltalk.addMethod(
  53. "_putBlock_",
  54. smalltalk.method({
  55. selector: "putBlock:",
  56. fn: function (aBlock){
  57. var self=this;
  58. self["@putBlock"]=aBlock;
  59. return self}
  60. }),
  61. smalltalk.EavModel);
  62. smalltalk.addClass('Isolator', smalltalk.Object, ['root'], 'Trapped');
  63. smalltalk.addMethod(
  64. "_model_modify_",
  65. smalltalk.method({
  66. selector: "model:modify:",
  67. fn: function (anEavModel,aBlock){
  68. var self=this;
  69. var newValue;
  70. newValue=smalltalk.send(aBlock,"_value_",[smalltalk.send(anEavModel,"_on_",[self])]);
  71. smalltalk.send(anEavModel,"_on_put_",[self,smalltalk.send(newValue,"_deepCopy",[])]);
  72. return self}
  73. }),
  74. smalltalk.Isolator);
  75. smalltalk.addMethod(
  76. "_model_read_",
  77. smalltalk.method({
  78. selector: "model:read:",
  79. fn: function (anEavModel,aBlock){
  80. var self=this;
  81. smalltalk.send(aBlock,"_value_",[smalltalk.send(smalltalk.send(anEavModel,"_on_",[self]),"_deepCopy",[])]);
  82. return self}
  83. }),
  84. smalltalk.Isolator);
  85. smalltalk.addMethod(
  86. "_root",
  87. smalltalk.method({
  88. selector: "root",
  89. fn: function (){
  90. var self=this;
  91. return self["@root"];
  92. }
  93. }),
  94. smalltalk.Isolator);
  95. smalltalk.addMethod(
  96. "_root_",
  97. smalltalk.method({
  98. selector: "root:",
  99. fn: function (anObject){
  100. var self=this;
  101. self["@root"]=anObject;
  102. return self}
  103. }),
  104. smalltalk.Isolator);
  105. smalltalk.addMethod(
  106. "_on_",
  107. smalltalk.method({
  108. selector: "on:",
  109. fn: function (anObject){
  110. var self=this;
  111. var $1;
  112. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_root_",[anObject]);
  113. return $1;
  114. }
  115. }),
  116. smalltalk.Isolator.klass);
  117. smalltalk.addClass('Trapped', smalltalk.Object, [], 'Trapped');