Kernel-Infrastructure.js 123 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509
  1. define(["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  3. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  5. $core.addPackage('Kernel-Infrastructure');
  6. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  7. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  8. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  9. //>>excludeStart("ide", pragmas.excludeIdeData);
  10. $globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  11. //>>excludeEnd("ide");
  12. $core.addMethod(
  13. $core.method({
  14. selector: "=",
  15. protocol: 'comparing',
  16. fn: function (anObject){
  17. var self=this;
  18. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19. return $core.withContext(function($ctx1) {
  20. //>>excludeEnd("ctx");
  21. var $2,$1;
  22. $2=$recv(anObject)._class();
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. $ctx1.sendIdx["class"]=1;
  25. //>>excludeEnd("ctx");
  26. $1=$recv($2).__eq_eq(self._class());
  27. if(!$core.assert($1)){
  28. return false;
  29. }
  30. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  33. //>>excludeEnd("ctx");
  34. },
  35. //>>excludeStart("ide", pragmas.excludeIdeData);
  36. args: ["anObject"],
  37. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  38. referencedClasses: ["JSObjectProxy"],
  39. //>>excludeEnd("ide");
  40. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  41. }),
  42. $globals.JSObjectProxy);
  43. $core.addMethod(
  44. $core.method({
  45. selector: "asJSON",
  46. protocol: 'enumerating',
  47. fn: function (){
  48. var self=this;
  49. return self["@jsObject"];
  50. },
  51. //>>excludeStart("ide", pragmas.excludeIdeData);
  52. args: [],
  53. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  54. referencedClasses: [],
  55. //>>excludeEnd("ide");
  56. messageSends: []
  57. }),
  58. $globals.JSObjectProxy);
  59. $core.addMethod(
  60. $core.method({
  61. selector: "at:",
  62. protocol: 'accessing',
  63. fn: function (aString){
  64. var self=this;
  65. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66. return $core.withContext(function($ctx1) {
  67. //>>excludeEnd("ctx");
  68. return self['@jsObject'][aString];
  69. return self;
  70. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  72. //>>excludeEnd("ctx");
  73. },
  74. //>>excludeStart("ide", pragmas.excludeIdeData);
  75. args: ["aString"],
  76. source: "at: aString\x0a\x09<inlineJS: 'return self[''@jsObject''][aString]'>",
  77. referencedClasses: [],
  78. //>>excludeEnd("ide");
  79. messageSends: []
  80. }),
  81. $globals.JSObjectProxy);
  82. $core.addMethod(
  83. $core.method({
  84. selector: "at:ifAbsent:",
  85. protocol: 'accessing',
  86. fn: function (aString,aBlock){
  87. var self=this;
  88. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  89. return $core.withContext(function($ctx1) {
  90. //>>excludeEnd("ctx");
  91. var obj = self['@jsObject'];
  92. return aString in obj ? obj[aString] : aBlock._value();
  93. ;
  94. return self;
  95. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  96. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  97. //>>excludeEnd("ctx");
  98. },
  99. //>>excludeStart("ide", pragmas.excludeIdeData);
  100. args: ["aString", "aBlock"],
  101. 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<inlineJS: '\x0a\x09\x09var obj = self[''@jsObject''];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09'>",
  102. referencedClasses: [],
  103. //>>excludeEnd("ide");
  104. messageSends: []
  105. }),
  106. $globals.JSObjectProxy);
  107. $core.addMethod(
  108. $core.method({
  109. selector: "at:ifPresent:",
  110. protocol: 'accessing',
  111. fn: function (aString,aBlock){
  112. var self=this;
  113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  114. return $core.withContext(function($ctx1) {
  115. //>>excludeEnd("ctx");
  116. var obj = self['@jsObject'];
  117. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  118. ;
  119. return self;
  120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  121. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  122. //>>excludeEnd("ctx");
  123. },
  124. //>>excludeStart("ide", pragmas.excludeIdeData);
  125. args: ["aString", "aBlock"],
  126. 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<inlineJS: '\x0a\x09\x09var obj = self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09'>",
  127. referencedClasses: [],
  128. //>>excludeEnd("ide");
  129. messageSends: []
  130. }),
  131. $globals.JSObjectProxy);
  132. $core.addMethod(
  133. $core.method({
  134. selector: "at:ifPresent:ifAbsent:",
  135. protocol: 'accessing',
  136. fn: function (aString,aBlock,anotherBlock){
  137. var self=this;
  138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  139. return $core.withContext(function($ctx1) {
  140. //>>excludeEnd("ctx");
  141. var obj = self['@jsObject'];
  142. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  143. ;
  144. return self;
  145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  146. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  147. //>>excludeEnd("ctx");
  148. },
  149. //>>excludeStart("ide", pragmas.excludeIdeData);
  150. args: ["aString", "aBlock", "anotherBlock"],
  151. 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<inlineJS: '\x0a\x09\x09var obj = self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09'>",
  152. referencedClasses: [],
  153. //>>excludeEnd("ide");
  154. messageSends: []
  155. }),
  156. $globals.JSObjectProxy);
  157. $core.addMethod(
  158. $core.method({
  159. selector: "at:put:",
  160. protocol: 'accessing',
  161. fn: function (aString,anObject){
  162. var self=this;
  163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  164. return $core.withContext(function($ctx1) {
  165. //>>excludeEnd("ctx");
  166. return self['@jsObject'][aString] = anObject;
  167. return self;
  168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  169. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  170. //>>excludeEnd("ctx");
  171. },
  172. //>>excludeStart("ide", pragmas.excludeIdeData);
  173. args: ["aString", "anObject"],
  174. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return self[''@jsObject''][aString] = anObject'>",
  175. referencedClasses: [],
  176. //>>excludeEnd("ide");
  177. messageSends: []
  178. }),
  179. $globals.JSObjectProxy);
  180. $core.addMethod(
  181. $core.method({
  182. selector: "doesNotUnderstand:",
  183. protocol: 'proxy',
  184. fn: function (aMessage){
  185. var self=this;
  186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  187. return $core.withContext(function($ctx1) {
  188. //>>excludeEnd("ctx");
  189. var $1,$receiver;
  190. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  191. if(($receiver = $1) == null || $receiver.isNil){
  192. return (
  193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  194. $ctx1.supercall = true,
  195. //>>excludeEnd("ctx");
  196. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  198. $ctx1.supercall = false;
  199. //>>excludeEnd("ctx");;
  200. } else {
  201. var jsSelector;
  202. jsSelector=$receiver;
  203. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  204. }
  205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  206. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  207. //>>excludeEnd("ctx");
  208. },
  209. //>>excludeStart("ide", pragmas.excludeIdeData);
  210. args: ["aMessage"],
  211. source: "doesNotUnderstand: aMessage\x0a\x09^ (JSObjectProxy lookupProperty: aMessage selector asJavaScriptPropertyName ofProxy: self)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09JSObjectProxy \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments\x0a\x09\x09\x09\x09ofProxy: self ]",
  212. referencedClasses: ["JSObjectProxy"],
  213. //>>excludeEnd("ide");
  214. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  215. }),
  216. $globals.JSObjectProxy);
  217. $core.addMethod(
  218. $core.method({
  219. selector: "in:",
  220. protocol: 'accessing',
  221. fn: function (aValuable){
  222. var self=this;
  223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  224. return $core.withContext(function($ctx1) {
  225. //>>excludeEnd("ctx");
  226. return $recv(aValuable)._value_(self["@jsObject"]);
  227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  228. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  229. //>>excludeEnd("ctx");
  230. },
  231. //>>excludeStart("ide", pragmas.excludeIdeData);
  232. args: ["aValuable"],
  233. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  234. referencedClasses: [],
  235. //>>excludeEnd("ide");
  236. messageSends: ["value:"]
  237. }),
  238. $globals.JSObjectProxy);
  239. $core.addMethod(
  240. $core.method({
  241. selector: "jsObject",
  242. protocol: 'accessing',
  243. fn: function (){
  244. var self=this;
  245. return self["@jsObject"];
  246. },
  247. //>>excludeStart("ide", pragmas.excludeIdeData);
  248. args: [],
  249. source: "jsObject\x0a\x09^ jsObject",
  250. referencedClasses: [],
  251. //>>excludeEnd("ide");
  252. messageSends: []
  253. }),
  254. $globals.JSObjectProxy);
  255. $core.addMethod(
  256. $core.method({
  257. selector: "keysAndValuesDo:",
  258. protocol: 'enumerating',
  259. fn: function (aBlock){
  260. var self=this;
  261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  262. return $core.withContext(function($ctx1) {
  263. //>>excludeEnd("ctx");
  264. var o = self['@jsObject'];
  265. for(var i in o) {
  266. aBlock._value_value_(i, o[i]);
  267. }
  268. ;
  269. return self;
  270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  271. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  272. //>>excludeEnd("ctx");
  273. },
  274. //>>excludeStart("ide", pragmas.excludeIdeData);
  275. args: ["aBlock"],
  276. source: "keysAndValuesDo: aBlock\x0a\x09<inlineJS: '\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'>",
  277. referencedClasses: [],
  278. //>>excludeEnd("ide");
  279. messageSends: []
  280. }),
  281. $globals.JSObjectProxy);
  282. $core.addMethod(
  283. $core.method({
  284. selector: "printOn:",
  285. protocol: 'printing',
  286. fn: function (aStream){
  287. var self=this;
  288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  289. return $core.withContext(function($ctx1) {
  290. //>>excludeEnd("ctx");
  291. $recv(aStream)._nextPutAll_(self._printString());
  292. return self;
  293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  294. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  295. //>>excludeEnd("ctx");
  296. },
  297. //>>excludeStart("ide", pragmas.excludeIdeData);
  298. args: ["aStream"],
  299. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  300. referencedClasses: [],
  301. //>>excludeEnd("ide");
  302. messageSends: ["nextPutAll:", "printString"]
  303. }),
  304. $globals.JSObjectProxy);
  305. $core.addMethod(
  306. $core.method({
  307. selector: "printString",
  308. protocol: 'printing',
  309. fn: function (){
  310. var self=this;
  311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  312. return $core.withContext(function($ctx1) {
  313. //>>excludeEnd("ctx");
  314. var js = self['@jsObject'];
  315. return js.toString
  316. ? js.toString()
  317. : Object.prototype.toString.call(js)
  318. ;
  319. return self;
  320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  321. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  322. //>>excludeEnd("ctx");
  323. },
  324. //>>excludeStart("ide", pragmas.excludeIdeData);
  325. args: [],
  326. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = self[''@jsObject''];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  327. referencedClasses: [],
  328. //>>excludeEnd("ide");
  329. messageSends: []
  330. }),
  331. $globals.JSObjectProxy);
  332. $core.addMethod(
  333. $core.method({
  334. selector: "putOn:",
  335. protocol: 'streaming',
  336. fn: function (aStream){
  337. var self=this;
  338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  339. return $core.withContext(function($ctx1) {
  340. //>>excludeEnd("ctx");
  341. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  342. return self;
  343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  344. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  345. //>>excludeEnd("ctx");
  346. },
  347. //>>excludeStart("ide", pragmas.excludeIdeData);
  348. args: ["aStream"],
  349. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  350. referencedClasses: [],
  351. //>>excludeEnd("ide");
  352. messageSends: ["nextPutJSObject:"]
  353. }),
  354. $globals.JSObjectProxy);
  355. $core.addMethod(
  356. $core.method({
  357. selector: "addObjectVariablesTo:ofProxy:",
  358. protocol: 'proxy',
  359. fn: function (aDictionary,aProxy){
  360. var self=this;
  361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  362. return $core.withContext(function($ctx1) {
  363. //>>excludeEnd("ctx");
  364. var jsObject = aProxy['@jsObject'];
  365. for(var i in jsObject) {
  366. aDictionary._at_put_(i, jsObject[i]);
  367. }
  368. ;
  369. return self;
  370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  371. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  372. //>>excludeEnd("ctx");
  373. },
  374. //>>excludeStart("ide", pragmas.excludeIdeData);
  375. args: ["aDictionary", "aProxy"],
  376. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09var jsObject = aProxy[''@jsObject''];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09'>",
  377. referencedClasses: [],
  378. //>>excludeEnd("ide");
  379. messageSends: []
  380. }),
  381. $globals.JSObjectProxy.klass);
  382. $core.addMethod(
  383. $core.method({
  384. selector: "compareJSObjectOfProxy:withProxy:",
  385. protocol: 'proxy',
  386. fn: function (aProxy,anotherProxy){
  387. var self=this;
  388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  389. return $core.withContext(function($ctx1) {
  390. //>>excludeEnd("ctx");
  391. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  392. return aProxy["@jsObject"] === anotherJSObject;
  393. return self;
  394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  395. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  396. //>>excludeEnd("ctx");
  397. },
  398. //>>excludeStart("ide", pragmas.excludeIdeData);
  399. args: ["aProxy", "anotherProxy"],
  400. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  401. referencedClasses: [],
  402. //>>excludeEnd("ide");
  403. messageSends: []
  404. }),
  405. $globals.JSObjectProxy.klass);
  406. $core.addMethod(
  407. $core.method({
  408. selector: "forwardMessage:withArguments:ofProxy:",
  409. protocol: 'proxy',
  410. fn: function (aString,anArray,aProxy){
  411. var self=this;
  412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  413. return $core.withContext(function($ctx1) {
  414. //>>excludeEnd("ctx");
  415. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  416. ;
  417. return self;
  418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  419. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  420. //>>excludeEnd("ctx");
  421. },
  422. //>>excludeStart("ide", pragmas.excludeIdeData);
  423. args: ["aString", "anArray", "aProxy"],
  424. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  425. referencedClasses: [],
  426. //>>excludeEnd("ide");
  427. messageSends: []
  428. }),
  429. $globals.JSObjectProxy.klass);
  430. $core.addMethod(
  431. $core.method({
  432. selector: "jsObject:ofProxy:",
  433. protocol: 'proxy',
  434. fn: function (aJSObject,aProxy){
  435. var self=this;
  436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  437. return $core.withContext(function($ctx1) {
  438. //>>excludeEnd("ctx");
  439. aProxy['@jsObject'] = aJSObject;
  440. return self;
  441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  442. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  443. //>>excludeEnd("ctx");
  444. },
  445. //>>excludeStart("ide", pragmas.excludeIdeData);
  446. args: ["aJSObject", "aProxy"],
  447. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  448. referencedClasses: [],
  449. //>>excludeEnd("ide");
  450. messageSends: []
  451. }),
  452. $globals.JSObjectProxy.klass);
  453. $core.addMethod(
  454. $core.method({
  455. selector: "lookupProperty:ofProxy:",
  456. protocol: 'proxy',
  457. fn: function (aString,aProxy){
  458. var self=this;
  459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  460. return $core.withContext(function($ctx1) {
  461. //>>excludeEnd("ctx");
  462. return aString in aProxy._jsObject() ? aString : nil;
  463. return self;
  464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  465. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  466. //>>excludeEnd("ctx");
  467. },
  468. //>>excludeStart("ide", pragmas.excludeIdeData);
  469. args: ["aString", "aProxy"],
  470. source: "lookupProperty: aString ofProxy: aProxy\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<inlineJS: 'return aString in aProxy._jsObject() ? aString : nil'>",
  471. referencedClasses: [],
  472. //>>excludeEnd("ide");
  473. messageSends: []
  474. }),
  475. $globals.JSObjectProxy.klass);
  476. $core.addMethod(
  477. $core.method({
  478. selector: "on:",
  479. protocol: 'instance creation',
  480. fn: function (aJSObject){
  481. var self=this;
  482. var instance;
  483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  484. return $core.withContext(function($ctx1) {
  485. //>>excludeEnd("ctx");
  486. instance=self._new();
  487. self._jsObject_ofProxy_(aJSObject,instance);
  488. return instance;
  489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  490. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  491. //>>excludeEnd("ctx");
  492. },
  493. //>>excludeStart("ide", pragmas.excludeIdeData);
  494. args: ["aJSObject"],
  495. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  496. referencedClasses: [],
  497. //>>excludeEnd("ide");
  498. messageSends: ["new", "jsObject:ofProxy:"]
  499. }),
  500. $globals.JSObjectProxy.klass);
  501. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  502. //>>excludeStart("ide", pragmas.excludeIdeData);
  503. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  504. //>>excludeEnd("ide");
  505. $core.addMethod(
  506. $core.method({
  507. selector: "addElement:",
  508. protocol: 'accessing',
  509. fn: function (anObject){
  510. var self=this;
  511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  512. return $core.withContext(function($ctx1) {
  513. //>>excludeEnd("ctx");
  514. $core.addElement(self.elements, anObject);
  515. return self;
  516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  517. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  518. //>>excludeEnd("ctx");
  519. },
  520. //>>excludeStart("ide", pragmas.excludeIdeData);
  521. args: ["anObject"],
  522. source: "addElement: anObject\x0a\x09<inlineJS: '$core.addElement(self.elements, anObject)'>",
  523. referencedClasses: [],
  524. //>>excludeEnd("ide");
  525. messageSends: []
  526. }),
  527. $globals.Organizer);
  528. $core.addMethod(
  529. $core.method({
  530. selector: "elements",
  531. protocol: 'accessing',
  532. fn: function (){
  533. var self=this;
  534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  535. return $core.withContext(function($ctx1) {
  536. //>>excludeEnd("ctx");
  537. return $recv(self._basicAt_("elements"))._copy();
  538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  539. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  540. //>>excludeEnd("ctx");
  541. },
  542. //>>excludeStart("ide", pragmas.excludeIdeData);
  543. args: [],
  544. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  545. referencedClasses: [],
  546. //>>excludeEnd("ide");
  547. messageSends: ["copy", "basicAt:"]
  548. }),
  549. $globals.Organizer);
  550. $core.addMethod(
  551. $core.method({
  552. selector: "removeElement:",
  553. protocol: 'accessing',
  554. fn: function (anObject){
  555. var self=this;
  556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  557. return $core.withContext(function($ctx1) {
  558. //>>excludeEnd("ctx");
  559. $core.removeElement(self.elements, anObject);
  560. return self;
  561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  562. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  563. //>>excludeEnd("ctx");
  564. },
  565. //>>excludeStart("ide", pragmas.excludeIdeData);
  566. args: ["anObject"],
  567. source: "removeElement: anObject\x0a\x09<inlineJS: '$core.removeElement(self.elements, anObject)'>",
  568. referencedClasses: [],
  569. //>>excludeEnd("ide");
  570. messageSends: []
  571. }),
  572. $globals.Organizer);
  573. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  574. //>>excludeStart("ide", pragmas.excludeIdeData);
  575. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  576. //>>excludeEnd("ide");
  577. $core.addMethod(
  578. $core.method({
  579. selector: "addElement:",
  580. protocol: 'accessing',
  581. fn: function (aString){
  582. var self=this;
  583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  584. return $core.withContext(function($ctx1) {
  585. //>>excludeEnd("ctx");
  586. var $1,$3,$2;
  587. (
  588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  589. $ctx1.supercall = true,
  590. //>>excludeEnd("ctx");
  591. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($recv(self), [aString]));
  592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  593. $ctx1.supercall = false;
  594. //>>excludeEnd("ctx");;
  595. $1=$recv($globals.SystemAnnouncer)._current();
  596. $3=$recv($globals.ProtocolAdded)._new();
  597. $recv($3)._protocol_(aString);
  598. $recv($3)._theClass_(self._theClass());
  599. $2=$recv($3)._yourself();
  600. $recv($1)._announce_($2);
  601. return self;
  602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  603. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  604. //>>excludeEnd("ctx");
  605. },
  606. //>>excludeStart("ide", pragmas.excludeIdeData);
  607. args: ["aString"],
  608. 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)",
  609. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  610. //>>excludeEnd("ide");
  611. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  612. }),
  613. $globals.ClassOrganizer);
  614. $core.addMethod(
  615. $core.method({
  616. selector: "removeElement:",
  617. protocol: 'accessing',
  618. fn: function (aString){
  619. var self=this;
  620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  621. return $core.withContext(function($ctx1) {
  622. //>>excludeEnd("ctx");
  623. var $1,$3,$2;
  624. (
  625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  626. $ctx1.supercall = true,
  627. //>>excludeEnd("ctx");
  628. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($recv(self), [aString]));
  629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  630. $ctx1.supercall = false;
  631. //>>excludeEnd("ctx");;
  632. $1=$recv($globals.SystemAnnouncer)._current();
  633. $3=$recv($globals.ProtocolRemoved)._new();
  634. $recv($3)._protocol_(aString);
  635. $recv($3)._theClass_(self._theClass());
  636. $2=$recv($3)._yourself();
  637. $recv($1)._announce_($2);
  638. return self;
  639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  640. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  641. //>>excludeEnd("ctx");
  642. },
  643. //>>excludeStart("ide", pragmas.excludeIdeData);
  644. args: ["aString"],
  645. 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)",
  646. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  647. //>>excludeEnd("ide");
  648. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  649. }),
  650. $globals.ClassOrganizer);
  651. $core.addMethod(
  652. $core.method({
  653. selector: "theClass",
  654. protocol: 'accessing',
  655. fn: function (){
  656. var self=this;
  657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  658. return $core.withContext(function($ctx1) {
  659. //>>excludeEnd("ctx");
  660. return self.theClass;
  661. return self;
  662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  663. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  664. //>>excludeEnd("ctx");
  665. },
  666. //>>excludeStart("ide", pragmas.excludeIdeData);
  667. args: [],
  668. source: "theClass\x0a\x09<inlineJS: 'return self.theClass'>",
  669. referencedClasses: [],
  670. //>>excludeEnd("ide");
  671. messageSends: []
  672. }),
  673. $globals.ClassOrganizer);
  674. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  675. //>>excludeStart("ide", pragmas.excludeIdeData);
  676. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  677. //>>excludeEnd("ide");
  678. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  679. //>>excludeStart("ide", pragmas.excludeIdeData);
  680. $globals.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  681. //>>excludeEnd("ide");
  682. $core.addMethod(
  683. $core.method({
  684. selector: "basicImports",
  685. protocol: 'private',
  686. fn: function (){
  687. var self=this;
  688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  689. return $core.withContext(function($ctx1) {
  690. //>>excludeEnd("ctx");
  691. return self.imports || [];
  692. return self;
  693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  694. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  695. //>>excludeEnd("ctx");
  696. },
  697. //>>excludeStart("ide", pragmas.excludeIdeData);
  698. args: [],
  699. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.imports || []'>",
  700. referencedClasses: [],
  701. //>>excludeEnd("ide");
  702. messageSends: []
  703. }),
  704. $globals.Package);
  705. $core.addMethod(
  706. $core.method({
  707. selector: "basicName:",
  708. protocol: 'private',
  709. fn: function (aString){
  710. var self=this;
  711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  712. return $core.withContext(function($ctx1) {
  713. //>>excludeEnd("ctx");
  714. self.pkgName = aString;
  715. return self;
  716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  717. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  718. //>>excludeEnd("ctx");
  719. },
  720. //>>excludeStart("ide", pragmas.excludeIdeData);
  721. args: ["aString"],
  722. source: "basicName: aString\x0a\x09<inlineJS: 'self.pkgName = aString'>",
  723. referencedClasses: [],
  724. //>>excludeEnd("ide");
  725. messageSends: []
  726. }),
  727. $globals.Package);
  728. $core.addMethod(
  729. $core.method({
  730. selector: "basicTransport",
  731. protocol: 'private',
  732. fn: function (){
  733. var self=this;
  734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  735. return $core.withContext(function($ctx1) {
  736. //>>excludeEnd("ctx");
  737. return self.transport;
  738. return self;
  739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  740. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  741. //>>excludeEnd("ctx");
  742. },
  743. //>>excludeStart("ide", pragmas.excludeIdeData);
  744. args: [],
  745. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.transport'>",
  746. referencedClasses: [],
  747. //>>excludeEnd("ide");
  748. messageSends: []
  749. }),
  750. $globals.Package);
  751. $core.addMethod(
  752. $core.method({
  753. selector: "beClean",
  754. protocol: 'accessing',
  755. fn: function (){
  756. var self=this;
  757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  758. return $core.withContext(function($ctx1) {
  759. //>>excludeEnd("ctx");
  760. var $1,$3,$2;
  761. self["@dirty"]=false;
  762. $1=$recv($globals.SystemAnnouncer)._current();
  763. $3=$recv($globals.PackageClean)._new();
  764. $recv($3)._package_(self);
  765. $2=$recv($3)._yourself();
  766. $recv($1)._announce_($2);
  767. return self;
  768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  769. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  770. //>>excludeEnd("ctx");
  771. },
  772. //>>excludeStart("ide", pragmas.excludeIdeData);
  773. args: [],
  774. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  775. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  776. //>>excludeEnd("ide");
  777. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  778. }),
  779. $globals.Package);
  780. $core.addMethod(
  781. $core.method({
  782. selector: "beDirty",
  783. protocol: 'accessing',
  784. fn: function (){
  785. var self=this;
  786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  787. return $core.withContext(function($ctx1) {
  788. //>>excludeEnd("ctx");
  789. var $1,$3,$2;
  790. self["@dirty"]=true;
  791. $1=$recv($globals.SystemAnnouncer)._current();
  792. $3=$recv($globals.PackageDirty)._new();
  793. $recv($3)._package_(self);
  794. $2=$recv($3)._yourself();
  795. $recv($1)._announce_($2);
  796. return self;
  797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  798. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  799. //>>excludeEnd("ctx");
  800. },
  801. //>>excludeStart("ide", pragmas.excludeIdeData);
  802. args: [],
  803. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  804. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  805. //>>excludeEnd("ide");
  806. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  807. }),
  808. $globals.Package);
  809. $core.addMethod(
  810. $core.method({
  811. selector: "classTemplate",
  812. protocol: 'accessing',
  813. fn: function (){
  814. var self=this;
  815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  816. return $core.withContext(function($ctx1) {
  817. //>>excludeEnd("ctx");
  818. return $recv($globals.String)._streamContents_((function(stream){
  819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  820. return $core.withContext(function($ctx2) {
  821. //>>excludeEnd("ctx");
  822. $recv(stream)._nextPutAll_("Object subclass: #NameOfSubclass");
  823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  824. $ctx2.sendIdx["nextPutAll:"]=1;
  825. //>>excludeEnd("ctx");
  826. $recv(stream)._lf();
  827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  828. $ctx2.sendIdx["lf"]=1;
  829. //>>excludeEnd("ctx");
  830. $recv(stream)._tab();
  831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  832. $ctx2.sendIdx["tab"]=1;
  833. //>>excludeEnd("ctx");
  834. $recv(stream)._nextPutAll_("instanceVariableNames: ''");
  835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  836. $ctx2.sendIdx["nextPutAll:"]=2;
  837. //>>excludeEnd("ctx");
  838. $recv(stream)._lf();
  839. $recv(stream)._tab();
  840. $recv(stream)._nextPutAll_("package: ");
  841. return $recv(self._name())._printOn_(stream);
  842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  843. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  844. //>>excludeEnd("ctx");
  845. }));
  846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  847. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  848. //>>excludeEnd("ctx");
  849. },
  850. //>>excludeStart("ide", pragmas.excludeIdeData);
  851. args: [],
  852. source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object subclass: #NameOfSubclass'; lf;\x0a\x09\x09\x09tab; nextPutAll: 'instanceVariableNames: '''''; lf;\x0a\x09\x09\x09tab; nextPutAll: 'package: '.\x0a\x09\x09self name printOn: stream ]",
  853. referencedClasses: ["String"],
  854. //>>excludeEnd("ide");
  855. messageSends: ["streamContents:", "nextPutAll:", "lf", "tab", "printOn:", "name"]
  856. }),
  857. $globals.Package);
  858. $core.addMethod(
  859. $core.method({
  860. selector: "classes",
  861. protocol: 'classes',
  862. fn: function (){
  863. var self=this;
  864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  865. return $core.withContext(function($ctx1) {
  866. //>>excludeEnd("ctx");
  867. return $recv(self._organization())._elements();
  868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  869. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  870. //>>excludeEnd("ctx");
  871. },
  872. //>>excludeStart("ide", pragmas.excludeIdeData);
  873. args: [],
  874. source: "classes\x0a\x09^ self organization elements",
  875. referencedClasses: [],
  876. //>>excludeEnd("ide");
  877. messageSends: ["elements", "organization"]
  878. }),
  879. $globals.Package);
  880. $core.addMethod(
  881. $core.method({
  882. selector: "definition",
  883. protocol: 'accessing',
  884. fn: function (){
  885. var self=this;
  886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  887. return $core.withContext(function($ctx1) {
  888. //>>excludeEnd("ctx");
  889. var $1,$2;
  890. return $recv($globals.String)._streamContents_((function(stream){
  891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  892. return $core.withContext(function($ctx2) {
  893. //>>excludeEnd("ctx");
  894. $1=$recv(self._class())._name();
  895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  896. $ctx2.sendIdx["name"]=1;
  897. //>>excludeEnd("ctx");
  898. $recv(stream)._nextPutAll_($1);
  899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  900. $ctx2.sendIdx["nextPutAll:"]=1;
  901. //>>excludeEnd("ctx");
  902. $recv(stream)._lf();
  903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  904. $ctx2.sendIdx["lf"]=1;
  905. //>>excludeEnd("ctx");
  906. $recv(stream)._tab();
  907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  908. $ctx2.sendIdx["tab"]=1;
  909. //>>excludeEnd("ctx");
  910. $2=$recv(stream)._nextPutAll_("named: ");
  911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  912. $ctx2.sendIdx["nextPutAll:"]=2;
  913. //>>excludeEnd("ctx");
  914. $2;
  915. $recv(self._name())._printOn_(stream);
  916. $recv(stream)._lf();
  917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  918. $ctx2.sendIdx["lf"]=2;
  919. //>>excludeEnd("ctx");
  920. $recv(stream)._tab();
  921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  922. $ctx2.sendIdx["tab"]=2;
  923. //>>excludeEnd("ctx");
  924. $recv(stream)._nextPutAll_("imports: ");
  925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  926. $ctx2.sendIdx["nextPutAll:"]=3;
  927. //>>excludeEnd("ctx");
  928. $recv(stream)._nextPutAll_(self._importsDefinition());
  929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  930. $ctx2.sendIdx["nextPutAll:"]=4;
  931. //>>excludeEnd("ctx");
  932. $recv(stream)._lf();
  933. $recv(stream)._tab();
  934. $recv(stream)._nextPutAll_("transport: (");
  935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  936. $ctx2.sendIdx["nextPutAll:"]=5;
  937. //>>excludeEnd("ctx");
  938. return $recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  940. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  941. //>>excludeEnd("ctx");
  942. }));
  943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  944. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  945. //>>excludeEnd("ctx");
  946. },
  947. //>>excludeStart("ide", pragmas.excludeIdeData);
  948. args: [],
  949. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name; lf;\x0a\x09\x09\x09tab; nextPutAll: 'named: '.\x0a\x09\x09self name printOn: stream.\x0a\x09\x09stream lf;\x0a\x09\x09\x09tab; nextPutAll: 'imports: '; nextPutAll: self importsDefinition; lf;\x0a\x09\x09\x09tab; nextPutAll: 'transport: ('; nextPutAll: self transport definition, ')' ]",
  950. referencedClasses: ["String"],
  951. //>>excludeEnd("ide");
  952. messageSends: ["streamContents:", "nextPutAll:", "name", "class", "lf", "tab", "printOn:", "importsDefinition", ",", "definition", "transport"]
  953. }),
  954. $globals.Package);
  955. $core.addMethod(
  956. $core.method({
  957. selector: "imports",
  958. protocol: 'accessing',
  959. fn: function (){
  960. var self=this;
  961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  962. return $core.withContext(function($ctx1) {
  963. //>>excludeEnd("ctx");
  964. var $1,$receiver;
  965. $1=self["@imports"];
  966. if(($receiver = $1) == null || $receiver.isNil){
  967. var parsed;
  968. parsed=self._importsFromJson_(self._basicImports());
  969. parsed;
  970. self._imports_(parsed);
  971. return self["@imports"];
  972. } else {
  973. return $1;
  974. }
  975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  976. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  977. //>>excludeEnd("ctx");
  978. },
  979. //>>excludeStart("ide", pragmas.excludeIdeData);
  980. args: [],
  981. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09| parsed |\x0a\x09\x09parsed := self importsFromJson: self basicImports.\x0a\x09\x09self imports: parsed.\x0a\x09\x09imports ]",
  982. referencedClasses: [],
  983. //>>excludeEnd("ide");
  984. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  985. }),
  986. $globals.Package);
  987. $core.addMethod(
  988. $core.method({
  989. selector: "imports:",
  990. protocol: 'accessing',
  991. fn: function (anArray){
  992. var self=this;
  993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  994. return $core.withContext(function($ctx1) {
  995. //>>excludeEnd("ctx");
  996. self._validateImports_(anArray);
  997. self["@imports"]=$recv(anArray)._asSet();
  998. return self;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  1001. //>>excludeEnd("ctx");
  1002. },
  1003. //>>excludeStart("ide", pragmas.excludeIdeData);
  1004. args: ["anArray"],
  1005. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  1006. referencedClasses: [],
  1007. //>>excludeEnd("ide");
  1008. messageSends: ["validateImports:", "asSet"]
  1009. }),
  1010. $globals.Package);
  1011. $core.addMethod(
  1012. $core.method({
  1013. selector: "importsAsJson",
  1014. protocol: 'converting',
  1015. fn: function (){
  1016. var self=this;
  1017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1018. return $core.withContext(function($ctx1) {
  1019. //>>excludeEnd("ctx");
  1020. var $1;
  1021. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  1022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1023. return $core.withContext(function($ctx2) {
  1024. //>>excludeEnd("ctx");
  1025. $1=$recv(each)._isString();
  1026. if($core.assert($1)){
  1027. return each;
  1028. } else {
  1029. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  1030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1031. $ctx2.sendIdx[","]=1;
  1032. //>>excludeEnd("ctx");
  1033. }
  1034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1036. //>>excludeEnd("ctx");
  1037. }));
  1038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1039. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  1040. //>>excludeEnd("ctx");
  1041. },
  1042. //>>excludeStart("ide", pragmas.excludeIdeData);
  1043. args: [],
  1044. source: "importsAsJson\x0a\x0a\x09^ self sortedImportsAsArray collect: [ :each |\x0a\x09\x09each isString\x0a\x09\x09\x09ifTrue: [ each ]\x0a\x09\x09\x09ifFalse: [ each key, '=', each value ]]",
  1045. referencedClasses: [],
  1046. //>>excludeEnd("ide");
  1047. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  1048. }),
  1049. $globals.Package);
  1050. $core.addMethod(
  1051. $core.method({
  1052. selector: "importsDefinition",
  1053. protocol: 'accessing',
  1054. fn: function (){
  1055. var self=this;
  1056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1057. return $core.withContext(function($ctx1) {
  1058. //>>excludeEnd("ctx");
  1059. return $recv($globals.String)._streamContents_((function(stream){
  1060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1061. return $core.withContext(function($ctx2) {
  1062. //>>excludeEnd("ctx");
  1063. $recv(stream)._nextPutAll_("{");
  1064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1065. $ctx2.sendIdx["nextPutAll:"]=1;
  1066. //>>excludeEnd("ctx");
  1067. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  1068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1069. return $core.withContext(function($ctx3) {
  1070. //>>excludeEnd("ctx");
  1071. return $recv(stream)._nextPutAll_($recv(each)._printString());
  1072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1073. $ctx3.sendIdx["nextPutAll:"]=2;
  1074. //>>excludeEnd("ctx");
  1075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1076. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  1077. //>>excludeEnd("ctx");
  1078. }),(function(){
  1079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1080. return $core.withContext(function($ctx3) {
  1081. //>>excludeEnd("ctx");
  1082. return $recv(stream)._nextPutAll_(". ");
  1083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1084. $ctx3.sendIdx["nextPutAll:"]=3;
  1085. //>>excludeEnd("ctx");
  1086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1087. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  1088. //>>excludeEnd("ctx");
  1089. }));
  1090. return $recv(stream)._nextPutAll_("}");
  1091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1092. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1093. //>>excludeEnd("ctx");
  1094. }));
  1095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1096. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  1097. //>>excludeEnd("ctx");
  1098. },
  1099. //>>excludeStart("ide", pragmas.excludeIdeData);
  1100. args: [],
  1101. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream nextPutAll: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each printString ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: '. ' ].\x0a\x09\x09stream nextPutAll: '}' ]",
  1102. referencedClasses: ["String"],
  1103. //>>excludeEnd("ide");
  1104. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "printString"]
  1105. }),
  1106. $globals.Package);
  1107. $core.addMethod(
  1108. $core.method({
  1109. selector: "importsFromJson:",
  1110. protocol: 'converting',
  1111. fn: function (anArray){
  1112. var self=this;
  1113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1114. return $core.withContext(function($ctx1) {
  1115. //>>excludeEnd("ctx");
  1116. var $1;
  1117. return $recv(anArray)._collect_((function(each){
  1118. var split;
  1119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1120. return $core.withContext(function($ctx2) {
  1121. //>>excludeEnd("ctx");
  1122. split=$recv(each)._tokenize_("=");
  1123. split;
  1124. $1=$recv($recv(split)._size()).__eq((1));
  1125. if($core.assert($1)){
  1126. return $recv(split)._first();
  1127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1128. $ctx2.sendIdx["first"]=1;
  1129. //>>excludeEnd("ctx");
  1130. } else {
  1131. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  1132. }
  1133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1134. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  1135. //>>excludeEnd("ctx");
  1136. }));
  1137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1138. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  1139. //>>excludeEnd("ctx");
  1140. },
  1141. //>>excludeStart("ide", pragmas.excludeIdeData);
  1142. args: ["anArray"],
  1143. source: "importsFromJson: anArray\x0a\x09\x22Parses array of string, eg. #('asdf' 'qwer=tyuo')\x0a\x09into array of Strings and Associations,\x0a\x09eg. {'asdf'. 'qwer'->'tyuo'}\x22\x0a\x0a\x09^ anArray collect: [ :each |\x0a\x09\x09| split |\x0a\x09\x09split := each tokenize: '='.\x0a\x09\x09split size = 1\x0a\x09\x09\x09ifTrue: [ split first ]\x0a\x09\x09\x09ifFalse: [ split first -> split second ]]",
  1144. referencedClasses: [],
  1145. //>>excludeEnd("ide");
  1146. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  1147. }),
  1148. $globals.Package);
  1149. $core.addMethod(
  1150. $core.method({
  1151. selector: "isDirty",
  1152. protocol: 'testing',
  1153. fn: function (){
  1154. var self=this;
  1155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1156. return $core.withContext(function($ctx1) {
  1157. //>>excludeEnd("ctx");
  1158. var $1,$receiver;
  1159. $1=self["@dirty"];
  1160. if(($receiver = $1) == null || $receiver.isNil){
  1161. return false;
  1162. } else {
  1163. return $1;
  1164. }
  1165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1166. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  1167. //>>excludeEnd("ctx");
  1168. },
  1169. //>>excludeStart("ide", pragmas.excludeIdeData);
  1170. args: [],
  1171. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  1172. referencedClasses: [],
  1173. //>>excludeEnd("ide");
  1174. messageSends: ["ifNil:"]
  1175. }),
  1176. $globals.Package);
  1177. $core.addMethod(
  1178. $core.method({
  1179. selector: "isPackage",
  1180. protocol: 'testing',
  1181. fn: function (){
  1182. var self=this;
  1183. return true;
  1184. },
  1185. //>>excludeStart("ide", pragmas.excludeIdeData);
  1186. args: [],
  1187. source: "isPackage\x0a\x09^ true",
  1188. referencedClasses: [],
  1189. //>>excludeEnd("ide");
  1190. messageSends: []
  1191. }),
  1192. $globals.Package);
  1193. $core.addMethod(
  1194. $core.method({
  1195. selector: "loadDependencies",
  1196. protocol: 'dependencies',
  1197. fn: function (){
  1198. var self=this;
  1199. var classes,packages;
  1200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1201. return $core.withContext(function($ctx1) {
  1202. //>>excludeEnd("ctx");
  1203. var $1;
  1204. classes=self._loadDependencyClasses();
  1205. $1=$recv($recv(classes)._collect_((function(each){
  1206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1207. return $core.withContext(function($ctx2) {
  1208. //>>excludeEnd("ctx");
  1209. return $recv(each)._package();
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1212. //>>excludeEnd("ctx");
  1213. })))._asSet();
  1214. $recv($1)._remove_ifAbsent_(self,(function(){
  1215. }));
  1216. return $recv($1)._yourself();
  1217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1218. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  1219. //>>excludeEnd("ctx");
  1220. },
  1221. //>>excludeStart("ide", pragmas.excludeIdeData);
  1222. args: [],
  1223. 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",
  1224. referencedClasses: [],
  1225. //>>excludeEnd("ide");
  1226. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  1227. }),
  1228. $globals.Package);
  1229. $core.addMethod(
  1230. $core.method({
  1231. selector: "loadDependencyClasses",
  1232. protocol: 'dependencies',
  1233. fn: function (){
  1234. var self=this;
  1235. var starCategoryName;
  1236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1237. return $core.withContext(function($ctx1) {
  1238. //>>excludeEnd("ctx");
  1239. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  1240. starCategoryName="*".__comma(self._name());
  1241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1242. $ctx1.sendIdx[","]=1;
  1243. //>>excludeEnd("ctx");
  1244. $3=self._classes();
  1245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1246. $ctx1.sendIdx["classes"]=1;
  1247. //>>excludeEnd("ctx");
  1248. $2=$recv($3)._collect_((function(each){
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. return $core.withContext(function($ctx2) {
  1251. //>>excludeEnd("ctx");
  1252. return $recv(each)._superclass();
  1253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1254. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1255. //>>excludeEnd("ctx");
  1256. }));
  1257. $1=$recv($2)._asSet();
  1258. $recv($1)._remove_ifAbsent_(nil,(function(){
  1259. }));
  1260. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  1261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1262. return $core.withContext(function($ctx2) {
  1263. //>>excludeEnd("ctx");
  1264. $5=$recv(each)._protocols();
  1265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1266. $ctx2.sendIdx["protocols"]=1;
  1267. //>>excludeEnd("ctx");
  1268. $7=$recv(each)._theMetaClass();
  1269. if(($receiver = $7) == null || $receiver.isNil){
  1270. $6=[];
  1271. } else {
  1272. var meta;
  1273. meta=$receiver;
  1274. $6=$recv(meta)._protocols();
  1275. }
  1276. $4=$recv($5).__comma($6);
  1277. return $recv($4)._includes_(starCategoryName);
  1278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1280. //>>excludeEnd("ctx");
  1281. })));
  1282. return $recv($1)._yourself();
  1283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1284. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  1285. //>>excludeEnd("ctx");
  1286. },
  1287. //>>excludeStart("ide", pragmas.excludeIdeData);
  1288. args: [],
  1289. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each |\x0a\x09\x09\x09each protocols, (each theMetaClass ifNil: [ #() ] ifNotNil: [ :meta | meta protocols])\x0a\x09\x09\x09\x09includes: starCategoryName ]);\x0a\x09\x09yourself",
  1290. referencedClasses: ["Smalltalk"],
  1291. //>>excludeEnd("ide");
  1292. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "yourself"]
  1293. }),
  1294. $globals.Package);
  1295. $core.addMethod(
  1296. $core.method({
  1297. selector: "name",
  1298. protocol: 'accessing',
  1299. fn: function (){
  1300. var self=this;
  1301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1302. return $core.withContext(function($ctx1) {
  1303. //>>excludeEnd("ctx");
  1304. return self.pkgName;
  1305. return self;
  1306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1307. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  1308. //>>excludeEnd("ctx");
  1309. },
  1310. //>>excludeStart("ide", pragmas.excludeIdeData);
  1311. args: [],
  1312. source: "name\x0a\x09<inlineJS: 'return self.pkgName'>",
  1313. referencedClasses: [],
  1314. //>>excludeEnd("ide");
  1315. messageSends: []
  1316. }),
  1317. $globals.Package);
  1318. $core.addMethod(
  1319. $core.method({
  1320. selector: "name:",
  1321. protocol: 'accessing',
  1322. fn: function (aString){
  1323. var self=this;
  1324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1325. return $core.withContext(function($ctx1) {
  1326. //>>excludeEnd("ctx");
  1327. self._basicName_(aString);
  1328. self._beDirty();
  1329. return self;
  1330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1331. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  1332. //>>excludeEnd("ctx");
  1333. },
  1334. //>>excludeStart("ide", pragmas.excludeIdeData);
  1335. args: ["aString"],
  1336. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  1337. referencedClasses: [],
  1338. //>>excludeEnd("ide");
  1339. messageSends: ["basicName:", "beDirty"]
  1340. }),
  1341. $globals.Package);
  1342. $core.addMethod(
  1343. $core.method({
  1344. selector: "organization",
  1345. protocol: 'accessing',
  1346. fn: function (){
  1347. var self=this;
  1348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1349. return $core.withContext(function($ctx1) {
  1350. //>>excludeEnd("ctx");
  1351. return self._basicAt_("organization");
  1352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1353. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  1354. //>>excludeEnd("ctx");
  1355. },
  1356. //>>excludeStart("ide", pragmas.excludeIdeData);
  1357. args: [],
  1358. source: "organization\x0a\x09^ self basicAt: 'organization'",
  1359. referencedClasses: [],
  1360. //>>excludeEnd("ide");
  1361. messageSends: ["basicAt:"]
  1362. }),
  1363. $globals.Package);
  1364. $core.addMethod(
  1365. $core.method({
  1366. selector: "printOn:",
  1367. protocol: 'printing',
  1368. fn: function (aStream){
  1369. var self=this;
  1370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1371. return $core.withContext(function($ctx1) {
  1372. //>>excludeEnd("ctx");
  1373. (
  1374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1375. $ctx1.supercall = true,
  1376. //>>excludeEnd("ctx");
  1377. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  1378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1379. $ctx1.supercall = false;
  1380. //>>excludeEnd("ctx");;
  1381. $recv(aStream)._nextPutAll_(" (");
  1382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1383. $ctx1.sendIdx["nextPutAll:"]=1;
  1384. //>>excludeEnd("ctx");
  1385. $recv(aStream)._nextPutAll_(self._name());
  1386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1387. $ctx1.sendIdx["nextPutAll:"]=2;
  1388. //>>excludeEnd("ctx");
  1389. $recv(aStream)._nextPutAll_(")");
  1390. return self;
  1391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1392. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  1393. //>>excludeEnd("ctx");
  1394. },
  1395. //>>excludeStart("ide", pragmas.excludeIdeData);
  1396. args: ["aStream"],
  1397. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  1398. referencedClasses: [],
  1399. //>>excludeEnd("ide");
  1400. messageSends: ["printOn:", "nextPutAll:", "name"]
  1401. }),
  1402. $globals.Package);
  1403. $core.addMethod(
  1404. $core.method({
  1405. selector: "setupClasses",
  1406. protocol: 'classes',
  1407. fn: function (){
  1408. var self=this;
  1409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1410. return $core.withContext(function($ctx1) {
  1411. //>>excludeEnd("ctx");
  1412. $recv(self._classes())._do_((function(each){
  1413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1414. return $core.withContext(function($ctx2) {
  1415. //>>excludeEnd("ctx");
  1416. return $recv(each)._initialize();
  1417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1419. //>>excludeEnd("ctx");
  1420. }));
  1421. return self;
  1422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1423. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  1424. //>>excludeEnd("ctx");
  1425. },
  1426. //>>excludeStart("ide", pragmas.excludeIdeData);
  1427. args: [],
  1428. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  1429. referencedClasses: [],
  1430. //>>excludeEnd("ide");
  1431. messageSends: ["do:", "classes", "initialize"]
  1432. }),
  1433. $globals.Package);
  1434. $core.addMethod(
  1435. $core.method({
  1436. selector: "sortedClasses",
  1437. protocol: 'classes',
  1438. fn: function (){
  1439. var self=this;
  1440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1441. return $core.withContext(function($ctx1) {
  1442. //>>excludeEnd("ctx");
  1443. return $recv(self._class())._sortedClasses_(self._classes());
  1444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1445. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  1446. //>>excludeEnd("ctx");
  1447. },
  1448. //>>excludeStart("ide", pragmas.excludeIdeData);
  1449. args: [],
  1450. 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",
  1451. referencedClasses: [],
  1452. //>>excludeEnd("ide");
  1453. messageSends: ["sortedClasses:", "class", "classes"]
  1454. }),
  1455. $globals.Package);
  1456. $core.addMethod(
  1457. $core.method({
  1458. selector: "sortedImportsAsArray",
  1459. protocol: 'private',
  1460. fn: function (){
  1461. var self=this;
  1462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1463. return $core.withContext(function($ctx1) {
  1464. //>>excludeEnd("ctx");
  1465. var $3,$2,$4,$1,$6,$5,$7;
  1466. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  1467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1468. return $core.withContext(function($ctx2) {
  1469. //>>excludeEnd("ctx");
  1470. $3=$recv(a)._isString();
  1471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1472. $ctx2.sendIdx["isString"]=1;
  1473. //>>excludeEnd("ctx");
  1474. $2=$recv($3)._not();
  1475. $4=$recv(b)._isString();
  1476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1477. $ctx2.sendIdx["isString"]=2;
  1478. //>>excludeEnd("ctx");
  1479. $1=$recv($2).__and($4);
  1480. return $recv($1)._or_((function(){
  1481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1482. return $core.withContext(function($ctx3) {
  1483. //>>excludeEnd("ctx");
  1484. $6=$recv(a)._isString();
  1485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1486. $ctx3.sendIdx["isString"]=3;
  1487. //>>excludeEnd("ctx");
  1488. $5=$recv($6).__eq($recv(b)._isString());
  1489. return $recv($5)._and_((function(){
  1490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1491. return $core.withContext(function($ctx4) {
  1492. //>>excludeEnd("ctx");
  1493. $7=$recv(a)._value();
  1494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1495. $ctx4.sendIdx["value"]=1;
  1496. //>>excludeEnd("ctx");
  1497. return $recv($7).__lt_eq($recv(b)._value());
  1498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1499. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  1500. //>>excludeEnd("ctx");
  1501. }));
  1502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1503. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1504. //>>excludeEnd("ctx");
  1505. }));
  1506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1507. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  1508. //>>excludeEnd("ctx");
  1509. }));
  1510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1511. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  1512. //>>excludeEnd("ctx");
  1513. },
  1514. //>>excludeStart("ide", pragmas.excludeIdeData);
  1515. args: [],
  1516. source: "sortedImportsAsArray\x0a\x09\x22Answer imports sorted first by type (associations first),\x0a\x09then by value\x22\x0a\x0a\x09^ self imports asArray\x0a\x09\x09sorted: [ :a :b |\x0a\x09\x09\x09a isString not & b isString or: [\x0a\x09\x09\x09\x09a isString = b isString and: [\x0a\x09\x09\x09\x09\x09a value <= b value ]]]",
  1517. referencedClasses: [],
  1518. //>>excludeEnd("ide");
  1519. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  1520. }),
  1521. $globals.Package);
  1522. $core.addMethod(
  1523. $core.method({
  1524. selector: "transport",
  1525. protocol: 'accessing',
  1526. fn: function (){
  1527. var self=this;
  1528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1529. return $core.withContext(function($ctx1) {
  1530. //>>excludeEnd("ctx");
  1531. var $1,$2,$receiver;
  1532. $1=self["@transport"];
  1533. if(($receiver = $1) == null || $receiver.isNil){
  1534. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  1535. $recv($2)._package_(self);
  1536. self["@transport"]=$recv($2)._yourself();
  1537. return self["@transport"];
  1538. } else {
  1539. return $1;
  1540. }
  1541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1542. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  1543. //>>excludeEnd("ctx");
  1544. },
  1545. //>>excludeStart("ide", pragmas.excludeIdeData);
  1546. args: [],
  1547. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  1548. referencedClasses: ["PackageTransport"],
  1549. //>>excludeEnd("ide");
  1550. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  1551. }),
  1552. $globals.Package);
  1553. $core.addMethod(
  1554. $core.method({
  1555. selector: "transport:",
  1556. protocol: 'accessing',
  1557. fn: function (aPackageTransport){
  1558. var self=this;
  1559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1560. return $core.withContext(function($ctx1) {
  1561. //>>excludeEnd("ctx");
  1562. self["@transport"]=aPackageTransport;
  1563. $recv(aPackageTransport)._package_(self);
  1564. return self;
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  1567. //>>excludeEnd("ctx");
  1568. },
  1569. //>>excludeStart("ide", pragmas.excludeIdeData);
  1570. args: ["aPackageTransport"],
  1571. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  1572. referencedClasses: [],
  1573. //>>excludeEnd("ide");
  1574. messageSends: ["package:"]
  1575. }),
  1576. $globals.Package);
  1577. $core.addMethod(
  1578. $core.method({
  1579. selector: "validateImports:",
  1580. protocol: 'validation',
  1581. fn: function (aCollection){
  1582. var self=this;
  1583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1584. return $core.withContext(function($ctx1) {
  1585. //>>excludeEnd("ctx");
  1586. var $1,$2,$5,$4,$3,$6;
  1587. $recv(aCollection)._do_((function(import_){
  1588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1589. return $core.withContext(function($ctx2) {
  1590. //>>excludeEnd("ctx");
  1591. $1=$recv(import_)._isString();
  1592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1593. $ctx2.sendIdx["isString"]=1;
  1594. //>>excludeEnd("ctx");
  1595. if(!$core.assert($1)){
  1596. $2=$recv(import_)._respondsTo_("key");
  1597. if(!$core.assert($2)){
  1598. self._error_("Imports must be Strings or Associations");
  1599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1600. $ctx2.sendIdx["error:"]=1;
  1601. //>>excludeEnd("ctx");
  1602. }
  1603. $5=$recv(import_)._key();
  1604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1605. $ctx2.sendIdx["key"]=1;
  1606. //>>excludeEnd("ctx");
  1607. $4=$recv($5)._isString();
  1608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1609. $ctx2.sendIdx["isString"]=2;
  1610. //>>excludeEnd("ctx");
  1611. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  1612. if(!$core.assert($3)){
  1613. self._error_("Key and value must be Strings");
  1614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1615. $ctx2.sendIdx["error:"]=2;
  1616. //>>excludeEnd("ctx");
  1617. }
  1618. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  1619. if(!$core.assert($6)){
  1620. return self._error_("Keys must be identifiers");
  1621. }
  1622. }
  1623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1624. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  1625. //>>excludeEnd("ctx");
  1626. }));
  1627. return self;
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  1630. //>>excludeEnd("ctx");
  1631. },
  1632. //>>excludeStart("ide", pragmas.excludeIdeData);
  1633. args: ["aCollection"],
  1634. source: "validateImports: aCollection\x0a\x0a\x09aCollection do: [ :import |\x0a\x09\x09import isString ifFalse: [\x0a\x09\x09\x09(import respondsTo: #key) ifFalse: [\x0a\x09\x09\x09\x09self error: 'Imports must be Strings or Associations' ].\x0a\x09\x09\x09import key isString & import value isString ifFalse: [\x0a\x09\x09\x09\x09self error: 'Key and value must be Strings' ].\x0a\x09\x09\x09(import key match: '^[a-zA-Z][a-zA-Z0-9]*$') ifFalse: [\x0a\x09\x09\x09\x09self error: 'Keys must be identifiers' ]]]",
  1635. referencedClasses: [],
  1636. //>>excludeEnd("ide");
  1637. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  1638. }),
  1639. $globals.Package);
  1640. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  1641. $core.addMethod(
  1642. $core.method({
  1643. selector: "named:",
  1644. protocol: 'accessing',
  1645. fn: function (aPackageName){
  1646. var self=this;
  1647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1648. return $core.withContext(function($ctx1) {
  1649. //>>excludeEnd("ctx");
  1650. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  1651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1652. return $core.withContext(function($ctx2) {
  1653. //>>excludeEnd("ctx");
  1654. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  1655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1657. //>>excludeEnd("ctx");
  1658. }));
  1659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1660. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  1661. //>>excludeEnd("ctx");
  1662. },
  1663. //>>excludeStart("ide", pragmas.excludeIdeData);
  1664. args: ["aPackageName"],
  1665. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  1666. referencedClasses: ["Smalltalk"],
  1667. //>>excludeEnd("ide");
  1668. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  1669. }),
  1670. $globals.Package.klass);
  1671. $core.addMethod(
  1672. $core.method({
  1673. selector: "named:ifAbsent:",
  1674. protocol: 'accessing',
  1675. fn: function (aPackageName,aBlock){
  1676. var self=this;
  1677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1678. return $core.withContext(function($ctx1) {
  1679. //>>excludeEnd("ctx");
  1680. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  1681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1682. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  1683. //>>excludeEnd("ctx");
  1684. },
  1685. //>>excludeStart("ide", pragmas.excludeIdeData);
  1686. args: ["aPackageName", "aBlock"],
  1687. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  1688. referencedClasses: ["Smalltalk"],
  1689. //>>excludeEnd("ide");
  1690. messageSends: ["packageAt:ifAbsent:"]
  1691. }),
  1692. $globals.Package.klass);
  1693. $core.addMethod(
  1694. $core.method({
  1695. selector: "named:imports:transport:",
  1696. protocol: 'accessing',
  1697. fn: function (aPackageName,anArray,aTransport){
  1698. var self=this;
  1699. var package_;
  1700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1701. return $core.withContext(function($ctx1) {
  1702. //>>excludeEnd("ctx");
  1703. package_=self._named_(aPackageName);
  1704. $recv(package_)._imports_(anArray);
  1705. $recv(package_)._transport_(aTransport);
  1706. return package_;
  1707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1708. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  1709. //>>excludeEnd("ctx");
  1710. },
  1711. //>>excludeStart("ide", pragmas.excludeIdeData);
  1712. args: ["aPackageName", "anArray", "aTransport"],
  1713. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  1714. referencedClasses: [],
  1715. //>>excludeEnd("ide");
  1716. messageSends: ["named:", "imports:", "transport:"]
  1717. }),
  1718. $globals.Package.klass);
  1719. $core.addMethod(
  1720. $core.method({
  1721. selector: "named:transport:",
  1722. protocol: 'accessing',
  1723. fn: function (aPackageName,aTransport){
  1724. var self=this;
  1725. var package_;
  1726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1727. return $core.withContext(function($ctx1) {
  1728. //>>excludeEnd("ctx");
  1729. package_=self._named_(aPackageName);
  1730. $recv(package_)._transport_(aTransport);
  1731. return package_;
  1732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1733. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  1734. //>>excludeEnd("ctx");
  1735. },
  1736. //>>excludeStart("ide", pragmas.excludeIdeData);
  1737. args: ["aPackageName", "aTransport"],
  1738. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  1739. referencedClasses: [],
  1740. //>>excludeEnd("ide");
  1741. messageSends: ["named:", "transport:"]
  1742. }),
  1743. $globals.Package.klass);
  1744. $core.addMethod(
  1745. $core.method({
  1746. selector: "sortedClasses:",
  1747. protocol: 'sorting',
  1748. fn: function (classes){
  1749. var self=this;
  1750. var children,others,nodes,expandedClasses;
  1751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1752. return $core.withContext(function($ctx1) {
  1753. //>>excludeEnd("ctx");
  1754. var $1,$3,$2;
  1755. children=[];
  1756. others=[];
  1757. $recv(classes)._do_((function(each){
  1758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1759. return $core.withContext(function($ctx2) {
  1760. //>>excludeEnd("ctx");
  1761. $1=$recv(classes)._includes_($recv(each)._superclass());
  1762. if($core.assert($1)){
  1763. return $recv(others)._add_(each);
  1764. } else {
  1765. return $recv(children)._add_(each);
  1766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1767. $ctx2.sendIdx["add:"]=1;
  1768. //>>excludeEnd("ctx");
  1769. }
  1770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1771. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1772. //>>excludeEnd("ctx");
  1773. }));
  1774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1775. $ctx1.sendIdx["do:"]=1;
  1776. //>>excludeEnd("ctx");
  1777. nodes=$recv(children)._collect_((function(each){
  1778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1779. return $core.withContext(function($ctx2) {
  1780. //>>excludeEnd("ctx");
  1781. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  1782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  1784. //>>excludeEnd("ctx");
  1785. }));
  1786. nodes=$recv(nodes)._sorted_((function(a,b){
  1787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1788. return $core.withContext(function($ctx2) {
  1789. //>>excludeEnd("ctx");
  1790. $3=$recv(a)._theClass();
  1791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1792. $ctx2.sendIdx["theClass"]=1;
  1793. //>>excludeEnd("ctx");
  1794. $2=$recv($3)._name();
  1795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1796. $ctx2.sendIdx["name"]=1;
  1797. //>>excludeEnd("ctx");
  1798. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  1799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1800. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  1801. //>>excludeEnd("ctx");
  1802. }));
  1803. expandedClasses=$recv($globals.Array)._new();
  1804. $recv(nodes)._do_((function(aNode){
  1805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1806. return $core.withContext(function($ctx2) {
  1807. //>>excludeEnd("ctx");
  1808. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  1809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1810. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  1811. //>>excludeEnd("ctx");
  1812. }));
  1813. return expandedClasses;
  1814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1815. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  1816. //>>excludeEnd("ctx");
  1817. },
  1818. //>>excludeStart("ide", pragmas.excludeIdeData);
  1819. args: ["classes"],
  1820. 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",
  1821. referencedClasses: ["ClassSorterNode", "Array"],
  1822. //>>excludeEnd("ide");
  1823. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  1824. }),
  1825. $globals.Package.klass);
  1826. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  1827. //>>excludeStart("ide", pragmas.excludeIdeData);
  1828. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  1829. //>>excludeEnd("ide");
  1830. $core.addMethod(
  1831. $core.method({
  1832. selector: "announcer",
  1833. protocol: 'accessing',
  1834. fn: function (){
  1835. var self=this;
  1836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1837. return $core.withContext(function($ctx1) {
  1838. //>>excludeEnd("ctx");
  1839. return $recv($globals.SystemAnnouncer)._current();
  1840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1841. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  1842. //>>excludeEnd("ctx");
  1843. },
  1844. //>>excludeStart("ide", pragmas.excludeIdeData);
  1845. args: [],
  1846. source: "announcer\x0a\x09^ SystemAnnouncer current",
  1847. referencedClasses: ["SystemAnnouncer"],
  1848. //>>excludeEnd("ide");
  1849. messageSends: ["current"]
  1850. }),
  1851. $globals.PackageStateObserver);
  1852. $core.addMethod(
  1853. $core.method({
  1854. selector: "observeSystem",
  1855. protocol: 'actions',
  1856. fn: function (){
  1857. var self=this;
  1858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1859. return $core.withContext(function($ctx1) {
  1860. //>>excludeEnd("ctx");
  1861. var $1;
  1862. $1=self._announcer();
  1863. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  1864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1865. $ctx1.sendIdx["on:send:to:"]=1;
  1866. //>>excludeEnd("ctx");
  1867. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  1868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1869. $ctx1.sendIdx["on:send:to:"]=2;
  1870. //>>excludeEnd("ctx");
  1871. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  1872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1873. $ctx1.sendIdx["on:send:to:"]=3;
  1874. //>>excludeEnd("ctx");
  1875. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  1876. return self;
  1877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1878. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  1879. //>>excludeEnd("ctx");
  1880. },
  1881. //>>excludeStart("ide", pragmas.excludeIdeData);
  1882. args: [],
  1883. source: "observeSystem\x0a\x09self announcer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassAnnouncement\x0a\x09\x09send: #onClassModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodAnnouncement\x0a\x09\x09send: #onMethodModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolAnnouncement\x0a\x09\x09send: #onProtocolModification:\x0a\x09\x09to: self",
  1884. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  1885. //>>excludeEnd("ide");
  1886. messageSends: ["on:send:to:", "announcer"]
  1887. }),
  1888. $globals.PackageStateObserver);
  1889. $core.addMethod(
  1890. $core.method({
  1891. selector: "onClassModification:",
  1892. protocol: 'reactions',
  1893. fn: function (anAnnouncement){
  1894. var self=this;
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. return $core.withContext(function($ctx1) {
  1897. //>>excludeEnd("ctx");
  1898. var $1,$receiver;
  1899. $1=$recv(anAnnouncement)._theClass();
  1900. if(($receiver = $1) == null || $receiver.isNil){
  1901. $1;
  1902. } else {
  1903. var theClass;
  1904. theClass=$receiver;
  1905. $recv($recv(theClass)._package())._beDirty();
  1906. }
  1907. return self;
  1908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1909. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1910. //>>excludeEnd("ctx");
  1911. },
  1912. //>>excludeStart("ide", pragmas.excludeIdeData);
  1913. args: ["anAnnouncement"],
  1914. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  1915. referencedClasses: [],
  1916. //>>excludeEnd("ide");
  1917. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  1918. }),
  1919. $globals.PackageStateObserver);
  1920. $core.addMethod(
  1921. $core.method({
  1922. selector: "onMethodModification:",
  1923. protocol: 'reactions',
  1924. fn: function (anAnnouncement){
  1925. var self=this;
  1926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1927. return $core.withContext(function($ctx1) {
  1928. //>>excludeEnd("ctx");
  1929. var $1,$receiver;
  1930. $1=$recv($recv(anAnnouncement)._method())._package();
  1931. if(($receiver = $1) == null || $receiver.isNil){
  1932. $1;
  1933. } else {
  1934. var package_;
  1935. package_=$receiver;
  1936. $recv(package_)._beDirty();
  1937. }
  1938. return self;
  1939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1940. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1941. //>>excludeEnd("ctx");
  1942. },
  1943. //>>excludeStart("ide", pragmas.excludeIdeData);
  1944. args: ["anAnnouncement"],
  1945. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  1946. referencedClasses: [],
  1947. //>>excludeEnd("ide");
  1948. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  1949. }),
  1950. $globals.PackageStateObserver);
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "onPackageAdded:",
  1954. protocol: 'reactions',
  1955. fn: function (anAnnouncement){
  1956. var self=this;
  1957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1958. return $core.withContext(function($ctx1) {
  1959. //>>excludeEnd("ctx");
  1960. $recv($recv(anAnnouncement)._package())._beDirty();
  1961. return self;
  1962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1963. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1964. //>>excludeEnd("ctx");
  1965. },
  1966. //>>excludeStart("ide", pragmas.excludeIdeData);
  1967. args: ["anAnnouncement"],
  1968. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  1969. referencedClasses: [],
  1970. //>>excludeEnd("ide");
  1971. messageSends: ["beDirty", "package"]
  1972. }),
  1973. $globals.PackageStateObserver);
  1974. $core.addMethod(
  1975. $core.method({
  1976. selector: "onProtocolModification:",
  1977. protocol: 'reactions',
  1978. fn: function (anAnnouncement){
  1979. var self=this;
  1980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1981. return $core.withContext(function($ctx1) {
  1982. //>>excludeEnd("ctx");
  1983. var $1,$receiver;
  1984. $1=$recv(anAnnouncement)._package();
  1985. if(($receiver = $1) == null || $receiver.isNil){
  1986. $1;
  1987. } else {
  1988. var package_;
  1989. package_=$receiver;
  1990. $recv(package_)._beDirty();
  1991. }
  1992. return self;
  1993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1994. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1995. //>>excludeEnd("ctx");
  1996. },
  1997. //>>excludeStart("ide", pragmas.excludeIdeData);
  1998. args: ["anAnnouncement"],
  1999. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  2000. referencedClasses: [],
  2001. //>>excludeEnd("ide");
  2002. messageSends: ["ifNotNil:", "package", "beDirty"]
  2003. }),
  2004. $globals.PackageStateObserver);
  2005. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  2006. $core.addMethod(
  2007. $core.method({
  2008. selector: "current",
  2009. protocol: 'accessing',
  2010. fn: function (){
  2011. var self=this;
  2012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2013. return $core.withContext(function($ctx1) {
  2014. //>>excludeEnd("ctx");
  2015. var $1,$receiver;
  2016. $1=self["@current"];
  2017. if(($receiver = $1) == null || $receiver.isNil){
  2018. self["@current"]=self._new();
  2019. return self["@current"];
  2020. } else {
  2021. return $1;
  2022. }
  2023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2024. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  2025. //>>excludeEnd("ctx");
  2026. },
  2027. //>>excludeStart("ide", pragmas.excludeIdeData);
  2028. args: [],
  2029. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  2030. referencedClasses: [],
  2031. //>>excludeEnd("ide");
  2032. messageSends: ["ifNil:", "new"]
  2033. }),
  2034. $globals.PackageStateObserver.klass);
  2035. $core.addMethod(
  2036. $core.method({
  2037. selector: "initialize",
  2038. protocol: 'initialization',
  2039. fn: function (){
  2040. var self=this;
  2041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2042. return $core.withContext(function($ctx1) {
  2043. //>>excludeEnd("ctx");
  2044. $recv(self._current())._observeSystem();
  2045. return self;
  2046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2047. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  2048. //>>excludeEnd("ctx");
  2049. },
  2050. //>>excludeStart("ide", pragmas.excludeIdeData);
  2051. args: [],
  2052. source: "initialize\x0a\x09self current observeSystem",
  2053. referencedClasses: [],
  2054. //>>excludeEnd("ide");
  2055. messageSends: ["observeSystem", "current"]
  2056. }),
  2057. $globals.PackageStateObserver.klass);
  2058. $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
  2059. //>>excludeStart("ide", pragmas.excludeIdeData);
  2060. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  2061. //>>excludeEnd("ide");
  2062. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  2063. //>>excludeStart("ide", pragmas.excludeIdeData);
  2064. $globals.Setting.comment="I represent a setting **stored** at `Smalltalk settings`. \x0aIn the current implementation, `Smalltalk settings` is an object persisted in the localStorage.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: aDefaultValue`.\x0a\x0aTo read the value of a setting you can also use the convenience:\x0a\x0a`theValueSet := 'any.characteristic' settingValue` \x0a\x0aor with a default using:\x0a\x0a `theEnsuredValueSet := 'any.characteristic' settingValueIfAbsent: true`";
  2065. //>>excludeEnd("ide");
  2066. $core.addMethod(
  2067. $core.method({
  2068. selector: "defaultValue",
  2069. protocol: 'accessing',
  2070. fn: function (){
  2071. var self=this;
  2072. return self["@defaultValue"];
  2073. },
  2074. //>>excludeStart("ide", pragmas.excludeIdeData);
  2075. args: [],
  2076. source: "defaultValue\x0a\x09^ defaultValue",
  2077. referencedClasses: [],
  2078. //>>excludeEnd("ide");
  2079. messageSends: []
  2080. }),
  2081. $globals.Setting);
  2082. $core.addMethod(
  2083. $core.method({
  2084. selector: "defaultValue:",
  2085. protocol: 'accessing',
  2086. fn: function (aStringifiableObject){
  2087. var self=this;
  2088. self["@defaultValue"]=aStringifiableObject;
  2089. return self;
  2090. },
  2091. //>>excludeStart("ide", pragmas.excludeIdeData);
  2092. args: ["aStringifiableObject"],
  2093. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  2094. referencedClasses: [],
  2095. //>>excludeEnd("ide");
  2096. messageSends: []
  2097. }),
  2098. $globals.Setting);
  2099. $core.addMethod(
  2100. $core.method({
  2101. selector: "key",
  2102. protocol: 'accessing',
  2103. fn: function (){
  2104. var self=this;
  2105. return self["@key"];
  2106. },
  2107. //>>excludeStart("ide", pragmas.excludeIdeData);
  2108. args: [],
  2109. source: "key\x0a\x09^ key",
  2110. referencedClasses: [],
  2111. //>>excludeEnd("ide");
  2112. messageSends: []
  2113. }),
  2114. $globals.Setting);
  2115. $core.addMethod(
  2116. $core.method({
  2117. selector: "key:",
  2118. protocol: 'accessing',
  2119. fn: function (aString){
  2120. var self=this;
  2121. self["@key"]=aString;
  2122. return self;
  2123. },
  2124. //>>excludeStart("ide", pragmas.excludeIdeData);
  2125. args: ["aString"],
  2126. source: "key: aString\x0a\x09key := aString",
  2127. referencedClasses: [],
  2128. //>>excludeEnd("ide");
  2129. messageSends: []
  2130. }),
  2131. $globals.Setting);
  2132. $core.addMethod(
  2133. $core.method({
  2134. selector: "value",
  2135. protocol: 'accessing',
  2136. fn: function (){
  2137. var self=this;
  2138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2139. return $core.withContext(function($ctx1) {
  2140. //>>excludeEnd("ctx");
  2141. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. return $core.withContext(function($ctx2) {
  2144. //>>excludeEnd("ctx");
  2145. return self._defaultValue();
  2146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2148. //>>excludeEnd("ctx");
  2149. }));
  2150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2151. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  2152. //>>excludeEnd("ctx");
  2153. },
  2154. //>>excludeStart("ide", pragmas.excludeIdeData);
  2155. args: [],
  2156. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  2157. referencedClasses: ["Smalltalk"],
  2158. //>>excludeEnd("ide");
  2159. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  2160. }),
  2161. $globals.Setting);
  2162. $core.addMethod(
  2163. $core.method({
  2164. selector: "value:",
  2165. protocol: 'accessing',
  2166. fn: function (aStringifiableObject){
  2167. var self=this;
  2168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2169. return $core.withContext(function($ctx1) {
  2170. //>>excludeEnd("ctx");
  2171. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  2172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2173. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  2174. //>>excludeEnd("ctx");
  2175. },
  2176. //>>excludeStart("ide", pragmas.excludeIdeData);
  2177. args: ["aStringifiableObject"],
  2178. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  2179. referencedClasses: ["Smalltalk"],
  2180. //>>excludeEnd("ide");
  2181. messageSends: ["at:put:", "settings", "key"]
  2182. }),
  2183. $globals.Setting);
  2184. $core.addMethod(
  2185. $core.method({
  2186. selector: "at:ifAbsent:",
  2187. protocol: 'instance creation',
  2188. fn: function (aString,aDefaultValue){
  2189. var self=this;
  2190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2191. return $core.withContext(function($ctx1) {
  2192. //>>excludeEnd("ctx");
  2193. var $1;
  2194. $1=(
  2195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2196. $ctx1.supercall = true,
  2197. //>>excludeEnd("ctx");
  2198. ($globals.Setting.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  2199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2200. $ctx1.supercall = false;
  2201. //>>excludeEnd("ctx");;
  2202. $recv($1)._key_(aString);
  2203. $recv($1)._defaultValue_(aDefaultValue);
  2204. return $recv($1)._yourself();
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  2207. //>>excludeEnd("ctx");
  2208. },
  2209. //>>excludeStart("ide", pragmas.excludeIdeData);
  2210. args: ["aString", "aDefaultValue"],
  2211. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  2212. referencedClasses: [],
  2213. //>>excludeEnd("ide");
  2214. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  2215. }),
  2216. $globals.Setting.klass);
  2217. $core.addMethod(
  2218. $core.method({
  2219. selector: "new",
  2220. protocol: 'instance creation',
  2221. fn: function (){
  2222. var self=this;
  2223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2224. return $core.withContext(function($ctx1) {
  2225. //>>excludeEnd("ctx");
  2226. self._shouldNotImplement();
  2227. return self;
  2228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2229. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  2230. //>>excludeEnd("ctx");
  2231. },
  2232. //>>excludeStart("ide", pragmas.excludeIdeData);
  2233. args: [],
  2234. source: "new\x0a\x09self shouldNotImplement",
  2235. referencedClasses: [],
  2236. //>>excludeEnd("ide");
  2237. messageSends: ["shouldNotImplement"]
  2238. }),
  2239. $globals.Setting.klass);
  2240. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  2241. //>>excludeStart("ide", pragmas.excludeIdeData);
  2242. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\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- `#globals #at:` answers a specific global (usually, a 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 `support/parser.js` parser file in order to work.";
  2243. //>>excludeEnd("ide");
  2244. $core.addMethod(
  2245. $core.method({
  2246. selector: "addGlobalJsVariable:",
  2247. protocol: 'globals',
  2248. fn: function (aString){
  2249. var self=this;
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. return $core.withContext(function($ctx1) {
  2252. //>>excludeEnd("ctx");
  2253. $recv(self._globalJsVariables())._add_(aString);
  2254. return self;
  2255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2256. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2257. //>>excludeEnd("ctx");
  2258. },
  2259. //>>excludeStart("ide", pragmas.excludeIdeData);
  2260. args: ["aString"],
  2261. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  2262. referencedClasses: [],
  2263. //>>excludeEnd("ide");
  2264. messageSends: ["add:", "globalJsVariables"]
  2265. }),
  2266. $globals.SmalltalkImage);
  2267. $core.addMethod(
  2268. $core.method({
  2269. selector: "amdRequire",
  2270. protocol: 'accessing amd',
  2271. fn: function (){
  2272. var self=this;
  2273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2274. return $core.withContext(function($ctx1) {
  2275. //>>excludeEnd("ctx");
  2276. return $recv(self._core())._at_("amdRequire");
  2277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2278. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  2279. //>>excludeEnd("ctx");
  2280. },
  2281. //>>excludeStart("ide", pragmas.excludeIdeData);
  2282. args: [],
  2283. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  2284. referencedClasses: [],
  2285. //>>excludeEnd("ide");
  2286. messageSends: ["at:", "core"]
  2287. }),
  2288. $globals.SmalltalkImage);
  2289. $core.addMethod(
  2290. $core.method({
  2291. selector: "asSmalltalkException:",
  2292. protocol: 'error handling',
  2293. fn: function (anObject){
  2294. var self=this;
  2295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2296. return $core.withContext(function($ctx1) {
  2297. //>>excludeEnd("ctx");
  2298. var $1;
  2299. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  2300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2301. return $core.withContext(function($ctx2) {
  2302. //>>excludeEnd("ctx");
  2303. return $recv(anObject)._isKindOf_($globals.Error);
  2304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2306. //>>excludeEnd("ctx");
  2307. }));
  2308. if($core.assert($1)){
  2309. return anObject;
  2310. } else {
  2311. return $recv($globals.JavaScriptException)._on_(anObject);
  2312. }
  2313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2314. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  2315. //>>excludeEnd("ctx");
  2316. },
  2317. //>>excludeStart("ide", pragmas.excludeIdeData);
  2318. args: ["anObject"],
  2319. 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 ]",
  2320. referencedClasses: ["Error", "JavaScriptException"],
  2321. //>>excludeEnd("ide");
  2322. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  2323. }),
  2324. $globals.SmalltalkImage);
  2325. $core.addMethod(
  2326. $core.method({
  2327. selector: "basicCreatePackage:",
  2328. protocol: 'private',
  2329. fn: function (packageName){
  2330. var self=this;
  2331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2332. return $core.withContext(function($ctx1) {
  2333. //>>excludeEnd("ctx");
  2334. return $core.addPackage(packageName);
  2335. return self;
  2336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2337. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  2338. //>>excludeEnd("ctx");
  2339. },
  2340. //>>excludeStart("ide", pragmas.excludeIdeData);
  2341. args: ["packageName"],
  2342. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<inlineJS: 'return $core.addPackage(packageName)'>",
  2343. referencedClasses: [],
  2344. //>>excludeEnd("ide");
  2345. messageSends: []
  2346. }),
  2347. $globals.SmalltalkImage);
  2348. $core.addMethod(
  2349. $core.method({
  2350. selector: "basicParse:",
  2351. protocol: 'private',
  2352. fn: function (aString){
  2353. var self=this;
  2354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2355. return $core.withContext(function($ctx1) {
  2356. //>>excludeEnd("ctx");
  2357. return $recv($globals.SmalltalkParser)._parse_(aString);
  2358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2359. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  2360. //>>excludeEnd("ctx");
  2361. },
  2362. //>>excludeStart("ide", pragmas.excludeIdeData);
  2363. args: ["aString"],
  2364. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  2365. referencedClasses: ["SmalltalkParser"],
  2366. //>>excludeEnd("ide");
  2367. messageSends: ["parse:"]
  2368. }),
  2369. $globals.SmalltalkImage);
  2370. $core.addMethod(
  2371. $core.method({
  2372. selector: "basicRegisterPackage:",
  2373. protocol: 'private',
  2374. fn: function (aPackage){
  2375. var self=this;
  2376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2377. return $core.withContext(function($ctx1) {
  2378. //>>excludeEnd("ctx");
  2379. $core.packages[aPackage.pkgName]=aPackage;
  2380. return self;
  2381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2382. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  2383. //>>excludeEnd("ctx");
  2384. },
  2385. //>>excludeStart("ide", pragmas.excludeIdeData);
  2386. args: ["aPackage"],
  2387. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<inlineJS: '$core.packages[aPackage.pkgName]=aPackage'>",
  2388. referencedClasses: [],
  2389. //>>excludeEnd("ide");
  2390. messageSends: []
  2391. }),
  2392. $globals.SmalltalkImage);
  2393. $core.addMethod(
  2394. $core.method({
  2395. selector: "cancelOptOut:",
  2396. protocol: 'accessing',
  2397. fn: function (anObject){
  2398. var self=this;
  2399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2400. return $core.withContext(function($ctx1) {
  2401. //>>excludeEnd("ctx");
  2402. delete anObject.klass;
  2403. return self;
  2404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2405. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  2406. //>>excludeEnd("ctx");
  2407. },
  2408. //>>excludeStart("ide", pragmas.excludeIdeData);
  2409. args: ["anObject"],
  2410. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.klass'>",
  2411. referencedClasses: [],
  2412. //>>excludeEnd("ide");
  2413. messageSends: []
  2414. }),
  2415. $globals.SmalltalkImage);
  2416. $core.addMethod(
  2417. $core.method({
  2418. selector: "classes",
  2419. protocol: 'classes',
  2420. fn: function (){
  2421. var self=this;
  2422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2423. return $core.withContext(function($ctx1) {
  2424. //>>excludeEnd("ctx");
  2425. return $core.classes();
  2426. return self;
  2427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2428. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  2429. //>>excludeEnd("ctx");
  2430. },
  2431. //>>excludeStart("ide", pragmas.excludeIdeData);
  2432. args: [],
  2433. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  2434. referencedClasses: [],
  2435. //>>excludeEnd("ide");
  2436. messageSends: []
  2437. }),
  2438. $globals.SmalltalkImage);
  2439. $core.addMethod(
  2440. $core.method({
  2441. selector: "core",
  2442. protocol: 'accessing',
  2443. fn: function (){
  2444. var self=this;
  2445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2446. return $core.withContext(function($ctx1) {
  2447. //>>excludeEnd("ctx");
  2448. return $core;
  2449. return self;
  2450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2451. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  2452. //>>excludeEnd("ctx");
  2453. },
  2454. //>>excludeStart("ide", pragmas.excludeIdeData);
  2455. args: [],
  2456. source: "core\x0a\x09<inlineJS: 'return $core'>",
  2457. referencedClasses: [],
  2458. //>>excludeEnd("ide");
  2459. messageSends: []
  2460. }),
  2461. $globals.SmalltalkImage);
  2462. $core.addMethod(
  2463. $core.method({
  2464. selector: "createPackage:",
  2465. protocol: 'packages',
  2466. fn: function (packageName){
  2467. var self=this;
  2468. var package_,announcement;
  2469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2470. return $core.withContext(function($ctx1) {
  2471. //>>excludeEnd("ctx");
  2472. var $1;
  2473. package_=self._basicCreatePackage_(packageName);
  2474. $1=$recv($globals.PackageAdded)._new();
  2475. $recv($1)._package_(package_);
  2476. announcement=$recv($1)._yourself();
  2477. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  2478. return package_;
  2479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2480. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  2481. //>>excludeEnd("ctx");
  2482. },
  2483. //>>excludeStart("ide", pragmas.excludeIdeData);
  2484. args: ["packageName"],
  2485. source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
  2486. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  2487. //>>excludeEnd("ide");
  2488. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  2489. }),
  2490. $globals.SmalltalkImage);
  2491. $core.addMethod(
  2492. $core.method({
  2493. selector: "defaultAmdNamespace",
  2494. protocol: 'accessing amd',
  2495. fn: function (){
  2496. var self=this;
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. return $core.withContext(function($ctx1) {
  2499. //>>excludeEnd("ctx");
  2500. return "transport.defaultAmdNamespace"._settingValue();
  2501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2502. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  2503. //>>excludeEnd("ctx");
  2504. },
  2505. //>>excludeStart("ide", pragmas.excludeIdeData);
  2506. args: [],
  2507. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  2508. referencedClasses: [],
  2509. //>>excludeEnd("ide");
  2510. messageSends: ["settingValue"]
  2511. }),
  2512. $globals.SmalltalkImage);
  2513. $core.addMethod(
  2514. $core.method({
  2515. selector: "defaultAmdNamespace:",
  2516. protocol: 'accessing amd',
  2517. fn: function (aString){
  2518. var self=this;
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. return $core.withContext(function($ctx1) {
  2521. //>>excludeEnd("ctx");
  2522. "transport.defaultAmdNamespace"._settingValue_(aString);
  2523. return self;
  2524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2525. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  2526. //>>excludeEnd("ctx");
  2527. },
  2528. //>>excludeStart("ide", pragmas.excludeIdeData);
  2529. args: ["aString"],
  2530. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  2531. referencedClasses: [],
  2532. //>>excludeEnd("ide");
  2533. messageSends: ["settingValue:"]
  2534. }),
  2535. $globals.SmalltalkImage);
  2536. $core.addMethod(
  2537. $core.method({
  2538. selector: "deleteClass:",
  2539. protocol: 'private',
  2540. fn: function (aClass){
  2541. var self=this;
  2542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2543. return $core.withContext(function($ctx1) {
  2544. //>>excludeEnd("ctx");
  2545. $core.removeClass(aClass);
  2546. return self;
  2547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2548. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  2549. //>>excludeEnd("ctx");
  2550. },
  2551. //>>excludeStart("ide", pragmas.excludeIdeData);
  2552. args: ["aClass"],
  2553. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  2554. referencedClasses: [],
  2555. //>>excludeEnd("ide");
  2556. messageSends: []
  2557. }),
  2558. $globals.SmalltalkImage);
  2559. $core.addMethod(
  2560. $core.method({
  2561. selector: "deleteGlobalJsVariable:",
  2562. protocol: 'globals',
  2563. fn: function (aString){
  2564. var self=this;
  2565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2566. return $core.withContext(function($ctx1) {
  2567. //>>excludeEnd("ctx");
  2568. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  2569. }));
  2570. return self;
  2571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2572. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2573. //>>excludeEnd("ctx");
  2574. },
  2575. //>>excludeStart("ide", pragmas.excludeIdeData);
  2576. args: ["aString"],
  2577. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  2578. referencedClasses: [],
  2579. //>>excludeEnd("ide");
  2580. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  2581. }),
  2582. $globals.SmalltalkImage);
  2583. $core.addMethod(
  2584. $core.method({
  2585. selector: "deletePackage:",
  2586. protocol: 'private',
  2587. fn: function (packageName){
  2588. var self=this;
  2589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2590. return $core.withContext(function($ctx1) {
  2591. //>>excludeEnd("ctx");
  2592. delete $core.packages[packageName];
  2593. return self;
  2594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2595. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  2596. //>>excludeEnd("ctx");
  2597. },
  2598. //>>excludeStart("ide", pragmas.excludeIdeData);
  2599. args: ["packageName"],
  2600. 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<inlineJS: 'delete $core.packages[packageName]'>",
  2601. referencedClasses: [],
  2602. //>>excludeEnd("ide");
  2603. messageSends: []
  2604. }),
  2605. $globals.SmalltalkImage);
  2606. $core.addMethod(
  2607. $core.method({
  2608. selector: "existsJsGlobal:",
  2609. protocol: 'testing',
  2610. fn: function (aString){
  2611. var self=this;
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. return $core.withContext(function($ctx1) {
  2614. //>>excludeEnd("ctx");
  2615. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  2616. return true;
  2617. }),(function(){
  2618. return false;
  2619. }));
  2620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2621. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  2622. //>>excludeEnd("ctx");
  2623. },
  2624. //>>excludeStart("ide", pragmas.excludeIdeData);
  2625. args: ["aString"],
  2626. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  2627. referencedClasses: ["Platform"],
  2628. //>>excludeEnd("ide");
  2629. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  2630. }),
  2631. $globals.SmalltalkImage);
  2632. $core.addMethod(
  2633. $core.method({
  2634. selector: "globalJsVariables",
  2635. protocol: 'globals',
  2636. fn: function (){
  2637. var self=this;
  2638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2639. return $core.withContext(function($ctx1) {
  2640. //>>excludeEnd("ctx");
  2641. return $core.globalJsVariables;
  2642. return self;
  2643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2644. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  2645. //>>excludeEnd("ctx");
  2646. },
  2647. //>>excludeStart("ide", pragmas.excludeIdeData);
  2648. args: [],
  2649. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<inlineJS: 'return $core.globalJsVariables'>",
  2650. referencedClasses: [],
  2651. //>>excludeEnd("ide");
  2652. messageSends: []
  2653. }),
  2654. $globals.SmalltalkImage);
  2655. $core.addMethod(
  2656. $core.method({
  2657. selector: "globals",
  2658. protocol: 'accessing',
  2659. fn: function (){
  2660. var self=this;
  2661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2662. return $core.withContext(function($ctx1) {
  2663. //>>excludeEnd("ctx");
  2664. return $globals;
  2665. return self;
  2666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2667. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  2668. //>>excludeEnd("ctx");
  2669. },
  2670. //>>excludeStart("ide", pragmas.excludeIdeData);
  2671. args: [],
  2672. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  2673. referencedClasses: [],
  2674. //>>excludeEnd("ide");
  2675. messageSends: []
  2676. }),
  2677. $globals.SmalltalkImage);
  2678. $core.addMethod(
  2679. $core.method({
  2680. selector: "includesKey:",
  2681. protocol: 'accessing',
  2682. fn: function (aKey){
  2683. var self=this;
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. return $core.withContext(function($ctx1) {
  2686. //>>excludeEnd("ctx");
  2687. return $core.hasOwnProperty(aKey);
  2688. return self;
  2689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2690. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  2691. //>>excludeEnd("ctx");
  2692. },
  2693. //>>excludeStart("ide", pragmas.excludeIdeData);
  2694. args: ["aKey"],
  2695. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  2696. referencedClasses: [],
  2697. //>>excludeEnd("ide");
  2698. messageSends: []
  2699. }),
  2700. $globals.SmalltalkImage);
  2701. $core.addMethod(
  2702. $core.method({
  2703. selector: "isSmalltalkObject:",
  2704. protocol: 'testing',
  2705. fn: function (anObject){
  2706. var self=this;
  2707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2708. return $core.withContext(function($ctx1) {
  2709. //>>excludeEnd("ctx");
  2710. return anObject.klass != null;
  2711. return self;
  2712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2713. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  2714. //>>excludeEnd("ctx");
  2715. },
  2716. //>>excludeStart("ide", pragmas.excludeIdeData);
  2717. args: ["anObject"],
  2718. 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<inlineJS: 'return anObject.klass != null'>",
  2719. referencedClasses: [],
  2720. //>>excludeEnd("ide");
  2721. messageSends: []
  2722. }),
  2723. $globals.SmalltalkImage);
  2724. $core.addMethod(
  2725. $core.method({
  2726. selector: "optOut:",
  2727. protocol: 'accessing',
  2728. fn: function (anObject){
  2729. var self=this;
  2730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2731. return $core.withContext(function($ctx1) {
  2732. //>>excludeEnd("ctx");
  2733. anObject.klass = null;
  2734. return self;
  2735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2736. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  2737. //>>excludeEnd("ctx");
  2738. },
  2739. //>>excludeStart("ide", pragmas.excludeIdeData);
  2740. args: ["anObject"],
  2741. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.klass = null'>",
  2742. referencedClasses: [],
  2743. //>>excludeEnd("ide");
  2744. messageSends: []
  2745. }),
  2746. $globals.SmalltalkImage);
  2747. $core.addMethod(
  2748. $core.method({
  2749. selector: "packageAt:",
  2750. protocol: 'packages',
  2751. fn: function (packageName){
  2752. var self=this;
  2753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2754. return $core.withContext(function($ctx1) {
  2755. //>>excludeEnd("ctx");
  2756. return $core.packages[packageName];
  2757. return self;
  2758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2759. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  2760. //>>excludeEnd("ctx");
  2761. },
  2762. //>>excludeStart("ide", pragmas.excludeIdeData);
  2763. args: ["packageName"],
  2764. source: "packageAt: packageName\x0a\x09<inlineJS: 'return $core.packages[packageName]'>",
  2765. referencedClasses: [],
  2766. //>>excludeEnd("ide");
  2767. messageSends: []
  2768. }),
  2769. $globals.SmalltalkImage);
  2770. $core.addMethod(
  2771. $core.method({
  2772. selector: "packageAt:ifAbsent:",
  2773. protocol: 'packages',
  2774. fn: function (packageName,aBlock){
  2775. var self=this;
  2776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2777. return $core.withContext(function($ctx1) {
  2778. //>>excludeEnd("ctx");
  2779. var $1;
  2780. $1=self._packageAt_(packageName);
  2781. return $recv($1)._ifNil_(aBlock);
  2782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2783. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  2784. //>>excludeEnd("ctx");
  2785. },
  2786. //>>excludeStart("ide", pragmas.excludeIdeData);
  2787. args: ["packageName", "aBlock"],
  2788. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  2789. referencedClasses: [],
  2790. //>>excludeEnd("ide");
  2791. messageSends: ["ifNil:", "packageAt:"]
  2792. }),
  2793. $globals.SmalltalkImage);
  2794. $core.addMethod(
  2795. $core.method({
  2796. selector: "packages",
  2797. protocol: 'packages',
  2798. fn: function (){
  2799. var self=this;
  2800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2801. return $core.withContext(function($ctx1) {
  2802. //>>excludeEnd("ctx");
  2803. return Object.keys($core.packages).map(function(k) {
  2804. return $core.packages[k];
  2805. })
  2806. ;
  2807. return self;
  2808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2809. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  2810. //>>excludeEnd("ctx");
  2811. },
  2812. //>>excludeStart("ide", pragmas.excludeIdeData);
  2813. args: [],
  2814. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<inlineJS: '\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09'>",
  2815. referencedClasses: [],
  2816. //>>excludeEnd("ide");
  2817. messageSends: []
  2818. }),
  2819. $globals.SmalltalkImage);
  2820. $core.addMethod(
  2821. $core.method({
  2822. selector: "parse:",
  2823. protocol: 'accessing',
  2824. fn: function (aString){
  2825. var self=this;
  2826. var result;
  2827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2828. return $core.withContext(function($ctx1) {
  2829. //>>excludeEnd("ctx");
  2830. var $1;
  2831. $recv((function(){
  2832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2833. return $core.withContext(function($ctx2) {
  2834. //>>excludeEnd("ctx");
  2835. result=self._basicParse_(aString);
  2836. return result;
  2837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2839. //>>excludeEnd("ctx");
  2840. }))._tryCatch_((function(ex){
  2841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2842. return $core.withContext(function($ctx2) {
  2843. //>>excludeEnd("ctx");
  2844. return $recv(self._parseError_parsing_(ex,aString))._signal();
  2845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2846. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  2847. //>>excludeEnd("ctx");
  2848. }));
  2849. $1=result;
  2850. $recv($1)._source_(aString);
  2851. return $recv($1)._yourself();
  2852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2853. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  2854. //>>excludeEnd("ctx");
  2855. },
  2856. //>>excludeStart("ide", pragmas.excludeIdeData);
  2857. args: ["aString"],
  2858. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  2859. referencedClasses: [],
  2860. //>>excludeEnd("ide");
  2861. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  2862. }),
  2863. $globals.SmalltalkImage);
  2864. $core.addMethod(
  2865. $core.method({
  2866. selector: "parseError:parsing:",
  2867. protocol: 'error handling',
  2868. fn: function (anException,aString){
  2869. var self=this;
  2870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2871. return $core.withContext(function($ctx1) {
  2872. //>>excludeEnd("ctx");
  2873. var $1,$7,$6,$5,$8,$4,$3,$2;
  2874. $1=$recv($globals.ParseError)._new();
  2875. $7=$recv(anException)._basicAt_("line");
  2876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2877. $ctx1.sendIdx["basicAt:"]=1;
  2878. //>>excludeEnd("ctx");
  2879. $6="Parse error on line ".__comma($7);
  2880. $5=$recv($6).__comma(" column ");
  2881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2882. $ctx1.sendIdx[","]=4;
  2883. //>>excludeEnd("ctx");
  2884. $8=$recv(anException)._basicAt_("column");
  2885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2886. $ctx1.sendIdx["basicAt:"]=2;
  2887. //>>excludeEnd("ctx");
  2888. $4=$recv($5).__comma($8);
  2889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2890. $ctx1.sendIdx[","]=3;
  2891. //>>excludeEnd("ctx");
  2892. $3=$recv($4).__comma(" : Unexpected character ");
  2893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2894. $ctx1.sendIdx[","]=2;
  2895. //>>excludeEnd("ctx");
  2896. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. $ctx1.sendIdx[","]=1;
  2899. //>>excludeEnd("ctx");
  2900. return $recv($1)._messageText_($2);
  2901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2902. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  2903. //>>excludeEnd("ctx");
  2904. },
  2905. //>>excludeStart("ide", pragmas.excludeIdeData);
  2906. args: ["anException", "aString"],
  2907. 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')",
  2908. referencedClasses: ["ParseError"],
  2909. //>>excludeEnd("ide");
  2910. messageSends: ["messageText:", "new", ",", "basicAt:"]
  2911. }),
  2912. $globals.SmalltalkImage);
  2913. $core.addMethod(
  2914. $core.method({
  2915. selector: "pseudoVariableNames",
  2916. protocol: 'accessing',
  2917. fn: function (){
  2918. var self=this;
  2919. return ["self", "super", "nil", "true", "false", "thisContext"];
  2920. },
  2921. //>>excludeStart("ide", pragmas.excludeIdeData);
  2922. args: [],
  2923. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  2924. referencedClasses: [],
  2925. //>>excludeEnd("ide");
  2926. messageSends: []
  2927. }),
  2928. $globals.SmalltalkImage);
  2929. $core.addMethod(
  2930. $core.method({
  2931. selector: "readJSObject:",
  2932. protocol: 'accessing',
  2933. fn: function (anObject){
  2934. var self=this;
  2935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2936. return $core.withContext(function($ctx1) {
  2937. //>>excludeEnd("ctx");
  2938. return $core.readJSObject(anObject);
  2939. return self;
  2940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2941. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  2942. //>>excludeEnd("ctx");
  2943. },
  2944. //>>excludeStart("ide", pragmas.excludeIdeData);
  2945. args: ["anObject"],
  2946. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  2947. referencedClasses: [],
  2948. //>>excludeEnd("ide");
  2949. messageSends: []
  2950. }),
  2951. $globals.SmalltalkImage);
  2952. $core.addMethod(
  2953. $core.method({
  2954. selector: "removeClass:",
  2955. protocol: 'classes',
  2956. fn: function (aClass){
  2957. var self=this;
  2958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2959. return $core.withContext(function($ctx1) {
  2960. //>>excludeEnd("ctx");
  2961. var $1,$2,$4,$3;
  2962. $1=$recv(aClass)._isMetaclass();
  2963. if($core.assert($1)){
  2964. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  2965. }
  2966. self._deleteClass_(aClass);
  2967. $2=$recv($globals.SystemAnnouncer)._current();
  2968. $4=$recv($globals.ClassRemoved)._new();
  2969. $recv($4)._theClass_(aClass);
  2970. $3=$recv($4)._yourself();
  2971. $recv($2)._announce_($3);
  2972. return self;
  2973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2974. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  2975. //>>excludeEnd("ctx");
  2976. },
  2977. //>>excludeStart("ide", pragmas.excludeIdeData);
  2978. args: ["aClass"],
  2979. 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)",
  2980. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  2981. //>>excludeEnd("ide");
  2982. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  2983. }),
  2984. $globals.SmalltalkImage);
  2985. $core.addMethod(
  2986. $core.method({
  2987. selector: "removePackage:",
  2988. protocol: 'packages',
  2989. fn: function (packageName){
  2990. var self=this;
  2991. var pkg;
  2992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2993. return $core.withContext(function($ctx1) {
  2994. //>>excludeEnd("ctx");
  2995. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. return $core.withContext(function($ctx2) {
  2998. //>>excludeEnd("ctx");
  2999. return self._error_("Missing package: ".__comma(packageName));
  3000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3002. //>>excludeEnd("ctx");
  3003. }));
  3004. $recv($recv(pkg)._classes())._do_((function(each){
  3005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3006. return $core.withContext(function($ctx2) {
  3007. //>>excludeEnd("ctx");
  3008. return self._removeClass_(each);
  3009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3010. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3011. //>>excludeEnd("ctx");
  3012. }));
  3013. self._deletePackage_(packageName);
  3014. return self;
  3015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3016. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  3017. //>>excludeEnd("ctx");
  3018. },
  3019. //>>excludeStart("ide", pragmas.excludeIdeData);
  3020. args: ["packageName"],
  3021. 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",
  3022. referencedClasses: [],
  3023. //>>excludeEnd("ide");
  3024. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  3025. }),
  3026. $globals.SmalltalkImage);
  3027. $core.addMethod(
  3028. $core.method({
  3029. selector: "renamePackage:to:",
  3030. protocol: 'packages',
  3031. fn: function (packageName,newName){
  3032. var self=this;
  3033. var pkg;
  3034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3035. return $core.withContext(function($ctx1) {
  3036. //>>excludeEnd("ctx");
  3037. var $1,$2,$receiver;
  3038. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  3039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3040. return $core.withContext(function($ctx2) {
  3041. //>>excludeEnd("ctx");
  3042. $1="Missing package: ".__comma(packageName);
  3043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3044. $ctx2.sendIdx[","]=1;
  3045. //>>excludeEnd("ctx");
  3046. return self._error_($1);
  3047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3048. $ctx2.sendIdx["error:"]=1;
  3049. //>>excludeEnd("ctx");
  3050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3052. //>>excludeEnd("ctx");
  3053. }));
  3054. $2=self._packageAt_(newName);
  3055. if(($receiver = $2) == null || $receiver.isNil){
  3056. $2;
  3057. } else {
  3058. self._error_("Already exists a package called: ".__comma(newName));
  3059. }
  3060. $recv(pkg)._name_(newName);
  3061. self._basicRegisterPackage_(pkg);
  3062. self._deletePackage_(packageName);
  3063. return self;
  3064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3065. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  3066. //>>excludeEnd("ctx");
  3067. },
  3068. //>>excludeStart("ide", pragmas.excludeIdeData);
  3069. args: ["packageName", "newName"],
  3070. 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\x09pkg name: newName.\x0a\x09self basicRegisterPackage: pkg.\x0a\x09self deletePackage: packageName.",
  3071. referencedClasses: [],
  3072. //>>excludeEnd("ide");
  3073. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  3074. }),
  3075. $globals.SmalltalkImage);
  3076. $core.addMethod(
  3077. $core.method({
  3078. selector: "reservedWords",
  3079. protocol: 'accessing',
  3080. fn: function (){
  3081. var self=this;
  3082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3083. return $core.withContext(function($ctx1) {
  3084. //>>excludeEnd("ctx");
  3085. return $core.reservedWords;
  3086. return self;
  3087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3088. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  3089. //>>excludeEnd("ctx");
  3090. },
  3091. //>>excludeStart("ide", pragmas.excludeIdeData);
  3092. args: [],
  3093. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<inlineJS: 'return $core.reservedWords'>",
  3094. referencedClasses: [],
  3095. //>>excludeEnd("ide");
  3096. messageSends: []
  3097. }),
  3098. $globals.SmalltalkImage);
  3099. $core.addMethod(
  3100. $core.method({
  3101. selector: "settings",
  3102. protocol: 'accessing',
  3103. fn: function (){
  3104. var self=this;
  3105. return $globals.SmalltalkSettings;
  3106. },
  3107. //>>excludeStart("ide", pragmas.excludeIdeData);
  3108. args: [],
  3109. source: "settings\x0a\x09^ SmalltalkSettings",
  3110. referencedClasses: ["SmalltalkSettings"],
  3111. //>>excludeEnd("ide");
  3112. messageSends: []
  3113. }),
  3114. $globals.SmalltalkImage);
  3115. $core.addMethod(
  3116. $core.method({
  3117. selector: "version",
  3118. protocol: 'accessing',
  3119. fn: function (){
  3120. var self=this;
  3121. return "0.19.0-pre";
  3122. },
  3123. //>>excludeStart("ide", pragmas.excludeIdeData);
  3124. args: [],
  3125. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.19.0-pre'",
  3126. referencedClasses: [],
  3127. //>>excludeEnd("ide");
  3128. messageSends: []
  3129. }),
  3130. $globals.SmalltalkImage);
  3131. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  3132. $core.addMethod(
  3133. $core.method({
  3134. selector: "current",
  3135. protocol: 'instance creation',
  3136. fn: function (){
  3137. var self=this;
  3138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3139. return $core.withContext(function($ctx1) {
  3140. //>>excludeEnd("ctx");
  3141. var $1,$receiver;
  3142. $1=self["@current"];
  3143. if(($receiver = $1) == null || $receiver.isNil){
  3144. self["@current"]=(
  3145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3146. $ctx1.supercall = true,
  3147. //>>excludeEnd("ctx");
  3148. ($globals.SmalltalkImage.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  3149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3150. $ctx1.supercall = false;
  3151. //>>excludeEnd("ctx");;
  3152. return self["@current"];
  3153. } else {
  3154. self._deprecatedAPI();
  3155. return self["@current"];
  3156. }
  3157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3158. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  3159. //>>excludeEnd("ctx");
  3160. },
  3161. //>>excludeStart("ide", pragmas.excludeIdeData);
  3162. args: [],
  3163. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  3164. referencedClasses: [],
  3165. //>>excludeEnd("ide");
  3166. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  3167. }),
  3168. $globals.SmalltalkImage.klass);
  3169. $core.addMethod(
  3170. $core.method({
  3171. selector: "initialize",
  3172. protocol: 'initialization',
  3173. fn: function (){
  3174. var self=this;
  3175. var st;
  3176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3177. return $core.withContext(function($ctx1) {
  3178. //>>excludeEnd("ctx");
  3179. st=self._current();
  3180. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  3181. return self;
  3182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3183. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  3184. //>>excludeEnd("ctx");
  3185. },
  3186. //>>excludeStart("ide", pragmas.excludeIdeData);
  3187. args: [],
  3188. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  3189. referencedClasses: [],
  3190. //>>excludeEnd("ide");
  3191. messageSends: ["current", "at:put:", "globals"]
  3192. }),
  3193. $globals.SmalltalkImage.klass);
  3194. $core.addMethod(
  3195. $core.method({
  3196. selector: "new",
  3197. protocol: 'instance creation',
  3198. fn: function (){
  3199. var self=this;
  3200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3201. return $core.withContext(function($ctx1) {
  3202. //>>excludeEnd("ctx");
  3203. self._shouldNotImplement();
  3204. return self;
  3205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3206. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  3207. //>>excludeEnd("ctx");
  3208. },
  3209. //>>excludeStart("ide", pragmas.excludeIdeData);
  3210. args: [],
  3211. source: "new\x0a\x09self shouldNotImplement",
  3212. referencedClasses: [],
  3213. //>>excludeEnd("ide");
  3214. messageSends: ["shouldNotImplement"]
  3215. }),
  3216. $globals.SmalltalkImage.klass);
  3217. $core.addMethod(
  3218. $core.method({
  3219. selector: "asJavaScriptPropertyName",
  3220. protocol: '*Kernel-Infrastructure',
  3221. fn: function (){
  3222. var self=this;
  3223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3224. return $core.withContext(function($ctx1) {
  3225. //>>excludeEnd("ctx");
  3226. return $core.st2prop(self);
  3227. return self;
  3228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3229. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  3230. //>>excludeEnd("ctx");
  3231. },
  3232. //>>excludeStart("ide", pragmas.excludeIdeData);
  3233. args: [],
  3234. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  3235. referencedClasses: [],
  3236. //>>excludeEnd("ide");
  3237. messageSends: []
  3238. }),
  3239. $globals.String);
  3240. $core.addMethod(
  3241. $core.method({
  3242. selector: "asSetting",
  3243. protocol: '*Kernel-Infrastructure',
  3244. fn: function (){
  3245. var self=this;
  3246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3247. return $core.withContext(function($ctx1) {
  3248. //>>excludeEnd("ctx");
  3249. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  3250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3251. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  3252. //>>excludeEnd("ctx");
  3253. },
  3254. //>>excludeStart("ide", pragmas.excludeIdeData);
  3255. args: [],
  3256. source: "asSetting\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Nil will be the default value.\x22\x0a\x09^ Setting at: self ifAbsent: nil",
  3257. referencedClasses: ["Setting"],
  3258. //>>excludeEnd("ide");
  3259. messageSends: ["at:ifAbsent:"]
  3260. }),
  3261. $globals.String);
  3262. $core.addMethod(
  3263. $core.method({
  3264. selector: "asSettingIfAbsent:",
  3265. protocol: '*Kernel-Infrastructure',
  3266. fn: function (aDefaultValue){
  3267. var self=this;
  3268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3269. return $core.withContext(function($ctx1) {
  3270. //>>excludeEnd("ctx");
  3271. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  3272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3273. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  3274. //>>excludeEnd("ctx");
  3275. },
  3276. //>>excludeStart("ide", pragmas.excludeIdeData);
  3277. args: ["aDefaultValue"],
  3278. source: "asSettingIfAbsent: aDefaultValue\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Make this setting to have aDefaultValue.\x22\x0a\x09^ Setting at: self ifAbsent: aDefaultValue",
  3279. referencedClasses: ["Setting"],
  3280. //>>excludeEnd("ide");
  3281. messageSends: ["at:ifAbsent:"]
  3282. }),
  3283. $globals.String);
  3284. $core.addMethod(
  3285. $core.method({
  3286. selector: "settingValue",
  3287. protocol: '*Kernel-Infrastructure',
  3288. fn: function (){
  3289. var self=this;
  3290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3291. return $core.withContext(function($ctx1) {
  3292. //>>excludeEnd("ctx");
  3293. return $recv(self._asSetting())._value();
  3294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3295. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  3296. //>>excludeEnd("ctx");
  3297. },
  3298. //>>excludeStart("ide", pragmas.excludeIdeData);
  3299. args: [],
  3300. source: "settingValue\x0a\x09^ self asSetting value",
  3301. referencedClasses: [],
  3302. //>>excludeEnd("ide");
  3303. messageSends: ["value", "asSetting"]
  3304. }),
  3305. $globals.String);
  3306. $core.addMethod(
  3307. $core.method({
  3308. selector: "settingValue:",
  3309. protocol: '*Kernel-Infrastructure',
  3310. fn: function (aValue){
  3311. var self=this;
  3312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3313. return $core.withContext(function($ctx1) {
  3314. //>>excludeEnd("ctx");
  3315. return $recv(self._asSetting())._value_(aValue);
  3316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3317. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  3318. //>>excludeEnd("ctx");
  3319. },
  3320. //>>excludeStart("ide", pragmas.excludeIdeData);
  3321. args: ["aValue"],
  3322. source: "settingValue: aValue\x0a\x09\x22Sets the value of the setting that will be locally stored using this string as key.\x0a\x09Note that aValue can be any object that can be stringifyed\x22\x0a\x09^ self asSetting value: aValue",
  3323. referencedClasses: [],
  3324. //>>excludeEnd("ide");
  3325. messageSends: ["value:", "asSetting"]
  3326. }),
  3327. $globals.String);
  3328. $core.addMethod(
  3329. $core.method({
  3330. selector: "settingValueIfAbsent:",
  3331. protocol: '*Kernel-Infrastructure',
  3332. fn: function (aDefaultValue){
  3333. var self=this;
  3334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3335. return $core.withContext(function($ctx1) {
  3336. //>>excludeEnd("ctx");
  3337. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  3338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3339. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  3340. //>>excludeEnd("ctx");
  3341. },
  3342. //>>excludeStart("ide", pragmas.excludeIdeData);
  3343. args: ["aDefaultValue"],
  3344. source: "settingValueIfAbsent: aDefaultValue\x0a\x09\x22Answer the value of the locally stored setting using this string as key.\x0a\x09Use aDefaultValue in case no setting is found\x22\x0a\x09^ (self asSettingIfAbsent: aDefaultValue) value",
  3345. referencedClasses: [],
  3346. //>>excludeEnd("ide");
  3347. messageSends: ["value", "asSettingIfAbsent:"]
  3348. }),
  3349. $globals.String);
  3350. });