1
0

Kernel-Infrastructure.js 109 KB

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