Kernel-Infrastructure.js 122 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512
  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)._write_("Object subclass: #NameOfSubclass");
  823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  824. $ctx2.sendIdx["write:"]=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)._write_("instanceVariableNames: ''");
  835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  836. $ctx2.sendIdx["write:"]=2;
  837. //>>excludeEnd("ctx");
  838. $recv(stream)._lf();
  839. $recv(stream)._tab();
  840. $recv(stream)._write_("package: ");
  841. return $recv(stream)._print_(self._name());
  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 | stream\x0a\x09\x09write: 'Object subclass: #NameOfSubclass'; lf;\x0a\x09\x09tab; write: 'instanceVariableNames: '''''; lf;\x0a\x09\x09tab; write: 'package: '; print: self name ]",
  853. referencedClasses: ["String"],
  854. //>>excludeEnd("ide");
  855. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "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;
  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)._write_($1);
  899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  900. $ctx2.sendIdx["write:"]=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. $recv(stream)._write_("named: ");
  911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  912. $ctx2.sendIdx["write:"]=2;
  913. //>>excludeEnd("ctx");
  914. $recv(stream)._print_(self._name());
  915. $recv(stream)._lf();
  916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  917. $ctx2.sendIdx["lf"]=2;
  918. //>>excludeEnd("ctx");
  919. $recv(stream)._tab();
  920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  921. $ctx2.sendIdx["tab"]=2;
  922. //>>excludeEnd("ctx");
  923. $recv(stream)._write_("imports: ");
  924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  925. $ctx2.sendIdx["write:"]=3;
  926. //>>excludeEnd("ctx");
  927. $recv(stream)._write_(self._importsDefinition());
  928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  929. $ctx2.sendIdx["write:"]=4;
  930. //>>excludeEnd("ctx");
  931. $recv(stream)._lf();
  932. $recv(stream)._tab();
  933. $recv(stream)._write_("transport: (");
  934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  935. $ctx2.sendIdx["write:"]=5;
  936. //>>excludeEnd("ctx");
  937. $recv(stream)._write_($recv(self._transport())._definition());
  938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  939. $ctx2.sendIdx["write:"]=6;
  940. //>>excludeEnd("ctx");
  941. return $recv(stream)._write_(")");
  942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  943. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  944. //>>excludeEnd("ctx");
  945. }));
  946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  947. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  948. //>>excludeEnd("ctx");
  949. },
  950. //>>excludeStart("ide", pragmas.excludeIdeData);
  951. args: [],
  952. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: self class name; lf;\x0a\x09\x09tab; write: 'named: '; print: self name; lf;\x0a\x09\x09tab; write: 'imports: '; write: self importsDefinition; lf;\x0a\x09\x09tab; write: 'transport: ('; write: self transport definition; write: ')' ]",
  953. referencedClasses: ["String"],
  954. //>>excludeEnd("ide");
  955. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  956. }),
  957. $globals.Package);
  958. $core.addMethod(
  959. $core.method({
  960. selector: "imports",
  961. protocol: "accessing",
  962. fn: function (){
  963. var self=this;
  964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  965. return $core.withContext(function($ctx1) {
  966. //>>excludeEnd("ctx");
  967. var $1,$receiver;
  968. $1=self["@imports"];
  969. if(($receiver = $1) == null || $receiver.isNil){
  970. var parsed;
  971. parsed=self._importsFromJson_(self._basicImports());
  972. parsed;
  973. self._imports_(parsed);
  974. return self["@imports"];
  975. } else {
  976. return $1;
  977. }
  978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  979. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  980. //>>excludeEnd("ctx");
  981. },
  982. //>>excludeStart("ide", pragmas.excludeIdeData);
  983. args: [],
  984. 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 ]",
  985. referencedClasses: [],
  986. //>>excludeEnd("ide");
  987. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  988. }),
  989. $globals.Package);
  990. $core.addMethod(
  991. $core.method({
  992. selector: "imports:",
  993. protocol: "accessing",
  994. fn: function (anArray){
  995. var self=this;
  996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  997. return $core.withContext(function($ctx1) {
  998. //>>excludeEnd("ctx");
  999. self._validateImports_(anArray);
  1000. self["@imports"]=$recv(anArray)._asSet();
  1001. return self;
  1002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1003. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  1004. //>>excludeEnd("ctx");
  1005. },
  1006. //>>excludeStart("ide", pragmas.excludeIdeData);
  1007. args: ["anArray"],
  1008. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  1009. referencedClasses: [],
  1010. //>>excludeEnd("ide");
  1011. messageSends: ["validateImports:", "asSet"]
  1012. }),
  1013. $globals.Package);
  1014. $core.addMethod(
  1015. $core.method({
  1016. selector: "importsAsJson",
  1017. protocol: "converting",
  1018. fn: function (){
  1019. var self=this;
  1020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1021. return $core.withContext(function($ctx1) {
  1022. //>>excludeEnd("ctx");
  1023. var $1;
  1024. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  1025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1026. return $core.withContext(function($ctx2) {
  1027. //>>excludeEnd("ctx");
  1028. $1=$recv(each)._isString();
  1029. if($core.assert($1)){
  1030. return each;
  1031. } else {
  1032. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  1033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1034. $ctx2.sendIdx[","]=1;
  1035. //>>excludeEnd("ctx");
  1036. }
  1037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1038. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1039. //>>excludeEnd("ctx");
  1040. }));
  1041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1042. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  1043. //>>excludeEnd("ctx");
  1044. },
  1045. //>>excludeStart("ide", pragmas.excludeIdeData);
  1046. args: [],
  1047. 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 ]]",
  1048. referencedClasses: [],
  1049. //>>excludeEnd("ide");
  1050. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  1051. }),
  1052. $globals.Package);
  1053. $core.addMethod(
  1054. $core.method({
  1055. selector: "importsDefinition",
  1056. protocol: "accessing",
  1057. fn: function (){
  1058. var self=this;
  1059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1060. return $core.withContext(function($ctx1) {
  1061. //>>excludeEnd("ctx");
  1062. return $recv($globals.String)._streamContents_((function(stream){
  1063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1064. return $core.withContext(function($ctx2) {
  1065. //>>excludeEnd("ctx");
  1066. $recv(stream)._nextPutAll_("{");
  1067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1068. $ctx2.sendIdx["nextPutAll:"]=1;
  1069. //>>excludeEnd("ctx");
  1070. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  1071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1072. return $core.withContext(function($ctx3) {
  1073. //>>excludeEnd("ctx");
  1074. return $recv(stream)._nextPutAll_($recv(each)._printString());
  1075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1076. $ctx3.sendIdx["nextPutAll:"]=2;
  1077. //>>excludeEnd("ctx");
  1078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1079. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  1080. //>>excludeEnd("ctx");
  1081. }),(function(){
  1082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1083. return $core.withContext(function($ctx3) {
  1084. //>>excludeEnd("ctx");
  1085. return $recv(stream)._nextPutAll_(". ");
  1086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1087. $ctx3.sendIdx["nextPutAll:"]=3;
  1088. //>>excludeEnd("ctx");
  1089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1090. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  1091. //>>excludeEnd("ctx");
  1092. }));
  1093. return $recv(stream)._nextPutAll_("}");
  1094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1095. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1096. //>>excludeEnd("ctx");
  1097. }));
  1098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1099. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  1100. //>>excludeEnd("ctx");
  1101. },
  1102. //>>excludeStart("ide", pragmas.excludeIdeData);
  1103. args: [],
  1104. 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: '}' ]",
  1105. referencedClasses: ["String"],
  1106. //>>excludeEnd("ide");
  1107. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "printString"]
  1108. }),
  1109. $globals.Package);
  1110. $core.addMethod(
  1111. $core.method({
  1112. selector: "importsFromJson:",
  1113. protocol: "converting",
  1114. fn: function (anArray){
  1115. var self=this;
  1116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1117. return $core.withContext(function($ctx1) {
  1118. //>>excludeEnd("ctx");
  1119. var $1;
  1120. return $recv(anArray)._collect_((function(each){
  1121. var split;
  1122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1123. return $core.withContext(function($ctx2) {
  1124. //>>excludeEnd("ctx");
  1125. split=$recv(each)._tokenize_("=");
  1126. split;
  1127. $1=$recv($recv(split)._size()).__eq((1));
  1128. if($core.assert($1)){
  1129. return $recv(split)._first();
  1130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1131. $ctx2.sendIdx["first"]=1;
  1132. //>>excludeEnd("ctx");
  1133. } else {
  1134. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  1135. }
  1136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1137. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  1138. //>>excludeEnd("ctx");
  1139. }));
  1140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1141. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  1142. //>>excludeEnd("ctx");
  1143. },
  1144. //>>excludeStart("ide", pragmas.excludeIdeData);
  1145. args: ["anArray"],
  1146. 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 ]]",
  1147. referencedClasses: [],
  1148. //>>excludeEnd("ide");
  1149. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  1150. }),
  1151. $globals.Package);
  1152. $core.addMethod(
  1153. $core.method({
  1154. selector: "isDirty",
  1155. protocol: "testing",
  1156. fn: function (){
  1157. var self=this;
  1158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1159. return $core.withContext(function($ctx1) {
  1160. //>>excludeEnd("ctx");
  1161. var $1,$receiver;
  1162. $1=self["@dirty"];
  1163. if(($receiver = $1) == null || $receiver.isNil){
  1164. return false;
  1165. } else {
  1166. return $1;
  1167. }
  1168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1169. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  1170. //>>excludeEnd("ctx");
  1171. },
  1172. //>>excludeStart("ide", pragmas.excludeIdeData);
  1173. args: [],
  1174. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  1175. referencedClasses: [],
  1176. //>>excludeEnd("ide");
  1177. messageSends: ["ifNil:"]
  1178. }),
  1179. $globals.Package);
  1180. $core.addMethod(
  1181. $core.method({
  1182. selector: "isPackage",
  1183. protocol: "testing",
  1184. fn: function (){
  1185. var self=this;
  1186. return true;
  1187. },
  1188. //>>excludeStart("ide", pragmas.excludeIdeData);
  1189. args: [],
  1190. source: "isPackage\x0a\x09^ true",
  1191. referencedClasses: [],
  1192. //>>excludeEnd("ide");
  1193. messageSends: []
  1194. }),
  1195. $globals.Package);
  1196. $core.addMethod(
  1197. $core.method({
  1198. selector: "loadDependencies",
  1199. protocol: "dependencies",
  1200. fn: function (){
  1201. var self=this;
  1202. var classes,packages;
  1203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1204. return $core.withContext(function($ctx1) {
  1205. //>>excludeEnd("ctx");
  1206. var $1;
  1207. classes=self._loadDependencyClasses();
  1208. $1=$recv($recv(classes)._collect_((function(each){
  1209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1210. return $core.withContext(function($ctx2) {
  1211. //>>excludeEnd("ctx");
  1212. return $recv(each)._package();
  1213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1214. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1215. //>>excludeEnd("ctx");
  1216. })))._asSet();
  1217. $recv($1)._remove_ifAbsent_(self,(function(){
  1218. }));
  1219. return $recv($1)._yourself();
  1220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1221. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  1222. //>>excludeEnd("ctx");
  1223. },
  1224. //>>excludeStart("ide", pragmas.excludeIdeData);
  1225. args: [],
  1226. 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",
  1227. referencedClasses: [],
  1228. //>>excludeEnd("ide");
  1229. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  1230. }),
  1231. $globals.Package);
  1232. $core.addMethod(
  1233. $core.method({
  1234. selector: "loadDependencyClasses",
  1235. protocol: "dependencies",
  1236. fn: function (){
  1237. var self=this;
  1238. var starCategoryName;
  1239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1240. return $core.withContext(function($ctx1) {
  1241. //>>excludeEnd("ctx");
  1242. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  1243. starCategoryName="*".__comma(self._name());
  1244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1245. $ctx1.sendIdx[","]=1;
  1246. //>>excludeEnd("ctx");
  1247. $3=self._classes();
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. $ctx1.sendIdx["classes"]=1;
  1250. //>>excludeEnd("ctx");
  1251. $2=$recv($3)._collect_((function(each){
  1252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1253. return $core.withContext(function($ctx2) {
  1254. //>>excludeEnd("ctx");
  1255. return $recv(each)._superclass();
  1256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1258. //>>excludeEnd("ctx");
  1259. }));
  1260. $1=$recv($2)._asSet();
  1261. $recv($1)._remove_ifAbsent_(nil,(function(){
  1262. }));
  1263. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. return $core.withContext(function($ctx2) {
  1266. //>>excludeEnd("ctx");
  1267. $5=$recv(each)._protocols();
  1268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1269. $ctx2.sendIdx["protocols"]=1;
  1270. //>>excludeEnd("ctx");
  1271. $7=$recv(each)._theMetaClass();
  1272. if(($receiver = $7) == null || $receiver.isNil){
  1273. $6=[];
  1274. } else {
  1275. var meta;
  1276. meta=$receiver;
  1277. $6=$recv(meta)._protocols();
  1278. }
  1279. $4=$recv($5).__comma($6);
  1280. return $recv($4)._includes_(starCategoryName);
  1281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1283. //>>excludeEnd("ctx");
  1284. })));
  1285. return $recv($1)._yourself();
  1286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1287. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  1288. //>>excludeEnd("ctx");
  1289. },
  1290. //>>excludeStart("ide", pragmas.excludeIdeData);
  1291. args: [],
  1292. 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",
  1293. referencedClasses: ["Smalltalk"],
  1294. //>>excludeEnd("ide");
  1295. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "yourself"]
  1296. }),
  1297. $globals.Package);
  1298. $core.addMethod(
  1299. $core.method({
  1300. selector: "name",
  1301. protocol: "accessing",
  1302. fn: function (){
  1303. var self=this;
  1304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1305. return $core.withContext(function($ctx1) {
  1306. //>>excludeEnd("ctx");
  1307. return self.pkgName;
  1308. return self;
  1309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1310. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  1311. //>>excludeEnd("ctx");
  1312. },
  1313. //>>excludeStart("ide", pragmas.excludeIdeData);
  1314. args: [],
  1315. source: "name\x0a\x09<inlineJS: 'return self.pkgName'>",
  1316. referencedClasses: [],
  1317. //>>excludeEnd("ide");
  1318. messageSends: []
  1319. }),
  1320. $globals.Package);
  1321. $core.addMethod(
  1322. $core.method({
  1323. selector: "name:",
  1324. protocol: "accessing",
  1325. fn: function (aString){
  1326. var self=this;
  1327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1328. return $core.withContext(function($ctx1) {
  1329. //>>excludeEnd("ctx");
  1330. self._basicName_(aString);
  1331. self._beDirty();
  1332. return self;
  1333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1334. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  1335. //>>excludeEnd("ctx");
  1336. },
  1337. //>>excludeStart("ide", pragmas.excludeIdeData);
  1338. args: ["aString"],
  1339. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  1340. referencedClasses: [],
  1341. //>>excludeEnd("ide");
  1342. messageSends: ["basicName:", "beDirty"]
  1343. }),
  1344. $globals.Package);
  1345. $core.addMethod(
  1346. $core.method({
  1347. selector: "organization",
  1348. protocol: "accessing",
  1349. fn: function (){
  1350. var self=this;
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. return $core.withContext(function($ctx1) {
  1353. //>>excludeEnd("ctx");
  1354. return self._basicAt_("organization");
  1355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1356. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  1357. //>>excludeEnd("ctx");
  1358. },
  1359. //>>excludeStart("ide", pragmas.excludeIdeData);
  1360. args: [],
  1361. source: "organization\x0a\x09^ self basicAt: 'organization'",
  1362. referencedClasses: [],
  1363. //>>excludeEnd("ide");
  1364. messageSends: ["basicAt:"]
  1365. }),
  1366. $globals.Package);
  1367. $core.addMethod(
  1368. $core.method({
  1369. selector: "printOn:",
  1370. protocol: "printing",
  1371. fn: function (aStream){
  1372. var self=this;
  1373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1374. return $core.withContext(function($ctx1) {
  1375. //>>excludeEnd("ctx");
  1376. (
  1377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1378. $ctx1.supercall = true,
  1379. //>>excludeEnd("ctx");
  1380. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  1381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1382. $ctx1.supercall = false;
  1383. //>>excludeEnd("ctx");;
  1384. $recv(aStream)._nextPutAll_(" (");
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. $ctx1.sendIdx["nextPutAll:"]=1;
  1387. //>>excludeEnd("ctx");
  1388. $recv(aStream)._nextPutAll_(self._name());
  1389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1390. $ctx1.sendIdx["nextPutAll:"]=2;
  1391. //>>excludeEnd("ctx");
  1392. $recv(aStream)._nextPutAll_(")");
  1393. return self;
  1394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1395. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  1396. //>>excludeEnd("ctx");
  1397. },
  1398. //>>excludeStart("ide", pragmas.excludeIdeData);
  1399. args: ["aStream"],
  1400. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  1401. referencedClasses: [],
  1402. //>>excludeEnd("ide");
  1403. messageSends: ["printOn:", "nextPutAll:", "name"]
  1404. }),
  1405. $globals.Package);
  1406. $core.addMethod(
  1407. $core.method({
  1408. selector: "setupClasses",
  1409. protocol: "classes",
  1410. fn: function (){
  1411. var self=this;
  1412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1413. return $core.withContext(function($ctx1) {
  1414. //>>excludeEnd("ctx");
  1415. $recv(self._classes())._do_((function(each){
  1416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1417. return $core.withContext(function($ctx2) {
  1418. //>>excludeEnd("ctx");
  1419. return $recv(each)._initialize();
  1420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1421. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1422. //>>excludeEnd("ctx");
  1423. }));
  1424. return self;
  1425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1426. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  1427. //>>excludeEnd("ctx");
  1428. },
  1429. //>>excludeStart("ide", pragmas.excludeIdeData);
  1430. args: [],
  1431. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  1432. referencedClasses: [],
  1433. //>>excludeEnd("ide");
  1434. messageSends: ["do:", "classes", "initialize"]
  1435. }),
  1436. $globals.Package);
  1437. $core.addMethod(
  1438. $core.method({
  1439. selector: "sortedClasses",
  1440. protocol: "classes",
  1441. fn: function (){
  1442. var self=this;
  1443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1444. return $core.withContext(function($ctx1) {
  1445. //>>excludeEnd("ctx");
  1446. return $recv(self._class())._sortedClasses_(self._classes());
  1447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1448. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  1449. //>>excludeEnd("ctx");
  1450. },
  1451. //>>excludeStart("ide", pragmas.excludeIdeData);
  1452. args: [],
  1453. 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",
  1454. referencedClasses: [],
  1455. //>>excludeEnd("ide");
  1456. messageSends: ["sortedClasses:", "class", "classes"]
  1457. }),
  1458. $globals.Package);
  1459. $core.addMethod(
  1460. $core.method({
  1461. selector: "sortedImportsAsArray",
  1462. protocol: "private",
  1463. fn: function (){
  1464. var self=this;
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. return $core.withContext(function($ctx1) {
  1467. //>>excludeEnd("ctx");
  1468. var $3,$2,$4,$1,$6,$5,$7;
  1469. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  1470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1471. return $core.withContext(function($ctx2) {
  1472. //>>excludeEnd("ctx");
  1473. $3=$recv(a)._isString();
  1474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1475. $ctx2.sendIdx["isString"]=1;
  1476. //>>excludeEnd("ctx");
  1477. $2=$recv($3)._not();
  1478. $4=$recv(b)._isString();
  1479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1480. $ctx2.sendIdx["isString"]=2;
  1481. //>>excludeEnd("ctx");
  1482. $1=$recv($2).__and($4);
  1483. return $recv($1)._or_((function(){
  1484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1485. return $core.withContext(function($ctx3) {
  1486. //>>excludeEnd("ctx");
  1487. $6=$recv(a)._isString();
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. $ctx3.sendIdx["isString"]=3;
  1490. //>>excludeEnd("ctx");
  1491. $5=$recv($6).__eq($recv(b)._isString());
  1492. return $recv($5)._and_((function(){
  1493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1494. return $core.withContext(function($ctx4) {
  1495. //>>excludeEnd("ctx");
  1496. $7=$recv(a)._value();
  1497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1498. $ctx4.sendIdx["value"]=1;
  1499. //>>excludeEnd("ctx");
  1500. return $recv($7).__lt_eq($recv(b)._value());
  1501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1502. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  1503. //>>excludeEnd("ctx");
  1504. }));
  1505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1506. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1507. //>>excludeEnd("ctx");
  1508. }));
  1509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1510. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  1511. //>>excludeEnd("ctx");
  1512. }));
  1513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1514. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  1515. //>>excludeEnd("ctx");
  1516. },
  1517. //>>excludeStart("ide", pragmas.excludeIdeData);
  1518. args: [],
  1519. 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 ]]]",
  1520. referencedClasses: [],
  1521. //>>excludeEnd("ide");
  1522. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  1523. }),
  1524. $globals.Package);
  1525. $core.addMethod(
  1526. $core.method({
  1527. selector: "transport",
  1528. protocol: "accessing",
  1529. fn: function (){
  1530. var self=this;
  1531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1532. return $core.withContext(function($ctx1) {
  1533. //>>excludeEnd("ctx");
  1534. var $1,$2,$receiver;
  1535. $1=self["@transport"];
  1536. if(($receiver = $1) == null || $receiver.isNil){
  1537. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  1538. $recv($2)._package_(self);
  1539. self["@transport"]=$recv($2)._yourself();
  1540. return self["@transport"];
  1541. } else {
  1542. return $1;
  1543. }
  1544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1545. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  1546. //>>excludeEnd("ctx");
  1547. },
  1548. //>>excludeStart("ide", pragmas.excludeIdeData);
  1549. args: [],
  1550. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  1551. referencedClasses: ["PackageTransport"],
  1552. //>>excludeEnd("ide");
  1553. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  1554. }),
  1555. $globals.Package);
  1556. $core.addMethod(
  1557. $core.method({
  1558. selector: "transport:",
  1559. protocol: "accessing",
  1560. fn: function (aPackageTransport){
  1561. var self=this;
  1562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1563. return $core.withContext(function($ctx1) {
  1564. //>>excludeEnd("ctx");
  1565. self["@transport"]=aPackageTransport;
  1566. $recv(aPackageTransport)._package_(self);
  1567. return self;
  1568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1569. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  1570. //>>excludeEnd("ctx");
  1571. },
  1572. //>>excludeStart("ide", pragmas.excludeIdeData);
  1573. args: ["aPackageTransport"],
  1574. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  1575. referencedClasses: [],
  1576. //>>excludeEnd("ide");
  1577. messageSends: ["package:"]
  1578. }),
  1579. $globals.Package);
  1580. $core.addMethod(
  1581. $core.method({
  1582. selector: "validateImports:",
  1583. protocol: "validation",
  1584. fn: function (aCollection){
  1585. var self=this;
  1586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1587. return $core.withContext(function($ctx1) {
  1588. //>>excludeEnd("ctx");
  1589. var $1,$2,$5,$4,$3,$6;
  1590. $recv(aCollection)._do_((function(import_){
  1591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1592. return $core.withContext(function($ctx2) {
  1593. //>>excludeEnd("ctx");
  1594. $1=$recv(import_)._isString();
  1595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1596. $ctx2.sendIdx["isString"]=1;
  1597. //>>excludeEnd("ctx");
  1598. if(!$core.assert($1)){
  1599. $2=$recv(import_)._respondsTo_("key");
  1600. if(!$core.assert($2)){
  1601. self._error_("Imports must be Strings or Associations");
  1602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1603. $ctx2.sendIdx["error:"]=1;
  1604. //>>excludeEnd("ctx");
  1605. }
  1606. $5=$recv(import_)._key();
  1607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1608. $ctx2.sendIdx["key"]=1;
  1609. //>>excludeEnd("ctx");
  1610. $4=$recv($5)._isString();
  1611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1612. $ctx2.sendIdx["isString"]=2;
  1613. //>>excludeEnd("ctx");
  1614. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  1615. if(!$core.assert($3)){
  1616. self._error_("Key and value must be Strings");
  1617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1618. $ctx2.sendIdx["error:"]=2;
  1619. //>>excludeEnd("ctx");
  1620. }
  1621. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  1622. if(!$core.assert($6)){
  1623. return self._error_("Keys must be identifiers");
  1624. }
  1625. }
  1626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1627. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  1628. //>>excludeEnd("ctx");
  1629. }));
  1630. return self;
  1631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1632. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  1633. //>>excludeEnd("ctx");
  1634. },
  1635. //>>excludeStart("ide", pragmas.excludeIdeData);
  1636. args: ["aCollection"],
  1637. 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' ]]]",
  1638. referencedClasses: [],
  1639. //>>excludeEnd("ide");
  1640. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  1641. }),
  1642. $globals.Package);
  1643. $globals.Package.klass.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  1644. $core.addMethod(
  1645. $core.method({
  1646. selector: "named:",
  1647. protocol: "accessing",
  1648. fn: function (aPackageName){
  1649. var self=this;
  1650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1651. return $core.withContext(function($ctx1) {
  1652. //>>excludeEnd("ctx");
  1653. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  1654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1655. return $core.withContext(function($ctx2) {
  1656. //>>excludeEnd("ctx");
  1657. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  1658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1660. //>>excludeEnd("ctx");
  1661. }));
  1662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1663. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  1664. //>>excludeEnd("ctx");
  1665. },
  1666. //>>excludeStart("ide", pragmas.excludeIdeData);
  1667. args: ["aPackageName"],
  1668. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  1669. referencedClasses: ["Smalltalk"],
  1670. //>>excludeEnd("ide");
  1671. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  1672. }),
  1673. $globals.Package.klass);
  1674. $core.addMethod(
  1675. $core.method({
  1676. selector: "named:ifAbsent:",
  1677. protocol: "accessing",
  1678. fn: function (aPackageName,aBlock){
  1679. var self=this;
  1680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1681. return $core.withContext(function($ctx1) {
  1682. //>>excludeEnd("ctx");
  1683. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  1684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1685. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  1686. //>>excludeEnd("ctx");
  1687. },
  1688. //>>excludeStart("ide", pragmas.excludeIdeData);
  1689. args: ["aPackageName", "aBlock"],
  1690. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  1691. referencedClasses: ["Smalltalk"],
  1692. //>>excludeEnd("ide");
  1693. messageSends: ["packageAt:ifAbsent:"]
  1694. }),
  1695. $globals.Package.klass);
  1696. $core.addMethod(
  1697. $core.method({
  1698. selector: "named:imports:transport:",
  1699. protocol: "accessing",
  1700. fn: function (aPackageName,anArray,aTransport){
  1701. var self=this;
  1702. var package_;
  1703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1704. return $core.withContext(function($ctx1) {
  1705. //>>excludeEnd("ctx");
  1706. package_=self._named_(aPackageName);
  1707. $recv(package_)._imports_(anArray);
  1708. $recv(package_)._transport_(aTransport);
  1709. return package_;
  1710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1711. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  1712. //>>excludeEnd("ctx");
  1713. },
  1714. //>>excludeStart("ide", pragmas.excludeIdeData);
  1715. args: ["aPackageName", "anArray", "aTransport"],
  1716. 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",
  1717. referencedClasses: [],
  1718. //>>excludeEnd("ide");
  1719. messageSends: ["named:", "imports:", "transport:"]
  1720. }),
  1721. $globals.Package.klass);
  1722. $core.addMethod(
  1723. $core.method({
  1724. selector: "named:transport:",
  1725. protocol: "accessing",
  1726. fn: function (aPackageName,aTransport){
  1727. var self=this;
  1728. var package_;
  1729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1730. return $core.withContext(function($ctx1) {
  1731. //>>excludeEnd("ctx");
  1732. package_=self._named_(aPackageName);
  1733. $recv(package_)._transport_(aTransport);
  1734. return package_;
  1735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1736. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  1737. //>>excludeEnd("ctx");
  1738. },
  1739. //>>excludeStart("ide", pragmas.excludeIdeData);
  1740. args: ["aPackageName", "aTransport"],
  1741. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  1742. referencedClasses: [],
  1743. //>>excludeEnd("ide");
  1744. messageSends: ["named:", "transport:"]
  1745. }),
  1746. $globals.Package.klass);
  1747. $core.addMethod(
  1748. $core.method({
  1749. selector: "sortedClasses:",
  1750. protocol: "sorting",
  1751. fn: function (classes){
  1752. var self=this;
  1753. var children,others,nodes,expandedClasses;
  1754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1755. return $core.withContext(function($ctx1) {
  1756. //>>excludeEnd("ctx");
  1757. var $1,$3,$2;
  1758. children=[];
  1759. others=[];
  1760. $recv(classes)._do_((function(each){
  1761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1762. return $core.withContext(function($ctx2) {
  1763. //>>excludeEnd("ctx");
  1764. $1=$recv(classes)._includes_($recv(each)._superclass());
  1765. if($core.assert($1)){
  1766. return $recv(others)._add_(each);
  1767. } else {
  1768. return $recv(children)._add_(each);
  1769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1770. $ctx2.sendIdx["add:"]=1;
  1771. //>>excludeEnd("ctx");
  1772. }
  1773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1775. //>>excludeEnd("ctx");
  1776. }));
  1777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1778. $ctx1.sendIdx["do:"]=1;
  1779. //>>excludeEnd("ctx");
  1780. nodes=$recv(children)._collect_((function(each){
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. return $core.withContext(function($ctx2) {
  1783. //>>excludeEnd("ctx");
  1784. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  1785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  1787. //>>excludeEnd("ctx");
  1788. }));
  1789. nodes=$recv(nodes)._sorted_((function(a,b){
  1790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1791. return $core.withContext(function($ctx2) {
  1792. //>>excludeEnd("ctx");
  1793. $3=$recv(a)._theClass();
  1794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1795. $ctx2.sendIdx["theClass"]=1;
  1796. //>>excludeEnd("ctx");
  1797. $2=$recv($3)._name();
  1798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1799. $ctx2.sendIdx["name"]=1;
  1800. //>>excludeEnd("ctx");
  1801. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  1802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1803. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  1804. //>>excludeEnd("ctx");
  1805. }));
  1806. expandedClasses=$recv($globals.Array)._new();
  1807. $recv(nodes)._do_((function(aNode){
  1808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1809. return $core.withContext(function($ctx2) {
  1810. //>>excludeEnd("ctx");
  1811. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  1812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1813. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  1814. //>>excludeEnd("ctx");
  1815. }));
  1816. return expandedClasses;
  1817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1818. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  1819. //>>excludeEnd("ctx");
  1820. },
  1821. //>>excludeStart("ide", pragmas.excludeIdeData);
  1822. args: ["classes"],
  1823. 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",
  1824. referencedClasses: ["ClassSorterNode", "Array"],
  1825. //>>excludeEnd("ide");
  1826. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  1827. }),
  1828. $globals.Package.klass);
  1829. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  1830. //>>excludeStart("ide", pragmas.excludeIdeData);
  1831. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  1832. //>>excludeEnd("ide");
  1833. $core.addMethod(
  1834. $core.method({
  1835. selector: "announcer",
  1836. protocol: "accessing",
  1837. fn: function (){
  1838. var self=this;
  1839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1840. return $core.withContext(function($ctx1) {
  1841. //>>excludeEnd("ctx");
  1842. return $recv($globals.SystemAnnouncer)._current();
  1843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1844. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  1845. //>>excludeEnd("ctx");
  1846. },
  1847. //>>excludeStart("ide", pragmas.excludeIdeData);
  1848. args: [],
  1849. source: "announcer\x0a\x09^ SystemAnnouncer current",
  1850. referencedClasses: ["SystemAnnouncer"],
  1851. //>>excludeEnd("ide");
  1852. messageSends: ["current"]
  1853. }),
  1854. $globals.PackageStateObserver);
  1855. $core.addMethod(
  1856. $core.method({
  1857. selector: "observeSystem",
  1858. protocol: "actions",
  1859. fn: function (){
  1860. var self=this;
  1861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1862. return $core.withContext(function($ctx1) {
  1863. //>>excludeEnd("ctx");
  1864. var $1;
  1865. $1=self._announcer();
  1866. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  1867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1868. $ctx1.sendIdx["on:send:to:"]=1;
  1869. //>>excludeEnd("ctx");
  1870. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  1871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1872. $ctx1.sendIdx["on:send:to:"]=2;
  1873. //>>excludeEnd("ctx");
  1874. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  1875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1876. $ctx1.sendIdx["on:send:to:"]=3;
  1877. //>>excludeEnd("ctx");
  1878. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  1879. return self;
  1880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1881. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  1882. //>>excludeEnd("ctx");
  1883. },
  1884. //>>excludeStart("ide", pragmas.excludeIdeData);
  1885. args: [],
  1886. 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",
  1887. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  1888. //>>excludeEnd("ide");
  1889. messageSends: ["on:send:to:", "announcer"]
  1890. }),
  1891. $globals.PackageStateObserver);
  1892. $core.addMethod(
  1893. $core.method({
  1894. selector: "onClassModification:",
  1895. protocol: "reactions",
  1896. fn: function (anAnnouncement){
  1897. var self=this;
  1898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1899. return $core.withContext(function($ctx1) {
  1900. //>>excludeEnd("ctx");
  1901. var $1,$receiver;
  1902. $1=$recv(anAnnouncement)._theClass();
  1903. if(($receiver = $1) == null || $receiver.isNil){
  1904. $1;
  1905. } else {
  1906. var theClass;
  1907. theClass=$receiver;
  1908. $recv($recv(theClass)._package())._beDirty();
  1909. }
  1910. return self;
  1911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1912. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1913. //>>excludeEnd("ctx");
  1914. },
  1915. //>>excludeStart("ide", pragmas.excludeIdeData);
  1916. args: ["anAnnouncement"],
  1917. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  1918. referencedClasses: [],
  1919. //>>excludeEnd("ide");
  1920. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  1921. }),
  1922. $globals.PackageStateObserver);
  1923. $core.addMethod(
  1924. $core.method({
  1925. selector: "onMethodModification:",
  1926. protocol: "reactions",
  1927. fn: function (anAnnouncement){
  1928. var self=this;
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. return $core.withContext(function($ctx1) {
  1931. //>>excludeEnd("ctx");
  1932. var $1,$receiver;
  1933. $1=$recv($recv(anAnnouncement)._method())._package();
  1934. if(($receiver = $1) == null || $receiver.isNil){
  1935. $1;
  1936. } else {
  1937. var package_;
  1938. package_=$receiver;
  1939. $recv(package_)._beDirty();
  1940. }
  1941. return self;
  1942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1943. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1944. //>>excludeEnd("ctx");
  1945. },
  1946. //>>excludeStart("ide", pragmas.excludeIdeData);
  1947. args: ["anAnnouncement"],
  1948. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  1949. referencedClasses: [],
  1950. //>>excludeEnd("ide");
  1951. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  1952. }),
  1953. $globals.PackageStateObserver);
  1954. $core.addMethod(
  1955. $core.method({
  1956. selector: "onPackageAdded:",
  1957. protocol: "reactions",
  1958. fn: function (anAnnouncement){
  1959. var self=this;
  1960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1961. return $core.withContext(function($ctx1) {
  1962. //>>excludeEnd("ctx");
  1963. $recv($recv(anAnnouncement)._package())._beDirty();
  1964. return self;
  1965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1966. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1967. //>>excludeEnd("ctx");
  1968. },
  1969. //>>excludeStart("ide", pragmas.excludeIdeData);
  1970. args: ["anAnnouncement"],
  1971. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  1972. referencedClasses: [],
  1973. //>>excludeEnd("ide");
  1974. messageSends: ["beDirty", "package"]
  1975. }),
  1976. $globals.PackageStateObserver);
  1977. $core.addMethod(
  1978. $core.method({
  1979. selector: "onProtocolModification:",
  1980. protocol: "reactions",
  1981. fn: function (anAnnouncement){
  1982. var self=this;
  1983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1984. return $core.withContext(function($ctx1) {
  1985. //>>excludeEnd("ctx");
  1986. var $1,$receiver;
  1987. $1=$recv(anAnnouncement)._package();
  1988. if(($receiver = $1) == null || $receiver.isNil){
  1989. $1;
  1990. } else {
  1991. var package_;
  1992. package_=$receiver;
  1993. $recv(package_)._beDirty();
  1994. }
  1995. return self;
  1996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1997. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1998. //>>excludeEnd("ctx");
  1999. },
  2000. //>>excludeStart("ide", pragmas.excludeIdeData);
  2001. args: ["anAnnouncement"],
  2002. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  2003. referencedClasses: [],
  2004. //>>excludeEnd("ide");
  2005. messageSends: ["ifNotNil:", "package", "beDirty"]
  2006. }),
  2007. $globals.PackageStateObserver);
  2008. $globals.PackageStateObserver.klass.iVarNames = ["current"];
  2009. $core.addMethod(
  2010. $core.method({
  2011. selector: "current",
  2012. protocol: "accessing",
  2013. fn: function (){
  2014. var self=this;
  2015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2016. return $core.withContext(function($ctx1) {
  2017. //>>excludeEnd("ctx");
  2018. var $1,$receiver;
  2019. $1=self["@current"];
  2020. if(($receiver = $1) == null || $receiver.isNil){
  2021. self["@current"]=self._new();
  2022. return self["@current"];
  2023. } else {
  2024. return $1;
  2025. }
  2026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2027. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  2028. //>>excludeEnd("ctx");
  2029. },
  2030. //>>excludeStart("ide", pragmas.excludeIdeData);
  2031. args: [],
  2032. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  2033. referencedClasses: [],
  2034. //>>excludeEnd("ide");
  2035. messageSends: ["ifNil:", "new"]
  2036. }),
  2037. $globals.PackageStateObserver.klass);
  2038. $core.addMethod(
  2039. $core.method({
  2040. selector: "initialize",
  2041. protocol: "initialization",
  2042. fn: function (){
  2043. var self=this;
  2044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2045. return $core.withContext(function($ctx1) {
  2046. //>>excludeEnd("ctx");
  2047. $recv(self._current())._observeSystem();
  2048. return self;
  2049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2050. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  2051. //>>excludeEnd("ctx");
  2052. },
  2053. //>>excludeStart("ide", pragmas.excludeIdeData);
  2054. args: [],
  2055. source: "initialize\x0a\x09self current observeSystem",
  2056. referencedClasses: [],
  2057. //>>excludeEnd("ide");
  2058. messageSends: ["observeSystem", "current"]
  2059. }),
  2060. $globals.PackageStateObserver.klass);
  2061. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  2062. //>>excludeStart("ide", pragmas.excludeIdeData);
  2063. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  2064. //>>excludeEnd("ide");
  2065. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  2066. //>>excludeStart("ide", pragmas.excludeIdeData);
  2067. $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`";
  2068. //>>excludeEnd("ide");
  2069. $core.addMethod(
  2070. $core.method({
  2071. selector: "defaultValue",
  2072. protocol: "accessing",
  2073. fn: function (){
  2074. var self=this;
  2075. return self["@defaultValue"];
  2076. },
  2077. //>>excludeStart("ide", pragmas.excludeIdeData);
  2078. args: [],
  2079. source: "defaultValue\x0a\x09^ defaultValue",
  2080. referencedClasses: [],
  2081. //>>excludeEnd("ide");
  2082. messageSends: []
  2083. }),
  2084. $globals.Setting);
  2085. $core.addMethod(
  2086. $core.method({
  2087. selector: "defaultValue:",
  2088. protocol: "accessing",
  2089. fn: function (aStringifiableObject){
  2090. var self=this;
  2091. self["@defaultValue"]=aStringifiableObject;
  2092. return self;
  2093. },
  2094. //>>excludeStart("ide", pragmas.excludeIdeData);
  2095. args: ["aStringifiableObject"],
  2096. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  2097. referencedClasses: [],
  2098. //>>excludeEnd("ide");
  2099. messageSends: []
  2100. }),
  2101. $globals.Setting);
  2102. $core.addMethod(
  2103. $core.method({
  2104. selector: "key",
  2105. protocol: "accessing",
  2106. fn: function (){
  2107. var self=this;
  2108. return self["@key"];
  2109. },
  2110. //>>excludeStart("ide", pragmas.excludeIdeData);
  2111. args: [],
  2112. source: "key\x0a\x09^ key",
  2113. referencedClasses: [],
  2114. //>>excludeEnd("ide");
  2115. messageSends: []
  2116. }),
  2117. $globals.Setting);
  2118. $core.addMethod(
  2119. $core.method({
  2120. selector: "key:",
  2121. protocol: "accessing",
  2122. fn: function (aString){
  2123. var self=this;
  2124. self["@key"]=aString;
  2125. return self;
  2126. },
  2127. //>>excludeStart("ide", pragmas.excludeIdeData);
  2128. args: ["aString"],
  2129. source: "key: aString\x0a\x09key := aString",
  2130. referencedClasses: [],
  2131. //>>excludeEnd("ide");
  2132. messageSends: []
  2133. }),
  2134. $globals.Setting);
  2135. $core.addMethod(
  2136. $core.method({
  2137. selector: "value",
  2138. protocol: "accessing",
  2139. fn: function (){
  2140. var self=this;
  2141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2142. return $core.withContext(function($ctx1) {
  2143. //>>excludeEnd("ctx");
  2144. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  2145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2146. return $core.withContext(function($ctx2) {
  2147. //>>excludeEnd("ctx");
  2148. return self._defaultValue();
  2149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2151. //>>excludeEnd("ctx");
  2152. }));
  2153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2154. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  2155. //>>excludeEnd("ctx");
  2156. },
  2157. //>>excludeStart("ide", pragmas.excludeIdeData);
  2158. args: [],
  2159. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  2160. referencedClasses: ["Smalltalk"],
  2161. //>>excludeEnd("ide");
  2162. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  2163. }),
  2164. $globals.Setting);
  2165. $core.addMethod(
  2166. $core.method({
  2167. selector: "value:",
  2168. protocol: "accessing",
  2169. fn: function (aStringifiableObject){
  2170. var self=this;
  2171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2172. return $core.withContext(function($ctx1) {
  2173. //>>excludeEnd("ctx");
  2174. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  2175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2176. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  2177. //>>excludeEnd("ctx");
  2178. },
  2179. //>>excludeStart("ide", pragmas.excludeIdeData);
  2180. args: ["aStringifiableObject"],
  2181. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  2182. referencedClasses: ["Smalltalk"],
  2183. //>>excludeEnd("ide");
  2184. messageSends: ["at:put:", "settings", "key"]
  2185. }),
  2186. $globals.Setting);
  2187. $core.addMethod(
  2188. $core.method({
  2189. selector: "at:ifAbsent:",
  2190. protocol: "instance creation",
  2191. fn: function (aString,aDefaultValue){
  2192. var self=this;
  2193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2194. return $core.withContext(function($ctx1) {
  2195. //>>excludeEnd("ctx");
  2196. var $1;
  2197. $1=(
  2198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2199. $ctx1.supercall = true,
  2200. //>>excludeEnd("ctx");
  2201. ($globals.Setting.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  2202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2203. $ctx1.supercall = false;
  2204. //>>excludeEnd("ctx");;
  2205. $recv($1)._key_(aString);
  2206. $recv($1)._defaultValue_(aDefaultValue);
  2207. return $recv($1)._yourself();
  2208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2209. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  2210. //>>excludeEnd("ctx");
  2211. },
  2212. //>>excludeStart("ide", pragmas.excludeIdeData);
  2213. args: ["aString", "aDefaultValue"],
  2214. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  2215. referencedClasses: [],
  2216. //>>excludeEnd("ide");
  2217. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  2218. }),
  2219. $globals.Setting.klass);
  2220. $core.addMethod(
  2221. $core.method({
  2222. selector: "new",
  2223. protocol: "instance creation",
  2224. fn: function (){
  2225. var self=this;
  2226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2227. return $core.withContext(function($ctx1) {
  2228. //>>excludeEnd("ctx");
  2229. self._shouldNotImplement();
  2230. return self;
  2231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2232. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  2233. //>>excludeEnd("ctx");
  2234. },
  2235. //>>excludeStart("ide", pragmas.excludeIdeData);
  2236. args: [],
  2237. source: "new\x0a\x09self shouldNotImplement",
  2238. referencedClasses: [],
  2239. //>>excludeEnd("ide");
  2240. messageSends: ["shouldNotImplement"]
  2241. }),
  2242. $globals.Setting.klass);
  2243. $core.addClass("SmalltalkImage", $globals.Object, [], "Kernel-Infrastructure");
  2244. //>>excludeStart("ide", pragmas.excludeIdeData);
  2245. $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.";
  2246. //>>excludeEnd("ide");
  2247. $core.addMethod(
  2248. $core.method({
  2249. selector: "addGlobalJsVariable:",
  2250. protocol: "globals",
  2251. fn: function (aString){
  2252. var self=this;
  2253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2254. return $core.withContext(function($ctx1) {
  2255. //>>excludeEnd("ctx");
  2256. $recv(self._globalJsVariables())._add_(aString);
  2257. return self;
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2260. //>>excludeEnd("ctx");
  2261. },
  2262. //>>excludeStart("ide", pragmas.excludeIdeData);
  2263. args: ["aString"],
  2264. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  2265. referencedClasses: [],
  2266. //>>excludeEnd("ide");
  2267. messageSends: ["add:", "globalJsVariables"]
  2268. }),
  2269. $globals.SmalltalkImage);
  2270. $core.addMethod(
  2271. $core.method({
  2272. selector: "amdRequire",
  2273. protocol: "accessing amd",
  2274. fn: function (){
  2275. var self=this;
  2276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2277. return $core.withContext(function($ctx1) {
  2278. //>>excludeEnd("ctx");
  2279. return $recv(self._core())._at_("amdRequire");
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  2282. //>>excludeEnd("ctx");
  2283. },
  2284. //>>excludeStart("ide", pragmas.excludeIdeData);
  2285. args: [],
  2286. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  2287. referencedClasses: [],
  2288. //>>excludeEnd("ide");
  2289. messageSends: ["at:", "core"]
  2290. }),
  2291. $globals.SmalltalkImage);
  2292. $core.addMethod(
  2293. $core.method({
  2294. selector: "asSmalltalkException:",
  2295. protocol: "error handling",
  2296. fn: function (anObject){
  2297. var self=this;
  2298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2299. return $core.withContext(function($ctx1) {
  2300. //>>excludeEnd("ctx");
  2301. var $1;
  2302. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  2303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2304. return $core.withContext(function($ctx2) {
  2305. //>>excludeEnd("ctx");
  2306. return $recv(anObject)._isKindOf_($globals.Error);
  2307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2309. //>>excludeEnd("ctx");
  2310. }));
  2311. if($core.assert($1)){
  2312. return anObject;
  2313. } else {
  2314. return $recv($globals.JavaScriptException)._on_(anObject);
  2315. }
  2316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2317. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  2318. //>>excludeEnd("ctx");
  2319. },
  2320. //>>excludeStart("ide", pragmas.excludeIdeData);
  2321. args: ["anObject"],
  2322. 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 ]",
  2323. referencedClasses: ["Error", "JavaScriptException"],
  2324. //>>excludeEnd("ide");
  2325. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  2326. }),
  2327. $globals.SmalltalkImage);
  2328. $core.addMethod(
  2329. $core.method({
  2330. selector: "basicCreatePackage:",
  2331. protocol: "private",
  2332. fn: function (packageName){
  2333. var self=this;
  2334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2335. return $core.withContext(function($ctx1) {
  2336. //>>excludeEnd("ctx");
  2337. return $core.addPackage(packageName);
  2338. return self;
  2339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2340. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  2341. //>>excludeEnd("ctx");
  2342. },
  2343. //>>excludeStart("ide", pragmas.excludeIdeData);
  2344. args: ["packageName"],
  2345. 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)'>",
  2346. referencedClasses: [],
  2347. //>>excludeEnd("ide");
  2348. messageSends: []
  2349. }),
  2350. $globals.SmalltalkImage);
  2351. $core.addMethod(
  2352. $core.method({
  2353. selector: "basicParse:",
  2354. protocol: "private",
  2355. fn: function (aString){
  2356. var self=this;
  2357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2358. return $core.withContext(function($ctx1) {
  2359. //>>excludeEnd("ctx");
  2360. return $recv($globals.SmalltalkParser)._parse_(aString);
  2361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2362. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  2363. //>>excludeEnd("ctx");
  2364. },
  2365. //>>excludeStart("ide", pragmas.excludeIdeData);
  2366. args: ["aString"],
  2367. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  2368. referencedClasses: ["SmalltalkParser"],
  2369. //>>excludeEnd("ide");
  2370. messageSends: ["parse:"]
  2371. }),
  2372. $globals.SmalltalkImage);
  2373. $core.addMethod(
  2374. $core.method({
  2375. selector: "basicRegisterPackage:",
  2376. protocol: "private",
  2377. fn: function (aPackage){
  2378. var self=this;
  2379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2380. return $core.withContext(function($ctx1) {
  2381. //>>excludeEnd("ctx");
  2382. $core.packages[aPackage.pkgName]=aPackage;
  2383. return self;
  2384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2385. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  2386. //>>excludeEnd("ctx");
  2387. },
  2388. //>>excludeStart("ide", pragmas.excludeIdeData);
  2389. args: ["aPackage"],
  2390. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<inlineJS: '$core.packages[aPackage.pkgName]=aPackage'>",
  2391. referencedClasses: [],
  2392. //>>excludeEnd("ide");
  2393. messageSends: []
  2394. }),
  2395. $globals.SmalltalkImage);
  2396. $core.addMethod(
  2397. $core.method({
  2398. selector: "cancelOptOut:",
  2399. protocol: "accessing",
  2400. fn: function (anObject){
  2401. var self=this;
  2402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2403. return $core.withContext(function($ctx1) {
  2404. //>>excludeEnd("ctx");
  2405. delete anObject.klass;
  2406. return self;
  2407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2408. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  2409. //>>excludeEnd("ctx");
  2410. },
  2411. //>>excludeStart("ide", pragmas.excludeIdeData);
  2412. args: ["anObject"],
  2413. 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'>",
  2414. referencedClasses: [],
  2415. //>>excludeEnd("ide");
  2416. messageSends: []
  2417. }),
  2418. $globals.SmalltalkImage);
  2419. $core.addMethod(
  2420. $core.method({
  2421. selector: "classes",
  2422. protocol: "classes",
  2423. fn: function (){
  2424. var self=this;
  2425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2426. return $core.withContext(function($ctx1) {
  2427. //>>excludeEnd("ctx");
  2428. return $core.classes();
  2429. return self;
  2430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2431. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  2432. //>>excludeEnd("ctx");
  2433. },
  2434. //>>excludeStart("ide", pragmas.excludeIdeData);
  2435. args: [],
  2436. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  2437. referencedClasses: [],
  2438. //>>excludeEnd("ide");
  2439. messageSends: []
  2440. }),
  2441. $globals.SmalltalkImage);
  2442. $core.addMethod(
  2443. $core.method({
  2444. selector: "core",
  2445. protocol: "accessing",
  2446. fn: function (){
  2447. var self=this;
  2448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2449. return $core.withContext(function($ctx1) {
  2450. //>>excludeEnd("ctx");
  2451. return $core;
  2452. return self;
  2453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2454. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  2455. //>>excludeEnd("ctx");
  2456. },
  2457. //>>excludeStart("ide", pragmas.excludeIdeData);
  2458. args: [],
  2459. source: "core\x0a\x09<inlineJS: 'return $core'>",
  2460. referencedClasses: [],
  2461. //>>excludeEnd("ide");
  2462. messageSends: []
  2463. }),
  2464. $globals.SmalltalkImage);
  2465. $core.addMethod(
  2466. $core.method({
  2467. selector: "createPackage:",
  2468. protocol: "packages",
  2469. fn: function (packageName){
  2470. var self=this;
  2471. var package_,announcement;
  2472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2473. return $core.withContext(function($ctx1) {
  2474. //>>excludeEnd("ctx");
  2475. var $1;
  2476. package_=self._basicCreatePackage_(packageName);
  2477. $1=$recv($globals.PackageAdded)._new();
  2478. $recv($1)._package_(package_);
  2479. announcement=$recv($1)._yourself();
  2480. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  2481. return package_;
  2482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2483. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  2484. //>>excludeEnd("ctx");
  2485. },
  2486. //>>excludeStart("ide", pragmas.excludeIdeData);
  2487. args: ["packageName"],
  2488. 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",
  2489. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  2490. //>>excludeEnd("ide");
  2491. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  2492. }),
  2493. $globals.SmalltalkImage);
  2494. $core.addMethod(
  2495. $core.method({
  2496. selector: "defaultAmdNamespace",
  2497. protocol: "accessing amd",
  2498. fn: function (){
  2499. var self=this;
  2500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2501. return $core.withContext(function($ctx1) {
  2502. //>>excludeEnd("ctx");
  2503. return "transport.defaultAmdNamespace"._settingValue();
  2504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2505. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  2506. //>>excludeEnd("ctx");
  2507. },
  2508. //>>excludeStart("ide", pragmas.excludeIdeData);
  2509. args: [],
  2510. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  2511. referencedClasses: [],
  2512. //>>excludeEnd("ide");
  2513. messageSends: ["settingValue"]
  2514. }),
  2515. $globals.SmalltalkImage);
  2516. $core.addMethod(
  2517. $core.method({
  2518. selector: "defaultAmdNamespace:",
  2519. protocol: "accessing amd",
  2520. fn: function (aString){
  2521. var self=this;
  2522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2523. return $core.withContext(function($ctx1) {
  2524. //>>excludeEnd("ctx");
  2525. "transport.defaultAmdNamespace"._settingValue_(aString);
  2526. return self;
  2527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2528. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  2529. //>>excludeEnd("ctx");
  2530. },
  2531. //>>excludeStart("ide", pragmas.excludeIdeData);
  2532. args: ["aString"],
  2533. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  2534. referencedClasses: [],
  2535. //>>excludeEnd("ide");
  2536. messageSends: ["settingValue:"]
  2537. }),
  2538. $globals.SmalltalkImage);
  2539. $core.addMethod(
  2540. $core.method({
  2541. selector: "deleteClass:",
  2542. protocol: "private",
  2543. fn: function (aClass){
  2544. var self=this;
  2545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2546. return $core.withContext(function($ctx1) {
  2547. //>>excludeEnd("ctx");
  2548. $core.removeClass(aClass);
  2549. return self;
  2550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2551. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  2552. //>>excludeEnd("ctx");
  2553. },
  2554. //>>excludeStart("ide", pragmas.excludeIdeData);
  2555. args: ["aClass"],
  2556. 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)'>",
  2557. referencedClasses: [],
  2558. //>>excludeEnd("ide");
  2559. messageSends: []
  2560. }),
  2561. $globals.SmalltalkImage);
  2562. $core.addMethod(
  2563. $core.method({
  2564. selector: "deleteGlobalJsVariable:",
  2565. protocol: "globals",
  2566. fn: function (aString){
  2567. var self=this;
  2568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2569. return $core.withContext(function($ctx1) {
  2570. //>>excludeEnd("ctx");
  2571. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  2572. }));
  2573. return self;
  2574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2575. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2576. //>>excludeEnd("ctx");
  2577. },
  2578. //>>excludeStart("ide", pragmas.excludeIdeData);
  2579. args: ["aString"],
  2580. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  2581. referencedClasses: [],
  2582. //>>excludeEnd("ide");
  2583. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  2584. }),
  2585. $globals.SmalltalkImage);
  2586. $core.addMethod(
  2587. $core.method({
  2588. selector: "deletePackage:",
  2589. protocol: "private",
  2590. fn: function (packageName){
  2591. var self=this;
  2592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2593. return $core.withContext(function($ctx1) {
  2594. //>>excludeEnd("ctx");
  2595. delete $core.packages[packageName];
  2596. return self;
  2597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2598. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  2599. //>>excludeEnd("ctx");
  2600. },
  2601. //>>excludeStart("ide", pragmas.excludeIdeData);
  2602. args: ["packageName"],
  2603. 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]'>",
  2604. referencedClasses: [],
  2605. //>>excludeEnd("ide");
  2606. messageSends: []
  2607. }),
  2608. $globals.SmalltalkImage);
  2609. $core.addMethod(
  2610. $core.method({
  2611. selector: "existsJsGlobal:",
  2612. protocol: "testing",
  2613. fn: function (aString){
  2614. var self=this;
  2615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2616. return $core.withContext(function($ctx1) {
  2617. //>>excludeEnd("ctx");
  2618. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  2619. return true;
  2620. }),(function(){
  2621. return false;
  2622. }));
  2623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2624. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  2625. //>>excludeEnd("ctx");
  2626. },
  2627. //>>excludeStart("ide", pragmas.excludeIdeData);
  2628. args: ["aString"],
  2629. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  2630. referencedClasses: ["Platform"],
  2631. //>>excludeEnd("ide");
  2632. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  2633. }),
  2634. $globals.SmalltalkImage);
  2635. $core.addMethod(
  2636. $core.method({
  2637. selector: "globalJsVariables",
  2638. protocol: "globals",
  2639. fn: function (){
  2640. var self=this;
  2641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2642. return $core.withContext(function($ctx1) {
  2643. //>>excludeEnd("ctx");
  2644. return $core.globalJsVariables;
  2645. return self;
  2646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2647. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  2648. //>>excludeEnd("ctx");
  2649. },
  2650. //>>excludeStart("ide", pragmas.excludeIdeData);
  2651. args: [],
  2652. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<inlineJS: 'return $core.globalJsVariables'>",
  2653. referencedClasses: [],
  2654. //>>excludeEnd("ide");
  2655. messageSends: []
  2656. }),
  2657. $globals.SmalltalkImage);
  2658. $core.addMethod(
  2659. $core.method({
  2660. selector: "globals",
  2661. protocol: "accessing",
  2662. fn: function (){
  2663. var self=this;
  2664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2665. return $core.withContext(function($ctx1) {
  2666. //>>excludeEnd("ctx");
  2667. return $globals;
  2668. return self;
  2669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2670. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  2671. //>>excludeEnd("ctx");
  2672. },
  2673. //>>excludeStart("ide", pragmas.excludeIdeData);
  2674. args: [],
  2675. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  2676. referencedClasses: [],
  2677. //>>excludeEnd("ide");
  2678. messageSends: []
  2679. }),
  2680. $globals.SmalltalkImage);
  2681. $core.addMethod(
  2682. $core.method({
  2683. selector: "includesKey:",
  2684. protocol: "accessing",
  2685. fn: function (aKey){
  2686. var self=this;
  2687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2688. return $core.withContext(function($ctx1) {
  2689. //>>excludeEnd("ctx");
  2690. return $core.hasOwnProperty(aKey);
  2691. return self;
  2692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2693. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  2694. //>>excludeEnd("ctx");
  2695. },
  2696. //>>excludeStart("ide", pragmas.excludeIdeData);
  2697. args: ["aKey"],
  2698. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  2699. referencedClasses: [],
  2700. //>>excludeEnd("ide");
  2701. messageSends: []
  2702. }),
  2703. $globals.SmalltalkImage);
  2704. $core.addMethod(
  2705. $core.method({
  2706. selector: "isSmalltalkObject:",
  2707. protocol: "testing",
  2708. fn: function (anObject){
  2709. var self=this;
  2710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2711. return $core.withContext(function($ctx1) {
  2712. //>>excludeEnd("ctx");
  2713. return anObject.klass != null;
  2714. return self;
  2715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2716. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  2717. //>>excludeEnd("ctx");
  2718. },
  2719. //>>excludeStart("ide", pragmas.excludeIdeData);
  2720. args: ["anObject"],
  2721. 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'>",
  2722. referencedClasses: [],
  2723. //>>excludeEnd("ide");
  2724. messageSends: []
  2725. }),
  2726. $globals.SmalltalkImage);
  2727. $core.addMethod(
  2728. $core.method({
  2729. selector: "optOut:",
  2730. protocol: "accessing",
  2731. fn: function (anObject){
  2732. var self=this;
  2733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2734. return $core.withContext(function($ctx1) {
  2735. //>>excludeEnd("ctx");
  2736. anObject.klass = null;
  2737. return self;
  2738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2739. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  2740. //>>excludeEnd("ctx");
  2741. },
  2742. //>>excludeStart("ide", pragmas.excludeIdeData);
  2743. args: ["anObject"],
  2744. 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'>",
  2745. referencedClasses: [],
  2746. //>>excludeEnd("ide");
  2747. messageSends: []
  2748. }),
  2749. $globals.SmalltalkImage);
  2750. $core.addMethod(
  2751. $core.method({
  2752. selector: "packageAt:",
  2753. protocol: "packages",
  2754. fn: function (packageName){
  2755. var self=this;
  2756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2757. return $core.withContext(function($ctx1) {
  2758. //>>excludeEnd("ctx");
  2759. return $core.packages[packageName];
  2760. return self;
  2761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2762. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  2763. //>>excludeEnd("ctx");
  2764. },
  2765. //>>excludeStart("ide", pragmas.excludeIdeData);
  2766. args: ["packageName"],
  2767. source: "packageAt: packageName\x0a\x09<inlineJS: 'return $core.packages[packageName]'>",
  2768. referencedClasses: [],
  2769. //>>excludeEnd("ide");
  2770. messageSends: []
  2771. }),
  2772. $globals.SmalltalkImage);
  2773. $core.addMethod(
  2774. $core.method({
  2775. selector: "packageAt:ifAbsent:",
  2776. protocol: "packages",
  2777. fn: function (packageName,aBlock){
  2778. var self=this;
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. return $core.withContext(function($ctx1) {
  2781. //>>excludeEnd("ctx");
  2782. var $1;
  2783. $1=self._packageAt_(packageName);
  2784. return $recv($1)._ifNil_(aBlock);
  2785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2786. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  2787. //>>excludeEnd("ctx");
  2788. },
  2789. //>>excludeStart("ide", pragmas.excludeIdeData);
  2790. args: ["packageName", "aBlock"],
  2791. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  2792. referencedClasses: [],
  2793. //>>excludeEnd("ide");
  2794. messageSends: ["ifNil:", "packageAt:"]
  2795. }),
  2796. $globals.SmalltalkImage);
  2797. $core.addMethod(
  2798. $core.method({
  2799. selector: "packages",
  2800. protocol: "packages",
  2801. fn: function (){
  2802. var self=this;
  2803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2804. return $core.withContext(function($ctx1) {
  2805. //>>excludeEnd("ctx");
  2806. return Object.keys($core.packages).map(function(k) {
  2807. return $core.packages[k];
  2808. })
  2809. ;
  2810. return self;
  2811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2812. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  2813. //>>excludeEnd("ctx");
  2814. },
  2815. //>>excludeStart("ide", pragmas.excludeIdeData);
  2816. args: [],
  2817. 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'>",
  2818. referencedClasses: [],
  2819. //>>excludeEnd("ide");
  2820. messageSends: []
  2821. }),
  2822. $globals.SmalltalkImage);
  2823. $core.addMethod(
  2824. $core.method({
  2825. selector: "parse:",
  2826. protocol: "accessing",
  2827. fn: function (aString){
  2828. var self=this;
  2829. var result;
  2830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2831. return $core.withContext(function($ctx1) {
  2832. //>>excludeEnd("ctx");
  2833. var $1;
  2834. $recv((function(){
  2835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2836. return $core.withContext(function($ctx2) {
  2837. //>>excludeEnd("ctx");
  2838. result=self._basicParse_(aString);
  2839. return result;
  2840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2842. //>>excludeEnd("ctx");
  2843. }))._tryCatch_((function(ex){
  2844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2845. return $core.withContext(function($ctx2) {
  2846. //>>excludeEnd("ctx");
  2847. return $recv(self._parseError_parsing_(ex,aString))._signal();
  2848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2849. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  2850. //>>excludeEnd("ctx");
  2851. }));
  2852. $1=result;
  2853. $recv($1)._source_(aString);
  2854. return $recv($1)._yourself();
  2855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2856. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  2857. //>>excludeEnd("ctx");
  2858. },
  2859. //>>excludeStart("ide", pragmas.excludeIdeData);
  2860. args: ["aString"],
  2861. 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",
  2862. referencedClasses: [],
  2863. //>>excludeEnd("ide");
  2864. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  2865. }),
  2866. $globals.SmalltalkImage);
  2867. $core.addMethod(
  2868. $core.method({
  2869. selector: "parseError:parsing:",
  2870. protocol: "error handling",
  2871. fn: function (anException,aString){
  2872. var self=this;
  2873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2874. return $core.withContext(function($ctx1) {
  2875. //>>excludeEnd("ctx");
  2876. var $1,$7,$6,$5,$8,$4,$3,$2;
  2877. $1=$recv($globals.ParseError)._new();
  2878. $7=$recv(anException)._basicAt_("line");
  2879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2880. $ctx1.sendIdx["basicAt:"]=1;
  2881. //>>excludeEnd("ctx");
  2882. $6="Parse error on line ".__comma($7);
  2883. $5=$recv($6).__comma(" column ");
  2884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2885. $ctx1.sendIdx[","]=4;
  2886. //>>excludeEnd("ctx");
  2887. $8=$recv(anException)._basicAt_("column");
  2888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2889. $ctx1.sendIdx["basicAt:"]=2;
  2890. //>>excludeEnd("ctx");
  2891. $4=$recv($5).__comma($8);
  2892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2893. $ctx1.sendIdx[","]=3;
  2894. //>>excludeEnd("ctx");
  2895. $3=$recv($4).__comma(" : Unexpected character ");
  2896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2897. $ctx1.sendIdx[","]=2;
  2898. //>>excludeEnd("ctx");
  2899. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  2900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2901. $ctx1.sendIdx[","]=1;
  2902. //>>excludeEnd("ctx");
  2903. return $recv($1)._messageText_($2);
  2904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2905. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  2906. //>>excludeEnd("ctx");
  2907. },
  2908. //>>excludeStart("ide", pragmas.excludeIdeData);
  2909. args: ["anException", "aString"],
  2910. 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')",
  2911. referencedClasses: ["ParseError"],
  2912. //>>excludeEnd("ide");
  2913. messageSends: ["messageText:", "new", ",", "basicAt:"]
  2914. }),
  2915. $globals.SmalltalkImage);
  2916. $core.addMethod(
  2917. $core.method({
  2918. selector: "pseudoVariableNames",
  2919. protocol: "accessing",
  2920. fn: function (){
  2921. var self=this;
  2922. return ["self", "super", "nil", "true", "false", "thisContext"];
  2923. },
  2924. //>>excludeStart("ide", pragmas.excludeIdeData);
  2925. args: [],
  2926. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  2927. referencedClasses: [],
  2928. //>>excludeEnd("ide");
  2929. messageSends: []
  2930. }),
  2931. $globals.SmalltalkImage);
  2932. $core.addMethod(
  2933. $core.method({
  2934. selector: "readJSObject:",
  2935. protocol: "accessing",
  2936. fn: function (anObject){
  2937. var self=this;
  2938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2939. return $core.withContext(function($ctx1) {
  2940. //>>excludeEnd("ctx");
  2941. return $core.readJSObject(anObject);
  2942. return self;
  2943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2944. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  2945. //>>excludeEnd("ctx");
  2946. },
  2947. //>>excludeStart("ide", pragmas.excludeIdeData);
  2948. args: ["anObject"],
  2949. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  2950. referencedClasses: [],
  2951. //>>excludeEnd("ide");
  2952. messageSends: []
  2953. }),
  2954. $globals.SmalltalkImage);
  2955. $core.addMethod(
  2956. $core.method({
  2957. selector: "removeClass:",
  2958. protocol: "classes",
  2959. fn: function (aClass){
  2960. var self=this;
  2961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2962. return $core.withContext(function($ctx1) {
  2963. //>>excludeEnd("ctx");
  2964. var $1,$2,$4,$3;
  2965. $1=$recv(aClass)._isMetaclass();
  2966. if($core.assert($1)){
  2967. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  2968. }
  2969. self._deleteClass_(aClass);
  2970. $2=$recv($globals.SystemAnnouncer)._current();
  2971. $4=$recv($globals.ClassRemoved)._new();
  2972. $recv($4)._theClass_(aClass);
  2973. $3=$recv($4)._yourself();
  2974. $recv($2)._announce_($3);
  2975. return self;
  2976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2977. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  2978. //>>excludeEnd("ctx");
  2979. },
  2980. //>>excludeStart("ide", pragmas.excludeIdeData);
  2981. args: ["aClass"],
  2982. 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)",
  2983. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  2984. //>>excludeEnd("ide");
  2985. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  2986. }),
  2987. $globals.SmalltalkImage);
  2988. $core.addMethod(
  2989. $core.method({
  2990. selector: "removePackage:",
  2991. protocol: "packages",
  2992. fn: function (packageName){
  2993. var self=this;
  2994. var pkg;
  2995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2996. return $core.withContext(function($ctx1) {
  2997. //>>excludeEnd("ctx");
  2998. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  2999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3000. return $core.withContext(function($ctx2) {
  3001. //>>excludeEnd("ctx");
  3002. return self._error_("Missing package: ".__comma(packageName));
  3003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3005. //>>excludeEnd("ctx");
  3006. }));
  3007. $recv($recv(pkg)._classes())._do_((function(each){
  3008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3009. return $core.withContext(function($ctx2) {
  3010. //>>excludeEnd("ctx");
  3011. return self._removeClass_(each);
  3012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3014. //>>excludeEnd("ctx");
  3015. }));
  3016. self._deletePackage_(packageName);
  3017. return self;
  3018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3019. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  3020. //>>excludeEnd("ctx");
  3021. },
  3022. //>>excludeStart("ide", pragmas.excludeIdeData);
  3023. args: ["packageName"],
  3024. 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",
  3025. referencedClasses: [],
  3026. //>>excludeEnd("ide");
  3027. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  3028. }),
  3029. $globals.SmalltalkImage);
  3030. $core.addMethod(
  3031. $core.method({
  3032. selector: "renamePackage:to:",
  3033. protocol: "packages",
  3034. fn: function (packageName,newName){
  3035. var self=this;
  3036. var pkg;
  3037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3038. return $core.withContext(function($ctx1) {
  3039. //>>excludeEnd("ctx");
  3040. var $1,$2,$receiver;
  3041. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  3042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3043. return $core.withContext(function($ctx2) {
  3044. //>>excludeEnd("ctx");
  3045. $1="Missing package: ".__comma(packageName);
  3046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3047. $ctx2.sendIdx[","]=1;
  3048. //>>excludeEnd("ctx");
  3049. return self._error_($1);
  3050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3051. $ctx2.sendIdx["error:"]=1;
  3052. //>>excludeEnd("ctx");
  3053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3055. //>>excludeEnd("ctx");
  3056. }));
  3057. $2=self._packageAt_(newName);
  3058. if(($receiver = $2) == null || $receiver.isNil){
  3059. $2;
  3060. } else {
  3061. self._error_("Already exists a package called: ".__comma(newName));
  3062. }
  3063. $recv(pkg)._name_(newName);
  3064. self._basicRegisterPackage_(pkg);
  3065. self._deletePackage_(packageName);
  3066. return self;
  3067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3068. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  3069. //>>excludeEnd("ctx");
  3070. },
  3071. //>>excludeStart("ide", pragmas.excludeIdeData);
  3072. args: ["packageName", "newName"],
  3073. 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.",
  3074. referencedClasses: [],
  3075. //>>excludeEnd("ide");
  3076. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  3077. }),
  3078. $globals.SmalltalkImage);
  3079. $core.addMethod(
  3080. $core.method({
  3081. selector: "reservedWords",
  3082. protocol: "accessing",
  3083. fn: function (){
  3084. var self=this;
  3085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3086. return $core.withContext(function($ctx1) {
  3087. //>>excludeEnd("ctx");
  3088. return $core.reservedWords;
  3089. return self;
  3090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3091. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  3092. //>>excludeEnd("ctx");
  3093. },
  3094. //>>excludeStart("ide", pragmas.excludeIdeData);
  3095. args: [],
  3096. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<inlineJS: 'return $core.reservedWords'>",
  3097. referencedClasses: [],
  3098. //>>excludeEnd("ide");
  3099. messageSends: []
  3100. }),
  3101. $globals.SmalltalkImage);
  3102. $core.addMethod(
  3103. $core.method({
  3104. selector: "settings",
  3105. protocol: "accessing",
  3106. fn: function (){
  3107. var self=this;
  3108. return $globals.SmalltalkSettings;
  3109. },
  3110. //>>excludeStart("ide", pragmas.excludeIdeData);
  3111. args: [],
  3112. source: "settings\x0a\x09^ SmalltalkSettings",
  3113. referencedClasses: ["SmalltalkSettings"],
  3114. //>>excludeEnd("ide");
  3115. messageSends: []
  3116. }),
  3117. $globals.SmalltalkImage);
  3118. $core.addMethod(
  3119. $core.method({
  3120. selector: "version",
  3121. protocol: "accessing",
  3122. fn: function (){
  3123. var self=this;
  3124. return "0.19.0-pre";
  3125. },
  3126. //>>excludeStart("ide", pragmas.excludeIdeData);
  3127. args: [],
  3128. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.19.0-pre'",
  3129. referencedClasses: [],
  3130. //>>excludeEnd("ide");
  3131. messageSends: []
  3132. }),
  3133. $globals.SmalltalkImage);
  3134. $globals.SmalltalkImage.klass.iVarNames = ["current"];
  3135. $core.addMethod(
  3136. $core.method({
  3137. selector: "current",
  3138. protocol: "instance creation",
  3139. fn: function (){
  3140. var self=this;
  3141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3142. return $core.withContext(function($ctx1) {
  3143. //>>excludeEnd("ctx");
  3144. var $1,$receiver;
  3145. $1=self["@current"];
  3146. if(($receiver = $1) == null || $receiver.isNil){
  3147. self["@current"]=(
  3148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3149. $ctx1.supercall = true,
  3150. //>>excludeEnd("ctx");
  3151. ($globals.SmalltalkImage.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  3152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3153. $ctx1.supercall = false;
  3154. //>>excludeEnd("ctx");;
  3155. return self["@current"];
  3156. } else {
  3157. self._deprecatedAPI();
  3158. return self["@current"];
  3159. }
  3160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3161. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  3162. //>>excludeEnd("ctx");
  3163. },
  3164. //>>excludeStart("ide", pragmas.excludeIdeData);
  3165. args: [],
  3166. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  3167. referencedClasses: [],
  3168. //>>excludeEnd("ide");
  3169. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  3170. }),
  3171. $globals.SmalltalkImage.klass);
  3172. $core.addMethod(
  3173. $core.method({
  3174. selector: "initialize",
  3175. protocol: "initialization",
  3176. fn: function (){
  3177. var self=this;
  3178. var st;
  3179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3180. return $core.withContext(function($ctx1) {
  3181. //>>excludeEnd("ctx");
  3182. st=self._current();
  3183. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  3184. return self;
  3185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3186. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  3187. //>>excludeEnd("ctx");
  3188. },
  3189. //>>excludeStart("ide", pragmas.excludeIdeData);
  3190. args: [],
  3191. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  3192. referencedClasses: [],
  3193. //>>excludeEnd("ide");
  3194. messageSends: ["current", "at:put:", "globals"]
  3195. }),
  3196. $globals.SmalltalkImage.klass);
  3197. $core.addMethod(
  3198. $core.method({
  3199. selector: "new",
  3200. protocol: "instance creation",
  3201. fn: function (){
  3202. var self=this;
  3203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3204. return $core.withContext(function($ctx1) {
  3205. //>>excludeEnd("ctx");
  3206. self._shouldNotImplement();
  3207. return self;
  3208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3209. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  3210. //>>excludeEnd("ctx");
  3211. },
  3212. //>>excludeStart("ide", pragmas.excludeIdeData);
  3213. args: [],
  3214. source: "new\x0a\x09self shouldNotImplement",
  3215. referencedClasses: [],
  3216. //>>excludeEnd("ide");
  3217. messageSends: ["shouldNotImplement"]
  3218. }),
  3219. $globals.SmalltalkImage.klass);
  3220. $core.addMethod(
  3221. $core.method({
  3222. selector: "asJavaScriptPropertyName",
  3223. protocol: "*Kernel-Infrastructure",
  3224. fn: function (){
  3225. var self=this;
  3226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3227. return $core.withContext(function($ctx1) {
  3228. //>>excludeEnd("ctx");
  3229. return $core.st2prop(self);
  3230. return self;
  3231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3232. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  3233. //>>excludeEnd("ctx");
  3234. },
  3235. //>>excludeStart("ide", pragmas.excludeIdeData);
  3236. args: [],
  3237. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  3238. referencedClasses: [],
  3239. //>>excludeEnd("ide");
  3240. messageSends: []
  3241. }),
  3242. $globals.String);
  3243. $core.addMethod(
  3244. $core.method({
  3245. selector: "asSetting",
  3246. protocol: "*Kernel-Infrastructure",
  3247. fn: function (){
  3248. var self=this;
  3249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3250. return $core.withContext(function($ctx1) {
  3251. //>>excludeEnd("ctx");
  3252. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  3253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3254. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  3255. //>>excludeEnd("ctx");
  3256. },
  3257. //>>excludeStart("ide", pragmas.excludeIdeData);
  3258. args: [],
  3259. 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",
  3260. referencedClasses: ["Setting"],
  3261. //>>excludeEnd("ide");
  3262. messageSends: ["at:ifAbsent:"]
  3263. }),
  3264. $globals.String);
  3265. $core.addMethod(
  3266. $core.method({
  3267. selector: "asSettingIfAbsent:",
  3268. protocol: "*Kernel-Infrastructure",
  3269. fn: function (aDefaultValue){
  3270. var self=this;
  3271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3272. return $core.withContext(function($ctx1) {
  3273. //>>excludeEnd("ctx");
  3274. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  3275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3276. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  3277. //>>excludeEnd("ctx");
  3278. },
  3279. //>>excludeStart("ide", pragmas.excludeIdeData);
  3280. args: ["aDefaultValue"],
  3281. 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",
  3282. referencedClasses: ["Setting"],
  3283. //>>excludeEnd("ide");
  3284. messageSends: ["at:ifAbsent:"]
  3285. }),
  3286. $globals.String);
  3287. $core.addMethod(
  3288. $core.method({
  3289. selector: "settingValue",
  3290. protocol: "*Kernel-Infrastructure",
  3291. fn: function (){
  3292. var self=this;
  3293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3294. return $core.withContext(function($ctx1) {
  3295. //>>excludeEnd("ctx");
  3296. return $recv(self._asSetting())._value();
  3297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3298. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  3299. //>>excludeEnd("ctx");
  3300. },
  3301. //>>excludeStart("ide", pragmas.excludeIdeData);
  3302. args: [],
  3303. source: "settingValue\x0a\x09^ self asSetting value",
  3304. referencedClasses: [],
  3305. //>>excludeEnd("ide");
  3306. messageSends: ["value", "asSetting"]
  3307. }),
  3308. $globals.String);
  3309. $core.addMethod(
  3310. $core.method({
  3311. selector: "settingValue:",
  3312. protocol: "*Kernel-Infrastructure",
  3313. fn: function (aValue){
  3314. var self=this;
  3315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3316. return $core.withContext(function($ctx1) {
  3317. //>>excludeEnd("ctx");
  3318. return $recv(self._asSetting())._value_(aValue);
  3319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3320. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  3321. //>>excludeEnd("ctx");
  3322. },
  3323. //>>excludeStart("ide", pragmas.excludeIdeData);
  3324. args: ["aValue"],
  3325. 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",
  3326. referencedClasses: [],
  3327. //>>excludeEnd("ide");
  3328. messageSends: ["value:", "asSetting"]
  3329. }),
  3330. $globals.String);
  3331. $core.addMethod(
  3332. $core.method({
  3333. selector: "settingValueIfAbsent:",
  3334. protocol: "*Kernel-Infrastructure",
  3335. fn: function (aDefaultValue){
  3336. var self=this;
  3337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3338. return $core.withContext(function($ctx1) {
  3339. //>>excludeEnd("ctx");
  3340. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  3341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3342. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  3343. //>>excludeEnd("ctx");
  3344. },
  3345. //>>excludeStart("ide", pragmas.excludeIdeData);
  3346. args: ["aDefaultValue"],
  3347. 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",
  3348. referencedClasses: [],
  3349. //>>excludeEnd("ide");
  3350. messageSends: ["value", "asSettingIfAbsent:"]
  3351. }),
  3352. $globals.String);
  3353. });