Kernel-Infrastructure.js 122 KB

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