1
0

Kernel-Classes.js 169 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663
  1. define(["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Helpers", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Classes");
  4. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  5. $core.addClass("Behavior", $globals.Object, "Kernel-Classes");
  6. $core.setSlots($globals.Behavior, ["organization", "slots", "fn", "superclass"]);
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aIn addition to BehaviorBody, I define superclass/subclass relationships and instantiation.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes and contain the description that instances are created from.\x0a\x0aI also provide iterating over the class hierarchy.";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "allSelectors",
  13. protocol: "accessing",
  14. //>>excludeStart("ide", pragmas.excludeIdeData);
  15. args: [],
  16. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  17. referencedClasses: [],
  18. //>>excludeEnd("ide");
  19. pragmas: [],
  20. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  21. }, function ($methodClass){ return function (){
  22. var self=this,$self=this;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. return $core.withContext(function($ctx1) {
  25. //>>excludeEnd("ctx");
  26. return $recv($self._allSuperclasses())._inject_into_([$self._selectors()
  27. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28. ,$ctx1.sendIdx["selectors"]=1
  29. //>>excludeEnd("ctx");
  30. ][0],(function(acc,each){
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. return $core.withContext(function($ctx2) {
  33. //>>excludeEnd("ctx");
  34. $recv(acc)._addAll_($recv(each)._selectors());
  35. return $recv(acc)._yourself();
  36. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  38. //>>excludeEnd("ctx");
  39. }));
  40. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{})});
  42. //>>excludeEnd("ctx");
  43. }; }),
  44. $globals.Behavior);
  45. $core.addMethod(
  46. $core.method({
  47. selector: "allSubclasses",
  48. protocol: "accessing",
  49. //>>excludeStart("ide", pragmas.excludeIdeData);
  50. args: [],
  51. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
  52. referencedClasses: ["Array"],
  53. //>>excludeEnd("ide");
  54. pragmas: [],
  55. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  56. }, function ($methodClass){ return function (){
  57. var self=this,$self=this;
  58. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59. return $core.withContext(function($ctx1) {
  60. //>>excludeEnd("ctx");
  61. return $recv($globals.Array)._streamContents_((function(str){
  62. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63. return $core.withContext(function($ctx2) {
  64. //>>excludeEnd("ctx");
  65. return $self._allSubclassesDo_((function(each){
  66. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67. return $core.withContext(function($ctx3) {
  68. //>>excludeEnd("ctx");
  69. return $recv(str)._nextPut_(each);
  70. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  72. //>>excludeEnd("ctx");
  73. }));
  74. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  76. //>>excludeEnd("ctx");
  77. }));
  78. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{})});
  80. //>>excludeEnd("ctx");
  81. }; }),
  82. $globals.Behavior);
  83. $core.addMethod(
  84. $core.method({
  85. selector: "allSubclassesDo:",
  86. protocol: "enumerating",
  87. //>>excludeStart("ide", pragmas.excludeIdeData);
  88. args: ["aBlock"],
  89. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
  90. referencedClasses: [],
  91. //>>excludeEnd("ide");
  92. pragmas: [["inlineJS:", ["$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})"]]],
  93. messageSends: []
  94. }, function ($methodClass){ return function (aBlock){
  95. var self=this,$self=this;
  96. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  97. return $core.withContext(function($ctx1) {
  98. //>>excludeEnd("ctx");
  99. $core.traverseClassTree(self, function(subclass) {
  100. if (subclass !== self) aBlock._value_(subclass);
  101. });
  102. return self;
  103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  104. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock})});
  105. //>>excludeEnd("ctx");
  106. }; }),
  107. $globals.Behavior);
  108. $core.addMethod(
  109. $core.method({
  110. selector: "allSuperclasses",
  111. protocol: "accessing",
  112. //>>excludeStart("ide", pragmas.excludeIdeData);
  113. args: [],
  114. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ self superclass allSuperclasses copyWithFirst: self superclass",
  115. referencedClasses: [],
  116. //>>excludeEnd("ide");
  117. pragmas: [],
  118. messageSends: ["ifNil:", "superclass", "copyWithFirst:", "allSuperclasses"]
  119. }, function ($methodClass){ return function (){
  120. var self=this,$self=this;
  121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  122. return $core.withContext(function($ctx1) {
  123. //>>excludeEnd("ctx");
  124. var $1;
  125. $1=[$self._superclass()
  126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  127. ,$ctx1.sendIdx["superclass"]=1
  128. //>>excludeEnd("ctx");
  129. ][0];
  130. if($1 == null || $1.a$nil){
  131. return [];
  132. } else {
  133. $1;
  134. }
  135. return $recv($recv([$self._superclass()
  136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  137. ,$ctx1.sendIdx["superclass"]=2
  138. //>>excludeEnd("ctx");
  139. ][0])._allSuperclasses())._copyWithFirst_($self._superclass());
  140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  141. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{})});
  142. //>>excludeEnd("ctx");
  143. }; }),
  144. $globals.Behavior);
  145. $core.addMethod(
  146. $core.method({
  147. selector: "alternateConstructorViaSelector:",
  148. protocol: "instance creation",
  149. //>>excludeStart("ide", pragmas.excludeIdeData);
  150. args: ["aSelector"],
  151. source: "alternateConstructorViaSelector: aSelector\x0a\x09^ BlockClosure\x0a\x09\x09javaScriptConstructorFor: self prototype\x0a\x09\x09initializingVia: (self >> aSelector) fn",
  152. referencedClasses: ["BlockClosure"],
  153. //>>excludeEnd("ide");
  154. pragmas: [],
  155. messageSends: ["javaScriptConstructorFor:initializingVia:", "prototype", "fn", ">>"]
  156. }, function ($methodClass){ return function (aSelector){
  157. var self=this,$self=this;
  158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  159. return $core.withContext(function($ctx1) {
  160. //>>excludeEnd("ctx");
  161. return $recv($globals.BlockClosure)._javaScriptConstructorFor_initializingVia_($self._prototype(),$recv($self.__gt_gt(aSelector))._fn());
  162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  163. }, function($ctx1) {$ctx1.fill(self,"alternateConstructorViaSelector:",{aSelector:aSelector})});
  164. //>>excludeEnd("ctx");
  165. }; }),
  166. $globals.Behavior);
  167. $core.addMethod(
  168. $core.method({
  169. selector: "applySuperConstructorOn:withArguments:",
  170. protocol: "accessing",
  171. //>>excludeStart("ide", pragmas.excludeIdeData);
  172. args: ["anObject", "anArray"],
  173. source: "applySuperConstructorOn: anObject withArguments: anArray\x0a\x09<inlineJS: '\x0a\x09\x09Object.getPrototypeOf($self.fn.prototype).constructor\x0a\x09\x09.apply(anObject, anArray)\x0a\x09'>",
  174. referencedClasses: [],
  175. //>>excludeEnd("ide");
  176. pragmas: [["inlineJS:", ["\x0a\x09\x09Object.getPrototypeOf($self.fn.prototype).constructor\x0a\x09\x09.apply(anObject, anArray)\x0a\x09"]]],
  177. messageSends: []
  178. }, function ($methodClass){ return function (anObject,anArray){
  179. var self=this,$self=this;
  180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  181. return $core.withContext(function($ctx1) {
  182. //>>excludeEnd("ctx");
  183. Object.getPrototypeOf($self.fn.prototype).constructor
  184. .apply(anObject, anArray)
  185. ;
  186. return self;
  187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  188. }, function($ctx1) {$ctx1.fill(self,"applySuperConstructorOn:withArguments:",{anObject:anObject,anArray:anArray})});
  189. //>>excludeEnd("ctx");
  190. }; }),
  191. $globals.Behavior);
  192. $core.addMethod(
  193. $core.method({
  194. selector: "basicNew",
  195. protocol: "instance creation",
  196. //>>excludeStart("ide", pragmas.excludeIdeData);
  197. args: [],
  198. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  199. referencedClasses: [],
  200. //>>excludeEnd("ide");
  201. pragmas: [["inlineJS:", ["return new self.fn()"]]],
  202. messageSends: []
  203. }, function ($methodClass){ return function (){
  204. var self=this,$self=this;
  205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  206. return $core.withContext(function($ctx1) {
  207. //>>excludeEnd("ctx");
  208. return new self.fn();
  209. return self;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. }, function($ctx1) {$ctx1.fill(self,"basicNew",{})});
  212. //>>excludeEnd("ctx");
  213. }; }),
  214. $globals.Behavior);
  215. $core.addMethod(
  216. $core.method({
  217. selector: "basicOrganization",
  218. protocol: "accessing",
  219. //>>excludeStart("ide", pragmas.excludeIdeData);
  220. args: [],
  221. source: "basicOrganization\x0a\x09^ organization",
  222. referencedClasses: [],
  223. //>>excludeEnd("ide");
  224. pragmas: [],
  225. messageSends: []
  226. }, function ($methodClass){ return function (){
  227. var self=this,$self=this;
  228. return $self.organization;
  229. }; }),
  230. $globals.Behavior);
  231. $core.addMethod(
  232. $core.method({
  233. selector: "basicOrganization:",
  234. protocol: "accessing",
  235. //>>excludeStart("ide", pragmas.excludeIdeData);
  236. args: ["aClassOrganizer"],
  237. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  238. referencedClasses: [],
  239. //>>excludeEnd("ide");
  240. pragmas: [],
  241. messageSends: []
  242. }, function ($methodClass){ return function (aClassOrganizer){
  243. var self=this,$self=this;
  244. $self.organization=aClassOrganizer;
  245. return self;
  246. }; }),
  247. $globals.Behavior);
  248. $core.addMethod(
  249. $core.method({
  250. selector: "beJavaScriptSubclassOf:",
  251. protocol: "accessing",
  252. //>>excludeStart("ide", pragmas.excludeIdeData);
  253. args: ["aJavaScriptFunction"],
  254. source: "beJavaScriptSubclassOf: aJavaScriptFunction\x0a\x09\x22Reparent the JS constructor's prototype to aJavaScriptFunction's one,\x0a\x09plus bookkeeping. That way I stay part of (simulated) Smalltalk hierarchy,\x0a\x09but my instances will physically be instanceof aJavaScriptFunction.\x22\x0a\x0a\x09self makeJavaScriptConstructorSubclassOf: aJavaScriptFunction.\x0a\x09Smalltalk core detachClass: self",
  255. referencedClasses: ["Smalltalk"],
  256. //>>excludeEnd("ide");
  257. pragmas: [],
  258. messageSends: ["makeJavaScriptConstructorSubclassOf:", "detachClass:", "core"]
  259. }, function ($methodClass){ return function (aJavaScriptFunction){
  260. var self=this,$self=this;
  261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  262. return $core.withContext(function($ctx1) {
  263. //>>excludeEnd("ctx");
  264. $self._makeJavaScriptConstructorSubclassOf_(aJavaScriptFunction);
  265. $recv($recv($globals.Smalltalk)._core())._detachClass_(self);
  266. return self;
  267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  268. }, function($ctx1) {$ctx1.fill(self,"beJavaScriptSubclassOf:",{aJavaScriptFunction:aJavaScriptFunction})});
  269. //>>excludeEnd("ctx");
  270. }; }),
  271. $globals.Behavior);
  272. $core.addMethod(
  273. $core.method({
  274. selector: "canUnderstand:",
  275. protocol: "testing",
  276. //>>excludeStart("ide", pragmas.excludeIdeData);
  277. args: ["aSelector"],
  278. source: "canUnderstand: aSelector\x0a\x09^ (self lookupSelector: aSelector) notNil",
  279. referencedClasses: [],
  280. //>>excludeEnd("ide");
  281. pragmas: [],
  282. messageSends: ["notNil", "lookupSelector:"]
  283. }, function ($methodClass){ return function (aSelector){
  284. var self=this,$self=this;
  285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  286. return $core.withContext(function($ctx1) {
  287. //>>excludeEnd("ctx");
  288. return $recv($self._lookupSelector_(aSelector))._notNil();
  289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  290. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector})});
  291. //>>excludeEnd("ctx");
  292. }; }),
  293. $globals.Behavior);
  294. $core.addMethod(
  295. $core.method({
  296. selector: "includesBehavior:",
  297. protocol: "testing",
  298. //>>excludeStart("ide", pragmas.excludeIdeData);
  299. args: ["aClass"],
  300. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  301. referencedClasses: [],
  302. //>>excludeEnd("ide");
  303. pragmas: [],
  304. messageSends: ["or:", "==", "inheritsFrom:"]
  305. }, function ($methodClass){ return function (aClass){
  306. var self=this,$self=this;
  307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  308. return $core.withContext(function($ctx1) {
  309. //>>excludeEnd("ctx");
  310. if($core.assert($self.__eq_eq(aClass))){
  311. return true;
  312. } else {
  313. return $self._inheritsFrom_(aClass);
  314. }
  315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  316. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass})});
  317. //>>excludeEnd("ctx");
  318. }; }),
  319. $globals.Behavior);
  320. $core.addMethod(
  321. $core.method({
  322. selector: "inheritsFrom:",
  323. protocol: "testing",
  324. //>>excludeStart("ide", pragmas.excludeIdeData);
  325. args: ["aClass"],
  326. source: "inheritsFrom: aClass\x0a\x09^ self superclass\x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :superClass | superClass includesBehavior: aClass ]",
  327. referencedClasses: [],
  328. //>>excludeEnd("ide");
  329. pragmas: [],
  330. messageSends: ["ifNil:ifNotNil:", "superclass", "includesBehavior:"]
  331. }, function ($methodClass){ return function (aClass){
  332. var self=this,$self=this;
  333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  334. return $core.withContext(function($ctx1) {
  335. //>>excludeEnd("ctx");
  336. var $1;
  337. $1=$self._superclass();
  338. if($1 == null || $1.a$nil){
  339. return false;
  340. } else {
  341. var superClass;
  342. superClass=$1;
  343. return $recv(superClass)._includesBehavior_(aClass);
  344. }
  345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  346. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass})});
  347. //>>excludeEnd("ctx");
  348. }; }),
  349. $globals.Behavior);
  350. $core.addMethod(
  351. $core.method({
  352. selector: "isBehavior",
  353. protocol: "testing",
  354. //>>excludeStart("ide", pragmas.excludeIdeData);
  355. args: [],
  356. source: "isBehavior\x0a\x09^ true",
  357. referencedClasses: [],
  358. //>>excludeEnd("ide");
  359. pragmas: [],
  360. messageSends: []
  361. }, function ($methodClass){ return function (){
  362. var self=this,$self=this;
  363. return true;
  364. }; }),
  365. $globals.Behavior);
  366. $core.addMethod(
  367. $core.method({
  368. selector: "javaScriptConstructor",
  369. protocol: "accessing",
  370. //>>excludeStart("ide", pragmas.excludeIdeData);
  371. args: [],
  372. source: "javaScriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See kernel-language.js\x22\x0a\x09\x0a\x09^ fn",
  373. referencedClasses: [],
  374. //>>excludeEnd("ide");
  375. pragmas: [],
  376. messageSends: []
  377. }, function ($methodClass){ return function (){
  378. var self=this,$self=this;
  379. return $self.fn;
  380. }; }),
  381. $globals.Behavior);
  382. $core.addMethod(
  383. $core.method({
  384. selector: "javaScriptConstructor:",
  385. protocol: "accessing",
  386. //>>excludeStart("ide", pragmas.excludeIdeData);
  387. args: ["aJavaScriptFunction"],
  388. source: "javaScriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09Smalltalk core setClassConstructor: self to: aJavaScriptFunction",
  389. referencedClasses: ["Smalltalk"],
  390. //>>excludeEnd("ide");
  391. pragmas: [],
  392. messageSends: ["setClassConstructor:to:", "core"]
  393. }, function ($methodClass){ return function (aJavaScriptFunction){
  394. var self=this,$self=this;
  395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  396. return $core.withContext(function($ctx1) {
  397. //>>excludeEnd("ctx");
  398. $recv($recv($globals.Smalltalk)._core())._setClassConstructor_to_(self,aJavaScriptFunction);
  399. return self;
  400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  401. }, function($ctx1) {$ctx1.fill(self,"javaScriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction})});
  402. //>>excludeEnd("ctx");
  403. }; }),
  404. $globals.Behavior);
  405. $core.addMethod(
  406. $core.method({
  407. selector: "javascriptConstructor",
  408. protocol: "accessing",
  409. //>>excludeStart("ide", pragmas.excludeIdeData);
  410. args: [],
  411. source: "javascriptConstructor\x0a\x09self deprecatedAPI: 'Use #javaScriptConstructor instead.'.\x0a\x09^ self javaScriptConstructor",
  412. referencedClasses: [],
  413. //>>excludeEnd("ide");
  414. pragmas: [],
  415. messageSends: ["deprecatedAPI:", "javaScriptConstructor"]
  416. }, function ($methodClass){ return function (){
  417. var self=this,$self=this;
  418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  419. return $core.withContext(function($ctx1) {
  420. //>>excludeEnd("ctx");
  421. $self._deprecatedAPI_("Use #javaScriptConstructor instead.");
  422. return $self._javaScriptConstructor();
  423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  424. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{})});
  425. //>>excludeEnd("ctx");
  426. }; }),
  427. $globals.Behavior);
  428. $core.addMethod(
  429. $core.method({
  430. selector: "javascriptConstructor:",
  431. protocol: "accessing",
  432. //>>excludeStart("ide", pragmas.excludeIdeData);
  433. args: ["aJavaScriptFunction"],
  434. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09self deprecatedAPI: 'Use #javaScriptConstructor: instead.'.\x0a\x09^ self javaScriptConstructor: aJavaScriptFunction",
  435. referencedClasses: [],
  436. //>>excludeEnd("ide");
  437. pragmas: [],
  438. messageSends: ["deprecatedAPI:", "javaScriptConstructor:"]
  439. }, function ($methodClass){ return function (aJavaScriptFunction){
  440. var self=this,$self=this;
  441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  442. return $core.withContext(function($ctx1) {
  443. //>>excludeEnd("ctx");
  444. $self._deprecatedAPI_("Use #javaScriptConstructor: instead.");
  445. return $self._javaScriptConstructor_(aJavaScriptFunction);
  446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  447. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction})});
  448. //>>excludeEnd("ctx");
  449. }; }),
  450. $globals.Behavior);
  451. $core.addMethod(
  452. $core.method({
  453. selector: "lookupSelector:",
  454. protocol: "accessing",
  455. //>>excludeStart("ide", pragmas.excludeIdeData);
  456. args: ["selector"],
  457. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09<inlineJS: 'return $self.methods[selector]'>",
  458. referencedClasses: [],
  459. //>>excludeEnd("ide");
  460. pragmas: [["inlineJS:", ["return $self.methods[selector]"]]],
  461. messageSends: []
  462. }, function ($methodClass){ return function (selector){
  463. var self=this,$self=this;
  464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  465. return $core.withContext(function($ctx1) {
  466. //>>excludeEnd("ctx");
  467. return $self.methods[selector];
  468. return self;
  469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  470. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector})});
  471. //>>excludeEnd("ctx");
  472. }; }),
  473. $globals.Behavior);
  474. $core.addMethod(
  475. $core.method({
  476. selector: "makeJavaScriptConstructorSubclassOf:",
  477. protocol: "private",
  478. //>>excludeStart("ide", pragmas.excludeIdeData);
  479. args: ["javaScriptClass"],
  480. source: "makeJavaScriptConstructorSubclassOf: javaScriptClass\x0a\x09<inlineJS: '\x0a\x09\x09Object.setPrototypeOf($self.fn.prototype, javaScriptClass.prototype);\x0a\x09'>",
  481. referencedClasses: [],
  482. //>>excludeEnd("ide");
  483. pragmas: [["inlineJS:", ["\x0a\x09\x09Object.setPrototypeOf($self.fn.prototype, javaScriptClass.prototype);\x0a\x09"]]],
  484. messageSends: []
  485. }, function ($methodClass){ return function (javaScriptClass){
  486. var self=this,$self=this;
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. return $core.withContext(function($ctx1) {
  489. //>>excludeEnd("ctx");
  490. Object.setPrototypeOf($self.fn.prototype, javaScriptClass.prototype);
  491. ;
  492. return self;
  493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  494. }, function($ctx1) {$ctx1.fill(self,"makeJavaScriptConstructorSubclassOf:",{javaScriptClass:javaScriptClass})});
  495. //>>excludeEnd("ctx");
  496. }; }),
  497. $globals.Behavior);
  498. $core.addMethod(
  499. $core.method({
  500. selector: "new",
  501. protocol: "instance creation",
  502. //>>excludeStart("ide", pragmas.excludeIdeData);
  503. args: [],
  504. source: "new\x0a\x09^ self basicNew initialize",
  505. referencedClasses: [],
  506. //>>excludeEnd("ide");
  507. pragmas: [],
  508. messageSends: ["initialize", "basicNew"]
  509. }, function ($methodClass){ return function (){
  510. var self=this,$self=this;
  511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  512. return $core.withContext(function($ctx1) {
  513. //>>excludeEnd("ctx");
  514. return $recv($self._basicNew())._initialize();
  515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  516. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  517. //>>excludeEnd("ctx");
  518. }; }),
  519. $globals.Behavior);
  520. $core.addMethod(
  521. $core.method({
  522. selector: "prototype",
  523. protocol: "accessing",
  524. //>>excludeStart("ide", pragmas.excludeIdeData);
  525. args: [],
  526. source: "prototype\x0a\x09^ self javaScriptConstructor prototype",
  527. referencedClasses: [],
  528. //>>excludeEnd("ide");
  529. pragmas: [],
  530. messageSends: ["prototype", "javaScriptConstructor"]
  531. }, function ($methodClass){ return function (){
  532. var self=this,$self=this;
  533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  534. return $core.withContext(function($ctx1) {
  535. //>>excludeEnd("ctx");
  536. return $recv($self._javaScriptConstructor())._prototype();
  537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  538. }, function($ctx1) {$ctx1.fill(self,"prototype",{})});
  539. //>>excludeEnd("ctx");
  540. }; }),
  541. $globals.Behavior);
  542. $core.addMethod(
  543. $core.method({
  544. selector: "slots",
  545. protocol: "accessing",
  546. //>>excludeStart("ide", pragmas.excludeIdeData);
  547. args: [],
  548. source: "slots\x0a\x09^ slots",
  549. referencedClasses: [],
  550. //>>excludeEnd("ide");
  551. pragmas: [],
  552. messageSends: []
  553. }, function ($methodClass){ return function (){
  554. var self=this,$self=this;
  555. return $self.slots;
  556. }; }),
  557. $globals.Behavior);
  558. $core.addMethod(
  559. $core.method({
  560. selector: "subclasses",
  561. protocol: "accessing",
  562. //>>excludeStart("ide", pragmas.excludeIdeData);
  563. args: [],
  564. source: "subclasses\x0a\x09self subclassResponsibility",
  565. referencedClasses: [],
  566. //>>excludeEnd("ide");
  567. pragmas: [],
  568. messageSends: ["subclassResponsibility"]
  569. }, function ($methodClass){ return function (){
  570. var self=this,$self=this;
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. return $core.withContext(function($ctx1) {
  573. //>>excludeEnd("ctx");
  574. $self._subclassResponsibility();
  575. return self;
  576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  577. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  578. //>>excludeEnd("ctx");
  579. }; }),
  580. $globals.Behavior);
  581. $core.addMethod(
  582. $core.method({
  583. selector: "superPrototype",
  584. protocol: "accessing",
  585. //>>excludeStart("ide", pragmas.excludeIdeData);
  586. args: [],
  587. source: "superPrototype\x0a\x09<inlineJS: 'return Object.getPrototypeOf($self.fn.prototype)'>",
  588. referencedClasses: [],
  589. //>>excludeEnd("ide");
  590. pragmas: [["inlineJS:", ["return Object.getPrototypeOf($self.fn.prototype)"]]],
  591. messageSends: []
  592. }, function ($methodClass){ return function (){
  593. var self=this,$self=this;
  594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  595. return $core.withContext(function($ctx1) {
  596. //>>excludeEnd("ctx");
  597. return Object.getPrototypeOf($self.fn.prototype);
  598. return self;
  599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  600. }, function($ctx1) {$ctx1.fill(self,"superPrototype",{})});
  601. //>>excludeEnd("ctx");
  602. }; }),
  603. $globals.Behavior);
  604. $core.addMethod(
  605. $core.method({
  606. selector: "superclass",
  607. protocol: "accessing",
  608. //>>excludeStart("ide", pragmas.excludeIdeData);
  609. args: [],
  610. source: "superclass\x0a\x09^ superclass",
  611. referencedClasses: [],
  612. //>>excludeEnd("ide");
  613. pragmas: [],
  614. messageSends: []
  615. }, function ($methodClass){ return function (){
  616. var self=this,$self=this;
  617. return $self.superclass;
  618. }; }),
  619. $globals.Behavior);
  620. $core.addMethod(
  621. $core.method({
  622. selector: "theMetaClass",
  623. protocol: "accessing",
  624. //>>excludeStart("ide", pragmas.excludeIdeData);
  625. args: [],
  626. source: "theMetaClass\x0a\x09self subclassResponsibility",
  627. referencedClasses: [],
  628. //>>excludeEnd("ide");
  629. pragmas: [],
  630. messageSends: ["subclassResponsibility"]
  631. }, function ($methodClass){ return function (){
  632. var self=this,$self=this;
  633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  634. return $core.withContext(function($ctx1) {
  635. //>>excludeEnd("ctx");
  636. $self._subclassResponsibility();
  637. return self;
  638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  639. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{})});
  640. //>>excludeEnd("ctx");
  641. }; }),
  642. $globals.Behavior);
  643. $core.addMethod(
  644. $core.method({
  645. selector: "theNonMetaClass",
  646. protocol: "accessing",
  647. //>>excludeStart("ide", pragmas.excludeIdeData);
  648. args: [],
  649. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  650. referencedClasses: [],
  651. //>>excludeEnd("ide");
  652. pragmas: [],
  653. messageSends: ["subclassResponsibility"]
  654. }, function ($methodClass){ return function (){
  655. var self=this,$self=this;
  656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  657. return $core.withContext(function($ctx1) {
  658. //>>excludeEnd("ctx");
  659. $self._subclassResponsibility();
  660. return self;
  661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  662. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{})});
  663. //>>excludeEnd("ctx");
  664. }; }),
  665. $globals.Behavior);
  666. $core.addMethod(
  667. $core.method({
  668. selector: "withAllSubclasses",
  669. protocol: "accessing",
  670. //>>excludeStart("ide", pragmas.excludeIdeData);
  671. args: [],
  672. source: "withAllSubclasses\x0a\x09^ self allSubclasses copyWithFirst: self",
  673. referencedClasses: [],
  674. //>>excludeEnd("ide");
  675. pragmas: [],
  676. messageSends: ["copyWithFirst:", "allSubclasses"]
  677. }, function ($methodClass){ return function (){
  678. var self=this,$self=this;
  679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  680. return $core.withContext(function($ctx1) {
  681. //>>excludeEnd("ctx");
  682. return $recv($self._allSubclasses())._copyWithFirst_(self);
  683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  684. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{})});
  685. //>>excludeEnd("ctx");
  686. }; }),
  687. $globals.Behavior);
  688. $core.addClass("Class", $globals.Behavior, "Kernel-Classes");
  689. $core.setSlots($globals.Class, ["package", "subclasses"]);
  690. //>>excludeStart("ide", pragmas.excludeIdeData);
  691. $globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  692. //>>excludeEnd("ide");
  693. $core.addMethod(
  694. $core.method({
  695. selector: "basicPackage:",
  696. protocol: "accessing",
  697. //>>excludeStart("ide", pragmas.excludeIdeData);
  698. args: ["aPackage"],
  699. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  700. referencedClasses: [],
  701. //>>excludeEnd("ide");
  702. pragmas: [],
  703. messageSends: []
  704. }, function ($methodClass){ return function (aPackage){
  705. var self=this,$self=this;
  706. $self.package=aPackage;
  707. return self;
  708. }; }),
  709. $globals.Class);
  710. $core.addMethod(
  711. $core.method({
  712. selector: "classTag",
  713. protocol: "accessing",
  714. //>>excludeStart("ide", pragmas.excludeIdeData);
  715. args: [],
  716. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'class'",
  717. referencedClasses: [],
  718. //>>excludeEnd("ide");
  719. pragmas: [],
  720. messageSends: []
  721. }, function ($methodClass){ return function (){
  722. var self=this,$self=this;
  723. return "class";
  724. }; }),
  725. $globals.Class);
  726. $core.addMethod(
  727. $core.method({
  728. selector: "definition",
  729. protocol: "accessing",
  730. //>>excludeStart("ide", pragmas.excludeIdeData);
  731. args: [],
  732. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self superclass; write: ' subclass: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: {'slots: {'. ('. ' join: (self instanceVariableNames collect: #symbolPrintString)). '}'}; lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  733. referencedClasses: ["String"],
  734. //>>excludeEnd("ide");
  735. pragmas: [],
  736. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "collect:", "instanceVariableNames", "category"]
  737. }, function ($methodClass){ return function (){
  738. var self=this,$self=this;
  739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  740. return $core.withContext(function($ctx1) {
  741. //>>excludeEnd("ctx");
  742. return $recv($globals.String)._streamContents_((function(stream){
  743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  744. return $core.withContext(function($ctx2) {
  745. //>>excludeEnd("ctx");
  746. [$recv(stream)._print_($self._superclass())
  747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  748. ,$ctx2.sendIdx["print:"]=1
  749. //>>excludeEnd("ctx");
  750. ][0];
  751. [$recv(stream)._write_(" subclass: ")
  752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  753. ,$ctx2.sendIdx["write:"]=1
  754. //>>excludeEnd("ctx");
  755. ][0];
  756. $recv(stream)._printSymbol_($self._name());
  757. [$recv(stream)._lf()
  758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  759. ,$ctx2.sendIdx["lf"]=1
  760. //>>excludeEnd("ctx");
  761. ][0];
  762. [$recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  764. return $core.withContext(function($ctx3) {
  765. //>>excludeEnd("ctx");
  766. return [[$recv($globals.String)._tab()
  767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  768. ,$ctx3.sendIdx["tab"]=1
  769. //>>excludeEnd("ctx");
  770. ][0],"uses: ",tcd,[$recv($globals.String)._lf()
  771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  772. ,$ctx3.sendIdx["lf"]=2
  773. //>>excludeEnd("ctx");
  774. ][0]];
  775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  776. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  777. //>>excludeEnd("ctx");
  778. })))
  779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  780. ,$ctx2.sendIdx["write:"]=2
  781. //>>excludeEnd("ctx");
  782. ][0];
  783. [$recv(stream)._tab()
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. ,$ctx2.sendIdx["tab"]=2
  786. //>>excludeEnd("ctx");
  787. ][0];
  788. [$recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"])
  789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  790. ,$ctx2.sendIdx["write:"]=3
  791. //>>excludeEnd("ctx");
  792. ][0];
  793. $recv(stream)._lf();
  794. $recv(stream)._tab();
  795. $recv(stream)._write_("package: ");
  796. return $recv(stream)._print_($self._category());
  797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  798. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  799. //>>excludeEnd("ctx");
  800. }));
  801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  802. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  803. //>>excludeEnd("ctx");
  804. }; }),
  805. $globals.Class);
  806. $core.addMethod(
  807. $core.method({
  808. selector: "includingPossibleMetaDo:",
  809. protocol: "enumerating",
  810. //>>excludeStart("ide", pragmas.excludeIdeData);
  811. args: ["aBlock"],
  812. source: "includingPossibleMetaDo: aBlock\x0a\x0a\x09aBlock value: self.\x0a\x09aBlock value: self theMetaClass",
  813. referencedClasses: [],
  814. //>>excludeEnd("ide");
  815. pragmas: [],
  816. messageSends: ["value:", "theMetaClass"]
  817. }, function ($methodClass){ return function (aBlock){
  818. var self=this,$self=this;
  819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  820. return $core.withContext(function($ctx1) {
  821. //>>excludeEnd("ctx");
  822. [$recv(aBlock)._value_(self)
  823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  824. ,$ctx1.sendIdx["value:"]=1
  825. //>>excludeEnd("ctx");
  826. ][0];
  827. $recv(aBlock)._value_($self._theMetaClass());
  828. return self;
  829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  830. }, function($ctx1) {$ctx1.fill(self,"includingPossibleMetaDo:",{aBlock:aBlock})});
  831. //>>excludeEnd("ctx");
  832. }; }),
  833. $globals.Class);
  834. $core.addMethod(
  835. $core.method({
  836. selector: "isClass",
  837. protocol: "testing",
  838. //>>excludeStart("ide", pragmas.excludeIdeData);
  839. args: [],
  840. source: "isClass\x0a\x09^ true",
  841. referencedClasses: [],
  842. //>>excludeEnd("ide");
  843. pragmas: [],
  844. messageSends: []
  845. }, function ($methodClass){ return function (){
  846. var self=this,$self=this;
  847. return true;
  848. }; }),
  849. $globals.Class);
  850. $core.addMethod(
  851. $core.method({
  852. selector: "package",
  853. protocol: "accessing",
  854. //>>excludeStart("ide", pragmas.excludeIdeData);
  855. args: [],
  856. source: "package\x0a\x09^ package",
  857. referencedClasses: [],
  858. //>>excludeEnd("ide");
  859. pragmas: [],
  860. messageSends: []
  861. }, function ($methodClass){ return function (){
  862. var self=this,$self=this;
  863. return $self.package;
  864. }; }),
  865. $globals.Class);
  866. $core.addMethod(
  867. $core.method({
  868. selector: "provided",
  869. protocol: "converting",
  870. //>>excludeStart("ide", pragmas.excludeIdeData);
  871. args: [],
  872. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 Number provided EPSILON\x0a\x09that forwards to (wrapped JS) constructor function.\x22\x0a\x09\x0a\x09^ self javaScriptConstructor provided",
  873. referencedClasses: [],
  874. //>>excludeEnd("ide");
  875. pragmas: [],
  876. messageSends: ["provided", "javaScriptConstructor"]
  877. }, function ($methodClass){ return function (){
  878. var self=this,$self=this;
  879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  880. return $core.withContext(function($ctx1) {
  881. //>>excludeEnd("ctx");
  882. return $recv($self._javaScriptConstructor())._provided();
  883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  884. }, function($ctx1) {$ctx1.fill(self,"provided",{})});
  885. //>>excludeEnd("ctx");
  886. }; }),
  887. $globals.Class);
  888. $core.addMethod(
  889. $core.method({
  890. selector: "rename:",
  891. protocol: "accessing",
  892. //>>excludeStart("ide", pragmas.excludeIdeData);
  893. args: ["aString"],
  894. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  895. referencedClasses: ["ClassBuilder"],
  896. //>>excludeEnd("ide");
  897. pragmas: [],
  898. messageSends: ["renameClass:to:", "new"]
  899. }, function ($methodClass){ return function (aString){
  900. var self=this,$self=this;
  901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  902. return $core.withContext(function($ctx1) {
  903. //>>excludeEnd("ctx");
  904. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  905. return self;
  906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  907. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString})});
  908. //>>excludeEnd("ctx");
  909. }; }),
  910. $globals.Class);
  911. $core.addMethod(
  912. $core.method({
  913. selector: "subclasses",
  914. protocol: "accessing",
  915. //>>excludeStart("ide", pragmas.excludeIdeData);
  916. args: [],
  917. source: "subclasses\x0a\x09^ subclasses copy",
  918. referencedClasses: [],
  919. //>>excludeEnd("ide");
  920. pragmas: [],
  921. messageSends: ["copy"]
  922. }, function ($methodClass){ return function (){
  923. var self=this,$self=this;
  924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  925. return $core.withContext(function($ctx1) {
  926. //>>excludeEnd("ctx");
  927. return $recv($self.subclasses)._copy();
  928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  929. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  930. //>>excludeEnd("ctx");
  931. }; }),
  932. $globals.Class);
  933. $core.addMethod(
  934. $core.method({
  935. selector: "theMetaClass",
  936. protocol: "accessing",
  937. //>>excludeStart("ide", pragmas.excludeIdeData);
  938. args: [],
  939. source: "theMetaClass\x0a\x09^ self class",
  940. referencedClasses: [],
  941. //>>excludeEnd("ide");
  942. pragmas: [],
  943. messageSends: ["class"]
  944. }, function ($methodClass){ return function (){
  945. var self=this,$self=this;
  946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  947. return $core.withContext(function($ctx1) {
  948. //>>excludeEnd("ctx");
  949. return $self._class();
  950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  951. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{})});
  952. //>>excludeEnd("ctx");
  953. }; }),
  954. $globals.Class);
  955. $core.addClass("Metaclass", $globals.Behavior, "Kernel-Classes");
  956. $core.setSlots($globals.Metaclass, ["instanceClass"]);
  957. //>>excludeStart("ide", pragmas.excludeIdeData);
  958. $globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  959. //>>excludeEnd("ide");
  960. $core.addMethod(
  961. $core.method({
  962. selector: "asJavaScriptSource",
  963. protocol: "converting",
  964. //>>excludeStart("ide", pragmas.excludeIdeData);
  965. args: [],
  966. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  967. referencedClasses: [],
  968. //>>excludeEnd("ide");
  969. pragmas: [],
  970. messageSends: [",", "name", "instanceClass"]
  971. }, function ($methodClass){ return function (){
  972. var self=this,$self=this;
  973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  974. return $core.withContext(function($ctx1) {
  975. //>>excludeEnd("ctx");
  976. return [$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls")
  977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  978. ,$ctx1.sendIdx[","]=1
  979. //>>excludeEnd("ctx");
  980. ][0];
  981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  982. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  983. //>>excludeEnd("ctx");
  984. }; }),
  985. $globals.Metaclass);
  986. $core.addMethod(
  987. $core.method({
  988. selector: "definition",
  989. protocol: "accessing",
  990. //>>excludeStart("ide", pragmas.excludeIdeData);
  991. args: [],
  992. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self;\x0a\x09\x09write: (self traitCompositionDefinition\x0a\x09\x09\x09ifEmpty: [' ']\x0a\x09\x09\x09ifNotEmpty: [ :tcd | { String lf. String tab. 'uses: '. tcd. String lf. String tab }]);\x0a\x09\x09write: {'slots: {'. ('. ' join: (self instanceVariableNames collect: #symbolPrintString)). '}'} ]",
  993. referencedClasses: ["String"],
  994. //>>excludeEnd("ide");
  995. pragmas: [],
  996. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "collect:", "instanceVariableNames"]
  997. }, function ($methodClass){ return function (){
  998. var self=this,$self=this;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. return $core.withContext(function($ctx1) {
  1001. //>>excludeEnd("ctx");
  1002. return $recv($globals.String)._streamContents_((function(stream){
  1003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1004. return $core.withContext(function($ctx2) {
  1005. //>>excludeEnd("ctx");
  1006. $recv(stream)._print_(self);
  1007. [$recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  1008. return " ";
  1009. }),(function(tcd){
  1010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1011. return $core.withContext(function($ctx3) {
  1012. //>>excludeEnd("ctx");
  1013. return [[$recv($globals.String)._lf()
  1014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1015. ,$ctx3.sendIdx["lf"]=1
  1016. //>>excludeEnd("ctx");
  1017. ][0],[$recv($globals.String)._tab()
  1018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1019. ,$ctx3.sendIdx["tab"]=1
  1020. //>>excludeEnd("ctx");
  1021. ][0],"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  1022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1023. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  1024. //>>excludeEnd("ctx");
  1025. })))
  1026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1027. ,$ctx2.sendIdx["write:"]=1
  1028. //>>excludeEnd("ctx");
  1029. ][0];
  1030. return $recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  1031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1032. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1033. //>>excludeEnd("ctx");
  1034. }));
  1035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1036. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  1037. //>>excludeEnd("ctx");
  1038. }; }),
  1039. $globals.Metaclass);
  1040. $core.addMethod(
  1041. $core.method({
  1042. selector: "instanceClass",
  1043. protocol: "accessing",
  1044. //>>excludeStart("ide", pragmas.excludeIdeData);
  1045. args: [],
  1046. source: "instanceClass\x0a\x09^ instanceClass",
  1047. referencedClasses: [],
  1048. //>>excludeEnd("ide");
  1049. pragmas: [],
  1050. messageSends: []
  1051. }, function ($methodClass){ return function (){
  1052. var self=this,$self=this;
  1053. return $self.instanceClass;
  1054. }; }),
  1055. $globals.Metaclass);
  1056. $core.addMethod(
  1057. $core.method({
  1058. selector: "instanceVariableNames:",
  1059. protocol: "accessing",
  1060. //>>excludeStart("ide", pragmas.excludeIdeData);
  1061. args: ["aString"],
  1062. source: "instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self slots: aString instanceVariablesStringAsSlotList",
  1063. referencedClasses: [],
  1064. //>>excludeEnd("ide");
  1065. pragmas: [],
  1066. messageSends: ["slots:", "instanceVariablesStringAsSlotList"]
  1067. }, function ($methodClass){ return function (aString){
  1068. var self=this,$self=this;
  1069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1070. return $core.withContext(function($ctx1) {
  1071. //>>excludeEnd("ctx");
  1072. return $self._slots_($recv(aString)._instanceVariablesStringAsSlotList());
  1073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1074. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aString:aString})});
  1075. //>>excludeEnd("ctx");
  1076. }; }),
  1077. $globals.Metaclass);
  1078. $core.addMethod(
  1079. $core.method({
  1080. selector: "isMetaclass",
  1081. protocol: "testing",
  1082. //>>excludeStart("ide", pragmas.excludeIdeData);
  1083. args: [],
  1084. source: "isMetaclass\x0a\x09^ true",
  1085. referencedClasses: [],
  1086. //>>excludeEnd("ide");
  1087. pragmas: [],
  1088. messageSends: []
  1089. }, function ($methodClass){ return function (){
  1090. var self=this,$self=this;
  1091. return true;
  1092. }; }),
  1093. $globals.Metaclass);
  1094. $core.addMethod(
  1095. $core.method({
  1096. selector: "name",
  1097. protocol: "accessing",
  1098. //>>excludeStart("ide", pragmas.excludeIdeData);
  1099. args: [],
  1100. source: "name\x0a\x09^ self instanceClass name, ' class'",
  1101. referencedClasses: [],
  1102. //>>excludeEnd("ide");
  1103. pragmas: [],
  1104. messageSends: [",", "name", "instanceClass"]
  1105. }, function ($methodClass){ return function (){
  1106. var self=this,$self=this;
  1107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1108. return $core.withContext(function($ctx1) {
  1109. //>>excludeEnd("ctx");
  1110. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  1111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1112. }, function($ctx1) {$ctx1.fill(self,"name",{})});
  1113. //>>excludeEnd("ctx");
  1114. }; }),
  1115. $globals.Metaclass);
  1116. $core.addMethod(
  1117. $core.method({
  1118. selector: "package",
  1119. protocol: "accessing",
  1120. //>>excludeStart("ide", pragmas.excludeIdeData);
  1121. args: [],
  1122. source: "package\x0a\x09^ self instanceClass package",
  1123. referencedClasses: [],
  1124. //>>excludeEnd("ide");
  1125. pragmas: [],
  1126. messageSends: ["package", "instanceClass"]
  1127. }, function ($methodClass){ return function (){
  1128. var self=this,$self=this;
  1129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1130. return $core.withContext(function($ctx1) {
  1131. //>>excludeEnd("ctx");
  1132. return $recv($self._instanceClass())._package();
  1133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1134. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  1135. //>>excludeEnd("ctx");
  1136. }; }),
  1137. $globals.Metaclass);
  1138. $core.addMethod(
  1139. $core.method({
  1140. selector: "slots:",
  1141. protocol: "accessing",
  1142. //>>excludeStart("ide", pragmas.excludeIdeData);
  1143. args: ["aCollection"],
  1144. source: "slots: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self slots: aCollection.\x0a\x09^ self",
  1145. referencedClasses: ["ClassBuilder"],
  1146. //>>excludeEnd("ide");
  1147. pragmas: [],
  1148. messageSends: ["class:slots:", "new"]
  1149. }, function ($methodClass){ return function (aCollection){
  1150. var self=this,$self=this;
  1151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1152. return $core.withContext(function($ctx1) {
  1153. //>>excludeEnd("ctx");
  1154. $recv($recv($globals.ClassBuilder)._new())._class_slots_(self,aCollection);
  1155. return self;
  1156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1157. }, function($ctx1) {$ctx1.fill(self,"slots:",{aCollection:aCollection})});
  1158. //>>excludeEnd("ctx");
  1159. }; }),
  1160. $globals.Metaclass);
  1161. $core.addMethod(
  1162. $core.method({
  1163. selector: "subclasses",
  1164. protocol: "accessing",
  1165. //>>excludeStart("ide", pragmas.excludeIdeData);
  1166. args: [],
  1167. source: "subclasses\x0a\x09^ Smalltalk core metaSubclasses: self",
  1168. referencedClasses: ["Smalltalk"],
  1169. //>>excludeEnd("ide");
  1170. pragmas: [],
  1171. messageSends: ["metaSubclasses:", "core"]
  1172. }, function ($methodClass){ return function (){
  1173. var self=this,$self=this;
  1174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1175. return $core.withContext(function($ctx1) {
  1176. //>>excludeEnd("ctx");
  1177. return $recv($recv($globals.Smalltalk)._core())._metaSubclasses_(self);
  1178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1179. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  1180. //>>excludeEnd("ctx");
  1181. }; }),
  1182. $globals.Metaclass);
  1183. $core.addMethod(
  1184. $core.method({
  1185. selector: "theMetaClass",
  1186. protocol: "accessing",
  1187. //>>excludeStart("ide", pragmas.excludeIdeData);
  1188. args: [],
  1189. source: "theMetaClass\x0a\x09^ self",
  1190. referencedClasses: [],
  1191. //>>excludeEnd("ide");
  1192. pragmas: [],
  1193. messageSends: []
  1194. }, function ($methodClass){ return function (){
  1195. var self=this,$self=this;
  1196. return self;
  1197. }; }),
  1198. $globals.Metaclass);
  1199. $core.addMethod(
  1200. $core.method({
  1201. selector: "theNonMetaClass",
  1202. protocol: "accessing",
  1203. //>>excludeStart("ide", pragmas.excludeIdeData);
  1204. args: [],
  1205. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  1206. referencedClasses: [],
  1207. //>>excludeEnd("ide");
  1208. pragmas: [],
  1209. messageSends: ["instanceClass"]
  1210. }, function ($methodClass){ return function (){
  1211. var self=this,$self=this;
  1212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1213. return $core.withContext(function($ctx1) {
  1214. //>>excludeEnd("ctx");
  1215. return $self._instanceClass();
  1216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1217. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{})});
  1218. //>>excludeEnd("ctx");
  1219. }; }),
  1220. $globals.Metaclass);
  1221. $core.addMethod(
  1222. $core.method({
  1223. selector: "uses:instanceVariableNames:",
  1224. protocol: "accessing",
  1225. //>>excludeStart("ide", pragmas.excludeIdeData);
  1226. args: ["aTraitCompositionDescription", "aString"],
  1227. source: "uses: aTraitCompositionDescription instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self uses: aTraitCompositionDescription slots: aString instanceVariablesStringAsSlotList",
  1228. referencedClasses: [],
  1229. //>>excludeEnd("ide");
  1230. pragmas: [],
  1231. messageSends: ["uses:slots:", "instanceVariablesStringAsSlotList"]
  1232. }, function ($methodClass){ return function (aTraitCompositionDescription,aString){
  1233. var self=this,$self=this;
  1234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1235. return $core.withContext(function($ctx1) {
  1236. //>>excludeEnd("ctx");
  1237. return $self._uses_slots_(aTraitCompositionDescription,$recv(aString)._instanceVariablesStringAsSlotList());
  1238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1239. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aString:aString})});
  1240. //>>excludeEnd("ctx");
  1241. }; }),
  1242. $globals.Metaclass);
  1243. $core.addMethod(
  1244. $core.method({
  1245. selector: "uses:slots:",
  1246. protocol: "accessing",
  1247. //>>excludeStart("ide", pragmas.excludeIdeData);
  1248. args: ["aTraitCompositionDescription", "aCollection"],
  1249. source: "uses: aTraitCompositionDescription slots: aCollection\x0a\x09self\x0a\x09\x09slots: aCollection;\x0a\x09\x09setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ self",
  1250. referencedClasses: [],
  1251. //>>excludeEnd("ide");
  1252. pragmas: [],
  1253. messageSends: ["slots:", "setTraitComposition:", "asTraitComposition"]
  1254. }, function ($methodClass){ return function (aTraitCompositionDescription,aCollection){
  1255. var self=this,$self=this;
  1256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1257. return $core.withContext(function($ctx1) {
  1258. //>>excludeEnd("ctx");
  1259. $self._slots_(aCollection);
  1260. $self._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  1261. return self;
  1262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1263. }, function($ctx1) {$ctx1.fill(self,"uses:slots:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection})});
  1264. //>>excludeEnd("ctx");
  1265. }; }),
  1266. $globals.Metaclass);
  1267. $core.addClass("ClassBuilder", $globals.Object, "Kernel-Classes");
  1268. //>>excludeStart("ide", pragmas.excludeIdeData);
  1269. $globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  1270. //>>excludeEnd("ide");
  1271. $core.addMethod(
  1272. $core.method({
  1273. selector: "addSubclassOf:named:instanceVariableNames:package:",
  1274. protocol: "class definition",
  1275. //>>excludeStart("ide", pragmas.excludeIdeData);
  1276. args: ["aClass", "className", "aCollection", "packageName"],
  1277. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09self deprecatedAPI: 'Use #addSubclass:named:slots:package: instead.'.\x0a\x09^ self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09slots: aCollection\x0a\x09\x09package: packageName",
  1278. referencedClasses: [],
  1279. //>>excludeEnd("ide");
  1280. pragmas: [],
  1281. messageSends: ["deprecatedAPI:", "addSubclassOf:named:slots:package:"]
  1282. }, function ($methodClass){ return function (aClass,className,aCollection,packageName){
  1283. var self=this,$self=this;
  1284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1285. return $core.withContext(function($ctx1) {
  1286. //>>excludeEnd("ctx");
  1287. $self._deprecatedAPI_("Use #addSubclass:named:slots:package: instead.");
  1288. return $self._addSubclassOf_named_slots_package_(aClass,className,aCollection,packageName);
  1289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1290. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName})});
  1291. //>>excludeEnd("ctx");
  1292. }; }),
  1293. $globals.ClassBuilder);
  1294. $core.addMethod(
  1295. $core.method({
  1296. selector: "addSubclassOf:named:slots:package:",
  1297. protocol: "class definition",
  1298. //>>excludeStart("ide", pragmas.excludeIdeData);
  1299. args: ["aClass", "className", "aCollection", "packageName"],
  1300. source: "addSubclassOf: aClass named: className slots: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass\x0a\x09\x09\x09ifFalse: [ ^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09slots: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ (self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09slots: aCollection\x0a\x09\x09package: packageName) recompile; yourself",
  1301. referencedClasses: ["Smalltalk", "Package"],
  1302. //>>excludeEnd("ide");
  1303. pragmas: [],
  1304. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:slots:package:", "recompile", "basicAddSubclassOf:named:slots:package:", "yourself"]
  1305. }, function ($methodClass){ return function (aClass,className,aCollection,packageName){
  1306. var self=this,$self=this;
  1307. var theClass,thePackage;
  1308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1309. return $core.withContext(function($ctx1) {
  1310. //>>excludeEnd("ctx");
  1311. var $1,$2;
  1312. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  1313. thePackage=$recv($globals.Package)._named_(packageName);
  1314. $1=theClass;
  1315. if($1 == null || $1.a$nil){
  1316. $1;
  1317. } else {
  1318. $recv(theClass)._package_(thePackage);
  1319. if(!$core.assert($recv($recv(theClass)._superclass()).__eq_eq(aClass))){
  1320. return $self._migrateClassNamed_superclass_slots_package_(className,aClass,aCollection,packageName);
  1321. }
  1322. }
  1323. $2=$self._basicAddSubclassOf_named_slots_package_(aClass,className,aCollection,packageName);
  1324. $recv($2)._recompile();
  1325. return $recv($2)._yourself();
  1326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1327. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:slots:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage})});
  1328. //>>excludeEnd("ctx");
  1329. }; }),
  1330. $globals.ClassBuilder);
  1331. $core.addMethod(
  1332. $core.method({
  1333. selector: "addTraitNamed:package:",
  1334. protocol: "class definition",
  1335. //>>excludeStart("ide", pragmas.excludeIdeData);
  1336. args: ["traitName", "packageName"],
  1337. source: "addTraitNamed: traitName package: packageName\x0a\x09| theTrait thePackage |\x0a\x09\x0a\x09theTrait := Smalltalk globals at: traitName.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theTrait ifNotNil: [ ^ theTrait package: thePackage; recompile; yourself ].\x0a\x09\x09\x0a\x09theTrait := self\x0a\x09\x09basicAddTraitNamed: traitName\x0a\x09\x09package: packageName.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: theTrait;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ theTrait",
  1338. referencedClasses: ["Smalltalk", "Package", "SystemAnnouncer", "ClassAdded"],
  1339. //>>excludeEnd("ide");
  1340. pragmas: [],
  1341. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:", "announce:", "current", "theClass:", "new"]
  1342. }, function ($methodClass){ return function (traitName,packageName){
  1343. var self=this,$self=this;
  1344. var theTrait,thePackage;
  1345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1346. return $core.withContext(function($ctx1) {
  1347. //>>excludeEnd("ctx");
  1348. var $1,$2,$3,$4;
  1349. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  1350. thePackage=$recv($globals.Package)._named_(packageName);
  1351. $1=theTrait;
  1352. if($1 == null || $1.a$nil){
  1353. $1;
  1354. } else {
  1355. $2=theTrait;
  1356. $recv($2)._package_(thePackage);
  1357. $recv($2)._recompile();
  1358. return [$recv($2)._yourself()
  1359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1360. ,$ctx1.sendIdx["yourself"]=1
  1361. //>>excludeEnd("ctx");
  1362. ][0];
  1363. }
  1364. theTrait=$self._basicAddTraitNamed_package_(traitName,packageName);
  1365. $3=$recv($globals.SystemAnnouncer)._current();
  1366. $4=$recv($globals.ClassAdded)._new();
  1367. $recv($4)._theClass_(theTrait);
  1368. $recv($3)._announce_($recv($4)._yourself());
  1369. return theTrait;
  1370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1371. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage})});
  1372. //>>excludeEnd("ctx");
  1373. }; }),
  1374. $globals.ClassBuilder);
  1375. $core.addMethod(
  1376. $core.method({
  1377. selector: "basicAddSubclassOf:named:slots:package:",
  1378. protocol: "private",
  1379. //>>excludeStart("ide", pragmas.excludeIdeData);
  1380. args: ["aClass", "aString", "aCollection", "packageName"],
  1381. source: "basicAddSubclassOf: aClass named: aString slots: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09var klass = $core.addClass(aString, aClass, packageName);\x0a\x09\x09$core.setSlots(klass, aCollection);\x0a\x09\x09return klass;\x0a\x09'>",
  1382. referencedClasses: [],
  1383. //>>excludeEnd("ide");
  1384. pragmas: [["inlineJS:", ["\x0a\x09\x09var klass = $core.addClass(aString, aClass, packageName);\x0a\x09\x09$core.setSlots(klass, aCollection);\x0a\x09\x09return klass;\x0a\x09"]]],
  1385. messageSends: []
  1386. }, function ($methodClass){ return function (aClass,aString,aCollection,packageName){
  1387. var self=this,$self=this;
  1388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1389. return $core.withContext(function($ctx1) {
  1390. //>>excludeEnd("ctx");
  1391. var klass = $core.addClass(aString, aClass, packageName);
  1392. $core.setSlots(klass, aCollection);
  1393. return klass;
  1394. ;
  1395. return self;
  1396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1397. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:slots:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName})});
  1398. //>>excludeEnd("ctx");
  1399. }; }),
  1400. $globals.ClassBuilder);
  1401. $core.addMethod(
  1402. $core.method({
  1403. selector: "basicAddTraitNamed:package:",
  1404. protocol: "private",
  1405. //>>excludeStart("ide", pragmas.excludeIdeData);
  1406. args: ["aString", "anotherString"],
  1407. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  1408. referencedClasses: [],
  1409. //>>excludeEnd("ide");
  1410. pragmas: [["inlineJS:", ["return $core.addTrait(aString, anotherString)"]]],
  1411. messageSends: []
  1412. }, function ($methodClass){ return function (aString,anotherString){
  1413. var self=this,$self=this;
  1414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1415. return $core.withContext(function($ctx1) {
  1416. //>>excludeEnd("ctx");
  1417. return $core.addTrait(aString, anotherString);
  1418. return self;
  1419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1420. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString})});
  1421. //>>excludeEnd("ctx");
  1422. }; }),
  1423. $globals.ClassBuilder);
  1424. $core.addMethod(
  1425. $core.method({
  1426. selector: "basicClass:slots:",
  1427. protocol: "private",
  1428. //>>excludeStart("ide", pragmas.excludeIdeData);
  1429. args: ["aClass", "aCollection"],
  1430. source: "basicClass: aClass slots: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09Smalltalk core setSlots: aClass to: aCollection",
  1431. referencedClasses: ["Smalltalk"],
  1432. //>>excludeEnd("ide");
  1433. pragmas: [],
  1434. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "setSlots:to:", "core"]
  1435. }, function ($methodClass){ return function (aClass,aCollection){
  1436. var self=this,$self=this;
  1437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1438. return $core.withContext(function($ctx1) {
  1439. //>>excludeEnd("ctx");
  1440. if(!$core.assert($recv(aClass)._isMetaclass())){
  1441. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  1442. }
  1443. $recv($recv($globals.Smalltalk)._core())._setSlots_to_(aClass,aCollection);
  1444. return self;
  1445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1446. }, function($ctx1) {$ctx1.fill(self,"basicClass:slots:",{aClass:aClass,aCollection:aCollection})});
  1447. //>>excludeEnd("ctx");
  1448. }; }),
  1449. $globals.ClassBuilder);
  1450. $core.addMethod(
  1451. $core.method({
  1452. selector: "basicRemoveClass:",
  1453. protocol: "private",
  1454. //>>excludeStart("ide", pragmas.excludeIdeData);
  1455. args: ["aClass"],
  1456. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  1457. referencedClasses: [],
  1458. //>>excludeEnd("ide");
  1459. pragmas: [["inlineJS:", ["$core.removeClass(aClass)"]]],
  1460. messageSends: []
  1461. }, function ($methodClass){ return function (aClass){
  1462. var self=this,$self=this;
  1463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1464. return $core.withContext(function($ctx1) {
  1465. //>>excludeEnd("ctx");
  1466. $core.removeClass(aClass);
  1467. return self;
  1468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1469. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass})});
  1470. //>>excludeEnd("ctx");
  1471. }; }),
  1472. $globals.ClassBuilder);
  1473. $core.addMethod(
  1474. $core.method({
  1475. selector: "basicRenameClass:to:",
  1476. protocol: "private",
  1477. //>>excludeStart("ide", pragmas.excludeIdeData);
  1478. args: ["aClass", "aString"],
  1479. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09'>",
  1480. referencedClasses: [],
  1481. //>>excludeEnd("ide");
  1482. pragmas: [["inlineJS:", ["\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09"]]],
  1483. messageSends: []
  1484. }, function ($methodClass){ return function (aClass,aString){
  1485. var self=this,$self=this;
  1486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1487. return $core.withContext(function($ctx1) {
  1488. //>>excludeEnd("ctx");
  1489. $globals[aString] = aClass;
  1490. delete $globals[aClass.name];
  1491. aClass.name = aString;
  1492. ;
  1493. return self;
  1494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1495. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString})});
  1496. //>>excludeEnd("ctx");
  1497. }; }),
  1498. $globals.ClassBuilder);
  1499. $core.addMethod(
  1500. $core.method({
  1501. selector: "basicSwapClassNames:with:",
  1502. protocol: "private",
  1503. //>>excludeStart("ide", pragmas.excludeIdeData);
  1504. args: ["aClass", "anotherClass"],
  1505. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09'>",
  1506. referencedClasses: [],
  1507. //>>excludeEnd("ide");
  1508. pragmas: [["inlineJS:", ["\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09"]]],
  1509. messageSends: []
  1510. }, function ($methodClass){ return function (aClass,anotherClass){
  1511. var self=this,$self=this;
  1512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1513. return $core.withContext(function($ctx1) {
  1514. //>>excludeEnd("ctx");
  1515. var tmp = aClass.name;
  1516. aClass.name = anotherClass.name;
  1517. anotherClass.name = tmp;
  1518. ;
  1519. return self;
  1520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1521. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass})});
  1522. //>>excludeEnd("ctx");
  1523. }; }),
  1524. $globals.ClassBuilder);
  1525. $core.addMethod(
  1526. $core.method({
  1527. selector: "class:slots:",
  1528. protocol: "class definition",
  1529. //>>excludeStart("ide", pragmas.excludeIdeData);
  1530. args: ["aClass", "aCollection"],
  1531. source: "class: aClass slots: aCollection\x0a\x09self basicClass: aClass slots: aCollection.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  1532. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  1533. //>>excludeEnd("ide");
  1534. pragmas: [],
  1535. messageSends: ["basicClass:slots:", "announce:", "current", "theClass:", "new", "yourself"]
  1536. }, function ($methodClass){ return function (aClass,aCollection){
  1537. var self=this,$self=this;
  1538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1539. return $core.withContext(function($ctx1) {
  1540. //>>excludeEnd("ctx");
  1541. var $1,$2;
  1542. $self._basicClass_slots_(aClass,aCollection);
  1543. $1=$recv($globals.SystemAnnouncer)._current();
  1544. $2=$recv($globals.ClassDefinitionChanged)._new();
  1545. $recv($2)._theClass_(aClass);
  1546. $recv($1)._announce_($recv($2)._yourself());
  1547. return self;
  1548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1549. }, function($ctx1) {$ctx1.fill(self,"class:slots:",{aClass:aClass,aCollection:aCollection})});
  1550. //>>excludeEnd("ctx");
  1551. }; }),
  1552. $globals.ClassBuilder);
  1553. $core.addMethod(
  1554. $core.method({
  1555. selector: "copyClass:named:",
  1556. protocol: "copying",
  1557. //>>excludeStart("ide", pragmas.excludeIdeData);
  1558. args: ["aClass", "className"],
  1559. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09slots: aClass slots copy\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  1560. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  1561. //>>excludeEnd("ide");
  1562. pragmas: [],
  1563. messageSends: ["addSubclassOf:named:slots:package:", "superclass", "copy", "slots", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  1564. }, function ($methodClass){ return function (aClass,className){
  1565. var self=this,$self=this;
  1566. var newClass;
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. return $core.withContext(function($ctx1) {
  1569. //>>excludeEnd("ctx");
  1570. var $1,$2;
  1571. newClass=$self._addSubclassOf_named_slots_package_($recv(aClass)._superclass(),className,$recv($recv(aClass)._slots())._copy(),$recv($recv(aClass)._package())._name());
  1572. $self._copyClass_to_(aClass,newClass);
  1573. $1=$recv($globals.SystemAnnouncer)._current();
  1574. $2=$recv($globals.ClassAdded)._new();
  1575. $recv($2)._theClass_(newClass);
  1576. $recv($1)._announce_($recv($2)._yourself());
  1577. return newClass;
  1578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1579. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass})});
  1580. //>>excludeEnd("ctx");
  1581. }; }),
  1582. $globals.ClassBuilder);
  1583. $core.addMethod(
  1584. $core.method({
  1585. selector: "copyClass:to:",
  1586. protocol: "copying",
  1587. //>>excludeStart("ide", pragmas.excludeIdeData);
  1588. args: ["aClass", "anotherClass"],
  1589. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each origin = aClass ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ] ].\x0a\x09anotherClass setTraitComposition: aClass traitComposition.\x0a\x0a\x09self basicClass: anotherClass class slots: aClass class slots copy.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09each origin = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ].\x0a\x09anotherClass class setTraitComposition: aClass class traitComposition",
  1590. referencedClasses: ["Compiler"],
  1591. //>>excludeEnd("ide");
  1592. pragmas: [],
  1593. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "origin", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:slots:", "class", "copy", "slots"]
  1594. }, function ($methodClass){ return function (aClass,anotherClass){
  1595. var self=this,$self=this;
  1596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1597. return $core.withContext(function($ctx1) {
  1598. //>>excludeEnd("ctx");
  1599. $recv(anotherClass)._comment_($recv(aClass)._comment());
  1600. [$recv([$recv(aClass)._methodDictionary()
  1601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1602. ,$ctx1.sendIdx["methodDictionary"]=1
  1603. //>>excludeEnd("ctx");
  1604. ][0])._valuesDo_((function(each){
  1605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1606. return $core.withContext(function($ctx2) {
  1607. //>>excludeEnd("ctx");
  1608. if($core.assert([$recv([$recv(each)._origin()
  1609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1610. ,$ctx2.sendIdx["origin"]=1
  1611. //>>excludeEnd("ctx");
  1612. ][0]).__eq(aClass)
  1613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1614. ,$ctx2.sendIdx["="]=1
  1615. //>>excludeEnd("ctx");
  1616. ][0])){
  1617. return [$recv([$recv($globals.Compiler)._new()
  1618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1619. ,$ctx2.sendIdx["new"]=1
  1620. //>>excludeEnd("ctx");
  1621. ][0])._install_forClass_protocol_([$recv(each)._source()
  1622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1623. ,$ctx2.sendIdx["source"]=1
  1624. //>>excludeEnd("ctx");
  1625. ][0],anotherClass,[$recv(each)._protocol()
  1626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1627. ,$ctx2.sendIdx["protocol"]=1
  1628. //>>excludeEnd("ctx");
  1629. ][0])
  1630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1631. ,$ctx2.sendIdx["install:forClass:protocol:"]=1
  1632. //>>excludeEnd("ctx");
  1633. ][0];
  1634. }
  1635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1637. //>>excludeEnd("ctx");
  1638. }))
  1639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1640. ,$ctx1.sendIdx["valuesDo:"]=1
  1641. //>>excludeEnd("ctx");
  1642. ][0];
  1643. [$recv(anotherClass)._setTraitComposition_([$recv(aClass)._traitComposition()
  1644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1645. ,$ctx1.sendIdx["traitComposition"]=1
  1646. //>>excludeEnd("ctx");
  1647. ][0])
  1648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1649. ,$ctx1.sendIdx["setTraitComposition:"]=1
  1650. //>>excludeEnd("ctx");
  1651. ][0];
  1652. $self._basicClass_slots_([$recv(anotherClass)._class()
  1653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1654. ,$ctx1.sendIdx["class"]=1
  1655. //>>excludeEnd("ctx");
  1656. ][0],$recv($recv([$recv(aClass)._class()
  1657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1658. ,$ctx1.sendIdx["class"]=2
  1659. //>>excludeEnd("ctx");
  1660. ][0])._slots())._copy());
  1661. $recv($recv([$recv(aClass)._class()
  1662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1663. ,$ctx1.sendIdx["class"]=3
  1664. //>>excludeEnd("ctx");
  1665. ][0])._methodDictionary())._valuesDo_((function(each){
  1666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1667. return $core.withContext(function($ctx2) {
  1668. //>>excludeEnd("ctx");
  1669. if($core.assert($recv($recv(each)._origin()).__eq([$recv(aClass)._class()
  1670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1671. ,$ctx2.sendIdx["class"]=4
  1672. //>>excludeEnd("ctx");
  1673. ][0]))){
  1674. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),[$recv(anotherClass)._class()
  1675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1676. ,$ctx2.sendIdx["class"]=5
  1677. //>>excludeEnd("ctx");
  1678. ][0],$recv(each)._protocol());
  1679. }
  1680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1682. //>>excludeEnd("ctx");
  1683. }));
  1684. $recv([$recv(anotherClass)._class()
  1685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1686. ,$ctx1.sendIdx["class"]=6
  1687. //>>excludeEnd("ctx");
  1688. ][0])._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  1689. return self;
  1690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1691. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass})});
  1692. //>>excludeEnd("ctx");
  1693. }; }),
  1694. $globals.ClassBuilder);
  1695. $core.addMethod(
  1696. $core.method({
  1697. selector: "migrateClass:superclass:",
  1698. protocol: "class migration",
  1699. //>>excludeStart("ide", pragmas.excludeIdeData);
  1700. args: ["aClass", "anotherClass"],
  1701. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09slots: aClass slots\x0a\x09\x09package: aClass package name",
  1702. referencedClasses: [],
  1703. //>>excludeEnd("ide");
  1704. pragmas: [],
  1705. messageSends: ["migrateClassNamed:superclass:slots:package:", "name", "slots", "package"]
  1706. }, function ($methodClass){ return function (aClass,anotherClass){
  1707. var self=this,$self=this;
  1708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1709. return $core.withContext(function($ctx1) {
  1710. //>>excludeEnd("ctx");
  1711. return $self._migrateClassNamed_superclass_slots_package_([$recv(aClass)._name()
  1712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1713. ,$ctx1.sendIdx["name"]=1
  1714. //>>excludeEnd("ctx");
  1715. ][0],anotherClass,$recv(aClass)._slots(),$recv($recv(aClass)._package())._name());
  1716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1717. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass})});
  1718. //>>excludeEnd("ctx");
  1719. }; }),
  1720. $globals.ClassBuilder);
  1721. $core.addMethod(
  1722. $core.method({
  1723. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  1724. protocol: "class migration",
  1725. //>>excludeStart("ide", pragmas.excludeIdeData);
  1726. args: ["className", "aClass", "aCollection", "packageName"],
  1727. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09self deprecatedAPI: 'Use #migrateClassNamed:superclass:slots:package: instead.'.\x0a\x09^ self\x0a\x09\x09migrateClassNamed: className\x0a\x09\x09superclass: aClass\x0a\x09\x09slots: aCollection\x0a\x09\x09package: packageName",
  1728. referencedClasses: [],
  1729. //>>excludeEnd("ide");
  1730. pragmas: [],
  1731. messageSends: ["deprecatedAPI:", "migrateClassNamed:superclass:slots:package:"]
  1732. }, function ($methodClass){ return function (className,aClass,aCollection,packageName){
  1733. var self=this,$self=this;
  1734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1735. return $core.withContext(function($ctx1) {
  1736. //>>excludeEnd("ctx");
  1737. $self._deprecatedAPI_("Use #migrateClassNamed:superclass:slots:package: instead.");
  1738. return $self._migrateClassNamed_superclass_slots_package_(className,aClass,aCollection,packageName);
  1739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1740. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName})});
  1741. //>>excludeEnd("ctx");
  1742. }; }),
  1743. $globals.ClassBuilder);
  1744. $core.addMethod(
  1745. $core.method({
  1746. selector: "migrateClassNamed:superclass:slots:package:",
  1747. protocol: "class migration",
  1748. //>>excludeStart("ide", pragmas.excludeIdeData);
  1749. args: ["className", "aClass", "aCollection", "packageName"],
  1750. source: "migrateClassNamed: className superclass: aClass slots: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09slots: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09SystemAnnouncer current announce: (ClassRenamed new\x0a\x09\x09\x09\x09\x09theClass: oldClass;\x0a\x09\x09\x09\x09\x09yourself).\x0a\x09\x09\x09\x09exception pass ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  1751. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassRenamed", "ClassMigrated"],
  1752. //>>excludeEnd("ide");
  1753. pragmas: [],
  1754. messageSends: [",", "at:", "globals", "addSubclassOf:named:slots:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "announce:", "current", "theClass:", "new", "yourself", "pass", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "oldClass:"]
  1755. }, function ($methodClass){ return function (className,aClass,aCollection,packageName){
  1756. var self=this,$self=this;
  1757. var oldClass,newClass,tmp;
  1758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1759. return $core.withContext(function($ctx1) {
  1760. //>>excludeEnd("ctx");
  1761. var $1,$2,$3,$4;
  1762. tmp="new*".__comma(className);
  1763. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  1764. newClass=$self._addSubclassOf_named_slots_package_(aClass,tmp,aCollection,packageName);
  1765. [$self._basicSwapClassNames_with_(oldClass,newClass)
  1766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1767. ,$ctx1.sendIdx["basicSwapClassNames:with:"]=1
  1768. //>>excludeEnd("ctx");
  1769. ][0];
  1770. $recv((function(){
  1771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1772. return $core.withContext(function($ctx2) {
  1773. //>>excludeEnd("ctx");
  1774. return $self._copyClass_to_(oldClass,newClass);
  1775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1777. //>>excludeEnd("ctx");
  1778. }))._on_do_($globals.Error,(function(exception){
  1779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1780. return $core.withContext(function($ctx2) {
  1781. //>>excludeEnd("ctx");
  1782. $self._basicSwapClassNames_with_(oldClass,newClass);
  1783. [$self._basicRemoveClass_(newClass)
  1784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1785. ,$ctx2.sendIdx["basicRemoveClass:"]=1
  1786. //>>excludeEnd("ctx");
  1787. ][0];
  1788. $1=[$recv($globals.SystemAnnouncer)._current()
  1789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1790. ,$ctx2.sendIdx["current"]=1
  1791. //>>excludeEnd("ctx");
  1792. ][0];
  1793. $2=[$recv($globals.ClassRenamed)._new()
  1794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1795. ,$ctx2.sendIdx["new"]=1
  1796. //>>excludeEnd("ctx");
  1797. ][0];
  1798. [$recv($2)._theClass_(oldClass)
  1799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1800. ,$ctx2.sendIdx["theClass:"]=1
  1801. //>>excludeEnd("ctx");
  1802. ][0];
  1803. [$recv($1)._announce_([$recv($2)._yourself()
  1804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1805. ,$ctx2.sendIdx["yourself"]=1
  1806. //>>excludeEnd("ctx");
  1807. ][0])
  1808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1809. ,$ctx2.sendIdx["announce:"]=1
  1810. //>>excludeEnd("ctx");
  1811. ][0];
  1812. return $recv(exception)._pass();
  1813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1814. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  1815. //>>excludeEnd("ctx");
  1816. }));
  1817. [$self._rawRenameClass_to_(oldClass,tmp)
  1818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1819. ,$ctx1.sendIdx["rawRenameClass:to:"]=1
  1820. //>>excludeEnd("ctx");
  1821. ][0];
  1822. $self._rawRenameClass_to_(newClass,className);
  1823. $recv($recv(oldClass)._subclasses())._do_((function(each){
  1824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1825. return $core.withContext(function($ctx2) {
  1826. //>>excludeEnd("ctx");
  1827. return $self._migrateClass_superclass_(each,newClass);
  1828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1829. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1830. //>>excludeEnd("ctx");
  1831. }));
  1832. $self._basicRemoveClass_(oldClass);
  1833. $3=$recv($globals.SystemAnnouncer)._current();
  1834. $4=$recv($globals.ClassMigrated)._new();
  1835. $recv($4)._theClass_(newClass);
  1836. $recv($4)._oldClass_(oldClass);
  1837. $recv($3)._announce_($recv($4)._yourself());
  1838. return newClass;
  1839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1840. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:slots:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp})});
  1841. //>>excludeEnd("ctx");
  1842. }; }),
  1843. $globals.ClassBuilder);
  1844. $core.addMethod(
  1845. $core.method({
  1846. selector: "rawRenameClass:to:",
  1847. protocol: "private",
  1848. //>>excludeStart("ide", pragmas.excludeIdeData);
  1849. args: ["aClass", "aString"],
  1850. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  1851. referencedClasses: [],
  1852. //>>excludeEnd("ide");
  1853. pragmas: [["inlineJS:", ["\x0a\x09\x09$globals[aString] = aClass;\x0a\x09"]]],
  1854. messageSends: []
  1855. }, function ($methodClass){ return function (aClass,aString){
  1856. var self=this,$self=this;
  1857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1858. return $core.withContext(function($ctx1) {
  1859. //>>excludeEnd("ctx");
  1860. $globals[aString] = aClass;
  1861. ;
  1862. return self;
  1863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1864. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString})});
  1865. //>>excludeEnd("ctx");
  1866. }; }),
  1867. $globals.ClassBuilder);
  1868. $core.addMethod(
  1869. $core.method({
  1870. selector: "renameClass:to:",
  1871. protocol: "class migration",
  1872. //>>excludeStart("ide", pragmas.excludeIdeData);
  1873. args: ["aClass", "className"],
  1874. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  1875. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  1876. //>>excludeEnd("ide");
  1877. pragmas: [],
  1878. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  1879. }, function ($methodClass){ return function (aClass,className){
  1880. var self=this,$self=this;
  1881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1882. return $core.withContext(function($ctx1) {
  1883. //>>excludeEnd("ctx");
  1884. var $1,$2;
  1885. $self._basicRenameClass_to_(aClass,className);
  1886. $recv(aClass)._recompile();
  1887. $1=$recv($globals.SystemAnnouncer)._current();
  1888. $2=$recv($globals.ClassRenamed)._new();
  1889. $recv($2)._theClass_(aClass);
  1890. $recv($1)._announce_($recv($2)._yourself());
  1891. return self;
  1892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1893. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className})});
  1894. //>>excludeEnd("ctx");
  1895. }; }),
  1896. $globals.ClassBuilder);
  1897. $core.addMethod(
  1898. $core.method({
  1899. selector: "superclass:subclass:",
  1900. protocol: "class definition",
  1901. //>>excludeStart("ide", pragmas.excludeIdeData);
  1902. args: ["aClass", "className"],
  1903. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className slots: #() package: nil",
  1904. referencedClasses: [],
  1905. //>>excludeEnd("ide");
  1906. pragmas: [],
  1907. messageSends: ["superclass:subclass:slots:package:"]
  1908. }, function ($methodClass){ return function (aClass,className){
  1909. var self=this,$self=this;
  1910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1911. return $core.withContext(function($ctx1) {
  1912. //>>excludeEnd("ctx");
  1913. return $self._superclass_subclass_slots_package_(aClass,className,[],nil);
  1914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1915. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className})});
  1916. //>>excludeEnd("ctx");
  1917. }; }),
  1918. $globals.ClassBuilder);
  1919. $core.addMethod(
  1920. $core.method({
  1921. selector: "superclass:subclass:slots:package:",
  1922. protocol: "class definition",
  1923. //>>excludeStart("ide", pragmas.excludeIdeData);
  1924. args: ["aClass", "className", "aCollection", "packageName"],
  1925. source: "superclass: aClass subclass: className slots: aCollection package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className slots: aCollection\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  1926. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  1927. //>>excludeEnd("ide");
  1928. pragmas: [],
  1929. messageSends: ["addSubclassOf:named:slots:package:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  1930. }, function ($methodClass){ return function (aClass,className,aCollection,packageName){
  1931. var self=this,$self=this;
  1932. var newClass;
  1933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1934. return $core.withContext(function($ctx1) {
  1935. //>>excludeEnd("ctx");
  1936. var $1,$2,$3;
  1937. if(packageName == null || packageName.a$nil){
  1938. $1="unclassified";
  1939. } else {
  1940. $1=packageName;
  1941. }
  1942. newClass=$self._addSubclassOf_named_slots_package_(aClass,className,aCollection,$1);
  1943. $2=$recv($globals.SystemAnnouncer)._current();
  1944. $3=$recv($globals.ClassAdded)._new();
  1945. $recv($3)._theClass_(newClass);
  1946. $recv($2)._announce_($recv($3)._yourself());
  1947. return newClass;
  1948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1949. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:slots:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,newClass:newClass})});
  1950. //>>excludeEnd("ctx");
  1951. }; }),
  1952. $globals.ClassBuilder);
  1953. $core.addMethod(
  1954. $core.method({
  1955. selector: "sortClasses:",
  1956. protocol: "as yet unclassified",
  1957. //>>excludeStart("ide", pragmas.excludeIdeData);
  1958. args: ["aCollection"],
  1959. source: "sortClasses: aCollection\x0a\x09| root members |\x0a\x09root := {nil. {}}.\x0a\x09members := HashedCollection new.\x0a\x09aCollection do: [ :each | members at: each name put: {each. {}} ].\x0a\x09(aCollection asArray sorted: [ :a :b | a name <= b name ]) do: [ :each |\x0a\x09\x09| target |\x0a\x09\x09target := members\x0a\x09\x09\x09at: (each superclass ifNotNil: [ :superklass | superklass name ])\x0a\x09\x09\x09ifAbsent: [ root ].\x0a\x09\x09target second add: (members at: each name) ].\x0a\x09^ root second",
  1960. referencedClasses: ["HashedCollection"],
  1961. //>>excludeEnd("ide");
  1962. pragmas: [],
  1963. messageSends: ["new", "do:", "at:put:", "name", "sorted:", "asArray", "<=", "at:ifAbsent:", "ifNotNil:", "superclass", "add:", "second", "at:"]
  1964. }, function ($methodClass){ return function (aCollection){
  1965. var self=this,$self=this;
  1966. var root,members;
  1967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1968. return $core.withContext(function($ctx1) {
  1969. //>>excludeEnd("ctx");
  1970. var $1,$2,$3;
  1971. root=[nil,[]];
  1972. members=$recv($globals.HashedCollection)._new();
  1973. [$recv(aCollection)._do_((function(each){
  1974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1975. return $core.withContext(function($ctx2) {
  1976. //>>excludeEnd("ctx");
  1977. return $recv(members)._at_put_([$recv(each)._name()
  1978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1979. ,$ctx2.sendIdx["name"]=1
  1980. //>>excludeEnd("ctx");
  1981. ][0],[each,[]]);
  1982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1983. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1984. //>>excludeEnd("ctx");
  1985. }))
  1986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1987. ,$ctx1.sendIdx["do:"]=1
  1988. //>>excludeEnd("ctx");
  1989. ][0];
  1990. $recv($recv($recv(aCollection)._asArray())._sorted_((function(a,b){
  1991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1992. return $core.withContext(function($ctx2) {
  1993. //>>excludeEnd("ctx");
  1994. return $recv([$recv(a)._name()
  1995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1996. ,$ctx2.sendIdx["name"]=2
  1997. //>>excludeEnd("ctx");
  1998. ][0]).__lt_eq([$recv(b)._name()
  1999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2000. ,$ctx2.sendIdx["name"]=3
  2001. //>>excludeEnd("ctx");
  2002. ][0]);
  2003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2004. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  2005. //>>excludeEnd("ctx");
  2006. })))._do_((function(each){
  2007. var target;
  2008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2009. return $core.withContext(function($ctx2) {
  2010. //>>excludeEnd("ctx");
  2011. $1=members;
  2012. $2=$recv(each)._superclass();
  2013. if($2 == null || $2.a$nil){
  2014. $3=$2;
  2015. } else {
  2016. var superklass;
  2017. superklass=$2;
  2018. $3=[$recv(superklass)._name()
  2019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2020. ,$ctx2.sendIdx["name"]=4
  2021. //>>excludeEnd("ctx");
  2022. ][0];
  2023. }
  2024. target=$recv($1)._at_ifAbsent_($3,(function(){
  2025. return root;
  2026. }));
  2027. return $recv([$recv(target)._second()
  2028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2029. ,$ctx2.sendIdx["second"]=1
  2030. //>>excludeEnd("ctx");
  2031. ][0])._add_($recv(members)._at_($recv(each)._name()));
  2032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2033. }, function($ctx2) {$ctx2.fillBlock({each:each,target:target},$ctx1,3)});
  2034. //>>excludeEnd("ctx");
  2035. }));
  2036. return $recv(root)._second();
  2037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2038. }, function($ctx1) {$ctx1.fill(self,"sortClasses:",{aCollection:aCollection,root:root,members:members})});
  2039. //>>excludeEnd("ctx");
  2040. }; }),
  2041. $globals.ClassBuilder.a$cls);
  2042. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  2043. $core.addMethod(
  2044. $core.method({
  2045. selector: "allSubclassesDo:",
  2046. protocol: "enumerating",
  2047. //>>excludeStart("ide", pragmas.excludeIdeData);
  2048. args: ["aBlock"],
  2049. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  2050. referencedClasses: [],
  2051. //>>excludeEnd("ide");
  2052. pragmas: [],
  2053. messageSends: []
  2054. }, function ($methodClass){ return function (aBlock){
  2055. var self=this,$self=this;
  2056. return self;
  2057. }; }),
  2058. $globals.TBehaviorDefaults);
  2059. $core.addMethod(
  2060. $core.method({
  2061. selector: "includingPossibleMetaDo:",
  2062. protocol: "enumerating",
  2063. //>>excludeStart("ide", pragmas.excludeIdeData);
  2064. args: ["aBlock"],
  2065. source: "includingPossibleMetaDo: aBlock\x0a\x09\x22Default for non-classes.\x22\x0a\x09aBlock value: self",
  2066. referencedClasses: [],
  2067. //>>excludeEnd("ide");
  2068. pragmas: [],
  2069. messageSends: ["value:"]
  2070. }, function ($methodClass){ return function (aBlock){
  2071. var self=this,$self=this;
  2072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2073. return $core.withContext(function($ctx1) {
  2074. //>>excludeEnd("ctx");
  2075. $recv(aBlock)._value_(self);
  2076. return self;
  2077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2078. }, function($ctx1) {$ctx1.fill(self,"includingPossibleMetaDo:",{aBlock:aBlock})});
  2079. //>>excludeEnd("ctx");
  2080. }; }),
  2081. $globals.TBehaviorDefaults);
  2082. $core.addMethod(
  2083. $core.method({
  2084. selector: "name",
  2085. protocol: "accessing",
  2086. //>>excludeStart("ide", pragmas.excludeIdeData);
  2087. args: [],
  2088. source: "name\x0a\x09^ nil",
  2089. referencedClasses: [],
  2090. //>>excludeEnd("ide");
  2091. pragmas: [],
  2092. messageSends: []
  2093. }, function ($methodClass){ return function (){
  2094. var self=this,$self=this;
  2095. return nil;
  2096. }; }),
  2097. $globals.TBehaviorDefaults);
  2098. $core.addMethod(
  2099. $core.method({
  2100. selector: "printOn:",
  2101. protocol: "printing",
  2102. //>>excludeStart("ide", pragmas.excludeIdeData);
  2103. args: ["aStream"],
  2104. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  2105. referencedClasses: [],
  2106. //>>excludeEnd("ide");
  2107. pragmas: [],
  2108. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  2109. }, function ($methodClass){ return function (aStream){
  2110. var self=this,$self=this;
  2111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2112. return $core.withContext(function($ctx1) {
  2113. //>>excludeEnd("ctx");
  2114. var $1;
  2115. $1=$self._name();
  2116. if($1 == null || $1.a$nil){
  2117. [(
  2118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2119. $ctx1.supercall = true,
  2120. //>>excludeEnd("ctx");
  2121. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  2122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2123. ,$ctx1.supercall = false
  2124. //>>excludeEnd("ctx");
  2125. ][0];
  2126. } else {
  2127. var name;
  2128. name=$1;
  2129. $recv(aStream)._nextPutAll_(name);
  2130. }
  2131. return self;
  2132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2133. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2134. //>>excludeEnd("ctx");
  2135. }; }),
  2136. $globals.TBehaviorDefaults);
  2137. $core.addMethod(
  2138. $core.method({
  2139. selector: "slots",
  2140. protocol: "accessing",
  2141. //>>excludeStart("ide", pragmas.excludeIdeData);
  2142. args: [],
  2143. source: "slots\x0a\x09\x22Default for non-classes; to be able to send #slots to any class / trait.\x22\x0a\x09^ #()",
  2144. referencedClasses: [],
  2145. //>>excludeEnd("ide");
  2146. pragmas: [],
  2147. messageSends: []
  2148. }, function ($methodClass){ return function (){
  2149. var self=this,$self=this;
  2150. return [];
  2151. }; }),
  2152. $globals.TBehaviorDefaults);
  2153. $core.addMethod(
  2154. $core.method({
  2155. selector: "superclass",
  2156. protocol: "accessing",
  2157. //>>excludeStart("ide", pragmas.excludeIdeData);
  2158. args: [],
  2159. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  2160. referencedClasses: [],
  2161. //>>excludeEnd("ide");
  2162. pragmas: [],
  2163. messageSends: []
  2164. }, function ($methodClass){ return function (){
  2165. var self=this,$self=this;
  2166. return nil;
  2167. }; }),
  2168. $globals.TBehaviorDefaults);
  2169. $core.addMethod(
  2170. $core.method({
  2171. selector: "traitUsers",
  2172. protocol: "accessing",
  2173. //>>excludeStart("ide", pragmas.excludeIdeData);
  2174. args: [],
  2175. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  2176. referencedClasses: [],
  2177. //>>excludeEnd("ide");
  2178. pragmas: [],
  2179. messageSends: []
  2180. }, function ($methodClass){ return function (){
  2181. var self=this,$self=this;
  2182. return [];
  2183. }; }),
  2184. $globals.TBehaviorDefaults);
  2185. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  2186. //>>excludeStart("ide", pragmas.excludeIdeData);
  2187. $globals.TBehaviorProvider.comment="I have method dictionary, slots and organization.";
  2188. //>>excludeEnd("ide");
  2189. $core.addMethod(
  2190. $core.method({
  2191. selector: ">>",
  2192. protocol: "accessing",
  2193. //>>excludeStart("ide", pragmas.excludeIdeData);
  2194. args: ["aString"],
  2195. source: ">> aString\x0a\x09^ self methodAt: aString",
  2196. referencedClasses: [],
  2197. //>>excludeEnd("ide");
  2198. pragmas: [],
  2199. messageSends: ["methodAt:"]
  2200. }, function ($methodClass){ return function (aString){
  2201. var self=this,$self=this;
  2202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2203. return $core.withContext(function($ctx1) {
  2204. //>>excludeEnd("ctx");
  2205. return $self._methodAt_(aString);
  2206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2207. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString})});
  2208. //>>excludeEnd("ctx");
  2209. }; }),
  2210. $globals.TBehaviorProvider);
  2211. $core.addMethod(
  2212. $core.method({
  2213. selector: "addCompiledMethod:",
  2214. protocol: "compiling",
  2215. //>>excludeStart("ide", pragmas.excludeIdeData);
  2216. args: ["aMethod"],
  2217. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  2218. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  2219. //>>excludeEnd("ide");
  2220. pragmas: [],
  2221. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  2222. }, function ($methodClass){ return function (aMethod){
  2223. var self=this,$self=this;
  2224. var oldMethod,announcement;
  2225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2226. return $core.withContext(function($ctx1) {
  2227. //>>excludeEnd("ctx");
  2228. var $1,$2,$3;
  2229. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  2230. return nil;
  2231. }));
  2232. $self._basicAddCompiledMethod_(aMethod);
  2233. $1=oldMethod;
  2234. if($1 == null || $1.a$nil){
  2235. $2=[$recv($globals.MethodAdded)._new()
  2236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2237. ,$ctx1.sendIdx["new"]=1
  2238. //>>excludeEnd("ctx");
  2239. ][0];
  2240. [$recv($2)._method_(aMethod)
  2241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2242. ,$ctx1.sendIdx["method:"]=1
  2243. //>>excludeEnd("ctx");
  2244. ][0];
  2245. announcement=[$recv($2)._yourself()
  2246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2247. ,$ctx1.sendIdx["yourself"]=1
  2248. //>>excludeEnd("ctx");
  2249. ][0];
  2250. } else {
  2251. $3=$recv($globals.MethodModified)._new();
  2252. $recv($3)._oldMethod_(oldMethod);
  2253. $recv($3)._method_(aMethod);
  2254. announcement=$recv($3)._yourself();
  2255. }
  2256. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  2257. return self;
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement})});
  2260. //>>excludeEnd("ctx");
  2261. }; }),
  2262. $globals.TBehaviorProvider);
  2263. $core.addMethod(
  2264. $core.method({
  2265. selector: "allInstanceVariableNames",
  2266. protocol: "accessing",
  2267. //>>excludeStart("ide", pragmas.excludeIdeData);
  2268. args: [],
  2269. source: "allInstanceVariableNames\x0a\x09^ self allSlots select: #isString",
  2270. referencedClasses: [],
  2271. //>>excludeEnd("ide");
  2272. pragmas: [],
  2273. messageSends: ["select:", "allSlots"]
  2274. }, function ($methodClass){ return function (){
  2275. var self=this,$self=this;
  2276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2277. return $core.withContext(function($ctx1) {
  2278. //>>excludeEnd("ctx");
  2279. return $recv($self._allSlots())._select_("isString");
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{})});
  2282. //>>excludeEnd("ctx");
  2283. }; }),
  2284. $globals.TBehaviorProvider);
  2285. $core.addMethod(
  2286. $core.method({
  2287. selector: "allSlotNames",
  2288. protocol: "accessing",
  2289. //>>excludeStart("ide", pragmas.excludeIdeData);
  2290. args: [],
  2291. source: "allSlotNames\x0a\x09^ self allSlots",
  2292. referencedClasses: [],
  2293. //>>excludeEnd("ide");
  2294. pragmas: [],
  2295. messageSends: ["allSlots"]
  2296. }, function ($methodClass){ return function (){
  2297. var self=this,$self=this;
  2298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2299. return $core.withContext(function($ctx1) {
  2300. //>>excludeEnd("ctx");
  2301. return $self._allSlots();
  2302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2303. }, function($ctx1) {$ctx1.fill(self,"allSlotNames",{})});
  2304. //>>excludeEnd("ctx");
  2305. }; }),
  2306. $globals.TBehaviorProvider);
  2307. $core.addMethod(
  2308. $core.method({
  2309. selector: "allSlots",
  2310. protocol: "accessing",
  2311. //>>excludeStart("ide", pragmas.excludeIdeData);
  2312. args: [],
  2313. source: "allSlots\x0a\x09| result |\x0a\x09result := self slots copy.\x0a\x09self superclass ifNotNil: [ :s | result addAll: s allSlots ].\x0a\x09^ result",
  2314. referencedClasses: [],
  2315. //>>excludeEnd("ide");
  2316. pragmas: [],
  2317. messageSends: ["copy", "slots", "ifNotNil:", "superclass", "addAll:", "allSlots"]
  2318. }, function ($methodClass){ return function (){
  2319. var self=this,$self=this;
  2320. var result;
  2321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2322. return $core.withContext(function($ctx1) {
  2323. //>>excludeEnd("ctx");
  2324. var $1;
  2325. result=$recv($self._slots())._copy();
  2326. $1=$self._superclass();
  2327. if($1 == null || $1.a$nil){
  2328. $1;
  2329. } else {
  2330. var s;
  2331. s=$1;
  2332. $recv(result)._addAll_($recv(s)._allSlots());
  2333. }
  2334. return result;
  2335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2336. }, function($ctx1) {$ctx1.fill(self,"allSlots",{result:result})});
  2337. //>>excludeEnd("ctx");
  2338. }; }),
  2339. $globals.TBehaviorProvider);
  2340. $core.addMethod(
  2341. $core.method({
  2342. selector: "basicAddCompiledMethod:",
  2343. protocol: "private",
  2344. //>>excludeStart("ide", pragmas.excludeIdeData);
  2345. args: ["aMethod"],
  2346. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  2347. referencedClasses: [],
  2348. //>>excludeEnd("ide");
  2349. pragmas: [["inlineJS:", ["$core.addMethod(aMethod, self)"]]],
  2350. messageSends: []
  2351. }, function ($methodClass){ return function (aMethod){
  2352. var self=this,$self=this;
  2353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2354. return $core.withContext(function($ctx1) {
  2355. //>>excludeEnd("ctx");
  2356. $core.addMethod(aMethod, self);
  2357. return self;
  2358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2359. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod})});
  2360. //>>excludeEnd("ctx");
  2361. }; }),
  2362. $globals.TBehaviorProvider);
  2363. $core.addMethod(
  2364. $core.method({
  2365. selector: "basicRemoveCompiledMethod:",
  2366. protocol: "private",
  2367. //>>excludeStart("ide", pragmas.excludeIdeData);
  2368. args: ["aMethod"],
  2369. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  2370. referencedClasses: [],
  2371. //>>excludeEnd("ide");
  2372. pragmas: [["inlineJS:", ["$core.removeMethod(aMethod,self)"]]],
  2373. messageSends: []
  2374. }, function ($methodClass){ return function (aMethod){
  2375. var self=this,$self=this;
  2376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2377. return $core.withContext(function($ctx1) {
  2378. //>>excludeEnd("ctx");
  2379. $core.removeMethod(aMethod,self);
  2380. return self;
  2381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2382. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod})});
  2383. //>>excludeEnd("ctx");
  2384. }; }),
  2385. $globals.TBehaviorProvider);
  2386. $core.addMethod(
  2387. $core.method({
  2388. selector: "compile:protocol:",
  2389. protocol: "compiling",
  2390. //>>excludeStart("ide", pragmas.excludeIdeData);
  2391. args: ["aString", "anotherString"],
  2392. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  2393. referencedClasses: ["Compiler"],
  2394. //>>excludeEnd("ide");
  2395. pragmas: [],
  2396. messageSends: ["install:forClass:protocol:", "new"]
  2397. }, function ($methodClass){ return function (aString,anotherString){
  2398. var self=this,$self=this;
  2399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2400. return $core.withContext(function($ctx1) {
  2401. //>>excludeEnd("ctx");
  2402. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  2403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2404. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString})});
  2405. //>>excludeEnd("ctx");
  2406. }; }),
  2407. $globals.TBehaviorProvider);
  2408. $core.addMethod(
  2409. $core.method({
  2410. selector: "includesSelector:",
  2411. protocol: "testing",
  2412. //>>excludeStart("ide", pragmas.excludeIdeData);
  2413. args: ["aString"],
  2414. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  2415. referencedClasses: [],
  2416. //>>excludeEnd("ide");
  2417. pragmas: [],
  2418. messageSends: ["includesKey:", "methodDictionary"]
  2419. }, function ($methodClass){ return function (aString){
  2420. var self=this,$self=this;
  2421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2422. return $core.withContext(function($ctx1) {
  2423. //>>excludeEnd("ctx");
  2424. return $recv($self._methodDictionary())._includesKey_(aString);
  2425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2426. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString})});
  2427. //>>excludeEnd("ctx");
  2428. }; }),
  2429. $globals.TBehaviorProvider);
  2430. $core.addMethod(
  2431. $core.method({
  2432. selector: "instanceVariableNames",
  2433. protocol: "accessing",
  2434. //>>excludeStart("ide", pragmas.excludeIdeData);
  2435. args: [],
  2436. source: "instanceVariableNames\x0a\x09^ self slots select: #isString",
  2437. referencedClasses: [],
  2438. //>>excludeEnd("ide");
  2439. pragmas: [],
  2440. messageSends: ["select:", "slots"]
  2441. }, function ($methodClass){ return function (){
  2442. var self=this,$self=this;
  2443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2444. return $core.withContext(function($ctx1) {
  2445. //>>excludeEnd("ctx");
  2446. return $recv($self._slots())._select_("isString");
  2447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2448. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{})});
  2449. //>>excludeEnd("ctx");
  2450. }; }),
  2451. $globals.TBehaviorProvider);
  2452. $core.addMethod(
  2453. $core.method({
  2454. selector: "methodAt:",
  2455. protocol: "accessing",
  2456. //>>excludeStart("ide", pragmas.excludeIdeData);
  2457. args: ["aString"],
  2458. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  2459. referencedClasses: [],
  2460. //>>excludeEnd("ide");
  2461. pragmas: [],
  2462. messageSends: ["at:", "methodDictionary"]
  2463. }, function ($methodClass){ return function (aString){
  2464. var self=this,$self=this;
  2465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2466. return $core.withContext(function($ctx1) {
  2467. //>>excludeEnd("ctx");
  2468. return $recv($self._methodDictionary())._at_(aString);
  2469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2470. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString})});
  2471. //>>excludeEnd("ctx");
  2472. }; }),
  2473. $globals.TBehaviorProvider);
  2474. $core.addMethod(
  2475. $core.method({
  2476. selector: "methodDictionary",
  2477. protocol: "accessing",
  2478. //>>excludeStart("ide", pragmas.excludeIdeData);
  2479. args: [],
  2480. source: "methodDictionary\x0a\x09<inlineJS: 'var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict'>",
  2481. referencedClasses: [],
  2482. //>>excludeEnd("ide");
  2483. pragmas: [["inlineJS:", ["var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict"]]],
  2484. messageSends: []
  2485. }, function ($methodClass){ return function (){
  2486. var self=this,$self=this;
  2487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2488. return $core.withContext(function($ctx1) {
  2489. //>>excludeEnd("ctx");
  2490. var dict = $globals.HashedCollection._new();
  2491. var methods = self.methods;
  2492. Object.keys(methods).forEach(function(i) {
  2493. if(methods[i].selector) {
  2494. dict._at_put_(methods[i].selector, methods[i]);
  2495. }
  2496. });
  2497. return dict;
  2498. return self;
  2499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2500. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{})});
  2501. //>>excludeEnd("ctx");
  2502. }; }),
  2503. $globals.TBehaviorProvider);
  2504. $core.addMethod(
  2505. $core.method({
  2506. selector: "methodOrganizationEnter:andLeave:",
  2507. protocol: "accessing",
  2508. //>>excludeStart("ide", pragmas.excludeIdeData);
  2509. args: ["aMethod", "oldMethod"],
  2510. source: "methodOrganizationEnter: aMethod andLeave: oldMethod\x0a\x09aMethod ifNotNil: [\x0a\x09\x09self organization addElement: aMethod protocol ].\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ]",
  2511. referencedClasses: [],
  2512. //>>excludeEnd("ide");
  2513. pragmas: [],
  2514. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  2515. }, function ($methodClass){ return function (aMethod,oldMethod){
  2516. var self=this,$self=this;
  2517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2518. return $core.withContext(function($ctx1) {
  2519. //>>excludeEnd("ctx");
  2520. if(aMethod == null || aMethod.a$nil){
  2521. aMethod;
  2522. } else {
  2523. $recv($self._organization())._addElement_([$recv(aMethod)._protocol()
  2524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2525. ,$ctx1.sendIdx["protocol"]=1
  2526. //>>excludeEnd("ctx");
  2527. ][0]);
  2528. }
  2529. if(oldMethod == null || oldMethod.a$nil){
  2530. oldMethod;
  2531. } else {
  2532. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  2533. }
  2534. return self;
  2535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2536. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod})});
  2537. //>>excludeEnd("ctx");
  2538. }; }),
  2539. $globals.TBehaviorProvider);
  2540. $core.addMethod(
  2541. $core.method({
  2542. selector: "methodTemplate",
  2543. protocol: "accessing",
  2544. //>>excludeStart("ide", pragmas.excludeIdeData);
  2545. args: [],
  2546. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: 'messageSelectorAndArgumentNames'; lf;\x0a\x09\x09tab; write: '\x22comment stating purpose of message\x22'; lf;\x0a\x09\x09lf;\x0a\x09\x09tab; write: '| temporary variable names |'; lf;\x0a\x09\x09tab; write: 'statements' ]",
  2547. referencedClasses: ["String"],
  2548. //>>excludeEnd("ide");
  2549. pragmas: [],
  2550. messageSends: ["streamContents:", "write:", "lf", "tab"]
  2551. }, function ($methodClass){ return function (){
  2552. var self=this,$self=this;
  2553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2554. return $core.withContext(function($ctx1) {
  2555. //>>excludeEnd("ctx");
  2556. return $recv($globals.String)._streamContents_((function(stream){
  2557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2558. return $core.withContext(function($ctx2) {
  2559. //>>excludeEnd("ctx");
  2560. [$recv(stream)._write_("messageSelectorAndArgumentNames")
  2561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2562. ,$ctx2.sendIdx["write:"]=1
  2563. //>>excludeEnd("ctx");
  2564. ][0];
  2565. [$recv(stream)._lf()
  2566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2567. ,$ctx2.sendIdx["lf"]=1
  2568. //>>excludeEnd("ctx");
  2569. ][0];
  2570. [$recv(stream)._tab()
  2571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2572. ,$ctx2.sendIdx["tab"]=1
  2573. //>>excludeEnd("ctx");
  2574. ][0];
  2575. [$recv(stream)._write_("\x22comment stating purpose of message\x22")
  2576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2577. ,$ctx2.sendIdx["write:"]=2
  2578. //>>excludeEnd("ctx");
  2579. ][0];
  2580. [$recv(stream)._lf()
  2581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2582. ,$ctx2.sendIdx["lf"]=2
  2583. //>>excludeEnd("ctx");
  2584. ][0];
  2585. [$recv(stream)._lf()
  2586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2587. ,$ctx2.sendIdx["lf"]=3
  2588. //>>excludeEnd("ctx");
  2589. ][0];
  2590. [$recv(stream)._tab()
  2591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2592. ,$ctx2.sendIdx["tab"]=2
  2593. //>>excludeEnd("ctx");
  2594. ][0];
  2595. [$recv(stream)._write_("| temporary variable names |")
  2596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2597. ,$ctx2.sendIdx["write:"]=3
  2598. //>>excludeEnd("ctx");
  2599. ][0];
  2600. $recv(stream)._lf();
  2601. $recv(stream)._tab();
  2602. return $recv(stream)._write_("statements");
  2603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2604. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  2605. //>>excludeEnd("ctx");
  2606. }));
  2607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2608. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{})});
  2609. //>>excludeEnd("ctx");
  2610. }; }),
  2611. $globals.TBehaviorProvider);
  2612. $core.addMethod(
  2613. $core.method({
  2614. selector: "methods",
  2615. protocol: "accessing",
  2616. //>>excludeStart("ide", pragmas.excludeIdeData);
  2617. args: [],
  2618. source: "methods\x0a\x09^ self methodDictionary values",
  2619. referencedClasses: [],
  2620. //>>excludeEnd("ide");
  2621. pragmas: [],
  2622. messageSends: ["values", "methodDictionary"]
  2623. }, function ($methodClass){ return function (){
  2624. var self=this,$self=this;
  2625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2626. return $core.withContext(function($ctx1) {
  2627. //>>excludeEnd("ctx");
  2628. return $recv($self._methodDictionary())._values();
  2629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2630. }, function($ctx1) {$ctx1.fill(self,"methods",{})});
  2631. //>>excludeEnd("ctx");
  2632. }; }),
  2633. $globals.TBehaviorProvider);
  2634. $core.addMethod(
  2635. $core.method({
  2636. selector: "methodsInProtocol:",
  2637. protocol: "accessing",
  2638. //>>excludeStart("ide", pragmas.excludeIdeData);
  2639. args: ["aString"],
  2640. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  2641. referencedClasses: [],
  2642. //>>excludeEnd("ide");
  2643. pragmas: [],
  2644. messageSends: ["select:", "methods", "=", "protocol"]
  2645. }, function ($methodClass){ return function (aString){
  2646. var self=this,$self=this;
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. return $core.withContext(function($ctx1) {
  2649. //>>excludeEnd("ctx");
  2650. return $recv($self._methods())._select_((function(each){
  2651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2652. return $core.withContext(function($ctx2) {
  2653. //>>excludeEnd("ctx");
  2654. return $recv($recv(each)._protocol()).__eq(aString);
  2655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2656. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2657. //>>excludeEnd("ctx");
  2658. }));
  2659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2660. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString})});
  2661. //>>excludeEnd("ctx");
  2662. }; }),
  2663. $globals.TBehaviorProvider);
  2664. $core.addMethod(
  2665. $core.method({
  2666. selector: "organization",
  2667. protocol: "accessing",
  2668. //>>excludeStart("ide", pragmas.excludeIdeData);
  2669. args: [],
  2670. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  2671. referencedClasses: ["ClassOrganizer"],
  2672. //>>excludeEnd("ide");
  2673. pragmas: [],
  2674. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  2675. }, function ($methodClass){ return function (){
  2676. var self=this,$self=this;
  2677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2678. return $core.withContext(function($ctx1) {
  2679. //>>excludeEnd("ctx");
  2680. var $1;
  2681. $1=[$self._basicOrganization()
  2682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2683. ,$ctx1.sendIdx["basicOrganization"]=1
  2684. //>>excludeEnd("ctx");
  2685. ][0];
  2686. if($1 == null || $1.a$nil){
  2687. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  2688. return $self._basicOrganization();
  2689. } else {
  2690. return $1;
  2691. }
  2692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2693. }, function($ctx1) {$ctx1.fill(self,"organization",{})});
  2694. //>>excludeEnd("ctx");
  2695. }; }),
  2696. $globals.TBehaviorProvider);
  2697. $core.addMethod(
  2698. $core.method({
  2699. selector: "ownMethods",
  2700. protocol: "accessing",
  2701. //>>excludeStart("ide", pragmas.excludeIdeData);
  2702. args: [],
  2703. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x0a\x09nor obtained via trait composition\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self ownMethodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  2704. referencedClasses: ["OrderedCollection"],
  2705. //>>excludeEnd("ide");
  2706. pragmas: [],
  2707. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  2708. }, function ($methodClass){ return function (){
  2709. var self=this,$self=this;
  2710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2711. return $core.withContext(function($ctx1) {
  2712. //>>excludeEnd("ctx");
  2713. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  2714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2715. return $core.withContext(function($ctx2) {
  2716. //>>excludeEnd("ctx");
  2717. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  2718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2719. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  2720. //>>excludeEnd("ctx");
  2721. })))._sorted_((function(a,b){
  2722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2723. return $core.withContext(function($ctx2) {
  2724. //>>excludeEnd("ctx");
  2725. return $recv([$recv(a)._selector()
  2726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2727. ,$ctx2.sendIdx["selector"]=1
  2728. //>>excludeEnd("ctx");
  2729. ][0]).__lt_eq($recv(b)._selector());
  2730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2731. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  2732. //>>excludeEnd("ctx");
  2733. }));
  2734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2735. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{})});
  2736. //>>excludeEnd("ctx");
  2737. }; }),
  2738. $globals.TBehaviorProvider);
  2739. $core.addMethod(
  2740. $core.method({
  2741. selector: "ownMethodsInProtocol:",
  2742. protocol: "accessing",
  2743. //>>excludeStart("ide", pragmas.excludeIdeData);
  2744. args: ["aString"],
  2745. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each origin = self ]",
  2746. referencedClasses: [],
  2747. //>>excludeEnd("ide");
  2748. pragmas: [],
  2749. messageSends: ["select:", "methodsInProtocol:", "=", "origin"]
  2750. }, function ($methodClass){ return function (aString){
  2751. var self=this,$self=this;
  2752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2753. return $core.withContext(function($ctx1) {
  2754. //>>excludeEnd("ctx");
  2755. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  2756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2757. return $core.withContext(function($ctx2) {
  2758. //>>excludeEnd("ctx");
  2759. return $recv($recv(each)._origin()).__eq(self);
  2760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2762. //>>excludeEnd("ctx");
  2763. }));
  2764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2765. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString})});
  2766. //>>excludeEnd("ctx");
  2767. }; }),
  2768. $globals.TBehaviorProvider);
  2769. $core.addMethod(
  2770. $core.method({
  2771. selector: "ownProtocols",
  2772. protocol: "accessing",
  2773. //>>excludeStart("ide", pragmas.excludeIdeData);
  2774. args: [],
  2775. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  2776. referencedClasses: [],
  2777. //>>excludeEnd("ide");
  2778. pragmas: [],
  2779. messageSends: ["reject:", "protocols", "match:"]
  2780. }, function ($methodClass){ return function (){
  2781. var self=this,$self=this;
  2782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2783. return $core.withContext(function($ctx1) {
  2784. //>>excludeEnd("ctx");
  2785. return $recv($self._protocols())._reject_((function(each){
  2786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2787. return $core.withContext(function($ctx2) {
  2788. //>>excludeEnd("ctx");
  2789. return $recv(each)._match_("^\x5c*");
  2790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2791. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2792. //>>excludeEnd("ctx");
  2793. }));
  2794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2795. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{})});
  2796. //>>excludeEnd("ctx");
  2797. }; }),
  2798. $globals.TBehaviorProvider);
  2799. $core.addMethod(
  2800. $core.method({
  2801. selector: "packageOfProtocol:",
  2802. protocol: "accessing",
  2803. //>>excludeStart("ide", pragmas.excludeIdeData);
  2804. args: ["aString"],
  2805. source: "packageOfProtocol: aString\x0a\x09\x22Answer the package the method of receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the receiver's package\x22\x0a\x09\x0a\x09(aString beginsWith: '*') ifFalse: [\x0a\x09\x09^ self package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: aString allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  2806. referencedClasses: ["Package"],
  2807. //>>excludeEnd("ide");
  2808. pragmas: [],
  2809. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  2810. }, function ($methodClass){ return function (aString){
  2811. var self=this,$self=this;
  2812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2813. return $core.withContext(function($ctx1) {
  2814. //>>excludeEnd("ctx");
  2815. if(!$core.assert($recv(aString)._beginsWith_("*"))){
  2816. return $self._package();
  2817. }
  2818. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  2819. return nil;
  2820. }));
  2821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2822. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString})});
  2823. //>>excludeEnd("ctx");
  2824. }; }),
  2825. $globals.TBehaviorProvider);
  2826. $core.addMethod(
  2827. $core.method({
  2828. selector: "protocols",
  2829. protocol: "accessing",
  2830. //>>excludeStart("ide", pragmas.excludeIdeData);
  2831. args: [],
  2832. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  2833. referencedClasses: [],
  2834. //>>excludeEnd("ide");
  2835. pragmas: [],
  2836. messageSends: ["sorted", "asArray", "elements", "organization"]
  2837. }, function ($methodClass){ return function (){
  2838. var self=this,$self=this;
  2839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2840. return $core.withContext(function($ctx1) {
  2841. //>>excludeEnd("ctx");
  2842. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  2843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2844. }, function($ctx1) {$ctx1.fill(self,"protocols",{})});
  2845. //>>excludeEnd("ctx");
  2846. }; }),
  2847. $globals.TBehaviorProvider);
  2848. $core.addMethod(
  2849. $core.method({
  2850. selector: "protocolsDo:",
  2851. protocol: "enumerating",
  2852. //>>excludeStart("ide", pragmas.excludeIdeData);
  2853. args: ["aBlock"],
  2854. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  2855. referencedClasses: ["HashedCollection", "Array"],
  2856. //>>excludeEnd("ide");
  2857. pragmas: [],
  2858. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  2859. }, function ($methodClass){ return function (aBlock){
  2860. var self=this,$self=this;
  2861. var methodsByProtocol;
  2862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2863. return $core.withContext(function($ctx1) {
  2864. //>>excludeEnd("ctx");
  2865. methodsByProtocol=[$recv($globals.HashedCollection)._new()
  2866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2867. ,$ctx1.sendIdx["new"]=1
  2868. //>>excludeEnd("ctx");
  2869. ][0];
  2870. $recv($self._methodDictionary())._valuesDo_((function(m){
  2871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2872. return $core.withContext(function($ctx2) {
  2873. //>>excludeEnd("ctx");
  2874. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  2875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2876. return $core.withContext(function($ctx3) {
  2877. //>>excludeEnd("ctx");
  2878. return $recv($globals.Array)._new();
  2879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2880. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2881. //>>excludeEnd("ctx");
  2882. })))._add_(m);
  2883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2884. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  2885. //>>excludeEnd("ctx");
  2886. }));
  2887. $recv($self._protocols())._do_((function(protocol){
  2888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2889. return $core.withContext(function($ctx2) {
  2890. //>>excludeEnd("ctx");
  2891. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  2892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2893. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  2894. //>>excludeEnd("ctx");
  2895. }));
  2896. return self;
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol})});
  2899. //>>excludeEnd("ctx");
  2900. }; }),
  2901. $globals.TBehaviorProvider);
  2902. $core.addMethod(
  2903. $core.method({
  2904. selector: "recompile",
  2905. protocol: "compiling",
  2906. //>>excludeStart("ide", pragmas.excludeIdeData);
  2907. args: [],
  2908. source: "recompile\x0a\x09^ Compiler new recompile: self",
  2909. referencedClasses: ["Compiler"],
  2910. //>>excludeEnd("ide");
  2911. pragmas: [],
  2912. messageSends: ["recompile:", "new"]
  2913. }, function ($methodClass){ return function (){
  2914. var self=this,$self=this;
  2915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2916. return $core.withContext(function($ctx1) {
  2917. //>>excludeEnd("ctx");
  2918. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  2919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2920. }, function($ctx1) {$ctx1.fill(self,"recompile",{})});
  2921. //>>excludeEnd("ctx");
  2922. }; }),
  2923. $globals.TBehaviorProvider);
  2924. $core.addMethod(
  2925. $core.method({
  2926. selector: "removeCompiledMethod:",
  2927. protocol: "compiling",
  2928. //>>excludeStart("ide", pragmas.excludeIdeData);
  2929. args: ["aMethod"],
  2930. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  2931. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  2932. //>>excludeEnd("ide");
  2933. pragmas: [],
  2934. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  2935. }, function ($methodClass){ return function (aMethod){
  2936. var self=this,$self=this;
  2937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2938. return $core.withContext(function($ctx1) {
  2939. //>>excludeEnd("ctx");
  2940. var $1,$2;
  2941. $self._basicRemoveCompiledMethod_(aMethod);
  2942. $1=$recv($globals.SystemAnnouncer)._current();
  2943. $2=$recv($globals.MethodRemoved)._new();
  2944. $recv($2)._method_(aMethod);
  2945. $recv($1)._announce_($recv($2)._yourself());
  2946. return self;
  2947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2948. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod})});
  2949. //>>excludeEnd("ctx");
  2950. }; }),
  2951. $globals.TBehaviorProvider);
  2952. $core.addMethod(
  2953. $core.method({
  2954. selector: "removeProtocolIfEmpty:",
  2955. protocol: "accessing",
  2956. //>>excludeStart("ide", pragmas.excludeIdeData);
  2957. args: ["aString"],
  2958. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  2959. referencedClasses: [],
  2960. //>>excludeEnd("ide");
  2961. pragmas: [],
  2962. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  2963. }, function ($methodClass){ return function (aString){
  2964. var self=this,$self=this;
  2965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2966. return $core.withContext(function($ctx1) {
  2967. //>>excludeEnd("ctx");
  2968. $recv($self._methods())._detect_ifNone_((function(each){
  2969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2970. return $core.withContext(function($ctx2) {
  2971. //>>excludeEnd("ctx");
  2972. return $recv($recv(each)._protocol()).__eq(aString);
  2973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2974. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2975. //>>excludeEnd("ctx");
  2976. }),(function(){
  2977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2978. return $core.withContext(function($ctx2) {
  2979. //>>excludeEnd("ctx");
  2980. return $recv($self._organization())._removeElement_(aString);
  2981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2983. //>>excludeEnd("ctx");
  2984. }));
  2985. return self;
  2986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2987. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString})});
  2988. //>>excludeEnd("ctx");
  2989. }; }),
  2990. $globals.TBehaviorProvider);
  2991. $core.addMethod(
  2992. $core.method({
  2993. selector: "selectors",
  2994. protocol: "accessing",
  2995. //>>excludeStart("ide", pragmas.excludeIdeData);
  2996. args: [],
  2997. source: "selectors\x0a\x09^ self methodDictionary keys",
  2998. referencedClasses: [],
  2999. //>>excludeEnd("ide");
  3000. pragmas: [],
  3001. messageSends: ["keys", "methodDictionary"]
  3002. }, function ($methodClass){ return function (){
  3003. var self=this,$self=this;
  3004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3005. return $core.withContext(function($ctx1) {
  3006. //>>excludeEnd("ctx");
  3007. return $recv($self._methodDictionary())._keys();
  3008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3009. }, function($ctx1) {$ctx1.fill(self,"selectors",{})});
  3010. //>>excludeEnd("ctx");
  3011. }; }),
  3012. $globals.TBehaviorProvider);
  3013. $core.addMethod(
  3014. $core.method({
  3015. selector: "setTraitComposition:",
  3016. protocol: "compiling",
  3017. //>>excludeStart("ide", pragmas.excludeIdeData);
  3018. args: ["aTraitComposition"],
  3019. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  3020. referencedClasses: [],
  3021. //>>excludeEnd("ide");
  3022. pragmas: [["inlineJS:", ["$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)"]]],
  3023. messageSends: []
  3024. }, function ($methodClass){ return function (aTraitComposition){
  3025. var self=this,$self=this;
  3026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3027. return $core.withContext(function($ctx1) {
  3028. //>>excludeEnd("ctx");
  3029. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  3030. return self;
  3031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3032. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition})});
  3033. //>>excludeEnd("ctx");
  3034. }; }),
  3035. $globals.TBehaviorProvider);
  3036. $core.addMethod(
  3037. $core.method({
  3038. selector: "slotNames",
  3039. protocol: "accessing",
  3040. //>>excludeStart("ide", pragmas.excludeIdeData);
  3041. args: [],
  3042. source: "slotNames\x0a\x09^ self slots",
  3043. referencedClasses: [],
  3044. //>>excludeEnd("ide");
  3045. pragmas: [],
  3046. messageSends: ["slots"]
  3047. }, function ($methodClass){ return function (){
  3048. var self=this,$self=this;
  3049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3050. return $core.withContext(function($ctx1) {
  3051. //>>excludeEnd("ctx");
  3052. return $self._slots();
  3053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3054. }, function($ctx1) {$ctx1.fill(self,"slotNames",{})});
  3055. //>>excludeEnd("ctx");
  3056. }; }),
  3057. $globals.TBehaviorProvider);
  3058. $core.addMethod(
  3059. $core.method({
  3060. selector: "traitComposition",
  3061. protocol: "accessing",
  3062. //>>excludeStart("ide", pragmas.excludeIdeData);
  3063. args: [],
  3064. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  3065. referencedClasses: ["TraitTransformation"],
  3066. //>>excludeEnd("ide");
  3067. pragmas: [],
  3068. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  3069. }, function ($methodClass){ return function (){
  3070. var self=this,$self=this;
  3071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3072. return $core.withContext(function($ctx1) {
  3073. //>>excludeEnd("ctx");
  3074. var $1;
  3075. $1=$self._basicAt_("traitComposition");
  3076. if($1 == null || $1.a$nil){
  3077. return [];
  3078. } else {
  3079. var aCollection;
  3080. aCollection=$1;
  3081. return $recv(aCollection)._collect_((function(each){
  3082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3083. return $core.withContext(function($ctx2) {
  3084. //>>excludeEnd("ctx");
  3085. return $recv($globals.TraitTransformation)._fromJSON_(each);
  3086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  3088. //>>excludeEnd("ctx");
  3089. }));
  3090. }
  3091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3092. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{})});
  3093. //>>excludeEnd("ctx");
  3094. }; }),
  3095. $globals.TBehaviorProvider);
  3096. $core.addMethod(
  3097. $core.method({
  3098. selector: "traitCompositionDefinition",
  3099. protocol: "accessing",
  3100. //>>excludeStart("ide", pragmas.excludeIdeData);
  3101. args: [],
  3102. source: "traitCompositionDefinition\x0a\x09^ self traitComposition ifNotEmpty: [ :traitComposition |\x0a\x09\x09String streamContents: [ :str |\x0a\x09\x09\x09str write: '{'.\x0a\x09\x09\x09traitComposition\x0a\x09\x09\x09\x09do: [ :each | str write: each definition ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ] ]",
  3103. referencedClasses: ["String"],
  3104. //>>excludeEnd("ide");
  3105. pragmas: [],
  3106. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  3107. }, function ($methodClass){ return function (){
  3108. var self=this,$self=this;
  3109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3110. return $core.withContext(function($ctx1) {
  3111. //>>excludeEnd("ctx");
  3112. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  3113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3114. return $core.withContext(function($ctx2) {
  3115. //>>excludeEnd("ctx");
  3116. return $recv($globals.String)._streamContents_((function(str){
  3117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3118. return $core.withContext(function($ctx3) {
  3119. //>>excludeEnd("ctx");
  3120. [$recv(str)._write_("{")
  3121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3122. ,$ctx3.sendIdx["write:"]=1
  3123. //>>excludeEnd("ctx");
  3124. ][0];
  3125. $recv(traitComposition)._do_separatedBy_((function(each){
  3126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3127. return $core.withContext(function($ctx4) {
  3128. //>>excludeEnd("ctx");
  3129. return [$recv(str)._write_($recv(each)._definition())
  3130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3131. ,$ctx4.sendIdx["write:"]=2
  3132. //>>excludeEnd("ctx");
  3133. ][0];
  3134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3135. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  3136. //>>excludeEnd("ctx");
  3137. }),(function(){
  3138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3139. return $core.withContext(function($ctx4) {
  3140. //>>excludeEnd("ctx");
  3141. return [$recv(str)._write_(". ")
  3142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3143. ,$ctx4.sendIdx["write:"]=3
  3144. //>>excludeEnd("ctx");
  3145. ][0];
  3146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3147. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  3148. //>>excludeEnd("ctx");
  3149. }));
  3150. return $recv(str)._write_("}");
  3151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3152. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  3153. //>>excludeEnd("ctx");
  3154. }));
  3155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3156. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  3157. //>>excludeEnd("ctx");
  3158. }));
  3159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3160. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{})});
  3161. //>>excludeEnd("ctx");
  3162. }; }),
  3163. $globals.TBehaviorProvider);
  3164. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  3165. //>>excludeStart("ide", pragmas.excludeIdeData);
  3166. $globals.TMasterBehavior.comment="I am the behavior on the instance-side of the browser.\x0a\x0aI define things like package, category, name, comment etc.\x0aas opposed to derived behaviors (metaclass, class trait, ...)\x0athat relate to me.";
  3167. //>>excludeEnd("ide");
  3168. $core.addMethod(
  3169. $core.method({
  3170. selector: "asJavaScriptSource",
  3171. protocol: "converting",
  3172. //>>excludeStart("ide", pragmas.excludeIdeData);
  3173. args: [],
  3174. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  3175. referencedClasses: [],
  3176. //>>excludeEnd("ide");
  3177. pragmas: [],
  3178. messageSends: [",", "name"]
  3179. }, function ($methodClass){ return function (){
  3180. var self=this,$self=this;
  3181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3182. return $core.withContext(function($ctx1) {
  3183. //>>excludeEnd("ctx");
  3184. return "$globals.".__comma($self._name());
  3185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3186. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3187. //>>excludeEnd("ctx");
  3188. }; }),
  3189. $globals.TMasterBehavior);
  3190. $core.addMethod(
  3191. $core.method({
  3192. selector: "browse",
  3193. protocol: "browsing",
  3194. //>>excludeStart("ide", pragmas.excludeIdeData);
  3195. args: [],
  3196. source: "browse\x0a\x09Finder findClass: self",
  3197. referencedClasses: ["Finder"],
  3198. //>>excludeEnd("ide");
  3199. pragmas: [],
  3200. messageSends: ["findClass:"]
  3201. }, function ($methodClass){ return function (){
  3202. var self=this,$self=this;
  3203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3204. return $core.withContext(function($ctx1) {
  3205. //>>excludeEnd("ctx");
  3206. $recv($globals.Finder)._findClass_(self);
  3207. return self;
  3208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3209. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  3210. //>>excludeEnd("ctx");
  3211. }; }),
  3212. $globals.TMasterBehavior);
  3213. $core.addMethod(
  3214. $core.method({
  3215. selector: "category",
  3216. protocol: "accessing",
  3217. //>>excludeStart("ide", pragmas.excludeIdeData);
  3218. args: [],
  3219. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  3220. referencedClasses: [],
  3221. //>>excludeEnd("ide");
  3222. pragmas: [],
  3223. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  3224. }, function ($methodClass){ return function (){
  3225. var self=this,$self=this;
  3226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3227. return $core.withContext(function($ctx1) {
  3228. //>>excludeEnd("ctx");
  3229. var $1;
  3230. $1=[$self._package()
  3231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3232. ,$ctx1.sendIdx["package"]=1
  3233. //>>excludeEnd("ctx");
  3234. ][0];
  3235. if($1 == null || $1.a$nil){
  3236. return "Unclassified";
  3237. } else {
  3238. return $recv($self._package())._name();
  3239. }
  3240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3241. }, function($ctx1) {$ctx1.fill(self,"category",{})});
  3242. //>>excludeEnd("ctx");
  3243. }; }),
  3244. $globals.TMasterBehavior);
  3245. $core.addMethod(
  3246. $core.method({
  3247. selector: "classTag",
  3248. protocol: "accessing",
  3249. //>>excludeStart("ide", pragmas.excludeIdeData);
  3250. args: [],
  3251. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  3252. referencedClasses: [],
  3253. //>>excludeEnd("ide");
  3254. pragmas: [],
  3255. messageSends: ["subclassResponsibility"]
  3256. }, function ($methodClass){ return function (){
  3257. var self=this,$self=this;
  3258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3259. return $core.withContext(function($ctx1) {
  3260. //>>excludeEnd("ctx");
  3261. return $self._subclassResponsibility();
  3262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3263. }, function($ctx1) {$ctx1.fill(self,"classTag",{})});
  3264. //>>excludeEnd("ctx");
  3265. }; }),
  3266. $globals.TMasterBehavior);
  3267. $core.addMethod(
  3268. $core.method({
  3269. selector: "comment",
  3270. protocol: "accessing",
  3271. //>>excludeStart("ide", pragmas.excludeIdeData);
  3272. args: [],
  3273. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  3274. referencedClasses: [],
  3275. //>>excludeEnd("ide");
  3276. pragmas: [],
  3277. messageSends: ["ifNil:", "basicAt:"]
  3278. }, function ($methodClass){ return function (){
  3279. var self=this,$self=this;
  3280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3281. return $core.withContext(function($ctx1) {
  3282. //>>excludeEnd("ctx");
  3283. var $1;
  3284. $1=$self._basicAt_("comment");
  3285. if($1 == null || $1.a$nil){
  3286. return "";
  3287. } else {
  3288. return $1;
  3289. }
  3290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3291. }, function($ctx1) {$ctx1.fill(self,"comment",{})});
  3292. //>>excludeEnd("ctx");
  3293. }; }),
  3294. $globals.TMasterBehavior);
  3295. $core.addMethod(
  3296. $core.method({
  3297. selector: "comment:",
  3298. protocol: "accessing",
  3299. //>>excludeStart("ide", pragmas.excludeIdeData);
  3300. args: ["aString"],
  3301. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  3302. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  3303. //>>excludeEnd("ide");
  3304. pragmas: [],
  3305. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  3306. }, function ($methodClass){ return function (aString){
  3307. var self=this,$self=this;
  3308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3309. return $core.withContext(function($ctx1) {
  3310. //>>excludeEnd("ctx");
  3311. var $1,$2;
  3312. $self._basicAt_put_("comment",aString);
  3313. $1=$recv($globals.SystemAnnouncer)._current();
  3314. $2=$recv($globals.ClassCommentChanged)._new();
  3315. $recv($2)._theClass_(self);
  3316. $recv($1)._announce_($recv($2)._yourself());
  3317. return self;
  3318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3319. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString})});
  3320. //>>excludeEnd("ctx");
  3321. }; }),
  3322. $globals.TMasterBehavior);
  3323. $core.addMethod(
  3324. $core.method({
  3325. selector: "definedMethods",
  3326. protocol: "accessing",
  3327. //>>excludeStart("ide", pragmas.excludeIdeData);
  3328. args: [],
  3329. source: "definedMethods\x0a\x09\x22Answers methods of me and derived 'meta' part if present\x22\x0a\x09| methods |\x0a\x09methods := self methods.\x0a\x09self theMetaClass\x0a\x09\x09ifNil: [ ^ methods ]\x0a\x09\x09ifNotNil: [ :meta | ^ methods, meta methods ]",
  3330. referencedClasses: [],
  3331. //>>excludeEnd("ide");
  3332. pragmas: [],
  3333. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  3334. }, function ($methodClass){ return function (){
  3335. var self=this,$self=this;
  3336. var methods;
  3337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3338. return $core.withContext(function($ctx1) {
  3339. //>>excludeEnd("ctx");
  3340. var $1;
  3341. methods=[$self._methods()
  3342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3343. ,$ctx1.sendIdx["methods"]=1
  3344. //>>excludeEnd("ctx");
  3345. ][0];
  3346. $1=$self._theMetaClass();
  3347. if($1 == null || $1.a$nil){
  3348. return methods;
  3349. } else {
  3350. var meta;
  3351. meta=$1;
  3352. return $recv(methods).__comma($recv(meta)._methods());
  3353. }
  3354. return self;
  3355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3356. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods})});
  3357. //>>excludeEnd("ctx");
  3358. }; }),
  3359. $globals.TMasterBehavior);
  3360. $core.addMethod(
  3361. $core.method({
  3362. selector: "enterOrganization",
  3363. protocol: "accessing",
  3364. //>>excludeStart("ide", pragmas.excludeIdeData);
  3365. args: [],
  3366. source: "enterOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09(self basicAt: 'category')\x0a\x09\x09\x09ifNil: [ self basicPackage: nil ]\x0a\x09\x09\x09ifNotNil: [ :category |\x0a\x09\x09\x09\x09\x22Amber has 1-1 correspondence between cat and pkg, atm\x22\x0a\x09\x09\x09\x09self basicPackage: (Package named: category).\x0a\x09\x09\x09\x09self package organization addElement: self ] ]",
  3367. referencedClasses: ["Smalltalk", "Package"],
  3368. //>>excludeEnd("ide");
  3369. pragmas: [],
  3370. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  3371. }, function ($methodClass){ return function (){
  3372. var self=this,$self=this;
  3373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3374. return $core.withContext(function($ctx1) {
  3375. //>>excludeEnd("ctx");
  3376. var $1,$2;
  3377. $1=$globals.Smalltalk;
  3378. if($1 == null || $1.a$nil){
  3379. $1;
  3380. } else {
  3381. $2=$self._basicAt_("category");
  3382. if($2 == null || $2.a$nil){
  3383. [$self._basicPackage_(nil)
  3384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3385. ,$ctx1.sendIdx["basicPackage:"]=1
  3386. //>>excludeEnd("ctx");
  3387. ][0];
  3388. } else {
  3389. var category;
  3390. category=$2;
  3391. $self._basicPackage_($recv($globals.Package)._named_(category));
  3392. $recv($recv($self._package())._organization())._addElement_(self);
  3393. }
  3394. }
  3395. return self;
  3396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3397. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{})});
  3398. //>>excludeEnd("ctx");
  3399. }; }),
  3400. $globals.TMasterBehavior);
  3401. $core.addMethod(
  3402. $core.method({
  3403. selector: "leaveOrganization",
  3404. protocol: "accessing",
  3405. //>>excludeStart("ide", pragmas.excludeIdeData);
  3406. args: [],
  3407. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  3408. referencedClasses: ["Smalltalk"],
  3409. //>>excludeEnd("ide");
  3410. pragmas: [],
  3411. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  3412. }, function ($methodClass){ return function (){
  3413. var self=this,$self=this;
  3414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3415. return $core.withContext(function($ctx1) {
  3416. //>>excludeEnd("ctx");
  3417. var $1;
  3418. $1=$globals.Smalltalk;
  3419. if($1 == null || $1.a$nil){
  3420. $1;
  3421. } else {
  3422. $recv($recv($self._package())._organization())._removeElement_(self);
  3423. }
  3424. return self;
  3425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3426. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{})});
  3427. //>>excludeEnd("ctx");
  3428. }; }),
  3429. $globals.TMasterBehavior);
  3430. $core.addMethod(
  3431. $core.method({
  3432. selector: "name",
  3433. protocol: "accessing",
  3434. //>>excludeStart("ide", pragmas.excludeIdeData);
  3435. args: [],
  3436. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  3437. referencedClasses: [],
  3438. //>>excludeEnd("ide");
  3439. pragmas: [["inlineJS:", ["return self.name"]]],
  3440. messageSends: []
  3441. }, function ($methodClass){ return function (){
  3442. var self=this,$self=this;
  3443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3444. return $core.withContext(function($ctx1) {
  3445. //>>excludeEnd("ctx");
  3446. return self.name;
  3447. return self;
  3448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3449. }, function($ctx1) {$ctx1.fill(self,"name",{})});
  3450. //>>excludeEnd("ctx");
  3451. }; }),
  3452. $globals.TMasterBehavior);
  3453. $core.addMethod(
  3454. $core.method({
  3455. selector: "package:",
  3456. protocol: "accessing",
  3457. //>>excludeStart("ide", pragmas.excludeIdeData);
  3458. args: ["aPackage"],
  3459. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  3460. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  3461. //>>excludeEnd("ide");
  3462. pragmas: [],
  3463. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  3464. }, function ($methodClass){ return function (aPackage){
  3465. var self=this,$self=this;
  3466. var oldPackage;
  3467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3468. return $core.withContext(function($ctx1) {
  3469. //>>excludeEnd("ctx");
  3470. var $1,$2;
  3471. if($core.assert($recv([$self._package()
  3472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3473. ,$ctx1.sendIdx["package"]=1
  3474. //>>excludeEnd("ctx");
  3475. ][0]).__eq(aPackage))){
  3476. return self;
  3477. }
  3478. oldPackage=$self._package();
  3479. $self._leaveOrganization();
  3480. $self._basicAt_put_("category",$recv(aPackage)._name());
  3481. $self._enterOrganization();
  3482. $1=$recv($globals.SystemAnnouncer)._current();
  3483. $2=$recv($globals.ClassMoved)._new();
  3484. $recv($2)._theClass_(self);
  3485. $recv($2)._oldPackage_(oldPackage);
  3486. $recv($1)._announce_($recv($2)._yourself());
  3487. return self;
  3488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3489. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage})});
  3490. //>>excludeEnd("ctx");
  3491. }; }),
  3492. $globals.TMasterBehavior);
  3493. $core.addMethod(
  3494. $core.method({
  3495. selector: "theNonMetaClass",
  3496. protocol: "accessing",
  3497. //>>excludeStart("ide", pragmas.excludeIdeData);
  3498. args: [],
  3499. source: "theNonMetaClass\x0a\x09^ self",
  3500. referencedClasses: [],
  3501. //>>excludeEnd("ide");
  3502. pragmas: [],
  3503. messageSends: []
  3504. }, function ($methodClass){ return function (){
  3505. var self=this,$self=this;
  3506. return self;
  3507. }; }),
  3508. $globals.TMasterBehavior);
  3509. $core.addClass("Trait", $globals.Object, "Kernel-Classes");
  3510. $core.setSlots($globals.Trait, ["organization", "package", "traitUsers"]);
  3511. $core.addMethod(
  3512. $core.method({
  3513. selector: "-",
  3514. protocol: "composition",
  3515. //>>excludeStart("ide", pragmas.excludeIdeData);
  3516. args: ["anArray"],
  3517. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  3518. referencedClasses: [],
  3519. //>>excludeEnd("ide");
  3520. pragmas: [],
  3521. messageSends: ["-", "asTraitTransformation"]
  3522. }, function ($methodClass){ return function (anArray){
  3523. var self=this,$self=this;
  3524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3525. return $core.withContext(function($ctx1) {
  3526. //>>excludeEnd("ctx");
  3527. return $recv($self._asTraitTransformation()).__minus(anArray);
  3528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3529. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray})});
  3530. //>>excludeEnd("ctx");
  3531. }; }),
  3532. $globals.Trait);
  3533. $core.addMethod(
  3534. $core.method({
  3535. selector: "@",
  3536. protocol: "composition",
  3537. //>>excludeStart("ide", pragmas.excludeIdeData);
  3538. args: ["anArrayOfAssociations"],
  3539. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  3540. referencedClasses: [],
  3541. //>>excludeEnd("ide");
  3542. pragmas: [],
  3543. messageSends: ["@", "asTraitTransformation"]
  3544. }, function ($methodClass){ return function (anArrayOfAssociations){
  3545. var self=this,$self=this;
  3546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3547. return $core.withContext(function($ctx1) {
  3548. //>>excludeEnd("ctx");
  3549. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  3550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3551. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations})});
  3552. //>>excludeEnd("ctx");
  3553. }; }),
  3554. $globals.Trait);
  3555. $core.addMethod(
  3556. $core.method({
  3557. selector: "asTraitComposition",
  3558. protocol: "converting",
  3559. //>>excludeStart("ide", pragmas.excludeIdeData);
  3560. args: [],
  3561. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  3562. referencedClasses: [],
  3563. //>>excludeEnd("ide");
  3564. pragmas: [],
  3565. messageSends: ["asTraitComposition", "asTraitTransformation"]
  3566. }, function ($methodClass){ return function (){
  3567. var self=this,$self=this;
  3568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3569. return $core.withContext(function($ctx1) {
  3570. //>>excludeEnd("ctx");
  3571. return $recv($self._asTraitTransformation())._asTraitComposition();
  3572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3573. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{})});
  3574. //>>excludeEnd("ctx");
  3575. }; }),
  3576. $globals.Trait);
  3577. $core.addMethod(
  3578. $core.method({
  3579. selector: "asTraitTransformation",
  3580. protocol: "converting",
  3581. //>>excludeStart("ide", pragmas.excludeIdeData);
  3582. args: [],
  3583. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  3584. referencedClasses: ["TraitTransformation"],
  3585. //>>excludeEnd("ide");
  3586. pragmas: [],
  3587. messageSends: ["on:"]
  3588. }, function ($methodClass){ return function (){
  3589. var self=this,$self=this;
  3590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3591. return $core.withContext(function($ctx1) {
  3592. //>>excludeEnd("ctx");
  3593. return $recv($globals.TraitTransformation)._on_(self);
  3594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3595. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{})});
  3596. //>>excludeEnd("ctx");
  3597. }; }),
  3598. $globals.Trait);
  3599. $core.addMethod(
  3600. $core.method({
  3601. selector: "basicOrganization",
  3602. protocol: "accessing",
  3603. //>>excludeStart("ide", pragmas.excludeIdeData);
  3604. args: [],
  3605. source: "basicOrganization\x0a\x09^ organization",
  3606. referencedClasses: [],
  3607. //>>excludeEnd("ide");
  3608. pragmas: [],
  3609. messageSends: []
  3610. }, function ($methodClass){ return function (){
  3611. var self=this,$self=this;
  3612. return $self.organization;
  3613. }; }),
  3614. $globals.Trait);
  3615. $core.addMethod(
  3616. $core.method({
  3617. selector: "basicOrganization:",
  3618. protocol: "accessing",
  3619. //>>excludeStart("ide", pragmas.excludeIdeData);
  3620. args: ["aClassOrganizer"],
  3621. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  3622. referencedClasses: [],
  3623. //>>excludeEnd("ide");
  3624. pragmas: [],
  3625. messageSends: []
  3626. }, function ($methodClass){ return function (aClassOrganizer){
  3627. var self=this,$self=this;
  3628. $self.organization=aClassOrganizer;
  3629. return self;
  3630. }; }),
  3631. $globals.Trait);
  3632. $core.addMethod(
  3633. $core.method({
  3634. selector: "basicPackage:",
  3635. protocol: "accessing",
  3636. //>>excludeStart("ide", pragmas.excludeIdeData);
  3637. args: ["aPackage"],
  3638. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  3639. referencedClasses: [],
  3640. //>>excludeEnd("ide");
  3641. pragmas: [],
  3642. messageSends: []
  3643. }, function ($methodClass){ return function (aPackage){
  3644. var self=this,$self=this;
  3645. $self.package=aPackage;
  3646. return self;
  3647. }; }),
  3648. $globals.Trait);
  3649. $core.addMethod(
  3650. $core.method({
  3651. selector: "classTag",
  3652. protocol: "accessing",
  3653. //>>excludeStart("ide", pragmas.excludeIdeData);
  3654. args: [],
  3655. source: "classTag\x0a\x09^ 'trait'",
  3656. referencedClasses: [],
  3657. //>>excludeEnd("ide");
  3658. pragmas: [],
  3659. messageSends: []
  3660. }, function ($methodClass){ return function (){
  3661. var self=this,$self=this;
  3662. return "trait";
  3663. }; }),
  3664. $globals.Trait);
  3665. $core.addMethod(
  3666. $core.method({
  3667. selector: "definition",
  3668. protocol: "accessing",
  3669. //>>excludeStart("ide", pragmas.excludeIdeData);
  3670. args: [],
  3671. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Trait named: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  3672. referencedClasses: ["String"],
  3673. //>>excludeEnd("ide");
  3674. pragmas: [],
  3675. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  3676. }, function ($methodClass){ return function (){
  3677. var self=this,$self=this;
  3678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3679. return $core.withContext(function($ctx1) {
  3680. //>>excludeEnd("ctx");
  3681. return $recv($globals.String)._streamContents_((function(stream){
  3682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3683. return $core.withContext(function($ctx2) {
  3684. //>>excludeEnd("ctx");
  3685. [$recv(stream)._write_("Trait named: ")
  3686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3687. ,$ctx2.sendIdx["write:"]=1
  3688. //>>excludeEnd("ctx");
  3689. ][0];
  3690. $recv(stream)._printSymbol_($self._name());
  3691. [$recv(stream)._lf()
  3692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3693. ,$ctx2.sendIdx["lf"]=1
  3694. //>>excludeEnd("ctx");
  3695. ][0];
  3696. [$recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  3697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3698. return $core.withContext(function($ctx3) {
  3699. //>>excludeEnd("ctx");
  3700. return [[$recv($globals.String)._tab()
  3701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3702. ,$ctx3.sendIdx["tab"]=1
  3703. //>>excludeEnd("ctx");
  3704. ][0],"uses: ",tcd,$recv($globals.String)._lf()];
  3705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3706. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  3707. //>>excludeEnd("ctx");
  3708. })))
  3709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3710. ,$ctx2.sendIdx["write:"]=2
  3711. //>>excludeEnd("ctx");
  3712. ][0];
  3713. $recv(stream)._tab();
  3714. $recv(stream)._write_("package: ");
  3715. return $recv(stream)._print_($self._category());
  3716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3717. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  3718. //>>excludeEnd("ctx");
  3719. }));
  3720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3721. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  3722. //>>excludeEnd("ctx");
  3723. }; }),
  3724. $globals.Trait);
  3725. $core.addMethod(
  3726. $core.method({
  3727. selector: "package",
  3728. protocol: "accessing",
  3729. //>>excludeStart("ide", pragmas.excludeIdeData);
  3730. args: [],
  3731. source: "package\x0a\x09^ package",
  3732. referencedClasses: [],
  3733. //>>excludeEnd("ide");
  3734. pragmas: [],
  3735. messageSends: []
  3736. }, function ($methodClass){ return function (){
  3737. var self=this,$self=this;
  3738. return $self.package;
  3739. }; }),
  3740. $globals.Trait);
  3741. $core.addMethod(
  3742. $core.method({
  3743. selector: "theMetaClass",
  3744. protocol: "accessing",
  3745. //>>excludeStart("ide", pragmas.excludeIdeData);
  3746. args: [],
  3747. source: "theMetaClass\x0a\x09^ nil",
  3748. referencedClasses: [],
  3749. //>>excludeEnd("ide");
  3750. pragmas: [],
  3751. messageSends: []
  3752. }, function ($methodClass){ return function (){
  3753. var self=this,$self=this;
  3754. return nil;
  3755. }; }),
  3756. $globals.Trait);
  3757. $core.addMethod(
  3758. $core.method({
  3759. selector: "traitUsers",
  3760. protocol: "accessing",
  3761. //>>excludeStart("ide", pragmas.excludeIdeData);
  3762. args: [],
  3763. source: "traitUsers\x0a\x09^ traitUsers copy",
  3764. referencedClasses: [],
  3765. //>>excludeEnd("ide");
  3766. pragmas: [],
  3767. messageSends: ["copy"]
  3768. }, function ($methodClass){ return function (){
  3769. var self=this,$self=this;
  3770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3771. return $core.withContext(function($ctx1) {
  3772. //>>excludeEnd("ctx");
  3773. return $recv($self.traitUsers)._copy();
  3774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3775. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{})});
  3776. //>>excludeEnd("ctx");
  3777. }; }),
  3778. $globals.Trait);
  3779. $core.addMethod(
  3780. $core.method({
  3781. selector: "named:package:",
  3782. protocol: "instance creation",
  3783. //>>excludeStart("ide", pragmas.excludeIdeData);
  3784. args: ["aString", "anotherString"],
  3785. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  3786. referencedClasses: ["ClassBuilder"],
  3787. //>>excludeEnd("ide");
  3788. pragmas: [],
  3789. messageSends: ["addTraitNamed:package:", "new"]
  3790. }, function ($methodClass){ return function (aString,anotherString){
  3791. var self=this,$self=this;
  3792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3793. return $core.withContext(function($ctx1) {
  3794. //>>excludeEnd("ctx");
  3795. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  3796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3797. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString})});
  3798. //>>excludeEnd("ctx");
  3799. }; }),
  3800. $globals.Trait.a$cls);
  3801. $core.addMethod(
  3802. $core.method({
  3803. selector: "named:uses:package:",
  3804. protocol: "instance creation",
  3805. //>>excludeStart("ide", pragmas.excludeIdeData);
  3806. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  3807. source: "named: aString uses: aTraitCompositionDescription package: anotherString\x0a\x09| trait |\x0a\x09trait := self named: aString package: anotherString.\x0a\x09trait setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ trait",
  3808. referencedClasses: [],
  3809. //>>excludeEnd("ide");
  3810. pragmas: [],
  3811. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  3812. }, function ($methodClass){ return function (aString,aTraitCompositionDescription,anotherString){
  3813. var self=this,$self=this;
  3814. var trait;
  3815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3816. return $core.withContext(function($ctx1) {
  3817. //>>excludeEnd("ctx");
  3818. trait=$self._named_package_(aString,anotherString);
  3819. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  3820. return trait;
  3821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3822. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait})});
  3823. //>>excludeEnd("ctx");
  3824. }; }),
  3825. $globals.Trait.a$cls);
  3826. $core.addClass("TraitTransformation", $globals.Object, "Kernel-Classes");
  3827. $core.setSlots($globals.TraitTransformation, ["trait", "aliases", "exclusions"]);
  3828. //>>excludeStart("ide", pragmas.excludeIdeData);
  3829. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  3830. //>>excludeEnd("ide");
  3831. $core.addMethod(
  3832. $core.method({
  3833. selector: "-",
  3834. protocol: "composition",
  3835. //>>excludeStart("ide", pragmas.excludeIdeData);
  3836. args: ["anArray"],
  3837. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  3838. referencedClasses: [],
  3839. //>>excludeEnd("ide");
  3840. pragmas: [],
  3841. messageSends: ["addExclusions:", "copy", "yourself"]
  3842. }, function ($methodClass){ return function (anArray){
  3843. var self=this,$self=this;
  3844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3845. return $core.withContext(function($ctx1) {
  3846. //>>excludeEnd("ctx");
  3847. var $1;
  3848. $1=$self._copy();
  3849. $recv($1)._addExclusions_(anArray);
  3850. return $recv($1)._yourself();
  3851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3852. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray})});
  3853. //>>excludeEnd("ctx");
  3854. }; }),
  3855. $globals.TraitTransformation);
  3856. $core.addMethod(
  3857. $core.method({
  3858. selector: "@",
  3859. protocol: "composition",
  3860. //>>excludeStart("ide", pragmas.excludeIdeData);
  3861. args: ["anArrayOfAssociations"],
  3862. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  3863. referencedClasses: [],
  3864. //>>excludeEnd("ide");
  3865. pragmas: [],
  3866. messageSends: ["addAliases:", "copy", "yourself"]
  3867. }, function ($methodClass){ return function (anArrayOfAssociations){
  3868. var self=this,$self=this;
  3869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3870. return $core.withContext(function($ctx1) {
  3871. //>>excludeEnd("ctx");
  3872. var $1;
  3873. $1=$self._copy();
  3874. $recv($1)._addAliases_(anArrayOfAssociations);
  3875. return $recv($1)._yourself();
  3876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3877. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations})});
  3878. //>>excludeEnd("ctx");
  3879. }; }),
  3880. $globals.TraitTransformation);
  3881. $core.addMethod(
  3882. $core.method({
  3883. selector: "addAliases:",
  3884. protocol: "accessing",
  3885. //>>excludeStart("ide", pragmas.excludeIdeData);
  3886. args: ["anArrayOfAssociations"],
  3887. source: "addAliases: anArrayOfAssociations\x0a\x09anArrayOfAssociations do: [ :each |\x0a\x09\x09| key |\x0a\x09\x09key := each key.\x0a\x09\x09aliases at: key\x0a\x09\x09\x09ifPresent: [ self error: 'Cannot use same alias name twice.' ]\x0a\x09\x09\x09ifAbsent: [ aliases at: key put: each value ] ].\x0a\x09^ anArrayOfAssociations",
  3888. referencedClasses: [],
  3889. //>>excludeEnd("ide");
  3890. pragmas: [],
  3891. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  3892. }, function ($methodClass){ return function (anArrayOfAssociations){
  3893. var self=this,$self=this;
  3894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3895. return $core.withContext(function($ctx1) {
  3896. //>>excludeEnd("ctx");
  3897. $recv(anArrayOfAssociations)._do_((function(each){
  3898. var key;
  3899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3900. return $core.withContext(function($ctx2) {
  3901. //>>excludeEnd("ctx");
  3902. key=$recv(each)._key();
  3903. return $recv($self.aliases)._at_ifPresent_ifAbsent_(key,(function(){
  3904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3905. return $core.withContext(function($ctx3) {
  3906. //>>excludeEnd("ctx");
  3907. return $self._error_("Cannot use same alias name twice.");
  3908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3909. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  3910. //>>excludeEnd("ctx");
  3911. }),(function(){
  3912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3913. return $core.withContext(function($ctx3) {
  3914. //>>excludeEnd("ctx");
  3915. return $recv($self.aliases)._at_put_(key,$recv(each)._value());
  3916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3917. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  3918. //>>excludeEnd("ctx");
  3919. }));
  3920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3921. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  3922. //>>excludeEnd("ctx");
  3923. }));
  3924. return anArrayOfAssociations;
  3925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3926. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations})});
  3927. //>>excludeEnd("ctx");
  3928. }; }),
  3929. $globals.TraitTransformation);
  3930. $core.addMethod(
  3931. $core.method({
  3932. selector: "addExclusions:",
  3933. protocol: "accessing",
  3934. //>>excludeStart("ide", pragmas.excludeIdeData);
  3935. args: ["anArray"],
  3936. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  3937. referencedClasses: [],
  3938. //>>excludeEnd("ide");
  3939. pragmas: [],
  3940. messageSends: ["addAll:"]
  3941. }, function ($methodClass){ return function (anArray){
  3942. var self=this,$self=this;
  3943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3944. return $core.withContext(function($ctx1) {
  3945. //>>excludeEnd("ctx");
  3946. $recv($self.exclusions)._addAll_(anArray);
  3947. return anArray;
  3948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3949. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray})});
  3950. //>>excludeEnd("ctx");
  3951. }; }),
  3952. $globals.TraitTransformation);
  3953. $core.addMethod(
  3954. $core.method({
  3955. selector: "aliases",
  3956. protocol: "accessing",
  3957. //>>excludeStart("ide", pragmas.excludeIdeData);
  3958. args: [],
  3959. source: "aliases\x0a\x09^ aliases",
  3960. referencedClasses: [],
  3961. //>>excludeEnd("ide");
  3962. pragmas: [],
  3963. messageSends: []
  3964. }, function ($methodClass){ return function (){
  3965. var self=this,$self=this;
  3966. return $self.aliases;
  3967. }; }),
  3968. $globals.TraitTransformation);
  3969. $core.addMethod(
  3970. $core.method({
  3971. selector: "asJavaScriptObject",
  3972. protocol: "converting",
  3973. //>>excludeStart("ide", pragmas.excludeIdeData);
  3974. args: [],
  3975. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  3976. referencedClasses: [],
  3977. //>>excludeEnd("ide");
  3978. pragmas: [],
  3979. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  3980. }, function ($methodClass){ return function (){
  3981. var self=this,$self=this;
  3982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3983. return $core.withContext(function($ctx1) {
  3984. //>>excludeEnd("ctx");
  3985. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  3986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3987. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  3988. //>>excludeEnd("ctx");
  3989. }; }),
  3990. $globals.TraitTransformation);
  3991. $core.addMethod(
  3992. $core.method({
  3993. selector: "asJavaScriptSource",
  3994. protocol: "converting",
  3995. //>>excludeStart("ide", pragmas.excludeIdeData);
  3996. args: [],
  3997. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str | str write: {\x0a\x09\x09'{trait: '. self trait asJavaScriptSource.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09{', aliases: '. al asJSONString} ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09{', exclusions: '. ex asArray sorted asJavaScriptSource} ].\x0a\x09\x09'}' } ]",
  3998. referencedClasses: ["String"],
  3999. //>>excludeEnd("ide");
  4000. pragmas: [],
  4001. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  4002. }, function ($methodClass){ return function (){
  4003. var self=this,$self=this;
  4004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4005. return $core.withContext(function($ctx1) {
  4006. //>>excludeEnd("ctx");
  4007. return $recv($globals.String)._streamContents_((function(str){
  4008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4009. return $core.withContext(function($ctx2) {
  4010. //>>excludeEnd("ctx");
  4011. return $recv(str)._write_(["{trait: ",[$recv($self._trait())._asJavaScriptSource()
  4012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4013. ,$ctx2.sendIdx["asJavaScriptSource"]=1
  4014. //>>excludeEnd("ctx");
  4015. ][0],[$recv($self._aliases())._ifNotEmpty_((function(al){
  4016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4017. return $core.withContext(function($ctx3) {
  4018. //>>excludeEnd("ctx");
  4019. return [", aliases: ",$recv(al)._asJSONString()];
  4020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4021. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  4022. //>>excludeEnd("ctx");
  4023. }))
  4024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4025. ,$ctx2.sendIdx["ifNotEmpty:"]=1
  4026. //>>excludeEnd("ctx");
  4027. ][0],$recv($self._exclusions())._ifNotEmpty_((function(ex){
  4028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4029. return $core.withContext(function($ctx3) {
  4030. //>>excludeEnd("ctx");
  4031. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  4032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4033. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  4034. //>>excludeEnd("ctx");
  4035. })),"}"]);
  4036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4037. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  4038. //>>excludeEnd("ctx");
  4039. }));
  4040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4041. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4042. //>>excludeEnd("ctx");
  4043. }; }),
  4044. $globals.TraitTransformation);
  4045. $core.addMethod(
  4046. $core.method({
  4047. selector: "asTraitComposition",
  4048. protocol: "converting",
  4049. //>>excludeStart("ide", pragmas.excludeIdeData);
  4050. args: [],
  4051. source: "asTraitComposition\x0a\x09^ { self }",
  4052. referencedClasses: [],
  4053. //>>excludeEnd("ide");
  4054. pragmas: [],
  4055. messageSends: []
  4056. }, function ($methodClass){ return function (){
  4057. var self=this,$self=this;
  4058. return [self];
  4059. }; }),
  4060. $globals.TraitTransformation);
  4061. $core.addMethod(
  4062. $core.method({
  4063. selector: "asTraitTransformation",
  4064. protocol: "converting",
  4065. //>>excludeStart("ide", pragmas.excludeIdeData);
  4066. args: [],
  4067. source: "asTraitTransformation\x0a\x09^ self",
  4068. referencedClasses: [],
  4069. //>>excludeEnd("ide");
  4070. pragmas: [],
  4071. messageSends: []
  4072. }, function ($methodClass){ return function (){
  4073. var self=this,$self=this;
  4074. return self;
  4075. }; }),
  4076. $globals.TraitTransformation);
  4077. $core.addMethod(
  4078. $core.method({
  4079. selector: "definition",
  4080. protocol: "accessing",
  4081. //>>excludeStart("ide", pragmas.excludeIdeData);
  4082. args: [],
  4083. source: "definition\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str print: self trait.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09str write: ' @ {'.\x0a\x09\x09\x09al associations\x0a\x09\x09\x09\x09do: [ :each | str printSymbol: each key; write: ' -> '; printSymbol: each value ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09str write: ' - #('.\x0a\x09\x09\x09ex asArray sorted \x0a\x09\x09\x09\x09do: [ :each | str write: each symbolPrintString allButFirst ]\x0a\x09\x09\x09\x09separatedBy: [ str space ].\x0a\x09\x09\x09str write: ')' ] ]",
  4084. referencedClasses: ["String"],
  4085. //>>excludeEnd("ide");
  4086. pragmas: [],
  4087. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  4088. }, function ($methodClass){ return function (){
  4089. var self=this,$self=this;
  4090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4091. return $core.withContext(function($ctx1) {
  4092. //>>excludeEnd("ctx");
  4093. return $recv($globals.String)._streamContents_((function(str){
  4094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4095. return $core.withContext(function($ctx2) {
  4096. //>>excludeEnd("ctx");
  4097. $recv(str)._print_($self._trait());
  4098. [$recv($self._aliases())._ifNotEmpty_((function(al){
  4099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4100. return $core.withContext(function($ctx3) {
  4101. //>>excludeEnd("ctx");
  4102. [$recv(str)._write_(" @ {")
  4103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4104. ,$ctx3.sendIdx["write:"]=1
  4105. //>>excludeEnd("ctx");
  4106. ][0];
  4107. [$recv($recv(al)._associations())._do_separatedBy_((function(each){
  4108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4109. return $core.withContext(function($ctx4) {
  4110. //>>excludeEnd("ctx");
  4111. [$recv(str)._printSymbol_($recv(each)._key())
  4112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4113. ,$ctx4.sendIdx["printSymbol:"]=1
  4114. //>>excludeEnd("ctx");
  4115. ][0];
  4116. [$recv(str)._write_(" -> ")
  4117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4118. ,$ctx4.sendIdx["write:"]=2
  4119. //>>excludeEnd("ctx");
  4120. ][0];
  4121. return $recv(str)._printSymbol_($recv(each)._value());
  4122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4123. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  4124. //>>excludeEnd("ctx");
  4125. }),(function(){
  4126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4127. return $core.withContext(function($ctx4) {
  4128. //>>excludeEnd("ctx");
  4129. return [$recv(str)._write_(". ")
  4130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4131. ,$ctx4.sendIdx["write:"]=3
  4132. //>>excludeEnd("ctx");
  4133. ][0];
  4134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4135. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  4136. //>>excludeEnd("ctx");
  4137. }))
  4138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4139. ,$ctx3.sendIdx["do:separatedBy:"]=1
  4140. //>>excludeEnd("ctx");
  4141. ][0];
  4142. return [$recv(str)._write_("}")
  4143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4144. ,$ctx3.sendIdx["write:"]=4
  4145. //>>excludeEnd("ctx");
  4146. ][0];
  4147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4148. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  4149. //>>excludeEnd("ctx");
  4150. }))
  4151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4152. ,$ctx2.sendIdx["ifNotEmpty:"]=1
  4153. //>>excludeEnd("ctx");
  4154. ][0];
  4155. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  4156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4157. return $core.withContext(function($ctx3) {
  4158. //>>excludeEnd("ctx");
  4159. [$recv(str)._write_(" - #(")
  4160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4161. ,$ctx3.sendIdx["write:"]=5
  4162. //>>excludeEnd("ctx");
  4163. ][0];
  4164. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  4165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4166. return $core.withContext(function($ctx4) {
  4167. //>>excludeEnd("ctx");
  4168. return [$recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst())
  4169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4170. ,$ctx4.sendIdx["write:"]=6
  4171. //>>excludeEnd("ctx");
  4172. ][0];
  4173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4174. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  4175. //>>excludeEnd("ctx");
  4176. }),(function(){
  4177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4178. return $core.withContext(function($ctx4) {
  4179. //>>excludeEnd("ctx");
  4180. return $recv(str)._space();
  4181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4182. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  4183. //>>excludeEnd("ctx");
  4184. }));
  4185. return $recv(str)._write_(")");
  4186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4187. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  4188. //>>excludeEnd("ctx");
  4189. }));
  4190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4191. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  4192. //>>excludeEnd("ctx");
  4193. }));
  4194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4195. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  4196. //>>excludeEnd("ctx");
  4197. }; }),
  4198. $globals.TraitTransformation);
  4199. $core.addMethod(
  4200. $core.method({
  4201. selector: "exclusions",
  4202. protocol: "accessing",
  4203. //>>excludeStart("ide", pragmas.excludeIdeData);
  4204. args: [],
  4205. source: "exclusions\x0a\x09^ exclusions",
  4206. referencedClasses: [],
  4207. //>>excludeEnd("ide");
  4208. pragmas: [],
  4209. messageSends: []
  4210. }, function ($methodClass){ return function (){
  4211. var self=this,$self=this;
  4212. return $self.exclusions;
  4213. }; }),
  4214. $globals.TraitTransformation);
  4215. $core.addMethod(
  4216. $core.method({
  4217. selector: "initialize",
  4218. protocol: "initialization",
  4219. //>>excludeStart("ide", pragmas.excludeIdeData);
  4220. args: [],
  4221. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  4222. referencedClasses: ["Set"],
  4223. //>>excludeEnd("ide");
  4224. pragmas: [],
  4225. messageSends: ["initialize", "new"]
  4226. }, function ($methodClass){ return function (){
  4227. var self=this,$self=this;
  4228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4229. return $core.withContext(function($ctx1) {
  4230. //>>excludeEnd("ctx");
  4231. [(
  4232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4233. $ctx1.supercall = true,
  4234. //>>excludeEnd("ctx");
  4235. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  4236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4237. ,$ctx1.supercall = false
  4238. //>>excludeEnd("ctx");
  4239. ][0];
  4240. $self.aliases=$globals.HashedCollection._newFromPairs_([]);
  4241. $self.exclusions=$recv($globals.Set)._new();
  4242. $self.trait=nil;
  4243. return self;
  4244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4245. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  4246. //>>excludeEnd("ctx");
  4247. }; }),
  4248. $globals.TraitTransformation);
  4249. $core.addMethod(
  4250. $core.method({
  4251. selector: "postCopy",
  4252. protocol: "copying",
  4253. //>>excludeStart("ide", pragmas.excludeIdeData);
  4254. args: [],
  4255. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  4256. referencedClasses: [],
  4257. //>>excludeEnd("ide");
  4258. pragmas: [],
  4259. messageSends: ["copy"]
  4260. }, function ($methodClass){ return function (){
  4261. var self=this,$self=this;
  4262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4263. return $core.withContext(function($ctx1) {
  4264. //>>excludeEnd("ctx");
  4265. $self.aliases=[$recv($self.aliases)._copy()
  4266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4267. ,$ctx1.sendIdx["copy"]=1
  4268. //>>excludeEnd("ctx");
  4269. ][0];
  4270. $self.exclusions=$recv($self.exclusions)._copy();
  4271. return self;
  4272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4273. }, function($ctx1) {$ctx1.fill(self,"postCopy",{})});
  4274. //>>excludeEnd("ctx");
  4275. }; }),
  4276. $globals.TraitTransformation);
  4277. $core.addMethod(
  4278. $core.method({
  4279. selector: "trait",
  4280. protocol: "accessing",
  4281. //>>excludeStart("ide", pragmas.excludeIdeData);
  4282. args: [],
  4283. source: "trait\x0a\x09^ trait",
  4284. referencedClasses: [],
  4285. //>>excludeEnd("ide");
  4286. pragmas: [],
  4287. messageSends: []
  4288. }, function ($methodClass){ return function (){
  4289. var self=this,$self=this;
  4290. return $self.trait;
  4291. }; }),
  4292. $globals.TraitTransformation);
  4293. $core.addMethod(
  4294. $core.method({
  4295. selector: "trait:",
  4296. protocol: "accessing",
  4297. //>>excludeStart("ide", pragmas.excludeIdeData);
  4298. args: ["anObject"],
  4299. source: "trait: anObject\x0a\x09trait := anObject",
  4300. referencedClasses: [],
  4301. //>>excludeEnd("ide");
  4302. pragmas: [],
  4303. messageSends: []
  4304. }, function ($methodClass){ return function (anObject){
  4305. var self=this,$self=this;
  4306. $self.trait=anObject;
  4307. return self;
  4308. }; }),
  4309. $globals.TraitTransformation);
  4310. $core.addMethod(
  4311. $core.method({
  4312. selector: "fromJSON:",
  4313. protocol: "instance creation",
  4314. //>>excludeStart("ide", pragmas.excludeIdeData);
  4315. args: ["aJSObject"],
  4316. source: "fromJSON: aJSObject\x0a\x09^ super new\x0a\x09\x09trait: (aJSObject at: #trait);\x0a\x09\x09addAliases: (Smalltalk readJSObject: (aJSObject at: #aliases ifAbsent: [#{}])) associations;\x0a\x09\x09addExclusions: (aJSObject at: #exclusions ifAbsent: [#()]);\x0a\x09\x09yourself",
  4317. referencedClasses: ["Smalltalk"],
  4318. //>>excludeEnd("ide");
  4319. pragmas: [],
  4320. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  4321. }, function ($methodClass){ return function (aJSObject){
  4322. var self=this,$self=this;
  4323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4324. return $core.withContext(function($ctx1) {
  4325. //>>excludeEnd("ctx");
  4326. var $1;
  4327. $1=[(
  4328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4329. $ctx1.supercall = true,
  4330. //>>excludeEnd("ctx");
  4331. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
  4332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4333. ,$ctx1.supercall = false
  4334. //>>excludeEnd("ctx");
  4335. ][0];
  4336. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  4337. $recv($1)._addAliases_($recv($recv($globals.Smalltalk)._readJSObject_([$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  4338. return $globals.HashedCollection._newFromPairs_([]);
  4339. }))
  4340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4341. ,$ctx1.sendIdx["at:ifAbsent:"]=1
  4342. //>>excludeEnd("ctx");
  4343. ][0]))._associations());
  4344. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  4345. return [];
  4346. })));
  4347. return $recv($1)._yourself();
  4348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4349. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject})});
  4350. //>>excludeEnd("ctx");
  4351. }; }),
  4352. $globals.TraitTransformation.a$cls);
  4353. $core.addMethod(
  4354. $core.method({
  4355. selector: "on:",
  4356. protocol: "instance creation",
  4357. //>>excludeStart("ide", pragmas.excludeIdeData);
  4358. args: ["aTrait"],
  4359. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  4360. referencedClasses: [],
  4361. //>>excludeEnd("ide");
  4362. pragmas: [],
  4363. messageSends: ["trait:", "new", "yourself"]
  4364. }, function ($methodClass){ return function (aTrait){
  4365. var self=this,$self=this;
  4366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4367. return $core.withContext(function($ctx1) {
  4368. //>>excludeEnd("ctx");
  4369. var $1;
  4370. $1=[(
  4371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4372. $ctx1.supercall = true,
  4373. //>>excludeEnd("ctx");
  4374. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
  4375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4376. ,$ctx1.supercall = false
  4377. //>>excludeEnd("ctx");
  4378. ][0];
  4379. $recv($1)._trait_(aTrait);
  4380. return $recv($1)._yourself();
  4381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4382. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait})});
  4383. //>>excludeEnd("ctx");
  4384. }; }),
  4385. $globals.TraitTransformation.a$cls);
  4386. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  4387. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  4388. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  4389. $core.addMethod(
  4390. $core.method({
  4391. selector: "asTraitComposition",
  4392. protocol: "*Kernel-Classes",
  4393. //>>excludeStart("ide", pragmas.excludeIdeData);
  4394. args: [],
  4395. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  4396. referencedClasses: [],
  4397. //>>excludeEnd("ide");
  4398. pragmas: [],
  4399. messageSends: ["collect:", "asTraitTransformation"]
  4400. }, function ($methodClass){ return function (){
  4401. var self=this,$self=this;
  4402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4403. return $core.withContext(function($ctx1) {
  4404. //>>excludeEnd("ctx");
  4405. return $self._collect_((function(each){
  4406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4407. return $core.withContext(function($ctx2) {
  4408. //>>excludeEnd("ctx");
  4409. return $recv(each)._asTraitTransformation();
  4410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4412. //>>excludeEnd("ctx");
  4413. }));
  4414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4415. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{})});
  4416. //>>excludeEnd("ctx");
  4417. }; }),
  4418. $globals.Array);
  4419. $core.addMethod(
  4420. $core.method({
  4421. selector: "instanceVariablesStringAsSlotList",
  4422. protocol: "*Kernel-Classes",
  4423. //>>excludeStart("ide", pragmas.excludeIdeData);
  4424. args: [],
  4425. source: "instanceVariablesStringAsSlotList\x0a\x09^ (self tokenize: ' ') reject: [ :each | each isEmpty ]",
  4426. referencedClasses: [],
  4427. //>>excludeEnd("ide");
  4428. pragmas: [],
  4429. messageSends: ["reject:", "tokenize:", "isEmpty"]
  4430. }, function ($methodClass){ return function (){
  4431. var self=this,$self=this;
  4432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4433. return $core.withContext(function($ctx1) {
  4434. //>>excludeEnd("ctx");
  4435. return $recv($self._tokenize_(" "))._reject_((function(each){
  4436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4437. return $core.withContext(function($ctx2) {
  4438. //>>excludeEnd("ctx");
  4439. return $recv(each)._isEmpty();
  4440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4441. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4442. //>>excludeEnd("ctx");
  4443. }));
  4444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4445. }, function($ctx1) {$ctx1.fill(self,"instanceVariablesStringAsSlotList",{})});
  4446. //>>excludeEnd("ctx");
  4447. }; }),
  4448. $globals.String);
  4449. });