Helios-Environments.deploy.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. smalltalk.addPackage('Helios-Environments');
  2. smalltalk.addClass('HLEnvironment', smalltalk.Object, [], 'Helios-Environments');
  3. smalltalk.addMethod(
  4. "_addInstVarNamed_to_",
  5. smalltalk.method({
  6. selector: "addInstVarNamed:to:",
  7. fn: function (aString,aClass){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { var $1,$2;
  10. $1=_st(_st(aClass)._instanceVariableNames())._copy();
  11. _st($1)._add_(aString);
  12. $2=_st($1)._yourself();
  13. _st(_st(self)._classBuilder())._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),_st(aClass)._name(),$2,_st(_st(aClass)._package())._name());
  14. return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass}, smalltalk.HLEnvironment)})},
  15. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package", "classBuilder"]}),
  16. smalltalk.HLEnvironment);
  17. smalltalk.addMethod(
  18. "_availableClassNames",
  19. smalltalk.method({
  20. selector: "availableClassNames",
  21. fn: function (){
  22. var self=this;
  23. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  24. return self}, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.HLEnvironment)})},
  25. messageSends: ["subclassResponsibility"]}),
  26. smalltalk.HLEnvironment);
  27. smalltalk.addMethod(
  28. "_availableProtocolsFor_",
  29. smalltalk.method({
  30. selector: "availableProtocolsFor:",
  31. fn: function (aClass){
  32. var self=this;
  33. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  34. return self}, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass},smalltalk.HLEnvironment)})},
  35. messageSends: ["subclassResponsibility"]}),
  36. smalltalk.HLEnvironment);
  37. smalltalk.addMethod(
  38. "_classBuilder",
  39. smalltalk.method({
  40. selector: "classBuilder",
  41. fn: function (){
  42. var self=this;
  43. return smalltalk.withContext(function($ctx1) { var $1;
  44. $1=_st(self)._subclassResponsibility();
  45. return $1;
  46. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{}, smalltalk.HLEnvironment)})},
  47. messageSends: ["subclassResponsibility"]}),
  48. smalltalk.HLEnvironment);
  49. smalltalk.addMethod(
  50. "_compileClassComment_for_",
  51. smalltalk.method({
  52. selector: "compileClassComment:for:",
  53. fn: function (aString,aClass){
  54. var self=this;
  55. return smalltalk.withContext(function($ctx1) { _st(aClass)._comment_(aString);
  56. return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass}, smalltalk.HLEnvironment)})},
  57. messageSends: ["comment:"]}),
  58. smalltalk.HLEnvironment);
  59. smalltalk.addMethod(
  60. "_compileClassDefinition_",
  61. smalltalk.method({
  62. selector: "compileClassDefinition:",
  63. fn: function (aString){
  64. var self=this;
  65. return smalltalk.withContext(function($ctx1) { _st(self)._eval_on_(aString,_st((smalltalk.DoIt || DoIt))._new());
  66. return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString}, smalltalk.HLEnvironment)})},
  67. messageSends: ["eval:on:", "new"]}),
  68. smalltalk.HLEnvironment);
  69. smalltalk.addMethod(
  70. "_compileMethod_for_protocol_",
  71. smalltalk.method({
  72. selector: "compileMethod:for:protocol:",
  73. fn: function (sourceCode,class_,protocol){
  74. var self=this;
  75. return smalltalk.withContext(function($ctx1) { _st(class_)._compile_category_(sourceCode,protocol);
  76. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol}, smalltalk.HLEnvironment)})},
  77. messageSends: ["compile:category:"]}),
  78. smalltalk.HLEnvironment);
  79. smalltalk.addMethod(
  80. "_eval_on_",
  81. smalltalk.method({
  82. selector: "eval:on:",
  83. fn: function (someCode,aReceiver){
  84. var self=this;
  85. return smalltalk.withContext(function($ctx1) { var $1;
  86. $1=_st(self)._subclassResponsibility();
  87. return $1;
  88. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{someCode:someCode,aReceiver:aReceiver}, smalltalk.HLEnvironment)})},
  89. messageSends: ["subclassResponsibility"]}),
  90. smalltalk.HLEnvironment);
  91. smalltalk.addMethod(
  92. "_moveMethod_toClass_",
  93. smalltalk.method({
  94. selector: "moveMethod:toClass:",
  95. fn: function (aMethod,aClassName){
  96. var self=this;
  97. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  98. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName},smalltalk.HLEnvironment)})},
  99. messageSends: ["subclassResponsibility"]}),
  100. smalltalk.HLEnvironment);
  101. smalltalk.addMethod(
  102. "_packages",
  103. smalltalk.method({
  104. selector: "packages",
  105. fn: function (){
  106. var self=this;
  107. return smalltalk.withContext(function($ctx1) { var $1;
  108. $1=_st(self)._subclassResponsibility();
  109. return $1;
  110. }, function($ctx1) {$ctx1.fill(self,"packages",{}, smalltalk.HLEnvironment)})},
  111. messageSends: ["subclassResponsibility"]}),
  112. smalltalk.HLEnvironment);
  113. smalltalk.addClass('HLLocalEnvironment', smalltalk.HLEnvironment, [], 'Helios-Environments');
  114. smalltalk.addMethod(
  115. "_availableClassNames",
  116. smalltalk.method({
  117. selector: "availableClassNames",
  118. fn: function (){
  119. var self=this;
  120. return smalltalk.withContext(function($ctx1) { var $1;
  121. $1=_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._classes())._collect_((function(each){
  122. return smalltalk.withContext(function($ctx2) { return _st(each)._name();
  123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  124. return $1;
  125. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.HLLocalEnvironment)})},
  126. messageSends: ["collect:", "name", "classes", "current"]}),
  127. smalltalk.HLLocalEnvironment);
  128. smalltalk.addMethod(
  129. "_availableProtocolsFor_",
  130. smalltalk.method({
  131. selector: "availableProtocolsFor:",
  132. fn: function (aClass){
  133. var self=this;
  134. var protocols;
  135. return smalltalk.withContext(function($ctx1) { var $1,$2;
  136. protocols=_st(aClass)._protocols();
  137. $1=_st(aClass)._superclass();
  138. if(($receiver = $1) == nil || $receiver == undefined){
  139. $1;
  140. } else {
  141. _st(protocols)._addAll_(_st(self)._availableProtocolsFor_(_st(aClass)._superclass()));
  142. };
  143. $2=_st(_st(protocols)._asSet())._asArray();
  144. return $2;
  145. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.HLLocalEnvironment)})},
  146. messageSends: ["protocols", "ifNotNil:", "addAll:", "availableProtocolsFor:", "superclass", "asArray", "asSet"]}),
  147. smalltalk.HLLocalEnvironment);
  148. smalltalk.addMethod(
  149. "_classBuilder",
  150. smalltalk.method({
  151. selector: "classBuilder",
  152. fn: function (){
  153. var self=this;
  154. return smalltalk.withContext(function($ctx1) { var $1;
  155. $1=_st((smalltalk.ClassBuilder || ClassBuilder))._new();
  156. return $1;
  157. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{}, smalltalk.HLLocalEnvironment)})},
  158. messageSends: ["new"]}),
  159. smalltalk.HLLocalEnvironment);
  160. smalltalk.addMethod(
  161. "_eval_on_",
  162. smalltalk.method({
  163. selector: "eval:on:",
  164. fn: function (aString,aReceiver){
  165. var self=this;
  166. var compiler;
  167. return smalltalk.withContext(function($ctx1) { var $1,$2;
  168. var $early={};
  169. try {
  170. compiler=_st((smalltalk.Compiler || Compiler))._new();
  171. _st((function(){
  172. return smalltalk.withContext(function($ctx2) { return _st(compiler)._parseExpression_(aString);
  173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  174. return smalltalk.withContext(function($ctx2) { $1=_st(window)._alert_(_st(ex)._messageText());
  175. throw $early=[$1];
  176. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  177. $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
  178. return $2;
  179. }
  180. catch(e) {if(e===$early)return e[0]; throw e}
  181. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler}, smalltalk.HLLocalEnvironment)})},
  182. messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "evaluateExpression:on:"]}),
  183. smalltalk.HLLocalEnvironment);
  184. smalltalk.addMethod(
  185. "_moveMethod_toClass_",
  186. smalltalk.method({
  187. selector: "moveMethod:toClass:",
  188. fn: function (aMethod,aClassName){
  189. var self=this;
  190. var destinationClass;
  191. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  192. destinationClass=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(_st(aClassName)._asSymbol());
  193. $1=destinationClass;
  194. if(($receiver = $1) == nil || $receiver == undefined){
  195. _st(self)._error_("Invalid class name");
  196. } else {
  197. $1;
  198. };
  199. $2=_st(destinationClass).__eq_eq(_st(aMethod)._methodClass());
  200. if(smalltalk.assert($2)){
  201. $3=self;
  202. return $3;
  203. };
  204. _st(destinationClass)._adoptMethod_(aMethod);
  205. _st(_st(aMethod)._methodClass())._forsakeMethod_(aMethod);
  206. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.HLLocalEnvironment)})},
  207. messageSends: ["at:", "asSymbol", "current", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "adoptMethod:", "forsakeMethod:"]}),
  208. smalltalk.HLLocalEnvironment);
  209. smalltalk.addMethod(
  210. "_packages",
  211. smalltalk.method({
  212. selector: "packages",
  213. fn: function (){
  214. var self=this;
  215. return smalltalk.withContext(function($ctx1) { var $1;
  216. $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._packages();
  217. return $1;
  218. }, function($ctx1) {$ctx1.fill(self,"packages",{}, smalltalk.HLLocalEnvironment)})},
  219. messageSends: ["packages", "current"]}),
  220. smalltalk.HLLocalEnvironment);
  221. smalltalk.addClass('HLRemoteEnvironment', smalltalk.HLEnvironment, [], 'Helios-Environments');
  222. smalltalk.addMethod(
  223. "_eval_on_",
  224. smalltalk.method({
  225. selector: "eval:on:",
  226. fn: function (someCode,aReceiver){
  227. var self=this;
  228. return smalltalk.withContext(function($ctx1) { _st(self)._notYetImplemented();
  229. return self}, function($ctx1) {$ctx1.fill(self,"eval:on:",{someCode:someCode,aReceiver:aReceiver}, smalltalk.HLRemoteEnvironment)})},
  230. messageSends: ["notYetImplemented"]}),
  231. smalltalk.HLRemoteEnvironment);
  232. smalltalk.addMethod(
  233. "_packages",
  234. smalltalk.method({
  235. selector: "packages",
  236. fn: function (){
  237. var self=this;
  238. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"packages",{}, smalltalk.HLRemoteEnvironment)})},
  239. messageSends: []}),
  240. smalltalk.HLRemoteEnvironment);
  241. smalltalk.addClass('HLRemoteObject', smalltalk.Object, [], 'Helios-Environments');
  242. smalltalk.addMethod(
  243. "_doesNotUnderstand_",
  244. smalltalk.method({
  245. selector: "doesNotUnderstand:",
  246. fn: function (aMessage){
  247. var self=this;
  248. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage}, smalltalk.HLRemoteObject)})},
  249. messageSends: []}),
  250. smalltalk.HLRemoteObject);
  251. smalltalk.addMethod(
  252. "_inspectOn_",
  253. smalltalk.method({
  254. selector: "inspectOn:",
  255. fn: function (anInspector){
  256. var self=this;
  257. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector}, smalltalk.HLRemoteObject)})},
  258. messageSends: []}),
  259. smalltalk.HLRemoteObject);
  260. smalltalk.addMethod(
  261. "_printString",
  262. smalltalk.method({
  263. selector: "printString",
  264. fn: function (){
  265. var self=this;
  266. return smalltalk.withContext(function($ctx1) { return "this is a remote object";
  267. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.HLRemoteObject)})},
  268. messageSends: []}),
  269. smalltalk.HLRemoteObject);
  270. smalltalk.addMethod(
  271. "_adoptMethod_",
  272. smalltalk.method({
  273. selector: "adoptMethod:",
  274. fn: function (aMethod){
  275. var self=this;
  276. return smalltalk.withContext(function($ctx1) { _st(self)._compile_category_(_st(aMethod)._source(),_st(aMethod)._protocol());
  277. return self}, function($ctx1) {$ctx1.fill(self,"adoptMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  278. messageSends: ["compile:category:", "source", "protocol"]}),
  279. smalltalk.Behavior);
  280. smalltalk.addMethod(
  281. "_forsakeMethod_",
  282. smalltalk.method({
  283. selector: "forsakeMethod:",
  284. fn: function (aMethod){
  285. var self=this;
  286. return smalltalk.withContext(function($ctx1) { _st(self)._removeCompiledMethod_(aMethod);
  287. return self}, function($ctx1) {$ctx1.fill(self,"forsakeMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  288. messageSends: ["removeCompiledMethod:"]}),
  289. smalltalk.Behavior);