Kernel-Helpers.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. define(["amber/boot"], function($boot){"use strict";
  2. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  3. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  4. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  5. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  6. $core.addPackage("Kernel-Helpers");
  7. $core.packages["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  8. $core.packages["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  9. $core.addTrait("TSubclassable", "Kernel-Helpers");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "subclass:",
  13. protocol: "class creation",
  14. fn: function (aString){
  15. var self=this,$self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  20. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  22. //>>excludeEnd("ctx");
  23. },
  24. //>>excludeStart("ide", pragmas.excludeIdeData);
  25. args: ["aString"],
  26. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  27. referencedClasses: [],
  28. //>>excludeEnd("ide");
  29. messageSends: ["subclass:instanceVariableNames:package:"]
  30. }),
  31. $globals.TSubclassable);
  32. $core.addMethod(
  33. $core.method({
  34. selector: "subclass:instanceVariableNames:",
  35. protocol: "class creation",
  36. fn: function (aString,anotherString){
  37. var self=this,$self=this;
  38. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39. return $core.withContext(function($ctx1) {
  40. //>>excludeEnd("ctx");
  41. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  42. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  44. //>>excludeEnd("ctx");
  45. },
  46. //>>excludeStart("ide", pragmas.excludeIdeData);
  47. args: ["aString", "anotherString"],
  48. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  49. referencedClasses: [],
  50. //>>excludeEnd("ide");
  51. messageSends: ["subclass:instanceVariableNames:package:"]
  52. }),
  53. $globals.TSubclassable);
  54. $core.addMethod(
  55. $core.method({
  56. selector: "subclass:instanceVariableNames:category:",
  57. protocol: "class creation",
  58. fn: function (aString,aString2,aString3){
  59. var self=this,$self=this;
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. return $core.withContext(function($ctx1) {
  62. //>>excludeEnd("ctx");
  63. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  64. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  66. //>>excludeEnd("ctx");
  67. },
  68. //>>excludeStart("ide", pragmas.excludeIdeData);
  69. args: ["aString", "aString2", "aString3"],
  70. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  71. referencedClasses: [],
  72. //>>excludeEnd("ide");
  73. messageSends: ["subclass:instanceVariableNames:package:"]
  74. }),
  75. $globals.TSubclassable);
  76. $core.addMethod(
  77. $core.method({
  78. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  79. protocol: "class creation",
  80. fn: function (aString,aString2,classVars,pools,aString3){
  81. var self=this,$self=this;
  82. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  83. return $core.withContext(function($ctx1) {
  84. //>>excludeEnd("ctx");
  85. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  86. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  87. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  88. //>>excludeEnd("ctx");
  89. },
  90. //>>excludeStart("ide", pragmas.excludeIdeData);
  91. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  92. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  93. referencedClasses: [],
  94. //>>excludeEnd("ide");
  95. messageSends: ["subclass:instanceVariableNames:package:"]
  96. }),
  97. $globals.TSubclassable);
  98. $core.addMethod(
  99. $core.method({
  100. selector: "subclass:instanceVariableNames:package:",
  101. protocol: "class creation",
  102. fn: function (aString,aString2,aString3){
  103. var self=this,$self=this;
  104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  105. return $core.withContext(function($ctx1) {
  106. //>>excludeEnd("ctx");
  107. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  109. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  110. //>>excludeEnd("ctx");
  111. },
  112. //>>excludeStart("ide", pragmas.excludeIdeData);
  113. args: ["aString", "aString2", "aString3"],
  114. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  115. referencedClasses: ["ClassBuilder"],
  116. //>>excludeEnd("ide");
  117. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  118. }),
  119. $globals.TSubclassable);
  120. $core.addMethod(
  121. $core.method({
  122. selector: "subclass:uses:",
  123. protocol: "class creation",
  124. fn: function (aString,aTraitCompositionDescription){
  125. var self=this,$self=this;
  126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  127. return $core.withContext(function($ctx1) {
  128. //>>excludeEnd("ctx");
  129. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  131. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  132. //>>excludeEnd("ctx");
  133. },
  134. //>>excludeStart("ide", pragmas.excludeIdeData);
  135. args: ["aString", "aTraitCompositionDescription"],
  136. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  137. referencedClasses: [],
  138. //>>excludeEnd("ide");
  139. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  140. }),
  141. $globals.TSubclassable);
  142. $core.addMethod(
  143. $core.method({
  144. selector: "subclass:uses:instanceVariableNames:",
  145. protocol: "class creation",
  146. fn: function (aString,aTraitCompositionDescription,anotherString){
  147. var self=this,$self=this;
  148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  149. return $core.withContext(function($ctx1) {
  150. //>>excludeEnd("ctx");
  151. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  153. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  154. //>>excludeEnd("ctx");
  155. },
  156. //>>excludeStart("ide", pragmas.excludeIdeData);
  157. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  158. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString package: nil",
  159. referencedClasses: [],
  160. //>>excludeEnd("ide");
  161. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  162. }),
  163. $globals.TSubclassable);
  164. $core.addMethod(
  165. $core.method({
  166. selector: "subclass:uses:instanceVariableNames:category:",
  167. protocol: "class creation",
  168. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  169. var self=this,$self=this;
  170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  171. return $core.withContext(function($ctx1) {
  172. //>>excludeEnd("ctx");
  173. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  175. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  176. //>>excludeEnd("ctx");
  177. },
  178. //>>excludeStart("ide", pragmas.excludeIdeData);
  179. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  180. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  181. referencedClasses: [],
  182. //>>excludeEnd("ide");
  183. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  184. }),
  185. $globals.TSubclassable);
  186. $core.addMethod(
  187. $core.method({
  188. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  189. protocol: "class creation",
  190. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  191. var self=this,$self=this;
  192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  193. return $core.withContext(function($ctx1) {
  194. //>>excludeEnd("ctx");
  195. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  197. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  198. //>>excludeEnd("ctx");
  199. },
  200. //>>excludeStart("ide", pragmas.excludeIdeData);
  201. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  202. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  203. referencedClasses: [],
  204. //>>excludeEnd("ide");
  205. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  206. }),
  207. $globals.TSubclassable);
  208. $core.addMethod(
  209. $core.method({
  210. selector: "subclass:uses:instanceVariableNames:package:",
  211. protocol: "class creation",
  212. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  213. var self=this,$self=this;
  214. var cls;
  215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  216. return $core.withContext(function($ctx1) {
  217. //>>excludeEnd("ctx");
  218. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  219. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  220. return cls;
  221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  222. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  223. //>>excludeEnd("ctx");
  224. },
  225. //>>excludeStart("ide", pragmas.excludeIdeData);
  226. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  227. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3\x0a\x09| cls |\x0a\x09cls := self subclass: aString instanceVariableNames: aString2 package: aString3.\x0a\x09cls setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ cls",
  228. referencedClasses: [],
  229. //>>excludeEnd("ide");
  230. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  231. }),
  232. $globals.TSubclassable);
  233. });