Kernel-Infrastructure.js 103 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660
  1. define("amber_core/Kernel-Infrastructure", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Infrastructure');
  3. smalltalk.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('InspectorHandler', smalltalk.Object, [], 'Kernel-Infrastructure');
  5. smalltalk.InspectorHandler.comment="I am responsible for inspecting object.\x0a\x0aMy class-side `inspector` inst var holds the current inspector I'm delegating object inspection to.\x0a\x0aThe default inspector object is the transcript.";
  6. smalltalk.InspectorHandler.klass.iVarNames = ['inspector'];
  7. smalltalk.addMethod(
  8. smalltalk.method({
  9. selector: "inspect:",
  10. category: 'registration',
  11. fn: function (anObject){
  12. var self=this;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $1;
  15. $1=_st(self._inspector())._inspect_(anObject);
  16. return $1;
  17. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.InspectorHandler.klass)})},
  18. args: ["anObject"],
  19. source: "inspect: anObject\x0a\x09^ self inspector inspect: anObject",
  20. messageSends: ["inspect:", "inspector"],
  21. referencedClasses: []
  22. }),
  23. smalltalk.InspectorHandler.klass);
  24. smalltalk.addMethod(
  25. smalltalk.method({
  26. selector: "inspector",
  27. category: 'accessing',
  28. fn: function (){
  29. var self=this;
  30. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  31. return smalltalk.withContext(function($ctx1) {
  32. var $2,$1;
  33. $2=self["@inspector"];
  34. if(($receiver = $2) == nil || $receiver == null){
  35. self["@inspector"]=$Transcript();
  36. $1=self["@inspector"];
  37. } else {
  38. $1=$2;
  39. };
  40. return $1;
  41. }, function($ctx1) {$ctx1.fill(self,"inspector",{},smalltalk.InspectorHandler.klass)})},
  42. args: [],
  43. source: "inspector\x0a\x09^ inspector ifNil: [ inspector := Transcript ]",
  44. messageSends: ["ifNil:"],
  45. referencedClasses: ["Transcript"]
  46. }),
  47. smalltalk.InspectorHandler.klass);
  48. smalltalk.addMethod(
  49. smalltalk.method({
  50. selector: "register:",
  51. category: 'registration',
  52. fn: function (anInspector){
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. self["@inspector"]=anInspector;
  56. return self}, function($ctx1) {$ctx1.fill(self,"register:",{anInspector:anInspector},smalltalk.InspectorHandler.klass)})},
  57. args: ["anInspector"],
  58. source: "register: anInspector\x0a\x09inspector := anInspector",
  59. messageSends: [],
  60. referencedClasses: []
  61. }),
  62. smalltalk.InspectorHandler.klass);
  63. smalltalk.addClass('InterfacingObject', smalltalk.Object, [], 'Kernel-Infrastructure');
  64. smalltalk.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  65. smalltalk.addMethod(
  66. smalltalk.method({
  67. selector: "ajax:",
  68. category: 'actions',
  69. fn: function (anObject){
  70. var self=this;
  71. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  72. return smalltalk.withContext(function($ctx1) {
  73. var $1;
  74. $1=_st($PlatformInterface())._ajax_(anObject);
  75. return $1;
  76. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},smalltalk.InterfacingObject)})},
  77. args: ["anObject"],
  78. source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject",
  79. messageSends: ["ajax:"],
  80. referencedClasses: ["PlatformInterface"]
  81. }),
  82. smalltalk.InterfacingObject);
  83. smalltalk.addMethod(
  84. smalltalk.method({
  85. selector: "alert:",
  86. category: 'actions',
  87. fn: function (aString){
  88. var self=this;
  89. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  90. return smalltalk.withContext(function($ctx1) {
  91. var $1;
  92. $1=_st($PlatformInterface())._alert_(aString);
  93. return $1;
  94. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},smalltalk.InterfacingObject)})},
  95. args: ["aString"],
  96. source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
  97. messageSends: ["alert:"],
  98. referencedClasses: ["PlatformInterface"]
  99. }),
  100. smalltalk.InterfacingObject);
  101. smalltalk.addMethod(
  102. smalltalk.method({
  103. selector: "confirm:",
  104. category: 'actions',
  105. fn: function (aString){
  106. var self=this;
  107. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  108. return smalltalk.withContext(function($ctx1) {
  109. var $1;
  110. $1=_st($PlatformInterface())._confirm_(aString);
  111. return $1;
  112. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},smalltalk.InterfacingObject)})},
  113. args: ["aString"],
  114. source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
  115. messageSends: ["confirm:"],
  116. referencedClasses: ["PlatformInterface"]
  117. }),
  118. smalltalk.InterfacingObject);
  119. smalltalk.addMethod(
  120. smalltalk.method({
  121. selector: "prompt:",
  122. category: 'actions',
  123. fn: function (aString){
  124. var self=this;
  125. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  126. return smalltalk.withContext(function($ctx1) {
  127. var $1;
  128. $1=_st($PlatformInterface())._prompt_(aString);
  129. return $1;
  130. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},smalltalk.InterfacingObject)})},
  131. args: ["aString"],
  132. source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
  133. messageSends: ["prompt:"],
  134. referencedClasses: ["PlatformInterface"]
  135. }),
  136. smalltalk.InterfacingObject);
  137. smalltalk.addClass('Environment', smalltalk.InterfacingObject, [], 'Kernel-Infrastructure');
  138. smalltalk.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
  139. smalltalk.addMethod(
  140. smalltalk.method({
  141. selector: "addInstVarNamed:to:",
  142. category: 'compiling',
  143. fn: function (aString,aClass){
  144. var self=this;
  145. return smalltalk.withContext(function($ctx1) {
  146. var $1,$2,$3,$4,$5;
  147. $1=self._classBuilder();
  148. $2=_st(aClass)._superclass();
  149. $3=_st(aClass)._name();
  150. $ctx1.sendIdx["name"]=1;
  151. $4=_st(_st(aClass)._instanceVariableNames())._copy();
  152. _st($4)._add_(aString);
  153. $5=_st($4)._yourself();
  154. _st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,_st(_st(aClass)._package())._name());
  155. return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  156. args: ["aString", "aClass"],
  157. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  158. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"],
  159. referencedClasses: []
  160. }),
  161. smalltalk.Environment);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "allSelectors",
  165. category: 'accessing',
  166. fn: function (){
  167. var self=this;
  168. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  169. return smalltalk.withContext(function($ctx1) {
  170. var $1;
  171. $1=_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value();
  172. return $1;
  173. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Environment)})},
  174. args: [],
  175. source: "allSelectors\x0a\x09^ (Smalltalk current at: 'allSelectors') value",
  176. messageSends: ["value", "at:", "current"],
  177. referencedClasses: ["Smalltalk"]
  178. }),
  179. smalltalk.Environment);
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "availableClassNames",
  183. category: 'accessing',
  184. fn: function (){
  185. var self=this;
  186. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  187. return smalltalk.withContext(function($ctx1) {
  188. var $1;
  189. $1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  190. return smalltalk.withContext(function($ctx2) {
  191. return _st(each)._name();
  192. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  193. return $1;
  194. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.Environment)})},
  195. args: [],
  196. source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
  197. messageSends: ["collect:", "classes", "current", "name"],
  198. referencedClasses: ["Smalltalk"]
  199. }),
  200. smalltalk.Environment);
  201. smalltalk.addMethod(
  202. smalltalk.method({
  203. selector: "availablePackageNames",
  204. category: 'accessing',
  205. fn: function (){
  206. var self=this;
  207. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  208. return smalltalk.withContext(function($ctx1) {
  209. var $1;
  210. $1=_st(_st(_st($Smalltalk())._current())._packages())._collect_((function(each){
  211. return smalltalk.withContext(function($ctx2) {
  212. return _st(each)._name();
  213. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  214. return $1;
  215. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.Environment)})},
  216. args: [],
  217. source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
  218. messageSends: ["collect:", "packages", "current", "name"],
  219. referencedClasses: ["Smalltalk"]
  220. }),
  221. smalltalk.Environment);
  222. smalltalk.addMethod(
  223. smalltalk.method({
  224. selector: "availableProtocolsFor:",
  225. category: 'accessing',
  226. fn: function (aClass){
  227. var self=this;
  228. var protocols;
  229. return smalltalk.withContext(function($ctx1) {
  230. var $1,$2;
  231. protocols=_st(aClass)._protocols();
  232. $1=_st(aClass)._superclass();
  233. $ctx1.sendIdx["superclass"]=1;
  234. if(($receiver = $1) == nil || $receiver == null){
  235. $1;
  236. } else {
  237. _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
  238. };
  239. $2=_st(_st(protocols)._asSet())._asArray();
  240. return $2;
  241. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.Environment)})},
  242. args: ["aClass"],
  243. source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray",
  244. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "asArray", "asSet"],
  245. referencedClasses: []
  246. }),
  247. smalltalk.Environment);
  248. smalltalk.addMethod(
  249. smalltalk.method({
  250. selector: "classBuilder",
  251. category: 'accessing',
  252. fn: function (){
  253. var self=this;
  254. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  255. return smalltalk.withContext(function($ctx1) {
  256. var $1;
  257. $1=_st($ClassBuilder())._new();
  258. return $1;
  259. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.Environment)})},
  260. args: [],
  261. source: "classBuilder\x0a\x09^ ClassBuilder new",
  262. messageSends: ["new"],
  263. referencedClasses: ["ClassBuilder"]
  264. }),
  265. smalltalk.Environment);
  266. smalltalk.addMethod(
  267. smalltalk.method({
  268. selector: "classNamed:",
  269. category: 'accessing',
  270. fn: function (aString){
  271. var self=this;
  272. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  273. return smalltalk.withContext(function($ctx1) {
  274. var $2,$1;
  275. $2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
  276. if(($receiver = $2) == nil || $receiver == null){
  277. $1=self._error_("Invalid class name");
  278. } else {
  279. $1=$2;
  280. };
  281. return $1;
  282. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.Environment)})},
  283. args: ["aString"],
  284. source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  285. messageSends: ["ifNil:", "at:", "current", "asSymbol", "error:"],
  286. referencedClasses: ["Smalltalk"]
  287. }),
  288. smalltalk.Environment);
  289. smalltalk.addMethod(
  290. smalltalk.method({
  291. selector: "classes",
  292. category: 'accessing',
  293. fn: function (){
  294. var self=this;
  295. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  296. return smalltalk.withContext(function($ctx1) {
  297. var $1;
  298. $1=_st(_st($Smalltalk())._current())._classes();
  299. return $1;
  300. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})},
  301. args: [],
  302. source: "classes\x0a\x09^ Smalltalk current classes",
  303. messageSends: ["classes", "current"],
  304. referencedClasses: ["Smalltalk"]
  305. }),
  306. smalltalk.Environment);
  307. smalltalk.addMethod(
  308. smalltalk.method({
  309. selector: "commitPackage:",
  310. category: 'actions',
  311. fn: function (aPackage){
  312. var self=this;
  313. return smalltalk.withContext(function($ctx1) {
  314. _st(aPackage)._commit();
  315. return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.Environment)})},
  316. args: ["aPackage"],
  317. source: "commitPackage: aPackage\x0a\x09aPackage commit",
  318. messageSends: ["commit"],
  319. referencedClasses: []
  320. }),
  321. smalltalk.Environment);
  322. smalltalk.addMethod(
  323. smalltalk.method({
  324. selector: "compileClassComment:for:",
  325. category: 'compiling',
  326. fn: function (aString,aClass){
  327. var self=this;
  328. return smalltalk.withContext(function($ctx1) {
  329. _st(aClass)._comment_(aString);
  330. return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  331. args: ["aString", "aClass"],
  332. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  333. messageSends: ["comment:"],
  334. referencedClasses: []
  335. }),
  336. smalltalk.Environment);
  337. smalltalk.addMethod(
  338. smalltalk.method({
  339. selector: "compileClassDefinition:",
  340. category: 'compiling',
  341. fn: function (aString){
  342. var self=this;
  343. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  344. return smalltalk.withContext(function($ctx1) {
  345. self._eval_on_(aString,_st($DoIt())._new());
  346. return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.Environment)})},
  347. args: ["aString"],
  348. source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
  349. messageSends: ["eval:on:", "new"],
  350. referencedClasses: ["DoIt"]
  351. }),
  352. smalltalk.Environment);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "compileMethod:for:protocol:",
  356. category: 'compiling',
  357. fn: function (sourceCode,class_,protocol){
  358. var self=this;
  359. return smalltalk.withContext(function($ctx1) {
  360. var $1;
  361. $1=_st(class_)._compile_category_(sourceCode,protocol);
  362. return $1;
  363. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},smalltalk.Environment)})},
  364. args: ["sourceCode", "class", "protocol"],
  365. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09category: protocol",
  366. messageSends: ["compile:category:"],
  367. referencedClasses: []
  368. }),
  369. smalltalk.Environment);
  370. smalltalk.addMethod(
  371. smalltalk.method({
  372. selector: "copyClass:to:",
  373. category: 'actions',
  374. fn: function (aClass,aClassName){
  375. var self=this;
  376. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  377. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  378. return smalltalk.withContext(function($ctx1) {
  379. var $1,$2;
  380. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  381. if(($receiver = $1) == nil || $receiver == null){
  382. $1;
  383. } else {
  384. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  385. $ctx1.sendIdx[","]=1;
  386. self._error_($2);
  387. };
  388. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  389. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  390. args: ["aClass", "aClassName"],
  391. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
  392. messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "copyClass:named:", "new"],
  393. referencedClasses: ["Smalltalk", "ClassBuilder"]
  394. }),
  395. smalltalk.Environment);
  396. smalltalk.addMethod(
  397. smalltalk.method({
  398. selector: "doItReceiver",
  399. category: 'accessing',
  400. fn: function (){
  401. var self=this;
  402. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  403. return smalltalk.withContext(function($ctx1) {
  404. var $1;
  405. $1=_st($DoIt())._new();
  406. return $1;
  407. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},smalltalk.Environment)})},
  408. args: [],
  409. source: "doItReceiver\x0a\x09^ DoIt new",
  410. messageSends: ["new"],
  411. referencedClasses: ["DoIt"]
  412. }),
  413. smalltalk.Environment);
  414. smalltalk.addMethod(
  415. smalltalk.method({
  416. selector: "eval:on:",
  417. category: 'actions',
  418. fn: function (aString,aReceiver){
  419. var self=this;
  420. var compiler;
  421. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  422. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  423. return smalltalk.withContext(function($ctx1) {
  424. var $1,$2;
  425. var $early={};
  426. try {
  427. compiler=_st($Compiler())._new();
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(compiler)._parseExpression_(aString);
  431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  432. return smalltalk.withContext(function($ctx2) {
  433. $1=self._alert_(_st(ex)._messageText());
  434. throw $early=[$1];
  435. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  436. $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
  437. return $2;
  438. }
  439. catch(e) {if(e===$early)return e[0]; throw e}
  440. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler},smalltalk.Environment)})},
  441. args: ["aString", "aReceiver"],
  442. source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ self alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
  443. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"],
  444. referencedClasses: ["Compiler", "Error"]
  445. }),
  446. smalltalk.Environment);
  447. smalltalk.addMethod(
  448. smalltalk.method({
  449. selector: "evaluate:on:do:",
  450. category: 'error handling',
  451. fn: function (aBlock,anErrorClass,exceptionBlock){
  452. var self=this;
  453. return smalltalk.withContext(function($ctx1) {
  454. var $1;
  455. self._try_catch_(aBlock,(function(exception){
  456. return smalltalk.withContext(function($ctx2) {
  457. $1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
  458. if(smalltalk.assert($1)){
  459. return _st(exceptionBlock)._value_(exception);
  460. } else {
  461. return _st(exception)._signal();
  462. };
  463. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)})}));
  464. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},smalltalk.Environment)})},
  465. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  466. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09self try: aBlock catch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
  467. messageSends: ["try:catch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "signal"],
  468. referencedClasses: []
  469. }),
  470. smalltalk.Environment);
  471. smalltalk.addMethod(
  472. smalltalk.method({
  473. selector: "inspect:",
  474. category: 'actions',
  475. fn: function (anObject){
  476. var self=this;
  477. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  478. return smalltalk.withContext(function($ctx1) {
  479. _st(_st($InspectorHandler())._inspector())._inspect_(anObject);
  480. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Environment)})},
  481. args: ["anObject"],
  482. source: "inspect: anObject\x0a\x09InspectorHandler inspector inspect: anObject",
  483. messageSends: ["inspect:", "inspector"],
  484. referencedClasses: ["InspectorHandler"]
  485. }),
  486. smalltalk.Environment);
  487. smalltalk.addMethod(
  488. smalltalk.method({
  489. selector: "moveClass:toPackage:",
  490. category: 'actions',
  491. fn: function (aClass,aPackageName){
  492. var self=this;
  493. var package_;
  494. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  495. return smalltalk.withContext(function($ctx1) {
  496. var $1,$2;
  497. package_=_st($Package())._named_(aPackageName);
  498. $1=package_;
  499. if(($receiver = $1) == nil || $receiver == null){
  500. self._error_("Invalid package name");
  501. } else {
  502. $1;
  503. };
  504. $2=_st(package_).__eq_eq(_st(aClass)._package());
  505. if(smalltalk.assert($2)){
  506. return self;
  507. };
  508. _st(aClass)._package_(package_);
  509. return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.Environment)})},
  510. args: ["aClass", "aPackageName"],
  511. source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package",
  512. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
  513. referencedClasses: ["Package"]
  514. }),
  515. smalltalk.Environment);
  516. smalltalk.addMethod(
  517. smalltalk.method({
  518. selector: "moveMethod:toClass:",
  519. category: 'actions',
  520. fn: function (aMethod,aClassName){
  521. var self=this;
  522. var destinationClass;
  523. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  524. return smalltalk.withContext(function($ctx1) {
  525. var $1,$3,$4,$2;
  526. destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
  527. $1=destinationClass;
  528. if(($receiver = $1) == nil || $receiver == null){
  529. self._error_("Invalid class name");
  530. } else {
  531. $1;
  532. };
  533. $3=destinationClass;
  534. $4=_st(aMethod)._methodClass();
  535. $ctx1.sendIdx["methodClass"]=1;
  536. $2=_st($3).__eq_eq($4);
  537. if(smalltalk.assert($2)){
  538. return self;
  539. };
  540. _st(destinationClass)._compile_category_(_st(aMethod)._source(),_st(aMethod)._protocol());
  541. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  542. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.Environment)})},
  543. args: ["aMethod", "aClassName"],
  544. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := Smalltalk current at: aClassName asSymbol.\x0a\x09destinationClass ifNil: [ self error: 'Invalid class name' ].\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09category: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  545. messageSends: ["at:", "current", "asSymbol", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"],
  546. referencedClasses: ["Smalltalk"]
  547. }),
  548. smalltalk.Environment);
  549. smalltalk.addMethod(
  550. smalltalk.method({
  551. selector: "moveMethod:toProtocol:",
  552. category: 'actions',
  553. fn: function (aMethod,aProtocol){
  554. var self=this;
  555. return smalltalk.withContext(function($ctx1) {
  556. _st(aMethod)._category_(aProtocol);
  557. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.Environment)})},
  558. args: ["aMethod", "aProtocol"],
  559. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol",
  560. messageSends: ["category:"],
  561. referencedClasses: []
  562. }),
  563. smalltalk.Environment);
  564. smalltalk.addMethod(
  565. smalltalk.method({
  566. selector: "packages",
  567. category: 'accessing',
  568. fn: function (){
  569. var self=this;
  570. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  571. return smalltalk.withContext(function($ctx1) {
  572. var $1;
  573. $1=_st(_st($Smalltalk())._current())._packages();
  574. return $1;
  575. }, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Environment)})},
  576. args: [],
  577. source: "packages\x0a\x09^ Smalltalk current packages",
  578. messageSends: ["packages", "current"],
  579. referencedClasses: ["Smalltalk"]
  580. }),
  581. smalltalk.Environment);
  582. smalltalk.addMethod(
  583. smalltalk.method({
  584. selector: "registerErrorHandler:",
  585. category: 'actions',
  586. fn: function (anErrorHandler){
  587. var self=this;
  588. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  589. return smalltalk.withContext(function($ctx1) {
  590. _st($ErrorHandler())._setCurrent_(anErrorHandler);
  591. return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},smalltalk.Environment)})},
  592. args: ["anErrorHandler"],
  593. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler setCurrent: anErrorHandler",
  594. messageSends: ["setCurrent:"],
  595. referencedClasses: ["ErrorHandler"]
  596. }),
  597. smalltalk.Environment);
  598. smalltalk.addMethod(
  599. smalltalk.method({
  600. selector: "registerInspector:",
  601. category: 'actions',
  602. fn: function (anInspector){
  603. var self=this;
  604. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  605. return smalltalk.withContext(function($ctx1) {
  606. _st($InspectorHandler())._register_(anInspector);
  607. return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},smalltalk.Environment)})},
  608. args: ["anInspector"],
  609. source: "registerInspector: anInspector\x0a\x09InspectorHandler register: anInspector",
  610. messageSends: ["register:"],
  611. referencedClasses: ["InspectorHandler"]
  612. }),
  613. smalltalk.Environment);
  614. smalltalk.addMethod(
  615. smalltalk.method({
  616. selector: "registerProgressHandler:",
  617. category: 'actions',
  618. fn: function (aProgressHandler){
  619. var self=this;
  620. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  621. return smalltalk.withContext(function($ctx1) {
  622. _st($ProgressHandler())._setCurrent_(aProgressHandler);
  623. return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},smalltalk.Environment)})},
  624. args: ["aProgressHandler"],
  625. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler setCurrent: aProgressHandler",
  626. messageSends: ["setCurrent:"],
  627. referencedClasses: ["ProgressHandler"]
  628. }),
  629. smalltalk.Environment);
  630. smalltalk.addMethod(
  631. smalltalk.method({
  632. selector: "removeClass:",
  633. category: 'actions',
  634. fn: function (aClass){
  635. var self=this;
  636. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  637. return smalltalk.withContext(function($ctx1) {
  638. _st(_st($Smalltalk())._current())._removeClass_(aClass);
  639. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Environment)})},
  640. args: ["aClass"],
  641. source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
  642. messageSends: ["removeClass:", "current"],
  643. referencedClasses: ["Smalltalk"]
  644. }),
  645. smalltalk.Environment);
  646. smalltalk.addMethod(
  647. smalltalk.method({
  648. selector: "removeMethod:",
  649. category: 'actions',
  650. fn: function (aMethod){
  651. var self=this;
  652. return smalltalk.withContext(function($ctx1) {
  653. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  654. return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},smalltalk.Environment)})},
  655. args: ["aMethod"],
  656. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  657. messageSends: ["removeCompiledMethod:", "methodClass"],
  658. referencedClasses: []
  659. }),
  660. smalltalk.Environment);
  661. smalltalk.addMethod(
  662. smalltalk.method({
  663. selector: "removeProtocol:from:",
  664. category: 'actions',
  665. fn: function (aString,aClass){
  666. var self=this;
  667. return smalltalk.withContext(function($ctx1) {
  668. _st(_st(_st(aClass)._methods())._select_((function(each){
  669. return smalltalk.withContext(function($ctx2) {
  670. return _st(_st(each)._protocol()).__eq(aString);
  671. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._do_((function(each){
  672. return smalltalk.withContext(function($ctx2) {
  673. return _st(aClass)._removeCompiledMethod_(each);
  674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  675. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  676. args: ["aString", "aClass"],
  677. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  678. messageSends: ["do:", "select:", "methods", "=", "protocol", "removeCompiledMethod:"],
  679. referencedClasses: []
  680. }),
  681. smalltalk.Environment);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "renameClass:to:",
  685. category: 'actions',
  686. fn: function (aClass,aClassName){
  687. var self=this;
  688. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  689. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  690. return smalltalk.withContext(function($ctx1) {
  691. var $1,$2;
  692. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  693. if(($receiver = $1) == nil || $receiver == null){
  694. $1;
  695. } else {
  696. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  697. $ctx1.sendIdx[","]=1;
  698. self._error_($2);
  699. };
  700. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  701. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  702. args: ["aClass", "aClassName"],
  703. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
  704. messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "renameClass:to:", "new"],
  705. referencedClasses: ["Smalltalk", "ClassBuilder"]
  706. }),
  707. smalltalk.Environment);
  708. smalltalk.addMethod(
  709. smalltalk.method({
  710. selector: "renameProtocol:to:in:",
  711. category: 'actions',
  712. fn: function (aString,anotherString,aClass){
  713. var self=this;
  714. return smalltalk.withContext(function($ctx1) {
  715. _st(_st(_st(aClass)._methods())._select_((function(each){
  716. return smalltalk.withContext(function($ctx2) {
  717. return _st(_st(each)._protocol()).__eq(aString);
  718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._do_((function(each){
  719. return smalltalk.withContext(function($ctx2) {
  720. return _st(each)._protocol_(anotherString);
  721. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  722. return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},smalltalk.Environment)})},
  723. args: ["aString", "anotherString", "aClass"],
  724. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  725. messageSends: ["do:", "select:", "methods", "=", "protocol", "protocol:"],
  726. referencedClasses: []
  727. }),
  728. smalltalk.Environment);
  729. smalltalk.addMethod(
  730. smalltalk.method({
  731. selector: "setClassCommentOf:to:",
  732. category: 'actions',
  733. fn: function (aClass,aString){
  734. var self=this;
  735. return smalltalk.withContext(function($ctx1) {
  736. _st(aClass)._comment_(aString);
  737. return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},smalltalk.Environment)})},
  738. args: ["aClass", "aString"],
  739. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  740. messageSends: ["comment:"],
  741. referencedClasses: []
  742. }),
  743. smalltalk.Environment);
  744. smalltalk.addMethod(
  745. smalltalk.method({
  746. selector: "systemAnnouncer",
  747. category: 'accessing',
  748. fn: function (){
  749. var self=this;
  750. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  751. return smalltalk.withContext(function($ctx1) {
  752. var $1;
  753. $1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
  754. $ctx1.sendIdx["current"]=1;
  755. return $1;
  756. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})},
  757. args: [],
  758. source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current",
  759. messageSends: ["current", "at:"],
  760. referencedClasses: ["Smalltalk"]
  761. }),
  762. smalltalk.Environment);
  763. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Infrastructure');
  764. smalltalk.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  765. smalltalk.addMethod(
  766. smalltalk.method({
  767. selector: "addObjectVariablesTo:",
  768. category: 'proxy',
  769. fn: function (aDictionary){
  770. var self=this;
  771. return smalltalk.withContext(function($ctx1) {
  772. for(var i in self['@jsObject']) {
  773. aDictionary._at_put_(i, self['@jsObject'][i]);
  774. }
  775. ;
  776. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},smalltalk.JSObjectProxy)})},
  777. args: ["aDictionary"],
  778. source: "addObjectVariablesTo: aDictionary\x0a\x09<\x0a\x09\x09for(var i in self['@jsObject']) {\x0a\x09\x09\x09aDictionary._at_put_(i, self['@jsObject'][i]);\x0a\x09\x09}\x0a\x09>",
  779. messageSends: [],
  780. referencedClasses: []
  781. }),
  782. smalltalk.JSObjectProxy);
  783. smalltalk.addMethod(
  784. smalltalk.method({
  785. selector: "at:",
  786. category: 'accessing',
  787. fn: function (aString){
  788. var self=this;
  789. return smalltalk.withContext(function($ctx1) {
  790. return self['@jsObject'][aString];
  791. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})},
  792. args: ["aString"],
  793. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  794. messageSends: [],
  795. referencedClasses: []
  796. }),
  797. smalltalk.JSObjectProxy);
  798. smalltalk.addMethod(
  799. smalltalk.method({
  800. selector: "at:ifAbsent:",
  801. category: 'accessing',
  802. fn: function (aString,aBlock){
  803. var self=this;
  804. return smalltalk.withContext(function($ctx1) {
  805. var obj = self['@jsObject'];
  806. return aString in obj ? obj[aString] : aBlock._value();
  807. ;
  808. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  809. args: ["aString", "aBlock"],
  810. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09>",
  811. messageSends: [],
  812. referencedClasses: []
  813. }),
  814. smalltalk.JSObjectProxy);
  815. smalltalk.addMethod(
  816. smalltalk.method({
  817. selector: "at:ifPresent:",
  818. category: 'accessing',
  819. fn: function (aString,aBlock){
  820. var self=this;
  821. return smalltalk.withContext(function($ctx1) {
  822. var obj = self['@jsObject'];
  823. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  824. ;
  825. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  826. args: ["aString", "aBlock"],
  827. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09>",
  828. messageSends: [],
  829. referencedClasses: []
  830. }),
  831. smalltalk.JSObjectProxy);
  832. smalltalk.addMethod(
  833. smalltalk.method({
  834. selector: "at:ifPresent:ifAbsent:",
  835. category: 'accessing',
  836. fn: function (aString,aBlock,anotherBlock){
  837. var self=this;
  838. return smalltalk.withContext(function($ctx1) {
  839. var obj = self['@jsObject'];
  840. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  841. ;
  842. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSObjectProxy)})},
  843. args: ["aString", "aBlock", "anotherBlock"],
  844. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
  845. messageSends: [],
  846. referencedClasses: []
  847. }),
  848. smalltalk.JSObjectProxy);
  849. smalltalk.addMethod(
  850. smalltalk.method({
  851. selector: "at:put:",
  852. category: 'accessing',
  853. fn: function (aString,anObject){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. self['@jsObject'][aString] = anObject;
  857. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.JSObjectProxy)})},
  858. args: ["aString", "anObject"],
  859. source: "at: aString put: anObject\x0a\x09<self['@jsObject'][aString] = anObject>",
  860. messageSends: [],
  861. referencedClasses: []
  862. }),
  863. smalltalk.JSObjectProxy);
  864. smalltalk.addMethod(
  865. smalltalk.method({
  866. selector: "doesNotUnderstand:",
  867. category: 'proxy',
  868. fn: function (aMessage){
  869. var self=this;
  870. return smalltalk.withContext(function($ctx1) {
  871. var $2,$1;
  872. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  873. if(($receiver = $2) == nil || $receiver == null){
  874. $1=smalltalk.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  875. } else {
  876. var jsSelector;
  877. jsSelector=$receiver;
  878. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  879. };
  880. return $1;
  881. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.JSObjectProxy)})},
  882. args: ["aMessage"],
  883. source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptSelector)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments ]",
  884. messageSends: ["ifNil:ifNotNil:", "lookupProperty:", "asJavaScriptSelector", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"],
  885. referencedClasses: []
  886. }),
  887. smalltalk.JSObjectProxy);
  888. smalltalk.addMethod(
  889. smalltalk.method({
  890. selector: "forwardMessage:withArguments:",
  891. category: 'proxy',
  892. fn: function (aString,anArray){
  893. var self=this;
  894. return smalltalk.withContext(function($ctx1) {
  895. return smalltalk.send(self._jsObject(), aString, anArray);
  896. ;
  897. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},smalltalk.JSObjectProxy)})},
  898. args: ["aString", "anArray"],
  899. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  900. messageSends: [],
  901. referencedClasses: []
  902. }),
  903. smalltalk.JSObjectProxy);
  904. smalltalk.addMethod(
  905. smalltalk.method({
  906. selector: "inspectOn:",
  907. category: 'proxy',
  908. fn: function (anInspector){
  909. var self=this;
  910. var variables;
  911. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  912. return smalltalk.withContext(function($ctx1) {
  913. variables=_st($Dictionary())._new();
  914. _st(variables)._at_put_("#self",self._jsObject());
  915. _st(anInspector)._setLabel_(self._printString());
  916. self._addObjectVariablesTo_(variables);
  917. _st(anInspector)._setVariables_(variables);
  918. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.JSObjectProxy)})},
  919. args: ["anInspector"],
  920. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09self addObjectVariablesTo: variables.\x0a\x09anInspector setVariables: variables",
  921. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  922. referencedClasses: ["Dictionary"]
  923. }),
  924. smalltalk.JSObjectProxy);
  925. smalltalk.addMethod(
  926. smalltalk.method({
  927. selector: "jsObject",
  928. category: 'accessing',
  929. fn: function (){
  930. var self=this;
  931. return smalltalk.withContext(function($ctx1) {
  932. var $1;
  933. $1=self["@jsObject"];
  934. return $1;
  935. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
  936. args: [],
  937. source: "jsObject\x0a\x09^ jsObject",
  938. messageSends: [],
  939. referencedClasses: []
  940. }),
  941. smalltalk.JSObjectProxy);
  942. smalltalk.addMethod(
  943. smalltalk.method({
  944. selector: "jsObject:",
  945. category: 'accessing',
  946. fn: function (aJSObject){
  947. var self=this;
  948. return smalltalk.withContext(function($ctx1) {
  949. self["@jsObject"]=aJSObject;
  950. return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject},smalltalk.JSObjectProxy)})},
  951. args: ["aJSObject"],
  952. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  953. messageSends: [],
  954. referencedClasses: []
  955. }),
  956. smalltalk.JSObjectProxy);
  957. smalltalk.addMethod(
  958. smalltalk.method({
  959. selector: "keysAndValuesDo:",
  960. category: 'enumerating',
  961. fn: function (aBlock){
  962. var self=this;
  963. return smalltalk.withContext(function($ctx1) {
  964. var o = self['@jsObject'];
  965. for(var i in o) {
  966. aBlock._value_value_(i, o[i]);
  967. }
  968. ;
  969. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.JSObjectProxy)})},
  970. args: ["aBlock"],
  971. source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09>",
  972. messageSends: [],
  973. referencedClasses: []
  974. }),
  975. smalltalk.JSObjectProxy);
  976. smalltalk.addMethod(
  977. smalltalk.method({
  978. selector: "lookupProperty:",
  979. category: 'accessing',
  980. fn: function (aString){
  981. var self=this;
  982. return smalltalk.withContext(function($ctx1) {
  983. return aString in self._jsObject() ? aString : nil;
  984. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},smalltalk.JSObjectProxy)})},
  985. args: ["aString"],
  986. source: "lookupProperty: aString\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<return aString in self._jsObject() ? aString : nil>",
  987. messageSends: [],
  988. referencedClasses: []
  989. }),
  990. smalltalk.JSObjectProxy);
  991. smalltalk.addMethod(
  992. smalltalk.method({
  993. selector: "printOn:",
  994. category: 'printing',
  995. fn: function (aStream){
  996. var self=this;
  997. return smalltalk.withContext(function($ctx1) {
  998. _st(aStream)._nextPutAll_(self._printString());
  999. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
  1000. args: ["aStream"],
  1001. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  1002. messageSends: ["nextPutAll:", "printString"],
  1003. referencedClasses: []
  1004. }),
  1005. smalltalk.JSObjectProxy);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "printString",
  1009. category: 'printing',
  1010. fn: function (){
  1011. var self=this;
  1012. return smalltalk.withContext(function($ctx1) {
  1013. var js = self['@jsObject'];
  1014. return js.toString
  1015. ? js.toString()
  1016. : Object.prototype.toString.call(js)
  1017. ;
  1018. return self}, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.JSObjectProxy)})},
  1019. args: [],
  1020. source: "printString\x0a\x09<\x0a\x09\x09var js = self['@jsObject'];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09>",
  1021. messageSends: [],
  1022. referencedClasses: []
  1023. }),
  1024. smalltalk.JSObjectProxy);
  1025. smalltalk.addMethod(
  1026. smalltalk.method({
  1027. selector: "value",
  1028. category: 'accessing',
  1029. fn: function (){
  1030. var self=this;
  1031. return smalltalk.withContext(function($ctx1) {
  1032. var $1;
  1033. $1=self._at_ifAbsent_("value",(function(){
  1034. return smalltalk.withContext(function($ctx2) {
  1035. return smalltalk.JSObjectProxy.superclass.fn.prototype._value.apply(_st(self), []);
  1036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1037. return $1;
  1038. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.JSObjectProxy)})},
  1039. args: [],
  1040. source: "value\x0a\x09\x22if attribute 'value' exists on the JS object return it,\x0a\x09otherwise return the result of Object>>value.\x22\x0a\x09\x0a\x09^ self \x0a\x09\x09at: 'value' \x0a\x09\x09ifAbsent: [ super value ]",
  1041. messageSends: ["at:ifAbsent:", "value"],
  1042. referencedClasses: []
  1043. }),
  1044. smalltalk.JSObjectProxy);
  1045. smalltalk.addMethod(
  1046. smalltalk.method({
  1047. selector: "on:",
  1048. category: 'instance creation',
  1049. fn: function (aJSObject){
  1050. var self=this;
  1051. return smalltalk.withContext(function($ctx1) {
  1052. var $2,$3,$1;
  1053. $2=self._new();
  1054. _st($2)._jsObject_(aJSObject);
  1055. $3=_st($2)._yourself();
  1056. $1=$3;
  1057. return $1;
  1058. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},smalltalk.JSObjectProxy.klass)})},
  1059. args: ["aJSObject"],
  1060. source: "on: aJSObject\x0a\x09^ self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  1061. messageSends: ["jsObject:", "new", "yourself"],
  1062. referencedClasses: []
  1063. }),
  1064. smalltalk.JSObjectProxy.klass);
  1065. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Infrastructure');
  1066. smalltalk.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  1067. smalltalk.addMethod(
  1068. smalltalk.method({
  1069. selector: "addElement:",
  1070. category: 'accessing',
  1071. fn: function (anObject){
  1072. var self=this;
  1073. return smalltalk.withContext(function($ctx1) {
  1074. self.elements.addElement(anObject);
  1075. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},smalltalk.Organizer)})},
  1076. args: ["anObject"],
  1077. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  1078. messageSends: [],
  1079. referencedClasses: []
  1080. }),
  1081. smalltalk.Organizer);
  1082. smalltalk.addMethod(
  1083. smalltalk.method({
  1084. selector: "elements",
  1085. category: 'accessing',
  1086. fn: function (){
  1087. var self=this;
  1088. return smalltalk.withContext(function($ctx1) {
  1089. var $1;
  1090. $1=_st(self._basicAt_("elements"))._copy();
  1091. return $1;
  1092. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.Organizer)})},
  1093. args: [],
  1094. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  1095. messageSends: ["copy", "basicAt:"],
  1096. referencedClasses: []
  1097. }),
  1098. smalltalk.Organizer);
  1099. smalltalk.addMethod(
  1100. smalltalk.method({
  1101. selector: "removeElement:",
  1102. category: 'accessing',
  1103. fn: function (anObject){
  1104. var self=this;
  1105. return smalltalk.withContext(function($ctx1) {
  1106. self.elements.removeElement(anObject);
  1107. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},smalltalk.Organizer)})},
  1108. args: ["anObject"],
  1109. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  1110. messageSends: [],
  1111. referencedClasses: []
  1112. }),
  1113. smalltalk.Organizer);
  1114. smalltalk.addClass('ClassOrganizer', smalltalk.Organizer, [], 'Kernel-Infrastructure');
  1115. smalltalk.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  1116. smalltalk.addMethod(
  1117. smalltalk.method({
  1118. selector: "addElement:",
  1119. category: 'accessing',
  1120. fn: function (aString){
  1121. var self=this;
  1122. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1123. function $ProtocolAdded(){return smalltalk.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  1124. return smalltalk.withContext(function($ctx1) {
  1125. var $1,$2;
  1126. smalltalk.ClassOrganizer.superclass.fn.prototype._addElement_.apply(_st(self), [aString]);
  1127. $1=_st($ProtocolAdded())._new();
  1128. _st($1)._protocol_(aString);
  1129. _st($1)._theClass_(self._theClass());
  1130. $2=_st($1)._yourself();
  1131. _st(_st($SystemAnnouncer())._current())._announce_($2);
  1132. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  1133. args: ["aString"],
  1134. source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  1135. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  1136. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"]
  1137. }),
  1138. smalltalk.ClassOrganizer);
  1139. smalltalk.addMethod(
  1140. smalltalk.method({
  1141. selector: "removeElement:",
  1142. category: 'accessing',
  1143. fn: function (aString){
  1144. var self=this;
  1145. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1146. function $ProtocolRemoved(){return smalltalk.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  1147. return smalltalk.withContext(function($ctx1) {
  1148. var $1,$2;
  1149. smalltalk.ClassOrganizer.superclass.fn.prototype._removeElement_.apply(_st(self), [aString]);
  1150. $1=_st($ProtocolRemoved())._new();
  1151. _st($1)._protocol_(aString);
  1152. _st($1)._theClass_(self._theClass());
  1153. $2=_st($1)._yourself();
  1154. _st(_st($SystemAnnouncer())._current())._announce_($2);
  1155. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  1156. args: ["aString"],
  1157. source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  1158. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  1159. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"]
  1160. }),
  1161. smalltalk.ClassOrganizer);
  1162. smalltalk.addMethod(
  1163. smalltalk.method({
  1164. selector: "theClass",
  1165. category: 'accessing',
  1166. fn: function (){
  1167. var self=this;
  1168. return smalltalk.withContext(function($ctx1) {
  1169. return self.theClass ;
  1170. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassOrganizer)})},
  1171. args: [],
  1172. source: "theClass\x0a\x09< return self.theClass >",
  1173. messageSends: [],
  1174. referencedClasses: []
  1175. }),
  1176. smalltalk.ClassOrganizer);
  1177. smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Infrastructure');
  1178. smalltalk.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  1179. smalltalk.addClass('Package', smalltalk.Object, ['transport'], 'Kernel-Infrastructure');
  1180. smalltalk.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "basicTransport",
  1184. category: 'accessing',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. return self.transport;
  1189. return self}, function($ctx1) {$ctx1.fill(self,"basicTransport",{},smalltalk.Package)})},
  1190. args: [],
  1191. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.transport>",
  1192. messageSends: [],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.Package);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "classes",
  1199. category: 'classes',
  1200. fn: function (){
  1201. var self=this;
  1202. return smalltalk.withContext(function($ctx1) {
  1203. var $1;
  1204. $1=_st(_st(_st(self._organization())._elements())._asSet())._asArray();
  1205. return $1;
  1206. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Package)})},
  1207. args: [],
  1208. source: "classes\x0a\x09^ self organization elements asSet asArray",
  1209. messageSends: ["asArray", "asSet", "elements", "organization"],
  1210. referencedClasses: []
  1211. }),
  1212. smalltalk.Package);
  1213. smalltalk.addMethod(
  1214. smalltalk.method({
  1215. selector: "definition",
  1216. category: 'accessing',
  1217. fn: function (){
  1218. var self=this;
  1219. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1220. return smalltalk.withContext(function($ctx1) {
  1221. var $2,$4,$5,$3,$7,$6,$8,$9,$1;
  1222. $1=_st($String())._streamContents_((function(stream){
  1223. return smalltalk.withContext(function($ctx2) {
  1224. $2=_st(self._class())._name();
  1225. $ctx2.sendIdx["name"]=1;
  1226. _st(stream)._nextPutAll_($2);
  1227. $ctx2.sendIdx["nextPutAll:"]=1;
  1228. $4=_st($String())._lf();
  1229. $ctx2.sendIdx["lf"]=1;
  1230. $5=_st($String())._tab();
  1231. $ctx2.sendIdx["tab"]=1;
  1232. $3=_st($4).__comma($5);
  1233. $ctx2.sendIdx[","]=1;
  1234. _st(stream)._nextPutAll_($3);
  1235. $ctx2.sendIdx["nextPutAll:"]=2;
  1236. _st(stream)._nextPutAll_(" named: ");
  1237. $ctx2.sendIdx["nextPutAll:"]=3;
  1238. $7="'".__comma(self._name());
  1239. $ctx2.sendIdx[","]=3;
  1240. $6=_st($7).__comma("'");
  1241. $ctx2.sendIdx[","]=2;
  1242. _st(stream)._nextPutAll_($6);
  1243. $ctx2.sendIdx["nextPutAll:"]=4;
  1244. $8=_st(_st($String())._lf()).__comma(_st($String())._tab());
  1245. $ctx2.sendIdx[","]=4;
  1246. _st(stream)._nextPutAll_($8);
  1247. $ctx2.sendIdx["nextPutAll:"]=5;
  1248. _st(stream)._nextPutAll_(" transport: (");
  1249. $ctx2.sendIdx["nextPutAll:"]=6;
  1250. $9=_st(stream)._nextPutAll_(_st(_st(self._transport())._definition()).__comma(")"));
  1251. return $9;
  1252. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  1253. return $1;
  1254. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Package)})},
  1255. args: [],
  1256. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: ' named: ';\x0a\x09\x09\x09nextPutAll: '''', self name, '''';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: ' transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]",
  1257. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "definition", "transport"],
  1258. referencedClasses: ["String"]
  1259. }),
  1260. smalltalk.Package);
  1261. smalltalk.addMethod(
  1262. smalltalk.method({
  1263. selector: "isPackage",
  1264. category: 'testing',
  1265. fn: function (){
  1266. var self=this;
  1267. return smalltalk.withContext(function($ctx1) {
  1268. return true;
  1269. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Package)})},
  1270. args: [],
  1271. source: "isPackage\x0a\x09^ true",
  1272. messageSends: [],
  1273. referencedClasses: []
  1274. }),
  1275. smalltalk.Package);
  1276. smalltalk.addMethod(
  1277. smalltalk.method({
  1278. selector: "loadDependencies",
  1279. category: 'dependencies',
  1280. fn: function (){
  1281. var self=this;
  1282. var classes,packages;
  1283. return smalltalk.withContext(function($ctx1) {
  1284. var $2,$3,$1;
  1285. classes=self._loadDependencyClasses();
  1286. $2=_st(_st(classes)._collect_((function(each){
  1287. return smalltalk.withContext(function($ctx2) {
  1288. return _st(each)._package();
  1289. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asSet();
  1290. _st($2)._remove_ifAbsent_(self,(function(){
  1291. return smalltalk.withContext(function($ctx2) {
  1292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1293. $3=_st($2)._yourself();
  1294. $1=$3;
  1295. return $1;
  1296. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},smalltalk.Package)})},
  1297. args: [],
  1298. source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^ (classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself",
  1299. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"],
  1300. referencedClasses: []
  1301. }),
  1302. smalltalk.Package);
  1303. smalltalk.addMethod(
  1304. smalltalk.method({
  1305. selector: "loadDependencyClasses",
  1306. category: 'dependencies',
  1307. fn: function (){
  1308. var self=this;
  1309. var starCategoryName;
  1310. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1311. return smalltalk.withContext(function($ctx1) {
  1312. var $4,$3,$2,$5,$1;
  1313. starCategoryName="*".__comma(self._name());
  1314. $4=self._classes();
  1315. $ctx1.sendIdx["classes"]=1;
  1316. $3=_st($4)._collect_((function(each){
  1317. return smalltalk.withContext(function($ctx2) {
  1318. return _st(each)._superclass();
  1319. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1320. $2=_st($3)._asSet();
  1321. _st($2)._remove_ifAbsent_(nil,(function(){
  1322. return smalltalk.withContext(function($ctx2) {
  1323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1324. _st($2)._addAll_(_st(_st(_st($Smalltalk())._current())._classes())._select_((function(each){
  1325. return smalltalk.withContext(function($ctx2) {
  1326. return _st(_st(each)._protocols())._includes_(starCategoryName);
  1327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})})));
  1328. $5=_st($2)._yourself();
  1329. $1=$5;
  1330. return $1;
  1331. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},smalltalk.Package)})},
  1332. args: [],
  1333. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk current classes select: [ :each | each protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
  1334. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "current", "includes:", "protocols", "yourself"],
  1335. referencedClasses: ["Smalltalk"]
  1336. }),
  1337. smalltalk.Package);
  1338. smalltalk.addMethod(
  1339. smalltalk.method({
  1340. selector: "name",
  1341. category: 'accessing',
  1342. fn: function (){
  1343. var self=this;
  1344. return smalltalk.withContext(function($ctx1) {
  1345. return self.pkgName;
  1346. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Package)})},
  1347. args: [],
  1348. source: "name\x0a\x09<return self.pkgName>",
  1349. messageSends: [],
  1350. referencedClasses: []
  1351. }),
  1352. smalltalk.Package);
  1353. smalltalk.addMethod(
  1354. smalltalk.method({
  1355. selector: "name:",
  1356. category: 'accessing',
  1357. fn: function (aString){
  1358. var self=this;
  1359. return smalltalk.withContext(function($ctx1) {
  1360. self.pkgName = aString;
  1361. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.Package)})},
  1362. args: ["aString"],
  1363. source: "name: aString\x0a\x09<self.pkgName = aString>",
  1364. messageSends: [],
  1365. referencedClasses: []
  1366. }),
  1367. smalltalk.Package);
  1368. smalltalk.addMethod(
  1369. smalltalk.method({
  1370. selector: "organization",
  1371. category: 'accessing',
  1372. fn: function (){
  1373. var self=this;
  1374. return smalltalk.withContext(function($ctx1) {
  1375. var $1;
  1376. $1=self._basicAt_("organization");
  1377. return $1;
  1378. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Package)})},
  1379. args: [],
  1380. source: "organization\x0a\x09^ self basicAt: 'organization'",
  1381. messageSends: ["basicAt:"],
  1382. referencedClasses: []
  1383. }),
  1384. smalltalk.Package);
  1385. smalltalk.addMethod(
  1386. smalltalk.method({
  1387. selector: "printOn:",
  1388. category: 'printing',
  1389. fn: function (aStream){
  1390. var self=this;
  1391. return smalltalk.withContext(function($ctx1) {
  1392. var $1;
  1393. smalltalk.Package.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  1394. _st(aStream)._nextPutAll_(" (");
  1395. $ctx1.sendIdx["nextPutAll:"]=1;
  1396. _st(aStream)._nextPutAll_(self._name());
  1397. $ctx1.sendIdx["nextPutAll:"]=2;
  1398. $1=_st(aStream)._nextPutAll_(")");
  1399. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Package)})},
  1400. args: ["aStream"],
  1401. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  1402. messageSends: ["printOn:", "nextPutAll:", "name"],
  1403. referencedClasses: []
  1404. }),
  1405. smalltalk.Package);
  1406. smalltalk.addMethod(
  1407. smalltalk.method({
  1408. selector: "setupClasses",
  1409. category: 'classes',
  1410. fn: function (){
  1411. var self=this;
  1412. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1413. return smalltalk.withContext(function($ctx1) {
  1414. var $1,$2;
  1415. $1=self._classes();
  1416. _st($1)._do_((function(each){
  1417. return smalltalk.withContext(function($ctx2) {
  1418. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  1419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1420. $ctx1.sendIdx["do:"]=1;
  1421. $2=_st($1)._do_((function(each){
  1422. return smalltalk.withContext(function($ctx2) {
  1423. return _st(each)._initialize();
  1424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1425. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},smalltalk.Package)})},
  1426. args: [],
  1427. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  1428. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"],
  1429. referencedClasses: ["ClassBuilder"]
  1430. }),
  1431. smalltalk.Package);
  1432. smalltalk.addMethod(
  1433. smalltalk.method({
  1434. selector: "sortedClasses",
  1435. category: 'classes',
  1436. fn: function (){
  1437. var self=this;
  1438. return smalltalk.withContext(function($ctx1) {
  1439. var $1;
  1440. $1=_st(self._class())._sortedClasses_(self._classes());
  1441. return $1;
  1442. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},smalltalk.Package)})},
  1443. args: [],
  1444. source: "sortedClasses\x0a\x09\x22Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143).\x22\x0a\x0a\x09^ self class sortedClasses: self classes",
  1445. messageSends: ["sortedClasses:", "class", "classes"],
  1446. referencedClasses: []
  1447. }),
  1448. smalltalk.Package);
  1449. smalltalk.addMethod(
  1450. smalltalk.method({
  1451. selector: "transport",
  1452. category: 'accessing',
  1453. fn: function (){
  1454. var self=this;
  1455. function $PackageTransport(){return smalltalk.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  1456. return smalltalk.withContext(function($ctx1) {
  1457. var $2,$3,$4,$1;
  1458. $2=self["@transport"];
  1459. if(($receiver = $2) == nil || $receiver == null){
  1460. $3=_st($PackageTransport())._fromJson_(self._basicTransport());
  1461. _st($3)._package_(self);
  1462. $4=_st($3)._yourself();
  1463. self["@transport"]=$4;
  1464. $1=self["@transport"];
  1465. } else {
  1466. $1=$2;
  1467. };
  1468. return $1;
  1469. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  1470. args: [],
  1471. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  1472. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"],
  1473. referencedClasses: ["PackageTransport"]
  1474. }),
  1475. smalltalk.Package);
  1476. smalltalk.addMethod(
  1477. smalltalk.method({
  1478. selector: "transport:",
  1479. category: 'accessing',
  1480. fn: function (aPackageTransport){
  1481. var self=this;
  1482. return smalltalk.withContext(function($ctx1) {
  1483. self["@transport"]=aPackageTransport;
  1484. _st(aPackageTransport)._package_(self);
  1485. return self}, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},smalltalk.Package)})},
  1486. args: ["aPackageTransport"],
  1487. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  1488. messageSends: ["package:"],
  1489. referencedClasses: []
  1490. }),
  1491. smalltalk.Package);
  1492. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  1493. smalltalk.addMethod(
  1494. smalltalk.method({
  1495. selector: "named:",
  1496. category: 'accessing',
  1497. fn: function (aPackageName){
  1498. var self=this;
  1499. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1500. return smalltalk.withContext(function($ctx1) {
  1501. var $2,$1;
  1502. $2=_st($Smalltalk())._current();
  1503. $ctx1.sendIdx["current"]=1;
  1504. $1=_st($2)._packageAt_ifAbsent_(aPackageName,(function(){
  1505. return smalltalk.withContext(function($ctx2) {
  1506. return _st(_st($Smalltalk())._current())._createPackage_(aPackageName);
  1507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1508. return $1;
  1509. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  1510. args: ["aPackageName"],
  1511. source: "named: aPackageName\x0a\x09^ Smalltalk current \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk current createPackage: aPackageName ]",
  1512. messageSends: ["packageAt:ifAbsent:", "current", "createPackage:"],
  1513. referencedClasses: ["Smalltalk"]
  1514. }),
  1515. smalltalk.Package.klass);
  1516. smalltalk.addMethod(
  1517. smalltalk.method({
  1518. selector: "named:ifAbsent:",
  1519. category: 'accessing',
  1520. fn: function (aPackageName,aBlock){
  1521. var self=this;
  1522. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1523. return smalltalk.withContext(function($ctx1) {
  1524. var $1;
  1525. $1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock);
  1526. return $1;
  1527. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})},
  1528. args: ["aPackageName", "aBlock"],
  1529. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  1530. messageSends: ["packageAt:ifAbsent:", "current"],
  1531. referencedClasses: ["Smalltalk"]
  1532. }),
  1533. smalltalk.Package.klass);
  1534. smalltalk.addMethod(
  1535. smalltalk.method({
  1536. selector: "named:transport:",
  1537. category: 'accessing',
  1538. fn: function (aPackageName,aTransport){
  1539. var self=this;
  1540. var package_;
  1541. return smalltalk.withContext(function($ctx1) {
  1542. var $1;
  1543. package_=self._named_(aPackageName);
  1544. _st(package_)._transport_(aTransport);
  1545. $1=package_;
  1546. return $1;
  1547. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},smalltalk.Package.klass)})},
  1548. args: ["aPackageName", "aTransport"],
  1549. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  1550. messageSends: ["named:", "transport:"],
  1551. referencedClasses: []
  1552. }),
  1553. smalltalk.Package.klass);
  1554. smalltalk.addMethod(
  1555. smalltalk.method({
  1556. selector: "sortedClasses:",
  1557. category: 'sorting',
  1558. fn: function (classes){
  1559. var self=this;
  1560. var children,others,nodes,expandedClasses;
  1561. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  1562. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1563. return smalltalk.withContext(function($ctx1) {
  1564. var $1,$3,$2,$4;
  1565. children=[];
  1566. others=[];
  1567. _st(classes)._do_((function(each){
  1568. return smalltalk.withContext(function($ctx2) {
  1569. $1=_st(classes)._includes_(_st(each)._superclass());
  1570. if(smalltalk.assert($1)){
  1571. return _st(others)._add_(each);
  1572. } else {
  1573. return _st(children)._add_(each);
  1574. $ctx2.sendIdx["add:"]=1;
  1575. };
  1576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1577. $ctx1.sendIdx["do:"]=1;
  1578. nodes=_st(children)._collect_((function(each){
  1579. return smalltalk.withContext(function($ctx2) {
  1580. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  1581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  1582. nodes=_st(nodes)._sorted_((function(a,b){
  1583. return smalltalk.withContext(function($ctx2) {
  1584. $3=_st(a)._theClass();
  1585. $ctx2.sendIdx["theClass"]=1;
  1586. $2=_st($3)._name();
  1587. $ctx2.sendIdx["name"]=1;
  1588. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  1589. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)})}));
  1590. expandedClasses=_st($Array())._new();
  1591. _st(nodes)._do_((function(aNode){
  1592. return smalltalk.withContext(function($ctx2) {
  1593. return _st(aNode)._traverseClassesWith_(expandedClasses);
  1594. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)})}));
  1595. $4=expandedClasses;
  1596. return $4;
  1597. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},smalltalk.Package.klass)})},
  1598. args: ["classes"],
  1599. source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [ :each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [ children add: each ]\x0a\x09\x09\x09ifTrue: [ others add: each ]].\x0a\x09nodes := children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0 ].\x0a\x09nodes := nodes sorted: [ :a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses ].\x0a\x09^ expandedClasses",
  1600. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  1601. referencedClasses: ["ClassSorterNode", "Array"]
  1602. }),
  1603. smalltalk.Package.klass);
  1604. smalltalk.addClass('PlatformInterface', smalltalk.Object, [], 'Kernel-Infrastructure');
  1605. smalltalk.PlatformInterface.comment="I am single entry point to UI and environment interface.\x0aMy `initialize` tries several options (for now, browser environment only) to set myself up.\x0a\x0a## API\x0a\x0a PlatformInterface alert: 'Hey, there is a problem'.\x0a PlatformInterface confirm: 'Affirmative?'.\x0a PlatformInterface prompt: 'Your name:'.\x0a\x0a PlatformInterface ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  1606. smalltalk.PlatformInterface.klass.iVarNames = ['worker'];
  1607. smalltalk.addMethod(
  1608. smalltalk.method({
  1609. selector: "ajax:",
  1610. category: 'actions',
  1611. fn: function (anObject){
  1612. var self=this;
  1613. return smalltalk.withContext(function($ctx1) {
  1614. var $2,$1;
  1615. $2=self["@worker"];
  1616. if(($receiver = $2) == nil || $receiver == null){
  1617. $1=self._error_("ajax: not available");
  1618. } else {
  1619. $1=_st(self["@worker"])._ajax_(anObject);
  1620. };
  1621. return $1;
  1622. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},smalltalk.PlatformInterface.klass)})},
  1623. args: ["anObject"],
  1624. source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
  1625. messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"],
  1626. referencedClasses: []
  1627. }),
  1628. smalltalk.PlatformInterface.klass);
  1629. smalltalk.addMethod(
  1630. smalltalk.method({
  1631. selector: "alert:",
  1632. category: 'actions',
  1633. fn: function (aString){
  1634. var self=this;
  1635. return smalltalk.withContext(function($ctx1) {
  1636. var $2,$1;
  1637. $2=self["@worker"];
  1638. if(($receiver = $2) == nil || $receiver == null){
  1639. $1=self._error_("alert: not available");
  1640. } else {
  1641. $1=_st(self["@worker"])._alert_(aString);
  1642. };
  1643. return $1;
  1644. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},smalltalk.PlatformInterface.klass)})},
  1645. args: ["aString"],
  1646. source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
  1647. messageSends: ["ifNotNil:ifNil:", "alert:", "error:"],
  1648. referencedClasses: []
  1649. }),
  1650. smalltalk.PlatformInterface.klass);
  1651. smalltalk.addMethod(
  1652. smalltalk.method({
  1653. selector: "confirm:",
  1654. category: 'actions',
  1655. fn: function (aString){
  1656. var self=this;
  1657. return smalltalk.withContext(function($ctx1) {
  1658. var $2,$1;
  1659. $2=self["@worker"];
  1660. if(($receiver = $2) == nil || $receiver == null){
  1661. $1=self._error_("confirm: not available");
  1662. } else {
  1663. $1=_st(self["@worker"])._confirm_(aString);
  1664. };
  1665. return $1;
  1666. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},smalltalk.PlatformInterface.klass)})},
  1667. args: ["aString"],
  1668. source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
  1669. messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"],
  1670. referencedClasses: []
  1671. }),
  1672. smalltalk.PlatformInterface.klass);
  1673. smalltalk.addMethod(
  1674. smalltalk.method({
  1675. selector: "existsGlobal:",
  1676. category: 'actions',
  1677. fn: function (aString){
  1678. var self=this;
  1679. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  1680. return smalltalk.withContext(function($ctx1) {
  1681. var $1;
  1682. $1=_st(_st($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  1683. return smalltalk.withContext(function($ctx2) {
  1684. return true;
  1685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1686. return smalltalk.withContext(function($ctx2) {
  1687. return false;
  1688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1689. return $1;
  1690. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},smalltalk.PlatformInterface.klass)})},
  1691. args: ["aString"],
  1692. source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  1693. messageSends: ["at:ifPresent:ifAbsent:", "globals"],
  1694. referencedClasses: ["PlatformInterface"]
  1695. }),
  1696. smalltalk.PlatformInterface.klass);
  1697. smalltalk.addMethod(
  1698. smalltalk.method({
  1699. selector: "globals",
  1700. category: 'accessing',
  1701. fn: function (){
  1702. var self=this;
  1703. return smalltalk.withContext(function($ctx1) {
  1704. return (new Function('return this'))();;
  1705. return self}, function($ctx1) {$ctx1.fill(self,"globals",{},smalltalk.PlatformInterface.klass)})},
  1706. args: [],
  1707. source: "globals\x0a\x09<return (new Function('return this'))();>",
  1708. messageSends: [],
  1709. referencedClasses: []
  1710. }),
  1711. smalltalk.PlatformInterface.klass);
  1712. smalltalk.addMethod(
  1713. smalltalk.method({
  1714. selector: "initialize",
  1715. category: 'initialization',
  1716. fn: function (){
  1717. var self=this;
  1718. var candidate;
  1719. function $BrowserInterface(){return smalltalk.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
  1720. return smalltalk.withContext(function($ctx1) {
  1721. var $1;
  1722. smalltalk.PlatformInterface.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1723. if(($receiver = $BrowserInterface()) == nil || $receiver == null){
  1724. $BrowserInterface();
  1725. } else {
  1726. candidate=_st($BrowserInterface())._new();
  1727. candidate;
  1728. $1=_st(candidate)._isAvailable();
  1729. if(smalltalk.assert($1)){
  1730. self._setWorker_(candidate);
  1731. return self;
  1732. };
  1733. };
  1734. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},smalltalk.PlatformInterface.klass)})},
  1735. args: [],
  1736. source: "initialize\x0a\x09| candidate |\x0a\x09\x0a\x09super initialize.\x0a\x09\x0a\x09BrowserInterface ifNotNil: [\x0a\x09\x09candidate := BrowserInterface new.\x0a\x09\x09candidate isAvailable ifTrue: [ self setWorker: candidate. ^ self ]\x0a\x09]",
  1737. messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"],
  1738. referencedClasses: ["BrowserInterface"]
  1739. }),
  1740. smalltalk.PlatformInterface.klass);
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "prompt:",
  1744. category: 'actions',
  1745. fn: function (aString){
  1746. var self=this;
  1747. return smalltalk.withContext(function($ctx1) {
  1748. var $2,$1;
  1749. $2=self["@worker"];
  1750. if(($receiver = $2) == nil || $receiver == null){
  1751. $1=self._error_("prompt: not available");
  1752. } else {
  1753. $1=_st(self["@worker"])._prompt_(aString);
  1754. };
  1755. return $1;
  1756. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},smalltalk.PlatformInterface.klass)})},
  1757. args: ["aString"],
  1758. source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  1759. messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"],
  1760. referencedClasses: []
  1761. }),
  1762. smalltalk.PlatformInterface.klass);
  1763. smalltalk.addMethod(
  1764. smalltalk.method({
  1765. selector: "setWorker:",
  1766. category: 'accessing',
  1767. fn: function (anObject){
  1768. var self=this;
  1769. return smalltalk.withContext(function($ctx1) {
  1770. self["@worker"]=anObject;
  1771. return self}, function($ctx1) {$ctx1.fill(self,"setWorker:",{anObject:anObject},smalltalk.PlatformInterface.klass)})},
  1772. args: ["anObject"],
  1773. source: "setWorker: anObject\x0a\x09worker := anObject",
  1774. messageSends: [],
  1775. referencedClasses: []
  1776. }),
  1777. smalltalk.PlatformInterface.klass);
  1778. smalltalk.addClass('ProgressHandler', smalltalk.Object, [], 'Kernel-Infrastructure');
  1779. smalltalk.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aSubclasses of can register themselves as the current handler with\x0a`ProgressHandler class >> register`.\x0a\x0aThe default behavior is to simply iterate over the collection.";
  1780. smalltalk.addMethod(
  1781. smalltalk.method({
  1782. selector: "do:on:displaying:",
  1783. category: 'progress handling',
  1784. fn: function (aBlock,aCollection,aString){
  1785. var self=this;
  1786. return smalltalk.withContext(function($ctx1) {
  1787. _st(aCollection)._do_(aBlock);
  1788. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},smalltalk.ProgressHandler)})},
  1789. args: ["aBlock", "aCollection", "aString"],
  1790. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  1791. messageSends: ["do:"],
  1792. referencedClasses: []
  1793. }),
  1794. smalltalk.ProgressHandler);
  1795. smalltalk.ProgressHandler.klass.iVarNames = ['current'];
  1796. smalltalk.addMethod(
  1797. smalltalk.method({
  1798. selector: "current",
  1799. category: 'accessing',
  1800. fn: function (){
  1801. var self=this;
  1802. return smalltalk.withContext(function($ctx1) {
  1803. var $2,$1;
  1804. $2=self["@current"];
  1805. if(($receiver = $2) == nil || $receiver == null){
  1806. self["@current"]=self._new();
  1807. $1=self["@current"];
  1808. } else {
  1809. $1=$2;
  1810. };
  1811. return $1;
  1812. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ProgressHandler.klass)})},
  1813. args: [],
  1814. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  1815. messageSends: ["ifNil:", "new"],
  1816. referencedClasses: []
  1817. }),
  1818. smalltalk.ProgressHandler.klass);
  1819. smalltalk.addMethod(
  1820. smalltalk.method({
  1821. selector: "initialize",
  1822. category: 'initialization',
  1823. fn: function (){
  1824. var self=this;
  1825. return smalltalk.withContext(function($ctx1) {
  1826. self._register();
  1827. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ProgressHandler.klass)})},
  1828. args: [],
  1829. source: "initialize\x0a\x09self register",
  1830. messageSends: ["register"],
  1831. referencedClasses: []
  1832. }),
  1833. smalltalk.ProgressHandler.klass);
  1834. smalltalk.addMethod(
  1835. smalltalk.method({
  1836. selector: "register",
  1837. category: 'initialization',
  1838. fn: function (){
  1839. var self=this;
  1840. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  1841. return smalltalk.withContext(function($ctx1) {
  1842. _st($ProgressHandler())._setCurrent_(self._new());
  1843. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ProgressHandler.klass)})},
  1844. args: [],
  1845. source: "register\x0a\x09ProgressHandler setCurrent: self new",
  1846. messageSends: ["setCurrent:", "new"],
  1847. referencedClasses: ["ProgressHandler"]
  1848. }),
  1849. smalltalk.ProgressHandler.klass);
  1850. smalltalk.addMethod(
  1851. smalltalk.method({
  1852. selector: "setCurrent:",
  1853. category: 'accessing',
  1854. fn: function (anHandler){
  1855. var self=this;
  1856. return smalltalk.withContext(function($ctx1) {
  1857. self["@current"]=anHandler;
  1858. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ProgressHandler.klass)})},
  1859. args: ["anHandler"],
  1860. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  1861. messageSends: [],
  1862. referencedClasses: []
  1863. }),
  1864. smalltalk.ProgressHandler.klass);
  1865. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Infrastructure');
  1866. smalltalk.Smalltalk.comment="I represent the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with class-side method `#current`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work.";
  1867. smalltalk.addMethod(
  1868. smalltalk.method({
  1869. selector: "addGlobalJsVariable:",
  1870. category: 'globals',
  1871. fn: function (aString){
  1872. var self=this;
  1873. return smalltalk.withContext(function($ctx1) {
  1874. _st(self._globalJsVariables())._add_(aString);
  1875. return self}, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},smalltalk.Smalltalk)})},
  1876. args: ["aString"],
  1877. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  1878. messageSends: ["add:", "globalJsVariables"],
  1879. referencedClasses: []
  1880. }),
  1881. smalltalk.Smalltalk);
  1882. smalltalk.addMethod(
  1883. smalltalk.method({
  1884. selector: "amdRequire",
  1885. category: 'accessing amd',
  1886. fn: function (){
  1887. var self=this;
  1888. return smalltalk.withContext(function($ctx1) {
  1889. var $1;
  1890. $1=self._at_("amdRequire");
  1891. return $1;
  1892. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},smalltalk.Smalltalk)})},
  1893. args: [],
  1894. source: "amdRequire\x0a\x09^ self at: 'amdRequire'",
  1895. messageSends: ["at:"],
  1896. referencedClasses: []
  1897. }),
  1898. smalltalk.Smalltalk);
  1899. smalltalk.addMethod(
  1900. smalltalk.method({
  1901. selector: "asSmalltalkException:",
  1902. category: 'error handling',
  1903. fn: function (anObject){
  1904. var self=this;
  1905. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1906. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  1907. return smalltalk.withContext(function($ctx1) {
  1908. var $2,$1;
  1909. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  1910. return smalltalk.withContext(function($ctx2) {
  1911. return _st(anObject)._isKindOf_($Error());
  1912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1913. if(smalltalk.assert($2)){
  1914. $1=anObject;
  1915. } else {
  1916. $1=_st($JavaScriptException())._on_(anObject);
  1917. };
  1918. return $1;
  1919. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})},
  1920. args: ["anObject"],
  1921. source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
  1922. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"],
  1923. referencedClasses: ["Error", "JavaScriptException"]
  1924. }),
  1925. smalltalk.Smalltalk);
  1926. smalltalk.addMethod(
  1927. smalltalk.method({
  1928. selector: "at:",
  1929. category: 'accessing',
  1930. fn: function (aString){
  1931. var self=this;
  1932. return smalltalk.withContext(function($ctx1) {
  1933. var $1;
  1934. $1=self._basicAt_(aString);
  1935. return $1;
  1936. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
  1937. args: ["aString"],
  1938. source: "at: aString\x0a\x09^ self basicAt: aString",
  1939. messageSends: ["basicAt:"],
  1940. referencedClasses: []
  1941. }),
  1942. smalltalk.Smalltalk);
  1943. smalltalk.addMethod(
  1944. smalltalk.method({
  1945. selector: "at:ifAbsent:",
  1946. category: 'accessing',
  1947. fn: function (aKey,aBlock){
  1948. var self=this;
  1949. return smalltalk.withContext(function($ctx1) {
  1950. var $2,$1;
  1951. $2=self._includesKey_(aKey);
  1952. $1=_st($2)._ifTrue_ifFalse_((function(){
  1953. return smalltalk.withContext(function($ctx2) {
  1954. return self._at_(aKey);
  1955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),aBlock);
  1956. return $1;
  1957. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Smalltalk)})},
  1958. args: ["aKey", "aBlock"],
  1959. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self at: aKey ]\x0a\x09\x09ifFalse: aBlock",
  1960. messageSends: ["ifTrue:ifFalse:", "includesKey:", "at:"],
  1961. referencedClasses: []
  1962. }),
  1963. smalltalk.Smalltalk);
  1964. smalltalk.addMethod(
  1965. smalltalk.method({
  1966. selector: "at:put:",
  1967. category: 'accessing',
  1968. fn: function (aString,anObject){
  1969. var self=this;
  1970. return smalltalk.withContext(function($ctx1) {
  1971. var $1;
  1972. $1=self._basicAt_put_(aString,anObject);
  1973. return $1;
  1974. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.Smalltalk)})},
  1975. args: ["aString", "anObject"],
  1976. source: "at: aString put: anObject\x0a\x09^ self basicAt: aString put: anObject",
  1977. messageSends: ["basicAt:put:"],
  1978. referencedClasses: []
  1979. }),
  1980. smalltalk.Smalltalk);
  1981. smalltalk.addMethod(
  1982. smalltalk.method({
  1983. selector: "basicCreatePackage:",
  1984. category: 'private',
  1985. fn: function (packageName){
  1986. var self=this;
  1987. return smalltalk.withContext(function($ctx1) {
  1988. return smalltalk.addPackage(packageName);
  1989. return self}, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  1990. args: ["packageName"],
  1991. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  1992. messageSends: [],
  1993. referencedClasses: []
  1994. }),
  1995. smalltalk.Smalltalk);
  1996. smalltalk.addMethod(
  1997. smalltalk.method({
  1998. selector: "basicParse:",
  1999. category: 'private',
  2000. fn: function (aString){
  2001. var self=this;
  2002. return smalltalk.withContext(function($ctx1) {
  2003. return smalltalk.parser.parse(aString);
  2004. return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})},
  2005. args: ["aString"],
  2006. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  2007. messageSends: [],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.Smalltalk);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "classes",
  2014. category: 'classes',
  2015. fn: function (){
  2016. var self=this;
  2017. return smalltalk.withContext(function($ctx1) {
  2018. return self.classes();
  2019. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})},
  2020. args: [],
  2021. source: "classes\x0a\x09<return self.classes()>",
  2022. messageSends: [],
  2023. referencedClasses: []
  2024. }),
  2025. smalltalk.Smalltalk);
  2026. smalltalk.addMethod(
  2027. smalltalk.method({
  2028. selector: "createPackage:",
  2029. category: 'packages',
  2030. fn: function (packageName){
  2031. var self=this;
  2032. var package_,announcement;
  2033. function $PackageAdded(){return smalltalk.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  2034. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  2035. return smalltalk.withContext(function($ctx1) {
  2036. var $1,$2,$3;
  2037. package_=self._basicCreatePackage_(packageName);
  2038. $1=_st($PackageAdded())._new();
  2039. _st($1)._package_(package_);
  2040. $2=_st($1)._yourself();
  2041. announcement=$2;
  2042. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  2043. $3=package_;
  2044. return $3;
  2045. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},smalltalk.Smalltalk)})},
  2046. args: ["packageName"],
  2047. source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
  2048. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"],
  2049. referencedClasses: ["PackageAdded", "SystemAnnouncer"]
  2050. }),
  2051. smalltalk.Smalltalk);
  2052. smalltalk.addMethod(
  2053. smalltalk.method({
  2054. selector: "createPackage:properties:",
  2055. category: 'private',
  2056. fn: function (packageName,aDict){
  2057. var self=this;
  2058. return smalltalk.withContext(function($ctx1) {
  2059. var $1,$2;
  2060. self._deprecatedAPI();
  2061. $1=_st(aDict)._isEmpty();
  2062. if(! smalltalk.assert($1)){
  2063. self._error_("createPackage:properties: called with nonempty properties");
  2064. };
  2065. $2=self._createPackage_(packageName);
  2066. return $2;
  2067. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})},
  2068. args: ["packageName", "aDict"],
  2069. source: "createPackage: packageName properties: aDict\x0a\x09\x22Needed to import .st files: they begin with this call.\x22\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a\x09^ self createPackage: packageName",
  2070. messageSends: ["deprecatedAPI", "ifFalse:", "isEmpty", "error:", "createPackage:"],
  2071. referencedClasses: []
  2072. }),
  2073. smalltalk.Smalltalk);
  2074. smalltalk.addMethod(
  2075. smalltalk.method({
  2076. selector: "defaultAmdNamespace",
  2077. category: 'accessing amd',
  2078. fn: function (){
  2079. var self=this;
  2080. return smalltalk.withContext(function($ctx1) {
  2081. var $1;
  2082. $1=self._at_("defaultAmdNamespace");
  2083. return $1;
  2084. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},smalltalk.Smalltalk)})},
  2085. args: [],
  2086. source: "defaultAmdNamespace\x0a\x09^ self at: 'defaultAmdNamespace'",
  2087. messageSends: ["at:"],
  2088. referencedClasses: []
  2089. }),
  2090. smalltalk.Smalltalk);
  2091. smalltalk.addMethod(
  2092. smalltalk.method({
  2093. selector: "defaultAmdNamespace:",
  2094. category: 'accessing amd',
  2095. fn: function (aString){
  2096. var self=this;
  2097. return smalltalk.withContext(function($ctx1) {
  2098. self._at_put_("defaultAmdNamespace",aString);
  2099. return self}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},smalltalk.Smalltalk)})},
  2100. args: ["aString"],
  2101. source: "defaultAmdNamespace: aString\x0a\x09self at: 'defaultAmdNamespace' put: aString",
  2102. messageSends: ["at:put:"],
  2103. referencedClasses: []
  2104. }),
  2105. smalltalk.Smalltalk);
  2106. smalltalk.addMethod(
  2107. smalltalk.method({
  2108. selector: "deleteClass:",
  2109. category: 'private',
  2110. fn: function (aClass){
  2111. var self=this;
  2112. return smalltalk.withContext(function($ctx1) {
  2113. self.removeClass(aClass);
  2114. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  2115. args: ["aClass"],
  2116. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<self.removeClass(aClass)>",
  2117. messageSends: [],
  2118. referencedClasses: []
  2119. }),
  2120. smalltalk.Smalltalk);
  2121. smalltalk.addMethod(
  2122. smalltalk.method({
  2123. selector: "deleteGlobalJsVariable:",
  2124. category: 'globals',
  2125. fn: function (aString){
  2126. var self=this;
  2127. return smalltalk.withContext(function($ctx1) {
  2128. _st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  2129. return smalltalk.withContext(function($ctx2) {
  2130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2131. return self}, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},smalltalk.Smalltalk)})},
  2132. args: ["aString"],
  2133. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  2134. messageSends: ["remove:ifAbsent:", "globalJsVariables"],
  2135. referencedClasses: []
  2136. }),
  2137. smalltalk.Smalltalk);
  2138. smalltalk.addMethod(
  2139. smalltalk.method({
  2140. selector: "deletePackage:",
  2141. category: 'private',
  2142. fn: function (packageName){
  2143. var self=this;
  2144. return smalltalk.withContext(function($ctx1) {
  2145. delete self.packages[ packageName];
  2146. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  2147. args: ["packageName"],
  2148. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete self.packages[ packageName]>",
  2149. messageSends: [],
  2150. referencedClasses: []
  2151. }),
  2152. smalltalk.Smalltalk);
  2153. smalltalk.addMethod(
  2154. smalltalk.method({
  2155. selector: "globalJsVariables",
  2156. category: 'globals',
  2157. fn: function (){
  2158. var self=this;
  2159. return smalltalk.withContext(function($ctx1) {
  2160. return self.globalJsVariables;
  2161. return self}, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},smalltalk.Smalltalk)})},
  2162. args: [],
  2163. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return self.globalJsVariables>",
  2164. messageSends: [],
  2165. referencedClasses: []
  2166. }),
  2167. smalltalk.Smalltalk);
  2168. smalltalk.addMethod(
  2169. smalltalk.method({
  2170. selector: "includesKey:",
  2171. category: 'accessing',
  2172. fn: function (aKey){
  2173. var self=this;
  2174. return smalltalk.withContext(function($ctx1) {
  2175. return self.hasOwnProperty(aKey);
  2176. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.Smalltalk)})},
  2177. args: ["aKey"],
  2178. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  2179. messageSends: [],
  2180. referencedClasses: []
  2181. }),
  2182. smalltalk.Smalltalk);
  2183. smalltalk.addMethod(
  2184. smalltalk.method({
  2185. selector: "isSmalltalkObject:",
  2186. category: 'testing',
  2187. fn: function (anObject){
  2188. var self=this;
  2189. return smalltalk.withContext(function($ctx1) {
  2190. return typeof anObject.klass !== 'undefined';
  2191. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  2192. args: ["anObject"],
  2193. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<return typeof anObject.klass !== 'undefined'>",
  2194. messageSends: [],
  2195. referencedClasses: []
  2196. }),
  2197. smalltalk.Smalltalk);
  2198. smalltalk.addMethod(
  2199. smalltalk.method({
  2200. selector: "packageAt:",
  2201. category: 'packages',
  2202. fn: function (packageName){
  2203. var self=this;
  2204. return smalltalk.withContext(function($ctx1) {
  2205. return self.packages[ packageName];
  2206. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})},
  2207. args: ["packageName"],
  2208. source: "packageAt: packageName\x0a\x09<return self.packages[ packageName]>",
  2209. messageSends: [],
  2210. referencedClasses: []
  2211. }),
  2212. smalltalk.Smalltalk);
  2213. smalltalk.addMethod(
  2214. smalltalk.method({
  2215. selector: "packageAt:ifAbsent:",
  2216. category: 'packages',
  2217. fn: function (packageName,aBlock){
  2218. var self=this;
  2219. return smalltalk.withContext(function($ctx1) {
  2220. var $2,$1;
  2221. $2=self._packageAt_(packageName);
  2222. $1=_st($2)._ifNil_(aBlock);
  2223. return $1;
  2224. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})},
  2225. args: ["packageName", "aBlock"],
  2226. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  2227. messageSends: ["ifNil:", "packageAt:"],
  2228. referencedClasses: []
  2229. }),
  2230. smalltalk.Smalltalk);
  2231. smalltalk.addMethod(
  2232. smalltalk.method({
  2233. selector: "packages",
  2234. category: 'packages',
  2235. fn: function (){
  2236. var self=this;
  2237. return smalltalk.withContext(function($ctx1) {
  2238. var packages = [];
  2239. for(var key in self.packages) {
  2240. packages.push(self.packages[key]);
  2241. }
  2242. return packages;
  2243. ;
  2244. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})},
  2245. args: [],
  2246. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09var packages = [];\x0a\x09\x09for(var key in self.packages) {\x0a\x09\x09\x09packages.push(self.packages[key]);\x0a\x09\x09}\x0a\x09\x09return packages;\x0a\x09>",
  2247. messageSends: [],
  2248. referencedClasses: []
  2249. }),
  2250. smalltalk.Smalltalk);
  2251. smalltalk.addMethod(
  2252. smalltalk.method({
  2253. selector: "parse:",
  2254. category: 'accessing',
  2255. fn: function (aString){
  2256. var self=this;
  2257. var result;
  2258. return smalltalk.withContext(function($ctx1) {
  2259. var $2,$3,$1;
  2260. self._try_catch_((function(){
  2261. return smalltalk.withContext(function($ctx2) {
  2262. result=self._basicParse_(aString);
  2263. return result;
  2264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(ex){
  2265. return smalltalk.withContext(function($ctx2) {
  2266. return _st(self._parseError_parsing_(ex,aString))._signal();
  2267. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  2268. $2=result;
  2269. _st($2)._source_(aString);
  2270. $3=_st($2)._yourself();
  2271. $1=$3;
  2272. return $1;
  2273. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
  2274. args: ["aString"],
  2275. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09self \x0a\x09\x09try: [ result := self basicParse: aString ] \x0a\x09\x09catch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  2276. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
  2277. referencedClasses: []
  2278. }),
  2279. smalltalk.Smalltalk);
  2280. smalltalk.addMethod(
  2281. smalltalk.method({
  2282. selector: "parseError:parsing:",
  2283. category: 'error handling',
  2284. fn: function (anException,aString){
  2285. var self=this;
  2286. function $ParseError(){return smalltalk.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  2287. return smalltalk.withContext(function($ctx1) {
  2288. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  2289. $2=_st($ParseError())._new();
  2290. $8=_st(anException)._basicAt_("line");
  2291. $ctx1.sendIdx["basicAt:"]=1;
  2292. $7="Parse error on line ".__comma($8);
  2293. $6=_st($7).__comma(" column ");
  2294. $ctx1.sendIdx[","]=4;
  2295. $9=_st(anException)._basicAt_("column");
  2296. $ctx1.sendIdx["basicAt:"]=2;
  2297. $5=_st($6).__comma($9);
  2298. $ctx1.sendIdx[","]=3;
  2299. $4=_st($5).__comma(" : Unexpected character ");
  2300. $ctx1.sendIdx[","]=2;
  2301. $3=_st($4).__comma(_st(anException)._basicAt_("found"));
  2302. $ctx1.sendIdx[","]=1;
  2303. $1=_st($2)._messageText_($3);
  2304. return $1;
  2305. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})},
  2306. args: ["anException", "aString"],
  2307. source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
  2308. messageSends: ["messageText:", "new", ",", "basicAt:"],
  2309. referencedClasses: ["ParseError"]
  2310. }),
  2311. smalltalk.Smalltalk);
  2312. smalltalk.addMethod(
  2313. smalltalk.method({
  2314. selector: "pseudoVariableNames",
  2315. category: 'accessing',
  2316. fn: function (){
  2317. var self=this;
  2318. return smalltalk.withContext(function($ctx1) {
  2319. var $1;
  2320. $1=["self", "super", "nil", "true", "false", "thisContext"];
  2321. return $1;
  2322. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})},
  2323. args: [],
  2324. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  2325. messageSends: [],
  2326. referencedClasses: []
  2327. }),
  2328. smalltalk.Smalltalk);
  2329. smalltalk.addMethod(
  2330. smalltalk.method({
  2331. selector: "readJSObject:",
  2332. category: 'accessing',
  2333. fn: function (anObject){
  2334. var self=this;
  2335. return smalltalk.withContext(function($ctx1) {
  2336. return self.readJSObject(anObject);
  2337. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  2338. args: ["anObject"],
  2339. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  2340. messageSends: [],
  2341. referencedClasses: []
  2342. }),
  2343. smalltalk.Smalltalk);
  2344. smalltalk.addMethod(
  2345. smalltalk.method({
  2346. selector: "removeClass:",
  2347. category: 'classes',
  2348. fn: function (aClass){
  2349. var self=this;
  2350. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  2351. function $ClassRemoved(){return smalltalk.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  2352. return smalltalk.withContext(function($ctx1) {
  2353. var $1,$2,$3;
  2354. $1=_st(aClass)._isMetaclass();
  2355. if(smalltalk.assert($1)){
  2356. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  2357. };
  2358. self._deleteClass_(aClass);
  2359. $2=_st($ClassRemoved())._new();
  2360. _st($2)._theClass_(aClass);
  2361. $3=_st($2)._yourself();
  2362. _st(_st($SystemAnnouncer())._current())._announce_($3);
  2363. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  2364. args: ["aClass"],
  2365. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  2366. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"],
  2367. referencedClasses: ["SystemAnnouncer", "ClassRemoved"]
  2368. }),
  2369. smalltalk.Smalltalk);
  2370. smalltalk.addMethod(
  2371. smalltalk.method({
  2372. selector: "removePackage:",
  2373. category: 'packages',
  2374. fn: function (packageName){
  2375. var self=this;
  2376. var pkg;
  2377. return smalltalk.withContext(function($ctx1) {
  2378. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  2379. return smalltalk.withContext(function($ctx2) {
  2380. return self._error_("Missing package: ".__comma(packageName));
  2381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2382. _st(_st(pkg)._classes())._do_((function(each){
  2383. return smalltalk.withContext(function($ctx2) {
  2384. return self._removeClass_(each);
  2385. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  2386. self._deletePackage_(packageName);
  2387. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})},
  2388. args: ["packageName"],
  2389. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self deletePackage: packageName",
  2390. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"],
  2391. referencedClasses: []
  2392. }),
  2393. smalltalk.Smalltalk);
  2394. smalltalk.addMethod(
  2395. smalltalk.method({
  2396. selector: "renamePackage:to:",
  2397. category: 'packages',
  2398. fn: function (packageName,newName){
  2399. var self=this;
  2400. var pkg;
  2401. return smalltalk.withContext(function($ctx1) {
  2402. var $1,$2;
  2403. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  2404. return smalltalk.withContext(function($ctx2) {
  2405. $1="Missing package: ".__comma(packageName);
  2406. $ctx2.sendIdx[","]=1;
  2407. return self._error_($1);
  2408. $ctx2.sendIdx["error:"]=1;
  2409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2410. $2=self._packageAt_(newName);
  2411. if(($receiver = $2) == nil || $receiver == null){
  2412. $2;
  2413. } else {
  2414. self._error_("Already exists a package called: ".__comma(newName));
  2415. };
  2416. _st(self._at_("packages"))._at_put_(newName,pkg);
  2417. _st(pkg)._name_(newName);
  2418. self._deletePackage_(packageName);
  2419. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
  2420. args: ["packageName", "newName"],
  2421. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09(self at: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  2422. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"],
  2423. referencedClasses: []
  2424. }),
  2425. smalltalk.Smalltalk);
  2426. smalltalk.addMethod(
  2427. smalltalk.method({
  2428. selector: "reservedWords",
  2429. category: 'accessing',
  2430. fn: function (){
  2431. var self=this;
  2432. return smalltalk.withContext(function($ctx1) {
  2433. return self.reservedWords;
  2434. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})},
  2435. args: [],
  2436. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  2437. messageSends: [],
  2438. referencedClasses: []
  2439. }),
  2440. smalltalk.Smalltalk);
  2441. smalltalk.addMethod(
  2442. smalltalk.method({
  2443. selector: "version",
  2444. category: 'accessing',
  2445. fn: function (){
  2446. var self=this;
  2447. return smalltalk.withContext(function($ctx1) {
  2448. return "0.13.0-pre";
  2449. }, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})},
  2450. args: [],
  2451. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.13.0-pre'",
  2452. messageSends: [],
  2453. referencedClasses: []
  2454. }),
  2455. smalltalk.Smalltalk);
  2456. smalltalk.addMethod(
  2457. smalltalk.method({
  2458. selector: "current",
  2459. category: 'accessing',
  2460. fn: function (){
  2461. var self=this;
  2462. return smalltalk.withContext(function($ctx1) {
  2463. return smalltalk;
  2464. return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})},
  2465. args: [],
  2466. source: "current\x0a\x09<return smalltalk>",
  2467. messageSends: [],
  2468. referencedClasses: []
  2469. }),
  2470. smalltalk.Smalltalk.klass);
  2471. smalltalk.addMethod(
  2472. smalltalk.method({
  2473. selector: "do:displayingProgress:",
  2474. category: '*Kernel-Infrastructure',
  2475. fn: function (aBlock,aString){
  2476. var self=this;
  2477. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  2478. return smalltalk.withContext(function($ctx1) {
  2479. _st(_st($ProgressHandler())._current())._do_on_displaying_(aBlock,self,aString);
  2480. return self}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},smalltalk.SequenceableCollection)})},
  2481. args: ["aBlock", "aString"],
  2482. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler current\x0a\x09\x09do: aBlock on: self displaying: aString",
  2483. messageSends: ["do:on:displaying:", "current"],
  2484. referencedClasses: ["ProgressHandler"]
  2485. }),
  2486. smalltalk.SequenceableCollection);
  2487. smalltalk.addMethod(
  2488. smalltalk.method({
  2489. selector: "asJavaScriptSelector",
  2490. category: '*Kernel-Infrastructure',
  2491. fn: function (){
  2492. var self=this;
  2493. return smalltalk.withContext(function($ctx1) {
  2494. var $1;
  2495. $1=self._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  2496. return $1;
  2497. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
  2498. args: [],
  2499. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^ self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  2500. messageSends: ["replace:with:"],
  2501. referencedClasses: []
  2502. }),
  2503. smalltalk.String);
  2504. });