Kernel-Infrastructure.js 91 KB

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