1
0

Kernel-Helpers.js 12 KB

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