Trapped-Backend.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. define(["amber/boot"
  2. //>>excludeStart("imports", pragmas.excludeImports);
  3. , "axxord/Axxord"
  4. //>>excludeEnd("imports");
  5. , "amber_core/Kernel-Objects"], function($boot
  6. //>>excludeStart("imports", pragmas.excludeImports);
  7. //>>excludeEnd("imports");
  8. ){"use strict";
  9. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  10. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  11. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  12. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  13. $core.addPackage("Trapped-Backend");
  14. $core.packages["Trapped-Backend"].innerEval = function (expr) { return eval(expr); };
  15. $core.packages["Trapped-Backend"].imports = ["axxord/Axxord"];
  16. $core.packages["Trapped-Backend"].transport = {"type":"amd","amdNamespace":"trapped"};
  17. $core.addClass("Isolator", $globals.Object, ["root"], "Trapped-Backend");
  18. $core.addMethod(
  19. $core.method({
  20. selector: "model:modify:",
  21. protocol: "action",
  22. fn: function (anEavModel,aBlock){
  23. var self=this,$self=this;
  24. var newValue;
  25. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26. return $core.withContext(function($ctx1) {
  27. //>>excludeEnd("ctx");
  28. newValue=$recv(aBlock)._value_($recv(anEavModel)._on_(self));
  29. $recv(anEavModel)._on_put_(self,$recv(newValue)._deepCopy());
  30. return self;
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. }, function($ctx1) {$ctx1.fill(self,"model:modify:",{anEavModel:anEavModel,aBlock:aBlock,newValue:newValue},$globals.Isolator)});
  33. //>>excludeEnd("ctx");
  34. },
  35. //>>excludeStart("ide", pragmas.excludeIdeData);
  36. args: ["anEavModel", "aBlock"],
  37. source: "model: anEavModel modify: aBlock\x0a\x0a| newValue |\x0anewValue := aBlock value: (anEavModel on: self).\x0aanEavModel on: self put: newValue deepCopy",
  38. referencedClasses: [],
  39. //>>excludeEnd("ide");
  40. messageSends: ["value:", "on:", "on:put:", "deepCopy"]
  41. }),
  42. $globals.Isolator);
  43. $core.addMethod(
  44. $core.method({
  45. selector: "model:read:",
  46. protocol: "action",
  47. fn: function (anEavModel,aBlock){
  48. var self=this,$self=this;
  49. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  50. return $core.withContext(function($ctx1) {
  51. //>>excludeEnd("ctx");
  52. $recv(aBlock)._value_($recv($recv(anEavModel)._on_(self))._deepCopy());
  53. return self;
  54. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55. }, function($ctx1) {$ctx1.fill(self,"model:read:",{anEavModel:anEavModel,aBlock:aBlock},$globals.Isolator)});
  56. //>>excludeEnd("ctx");
  57. },
  58. //>>excludeStart("ide", pragmas.excludeIdeData);
  59. args: ["anEavModel", "aBlock"],
  60. source: "model: anEavModel read: aBlock\x0a\x0aaBlock value: (anEavModel on: self) deepCopy",
  61. referencedClasses: [],
  62. //>>excludeEnd("ide");
  63. messageSends: ["value:", "deepCopy", "on:"]
  64. }),
  65. $globals.Isolator);
  66. $core.addMethod(
  67. $core.method({
  68. selector: "root",
  69. protocol: "accessing",
  70. fn: function (){
  71. var self=this,$self=this;
  72. return $self["@root"];
  73. },
  74. //>>excludeStart("ide", pragmas.excludeIdeData);
  75. args: [],
  76. source: "root\x0a\x0a^root",
  77. referencedClasses: [],
  78. //>>excludeEnd("ide");
  79. messageSends: []
  80. }),
  81. $globals.Isolator);
  82. $core.addMethod(
  83. $core.method({
  84. selector: "root:",
  85. protocol: "accessing",
  86. fn: function (anObject){
  87. var self=this,$self=this;
  88. $self["@root"]=anObject;
  89. return self;
  90. },
  91. //>>excludeStart("ide", pragmas.excludeIdeData);
  92. args: ["anObject"],
  93. source: "root: anObject\x0a\x0aroot := anObject",
  94. referencedClasses: [],
  95. //>>excludeEnd("ide");
  96. messageSends: []
  97. }),
  98. $globals.Isolator);
  99. $core.addMethod(
  100. $core.method({
  101. selector: "on:",
  102. protocol: "instance creation",
  103. fn: function (anObject){
  104. var self=this,$self=this;
  105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  106. return $core.withContext(function($ctx1) {
  107. //>>excludeEnd("ctx");
  108. return $recv($self._new())._root_(anObject);
  109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  110. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Isolator.a$cls)});
  111. //>>excludeEnd("ctx");
  112. },
  113. //>>excludeStart("ide", pragmas.excludeIdeData);
  114. args: ["anObject"],
  115. source: "on: anObject\x0a^self new root: anObject",
  116. referencedClasses: [],
  117. //>>excludeEnd("ide");
  118. messageSends: ["root:", "new"]
  119. }),
  120. $globals.Isolator.a$cls);
  121. });