Kernel-Infrastructure.js 124 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361
  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: 'evaluating',
  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: "interpret:inContext:",
  559. protocol: 'evaluating',
  560. fn: function (aString,anAIContext){
  561. var self=this;
  562. var compiler,ast;
  563. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  564. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  565. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  566. return smalltalk.withContext(function($ctx1) {
  567. var $1,$2;
  568. var $early={};
  569. try {
  570. compiler=_st($Compiler())._new();
  571. _st((function(){
  572. return smalltalk.withContext(function($ctx2) {
  573. ast=_st(compiler)._parseExpression_(aString);
  574. return ast;
  575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  576. return smalltalk.withContext(function($ctx2) {
  577. $1=self._alert_(_st(ex)._messageText());
  578. throw $early=[$1];
  579. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  580. _st(_st($SemanticAnalyzer())._on_(_st(_st(anAIContext)._receiver())._class()))._visit_(ast);
  581. $2=_st(anAIContext)._evaluateNode_(ast);
  582. return $2;
  583. }
  584. catch(e) {if(e===$early)return e[0]; throw e}
  585. }, function($ctx1) {$ctx1.fill(self,"interpret:inContext:",{aString:aString,anAIContext:anAIContext,compiler:compiler,ast:ast},globals.Environment)})},
  586. args: ["aString", "anAIContext"],
  587. source: "interpret: aString inContext: anAIContext\x0a\x09\x22Similar to #eval:on:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `anAIContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ self alert: ex messageText ].\x0a\x09(SemanticAnalyzer on: anAIContext receiver class)\x0a\x09\x09visit: ast.\x0a\x09^ anAIContext evaluateNode: ast",
  588. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "visit:", "on:", "class", "receiver", "evaluateNode:"],
  589. referencedClasses: ["Compiler", "Error", "SemanticAnalyzer"]
  590. }),
  591. globals.Environment);
  592. smalltalk.addMethod(
  593. smalltalk.method({
  594. selector: "moveClass:toPackage:",
  595. protocol: 'actions',
  596. fn: function (aClass,aPackageName){
  597. var self=this;
  598. var package_;
  599. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  600. return smalltalk.withContext(function($ctx1) {
  601. var $1,$2;
  602. package_=_st($Package())._named_(aPackageName);
  603. $1=package_;
  604. if(($receiver = $1) == nil || $receiver == null){
  605. self._error_("Invalid package name");
  606. } else {
  607. $1;
  608. };
  609. $2=_st(package_).__eq_eq(_st(aClass)._package());
  610. if(smalltalk.assert($2)){
  611. return self;
  612. };
  613. _st(aClass)._package_(package_);
  614. return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},globals.Environment)})},
  615. args: ["aClass", "aPackageName"],
  616. 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",
  617. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
  618. referencedClasses: ["Package"]
  619. }),
  620. globals.Environment);
  621. smalltalk.addMethod(
  622. smalltalk.method({
  623. selector: "moveMethod:toClass:",
  624. protocol: 'actions',
  625. fn: function (aMethod,aClassName){
  626. var self=this;
  627. var destinationClass;
  628. return smalltalk.withContext(function($ctx1) {
  629. var $2,$3,$1;
  630. destinationClass=self._classNamed_(aClassName);
  631. $2=destinationClass;
  632. $3=_st(aMethod)._methodClass();
  633. $ctx1.sendIdx["methodClass"]=1;
  634. $1=_st($2).__eq_eq($3);
  635. if(smalltalk.assert($1)){
  636. return self;
  637. };
  638. _st(destinationClass)._compile_protocol_(_st(aMethod)._source(),_st(aMethod)._protocol());
  639. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  640. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},globals.Environment)})},
  641. args: ["aMethod", "aClassName"],
  642. 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",
  643. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"],
  644. referencedClasses: []
  645. }),
  646. globals.Environment);
  647. smalltalk.addMethod(
  648. smalltalk.method({
  649. selector: "moveMethod:toProtocol:",
  650. protocol: 'actions',
  651. fn: function (aMethod,aProtocol){
  652. var self=this;
  653. return smalltalk.withContext(function($ctx1) {
  654. _st(aMethod)._protocol_(aProtocol);
  655. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},globals.Environment)})},
  656. args: ["aMethod", "aProtocol"],
  657. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  658. messageSends: ["protocol:"],
  659. referencedClasses: []
  660. }),
  661. globals.Environment);
  662. smalltalk.addMethod(
  663. smalltalk.method({
  664. selector: "packages",
  665. protocol: 'accessing',
  666. fn: function (){
  667. var self=this;
  668. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  669. return smalltalk.withContext(function($ctx1) {
  670. var $1;
  671. $1=_st($Smalltalk())._packages();
  672. return $1;
  673. }, function($ctx1) {$ctx1.fill(self,"packages",{},globals.Environment)})},
  674. args: [],
  675. source: "packages\x0a\x09^ Smalltalk packages",
  676. messageSends: ["packages"],
  677. referencedClasses: ["Smalltalk"]
  678. }),
  679. globals.Environment);
  680. smalltalk.addMethod(
  681. smalltalk.method({
  682. selector: "registerErrorHandler:",
  683. protocol: 'services',
  684. fn: function (anErrorHandler){
  685. var self=this;
  686. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  687. return smalltalk.withContext(function($ctx1) {
  688. _st($ErrorHandler())._register_(anErrorHandler);
  689. return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},globals.Environment)})},
  690. args: ["anErrorHandler"],
  691. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  692. messageSends: ["register:"],
  693. referencedClasses: ["ErrorHandler"]
  694. }),
  695. globals.Environment);
  696. smalltalk.addMethod(
  697. smalltalk.method({
  698. selector: "registerInspector:",
  699. protocol: 'services',
  700. fn: function (anInspector){
  701. var self=this;
  702. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  703. return smalltalk.withContext(function($ctx1) {
  704. _st($Inspector())._register_(anInspector);
  705. return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},globals.Environment)})},
  706. args: ["anInspector"],
  707. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  708. messageSends: ["register:"],
  709. referencedClasses: ["Inspector"]
  710. }),
  711. globals.Environment);
  712. smalltalk.addMethod(
  713. smalltalk.method({
  714. selector: "registerProgressHandler:",
  715. protocol: 'services',
  716. fn: function (aProgressHandler){
  717. var self=this;
  718. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  719. return smalltalk.withContext(function($ctx1) {
  720. _st($ProgressHandler())._register_(aProgressHandler);
  721. return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},globals.Environment)})},
  722. args: ["aProgressHandler"],
  723. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  724. messageSends: ["register:"],
  725. referencedClasses: ["ProgressHandler"]
  726. }),
  727. globals.Environment);
  728. smalltalk.addMethod(
  729. smalltalk.method({
  730. selector: "registerTranscript:",
  731. protocol: 'services',
  732. fn: function (aTranscript){
  733. var self=this;
  734. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  735. return smalltalk.withContext(function($ctx1) {
  736. _st($Transcript())._register_(aTranscript);
  737. return self}, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},globals.Environment)})},
  738. args: ["aTranscript"],
  739. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  740. messageSends: ["register:"],
  741. referencedClasses: ["Transcript"]
  742. }),
  743. globals.Environment);
  744. smalltalk.addMethod(
  745. smalltalk.method({
  746. selector: "removeClass:",
  747. protocol: 'actions',
  748. fn: function (aClass){
  749. var self=this;
  750. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  751. return smalltalk.withContext(function($ctx1) {
  752. _st($Smalltalk())._removeClass_(aClass);
  753. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.Environment)})},
  754. args: ["aClass"],
  755. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  756. messageSends: ["removeClass:"],
  757. referencedClasses: ["Smalltalk"]
  758. }),
  759. globals.Environment);
  760. smalltalk.addMethod(
  761. smalltalk.method({
  762. selector: "removeMethod:",
  763. protocol: 'actions',
  764. fn: function (aMethod){
  765. var self=this;
  766. return smalltalk.withContext(function($ctx1) {
  767. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  768. return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},globals.Environment)})},
  769. args: ["aMethod"],
  770. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  771. messageSends: ["removeCompiledMethod:", "methodClass"],
  772. referencedClasses: []
  773. }),
  774. globals.Environment);
  775. smalltalk.addMethod(
  776. smalltalk.method({
  777. selector: "removeProtocol:from:",
  778. protocol: 'actions',
  779. fn: function (aString,aClass){
  780. var self=this;
  781. return smalltalk.withContext(function($ctx1) {
  782. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  783. return smalltalk.withContext(function($ctx2) {
  784. return _st(aClass)._removeCompiledMethod_(each);
  785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  786. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},globals.Environment)})},
  787. args: ["aString", "aClass"],
  788. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  789. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"],
  790. referencedClasses: []
  791. }),
  792. globals.Environment);
  793. smalltalk.addMethod(
  794. smalltalk.method({
  795. selector: "renameClass:to:",
  796. protocol: 'actions',
  797. fn: function (aClass,aClassName){
  798. var self=this;
  799. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  800. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  801. return smalltalk.withContext(function($ctx1) {
  802. var $1,$2;
  803. $1=_st(_st($Smalltalk())._globals())._at_(aClassName);
  804. if(($receiver = $1) == nil || $receiver == null){
  805. $1;
  806. } else {
  807. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  808. $ctx1.sendIdx[","]=1;
  809. self._error_($2);
  810. };
  811. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  812. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)})},
  813. args: ["aClass", "aClassName"],
  814. 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",
  815. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"],
  816. referencedClasses: ["Smalltalk", "ClassBuilder"]
  817. }),
  818. globals.Environment);
  819. smalltalk.addMethod(
  820. smalltalk.method({
  821. selector: "renameProtocol:to:in:",
  822. protocol: 'actions',
  823. fn: function (aString,anotherString,aClass){
  824. var self=this;
  825. return smalltalk.withContext(function($ctx1) {
  826. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  827. return smalltalk.withContext(function($ctx2) {
  828. return _st(each)._protocol_(anotherString);
  829. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  830. return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},globals.Environment)})},
  831. args: ["aString", "anotherString", "aClass"],
  832. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  833. messageSends: ["do:", "methodsInProtocol:", "protocol:"],
  834. referencedClasses: []
  835. }),
  836. globals.Environment);
  837. smalltalk.addMethod(
  838. smalltalk.method({
  839. selector: "setClassCommentOf:to:",
  840. protocol: 'actions',
  841. fn: function (aClass,aString){
  842. var self=this;
  843. return smalltalk.withContext(function($ctx1) {
  844. _st(aClass)._comment_(aString);
  845. return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},globals.Environment)})},
  846. args: ["aClass", "aString"],
  847. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  848. messageSends: ["comment:"],
  849. referencedClasses: []
  850. }),
  851. globals.Environment);
  852. smalltalk.addMethod(
  853. smalltalk.method({
  854. selector: "systemAnnouncer",
  855. protocol: 'accessing',
  856. fn: function (){
  857. var self=this;
  858. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  859. return smalltalk.withContext(function($ctx1) {
  860. var $1;
  861. $1=_st(_st(_st($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  862. return $1;
  863. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},globals.Environment)})},
  864. args: [],
  865. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  866. messageSends: ["current", "at:", "globals"],
  867. referencedClasses: ["Smalltalk"]
  868. }),
  869. globals.Environment);
  870. smalltalk.addClass('JSObjectProxy', globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  871. 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`.";
  872. smalltalk.addMethod(
  873. smalltalk.method({
  874. selector: "=",
  875. protocol: 'comparing',
  876. fn: function (anObject){
  877. var self=this;
  878. return smalltalk.withContext(function($ctx1) {
  879. var $2,$1,$3;
  880. $2=_st(anObject)._class();
  881. $ctx1.sendIdx["class"]=1;
  882. $1=_st($2).__eq_eq(self._class());
  883. if(! smalltalk.assert($1)){
  884. return false;
  885. };
  886. $3=self._compareJSObjectWith_(_st(anObject)._jsObject());
  887. return $3;
  888. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.JSObjectProxy)})},
  889. args: ["anObject"],
  890. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ self compareJSObjectWith: anObject jsObject",
  891. messageSends: ["ifFalse:", "==", "class", "compareJSObjectWith:", "jsObject"],
  892. referencedClasses: []
  893. }),
  894. globals.JSObjectProxy);
  895. smalltalk.addMethod(
  896. smalltalk.method({
  897. selector: "addObjectVariablesTo:",
  898. protocol: 'proxy',
  899. fn: function (aDictionary){
  900. var self=this;
  901. return smalltalk.withContext(function($ctx1) {
  902. for(var i in self['@jsObject']) {
  903. aDictionary._at_put_(i, self['@jsObject'][i]);
  904. }
  905. ;
  906. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},globals.JSObjectProxy)})},
  907. args: ["aDictionary"],
  908. 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>",
  909. messageSends: [],
  910. referencedClasses: []
  911. }),
  912. globals.JSObjectProxy);
  913. smalltalk.addMethod(
  914. smalltalk.method({
  915. selector: "asJSON",
  916. protocol: 'enumerating',
  917. fn: function (){
  918. var self=this;
  919. var $1;
  920. $1=self["@jsObject"];
  921. return $1;
  922. },
  923. args: [],
  924. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  925. messageSends: [],
  926. referencedClasses: []
  927. }),
  928. globals.JSObjectProxy);
  929. smalltalk.addMethod(
  930. smalltalk.method({
  931. selector: "at:",
  932. protocol: 'accessing',
  933. fn: function (aString){
  934. var self=this;
  935. return smalltalk.withContext(function($ctx1) {
  936. return self['@jsObject'][aString];
  937. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.JSObjectProxy)})},
  938. args: ["aString"],
  939. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  940. messageSends: [],
  941. referencedClasses: []
  942. }),
  943. globals.JSObjectProxy);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "at:ifAbsent:",
  947. protocol: 'accessing',
  948. fn: function (aString,aBlock){
  949. var self=this;
  950. return smalltalk.withContext(function($ctx1) {
  951. var obj = self['@jsObject'];
  952. return aString in obj ? obj[aString] : aBlock._value();
  953. ;
  954. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)})},
  955. args: ["aString", "aBlock"],
  956. 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>",
  957. messageSends: [],
  958. referencedClasses: []
  959. }),
  960. globals.JSObjectProxy);
  961. smalltalk.addMethod(
  962. smalltalk.method({
  963. selector: "at:ifPresent:",
  964. protocol: 'accessing',
  965. fn: function (aString,aBlock){
  966. var self=this;
  967. return smalltalk.withContext(function($ctx1) {
  968. var obj = self['@jsObject'];
  969. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  970. ;
  971. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)})},
  972. args: ["aString", "aBlock"],
  973. 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>",
  974. messageSends: [],
  975. referencedClasses: []
  976. }),
  977. globals.JSObjectProxy);
  978. smalltalk.addMethod(
  979. smalltalk.method({
  980. selector: "at:ifPresent:ifAbsent:",
  981. protocol: 'accessing',
  982. fn: function (aString,aBlock,anotherBlock){
  983. var self=this;
  984. return smalltalk.withContext(function($ctx1) {
  985. var obj = self['@jsObject'];
  986. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  987. ;
  988. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.JSObjectProxy)})},
  989. args: ["aString", "aBlock", "anotherBlock"],
  990. 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>",
  991. messageSends: [],
  992. referencedClasses: []
  993. }),
  994. globals.JSObjectProxy);
  995. smalltalk.addMethod(
  996. smalltalk.method({
  997. selector: "at:put:",
  998. protocol: 'accessing',
  999. fn: function (aString,anObject){
  1000. var self=this;
  1001. return smalltalk.withContext(function($ctx1) {
  1002. return self['@jsObject'][aString] = anObject;
  1003. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.JSObjectProxy)})},
  1004. args: ["aString", "anObject"],
  1005. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  1006. messageSends: [],
  1007. referencedClasses: []
  1008. }),
  1009. globals.JSObjectProxy);
  1010. smalltalk.addMethod(
  1011. smalltalk.method({
  1012. selector: "compareJSObjectWith:",
  1013. protocol: 'private',
  1014. fn: function (aJSObject){
  1015. var self=this;
  1016. return smalltalk.withContext(function($ctx1) {
  1017. return self["@jsObject"] === aJSObject;
  1018. return self}, function($ctx1) {$ctx1.fill(self,"compareJSObjectWith:",{aJSObject:aJSObject},globals.JSObjectProxy)})},
  1019. args: ["aJSObject"],
  1020. source: "compareJSObjectWith: aJSObject\x0a \x09<return self[\x22@jsObject\x22] === aJSObject>",
  1021. messageSends: [],
  1022. referencedClasses: []
  1023. }),
  1024. globals.JSObjectProxy);
  1025. smalltalk.addMethod(
  1026. smalltalk.method({
  1027. selector: "doesNotUnderstand:",
  1028. protocol: 'proxy',
  1029. fn: function (aMessage){
  1030. var self=this;
  1031. return smalltalk.withContext(function($ctx1) {
  1032. var $2,$1;
  1033. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  1034. if(($receiver = $2) == nil || $receiver == null){
  1035. $1=globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  1036. } else {
  1037. var jsSelector;
  1038. jsSelector=$receiver;
  1039. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  1040. };
  1041. return $1;
  1042. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.JSObjectProxy)})},
  1043. args: ["aMessage"],
  1044. 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 ]",
  1045. messageSends: ["ifNil:ifNotNil:", "lookupProperty:", "asJavaScriptSelector", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"],
  1046. referencedClasses: []
  1047. }),
  1048. globals.JSObjectProxy);
  1049. smalltalk.addMethod(
  1050. smalltalk.method({
  1051. selector: "forwardMessage:withArguments:",
  1052. protocol: 'proxy',
  1053. fn: function (aString,anArray){
  1054. var self=this;
  1055. return smalltalk.withContext(function($ctx1) {
  1056. return smalltalk.send(self._jsObject(), aString, anArray);
  1057. ;
  1058. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},globals.JSObjectProxy)})},
  1059. args: ["aString", "anArray"],
  1060. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  1061. messageSends: [],
  1062. referencedClasses: []
  1063. }),
  1064. globals.JSObjectProxy);
  1065. smalltalk.addMethod(
  1066. smalltalk.method({
  1067. selector: "inspectOn:",
  1068. protocol: 'proxy',
  1069. fn: function (anInspector){
  1070. var self=this;
  1071. var variables;
  1072. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1073. return smalltalk.withContext(function($ctx1) {
  1074. variables=_st($Dictionary())._new();
  1075. _st(variables)._at_put_("#self",self._jsObject());
  1076. _st(anInspector)._setLabel_(self._printString());
  1077. self._addObjectVariablesTo_(variables);
  1078. _st(anInspector)._setVariables_(variables);
  1079. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.JSObjectProxy)})},
  1080. args: ["anInspector"],
  1081. 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",
  1082. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  1083. referencedClasses: ["Dictionary"]
  1084. }),
  1085. globals.JSObjectProxy);
  1086. smalltalk.addMethod(
  1087. smalltalk.method({
  1088. selector: "jsObject",
  1089. protocol: 'accessing',
  1090. fn: function (){
  1091. var self=this;
  1092. var $1;
  1093. $1=self["@jsObject"];
  1094. return $1;
  1095. },
  1096. args: [],
  1097. source: "jsObject\x0a\x09^ jsObject",
  1098. messageSends: [],
  1099. referencedClasses: []
  1100. }),
  1101. globals.JSObjectProxy);
  1102. smalltalk.addMethod(
  1103. smalltalk.method({
  1104. selector: "jsObject:",
  1105. protocol: 'accessing',
  1106. fn: function (aJSObject){
  1107. var self=this;
  1108. self["@jsObject"]=aJSObject;
  1109. return self},
  1110. args: ["aJSObject"],
  1111. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  1112. messageSends: [],
  1113. referencedClasses: []
  1114. }),
  1115. globals.JSObjectProxy);
  1116. smalltalk.addMethod(
  1117. smalltalk.method({
  1118. selector: "keysAndValuesDo:",
  1119. protocol: 'enumerating',
  1120. fn: function (aBlock){
  1121. var self=this;
  1122. return smalltalk.withContext(function($ctx1) {
  1123. var o = self['@jsObject'];
  1124. for(var i in o) {
  1125. aBlock._value_value_(i, o[i]);
  1126. }
  1127. ;
  1128. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.JSObjectProxy)})},
  1129. args: ["aBlock"],
  1130. 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>",
  1131. messageSends: [],
  1132. referencedClasses: []
  1133. }),
  1134. globals.JSObjectProxy);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "lookupProperty:",
  1138. protocol: 'accessing',
  1139. fn: function (aString){
  1140. var self=this;
  1141. return smalltalk.withContext(function($ctx1) {
  1142. return aString in self._jsObject() ? aString : nil;
  1143. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},globals.JSObjectProxy)})},
  1144. args: ["aString"],
  1145. 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>",
  1146. messageSends: [],
  1147. referencedClasses: []
  1148. }),
  1149. globals.JSObjectProxy);
  1150. smalltalk.addMethod(
  1151. smalltalk.method({
  1152. selector: "printOn:",
  1153. protocol: 'printing',
  1154. fn: function (aStream){
  1155. var self=this;
  1156. return smalltalk.withContext(function($ctx1) {
  1157. _st(aStream)._nextPutAll_(self._printString());
  1158. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.JSObjectProxy)})},
  1159. args: ["aStream"],
  1160. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  1161. messageSends: ["nextPutAll:", "printString"],
  1162. referencedClasses: []
  1163. }),
  1164. globals.JSObjectProxy);
  1165. smalltalk.addMethod(
  1166. smalltalk.method({
  1167. selector: "printString",
  1168. protocol: 'printing',
  1169. fn: function (){
  1170. var self=this;
  1171. return smalltalk.withContext(function($ctx1) {
  1172. var js = self['@jsObject'];
  1173. return js.toString
  1174. ? js.toString()
  1175. : Object.prototype.toString.call(js)
  1176. ;
  1177. return self}, function($ctx1) {$ctx1.fill(self,"printString",{},globals.JSObjectProxy)})},
  1178. args: [],
  1179. 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>",
  1180. messageSends: [],
  1181. referencedClasses: []
  1182. }),
  1183. globals.JSObjectProxy);
  1184. smalltalk.addMethod(
  1185. smalltalk.method({
  1186. selector: "on:",
  1187. protocol: 'instance creation',
  1188. fn: function (aJSObject){
  1189. var self=this;
  1190. return smalltalk.withContext(function($ctx1) {
  1191. var $2,$3,$1;
  1192. $2=self._new();
  1193. _st($2)._jsObject_(aJSObject);
  1194. $3=_st($2)._yourself();
  1195. $1=$3;
  1196. return $1;
  1197. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},globals.JSObjectProxy.klass)})},
  1198. args: ["aJSObject"],
  1199. source: "on: aJSObject\x0a\x09^ self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  1200. messageSends: ["jsObject:", "new", "yourself"],
  1201. referencedClasses: []
  1202. }),
  1203. globals.JSObjectProxy.klass);
  1204. smalltalk.addClass('NullProgressHandler', globals.Object, [], 'Kernel-Infrastructure');
  1205. globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  1206. smalltalk.addMethod(
  1207. smalltalk.method({
  1208. selector: "do:on:displaying:",
  1209. protocol: 'progress handling',
  1210. fn: function (aBlock,aCollection,aString){
  1211. var self=this;
  1212. return smalltalk.withContext(function($ctx1) {
  1213. _st(aCollection)._do_(aBlock);
  1214. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.NullProgressHandler)})},
  1215. args: ["aBlock", "aCollection", "aString"],
  1216. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  1217. messageSends: ["do:"],
  1218. referencedClasses: []
  1219. }),
  1220. globals.NullProgressHandler);
  1221. globals.NullProgressHandler.klass.iVarNames = ['current'];
  1222. smalltalk.addMethod(
  1223. smalltalk.method({
  1224. selector: "initialize",
  1225. protocol: 'initialization',
  1226. fn: function (){
  1227. var self=this;
  1228. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  1229. return smalltalk.withContext(function($ctx1) {
  1230. _st($ProgressHandler())._registerIfNone_(self._new());
  1231. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.NullProgressHandler.klass)})},
  1232. args: [],
  1233. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  1234. messageSends: ["registerIfNone:", "new"],
  1235. referencedClasses: ["ProgressHandler"]
  1236. }),
  1237. globals.NullProgressHandler.klass);
  1238. smalltalk.addClass('Organizer', globals.Object, [], 'Kernel-Infrastructure');
  1239. globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "addElement:",
  1243. protocol: 'accessing',
  1244. fn: function (anObject){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. self.elements.addElement(anObject);
  1248. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},globals.Organizer)})},
  1249. args: ["anObject"],
  1250. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  1251. messageSends: [],
  1252. referencedClasses: []
  1253. }),
  1254. globals.Organizer);
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "elements",
  1258. protocol: 'accessing',
  1259. fn: function (){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $1;
  1263. $1=_st(self._basicAt_("elements"))._copy();
  1264. return $1;
  1265. }, function($ctx1) {$ctx1.fill(self,"elements",{},globals.Organizer)})},
  1266. args: [],
  1267. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  1268. messageSends: ["copy", "basicAt:"],
  1269. referencedClasses: []
  1270. }),
  1271. globals.Organizer);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "removeElement:",
  1275. protocol: 'accessing',
  1276. fn: function (anObject){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self.elements.removeElement(anObject);
  1280. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},globals.Organizer)})},
  1281. args: ["anObject"],
  1282. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  1283. messageSends: [],
  1284. referencedClasses: []
  1285. }),
  1286. globals.Organizer);
  1287. smalltalk.addClass('ClassOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  1288. globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  1289. smalltalk.addMethod(
  1290. smalltalk.method({
  1291. selector: "addElement:",
  1292. protocol: 'accessing',
  1293. fn: function (aString){
  1294. var self=this;
  1295. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1296. function $ProtocolAdded(){return globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  1297. return smalltalk.withContext(function($ctx1) {
  1298. var $1,$2;
  1299. globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply(_st(self), [aString]);
  1300. $1=_st($ProtocolAdded())._new();
  1301. _st($1)._protocol_(aString);
  1302. _st($1)._theClass_(self._theClass());
  1303. $2=_st($1)._yourself();
  1304. _st(_st($SystemAnnouncer())._current())._announce_($2);
  1305. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},globals.ClassOrganizer)})},
  1306. args: ["aString"],
  1307. 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)",
  1308. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  1309. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"]
  1310. }),
  1311. globals.ClassOrganizer);
  1312. smalltalk.addMethod(
  1313. smalltalk.method({
  1314. selector: "removeElement:",
  1315. protocol: 'accessing',
  1316. fn: function (aString){
  1317. var self=this;
  1318. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1319. function $ProtocolRemoved(){return globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  1320. return smalltalk.withContext(function($ctx1) {
  1321. var $1,$2;
  1322. globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply(_st(self), [aString]);
  1323. $1=_st($ProtocolRemoved())._new();
  1324. _st($1)._protocol_(aString);
  1325. _st($1)._theClass_(self._theClass());
  1326. $2=_st($1)._yourself();
  1327. _st(_st($SystemAnnouncer())._current())._announce_($2);
  1328. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},globals.ClassOrganizer)})},
  1329. args: ["aString"],
  1330. 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)",
  1331. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  1332. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"]
  1333. }),
  1334. globals.ClassOrganizer);
  1335. smalltalk.addMethod(
  1336. smalltalk.method({
  1337. selector: "theClass",
  1338. protocol: 'accessing',
  1339. fn: function (){
  1340. var self=this;
  1341. return smalltalk.withContext(function($ctx1) {
  1342. return self.theClass ;
  1343. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},globals.ClassOrganizer)})},
  1344. args: [],
  1345. source: "theClass\x0a\x09< return self.theClass >",
  1346. messageSends: [],
  1347. referencedClasses: []
  1348. }),
  1349. globals.ClassOrganizer);
  1350. smalltalk.addClass('PackageOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  1351. globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  1352. smalltalk.addClass('Package', globals.Object, ['transport'], 'Kernel-Infrastructure');
  1353. 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'";
  1354. smalltalk.addMethod(
  1355. smalltalk.method({
  1356. selector: "basicTransport",
  1357. protocol: 'accessing',
  1358. fn: function (){
  1359. var self=this;
  1360. return smalltalk.withContext(function($ctx1) {
  1361. return self.transport;
  1362. return self}, function($ctx1) {$ctx1.fill(self,"basicTransport",{},globals.Package)})},
  1363. args: [],
  1364. 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>",
  1365. messageSends: [],
  1366. referencedClasses: []
  1367. }),
  1368. globals.Package);
  1369. smalltalk.addMethod(
  1370. smalltalk.method({
  1371. selector: "classTemplate",
  1372. protocol: 'accessing',
  1373. fn: function (){
  1374. var self=this;
  1375. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1376. return smalltalk.withContext(function($ctx1) {
  1377. var $3,$4,$2,$5,$6,$7,$1;
  1378. $1=_st($String())._streamContents_((function(stream){
  1379. return smalltalk.withContext(function($ctx2) {
  1380. _st(stream)._nextPutAll_("Object");
  1381. $ctx2.sendIdx["nextPutAll:"]=1;
  1382. _st(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  1383. $ctx2.sendIdx["nextPutAll:"]=2;
  1384. $3=_st($String())._lf();
  1385. $ctx2.sendIdx["lf"]=1;
  1386. $4=_st($String())._tab();
  1387. $ctx2.sendIdx["tab"]=1;
  1388. $2=_st($3).__comma($4);
  1389. $ctx2.sendIdx[","]=1;
  1390. _st(stream)._nextPutAll_($2);
  1391. $ctx2.sendIdx["nextPutAll:"]=3;
  1392. $5=_st(stream)._nextPutAll_("instanceVariableNames: ''");
  1393. $ctx2.sendIdx["nextPutAll:"]=4;
  1394. $5;
  1395. $6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
  1396. $ctx2.sendIdx[","]=2;
  1397. _st(stream)._nextPutAll_($6);
  1398. $ctx2.sendIdx["nextPutAll:"]=5;
  1399. _st(stream)._nextPutAll_("package: '");
  1400. $ctx2.sendIdx["nextPutAll:"]=6;
  1401. _st(stream)._nextPutAll_(self._name());
  1402. $ctx2.sendIdx["nextPutAll:"]=7;
  1403. $7=_st(stream)._nextPutAll_("'");
  1404. return $7;
  1405. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  1406. return $1;
  1407. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},globals.Package)})},
  1408. args: [],
  1409. source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]",
  1410. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"],
  1411. referencedClasses: ["String"]
  1412. }),
  1413. globals.Package);
  1414. smalltalk.addMethod(
  1415. smalltalk.method({
  1416. selector: "classes",
  1417. protocol: 'classes',
  1418. fn: function (){
  1419. var self=this;
  1420. return smalltalk.withContext(function($ctx1) {
  1421. var $1;
  1422. $1=_st(self._organization())._elements();
  1423. return $1;
  1424. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Package)})},
  1425. args: [],
  1426. source: "classes\x0a\x09^ self organization elements",
  1427. messageSends: ["elements", "organization"],
  1428. referencedClasses: []
  1429. }),
  1430. globals.Package);
  1431. smalltalk.addMethod(
  1432. smalltalk.method({
  1433. selector: "definition",
  1434. protocol: 'accessing',
  1435. fn: function (){
  1436. var self=this;
  1437. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1438. return smalltalk.withContext(function($ctx1) {
  1439. var $2,$4,$5,$3,$7,$6,$8,$9,$1;
  1440. $1=_st($String())._streamContents_((function(stream){
  1441. return smalltalk.withContext(function($ctx2) {
  1442. $2=_st(self._class())._name();
  1443. $ctx2.sendIdx["name"]=1;
  1444. _st(stream)._nextPutAll_($2);
  1445. $ctx2.sendIdx["nextPutAll:"]=1;
  1446. $4=_st($String())._lf();
  1447. $ctx2.sendIdx["lf"]=1;
  1448. $5=_st($String())._tab();
  1449. $ctx2.sendIdx["tab"]=1;
  1450. $3=_st($4).__comma($5);
  1451. $ctx2.sendIdx[","]=1;
  1452. _st(stream)._nextPutAll_($3);
  1453. $ctx2.sendIdx["nextPutAll:"]=2;
  1454. _st(stream)._nextPutAll_(" named: ");
  1455. $ctx2.sendIdx["nextPutAll:"]=3;
  1456. $7="'".__comma(self._name());
  1457. $ctx2.sendIdx[","]=3;
  1458. $6=_st($7).__comma("'");
  1459. $ctx2.sendIdx[","]=2;
  1460. _st(stream)._nextPutAll_($6);
  1461. $ctx2.sendIdx["nextPutAll:"]=4;
  1462. $8=_st(_st($String())._lf()).__comma(_st($String())._tab());
  1463. $ctx2.sendIdx[","]=4;
  1464. _st(stream)._nextPutAll_($8);
  1465. $ctx2.sendIdx["nextPutAll:"]=5;
  1466. _st(stream)._nextPutAll_(" transport: (");
  1467. $ctx2.sendIdx["nextPutAll:"]=6;
  1468. $9=_st(stream)._nextPutAll_(_st(_st(self._transport())._definition()).__comma(")"));
  1469. return $9;
  1470. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  1471. return $1;
  1472. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Package)})},
  1473. args: [],
  1474. 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, ')' ]",
  1475. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "definition", "transport"],
  1476. referencedClasses: ["String"]
  1477. }),
  1478. globals.Package);
  1479. smalltalk.addMethod(
  1480. smalltalk.method({
  1481. selector: "isPackage",
  1482. protocol: 'testing',
  1483. fn: function (){
  1484. var self=this;
  1485. return true;
  1486. },
  1487. args: [],
  1488. source: "isPackage\x0a\x09^ true",
  1489. messageSends: [],
  1490. referencedClasses: []
  1491. }),
  1492. globals.Package);
  1493. smalltalk.addMethod(
  1494. smalltalk.method({
  1495. selector: "loadDependencies",
  1496. protocol: 'dependencies',
  1497. fn: function (){
  1498. var self=this;
  1499. var classes,packages;
  1500. return smalltalk.withContext(function($ctx1) {
  1501. var $2,$3,$1;
  1502. classes=self._loadDependencyClasses();
  1503. $2=_st(_st(classes)._collect_((function(each){
  1504. return smalltalk.withContext(function($ctx2) {
  1505. return _st(each)._package();
  1506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asSet();
  1507. _st($2)._remove_ifAbsent_(self,(function(){
  1508. }));
  1509. $3=_st($2)._yourself();
  1510. $1=$3;
  1511. return $1;
  1512. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},globals.Package)})},
  1513. args: [],
  1514. 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",
  1515. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"],
  1516. referencedClasses: []
  1517. }),
  1518. globals.Package);
  1519. smalltalk.addMethod(
  1520. smalltalk.method({
  1521. selector: "loadDependencyClasses",
  1522. protocol: 'dependencies',
  1523. fn: function (){
  1524. var self=this;
  1525. var starCategoryName;
  1526. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1527. return smalltalk.withContext(function($ctx1) {
  1528. var $4,$3,$2,$6,$5,$7,$1;
  1529. starCategoryName="*".__comma(self._name());
  1530. $ctx1.sendIdx[","]=1;
  1531. $4=self._classes();
  1532. $ctx1.sendIdx["classes"]=1;
  1533. $3=_st($4)._collect_((function(each){
  1534. return smalltalk.withContext(function($ctx2) {
  1535. return _st(each)._superclass();
  1536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1537. $2=_st($3)._asSet();
  1538. _st($2)._remove_ifAbsent_(nil,(function(){
  1539. }));
  1540. _st($2)._addAll_(_st(_st($Smalltalk())._classes())._select_((function(each){
  1541. return smalltalk.withContext(function($ctx2) {
  1542. $6=_st(each)._protocols();
  1543. $ctx2.sendIdx["protocols"]=1;
  1544. $5=_st($6).__comma(_st(_st(each)._class())._protocols());
  1545. return _st($5)._includes_(starCategoryName);
  1546. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})})));
  1547. $7=_st($2)._yourself();
  1548. $1=$7;
  1549. return $1;
  1550. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},globals.Package)})},
  1551. args: [],
  1552. 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",
  1553. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"],
  1554. referencedClasses: ["Smalltalk"]
  1555. }),
  1556. globals.Package);
  1557. smalltalk.addMethod(
  1558. smalltalk.method({
  1559. selector: "name",
  1560. protocol: 'accessing',
  1561. fn: function (){
  1562. var self=this;
  1563. return smalltalk.withContext(function($ctx1) {
  1564. return self.pkgName;
  1565. return self}, function($ctx1) {$ctx1.fill(self,"name",{},globals.Package)})},
  1566. args: [],
  1567. source: "name\x0a\x09<return self.pkgName>",
  1568. messageSends: [],
  1569. referencedClasses: []
  1570. }),
  1571. globals.Package);
  1572. smalltalk.addMethod(
  1573. smalltalk.method({
  1574. selector: "name:",
  1575. protocol: 'accessing',
  1576. fn: function (aString){
  1577. var self=this;
  1578. return smalltalk.withContext(function($ctx1) {
  1579. self.pkgName = aString;
  1580. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},globals.Package)})},
  1581. args: ["aString"],
  1582. source: "name: aString\x0a\x09<self.pkgName = aString>",
  1583. messageSends: [],
  1584. referencedClasses: []
  1585. }),
  1586. globals.Package);
  1587. smalltalk.addMethod(
  1588. smalltalk.method({
  1589. selector: "organization",
  1590. protocol: 'accessing',
  1591. fn: function (){
  1592. var self=this;
  1593. return smalltalk.withContext(function($ctx1) {
  1594. var $1;
  1595. $1=self._basicAt_("organization");
  1596. return $1;
  1597. }, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Package)})},
  1598. args: [],
  1599. source: "organization\x0a\x09^ self basicAt: 'organization'",
  1600. messageSends: ["basicAt:"],
  1601. referencedClasses: []
  1602. }),
  1603. globals.Package);
  1604. smalltalk.addMethod(
  1605. smalltalk.method({
  1606. selector: "printOn:",
  1607. protocol: 'printing',
  1608. fn: function (aStream){
  1609. var self=this;
  1610. return smalltalk.withContext(function($ctx1) {
  1611. var $1;
  1612. globals.Package.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  1613. _st(aStream)._nextPutAll_(" (");
  1614. $ctx1.sendIdx["nextPutAll:"]=1;
  1615. _st(aStream)._nextPutAll_(self._name());
  1616. $ctx1.sendIdx["nextPutAll:"]=2;
  1617. $1=_st(aStream)._nextPutAll_(")");
  1618. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Package)})},
  1619. args: ["aStream"],
  1620. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  1621. messageSends: ["printOn:", "nextPutAll:", "name"],
  1622. referencedClasses: []
  1623. }),
  1624. globals.Package);
  1625. smalltalk.addMethod(
  1626. smalltalk.method({
  1627. selector: "setupClasses",
  1628. protocol: 'classes',
  1629. fn: function (){
  1630. var self=this;
  1631. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1632. return smalltalk.withContext(function($ctx1) {
  1633. var $1,$2;
  1634. $1=self._classes();
  1635. _st($1)._do_((function(each){
  1636. return smalltalk.withContext(function($ctx2) {
  1637. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  1638. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1639. $ctx1.sendIdx["do:"]=1;
  1640. $2=_st($1)._do_((function(each){
  1641. return smalltalk.withContext(function($ctx2) {
  1642. return _st(each)._initialize();
  1643. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1644. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},globals.Package)})},
  1645. args: [],
  1646. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  1647. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"],
  1648. referencedClasses: ["ClassBuilder"]
  1649. }),
  1650. globals.Package);
  1651. smalltalk.addMethod(
  1652. smalltalk.method({
  1653. selector: "sortedClasses",
  1654. protocol: 'classes',
  1655. fn: function (){
  1656. var self=this;
  1657. return smalltalk.withContext(function($ctx1) {
  1658. var $1;
  1659. $1=_st(self._class())._sortedClasses_(self._classes());
  1660. return $1;
  1661. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},globals.Package)})},
  1662. args: [],
  1663. 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",
  1664. messageSends: ["sortedClasses:", "class", "classes"],
  1665. referencedClasses: []
  1666. }),
  1667. globals.Package);
  1668. smalltalk.addMethod(
  1669. smalltalk.method({
  1670. selector: "transport",
  1671. protocol: 'accessing',
  1672. fn: function (){
  1673. var self=this;
  1674. function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  1675. return smalltalk.withContext(function($ctx1) {
  1676. var $2,$3,$4,$1;
  1677. $2=self["@transport"];
  1678. if(($receiver = $2) == nil || $receiver == null){
  1679. $3=_st($PackageTransport())._fromJson_(self._basicTransport());
  1680. _st($3)._package_(self);
  1681. $4=_st($3)._yourself();
  1682. self["@transport"]=$4;
  1683. $1=self["@transport"];
  1684. } else {
  1685. $1=$2;
  1686. };
  1687. return $1;
  1688. }, function($ctx1) {$ctx1.fill(self,"transport",{},globals.Package)})},
  1689. args: [],
  1690. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  1691. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"],
  1692. referencedClasses: ["PackageTransport"]
  1693. }),
  1694. globals.Package);
  1695. smalltalk.addMethod(
  1696. smalltalk.method({
  1697. selector: "transport:",
  1698. protocol: 'accessing',
  1699. fn: function (aPackageTransport){
  1700. var self=this;
  1701. return smalltalk.withContext(function($ctx1) {
  1702. self["@transport"]=aPackageTransport;
  1703. _st(aPackageTransport)._package_(self);
  1704. return self}, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},globals.Package)})},
  1705. args: ["aPackageTransport"],
  1706. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  1707. messageSends: ["package:"],
  1708. referencedClasses: []
  1709. }),
  1710. globals.Package);
  1711. globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  1712. smalltalk.addMethod(
  1713. smalltalk.method({
  1714. selector: "named:",
  1715. protocol: 'accessing',
  1716. fn: function (aPackageName){
  1717. var self=this;
  1718. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1719. return smalltalk.withContext(function($ctx1) {
  1720. var $1;
  1721. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  1722. return smalltalk.withContext(function($ctx2) {
  1723. return _st($Smalltalk())._createPackage_(aPackageName);
  1724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1725. return $1;
  1726. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},globals.Package.klass)})},
  1727. args: ["aPackageName"],
  1728. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  1729. messageSends: ["packageAt:ifAbsent:", "createPackage:"],
  1730. referencedClasses: ["Smalltalk"]
  1731. }),
  1732. globals.Package.klass);
  1733. smalltalk.addMethod(
  1734. smalltalk.method({
  1735. selector: "named:ifAbsent:",
  1736. protocol: 'accessing',
  1737. fn: function (aPackageName,aBlock){
  1738. var self=this;
  1739. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1740. return smalltalk.withContext(function($ctx1) {
  1741. var $1;
  1742. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  1743. return $1;
  1744. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},globals.Package.klass)})},
  1745. args: ["aPackageName", "aBlock"],
  1746. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  1747. messageSends: ["packageAt:ifAbsent:"],
  1748. referencedClasses: ["Smalltalk"]
  1749. }),
  1750. globals.Package.klass);
  1751. smalltalk.addMethod(
  1752. smalltalk.method({
  1753. selector: "named:transport:",
  1754. protocol: 'accessing',
  1755. fn: function (aPackageName,aTransport){
  1756. var self=this;
  1757. var package_;
  1758. return smalltalk.withContext(function($ctx1) {
  1759. var $1;
  1760. package_=self._named_(aPackageName);
  1761. _st(package_)._transport_(aTransport);
  1762. $1=package_;
  1763. return $1;
  1764. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},globals.Package.klass)})},
  1765. args: ["aPackageName", "aTransport"],
  1766. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  1767. messageSends: ["named:", "transport:"],
  1768. referencedClasses: []
  1769. }),
  1770. globals.Package.klass);
  1771. smalltalk.addMethod(
  1772. smalltalk.method({
  1773. selector: "sortedClasses:",
  1774. protocol: 'sorting',
  1775. fn: function (classes){
  1776. var self=this;
  1777. var children,others,nodes,expandedClasses;
  1778. function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  1779. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  1780. return smalltalk.withContext(function($ctx1) {
  1781. var $1,$3,$2,$4;
  1782. children=[];
  1783. others=[];
  1784. _st(classes)._do_((function(each){
  1785. return smalltalk.withContext(function($ctx2) {
  1786. $1=_st(classes)._includes_(_st(each)._superclass());
  1787. if(smalltalk.assert($1)){
  1788. return _st(others)._add_(each);
  1789. } else {
  1790. return _st(children)._add_(each);
  1791. $ctx2.sendIdx["add:"]=1;
  1792. };
  1793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1794. $ctx1.sendIdx["do:"]=1;
  1795. nodes=_st(children)._collect_((function(each){
  1796. return smalltalk.withContext(function($ctx2) {
  1797. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  1798. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  1799. nodes=_st(nodes)._sorted_((function(a,b){
  1800. return smalltalk.withContext(function($ctx2) {
  1801. $3=_st(a)._theClass();
  1802. $ctx2.sendIdx["theClass"]=1;
  1803. $2=_st($3)._name();
  1804. $ctx2.sendIdx["name"]=1;
  1805. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  1806. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)})}));
  1807. expandedClasses=_st($Array())._new();
  1808. _st(nodes)._do_((function(aNode){
  1809. return smalltalk.withContext(function($ctx2) {
  1810. return _st(aNode)._traverseClassesWith_(expandedClasses);
  1811. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)})}));
  1812. $4=expandedClasses;
  1813. return $4;
  1814. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},globals.Package.klass)})},
  1815. args: ["classes"],
  1816. 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",
  1817. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  1818. referencedClasses: ["ClassSorterNode", "Array"]
  1819. }),
  1820. globals.Package.klass);
  1821. smalltalk.addClass('PlatformInterface', globals.Object, [], 'Kernel-Infrastructure');
  1822. 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 }.";
  1823. globals.PlatformInterface.klass.iVarNames = ['worker'];
  1824. smalltalk.addMethod(
  1825. smalltalk.method({
  1826. selector: "ajax:",
  1827. protocol: 'actions',
  1828. fn: function (anObject){
  1829. var self=this;
  1830. return smalltalk.withContext(function($ctx1) {
  1831. var $2,$1;
  1832. $2=self["@worker"];
  1833. if(($receiver = $2) == nil || $receiver == null){
  1834. $1=self._error_("ajax: not available");
  1835. } else {
  1836. $1=_st(self["@worker"])._ajax_(anObject);
  1837. };
  1838. return $1;
  1839. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.PlatformInterface.klass)})},
  1840. args: ["anObject"],
  1841. source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
  1842. messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"],
  1843. referencedClasses: []
  1844. }),
  1845. globals.PlatformInterface.klass);
  1846. smalltalk.addMethod(
  1847. smalltalk.method({
  1848. selector: "alert:",
  1849. protocol: 'actions',
  1850. fn: function (aString){
  1851. var self=this;
  1852. return smalltalk.withContext(function($ctx1) {
  1853. var $2,$1;
  1854. $2=self["@worker"];
  1855. if(($receiver = $2) == nil || $receiver == null){
  1856. $1=self._error_("alert: not available");
  1857. } else {
  1858. $1=_st(self["@worker"])._alert_(aString);
  1859. };
  1860. return $1;
  1861. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.PlatformInterface.klass)})},
  1862. args: ["aString"],
  1863. source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
  1864. messageSends: ["ifNotNil:ifNil:", "alert:", "error:"],
  1865. referencedClasses: []
  1866. }),
  1867. globals.PlatformInterface.klass);
  1868. smalltalk.addMethod(
  1869. smalltalk.method({
  1870. selector: "confirm:",
  1871. protocol: 'actions',
  1872. fn: function (aString){
  1873. var self=this;
  1874. return smalltalk.withContext(function($ctx1) {
  1875. var $2,$1;
  1876. $2=self["@worker"];
  1877. if(($receiver = $2) == nil || $receiver == null){
  1878. $1=self._error_("confirm: not available");
  1879. } else {
  1880. $1=_st(self["@worker"])._confirm_(aString);
  1881. };
  1882. return $1;
  1883. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.PlatformInterface.klass)})},
  1884. args: ["aString"],
  1885. source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
  1886. messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"],
  1887. referencedClasses: []
  1888. }),
  1889. globals.PlatformInterface.klass);
  1890. smalltalk.addMethod(
  1891. smalltalk.method({
  1892. selector: "existsGlobal:",
  1893. protocol: 'actions',
  1894. fn: function (aString){
  1895. var self=this;
  1896. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  1897. return smalltalk.withContext(function($ctx1) {
  1898. var $1;
  1899. $1=_st(_st($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  1900. return true;
  1901. }),(function(){
  1902. return false;
  1903. }));
  1904. return $1;
  1905. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},globals.PlatformInterface.klass)})},
  1906. args: ["aString"],
  1907. source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  1908. messageSends: ["at:ifPresent:ifAbsent:", "globals"],
  1909. referencedClasses: ["PlatformInterface"]
  1910. }),
  1911. globals.PlatformInterface.klass);
  1912. smalltalk.addMethod(
  1913. smalltalk.method({
  1914. selector: "globals",
  1915. protocol: 'accessing',
  1916. fn: function (){
  1917. var self=this;
  1918. return smalltalk.withContext(function($ctx1) {
  1919. return (new Function('return this'))();;
  1920. return self}, function($ctx1) {$ctx1.fill(self,"globals",{},globals.PlatformInterface.klass)})},
  1921. args: [],
  1922. source: "globals\x0a\x09<return (new Function('return this'))();>",
  1923. messageSends: [],
  1924. referencedClasses: []
  1925. }),
  1926. globals.PlatformInterface.klass);
  1927. smalltalk.addMethod(
  1928. smalltalk.method({
  1929. selector: "initialize",
  1930. protocol: 'initialization',
  1931. fn: function (){
  1932. var self=this;
  1933. var candidate;
  1934. function $BrowserInterface(){return globals.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
  1935. return smalltalk.withContext(function($ctx1) {
  1936. var $1;
  1937. globals.PlatformInterface.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1938. if(($receiver = $BrowserInterface()) == nil || $receiver == null){
  1939. $BrowserInterface();
  1940. } else {
  1941. candidate=_st($BrowserInterface())._new();
  1942. candidate;
  1943. $1=_st(candidate)._isAvailable();
  1944. if(smalltalk.assert($1)){
  1945. self._setWorker_(candidate);
  1946. return self;
  1947. };
  1948. };
  1949. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},globals.PlatformInterface.klass)})},
  1950. args: [],
  1951. 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]",
  1952. messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"],
  1953. referencedClasses: ["BrowserInterface"]
  1954. }),
  1955. globals.PlatformInterface.klass);
  1956. smalltalk.addMethod(
  1957. smalltalk.method({
  1958. selector: "prompt:",
  1959. protocol: 'actions',
  1960. fn: function (aString){
  1961. var self=this;
  1962. return smalltalk.withContext(function($ctx1) {
  1963. var $2,$1;
  1964. $2=self["@worker"];
  1965. if(($receiver = $2) == nil || $receiver == null){
  1966. $1=self._error_("prompt: not available");
  1967. } else {
  1968. $1=_st(self["@worker"])._prompt_(aString);
  1969. };
  1970. return $1;
  1971. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.PlatformInterface.klass)})},
  1972. args: ["aString"],
  1973. source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  1974. messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"],
  1975. referencedClasses: []
  1976. }),
  1977. globals.PlatformInterface.klass);
  1978. smalltalk.addMethod(
  1979. smalltalk.method({
  1980. selector: "setWorker:",
  1981. protocol: 'accessing',
  1982. fn: function (anObject){
  1983. var self=this;
  1984. self["@worker"]=anObject;
  1985. return self},
  1986. args: ["anObject"],
  1987. source: "setWorker: anObject\x0a\x09worker := anObject",
  1988. messageSends: [],
  1989. referencedClasses: []
  1990. }),
  1991. globals.PlatformInterface.klass);
  1992. smalltalk.addClass('Service', globals.Object, [], 'Kernel-Infrastructure');
  1993. 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.";
  1994. globals.Service.klass.iVarNames = ['current'];
  1995. smalltalk.addMethod(
  1996. smalltalk.method({
  1997. selector: "current",
  1998. protocol: 'accessing',
  1999. fn: function (){
  2000. var self=this;
  2001. var $1;
  2002. $1=self["@current"];
  2003. return $1;
  2004. },
  2005. args: [],
  2006. source: "current\x0a\x09^ current",
  2007. messageSends: [],
  2008. referencedClasses: []
  2009. }),
  2010. globals.Service.klass);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "new",
  2014. protocol: 'instance creation',
  2015. fn: function (){
  2016. var self=this;
  2017. return smalltalk.withContext(function($ctx1) {
  2018. self._shouldNotImplement();
  2019. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.Service.klass)})},
  2020. args: [],
  2021. source: "new\x0a\x09self shouldNotImplement",
  2022. messageSends: ["shouldNotImplement"],
  2023. referencedClasses: []
  2024. }),
  2025. globals.Service.klass);
  2026. smalltalk.addMethod(
  2027. smalltalk.method({
  2028. selector: "register:",
  2029. protocol: 'registration',
  2030. fn: function (anObject){
  2031. var self=this;
  2032. self["@current"]=anObject;
  2033. return self},
  2034. args: ["anObject"],
  2035. source: "register: anObject\x0a\x09current := anObject",
  2036. messageSends: [],
  2037. referencedClasses: []
  2038. }),
  2039. globals.Service.klass);
  2040. smalltalk.addMethod(
  2041. smalltalk.method({
  2042. selector: "registerIfNone:",
  2043. protocol: 'registration',
  2044. fn: function (anObject){
  2045. var self=this;
  2046. return smalltalk.withContext(function($ctx1) {
  2047. var $1;
  2048. $1=self._current();
  2049. if(($receiver = $1) == nil || $receiver == null){
  2050. self._register_(anObject);
  2051. } else {
  2052. $1;
  2053. };
  2054. return self}, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},globals.Service.klass)})},
  2055. args: ["anObject"],
  2056. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  2057. messageSends: ["ifNil:", "current", "register:"],
  2058. referencedClasses: []
  2059. }),
  2060. globals.Service.klass);
  2061. smalltalk.addClass('ErrorHandler', globals.Service, [], 'Kernel-Infrastructure');
  2062. 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.";
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "handleError:",
  2066. protocol: 'error handling',
  2067. fn: function (anError){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. _st(self._current())._handleError_(anError);
  2071. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ErrorHandler.klass)})},
  2072. args: ["anError"],
  2073. source: "handleError: anError\x0a\x09self current handleError: anError",
  2074. messageSends: ["handleError:", "current"],
  2075. referencedClasses: []
  2076. }),
  2077. globals.ErrorHandler.klass);
  2078. smalltalk.addClass('Inspector', globals.Service, [], 'Kernel-Infrastructure');
  2079. globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  2080. smalltalk.addMethod(
  2081. smalltalk.method({
  2082. selector: "inspect:",
  2083. protocol: 'inspecting',
  2084. fn: function (anObject){
  2085. var self=this;
  2086. return smalltalk.withContext(function($ctx1) {
  2087. var $1;
  2088. $1=_st(self._current())._inspect_(anObject);
  2089. return $1;
  2090. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Inspector.klass)})},
  2091. args: ["anObject"],
  2092. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  2093. messageSends: ["inspect:", "current"],
  2094. referencedClasses: []
  2095. }),
  2096. globals.Inspector.klass);
  2097. smalltalk.addClass('ProgressHandler', globals.Service, [], 'Kernel-Infrastructure');
  2098. 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`.";
  2099. smalltalk.addMethod(
  2100. smalltalk.method({
  2101. selector: "do:on:displaying:",
  2102. protocol: 'progress handling',
  2103. fn: function (aBlock,aCollection,aString){
  2104. var self=this;
  2105. return smalltalk.withContext(function($ctx1) {
  2106. _st(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  2107. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.ProgressHandler.klass)})},
  2108. args: ["aBlock", "aCollection", "aString"],
  2109. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  2110. messageSends: ["do:on:displaying:", "current"],
  2111. referencedClasses: []
  2112. }),
  2113. globals.ProgressHandler.klass);
  2114. smalltalk.addClass('Transcript', globals.Service, [], 'Kernel-Infrastructure');
  2115. 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.";
  2116. smalltalk.addMethod(
  2117. smalltalk.method({
  2118. selector: "clear",
  2119. protocol: 'printing',
  2120. fn: function (){
  2121. var self=this;
  2122. return smalltalk.withContext(function($ctx1) {
  2123. _st(self._current())._clear();
  2124. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},globals.Transcript.klass)})},
  2125. args: [],
  2126. source: "clear\x0a\x09self current clear",
  2127. messageSends: ["clear", "current"],
  2128. referencedClasses: []
  2129. }),
  2130. globals.Transcript.klass);
  2131. smalltalk.addMethod(
  2132. smalltalk.method({
  2133. selector: "cr",
  2134. protocol: 'printing',
  2135. fn: function (){
  2136. var self=this;
  2137. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  2138. return smalltalk.withContext(function($ctx1) {
  2139. _st(self._current())._show_(_st($String())._cr());
  2140. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.Transcript.klass)})},
  2141. args: [],
  2142. source: "cr\x0a\x09self current show: String cr",
  2143. messageSends: ["show:", "current", "cr"],
  2144. referencedClasses: ["String"]
  2145. }),
  2146. globals.Transcript.klass);
  2147. smalltalk.addMethod(
  2148. smalltalk.method({
  2149. selector: "inspect:",
  2150. protocol: 'printing',
  2151. fn: function (anObject){
  2152. var self=this;
  2153. return smalltalk.withContext(function($ctx1) {
  2154. self._show_(anObject);
  2155. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Transcript.klass)})},
  2156. args: ["anObject"],
  2157. source: "inspect: anObject\x0a\x09self show: anObject",
  2158. messageSends: ["show:"],
  2159. referencedClasses: []
  2160. }),
  2161. globals.Transcript.klass);
  2162. smalltalk.addMethod(
  2163. smalltalk.method({
  2164. selector: "open",
  2165. protocol: 'instance creation',
  2166. fn: function (){
  2167. var self=this;
  2168. return smalltalk.withContext(function($ctx1) {
  2169. _st(self._current())._open();
  2170. return self}, function($ctx1) {$ctx1.fill(self,"open",{},globals.Transcript.klass)})},
  2171. args: [],
  2172. source: "open\x0a\x09self current open",
  2173. messageSends: ["open", "current"],
  2174. referencedClasses: []
  2175. }),
  2176. globals.Transcript.klass);
  2177. smalltalk.addMethod(
  2178. smalltalk.method({
  2179. selector: "show:",
  2180. protocol: 'printing',
  2181. fn: function (anObject){
  2182. var self=this;
  2183. return smalltalk.withContext(function($ctx1) {
  2184. _st(self._current())._show_(anObject);
  2185. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.Transcript.klass)})},
  2186. args: ["anObject"],
  2187. source: "show: anObject\x0a\x09self current show: anObject",
  2188. messageSends: ["show:", "current"],
  2189. referencedClasses: []
  2190. }),
  2191. globals.Transcript.klass);
  2192. smalltalk.addClass('Setting', globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  2193. globals.Setting.comment="I represent a setting accessible via `Smalltalk settings`.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: 'defaultValue'`.";
  2194. smalltalk.addMethod(
  2195. smalltalk.method({
  2196. selector: "defaultValue",
  2197. protocol: 'accessing',
  2198. fn: function (){
  2199. var self=this;
  2200. var $1;
  2201. $1=self["@defaultValue"];
  2202. return $1;
  2203. },
  2204. args: [],
  2205. source: "defaultValue\x0a\x09^ defaultValue",
  2206. messageSends: [],
  2207. referencedClasses: []
  2208. }),
  2209. globals.Setting);
  2210. smalltalk.addMethod(
  2211. smalltalk.method({
  2212. selector: "defaultValue:",
  2213. protocol: 'accessing',
  2214. fn: function (anObject){
  2215. var self=this;
  2216. self["@defaultValue"]=anObject;
  2217. return self},
  2218. args: ["anObject"],
  2219. source: "defaultValue: anObject\x0a\x09defaultValue := anObject",
  2220. messageSends: [],
  2221. referencedClasses: []
  2222. }),
  2223. globals.Setting);
  2224. smalltalk.addMethod(
  2225. smalltalk.method({
  2226. selector: "key",
  2227. protocol: 'accessing',
  2228. fn: function (){
  2229. var self=this;
  2230. var $1;
  2231. $1=self["@key"];
  2232. return $1;
  2233. },
  2234. args: [],
  2235. source: "key\x0a\x09^ key",
  2236. messageSends: [],
  2237. referencedClasses: []
  2238. }),
  2239. globals.Setting);
  2240. smalltalk.addMethod(
  2241. smalltalk.method({
  2242. selector: "key:",
  2243. protocol: 'accessing',
  2244. fn: function (anObject){
  2245. var self=this;
  2246. self["@key"]=anObject;
  2247. return self},
  2248. args: ["anObject"],
  2249. source: "key: anObject\x0a\x09key := anObject",
  2250. messageSends: [],
  2251. referencedClasses: []
  2252. }),
  2253. globals.Setting);
  2254. smalltalk.addMethod(
  2255. smalltalk.method({
  2256. selector: "value",
  2257. protocol: 'accessing',
  2258. fn: function (){
  2259. var self=this;
  2260. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2261. return smalltalk.withContext(function($ctx1) {
  2262. var $1;
  2263. $1=_st(_st($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  2264. return smalltalk.withContext(function($ctx2) {
  2265. return self._defaultValue();
  2266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2267. return $1;
  2268. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.Setting)})},
  2269. args: [],
  2270. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  2271. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"],
  2272. referencedClasses: ["Smalltalk"]
  2273. }),
  2274. globals.Setting);
  2275. smalltalk.addMethod(
  2276. smalltalk.method({
  2277. selector: "value:",
  2278. protocol: 'accessing',
  2279. fn: function (aString){
  2280. var self=this;
  2281. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2282. return smalltalk.withContext(function($ctx1) {
  2283. var $1;
  2284. $1=_st(_st($Smalltalk())._settings())._at_put_(self._key(),aString);
  2285. return $1;
  2286. }, function($ctx1) {$ctx1.fill(self,"value:",{aString:aString},globals.Setting)})},
  2287. args: ["aString"],
  2288. source: "value: aString\x0a\x09^ Smalltalk settings at: self key put: aString",
  2289. messageSends: ["at:put:", "settings", "key"],
  2290. referencedClasses: ["Smalltalk"]
  2291. }),
  2292. globals.Setting);
  2293. smalltalk.addMethod(
  2294. smalltalk.method({
  2295. selector: "at:ifAbsent:",
  2296. protocol: 'instance creation',
  2297. fn: function (aString,anotherString){
  2298. var self=this;
  2299. return smalltalk.withContext(function($ctx1) {
  2300. var $2,$3,$1;
  2301. $2=globals.Setting.klass.superclass.fn.prototype._new.apply(_st(self), []);
  2302. _st($2)._key_(aString);
  2303. _st($2)._defaultValue_(anotherString);
  2304. $3=_st($2)._yourself();
  2305. $1=$3;
  2306. return $1;
  2307. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,anotherString:anotherString},globals.Setting.klass)})},
  2308. args: ["aString", "anotherString"],
  2309. source: "at: aString ifAbsent: anotherString\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: anotherString;\x0a\x09\x09yourself",
  2310. messageSends: ["key:", "new", "defaultValue:", "yourself"],
  2311. referencedClasses: []
  2312. }),
  2313. globals.Setting.klass);
  2314. smalltalk.addMethod(
  2315. smalltalk.method({
  2316. selector: "new",
  2317. protocol: 'instance creation',
  2318. fn: function (){
  2319. var self=this;
  2320. return smalltalk.withContext(function($ctx1) {
  2321. self._shouldNotImplement();
  2322. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.Setting.klass)})},
  2323. args: [],
  2324. source: "new\x0a\x09self shouldNotImplement",
  2325. messageSends: ["shouldNotImplement"],
  2326. referencedClasses: []
  2327. }),
  2328. globals.Setting.klass);
  2329. smalltalk.addClass('SmalltalkImage', globals.Object, [], 'Kernel-Infrastructure');
  2330. 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.";
  2331. smalltalk.addMethod(
  2332. smalltalk.method({
  2333. selector: "addGlobalJsVariable:",
  2334. protocol: 'globals',
  2335. fn: function (aString){
  2336. var self=this;
  2337. return smalltalk.withContext(function($ctx1) {
  2338. _st(self._globalJsVariables())._add_(aString);
  2339. return self}, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)})},
  2340. args: ["aString"],
  2341. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  2342. messageSends: ["add:", "globalJsVariables"],
  2343. referencedClasses: []
  2344. }),
  2345. globals.SmalltalkImage);
  2346. smalltalk.addMethod(
  2347. smalltalk.method({
  2348. selector: "amdRequire",
  2349. protocol: 'accessing amd',
  2350. fn: function (){
  2351. var self=this;
  2352. return smalltalk.withContext(function($ctx1) {
  2353. var $1;
  2354. $1=_st(self._vm())._at_("amdRequire");
  2355. return $1;
  2356. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},globals.SmalltalkImage)})},
  2357. args: [],
  2358. source: "amdRequire\x0a\x09^ self vm at: 'amdRequire'",
  2359. messageSends: ["at:", "vm"],
  2360. referencedClasses: []
  2361. }),
  2362. globals.SmalltalkImage);
  2363. smalltalk.addMethod(
  2364. smalltalk.method({
  2365. selector: "asSmalltalkException:",
  2366. protocol: 'error handling',
  2367. fn: function (anObject){
  2368. var self=this;
  2369. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2370. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  2371. return smalltalk.withContext(function($ctx1) {
  2372. var $2,$1;
  2373. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  2374. return smalltalk.withContext(function($ctx2) {
  2375. return _st(anObject)._isKindOf_($Error());
  2376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2377. if(smalltalk.assert($2)){
  2378. $1=anObject;
  2379. } else {
  2380. $1=_st($JavaScriptException())._on_(anObject);
  2381. };
  2382. return $1;
  2383. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},globals.SmalltalkImage)})},
  2384. args: ["anObject"],
  2385. 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 ]",
  2386. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"],
  2387. referencedClasses: ["Error", "JavaScriptException"]
  2388. }),
  2389. globals.SmalltalkImage);
  2390. smalltalk.addMethod(
  2391. smalltalk.method({
  2392. selector: "at:",
  2393. protocol: 'accessing',
  2394. fn: function (aString){
  2395. var self=this;
  2396. return smalltalk.withContext(function($ctx1) {
  2397. var $1;
  2398. self._deprecatedAPI();
  2399. $1=_st(self._globals())._at_(aString);
  2400. return $1;
  2401. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.SmalltalkImage)})},
  2402. args: ["aString"],
  2403. source: "at: aString\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString",
  2404. messageSends: ["deprecatedAPI", "at:", "globals"],
  2405. referencedClasses: []
  2406. }),
  2407. globals.SmalltalkImage);
  2408. smalltalk.addMethod(
  2409. smalltalk.method({
  2410. selector: "at:ifAbsent:",
  2411. protocol: 'accessing',
  2412. fn: function (aKey,aBlock){
  2413. var self=this;
  2414. return smalltalk.withContext(function($ctx1) {
  2415. var $2,$1;
  2416. $2=self._includesKey_(aKey);
  2417. if(smalltalk.assert($2)){
  2418. $1=self._at_(aKey);
  2419. } else {
  2420. $1=_st(aBlock)._value();
  2421. };
  2422. return $1;
  2423. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.SmalltalkImage)})},
  2424. args: ["aKey", "aBlock"],
  2425. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self at: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  2426. messageSends: ["ifTrue:ifFalse:", "includesKey:", "at:", "value"],
  2427. referencedClasses: []
  2428. }),
  2429. globals.SmalltalkImage);
  2430. smalltalk.addMethod(
  2431. smalltalk.method({
  2432. selector: "at:put:",
  2433. protocol: 'accessing',
  2434. fn: function (aString,anObject){
  2435. var self=this;
  2436. return smalltalk.withContext(function($ctx1) {
  2437. var $1;
  2438. self._deprecatedAPI();
  2439. $1=_st(self._globals())._at_put_(aString,anObject);
  2440. return $1;
  2441. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.SmalltalkImage)})},
  2442. args: ["aString", "anObject"],
  2443. source: "at: aString put: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString put: anObject",
  2444. messageSends: ["deprecatedAPI", "at:put:", "globals"],
  2445. referencedClasses: []
  2446. }),
  2447. globals.SmalltalkImage);
  2448. smalltalk.addMethod(
  2449. smalltalk.method({
  2450. selector: "basicCreatePackage:",
  2451. protocol: 'private',
  2452. fn: function (packageName){
  2453. var self=this;
  2454. return smalltalk.withContext(function($ctx1) {
  2455. return smalltalk.addPackage(packageName);
  2456. return self}, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},globals.SmalltalkImage)})},
  2457. args: ["packageName"],
  2458. 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)>",
  2459. messageSends: [],
  2460. referencedClasses: []
  2461. }),
  2462. globals.SmalltalkImage);
  2463. smalltalk.addMethod(
  2464. smalltalk.method({
  2465. selector: "basicParse:",
  2466. protocol: 'private',
  2467. fn: function (aString){
  2468. var self=this;
  2469. function $SmalltalkParser(){return globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  2470. return smalltalk.withContext(function($ctx1) {
  2471. var $1;
  2472. $1=_st($SmalltalkParser())._parse_(aString);
  2473. return $1;
  2474. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},globals.SmalltalkImage)})},
  2475. args: ["aString"],
  2476. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  2477. messageSends: ["parse:"],
  2478. referencedClasses: ["SmalltalkParser"]
  2479. }),
  2480. globals.SmalltalkImage);
  2481. smalltalk.addMethod(
  2482. smalltalk.method({
  2483. selector: "classes",
  2484. protocol: 'classes',
  2485. fn: function (){
  2486. var self=this;
  2487. return smalltalk.withContext(function($ctx1) {
  2488. return smalltalk.classes();
  2489. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},globals.SmalltalkImage)})},
  2490. args: [],
  2491. source: "classes\x0a\x09<return smalltalk.classes()>",
  2492. messageSends: [],
  2493. referencedClasses: []
  2494. }),
  2495. globals.SmalltalkImage);
  2496. smalltalk.addMethod(
  2497. smalltalk.method({
  2498. selector: "createPackage:",
  2499. protocol: 'packages',
  2500. fn: function (packageName){
  2501. var self=this;
  2502. var package_,announcement;
  2503. function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  2504. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  2505. return smalltalk.withContext(function($ctx1) {
  2506. var $1,$2,$3;
  2507. package_=self._basicCreatePackage_(packageName);
  2508. $1=_st($PackageAdded())._new();
  2509. _st($1)._package_(package_);
  2510. $2=_st($1)._yourself();
  2511. announcement=$2;
  2512. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  2513. $3=package_;
  2514. return $3;
  2515. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},globals.SmalltalkImage)})},
  2516. args: ["packageName"],
  2517. 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",
  2518. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"],
  2519. referencedClasses: ["PackageAdded", "SystemAnnouncer"]
  2520. }),
  2521. globals.SmalltalkImage);
  2522. smalltalk.addMethod(
  2523. smalltalk.method({
  2524. selector: "createPackage:properties:",
  2525. protocol: 'private',
  2526. fn: function (packageName,aDict){
  2527. var self=this;
  2528. return smalltalk.withContext(function($ctx1) {
  2529. var $1,$2;
  2530. self._deprecatedAPI();
  2531. $1=_st(aDict)._isEmpty();
  2532. if(! smalltalk.assert($1)){
  2533. self._error_("createPackage:properties: called with nonempty properties");
  2534. };
  2535. $2=self._createPackage_(packageName);
  2536. return $2;
  2537. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},globals.SmalltalkImage)})},
  2538. args: ["packageName", "aDict"],
  2539. 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",
  2540. messageSends: ["deprecatedAPI", "ifFalse:", "isEmpty", "error:", "createPackage:"],
  2541. referencedClasses: []
  2542. }),
  2543. globals.SmalltalkImage);
  2544. smalltalk.addMethod(
  2545. smalltalk.method({
  2546. selector: "current",
  2547. protocol: 'accessing',
  2548. fn: function (){
  2549. var self=this;
  2550. return smalltalk.withContext(function($ctx1) {
  2551. self._deprecatedAPI();
  2552. return self;
  2553. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage)})},
  2554. args: [],
  2555. source: "current\x0a\x09\x22Backward compatibility for Smalltalk current ...\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self",
  2556. messageSends: ["deprecatedAPI"],
  2557. referencedClasses: []
  2558. }),
  2559. globals.SmalltalkImage);
  2560. smalltalk.addMethod(
  2561. smalltalk.method({
  2562. selector: "defaultAmdNamespace",
  2563. protocol: 'accessing amd',
  2564. fn: function (){
  2565. var self=this;
  2566. return smalltalk.withContext(function($ctx1) {
  2567. var $1;
  2568. $1="transport.defaultAmdNamespace"._settingValue();
  2569. return $1;
  2570. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},globals.SmalltalkImage)})},
  2571. args: [],
  2572. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  2573. messageSends: ["settingValue"],
  2574. referencedClasses: []
  2575. }),
  2576. globals.SmalltalkImage);
  2577. smalltalk.addMethod(
  2578. smalltalk.method({
  2579. selector: "defaultAmdNamespace:",
  2580. protocol: 'accessing amd',
  2581. fn: function (aString){
  2582. var self=this;
  2583. return smalltalk.withContext(function($ctx1) {
  2584. "transport.defaultAmdNamespace"._settingValue_(aString);
  2585. return self}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},globals.SmalltalkImage)})},
  2586. args: ["aString"],
  2587. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  2588. messageSends: ["settingValue:"],
  2589. referencedClasses: []
  2590. }),
  2591. globals.SmalltalkImage);
  2592. smalltalk.addMethod(
  2593. smalltalk.method({
  2594. selector: "deleteClass:",
  2595. protocol: 'private',
  2596. fn: function (aClass){
  2597. var self=this;
  2598. return smalltalk.withContext(function($ctx1) {
  2599. smalltalk.removeClass(aClass);
  2600. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},globals.SmalltalkImage)})},
  2601. args: ["aClass"],
  2602. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<smalltalk.removeClass(aClass)>",
  2603. messageSends: [],
  2604. referencedClasses: []
  2605. }),
  2606. globals.SmalltalkImage);
  2607. smalltalk.addMethod(
  2608. smalltalk.method({
  2609. selector: "deleteGlobalJsVariable:",
  2610. protocol: 'globals',
  2611. fn: function (aString){
  2612. var self=this;
  2613. return smalltalk.withContext(function($ctx1) {
  2614. _st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  2615. }));
  2616. return self}, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)})},
  2617. args: ["aString"],
  2618. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  2619. messageSends: ["remove:ifAbsent:", "globalJsVariables"],
  2620. referencedClasses: []
  2621. }),
  2622. globals.SmalltalkImage);
  2623. smalltalk.addMethod(
  2624. smalltalk.method({
  2625. selector: "deletePackage:",
  2626. protocol: 'private',
  2627. fn: function (packageName){
  2628. var self=this;
  2629. return smalltalk.withContext(function($ctx1) {
  2630. delete smalltalk.packages[packageName];
  2631. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},globals.SmalltalkImage)})},
  2632. args: ["packageName"],
  2633. 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]>",
  2634. messageSends: [],
  2635. referencedClasses: []
  2636. }),
  2637. globals.SmalltalkImage);
  2638. smalltalk.addMethod(
  2639. smalltalk.method({
  2640. selector: "globalJsVariables",
  2641. protocol: 'globals',
  2642. fn: function (){
  2643. var self=this;
  2644. return smalltalk.withContext(function($ctx1) {
  2645. return smalltalk.globalJsVariables;
  2646. return self}, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},globals.SmalltalkImage)})},
  2647. args: [],
  2648. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return smalltalk.globalJsVariables>",
  2649. messageSends: [],
  2650. referencedClasses: []
  2651. }),
  2652. globals.SmalltalkImage);
  2653. smalltalk.addMethod(
  2654. smalltalk.method({
  2655. selector: "globals",
  2656. protocol: 'accessing',
  2657. fn: function (){
  2658. var self=this;
  2659. return smalltalk.withContext(function($ctx1) {
  2660. return globals;
  2661. return self}, function($ctx1) {$ctx1.fill(self,"globals",{},globals.SmalltalkImage)})},
  2662. args: [],
  2663. source: "globals\x0a\x09\x22Future compatibility to be able to use Smalltalk globals at: ...\x22\x0a\x09<return globals>",
  2664. messageSends: [],
  2665. referencedClasses: []
  2666. }),
  2667. globals.SmalltalkImage);
  2668. smalltalk.addMethod(
  2669. smalltalk.method({
  2670. selector: "includesKey:",
  2671. protocol: 'accessing',
  2672. fn: function (aKey){
  2673. var self=this;
  2674. return smalltalk.withContext(function($ctx1) {
  2675. return smalltalk.hasOwnProperty(aKey);
  2676. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.SmalltalkImage)})},
  2677. args: ["aKey"],
  2678. source: "includesKey: aKey\x0a\x09<return smalltalk.hasOwnProperty(aKey)>",
  2679. messageSends: [],
  2680. referencedClasses: []
  2681. }),
  2682. globals.SmalltalkImage);
  2683. smalltalk.addMethod(
  2684. smalltalk.method({
  2685. selector: "isSmalltalkObject:",
  2686. protocol: 'testing',
  2687. fn: function (anObject){
  2688. var self=this;
  2689. return smalltalk.withContext(function($ctx1) {
  2690. return typeof anObject.klass !== 'undefined';
  2691. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},globals.SmalltalkImage)})},
  2692. args: ["anObject"],
  2693. 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'>",
  2694. messageSends: [],
  2695. referencedClasses: []
  2696. }),
  2697. globals.SmalltalkImage);
  2698. smalltalk.addMethod(
  2699. smalltalk.method({
  2700. selector: "packageAt:",
  2701. protocol: 'packages',
  2702. fn: function (packageName){
  2703. var self=this;
  2704. return smalltalk.withContext(function($ctx1) {
  2705. return smalltalk.packages[packageName];
  2706. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},globals.SmalltalkImage)})},
  2707. args: ["packageName"],
  2708. source: "packageAt: packageName\x0a\x09<return smalltalk.packages[packageName]>",
  2709. messageSends: [],
  2710. referencedClasses: []
  2711. }),
  2712. globals.SmalltalkImage);
  2713. smalltalk.addMethod(
  2714. smalltalk.method({
  2715. selector: "packageAt:ifAbsent:",
  2716. protocol: 'packages',
  2717. fn: function (packageName,aBlock){
  2718. var self=this;
  2719. return smalltalk.withContext(function($ctx1) {
  2720. var $2,$1;
  2721. $2=self._packageAt_(packageName);
  2722. $1=_st($2)._ifNil_(aBlock);
  2723. return $1;
  2724. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},globals.SmalltalkImage)})},
  2725. args: ["packageName", "aBlock"],
  2726. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  2727. messageSends: ["ifNil:", "packageAt:"],
  2728. referencedClasses: []
  2729. }),
  2730. globals.SmalltalkImage);
  2731. smalltalk.addMethod(
  2732. smalltalk.method({
  2733. selector: "packages",
  2734. protocol: 'packages',
  2735. fn: function (){
  2736. var self=this;
  2737. return smalltalk.withContext(function($ctx1) {
  2738. return Object.keys(smalltalk.packages).map(function(k) {
  2739. return smalltalk.packages[k];
  2740. })
  2741. ;
  2742. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},globals.SmalltalkImage)})},
  2743. args: [],
  2744. 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>",
  2745. messageSends: [],
  2746. referencedClasses: []
  2747. }),
  2748. globals.SmalltalkImage);
  2749. smalltalk.addMethod(
  2750. smalltalk.method({
  2751. selector: "parse:",
  2752. protocol: 'accessing',
  2753. fn: function (aString){
  2754. var self=this;
  2755. var result;
  2756. return smalltalk.withContext(function($ctx1) {
  2757. var $2,$3,$1;
  2758. self._try_catch_((function(){
  2759. return smalltalk.withContext(function($ctx2) {
  2760. result=self._basicParse_(aString);
  2761. return result;
  2762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(ex){
  2763. return smalltalk.withContext(function($ctx2) {
  2764. return _st(self._parseError_parsing_(ex,aString))._signal();
  2765. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  2766. $2=result;
  2767. _st($2)._source_(aString);
  2768. $3=_st($2)._yourself();
  2769. $1=$3;
  2770. return $1;
  2771. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},globals.SmalltalkImage)})},
  2772. args: ["aString"],
  2773. 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",
  2774. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
  2775. referencedClasses: []
  2776. }),
  2777. globals.SmalltalkImage);
  2778. smalltalk.addMethod(
  2779. smalltalk.method({
  2780. selector: "parseError:parsing:",
  2781. protocol: 'error handling',
  2782. fn: function (anException,aString){
  2783. var self=this;
  2784. function $ParseError(){return globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  2785. return smalltalk.withContext(function($ctx1) {
  2786. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  2787. $2=_st($ParseError())._new();
  2788. $8=_st(anException)._basicAt_("line");
  2789. $ctx1.sendIdx["basicAt:"]=1;
  2790. $7="Parse error on line ".__comma($8);
  2791. $6=_st($7).__comma(" column ");
  2792. $ctx1.sendIdx[","]=4;
  2793. $9=_st(anException)._basicAt_("column");
  2794. $ctx1.sendIdx["basicAt:"]=2;
  2795. $5=_st($6).__comma($9);
  2796. $ctx1.sendIdx[","]=3;
  2797. $4=_st($5).__comma(" : Unexpected character ");
  2798. $ctx1.sendIdx[","]=2;
  2799. $3=_st($4).__comma(_st(anException)._basicAt_("found"));
  2800. $ctx1.sendIdx[","]=1;
  2801. $1=_st($2)._messageText_($3);
  2802. return $1;
  2803. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},globals.SmalltalkImage)})},
  2804. args: ["anException", "aString"],
  2805. 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')",
  2806. messageSends: ["messageText:", "new", ",", "basicAt:"],
  2807. referencedClasses: ["ParseError"]
  2808. }),
  2809. globals.SmalltalkImage);
  2810. smalltalk.addMethod(
  2811. smalltalk.method({
  2812. selector: "pseudoVariableNames",
  2813. protocol: 'accessing',
  2814. fn: function (){
  2815. var self=this;
  2816. var $1;
  2817. $1=["self", "super", "nil", "true", "false", "thisContext"];
  2818. return $1;
  2819. },
  2820. args: [],
  2821. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  2822. messageSends: [],
  2823. referencedClasses: []
  2824. }),
  2825. globals.SmalltalkImage);
  2826. smalltalk.addMethod(
  2827. smalltalk.method({
  2828. selector: "readJSObject:",
  2829. protocol: 'accessing',
  2830. fn: function (anObject){
  2831. var self=this;
  2832. return smalltalk.withContext(function($ctx1) {
  2833. return smalltalk.readJSObject(anObject);
  2834. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},globals.SmalltalkImage)})},
  2835. args: ["anObject"],
  2836. source: "readJSObject: anObject\x0a\x09<return smalltalk.readJSObject(anObject)>",
  2837. messageSends: [],
  2838. referencedClasses: []
  2839. }),
  2840. globals.SmalltalkImage);
  2841. smalltalk.addMethod(
  2842. smalltalk.method({
  2843. selector: "removeClass:",
  2844. protocol: 'classes',
  2845. fn: function (aClass){
  2846. var self=this;
  2847. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  2848. function $ClassRemoved(){return globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  2849. return smalltalk.withContext(function($ctx1) {
  2850. var $1,$2,$3;
  2851. $1=_st(aClass)._isMetaclass();
  2852. if(smalltalk.assert($1)){
  2853. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  2854. };
  2855. self._deleteClass_(aClass);
  2856. $2=_st($ClassRemoved())._new();
  2857. _st($2)._theClass_(aClass);
  2858. $3=_st($2)._yourself();
  2859. _st(_st($SystemAnnouncer())._current())._announce_($3);
  2860. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.SmalltalkImage)})},
  2861. args: ["aClass"],
  2862. 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)",
  2863. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"],
  2864. referencedClasses: ["SystemAnnouncer", "ClassRemoved"]
  2865. }),
  2866. globals.SmalltalkImage);
  2867. smalltalk.addMethod(
  2868. smalltalk.method({
  2869. selector: "removePackage:",
  2870. protocol: 'packages',
  2871. fn: function (packageName){
  2872. var self=this;
  2873. var pkg;
  2874. return smalltalk.withContext(function($ctx1) {
  2875. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  2876. return smalltalk.withContext(function($ctx2) {
  2877. return self._error_("Missing package: ".__comma(packageName));
  2878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2879. _st(_st(pkg)._classes())._do_((function(each){
  2880. return smalltalk.withContext(function($ctx2) {
  2881. return self._removeClass_(each);
  2882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  2883. self._deletePackage_(packageName);
  2884. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},globals.SmalltalkImage)})},
  2885. args: ["packageName"],
  2886. 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",
  2887. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"],
  2888. referencedClasses: []
  2889. }),
  2890. globals.SmalltalkImage);
  2891. smalltalk.addMethod(
  2892. smalltalk.method({
  2893. selector: "renamePackage:to:",
  2894. protocol: 'packages',
  2895. fn: function (packageName,newName){
  2896. var self=this;
  2897. var pkg;
  2898. return smalltalk.withContext(function($ctx1) {
  2899. var $1,$2;
  2900. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  2901. return smalltalk.withContext(function($ctx2) {
  2902. $1="Missing package: ".__comma(packageName);
  2903. $ctx2.sendIdx[","]=1;
  2904. return self._error_($1);
  2905. $ctx2.sendIdx["error:"]=1;
  2906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2907. $2=self._packageAt_(newName);
  2908. if(($receiver = $2) == nil || $receiver == null){
  2909. $2;
  2910. } else {
  2911. self._error_("Already exists a package called: ".__comma(newName));
  2912. };
  2913. _st(self._at_("packages"))._at_put_(newName,pkg);
  2914. _st(pkg)._name_(newName);
  2915. self._deletePackage_(packageName);
  2916. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},globals.SmalltalkImage)})},
  2917. args: ["packageName", "newName"],
  2918. 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.",
  2919. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"],
  2920. referencedClasses: []
  2921. }),
  2922. globals.SmalltalkImage);
  2923. smalltalk.addMethod(
  2924. smalltalk.method({
  2925. selector: "reservedWords",
  2926. protocol: 'accessing',
  2927. fn: function (){
  2928. var self=this;
  2929. return smalltalk.withContext(function($ctx1) {
  2930. return smalltalk.reservedWords;
  2931. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},globals.SmalltalkImage)})},
  2932. args: [],
  2933. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return smalltalk.reservedWords>",
  2934. messageSends: [],
  2935. referencedClasses: []
  2936. }),
  2937. globals.SmalltalkImage);
  2938. smalltalk.addMethod(
  2939. smalltalk.method({
  2940. selector: "settings",
  2941. protocol: 'accessing',
  2942. fn: function (){
  2943. var self=this;
  2944. function $SmalltalkSettings(){return globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  2945. return $SmalltalkSettings();
  2946. },
  2947. args: [],
  2948. source: "settings\x0a\x09^ SmalltalkSettings",
  2949. messageSends: [],
  2950. referencedClasses: ["SmalltalkSettings"]
  2951. }),
  2952. globals.SmalltalkImage);
  2953. smalltalk.addMethod(
  2954. smalltalk.method({
  2955. selector: "version",
  2956. protocol: 'accessing',
  2957. fn: function (){
  2958. var self=this;
  2959. return "0.13.0-pre";
  2960. },
  2961. args: [],
  2962. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.13.0-pre'",
  2963. messageSends: [],
  2964. referencedClasses: []
  2965. }),
  2966. globals.SmalltalkImage);
  2967. smalltalk.addMethod(
  2968. smalltalk.method({
  2969. selector: "vm",
  2970. protocol: 'accessing',
  2971. fn: function (){
  2972. var self=this;
  2973. return smalltalk.withContext(function($ctx1) {
  2974. return smalltalk;
  2975. return self}, function($ctx1) {$ctx1.fill(self,"vm",{},globals.SmalltalkImage)})},
  2976. args: [],
  2977. source: "vm\x0a\x09\x22Future compatibility to be able to use Smalltalk vm ...\x22\x0a\x09<return smalltalk>",
  2978. messageSends: [],
  2979. referencedClasses: []
  2980. }),
  2981. globals.SmalltalkImage);
  2982. globals.SmalltalkImage.klass.iVarNames = ['current'];
  2983. smalltalk.addMethod(
  2984. smalltalk.method({
  2985. selector: "current",
  2986. protocol: 'instance creation',
  2987. fn: function (){
  2988. var self=this;
  2989. return smalltalk.withContext(function($ctx1) {
  2990. var $2,$1;
  2991. $2=self["@current"];
  2992. if(($receiver = $2) == nil || $receiver == null){
  2993. self["@current"]=globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply(_st(self), []);
  2994. $1=self["@current"];
  2995. } else {
  2996. self._deprecatedAPI();
  2997. $1=self["@current"];
  2998. };
  2999. return $1;
  3000. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage.klass)})},
  3001. args: [],
  3002. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  3003. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"],
  3004. referencedClasses: []
  3005. }),
  3006. globals.SmalltalkImage.klass);
  3007. smalltalk.addMethod(
  3008. smalltalk.method({
  3009. selector: "initialize",
  3010. protocol: 'initialization',
  3011. fn: function (){
  3012. var self=this;
  3013. return smalltalk.withContext(function($ctx1) {
  3014. _st(globals)._at_put_("Smalltalk",self._current());
  3015. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.SmalltalkImage.klass)})},
  3016. args: [],
  3017. source: "initialize\x0a\x09globals at: 'Smalltalk' put: self current",
  3018. messageSends: ["at:put:", "current"],
  3019. referencedClasses: []
  3020. }),
  3021. globals.SmalltalkImage.klass);
  3022. smalltalk.addMethod(
  3023. smalltalk.method({
  3024. selector: "new",
  3025. protocol: 'instance creation',
  3026. fn: function (){
  3027. var self=this;
  3028. return smalltalk.withContext(function($ctx1) {
  3029. self._shouldNotImplement();
  3030. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.SmalltalkImage.klass)})},
  3031. args: [],
  3032. source: "new\x0a\x09self shouldNotImplement",
  3033. messageSends: ["shouldNotImplement"],
  3034. referencedClasses: []
  3035. }),
  3036. globals.SmalltalkImage.klass);
  3037. smalltalk.addMethod(
  3038. smalltalk.method({
  3039. selector: "do:displayingProgress:",
  3040. protocol: '*Kernel-Infrastructure',
  3041. fn: function (aBlock,aString){
  3042. var self=this;
  3043. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  3044. return smalltalk.withContext(function($ctx1) {
  3045. _st($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  3046. return self}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},globals.SequenceableCollection)})},
  3047. args: ["aBlock", "aString"],
  3048. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  3049. messageSends: ["do:on:displaying:"],
  3050. referencedClasses: ["ProgressHandler"]
  3051. }),
  3052. globals.SequenceableCollection);
  3053. smalltalk.addMethod(
  3054. smalltalk.method({
  3055. selector: "asJavaScriptSelector",
  3056. protocol: '*Kernel-Infrastructure',
  3057. fn: function (){
  3058. var self=this;
  3059. return smalltalk.withContext(function($ctx1) {
  3060. var $1;
  3061. $1=self._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  3062. return $1;
  3063. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},globals.String)})},
  3064. args: [],
  3065. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^ self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  3066. messageSends: ["replace:with:"],
  3067. referencedClasses: []
  3068. }),
  3069. globals.String);
  3070. smalltalk.addMethod(
  3071. smalltalk.method({
  3072. selector: "asSetting",
  3073. protocol: '*Kernel-Infrastructure',
  3074. fn: function (){
  3075. var self=this;
  3076. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  3077. return smalltalk.withContext(function($ctx1) {
  3078. var $1;
  3079. $1=_st($Setting())._at_ifAbsent_(self,nil);
  3080. return $1;
  3081. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},globals.String)})},
  3082. args: [],
  3083. source: "asSetting\x0a\x09^ Setting at: self ifAbsent: nil",
  3084. messageSends: ["at:ifAbsent:"],
  3085. referencedClasses: ["Setting"]
  3086. }),
  3087. globals.String);
  3088. smalltalk.addMethod(
  3089. smalltalk.method({
  3090. selector: "asSettingIfAbsent:",
  3091. protocol: '*Kernel-Infrastructure',
  3092. fn: function (aString){
  3093. var self=this;
  3094. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  3095. return smalltalk.withContext(function($ctx1) {
  3096. var $1;
  3097. $1=_st($Setting())._at_ifAbsent_(self,aString);
  3098. return $1;
  3099. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aString:aString},globals.String)})},
  3100. args: ["aString"],
  3101. source: "asSettingIfAbsent: aString\x0a\x09^ Setting at: self ifAbsent: aString",
  3102. messageSends: ["at:ifAbsent:"],
  3103. referencedClasses: ["Setting"]
  3104. }),
  3105. globals.String);
  3106. smalltalk.addMethod(
  3107. smalltalk.method({
  3108. selector: "settingValue",
  3109. protocol: '*Kernel-Infrastructure',
  3110. fn: function (){
  3111. var self=this;
  3112. return smalltalk.withContext(function($ctx1) {
  3113. var $1;
  3114. $1=_st(self._asSetting())._value();
  3115. return $1;
  3116. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},globals.String)})},
  3117. args: [],
  3118. source: "settingValue\x0a\x09^ self asSetting value",
  3119. messageSends: ["value", "asSetting"],
  3120. referencedClasses: []
  3121. }),
  3122. globals.String);
  3123. smalltalk.addMethod(
  3124. smalltalk.method({
  3125. selector: "settingValue:",
  3126. protocol: '*Kernel-Infrastructure',
  3127. fn: function (aString){
  3128. var self=this;
  3129. return smalltalk.withContext(function($ctx1) {
  3130. var $1;
  3131. $1=_st(self._asSetting())._value_(aString);
  3132. return $1;
  3133. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aString:aString},globals.String)})},
  3134. args: ["aString"],
  3135. source: "settingValue: aString\x0a\x09^ self asSetting value: aString",
  3136. messageSends: ["value:", "asSetting"],
  3137. referencedClasses: []
  3138. }),
  3139. globals.String);
  3140. smalltalk.addMethod(
  3141. smalltalk.method({
  3142. selector: "settingValueIfAbsent:",
  3143. protocol: '*Kernel-Infrastructure',
  3144. fn: function (aString){
  3145. var self=this;
  3146. return smalltalk.withContext(function($ctx1) {
  3147. var $1;
  3148. $1=_st(self._asSettingIfAbsent_(aString))._value();
  3149. return $1;
  3150. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aString:aString},globals.String)})},
  3151. args: ["aString"],
  3152. source: "settingValueIfAbsent: aString\x0a\x09^ (self asSettingIfAbsent: aString) value",
  3153. messageSends: ["value", "asSettingIfAbsent:"],
  3154. referencedClasses: []
  3155. }),
  3156. globals.String);
  3157. });