2
0

server.js 632 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750
  1. /* ====================================================================
  2. |
  3. | Amber Smalltalk
  4. | http://amber-lang.net
  5. |
  6. ======================================================================
  7. ======================================================================
  8. |
  9. | Copyright (c) 2010-2011
  10. | Nicolas Petton <petton.nicolas@gmail.com>
  11. |
  12. | Amber is released under the MIT license
  13. |
  14. | Permission is hereby granted, free of charge, to any person obtaining
  15. | a copy of this software and associated documentation files (the
  16. | 'Software'), to deal in the Software without restriction, including
  17. | without limitation the rights to use, copy, modify, merge, publish,
  18. | distribute, sublicense, and/or sell copies of the Software, and to
  19. | permit persons to whom the Software is furnished to do so, subject to
  20. | the following conditions:
  21. |
  22. | The above copyright notice and this permission notice shall be
  23. | included in all copies or substantial portions of the Software.
  24. |
  25. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  26. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  28. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  29. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  30. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  31. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  32. |
  33. ==================================================================== */
  34. /* Make sure that console is defined */
  35. if(typeof console === "undefined") {
  36. this.console = {
  37. log: function() {},
  38. warn: function() {},
  39. info: function() {},
  40. debug: function() {},
  41. error: function() {}
  42. };
  43. }
  44. /* Array extensions */
  45. Array.prototype.addElement = function(el) {
  46. if(typeof el === 'undefined') { return; }
  47. if(this.indexOf(el) == -1) {
  48. this.push(el);
  49. }
  50. };
  51. Array.prototype.removeElement = function(el) {
  52. var i = this.indexOf(el);
  53. if (i !== -1) { this.splice(i, 1); }
  54. };
  55. /* Smalltalk constructors definition */
  56. function SmalltalkObject() {}
  57. function SmalltalkBehavior() {}
  58. function SmalltalkClass() {}
  59. function SmalltalkMetaclass() {
  60. this.meta = true;
  61. }
  62. function SmalltalkPackage() {}
  63. function SmalltalkMethod() {}
  64. function SmalltalkNil() {}
  65. function SmalltalkOrganizer() {
  66. }
  67. function SmalltalkPackageOrganizer() {
  68. this.elements = [];
  69. }
  70. function SmalltalkClassOrganizer() {
  71. this.elements = [];
  72. }
  73. function inherits(child, parent) {
  74. child.prototype = Object.create(parent.prototype, {
  75. constructor: { value: child,
  76. enumerable: false, configurable: true, writable: true }
  77. });
  78. }
  79. inherits(SmalltalkBehavior, SmalltalkObject);
  80. inherits(SmalltalkClass, SmalltalkBehavior);
  81. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  82. inherits(SmalltalkNil, SmalltalkObject);
  83. inherits(SmalltalkMethod, SmalltalkObject);
  84. inherits(SmalltalkPackage, SmalltalkObject);
  85. inherits(SmalltalkOrganizer, SmalltalkObject);
  86. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  87. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  88. function Smalltalk() {
  89. var st = this;
  90. /* This is the current call context object. While it is publicly available,
  91. Use smalltalk.getThisContext() instead which will answer a safe copy of
  92. the current context */
  93. st.thisContext = undefined;
  94. /* List of all reserved words in JavaScript. They may not be used as variables
  95. in Smalltalk. */
  96. // list of reserved JavaScript keywords as of
  97. // http://es5.github.com/#x7.6.1.1
  98. // and
  99. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  100. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  101. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  102. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  103. 'try', 'typeof', 'var', 'void', 'while', 'with',
  104. // ES5: future use: http://es5.github.com/#x7.6.1.2
  105. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  106. // ES5: future use in strict mode
  107. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  108. 'public', 'static', 'yield'];
  109. var initialized = false;
  110. /* Smalltalk classes */
  111. var classes = [];
  112. var wrappedClasses = [];
  113. /* Method not implemented handlers */
  114. var dnu = {
  115. methods: [],
  116. selectors: [],
  117. get: function (string) {
  118. var index = this.selectors.indexOf(string);
  119. if(index !== -1) {
  120. return this.methods[index];
  121. }
  122. this.selectors.push(string);
  123. var selector = st.selector(string);
  124. var method = {jsSelector: selector, fn: this.createHandler(selector)};
  125. this.methods.push(method);
  126. return method;
  127. },
  128. /* Dnu handler method */
  129. createHandler: function (selector) {
  130. return function () {
  131. var args = Array.prototype.slice.call(arguments);
  132. return messageNotUnderstood(this, selector, args);
  133. };
  134. }
  135. };
  136. /* Answer all method selectors based on dnu handlers */
  137. st.allSelectors = function() {
  138. return dnu.selectors;
  139. };
  140. /* Unique ID number generator */
  141. var oid = 0;
  142. st.nextId = function() {
  143. oid += 1;
  144. return oid;
  145. };
  146. /* We hold all Packages in a separate Object */
  147. st.packages = {};
  148. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  149. function pkg(spec) {
  150. var that = new SmalltalkPackage();
  151. that.pkgName = spec.pkgName;
  152. that.organization = new SmalltalkPackageOrganizer();
  153. that.properties = spec.properties || {};
  154. return that;
  155. }
  156. /* Smalltalk class creation. A class is an instance of an automatically
  157. created metaclass object. Newly created classes (not their metaclass)
  158. should be added to the smalltalk object, see smalltalk.addClass().
  159. Superclass linking is *not* handled here, see smalltalk.init() */
  160. function klass(spec) {
  161. spec = spec || {};
  162. var meta = metaclass(spec);
  163. var that = meta.instanceClass;
  164. that.fn = spec.fn || function() {};
  165. setupClass(that, spec);
  166. that.className = spec.className;
  167. that.wrapped = spec.wrapped || false;
  168. meta.className = spec.className + ' class';
  169. if(spec.superclass) {
  170. that.superclass = spec.superclass;
  171. meta.superclass = spec.superclass.klass;
  172. }
  173. return that;
  174. }
  175. function metaclass(spec) {
  176. spec = spec || {};
  177. var that = new SmalltalkMetaclass();
  178. inherits(
  179. that.fn = function() {},
  180. spec.superclass ? spec.superclass.klass.fn : SmalltalkClass
  181. );
  182. that.instanceClass = new that.fn();
  183. setupClass(that);
  184. return that;
  185. }
  186. function setupClass(klass, spec) {
  187. spec = spec || {};
  188. klass.iVarNames = spec.iVarNames || [];
  189. klass.pkg = spec.pkg;
  190. Object.defineProperty(klass, "toString", {
  191. value: function() { return 'Smalltalk ' + this.className; },
  192. enumerable:false, configurable: true, writable: false
  193. });
  194. klass.organization = new SmalltalkClassOrganizer();
  195. klass.organization.theClass = klass;
  196. Object.defineProperty(klass, "methods", {
  197. value: {},
  198. enumerable: false, configurable: true, writable: true
  199. });
  200. wireKlass(klass);
  201. }
  202. /* Smalltalk method object. To add a method to a class,
  203. use smalltalk.addMethod() */
  204. st.method = function(spec) {
  205. var that = new SmalltalkMethod();
  206. that.selector = spec.selector;
  207. that.jsSelector = spec.jsSelector;
  208. that.args = spec.args || {};
  209. that.category = spec.category;
  210. that.source = spec.source;
  211. that.messageSends = spec.messageSends || [];
  212. that.referencedClasses = spec.referencedClasses || [];
  213. that.fn = spec.fn;
  214. return that;
  215. };
  216. /* Initialize a class in its class hierarchy. Handle both classes and
  217. metaclasses. */
  218. st.init = function(klass) {
  219. st.initClass(klass);
  220. if(klass.klass && !klass.meta) {
  221. st.initClass(klass.klass);
  222. }
  223. };
  224. st.initClass = function(klass) {
  225. if(klass.wrapped) {
  226. copySuperclass(klass);
  227. }
  228. else {
  229. installSuperclass(klass);
  230. }
  231. if(klass === st.Object || klass.wrapped) {
  232. installDnuHandlers(klass);
  233. }
  234. };
  235. function wireKlass(klass) {
  236. Object.defineProperty(klass.fn.prototype, "klass", {
  237. value: klass,
  238. enumerable: false, configurable: true, writable: true
  239. });
  240. }
  241. function installSuperclass(klass) {
  242. // only if the klass has not been initialized yet.
  243. if(klass.fn.prototype._yourself) { return; }
  244. if(klass.superclass && klass.superclass !== nil) {
  245. inherits(klass.fn, klass.superclass.fn);
  246. wireKlass(klass);
  247. reinstallMethods(klass);
  248. }
  249. }
  250. function copySuperclass(klass, superclass) {
  251. for (superclass = superclass || klass.superclass;
  252. superclass && superclass !== nil;
  253. superclass = superclass.superclass) {
  254. for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
  255. installMethodIfAbsent(superclass.methods[keys[i]], klass);
  256. }
  257. }
  258. }
  259. function installMethod(method, klass) {
  260. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  261. value: method.fn,
  262. enumerable: false, configurable: true, writable: true
  263. });
  264. }
  265. function installMethodIfAbsent(method, klass) {
  266. if(!klass.fn.prototype[method.jsSelector]) {
  267. installMethod(method, klass);
  268. }
  269. }
  270. function reinstallMethods(klass) {
  271. for(var keys = Object.keys(klass.methods), i=0; i<keys.length; i++) {
  272. installMethod(klass.methods[keys[i]], klass);
  273. }
  274. }
  275. function installDnuHandlers(klass) {
  276. var m = dnu.methods;
  277. for(var i=0; i<m.length; i++) {
  278. installMethodIfAbsent(m[i], klass);
  279. }
  280. }
  281. function installNewDnuHandler(newHandler) {
  282. installMethodIfAbsent(newHandler, st.Object);
  283. for(var i = 0; i < wrappedClasses.length; i++) {
  284. installMethodIfAbsent(newHandler, wrappedClasses[i]);
  285. }
  286. }
  287. /* Answer all registered Packages as Array */
  288. // TODO: Remove this hack
  289. st.packages.all = function() {
  290. var packages = [];
  291. for(var i in st.packages) {
  292. if(!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
  293. packages.push(st.packages[i]);
  294. }
  295. return packages
  296. };
  297. /* Answer all registered Smalltalk classes */
  298. //TODO: remove the function and make smalltalk.classes an array
  299. st.classes = function() {
  300. return classes;
  301. };
  302. st.wrappedClasses = function() {
  303. return wrappedClasses;
  304. };
  305. /* Answer the direct subclasses of klass. */
  306. st.subclasses = function(klass) {
  307. var subclasses = [];
  308. var classes = st.classes();
  309. for(var i=0; i < classes.length; i++) {
  310. var c = classes[i];
  311. if(c.fn) {
  312. //Classes
  313. if(c.superclass === klass) {
  314. subclasses.push(c);
  315. }
  316. c = c.klass;
  317. //Metaclasses
  318. if(c && c.superclass === klass) {
  319. subclasses.push(c);
  320. }
  321. }
  322. }
  323. return subclasses;
  324. };
  325. /* Create a new class wrapping a JavaScript constructor, and add it to the
  326. global smalltalk object. Package is lazily created if it does not exist with given name. */
  327. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  328. if(wrapped !== false) {
  329. wrapped = true;
  330. }
  331. var pkg = st.addPackage(pkgName);
  332. st[className] = klass({
  333. className: className,
  334. superclass: superclass,
  335. pkg: pkg,
  336. fn: fn,
  337. wrapped: wrapped
  338. });
  339. classes.addElement(st[className]);
  340. if(wrapped) {wrappedClasses.addElement(st[className])}
  341. pkg.organization.elements.addElement(st[className]);
  342. };
  343. /* Create an alias for an existing class */
  344. st.alias = function(klass, alias) {
  345. st[alias] = klass;
  346. };
  347. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  348. If pkgName is null or empty we return nil, which is an allowed package for a class.
  349. If package already exists we still update the properties of it. */
  350. st.addPackage = function(pkgName, properties) {
  351. if(!pkgName) {return nil;}
  352. if(!(st.packages[pkgName])) {
  353. st.packages[pkgName] = pkg({
  354. pkgName: pkgName,
  355. properties: properties
  356. });
  357. } else {
  358. if(properties) {
  359. st.packages[pkgName].properties = properties;
  360. }
  361. }
  362. return st.packages[pkgName];
  363. };
  364. /* Add a class to the smalltalk object, creating a new one if needed.
  365. A Package is lazily created if it does not exist with given name. */
  366. st.addClass = function(className, superclass, iVarNames, pkgName) {
  367. var pkg = st.addPackage(pkgName);
  368. if (superclass == nil) { superclass = null; }
  369. if(st[className] && st[className].superclass == superclass) {
  370. st[className].superclass = superclass;
  371. st[className].iVarNames = iVarNames;
  372. st[className].pkg = pkg || st[className].pkg;
  373. } else {
  374. if(st[className]) {
  375. st.removeClass(st[className]);
  376. }
  377. st[className] = klass({
  378. className: className,
  379. superclass: superclass,
  380. pkg: pkg,
  381. iVarNames: iVarNames
  382. });
  383. }
  384. classes.addElement(st[className]);
  385. pkg.organization.elements.addElement(st[className]);
  386. };
  387. st.removeClass = function(klass) {
  388. klass.pkg.organization.elements.removeElement(klass);
  389. classes.removeElement(klass);
  390. delete st[klass.className];
  391. };
  392. /*
  393. * Add/remove a method to/from a class
  394. */
  395. /* This is a temporary version of addMethod() for backward compatibility */
  396. st.addMethod = function(method_exJsSelector, klass_exMethod, exKlass) {
  397. if (typeof method_exJsSelector === "string") { //legacy
  398. if (method_exJsSelector !== st.selector(klass_exMethod.selector)) {
  399. console.log("DISCREPANCY: arg, in_method");
  400. console.log(method_exJsSelector);
  401. console.log(st.selector(klass_exMethod.selector));
  402. klass_exMethod.jsSelector = method_exJsSelector;
  403. }
  404. return new_addMethod(klass_exMethod, exKlass);
  405. }
  406. return new_addMethod(method_exJsSelector, klass_exMethod);
  407. }
  408. // later, st.addMethod can be this:
  409. function new_addMethod(method, klass) {
  410. if (!(method.jsSelector)) {
  411. method.jsSelector = st.selector(method.selector);
  412. }
  413. installMethod(method, klass);
  414. klass.methods[method.selector] = method;
  415. method.methodClass = klass;
  416. // During the bootstrap, #addCompiledMethod is not used.
  417. // Therefore we populate the organizer here too
  418. klass.organization.elements.addElement(method.category);
  419. for(var i=0; i<method.messageSends.length; i++) {
  420. var dnuHandler = dnu.get(method.messageSends[i]);
  421. if(initialized) {
  422. installNewDnuHandler(dnuHandler);
  423. }
  424. }
  425. };
  426. st.removeMethod = function(method) {
  427. var protocol = method.category;
  428. var klass = method.methodClass;
  429. delete klass.fn.prototype[st.selector(method.selector)];
  430. delete klass.methods[method.selector];
  431. var selectors = Object.keys(klass.methods);
  432. // Do *not* delete protocols from here.
  433. // This is handled by #removeCompiledMethod
  434. };
  435. /* Handles unhandled errors during message sends */
  436. // simply send the message and handle #dnu:
  437. st.send = function(receiver, selector, args, klass) {
  438. var method;
  439. if(receiver == null) {
  440. receiver = nil;
  441. }
  442. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  443. if(method) {
  444. return method.apply(receiver, args);
  445. } else {
  446. return messageNotUnderstood(receiver, selector, args);
  447. }
  448. }
  449. st.withContext = function(worker, setup) {
  450. if(st.thisContext) {
  451. st.thisContext.pc++;
  452. return inContext(worker, setup);
  453. } else {
  454. try {return inContext(worker, setup)}
  455. catch(error) {
  456. if(error.smalltalkError) {
  457. handleError(error);
  458. } else {
  459. var errorWrapper = st.JavaScriptException._on_(error);
  460. try {errorWrapper._signal()} catch(ex) {}
  461. errorWrapper._context_(st.getThisContext());
  462. handleError(errorWrapper);
  463. }
  464. // Reset the context stack in any case
  465. st.thisContext = undefined;
  466. // Throw the exception anyway, as we want to stop
  467. // the execution to avoid infinite loops
  468. throw error;
  469. }
  470. }
  471. };
  472. function inContext(worker, setup) {
  473. var context = pushContext(setup);
  474. var result = worker(context);
  475. popContext(context);
  476. return result;
  477. }
  478. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  479. (See the Smalltalk class ErrorHandler and its subclasses */
  480. function handleError(error) {
  481. st.ErrorHandler._current()._handleError_(error);
  482. }
  483. /* Handles #dnu: *and* JavaScript method calls.
  484. if the receiver has no klass, we consider it a JS object (outside of the
  485. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  486. function messageNotUnderstood(receiver, selector, args) {
  487. /* Handles JS method calls. */
  488. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  489. return callJavaScriptMethod(receiver, selector, args);
  490. }
  491. /* Handles not understood messages. Also see the Amber counter-part
  492. Object>>doesNotUnderstand: */
  493. return receiver._doesNotUnderstand_(
  494. st.Message._new()
  495. ._selector_(st.convertSelector(selector))
  496. ._arguments_(args)
  497. );
  498. }
  499. /* Call a method of a JS object, or answer a property if it exists.
  500. Else try wrapping a JSObjectProxy around the receiver.
  501. If the object property is a function, then call it, except if it starts with
  502. an uppercase character (we probably want to answer the function itself in this
  503. case and send it #new from Amber).
  504. Converts keyword-based selectors by using the first
  505. keyword only, but keeping all message arguments.
  506. Example:
  507. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  508. function callJavaScriptMethod(receiver, selector, args) {
  509. var jsSelector = selector._asJavaScriptSelector();
  510. var jsProperty = receiver[jsSelector];
  511. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  512. return jsProperty.apply(receiver, args);
  513. } else if(jsProperty !== undefined) {
  514. if(args[0]) {
  515. receiver[jsSelector] = args[0];
  516. return nil;
  517. } else {
  518. return jsProperty;
  519. }
  520. }
  521. return st.send(st.JSObjectProxy._on_(receiver), selector, args);
  522. }
  523. /* Handle thisContext pseudo variable */
  524. st.getThisContext = function() {
  525. if(st.thisContext) {
  526. st.thisContext.init();
  527. return st.thisContext;
  528. } else {
  529. return nil;
  530. }
  531. };
  532. function pushContext(setup) {
  533. return st.thisContext = new SmalltalkMethodContext(smalltalk.thisContext, setup);
  534. }
  535. function popContext(context) {
  536. st.thisContext = context.homeContext;
  537. }
  538. /* Convert a Smalltalk selector into a JS selector */
  539. st.selector = function(string) {
  540. var selector = '_' + string;
  541. selector = selector.replace(/:/g, '_');
  542. selector = selector.replace(/[\&]/g, '_and');
  543. selector = selector.replace(/[\|]/g, '_or');
  544. selector = selector.replace(/[+]/g, '_plus');
  545. selector = selector.replace(/-/g, '_minus');
  546. selector = selector.replace(/[*]/g ,'_star');
  547. selector = selector.replace(/[\/]/g ,'_slash');
  548. selector = selector.replace(/[\\]/g ,'_backslash');
  549. selector = selector.replace(/[\~]/g ,'_tild');
  550. selector = selector.replace(/>/g ,'_gt');
  551. selector = selector.replace(/</g ,'_lt');
  552. selector = selector.replace(/=/g ,'_eq');
  553. selector = selector.replace(/,/g ,'_comma');
  554. selector = selector.replace(/[@]/g ,'_at');
  555. return selector
  556. };
  557. /* Convert a string to a valid smalltalk selector.
  558. if you modify the following functions, also change String>>asSelector
  559. accordingly */
  560. st.convertSelector = function(selector) {
  561. if(selector.match(/__/)) {
  562. return convertBinarySelector(selector);
  563. } else {
  564. return convertKeywordSelector(selector);
  565. }
  566. };
  567. function convertKeywordSelector(selector) {
  568. return selector.replace(/^_/, '').replace(/_/g, ':');
  569. }
  570. function convertBinarySelector(selector) {
  571. return selector
  572. .replace(/^_/, '')
  573. .replace(/_and/g, '&')
  574. .replace(/_or/g, '|')
  575. .replace(/_plus/g, '+')
  576. .replace(/_minus/g, '-')
  577. .replace(/_star/g, '*')
  578. .replace(/_slash/g, '/')
  579. .replace(/_backslash/g, '\\')
  580. .replace(/_tild/g, '~')
  581. .replace(/_gt/g, '>')
  582. .replace(/_lt/g, '<')
  583. .replace(/_eq/g, '=')
  584. .replace(/_comma/g, ',')
  585. .replace(/_at/g, '@')
  586. }
  587. /* Converts a JavaScript object to valid Smalltalk Object */
  588. st.readJSObject = function(js) {
  589. var object = js;
  590. var readObject = (js.constructor === Object);
  591. var readArray = (js.constructor === Array);
  592. if(readObject) {
  593. object = st.Dictionary._new();
  594. }
  595. for(var i in js) {
  596. if(readObject) {
  597. object._at_put_(i, st.readJSObject(js[i]));
  598. }
  599. if(readArray) {
  600. object[i] = st.readJSObject(js[i]);
  601. }
  602. }
  603. return object;
  604. };
  605. /* Boolean assertion */
  606. st.assert = function(shouldBeBoolean) {
  607. if ((undefined !== shouldBeBoolean) && (shouldBeBoolean.klass === smalltalk.Boolean)) {
  608. return shouldBeBoolean == true;
  609. } else {
  610. smalltalk.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  611. }
  612. };
  613. /* Backward compatibility with Amber 0.9.1 */
  614. st.symbolFor = function(aString) { return aString; }
  615. /* Smalltalk initialization. Called on page load */
  616. st.initialize = function() {
  617. if(initialized) { return; }
  618. classes.forEach(function(klass) {
  619. st.init(klass);
  620. });
  621. classes.forEach(function(klass) {
  622. klass._initialize();
  623. });
  624. initialized = true;
  625. };
  626. }
  627. inherits(Smalltalk, SmalltalkObject);
  628. function SmalltalkMethodContext(home, setup) {
  629. this.homeContext = home;
  630. this.setup = setup || function() {};
  631. this.pc = 0;
  632. }
  633. // Fallbacks
  634. SmalltalkMethodContext.prototype.locals = {};
  635. SmalltalkMethodContext.prototype.receiver = null;
  636. SmalltalkMethodContext.prototype.selector = null;
  637. SmalltalkMethodContext.prototype.lookupClass = null;
  638. inherits(SmalltalkMethodContext, SmalltalkObject);
  639. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  640. this.receiver = receiver;
  641. this.selector = selector;
  642. this.locals = locals || {};
  643. this.lookupClass = lookupClass;
  644. };
  645. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx) {
  646. this.locals = locals || {};
  647. this.methodContext = ctx;
  648. };
  649. SmalltalkMethodContext.prototype.init = function() {
  650. var home = this.homeContext;
  651. if(home) {home = home.init()}
  652. this.setup(this);
  653. };
  654. SmalltalkMethodContext.prototype.method = function() {
  655. var method;
  656. var lookup = this.lookupClass || this.receiver.klass;
  657. while(!method && lookup) {
  658. method = lookup.methods[smalltalk.convertSelector(this.selector)];
  659. lookup = lookup.superclass
  660. }
  661. return method;
  662. };
  663. // TODO: this is just wrong :)
  664. SmalltalkMethodContext.prototype.resume = function() {
  665. //Brutally set the receiver as thisContext, then re-enter the function
  666. smalltalk.thisContext = this;
  667. return this.method.apply(receiver, temps);
  668. };
  669. /* Global Smalltalk objects. */
  670. var nil = new SmalltalkNil();
  671. var smalltalk = new Smalltalk();
  672. if(this.jQuery) {
  673. this.jQuery.allowJavaScriptCalls = true;
  674. }
  675. /*
  676. * Answer the smalltalk representation of o.
  677. * Used in message sends
  678. */
  679. var _st = function(o) {
  680. if(o == null) {return nil}
  681. if(o.klass) {return o}
  682. return smalltalk.JSObjectProxy._on_(o);
  683. };
  684. /***************************************** BOOTSTRAP ******************************************/
  685. smalltalk.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, undefined, false);
  686. smalltalk.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, smalltalk.Object, false);
  687. smalltalk.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, smalltalk.Behavior, false);
  688. smalltalk.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, smalltalk.Behavior, false);
  689. smalltalk.Object.klass.superclass = smalltalk.Class;
  690. smalltalk.wrapClassName("Smalltalk", "Kernel-Objects", Smalltalk, smalltalk.Object, false);
  691. smalltalk.wrapClassName("Package", "Kernel-Objects", SmalltalkPackage, smalltalk.Object, false);
  692. smalltalk.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, smalltalk.Object, false);
  693. smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object, false);
  694. smalltalk.wrapClassName("PackageOrganizer", "Kernel-Objects", SmalltalkPackageOrganizer, smalltalk.Organizer, false);
  695. smalltalk.wrapClassName("ClassOrganizer", "Kernel-Objects", SmalltalkClassOrganizer, smalltalk.Organizer, false);
  696. smalltalk.wrapClassName("Number", "Kernel-Objects", Number, smalltalk.Object);
  697. smalltalk.wrapClassName("BlockClosure", "Kernel-Methods", Function, smalltalk.Object);
  698. smalltalk.wrapClassName("Boolean", "Kernel-Objects", Boolean, smalltalk.Object);
  699. smalltalk.wrapClassName("Date", "Kernel-Objects", Date, smalltalk.Object);
  700. smalltalk.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, smalltalk.Object, false);
  701. smalltalk.addClass("Collection", smalltalk.Object, null, "Kernel-Collections");
  702. smalltalk.addClass("IndexableCollection", smalltalk.Collection, null, "Kernel-Collections");
  703. smalltalk.addClass("SequenceableCollection", smalltalk.IndexableCollection, null, "Kernel-Collections");
  704. smalltalk.addClass("CharacterArray", smalltalk.SequenceableCollection, null, "Kernel-Collections");
  705. smalltalk.wrapClassName("String", "Kernel-Collections", String, smalltalk.CharacterArray);
  706. smalltalk.wrapClassName("Array", "Kernel-Collections", Array, smalltalk.SequenceableCollection);
  707. smalltalk.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, smalltalk.Object);
  708. smalltalk.wrapClassName("Error", "Kernel-Exceptions", Error, smalltalk.Object);
  709. smalltalk.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, smalltalk.Object, false);
  710. /* Alias definitions */
  711. smalltalk.alias(smalltalk.Array, "OrderedCollection");
  712. smalltalk.alias(smalltalk.Date, "Time");
  713. smalltalk.addPackage('Kernel-Objects');
  714. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  715. smalltalk.Object.comment="*Object is the root of the Smalltalk class system*. All classes in the system are subclasses of Object.\x0a\x0aObject provides default behavior common to all normal objects, such as:\x0a\x0a- access\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aObject has no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `Object >> instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aObjects understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example."
  716. smalltalk.addMethod(
  717. smalltalk.method({
  718. selector: "->",
  719. category: 'converting',
  720. fn: function (anObject){
  721. var self=this;
  722. function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
  723. return smalltalk.withContext(function($ctx1) {
  724. var $1;
  725. $1=_st($Association())._key_value_(self,anObject);
  726. return $1;
  727. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},smalltalk.Object)})},
  728. args: ["anObject"],
  729. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  730. messageSends: ["key:value:"],
  731. referencedClasses: ["Association"]
  732. }),
  733. smalltalk.Object);
  734. smalltalk.addMethod(
  735. smalltalk.method({
  736. selector: "=",
  737. category: 'comparing',
  738. fn: function (anObject){
  739. var self=this;
  740. return smalltalk.withContext(function($ctx1) {
  741. var $1;
  742. $1=_st(self).__eq_eq(anObject);
  743. return $1;
  744. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},smalltalk.Object)})},
  745. args: ["anObject"],
  746. source: "= anObject\x0a\x09^self == anObject",
  747. messageSends: ["=="],
  748. referencedClasses: []
  749. }),
  750. smalltalk.Object);
  751. smalltalk.addMethod(
  752. smalltalk.method({
  753. selector: "==",
  754. category: 'comparing',
  755. fn: function (anObject){
  756. var self=this;
  757. return smalltalk.withContext(function($ctx1) {
  758. var $1;
  759. $1=_st(_st(self)._identityHash()).__eq(_st(anObject)._identityHash());
  760. return $1;
  761. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},smalltalk.Object)})},
  762. args: ["anObject"],
  763. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  764. messageSends: ["=", "identityHash"],
  765. referencedClasses: []
  766. }),
  767. smalltalk.Object);
  768. smalltalk.addMethod(
  769. smalltalk.method({
  770. selector: "asJSON",
  771. category: 'converting',
  772. fn: function (){
  773. var self=this;
  774. var variables;
  775. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  776. return smalltalk.withContext(function($ctx1) {
  777. var $1;
  778. variables=_st($HashedCollection())._new();
  779. _st(_st(_st(self)._class())._allInstanceVariableNames())._do_((function(each){
  780. return smalltalk.withContext(function($ctx2) {
  781. return _st(variables)._at_put_(each,_st(_st(self)._instVarAt_(each))._asJSON());
  782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  783. $1=variables;
  784. return $1;
  785. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},smalltalk.Object)})},
  786. args: [],
  787. source: "asJSON\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [:each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJSON].\x0a\x09^variables",
  788. messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"],
  789. referencedClasses: ["HashedCollection"]
  790. }),
  791. smalltalk.Object);
  792. smalltalk.addMethod(
  793. smalltalk.method({
  794. selector: "asJSONString",
  795. category: 'converting',
  796. fn: function (){
  797. var self=this;
  798. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  799. return smalltalk.withContext(function($ctx1) {
  800. var $1;
  801. $1=_st($JSON())._stringify_(_st(self)._asJSON());
  802. return $1;
  803. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},smalltalk.Object)})},
  804. args: [],
  805. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  806. messageSends: ["stringify:", "asJSON"],
  807. referencedClasses: ["JSON"]
  808. }),
  809. smalltalk.Object);
  810. smalltalk.addMethod(
  811. smalltalk.method({
  812. selector: "asJavascript",
  813. category: 'converting',
  814. fn: function (){
  815. var self=this;
  816. return smalltalk.withContext(function($ctx1) {
  817. var $1;
  818. $1=_st(self)._asString();
  819. return $1;
  820. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Object)})},
  821. args: [],
  822. source: "asJavascript\x0a\x09^self asString",
  823. messageSends: ["asString"],
  824. referencedClasses: []
  825. }),
  826. smalltalk.Object);
  827. smalltalk.addMethod(
  828. smalltalk.method({
  829. selector: "asString",
  830. category: 'converting',
  831. fn: function (){
  832. var self=this;
  833. return smalltalk.withContext(function($ctx1) {
  834. var $1;
  835. $1=_st(self)._printString();
  836. return $1;
  837. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Object)})},
  838. args: [],
  839. source: "asString\x0a\x09^self printString",
  840. messageSends: ["printString"],
  841. referencedClasses: []
  842. }),
  843. smalltalk.Object);
  844. smalltalk.addMethod(
  845. smalltalk.method({
  846. selector: "basicAt:",
  847. category: 'accessing',
  848. fn: function (aString){
  849. var self=this;
  850. return smalltalk.withContext(function($ctx1) {
  851. return self[aString];
  852. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},smalltalk.Object)})},
  853. args: ["aString"],
  854. source: "basicAt: aString\x0a\x09<return self[aString]>",
  855. messageSends: [],
  856. referencedClasses: []
  857. }),
  858. smalltalk.Object);
  859. smalltalk.addMethod(
  860. smalltalk.method({
  861. selector: "basicAt:put:",
  862. category: 'accessing',
  863. fn: function (aString,anObject){
  864. var self=this;
  865. return smalltalk.withContext(function($ctx1) {
  866. return self[aString] = anObject;
  867. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  868. args: ["aString", "anObject"],
  869. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  870. messageSends: [],
  871. referencedClasses: []
  872. }),
  873. smalltalk.Object);
  874. smalltalk.addMethod(
  875. smalltalk.method({
  876. selector: "basicDelete:",
  877. category: 'accessing',
  878. fn: function (aString){
  879. var self=this;
  880. return smalltalk.withContext(function($ctx1) {
  881. delete self[aString]; return aString;
  882. return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},smalltalk.Object)})},
  883. args: ["aString"],
  884. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  885. messageSends: [],
  886. referencedClasses: []
  887. }),
  888. smalltalk.Object);
  889. smalltalk.addMethod(
  890. smalltalk.method({
  891. selector: "basicPerform:",
  892. category: 'message handling',
  893. fn: function (aString){
  894. var self=this;
  895. return smalltalk.withContext(function($ctx1) {
  896. var $1;
  897. $1=_st(self)._basicPerform_withArguments_(aString,[]);
  898. return $1;
  899. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},smalltalk.Object)})},
  900. args: ["aString"],
  901. source: "basicPerform: aString\x0a\x09^self basicPerform: aString withArguments: #()",
  902. messageSends: ["basicPerform:withArguments:"],
  903. referencedClasses: []
  904. }),
  905. smalltalk.Object);
  906. smalltalk.addMethod(
  907. smalltalk.method({
  908. selector: "basicPerform:withArguments:",
  909. category: 'message handling',
  910. fn: function (aString,aCollection){
  911. var self=this;
  912. return smalltalk.withContext(function($ctx1) {
  913. return self[aString].apply(self, aCollection);;
  914. return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  915. args: ["aString", "aCollection"],
  916. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  917. messageSends: [],
  918. referencedClasses: []
  919. }),
  920. smalltalk.Object);
  921. smalltalk.addMethod(
  922. smalltalk.method({
  923. selector: "class",
  924. category: 'accessing',
  925. fn: function (){
  926. var self=this;
  927. return smalltalk.withContext(function($ctx1) {
  928. return self.klass;
  929. return self}, function($ctx1) {$ctx1.fill(self,"class",{},smalltalk.Object)})},
  930. args: [],
  931. source: "class\x0a\x09<return self.klass>",
  932. messageSends: [],
  933. referencedClasses: []
  934. }),
  935. smalltalk.Object);
  936. smalltalk.addMethod(
  937. smalltalk.method({
  938. selector: "copy",
  939. category: 'copying',
  940. fn: function (){
  941. var self=this;
  942. return smalltalk.withContext(function($ctx1) {
  943. var $1;
  944. $1=_st(_st(self)._shallowCopy())._postCopy();
  945. return $1;
  946. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Object)})},
  947. args: [],
  948. source: "copy\x0a\x09^self shallowCopy postCopy",
  949. messageSends: ["postCopy", "shallowCopy"],
  950. referencedClasses: []
  951. }),
  952. smalltalk.Object);
  953. smalltalk.addMethod(
  954. smalltalk.method({
  955. selector: "deepCopy",
  956. category: 'copying',
  957. fn: function (){
  958. var self=this;
  959. return smalltalk.withContext(function($ctx1) {
  960. var copy = self.klass._new();
  961. for(var i in self) {
  962. if(/^@.+/.test(i)) {
  963. copy[i] = self[i]._deepCopy();
  964. }
  965. }
  966. return copy;
  967. ;
  968. return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Object)})},
  969. args: [],
  970. source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>",
  971. messageSends: [],
  972. referencedClasses: []
  973. }),
  974. smalltalk.Object);
  975. smalltalk.addMethod(
  976. smalltalk.method({
  977. selector: "deprecatedAPI",
  978. category: 'error handling',
  979. fn: function (){
  980. var self=this;
  981. return smalltalk.withContext(function($ctx1) {
  982. _st(console)._warn_(_st(_st(_st(_st(_st(smalltalk.getThisContext())._home())._asString()).__comma(" is deprecated! (in ")).__comma(_st(_st(_st(smalltalk.getThisContext())._home())._home())._asString())).__comma(")"));
  983. return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},smalltalk.Object)})},
  984. args: [],
  985. source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'",
  986. messageSends: ["warn:", ",", "asString", "home"],
  987. referencedClasses: []
  988. }),
  989. smalltalk.Object);
  990. smalltalk.addMethod(
  991. smalltalk.method({
  992. selector: "doesNotUnderstand:",
  993. category: 'error handling',
  994. fn: function (aMessage){
  995. var self=this;
  996. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  997. return smalltalk.withContext(function($ctx1) {
  998. var $1,$2;
  999. $1=_st($MessageNotUnderstood())._new();
  1000. _st($1)._receiver_(self);
  1001. _st($1)._message_(aMessage);
  1002. $2=_st($1)._signal();
  1003. return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.Object)})},
  1004. args: ["aMessage"],
  1005. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1006. messageSends: ["receiver:", "new", "message:", "signal"],
  1007. referencedClasses: ["MessageNotUnderstood"]
  1008. }),
  1009. smalltalk.Object);
  1010. smalltalk.addMethod(
  1011. smalltalk.method({
  1012. selector: "error:",
  1013. category: 'error handling',
  1014. fn: function (aString){
  1015. var self=this;
  1016. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1017. return smalltalk.withContext(function($ctx1) {
  1018. _st($Error())._signal_(aString);
  1019. return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},smalltalk.Object)})},
  1020. args: ["aString"],
  1021. source: "error: aString\x0a\x09Error signal: aString",
  1022. messageSends: ["signal:"],
  1023. referencedClasses: ["Error"]
  1024. }),
  1025. smalltalk.Object);
  1026. smalltalk.addMethod(
  1027. smalltalk.method({
  1028. selector: "halt",
  1029. category: 'error handling',
  1030. fn: function (){
  1031. var self=this;
  1032. return smalltalk.withContext(function($ctx1) {
  1033. _st(self)._error_("Halt encountered");
  1034. return self}, function($ctx1) {$ctx1.fill(self,"halt",{},smalltalk.Object)})},
  1035. args: [],
  1036. source: "halt\x0a\x09self error: 'Halt encountered'",
  1037. messageSends: ["error:"],
  1038. referencedClasses: []
  1039. }),
  1040. smalltalk.Object);
  1041. smalltalk.addMethod(
  1042. smalltalk.method({
  1043. selector: "identityHash",
  1044. category: 'accessing',
  1045. fn: function (){
  1046. var self=this;
  1047. return smalltalk.withContext(function($ctx1) {
  1048. var hash=self.identityHash;
  1049. if (hash) return hash;
  1050. hash=smalltalk.nextId();
  1051. Object.defineProperty(self, 'identityHash', {value:hash});
  1052. return hash;
  1053. ;
  1054. return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Object)})},
  1055. args: [],
  1056. source: "identityHash\x0a\x09<\x0a\x09var hash=self.identityHash;\x0a\x09if (hash) return hash;\x0a\x09hash=smalltalk.nextId();\x0a\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09return hash;\x0a\x09>",
  1057. messageSends: [],
  1058. referencedClasses: []
  1059. }),
  1060. smalltalk.Object);
  1061. smalltalk.addMethod(
  1062. smalltalk.method({
  1063. selector: "ifNil:",
  1064. category: 'testing',
  1065. fn: function (aBlock){
  1066. var self=this;
  1067. return smalltalk.withContext(function($ctx1) {
  1068. var $1;
  1069. $1=self;
  1070. return $1;
  1071. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.Object)})},
  1072. args: ["aBlock"],
  1073. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  1074. messageSends: [],
  1075. referencedClasses: []
  1076. }),
  1077. smalltalk.Object);
  1078. smalltalk.addMethod(
  1079. smalltalk.method({
  1080. selector: "ifNil:ifNotNil:",
  1081. category: 'testing',
  1082. fn: function (aBlock,anotherBlock){
  1083. var self=this;
  1084. return smalltalk.withContext(function($ctx1) {
  1085. var $1;
  1086. $1=_st(anotherBlock)._value_(self);
  1087. return $1;
  1088. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1089. args: ["aBlock", "anotherBlock"],
  1090. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value: self",
  1091. messageSends: ["value:"],
  1092. referencedClasses: []
  1093. }),
  1094. smalltalk.Object);
  1095. smalltalk.addMethod(
  1096. smalltalk.method({
  1097. selector: "ifNotNil:",
  1098. category: 'testing',
  1099. fn: function (aBlock){
  1100. var self=this;
  1101. return smalltalk.withContext(function($ctx1) {
  1102. var $1;
  1103. $1=_st(aBlock)._value_(self);
  1104. return $1;
  1105. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.Object)})},
  1106. args: ["aBlock"],
  1107. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  1108. messageSends: ["value:"],
  1109. referencedClasses: []
  1110. }),
  1111. smalltalk.Object);
  1112. smalltalk.addMethod(
  1113. smalltalk.method({
  1114. selector: "ifNotNil:ifNil:",
  1115. category: 'testing',
  1116. fn: function (aBlock,anotherBlock){
  1117. var self=this;
  1118. return smalltalk.withContext(function($ctx1) {
  1119. var $1;
  1120. $1=_st(aBlock)._value_(self);
  1121. return $1;
  1122. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1123. args: ["aBlock", "anotherBlock"],
  1124. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  1125. messageSends: ["value:"],
  1126. referencedClasses: []
  1127. }),
  1128. smalltalk.Object);
  1129. smalltalk.addMethod(
  1130. smalltalk.method({
  1131. selector: "initialize",
  1132. category: 'initialization',
  1133. fn: function (){
  1134. var self=this;
  1135. return smalltalk.withContext(function($ctx1) {
  1136. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object)})},
  1137. args: [],
  1138. source: "initialize",
  1139. messageSends: [],
  1140. referencedClasses: []
  1141. }),
  1142. smalltalk.Object);
  1143. smalltalk.addMethod(
  1144. smalltalk.method({
  1145. selector: "instVarAt:",
  1146. category: 'accessing',
  1147. fn: function (aString){
  1148. var self=this;
  1149. return smalltalk.withContext(function($ctx1) {
  1150. return self['@'+aString] ;
  1151. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},smalltalk.Object)})},
  1152. args: ["aString"],
  1153. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1154. messageSends: [],
  1155. referencedClasses: []
  1156. }),
  1157. smalltalk.Object);
  1158. smalltalk.addMethod(
  1159. smalltalk.method({
  1160. selector: "instVarAt:put:",
  1161. category: 'accessing',
  1162. fn: function (aString,anObject){
  1163. var self=this;
  1164. return smalltalk.withContext(function($ctx1) {
  1165. self['@' + aString] = anObject ;
  1166. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  1167. args: ["aString", "anObject"],
  1168. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1169. messageSends: [],
  1170. referencedClasses: []
  1171. }),
  1172. smalltalk.Object);
  1173. smalltalk.addMethod(
  1174. smalltalk.method({
  1175. selector: "isBehavior",
  1176. category: 'testing',
  1177. fn: function (){
  1178. var self=this;
  1179. return smalltalk.withContext(function($ctx1) {
  1180. return false;
  1181. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Object)})},
  1182. args: [],
  1183. source: "isBehavior\x0a\x09^ false",
  1184. messageSends: [],
  1185. referencedClasses: []
  1186. }),
  1187. smalltalk.Object);
  1188. smalltalk.addMethod(
  1189. smalltalk.method({
  1190. selector: "isBoolean",
  1191. category: 'testing',
  1192. fn: function (){
  1193. var self=this;
  1194. return smalltalk.withContext(function($ctx1) {
  1195. return false;
  1196. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Object)})},
  1197. args: [],
  1198. source: "isBoolean\x0a\x09^ false",
  1199. messageSends: [],
  1200. referencedClasses: []
  1201. }),
  1202. smalltalk.Object);
  1203. smalltalk.addMethod(
  1204. smalltalk.method({
  1205. selector: "isClass",
  1206. category: 'testing',
  1207. fn: function (){
  1208. var self=this;
  1209. return smalltalk.withContext(function($ctx1) {
  1210. return false;
  1211. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Object)})},
  1212. args: [],
  1213. source: "isClass\x0a\x09^false",
  1214. messageSends: [],
  1215. referencedClasses: []
  1216. }),
  1217. smalltalk.Object);
  1218. smalltalk.addMethod(
  1219. smalltalk.method({
  1220. selector: "isCompiledMethod",
  1221. category: 'testing',
  1222. fn: function (){
  1223. var self=this;
  1224. return smalltalk.withContext(function($ctx1) {
  1225. return false;
  1226. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.Object)})},
  1227. args: [],
  1228. source: "isCompiledMethod\x0a\x09^ false",
  1229. messageSends: [],
  1230. referencedClasses: []
  1231. }),
  1232. smalltalk.Object);
  1233. smalltalk.addMethod(
  1234. smalltalk.method({
  1235. selector: "isImmutable",
  1236. category: 'testing',
  1237. fn: function (){
  1238. var self=this;
  1239. return smalltalk.withContext(function($ctx1) {
  1240. return false;
  1241. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Object)})},
  1242. args: [],
  1243. source: "isImmutable\x0a\x09^ false",
  1244. messageSends: [],
  1245. referencedClasses: []
  1246. }),
  1247. smalltalk.Object);
  1248. smalltalk.addMethod(
  1249. smalltalk.method({
  1250. selector: "isKindOf:",
  1251. category: 'testing',
  1252. fn: function (aClass){
  1253. var self=this;
  1254. return smalltalk.withContext(function($ctx1) {
  1255. var $2,$1;
  1256. $2=_st(self)._isMemberOf_(aClass);
  1257. if(smalltalk.assert($2)){
  1258. $1=true;
  1259. } else {
  1260. $1=_st(_st(self)._class())._inheritsFrom_(aClass);
  1261. };
  1262. return $1;
  1263. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},smalltalk.Object)})},
  1264. args: ["aClass"],
  1265. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: [self class inheritsFrom: aClass]",
  1266. messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
  1267. referencedClasses: []
  1268. }),
  1269. smalltalk.Object);
  1270. smalltalk.addMethod(
  1271. smalltalk.method({
  1272. selector: "isMemberOf:",
  1273. category: 'testing',
  1274. fn: function (aClass){
  1275. var self=this;
  1276. return smalltalk.withContext(function($ctx1) {
  1277. var $1;
  1278. $1=_st(_st(self)._class()).__eq(aClass);
  1279. return $1;
  1280. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},smalltalk.Object)})},
  1281. args: ["aClass"],
  1282. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  1283. messageSends: ["=", "class"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.Object);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "isMetaclass",
  1290. category: 'testing',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. return false;
  1295. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Object)})},
  1296. args: [],
  1297. source: "isMetaclass\x0a\x09^false",
  1298. messageSends: [],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.Object);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "isNil",
  1305. category: 'testing',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. return false;
  1310. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.Object)})},
  1311. args: [],
  1312. source: "isNil\x0a\x09^false",
  1313. messageSends: [],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.Object);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "isNumber",
  1320. category: 'testing',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return false;
  1325. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Object)})},
  1326. args: [],
  1327. source: "isNumber\x0a\x09^false",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.Object);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "isPackage",
  1335. category: 'testing',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. return false;
  1340. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Object)})},
  1341. args: [],
  1342. source: "isPackage\x0a\x09^ false",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.Object);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "isParseFailure",
  1350. category: 'testing',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.withContext(function($ctx1) {
  1354. return false;
  1355. }, function($ctx1) {$ctx1.fill(self,"isParseFailure",{},smalltalk.Object)})},
  1356. args: [],
  1357. source: "isParseFailure\x0a\x09^false",
  1358. messageSends: [],
  1359. referencedClasses: []
  1360. }),
  1361. smalltalk.Object);
  1362. smalltalk.addMethod(
  1363. smalltalk.method({
  1364. selector: "isString",
  1365. category: 'testing',
  1366. fn: function (){
  1367. var self=this;
  1368. return smalltalk.withContext(function($ctx1) {
  1369. return false;
  1370. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.Object)})},
  1371. args: [],
  1372. source: "isString\x0a\x09^false",
  1373. messageSends: [],
  1374. referencedClasses: []
  1375. }),
  1376. smalltalk.Object);
  1377. smalltalk.addMethod(
  1378. smalltalk.method({
  1379. selector: "isSymbol",
  1380. category: 'testing',
  1381. fn: function (){
  1382. var self=this;
  1383. return smalltalk.withContext(function($ctx1) {
  1384. return false;
  1385. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{},smalltalk.Object)})},
  1386. args: [],
  1387. source: "isSymbol\x0a\x09^false",
  1388. messageSends: [],
  1389. referencedClasses: []
  1390. }),
  1391. smalltalk.Object);
  1392. smalltalk.addMethod(
  1393. smalltalk.method({
  1394. selector: "notNil",
  1395. category: 'testing',
  1396. fn: function (){
  1397. var self=this;
  1398. return smalltalk.withContext(function($ctx1) {
  1399. var $1;
  1400. $1=_st(_st(self)._isNil())._not();
  1401. return $1;
  1402. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.Object)})},
  1403. args: [],
  1404. source: "notNil\x0a\x09^self isNil not",
  1405. messageSends: ["not", "isNil"],
  1406. referencedClasses: []
  1407. }),
  1408. smalltalk.Object);
  1409. smalltalk.addMethod(
  1410. smalltalk.method({
  1411. selector: "perform:",
  1412. category: 'message handling',
  1413. fn: function (aString){
  1414. var self=this;
  1415. return smalltalk.withContext(function($ctx1) {
  1416. var $1;
  1417. $1=_st(self)._perform_withArguments_(aString,[]);
  1418. return $1;
  1419. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},smalltalk.Object)})},
  1420. args: ["aString"],
  1421. source: "perform: aString\x0a\x09^self perform: aString withArguments: #()",
  1422. messageSends: ["perform:withArguments:"],
  1423. referencedClasses: []
  1424. }),
  1425. smalltalk.Object);
  1426. smalltalk.addMethod(
  1427. smalltalk.method({
  1428. selector: "perform:withArguments:",
  1429. category: 'message handling',
  1430. fn: function (aString,aCollection){
  1431. var self=this;
  1432. return smalltalk.withContext(function($ctx1) {
  1433. return smalltalk.send(self, aString._asSelector(), aCollection);
  1434. return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  1435. args: ["aString", "aCollection"],
  1436. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
  1437. messageSends: [],
  1438. referencedClasses: []
  1439. }),
  1440. smalltalk.Object);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "postCopy",
  1444. category: 'copying',
  1445. fn: function (){
  1446. var self=this;
  1447. return smalltalk.withContext(function($ctx1) {
  1448. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},smalltalk.Object)})},
  1449. args: [],
  1450. source: "postCopy",
  1451. messageSends: [],
  1452. referencedClasses: []
  1453. }),
  1454. smalltalk.Object);
  1455. smalltalk.addMethod(
  1456. smalltalk.method({
  1457. selector: "printOn:",
  1458. category: 'printing',
  1459. fn: function (aStream){
  1460. var self=this;
  1461. return smalltalk.withContext(function($ctx1) {
  1462. var $1,$3,$2;
  1463. $1=aStream;
  1464. $3=_st(_st(_st(_st(self)._class())._name())._first())._isVowel();
  1465. if(smalltalk.assert($3)){
  1466. $2="an ";
  1467. } else {
  1468. $2="a ";
  1469. };
  1470. _st($1)._nextPutAll_($2);
  1471. _st(aStream)._nextPutAll_(_st(_st(self)._class())._name());
  1472. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Object)})},
  1473. args: ["aStream"],
  1474. source: "printOn: aStream\x0a\x09\x22Append to the aStream, a string representing the receiver.\x22\x0a\x09\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  1475. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
  1476. referencedClasses: []
  1477. }),
  1478. smalltalk.Object);
  1479. smalltalk.addMethod(
  1480. smalltalk.method({
  1481. selector: "printString",
  1482. category: 'printing',
  1483. fn: function (){
  1484. var self=this;
  1485. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1486. return smalltalk.withContext(function($ctx1) {
  1487. var $1;
  1488. $1=_st($String())._streamContents_((function(stream){
  1489. return smalltalk.withContext(function($ctx2) {
  1490. return _st(self)._printOn_(stream);
  1491. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  1492. return $1;
  1493. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Object)})},
  1494. args: [],
  1495. source: "printString\x0a\x09\x22Answer a String representation of the receiver.\x22\x0a\x0a\x09^ String streamContents: [ :stream | self printOn: stream ]",
  1496. messageSends: ["streamContents:", "printOn:"],
  1497. referencedClasses: ["String"]
  1498. }),
  1499. smalltalk.Object);
  1500. smalltalk.addMethod(
  1501. smalltalk.method({
  1502. selector: "putOn:",
  1503. category: 'streaming',
  1504. fn: function (aStream){
  1505. var self=this;
  1506. return smalltalk.withContext(function($ctx1) {
  1507. _st(aStream)._nextPut_(self);
  1508. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Object)})},
  1509. args: ["aStream"],
  1510. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  1511. messageSends: ["nextPut:"],
  1512. referencedClasses: []
  1513. }),
  1514. smalltalk.Object);
  1515. smalltalk.addMethod(
  1516. smalltalk.method({
  1517. selector: "respondsTo:",
  1518. category: 'testing',
  1519. fn: function (aSelector){
  1520. var self=this;
  1521. return smalltalk.withContext(function($ctx1) {
  1522. var $1;
  1523. $1=_st(_st(self)._class())._canUnderstand_(aSelector);
  1524. return $1;
  1525. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},smalltalk.Object)})},
  1526. args: ["aSelector"],
  1527. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  1528. messageSends: ["canUnderstand:", "class"],
  1529. referencedClasses: []
  1530. }),
  1531. smalltalk.Object);
  1532. smalltalk.addMethod(
  1533. smalltalk.method({
  1534. selector: "shallowCopy",
  1535. category: 'copying',
  1536. fn: function (){
  1537. var self=this;
  1538. return smalltalk.withContext(function($ctx1) {
  1539. var copy = self.klass._new();
  1540. for(var i in self) {
  1541. if(/^@.+/.test(i)) {
  1542. copy[i] = self[i];
  1543. }
  1544. }
  1545. return copy;
  1546. ;
  1547. return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Object)})},
  1548. args: [],
  1549. source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>",
  1550. messageSends: [],
  1551. referencedClasses: []
  1552. }),
  1553. smalltalk.Object);
  1554. smalltalk.addMethod(
  1555. smalltalk.method({
  1556. selector: "shouldNotImplement",
  1557. category: 'error handling',
  1558. fn: function (){
  1559. var self=this;
  1560. return smalltalk.withContext(function($ctx1) {
  1561. _st(self)._error_(_st("This method should not be implemented in ").__comma(_st(_st(self)._class())._name()));
  1562. return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},smalltalk.Object)})},
  1563. args: [],
  1564. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  1565. messageSends: ["error:", ",", "name", "class"],
  1566. referencedClasses: []
  1567. }),
  1568. smalltalk.Object);
  1569. smalltalk.addMethod(
  1570. smalltalk.method({
  1571. selector: "size",
  1572. category: 'accessing',
  1573. fn: function (){
  1574. var self=this;
  1575. return smalltalk.withContext(function($ctx1) {
  1576. _st(self)._error_("Object not indexable");
  1577. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Object)})},
  1578. args: [],
  1579. source: "size\x0a\x09self error: 'Object not indexable'",
  1580. messageSends: ["error:"],
  1581. referencedClasses: []
  1582. }),
  1583. smalltalk.Object);
  1584. smalltalk.addMethod(
  1585. smalltalk.method({
  1586. selector: "subclassResponsibility",
  1587. category: 'error handling',
  1588. fn: function (){
  1589. var self=this;
  1590. return smalltalk.withContext(function($ctx1) {
  1591. _st(self)._error_("This method is a responsibility of a subclass");
  1592. return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},smalltalk.Object)})},
  1593. args: [],
  1594. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  1595. messageSends: ["error:"],
  1596. referencedClasses: []
  1597. }),
  1598. smalltalk.Object);
  1599. smalltalk.addMethod(
  1600. smalltalk.method({
  1601. selector: "test",
  1602. category: 'converting',
  1603. fn: function (){
  1604. var self=this;
  1605. var a;
  1606. return smalltalk.withContext(function($ctx1) {
  1607. a=(1);
  1608. _st(self)._halt();
  1609. return self}, function($ctx1) {$ctx1.fill(self,"test",{a:a},smalltalk.Object)})},
  1610. args: [],
  1611. source: "test\x0a\x09| a |\x0a\x09a := 1.\x0a\x09self halt",
  1612. messageSends: ["halt"],
  1613. referencedClasses: []
  1614. }),
  1615. smalltalk.Object);
  1616. smalltalk.addMethod(
  1617. smalltalk.method({
  1618. selector: "throw:",
  1619. category: 'error handling',
  1620. fn: function (anObject){
  1621. var self=this;
  1622. return smalltalk.withContext(function($ctx1) {
  1623. throw anObject ;
  1624. return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},smalltalk.Object)})},
  1625. args: ["anObject"],
  1626. source: "throw: anObject\x0a\x09< throw anObject >",
  1627. messageSends: [],
  1628. referencedClasses: []
  1629. }),
  1630. smalltalk.Object);
  1631. smalltalk.addMethod(
  1632. smalltalk.method({
  1633. selector: "try:catch:",
  1634. category: 'error handling',
  1635. fn: function (aBlock,anotherBlock){
  1636. var self=this;
  1637. return smalltalk.withContext(function($ctx1) {
  1638. try{return aBlock()} catch(e) {return anotherBlock(e)};
  1639. return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1640. args: ["aBlock", "anotherBlock"],
  1641. source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock()} catch(e) {return anotherBlock(e)}>",
  1642. messageSends: [],
  1643. referencedClasses: []
  1644. }),
  1645. smalltalk.Object);
  1646. smalltalk.addMethod(
  1647. smalltalk.method({
  1648. selector: "value",
  1649. category: 'accessing',
  1650. fn: function (){
  1651. var self=this;
  1652. return smalltalk.withContext(function($ctx1) {
  1653. return self.valueOf();
  1654. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Object)})},
  1655. args: [],
  1656. source: "value\x0a\x09<return self.valueOf()>",
  1657. messageSends: [],
  1658. referencedClasses: []
  1659. }),
  1660. smalltalk.Object);
  1661. smalltalk.addMethod(
  1662. smalltalk.method({
  1663. selector: "yourself",
  1664. category: 'accessing',
  1665. fn: function (){
  1666. var self=this;
  1667. return smalltalk.withContext(function($ctx1) {
  1668. var $1;
  1669. $1=self;
  1670. return $1;
  1671. }, function($ctx1) {$ctx1.fill(self,"yourself",{},smalltalk.Object)})},
  1672. args: [],
  1673. source: "yourself\x0a\x09^self",
  1674. messageSends: [],
  1675. referencedClasses: []
  1676. }),
  1677. smalltalk.Object);
  1678. smalltalk.addMethod(
  1679. smalltalk.method({
  1680. selector: "~=",
  1681. category: 'comparing',
  1682. fn: function (anObject){
  1683. var self=this;
  1684. return smalltalk.withContext(function($ctx1) {
  1685. var $1;
  1686. $1=_st(_st(self).__eq(anObject)).__eq(false);
  1687. return $1;
  1688. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},smalltalk.Object)})},
  1689. args: ["anObject"],
  1690. source: "~= anObject\x0a\x09^(self = anObject) = false",
  1691. messageSends: ["="],
  1692. referencedClasses: []
  1693. }),
  1694. smalltalk.Object);
  1695. smalltalk.addMethod(
  1696. smalltalk.method({
  1697. selector: "~~",
  1698. category: 'comparing',
  1699. fn: function (anObject){
  1700. var self=this;
  1701. return smalltalk.withContext(function($ctx1) {
  1702. var $1;
  1703. $1=_st(_st(self).__eq_eq(anObject)).__eq(false);
  1704. return $1;
  1705. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},smalltalk.Object)})},
  1706. args: ["anObject"],
  1707. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  1708. messageSends: ["=", "=="],
  1709. referencedClasses: []
  1710. }),
  1711. smalltalk.Object);
  1712. smalltalk.addMethod(
  1713. smalltalk.method({
  1714. selector: "initialize",
  1715. category: 'initialization',
  1716. fn: function (){
  1717. var self=this;
  1718. return smalltalk.withContext(function($ctx1) {
  1719. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object.klass)})},
  1720. args: [],
  1721. source: "initialize\x0a\x09\x22no op\x22",
  1722. messageSends: [],
  1723. referencedClasses: []
  1724. }),
  1725. smalltalk.Object.klass);
  1726. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1727. smalltalk.Boolean.comment="Boolean wraps the JavaScript `Boolean()` constructor. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0aBoolean defines the protocol for logic testing operations and conditional control structures for the logical values.\x0aBoolean instances are weither `true` or `false`."
  1728. smalltalk.addMethod(
  1729. smalltalk.method({
  1730. selector: "&",
  1731. category: 'controlling',
  1732. fn: function (aBoolean){
  1733. var self=this;
  1734. return smalltalk.withContext(function($ctx1) {
  1735. if(self == true) {
  1736. return aBoolean;
  1737. } else {
  1738. return false;
  1739. }
  1740. ;
  1741. return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1742. args: ["aBoolean"],
  1743. source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>",
  1744. messageSends: [],
  1745. referencedClasses: []
  1746. }),
  1747. smalltalk.Boolean);
  1748. smalltalk.addMethod(
  1749. smalltalk.method({
  1750. selector: "=",
  1751. category: 'comparing',
  1752. fn: function (aBoolean){
  1753. var self=this;
  1754. return smalltalk.withContext(function($ctx1) {
  1755. if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {
  1756. return false;
  1757. }
  1758. return Boolean(self == true) == aBoolean
  1759. ;
  1760. return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1761. args: ["aBoolean"],
  1762. source: "= aBoolean\x0a\x09<\x0a\x09\x09if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Boolean(self == true) == aBoolean\x0a\x09>",
  1763. messageSends: [],
  1764. referencedClasses: []
  1765. }),
  1766. smalltalk.Boolean);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "==",
  1770. category: 'comparing',
  1771. fn: function (aBoolean){
  1772. var self=this;
  1773. return smalltalk.withContext(function($ctx1) {
  1774. var $1;
  1775. $1=_st(self).__eq(aBoolean);
  1776. return $1;
  1777. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1778. args: ["aBoolean"],
  1779. source: "== aBoolean\x0a\x09^self = aBoolean",
  1780. messageSends: ["="],
  1781. referencedClasses: []
  1782. }),
  1783. smalltalk.Boolean);
  1784. smalltalk.addMethod(
  1785. smalltalk.method({
  1786. selector: "and:",
  1787. category: 'controlling',
  1788. fn: function (aBlock){
  1789. var self=this;
  1790. return smalltalk.withContext(function($ctx1) {
  1791. var $2,$1;
  1792. $2=_st(self).__eq(true);
  1793. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1794. return smalltalk.withContext(function($ctx2) {
  1795. return false;
  1796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1797. return $1;
  1798. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},smalltalk.Boolean)})},
  1799. args: ["aBlock"],
  1800. source: "and: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [false]",
  1801. messageSends: ["ifTrue:ifFalse:", "="],
  1802. referencedClasses: []
  1803. }),
  1804. smalltalk.Boolean);
  1805. smalltalk.addMethod(
  1806. smalltalk.method({
  1807. selector: "asJSON",
  1808. category: 'converting',
  1809. fn: function (){
  1810. var self=this;
  1811. return smalltalk.withContext(function($ctx1) {
  1812. var $1;
  1813. $1=self;
  1814. return $1;
  1815. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Boolean)})},
  1816. args: [],
  1817. source: "asJSON\x0a\x09^self",
  1818. messageSends: [],
  1819. referencedClasses: []
  1820. }),
  1821. smalltalk.Boolean);
  1822. smalltalk.addMethod(
  1823. smalltalk.method({
  1824. selector: "asString",
  1825. category: 'converting',
  1826. fn: function (){
  1827. var self=this;
  1828. return smalltalk.withContext(function($ctx1) {
  1829. return self.toString() ;
  1830. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Boolean)})},
  1831. args: [],
  1832. source: "asString\x0a\x09< return self.toString() >",
  1833. messageSends: [],
  1834. referencedClasses: []
  1835. }),
  1836. smalltalk.Boolean);
  1837. smalltalk.addMethod(
  1838. smalltalk.method({
  1839. selector: "deepCopy",
  1840. category: 'copying',
  1841. fn: function (){
  1842. var self=this;
  1843. return smalltalk.withContext(function($ctx1) {
  1844. var $1;
  1845. $1=self;
  1846. return $1;
  1847. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Boolean)})},
  1848. args: [],
  1849. source: "deepCopy\x0a\x09^self",
  1850. messageSends: [],
  1851. referencedClasses: []
  1852. }),
  1853. smalltalk.Boolean);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "ifFalse:",
  1857. category: 'controlling',
  1858. fn: function (aBlock){
  1859. var self=this;
  1860. return smalltalk.withContext(function($ctx1) {
  1861. var $2,$1;
  1862. $2=self;
  1863. $1=_st($2)._ifTrue_ifFalse_((function(){
  1864. return smalltalk.withContext(function($ctx2) {
  1865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1866. return $1;
  1867. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},smalltalk.Boolean)})},
  1868. args: ["aBlock"],
  1869. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1870. messageSends: ["ifTrue:ifFalse:"],
  1871. referencedClasses: []
  1872. }),
  1873. smalltalk.Boolean);
  1874. smalltalk.addMethod(
  1875. smalltalk.method({
  1876. selector: "ifFalse:ifTrue:",
  1877. category: 'controlling',
  1878. fn: function (aBlock,anotherBlock){
  1879. var self=this;
  1880. return smalltalk.withContext(function($ctx1) {
  1881. var $2,$1;
  1882. $2=self;
  1883. $1=_st($2)._ifTrue_ifFalse_(anotherBlock,aBlock);
  1884. return $1;
  1885. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  1886. args: ["aBlock", "anotherBlock"],
  1887. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1888. messageSends: ["ifTrue:ifFalse:"],
  1889. referencedClasses: []
  1890. }),
  1891. smalltalk.Boolean);
  1892. smalltalk.addMethod(
  1893. smalltalk.method({
  1894. selector: "ifTrue:",
  1895. category: 'controlling',
  1896. fn: function (aBlock){
  1897. var self=this;
  1898. return smalltalk.withContext(function($ctx1) {
  1899. var $2,$1;
  1900. $2=self;
  1901. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1902. return smalltalk.withContext(function($ctx2) {
  1903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1904. return $1;
  1905. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},smalltalk.Boolean)})},
  1906. args: ["aBlock"],
  1907. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  1908. messageSends: ["ifTrue:ifFalse:"],
  1909. referencedClasses: []
  1910. }),
  1911. smalltalk.Boolean);
  1912. smalltalk.addMethod(
  1913. smalltalk.method({
  1914. selector: "ifTrue:ifFalse:",
  1915. category: 'controlling',
  1916. fn: function (aBlock,anotherBlock){
  1917. var self=this;
  1918. return smalltalk.withContext(function($ctx1) {
  1919. if(self == true) {
  1920. return aBlock();
  1921. } else {
  1922. return anotherBlock();
  1923. }
  1924. ;
  1925. return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  1926. args: ["aBlock", "anotherBlock"],
  1927. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock();\x0a\x09\x09}\x0a\x09>",
  1928. messageSends: [],
  1929. referencedClasses: []
  1930. }),
  1931. smalltalk.Boolean);
  1932. smalltalk.addMethod(
  1933. smalltalk.method({
  1934. selector: "isBoolean",
  1935. category: 'testing',
  1936. fn: function (){
  1937. var self=this;
  1938. return smalltalk.withContext(function($ctx1) {
  1939. return true;
  1940. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Boolean)})},
  1941. args: [],
  1942. source: "isBoolean\x0a\x09^ true",
  1943. messageSends: [],
  1944. referencedClasses: []
  1945. }),
  1946. smalltalk.Boolean);
  1947. smalltalk.addMethod(
  1948. smalltalk.method({
  1949. selector: "isImmutable",
  1950. category: 'testing',
  1951. fn: function (){
  1952. var self=this;
  1953. return smalltalk.withContext(function($ctx1) {
  1954. return true;
  1955. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Boolean)})},
  1956. args: [],
  1957. source: "isImmutable\x0a\x09^ true",
  1958. messageSends: [],
  1959. referencedClasses: []
  1960. }),
  1961. smalltalk.Boolean);
  1962. smalltalk.addMethod(
  1963. smalltalk.method({
  1964. selector: "not",
  1965. category: 'controlling',
  1966. fn: function (){
  1967. var self=this;
  1968. return smalltalk.withContext(function($ctx1) {
  1969. var $1;
  1970. $1=_st(self).__eq(false);
  1971. return $1;
  1972. }, function($ctx1) {$ctx1.fill(self,"not",{},smalltalk.Boolean)})},
  1973. args: [],
  1974. source: "not\x0a\x09^self = false",
  1975. messageSends: ["="],
  1976. referencedClasses: []
  1977. }),
  1978. smalltalk.Boolean);
  1979. smalltalk.addMethod(
  1980. smalltalk.method({
  1981. selector: "or:",
  1982. category: 'controlling',
  1983. fn: function (aBlock){
  1984. var self=this;
  1985. return smalltalk.withContext(function($ctx1) {
  1986. var $2,$1;
  1987. $2=_st(self).__eq(true);
  1988. $1=_st($2)._ifTrue_ifFalse_((function(){
  1989. return smalltalk.withContext(function($ctx2) {
  1990. return true;
  1991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1992. return $1;
  1993. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},smalltalk.Boolean)})},
  1994. args: ["aBlock"],
  1995. source: "or: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: aBlock",
  1996. messageSends: ["ifTrue:ifFalse:", "="],
  1997. referencedClasses: []
  1998. }),
  1999. smalltalk.Boolean);
  2000. smalltalk.addMethod(
  2001. smalltalk.method({
  2002. selector: "printOn:",
  2003. category: 'printing',
  2004. fn: function (aStream){
  2005. var self=this;
  2006. return smalltalk.withContext(function($ctx1) {
  2007. _st(aStream)._nextPutAll_(_st(self)._asString());
  2008. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Boolean)})},
  2009. args: ["aStream"],
  2010. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2011. messageSends: ["nextPutAll:", "asString"],
  2012. referencedClasses: []
  2013. }),
  2014. smalltalk.Boolean);
  2015. smalltalk.addMethod(
  2016. smalltalk.method({
  2017. selector: "shallowCopy",
  2018. category: 'copying',
  2019. fn: function (){
  2020. var self=this;
  2021. return smalltalk.withContext(function($ctx1) {
  2022. var $1;
  2023. $1=self;
  2024. return $1;
  2025. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Boolean)})},
  2026. args: [],
  2027. source: "shallowCopy\x0a\x09^self",
  2028. messageSends: [],
  2029. referencedClasses: []
  2030. }),
  2031. smalltalk.Boolean);
  2032. smalltalk.addMethod(
  2033. smalltalk.method({
  2034. selector: "|",
  2035. category: 'controlling',
  2036. fn: function (aBoolean){
  2037. var self=this;
  2038. return smalltalk.withContext(function($ctx1) {
  2039. if(self == true) {
  2040. return true;
  2041. } else {
  2042. return aBoolean;
  2043. }
  2044. ;
  2045. return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},smalltalk.Boolean)})},
  2046. args: ["aBoolean"],
  2047. source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>",
  2048. messageSends: [],
  2049. referencedClasses: []
  2050. }),
  2051. smalltalk.Boolean);
  2052. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  2053. smalltalk.Date.comment="The Date class is used to work with dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate wraps the `Date()` JavaScript constructor, and Smalltalk date objects are JavaScript date objects."
  2054. smalltalk.addMethod(
  2055. smalltalk.method({
  2056. selector: "+",
  2057. category: 'arithmetic',
  2058. fn: function (aDate){
  2059. var self=this;
  2060. return smalltalk.withContext(function($ctx1) {
  2061. return self + aDate;
  2062. return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},smalltalk.Date)})},
  2063. args: ["aDate"],
  2064. source: "+ aDate\x0a\x09<return self + aDate>",
  2065. messageSends: [],
  2066. referencedClasses: []
  2067. }),
  2068. smalltalk.Date);
  2069. smalltalk.addMethod(
  2070. smalltalk.method({
  2071. selector: "-",
  2072. category: 'arithmetic',
  2073. fn: function (aDate){
  2074. var self=this;
  2075. return smalltalk.withContext(function($ctx1) {
  2076. return self - aDate;
  2077. return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},smalltalk.Date)})},
  2078. args: ["aDate"],
  2079. source: "- aDate\x0a\x09<return self - aDate>",
  2080. messageSends: [],
  2081. referencedClasses: []
  2082. }),
  2083. smalltalk.Date);
  2084. smalltalk.addMethod(
  2085. smalltalk.method({
  2086. selector: "<",
  2087. category: 'comparing',
  2088. fn: function (aDate){
  2089. var self=this;
  2090. return smalltalk.withContext(function($ctx1) {
  2091. return self < aDate;
  2092. return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},smalltalk.Date)})},
  2093. args: ["aDate"],
  2094. source: "< aDate\x0a\x09<return self < aDate>",
  2095. messageSends: [],
  2096. referencedClasses: []
  2097. }),
  2098. smalltalk.Date);
  2099. smalltalk.addMethod(
  2100. smalltalk.method({
  2101. selector: "<=",
  2102. category: 'comparing',
  2103. fn: function (aDate){
  2104. var self=this;
  2105. return smalltalk.withContext(function($ctx1) {
  2106. return self <= aDate;
  2107. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},smalltalk.Date)})},
  2108. args: ["aDate"],
  2109. source: "<= aDate\x0a\x09<return self <= aDate>",
  2110. messageSends: [],
  2111. referencedClasses: []
  2112. }),
  2113. smalltalk.Date);
  2114. smalltalk.addMethod(
  2115. smalltalk.method({
  2116. selector: ">",
  2117. category: 'comparing',
  2118. fn: function (aDate){
  2119. var self=this;
  2120. return smalltalk.withContext(function($ctx1) {
  2121. return self > aDate;
  2122. return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},smalltalk.Date)})},
  2123. args: ["aDate"],
  2124. source: "> aDate\x0a\x09<return self >> aDate>",
  2125. messageSends: [],
  2126. referencedClasses: []
  2127. }),
  2128. smalltalk.Date);
  2129. smalltalk.addMethod(
  2130. smalltalk.method({
  2131. selector: ">=",
  2132. category: 'comparing',
  2133. fn: function (aDate){
  2134. var self=this;
  2135. return smalltalk.withContext(function($ctx1) {
  2136. return self >= aDate;
  2137. return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},smalltalk.Date)})},
  2138. args: ["aDate"],
  2139. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2140. messageSends: [],
  2141. referencedClasses: []
  2142. }),
  2143. smalltalk.Date);
  2144. smalltalk.addMethod(
  2145. smalltalk.method({
  2146. selector: "asDateString",
  2147. category: 'converting',
  2148. fn: function (){
  2149. var self=this;
  2150. return smalltalk.withContext(function($ctx1) {
  2151. return self.toDateString();
  2152. return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},smalltalk.Date)})},
  2153. args: [],
  2154. source: "asDateString\x0a\x09<return self.toDateString()>",
  2155. messageSends: [],
  2156. referencedClasses: []
  2157. }),
  2158. smalltalk.Date);
  2159. smalltalk.addMethod(
  2160. smalltalk.method({
  2161. selector: "asLocaleString",
  2162. category: 'converting',
  2163. fn: function (){
  2164. var self=this;
  2165. return smalltalk.withContext(function($ctx1) {
  2166. return self.toLocaleString();
  2167. return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},smalltalk.Date)})},
  2168. args: [],
  2169. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2170. messageSends: [],
  2171. referencedClasses: []
  2172. }),
  2173. smalltalk.Date);
  2174. smalltalk.addMethod(
  2175. smalltalk.method({
  2176. selector: "asMilliseconds",
  2177. category: 'converting',
  2178. fn: function (){
  2179. var self=this;
  2180. return smalltalk.withContext(function($ctx1) {
  2181. var $1;
  2182. $1=_st(self)._time();
  2183. return $1;
  2184. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},smalltalk.Date)})},
  2185. args: [],
  2186. source: "asMilliseconds\x0a\x09^self time",
  2187. messageSends: ["time"],
  2188. referencedClasses: []
  2189. }),
  2190. smalltalk.Date);
  2191. smalltalk.addMethod(
  2192. smalltalk.method({
  2193. selector: "asNumber",
  2194. category: 'converting',
  2195. fn: function (){
  2196. var self=this;
  2197. return smalltalk.withContext(function($ctx1) {
  2198. var $1;
  2199. $1=_st(self)._asMilliseconds();
  2200. return $1;
  2201. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.Date)})},
  2202. args: [],
  2203. source: "asNumber\x0a\x09^self asMilliseconds",
  2204. messageSends: ["asMilliseconds"],
  2205. referencedClasses: []
  2206. }),
  2207. smalltalk.Date);
  2208. smalltalk.addMethod(
  2209. smalltalk.method({
  2210. selector: "asString",
  2211. category: 'converting',
  2212. fn: function (){
  2213. var self=this;
  2214. return smalltalk.withContext(function($ctx1) {
  2215. return self.toString();
  2216. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Date)})},
  2217. args: [],
  2218. source: "asString\x0a\x09<return self.toString()>",
  2219. messageSends: [],
  2220. referencedClasses: []
  2221. }),
  2222. smalltalk.Date);
  2223. smalltalk.addMethod(
  2224. smalltalk.method({
  2225. selector: "asTimeString",
  2226. category: 'converting',
  2227. fn: function (){
  2228. var self=this;
  2229. return smalltalk.withContext(function($ctx1) {
  2230. return self.toTimeString();
  2231. return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},smalltalk.Date)})},
  2232. args: [],
  2233. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2234. messageSends: [],
  2235. referencedClasses: []
  2236. }),
  2237. smalltalk.Date);
  2238. smalltalk.addMethod(
  2239. smalltalk.method({
  2240. selector: "day",
  2241. category: 'accessing',
  2242. fn: function (){
  2243. var self=this;
  2244. return smalltalk.withContext(function($ctx1) {
  2245. var $1;
  2246. $1=_st(self)._dayOfWeek();
  2247. return $1;
  2248. }, function($ctx1) {$ctx1.fill(self,"day",{},smalltalk.Date)})},
  2249. args: [],
  2250. source: "day\x0a\x09^self dayOfWeek",
  2251. messageSends: ["dayOfWeek"],
  2252. referencedClasses: []
  2253. }),
  2254. smalltalk.Date);
  2255. smalltalk.addMethod(
  2256. smalltalk.method({
  2257. selector: "day:",
  2258. category: 'accessing',
  2259. fn: function (aNumber){
  2260. var self=this;
  2261. return smalltalk.withContext(function($ctx1) {
  2262. _st(self)._dayOfWeek_(aNumber);
  2263. return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},smalltalk.Date)})},
  2264. args: ["aNumber"],
  2265. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2266. messageSends: ["dayOfWeek:"],
  2267. referencedClasses: []
  2268. }),
  2269. smalltalk.Date);
  2270. smalltalk.addMethod(
  2271. smalltalk.method({
  2272. selector: "dayOfMonth",
  2273. category: 'accessing',
  2274. fn: function (){
  2275. var self=this;
  2276. return smalltalk.withContext(function($ctx1) {
  2277. return self.getDate();
  2278. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},smalltalk.Date)})},
  2279. args: [],
  2280. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2281. messageSends: [],
  2282. referencedClasses: []
  2283. }),
  2284. smalltalk.Date);
  2285. smalltalk.addMethod(
  2286. smalltalk.method({
  2287. selector: "dayOfMonth:",
  2288. category: 'accessing',
  2289. fn: function (aNumber){
  2290. var self=this;
  2291. return smalltalk.withContext(function($ctx1) {
  2292. self.setDate(aNumber);
  2293. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},smalltalk.Date)})},
  2294. args: ["aNumber"],
  2295. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2296. messageSends: [],
  2297. referencedClasses: []
  2298. }),
  2299. smalltalk.Date);
  2300. smalltalk.addMethod(
  2301. smalltalk.method({
  2302. selector: "dayOfWeek",
  2303. category: 'accessing',
  2304. fn: function (){
  2305. var self=this;
  2306. return smalltalk.withContext(function($ctx1) {
  2307. return self.getDay() + 1;
  2308. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},smalltalk.Date)})},
  2309. args: [],
  2310. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2311. messageSends: [],
  2312. referencedClasses: []
  2313. }),
  2314. smalltalk.Date);
  2315. smalltalk.addMethod(
  2316. smalltalk.method({
  2317. selector: "dayOfWeek:",
  2318. category: 'accessing',
  2319. fn: function (aNumber){
  2320. var self=this;
  2321. return smalltalk.withContext(function($ctx1) {
  2322. return self.setDay(aNumber - 1);
  2323. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},smalltalk.Date)})},
  2324. args: ["aNumber"],
  2325. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2326. messageSends: [],
  2327. referencedClasses: []
  2328. }),
  2329. smalltalk.Date);
  2330. smalltalk.addMethod(
  2331. smalltalk.method({
  2332. selector: "hours",
  2333. category: 'accessing',
  2334. fn: function (){
  2335. var self=this;
  2336. return smalltalk.withContext(function($ctx1) {
  2337. return self.getHours();
  2338. return self}, function($ctx1) {$ctx1.fill(self,"hours",{},smalltalk.Date)})},
  2339. args: [],
  2340. source: "hours\x0a\x09<return self.getHours()>",
  2341. messageSends: [],
  2342. referencedClasses: []
  2343. }),
  2344. smalltalk.Date);
  2345. smalltalk.addMethod(
  2346. smalltalk.method({
  2347. selector: "hours:",
  2348. category: 'accessing',
  2349. fn: function (aNumber){
  2350. var self=this;
  2351. return smalltalk.withContext(function($ctx1) {
  2352. self.setHours(aNumber);
  2353. return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},smalltalk.Date)})},
  2354. args: ["aNumber"],
  2355. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2356. messageSends: [],
  2357. referencedClasses: []
  2358. }),
  2359. smalltalk.Date);
  2360. smalltalk.addMethod(
  2361. smalltalk.method({
  2362. selector: "milliseconds",
  2363. category: 'accessing',
  2364. fn: function (){
  2365. var self=this;
  2366. return smalltalk.withContext(function($ctx1) {
  2367. return self.getMilliseconds();
  2368. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},smalltalk.Date)})},
  2369. args: [],
  2370. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2371. messageSends: [],
  2372. referencedClasses: []
  2373. }),
  2374. smalltalk.Date);
  2375. smalltalk.addMethod(
  2376. smalltalk.method({
  2377. selector: "milliseconds:",
  2378. category: 'accessing',
  2379. fn: function (aNumber){
  2380. var self=this;
  2381. return smalltalk.withContext(function($ctx1) {
  2382. self.setMilliseconds(aNumber);
  2383. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},smalltalk.Date)})},
  2384. args: ["aNumber"],
  2385. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  2386. messageSends: [],
  2387. referencedClasses: []
  2388. }),
  2389. smalltalk.Date);
  2390. smalltalk.addMethod(
  2391. smalltalk.method({
  2392. selector: "minutes",
  2393. category: 'accessing',
  2394. fn: function (){
  2395. var self=this;
  2396. return smalltalk.withContext(function($ctx1) {
  2397. return self.getMinutes();
  2398. return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},smalltalk.Date)})},
  2399. args: [],
  2400. source: "minutes\x0a\x09<return self.getMinutes()>",
  2401. messageSends: [],
  2402. referencedClasses: []
  2403. }),
  2404. smalltalk.Date);
  2405. smalltalk.addMethod(
  2406. smalltalk.method({
  2407. selector: "minutes:",
  2408. category: 'accessing',
  2409. fn: function (aNumber){
  2410. var self=this;
  2411. return smalltalk.withContext(function($ctx1) {
  2412. self.setMinutes(aNumber);
  2413. return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},smalltalk.Date)})},
  2414. args: ["aNumber"],
  2415. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  2416. messageSends: [],
  2417. referencedClasses: []
  2418. }),
  2419. smalltalk.Date);
  2420. smalltalk.addMethod(
  2421. smalltalk.method({
  2422. selector: "month",
  2423. category: 'accessing',
  2424. fn: function (){
  2425. var self=this;
  2426. return smalltalk.withContext(function($ctx1) {
  2427. return self.getMonth() + 1;
  2428. return self}, function($ctx1) {$ctx1.fill(self,"month",{},smalltalk.Date)})},
  2429. args: [],
  2430. source: "month\x0a\x09<return self.getMonth() + 1>",
  2431. messageSends: [],
  2432. referencedClasses: []
  2433. }),
  2434. smalltalk.Date);
  2435. smalltalk.addMethod(
  2436. smalltalk.method({
  2437. selector: "month:",
  2438. category: 'accessing',
  2439. fn: function (aNumber){
  2440. var self=this;
  2441. return smalltalk.withContext(function($ctx1) {
  2442. self.setMonth(aNumber - 1);
  2443. return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},smalltalk.Date)})},
  2444. args: ["aNumber"],
  2445. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  2446. messageSends: [],
  2447. referencedClasses: []
  2448. }),
  2449. smalltalk.Date);
  2450. smalltalk.addMethod(
  2451. smalltalk.method({
  2452. selector: "printOn:",
  2453. category: 'printing',
  2454. fn: function (aStream){
  2455. var self=this;
  2456. return smalltalk.withContext(function($ctx1) {
  2457. _st(aStream)._nextPutAll_(_st(self)._asString());
  2458. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Date)})},
  2459. args: ["aStream"],
  2460. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2461. messageSends: ["nextPutAll:", "asString"],
  2462. referencedClasses: []
  2463. }),
  2464. smalltalk.Date);
  2465. smalltalk.addMethod(
  2466. smalltalk.method({
  2467. selector: "seconds",
  2468. category: 'accessing',
  2469. fn: function (){
  2470. var self=this;
  2471. return smalltalk.withContext(function($ctx1) {
  2472. return self.getSeconds();
  2473. return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},smalltalk.Date)})},
  2474. args: [],
  2475. source: "seconds\x0a\x09<return self.getSeconds()>",
  2476. messageSends: [],
  2477. referencedClasses: []
  2478. }),
  2479. smalltalk.Date);
  2480. smalltalk.addMethod(
  2481. smalltalk.method({
  2482. selector: "seconds:",
  2483. category: 'accessing',
  2484. fn: function (aNumber){
  2485. var self=this;
  2486. return smalltalk.withContext(function($ctx1) {
  2487. self.setSeconds(aNumber);
  2488. return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},smalltalk.Date)})},
  2489. args: ["aNumber"],
  2490. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  2491. messageSends: [],
  2492. referencedClasses: []
  2493. }),
  2494. smalltalk.Date);
  2495. smalltalk.addMethod(
  2496. smalltalk.method({
  2497. selector: "time",
  2498. category: 'accessing',
  2499. fn: function (){
  2500. var self=this;
  2501. return smalltalk.withContext(function($ctx1) {
  2502. return self.getTime();
  2503. return self}, function($ctx1) {$ctx1.fill(self,"time",{},smalltalk.Date)})},
  2504. args: [],
  2505. source: "time\x0a\x09<return self.getTime()>",
  2506. messageSends: [],
  2507. referencedClasses: []
  2508. }),
  2509. smalltalk.Date);
  2510. smalltalk.addMethod(
  2511. smalltalk.method({
  2512. selector: "time:",
  2513. category: 'accessing',
  2514. fn: function (aNumber){
  2515. var self=this;
  2516. return smalltalk.withContext(function($ctx1) {
  2517. self.setTime(aNumber);
  2518. return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},smalltalk.Date)})},
  2519. args: ["aNumber"],
  2520. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  2521. messageSends: [],
  2522. referencedClasses: []
  2523. }),
  2524. smalltalk.Date);
  2525. smalltalk.addMethod(
  2526. smalltalk.method({
  2527. selector: "year",
  2528. category: 'accessing',
  2529. fn: function (){
  2530. var self=this;
  2531. return smalltalk.withContext(function($ctx1) {
  2532. return self.getFullYear();
  2533. return self}, function($ctx1) {$ctx1.fill(self,"year",{},smalltalk.Date)})},
  2534. args: [],
  2535. source: "year\x0a\x09<return self.getFullYear()>",
  2536. messageSends: [],
  2537. referencedClasses: []
  2538. }),
  2539. smalltalk.Date);
  2540. smalltalk.addMethod(
  2541. smalltalk.method({
  2542. selector: "year:",
  2543. category: 'accessing',
  2544. fn: function (aNumber){
  2545. var self=this;
  2546. return smalltalk.withContext(function($ctx1) {
  2547. self.setFullYear(aNumber);
  2548. return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},smalltalk.Date)})},
  2549. args: ["aNumber"],
  2550. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  2551. messageSends: [],
  2552. referencedClasses: []
  2553. }),
  2554. smalltalk.Date);
  2555. smalltalk.addMethod(
  2556. smalltalk.method({
  2557. selector: "fromMilliseconds:",
  2558. category: 'instance creation',
  2559. fn: function (aNumber){
  2560. var self=this;
  2561. return smalltalk.withContext(function($ctx1) {
  2562. var $1;
  2563. $1=_st(self)._new_(aNumber);
  2564. return $1;
  2565. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  2566. args: ["aNumber"],
  2567. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  2568. messageSends: ["new:"],
  2569. referencedClasses: []
  2570. }),
  2571. smalltalk.Date.klass);
  2572. smalltalk.addMethod(
  2573. smalltalk.method({
  2574. selector: "fromSeconds:",
  2575. category: 'instance creation',
  2576. fn: function (aNumber){
  2577. var self=this;
  2578. return smalltalk.withContext(function($ctx1) {
  2579. var $1;
  2580. $1=_st(self)._fromMilliseconds_(_st(aNumber).__star((1000)));
  2581. return $1;
  2582. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  2583. args: ["aNumber"],
  2584. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  2585. messageSends: ["fromMilliseconds:", "*"],
  2586. referencedClasses: []
  2587. }),
  2588. smalltalk.Date.klass);
  2589. smalltalk.addMethod(
  2590. smalltalk.method({
  2591. selector: "fromString:",
  2592. category: 'instance creation',
  2593. fn: function (aString){
  2594. var self=this;
  2595. return smalltalk.withContext(function($ctx1) {
  2596. var $1;
  2597. $1=_st(self)._new_(aString);
  2598. return $1;
  2599. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.Date.klass)})},
  2600. args: ["aString"],
  2601. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  2602. messageSends: ["new:"],
  2603. referencedClasses: []
  2604. }),
  2605. smalltalk.Date.klass);
  2606. smalltalk.addMethod(
  2607. smalltalk.method({
  2608. selector: "millisecondsToRun:",
  2609. category: 'instance creation',
  2610. fn: function (aBlock){
  2611. var self=this;
  2612. var t;
  2613. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  2614. return smalltalk.withContext(function($ctx1) {
  2615. var $1;
  2616. t=_st($Date())._now();
  2617. _st(aBlock)._value();
  2618. $1=_st(_st($Date())._now()).__minus(t);
  2619. return $1;
  2620. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},smalltalk.Date.klass)})},
  2621. args: ["aBlock"],
  2622. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  2623. messageSends: ["now", "value", "-"],
  2624. referencedClasses: ["Date"]
  2625. }),
  2626. smalltalk.Date.klass);
  2627. smalltalk.addMethod(
  2628. smalltalk.method({
  2629. selector: "new:",
  2630. category: 'instance creation',
  2631. fn: function (anObject){
  2632. var self=this;
  2633. return smalltalk.withContext(function($ctx1) {
  2634. return new Date(anObject);
  2635. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},smalltalk.Date.klass)})},
  2636. args: ["anObject"],
  2637. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  2638. messageSends: [],
  2639. referencedClasses: []
  2640. }),
  2641. smalltalk.Date.klass);
  2642. smalltalk.addMethod(
  2643. smalltalk.method({
  2644. selector: "now",
  2645. category: 'instance creation',
  2646. fn: function (){
  2647. var self=this;
  2648. return smalltalk.withContext(function($ctx1) {
  2649. var $1;
  2650. $1=_st(self)._today();
  2651. return $1;
  2652. }, function($ctx1) {$ctx1.fill(self,"now",{},smalltalk.Date.klass)})},
  2653. args: [],
  2654. source: "now\x0a\x09^self today",
  2655. messageSends: ["today"],
  2656. referencedClasses: []
  2657. }),
  2658. smalltalk.Date.klass);
  2659. smalltalk.addMethod(
  2660. smalltalk.method({
  2661. selector: "today",
  2662. category: 'instance creation',
  2663. fn: function (){
  2664. var self=this;
  2665. return smalltalk.withContext(function($ctx1) {
  2666. var $1;
  2667. $1=_st(self)._new();
  2668. return $1;
  2669. }, function($ctx1) {$ctx1.fill(self,"today",{},smalltalk.Date.klass)})},
  2670. args: [],
  2671. source: "today\x0a\x09^self new",
  2672. messageSends: ["new"],
  2673. referencedClasses: []
  2674. }),
  2675. smalltalk.Date.klass);
  2676. smalltalk.addClass('Environment', smalltalk.Object, [], 'Kernel-Objects');
  2677. smalltalk.Environment.comment="Abstract class defining common behavior for local and remote environments"
  2678. smalltalk.addMethod(
  2679. smalltalk.method({
  2680. selector: "addInstVarNamed:to:",
  2681. category: 'compiling',
  2682. fn: function (aString,aClass){
  2683. var self=this;
  2684. return smalltalk.withContext(function($ctx1) {
  2685. var $1,$2;
  2686. $1=_st(_st(aClass)._instanceVariableNames())._copy();
  2687. _st($1)._add_(aString);
  2688. $2=_st($1)._yourself();
  2689. _st(_st(self)._classBuilder())._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),_st(aClass)._name(),$2,_st(_st(aClass)._package())._name());
  2690. return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.HLEnvironment)})},
  2691. args: ["aString", "aClass"],
  2692. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  2693. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package", "classBuilder"],
  2694. referencedClasses: []
  2695. }),
  2696. smalltalk.Environment);
  2697. smalltalk.addMethod(
  2698. smalltalk.method({
  2699. selector: "allSelectors",
  2700. category: 'accessing',
  2701. fn: function (){
  2702. var self=this;
  2703. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2704. return smalltalk.withContext(function($ctx1) {
  2705. var $1;
  2706. $1=_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value();
  2707. return $1;
  2708. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Environment)})},
  2709. args: [],
  2710. source: "allSelectors\x0a\x09^ (Smalltalk current at: 'allSelectors') value",
  2711. messageSends: ["value", "at:", "current"],
  2712. referencedClasses: ["Smalltalk"]
  2713. }),
  2714. smalltalk.Environment);
  2715. smalltalk.addMethod(
  2716. smalltalk.method({
  2717. selector: "availableClassNames",
  2718. category: 'accessing',
  2719. fn: function (){
  2720. var self=this;
  2721. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2722. return smalltalk.withContext(function($ctx1) {
  2723. var $1;
  2724. $1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  2725. return smalltalk.withContext(function($ctx2) {
  2726. return _st(each)._name();
  2727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2728. return $1;
  2729. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.HLEnvironment)})},
  2730. args: [],
  2731. source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
  2732. messageSends: ["collect:", "name", "classes", "current"],
  2733. referencedClasses: ["Smalltalk"]
  2734. }),
  2735. smalltalk.Environment);
  2736. smalltalk.addMethod(
  2737. smalltalk.method({
  2738. selector: "availablePackageNames",
  2739. category: 'accessing',
  2740. fn: function (){
  2741. var self=this;
  2742. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2743. return smalltalk.withContext(function($ctx1) {
  2744. var $1;
  2745. $1=_st(_st(_st($Smalltalk())._current())._packages())._collect_((function(each){
  2746. return smalltalk.withContext(function($ctx2) {
  2747. return _st(each)._name();
  2748. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2749. return $1;
  2750. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.HLEnvironment)})},
  2751. args: [],
  2752. source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
  2753. messageSends: ["collect:", "name", "packages", "current"],
  2754. referencedClasses: ["Smalltalk"]
  2755. }),
  2756. smalltalk.Environment);
  2757. smalltalk.addMethod(
  2758. smalltalk.method({
  2759. selector: "availableProtocolsFor:",
  2760. category: 'accessing',
  2761. fn: function (aClass){
  2762. var self=this;
  2763. var protocols;
  2764. return smalltalk.withContext(function($ctx1) {
  2765. var $1,$2;
  2766. protocols=_st(aClass)._protocols();
  2767. $1=_st(aClass)._superclass();
  2768. if(($receiver = $1) == nil || $receiver == undefined){
  2769. $1;
  2770. } else {
  2771. _st(protocols)._addAll_(_st(self)._availableProtocolsFor_(_st(aClass)._superclass()));
  2772. };
  2773. $2=_st(_st(protocols)._asSet())._asArray();
  2774. return $2;
  2775. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.HLEnvironment)})},
  2776. args: ["aClass"],
  2777. source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray",
  2778. messageSends: ["protocols", "ifNotNil:", "addAll:", "availableProtocolsFor:", "superclass", "asArray", "asSet"],
  2779. referencedClasses: []
  2780. }),
  2781. smalltalk.Environment);
  2782. smalltalk.addMethod(
  2783. smalltalk.method({
  2784. selector: "classBuilder",
  2785. category: 'accessing',
  2786. fn: function (){
  2787. var self=this;
  2788. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  2789. return smalltalk.withContext(function($ctx1) {
  2790. var $1;
  2791. $1=_st($ClassBuilder())._new();
  2792. return $1;
  2793. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.HLEnvironment)})},
  2794. args: [],
  2795. source: "classBuilder\x0a\x09^ ClassBuilder new",
  2796. messageSends: ["new"],
  2797. referencedClasses: ["ClassBuilder"]
  2798. }),
  2799. smalltalk.Environment);
  2800. smalltalk.addMethod(
  2801. smalltalk.method({
  2802. selector: "classNamed:",
  2803. category: 'accessing',
  2804. fn: function (aString){
  2805. var self=this;
  2806. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2807. return smalltalk.withContext(function($ctx1) {
  2808. var $2,$1;
  2809. $2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
  2810. if(($receiver = $2) == nil || $receiver == undefined){
  2811. $1=_st(self)._error_("Invalid class name");
  2812. } else {
  2813. $1=$2;
  2814. };
  2815. return $1;
  2816. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.HLEnvironment)})},
  2817. args: ["aString"],
  2818. source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  2819. messageSends: ["ifNil:", "error:", "at:", "asSymbol", "current"],
  2820. referencedClasses: ["Smalltalk"]
  2821. }),
  2822. smalltalk.Environment);
  2823. smalltalk.addMethod(
  2824. smalltalk.method({
  2825. selector: "classes",
  2826. category: 'accessing',
  2827. fn: function (){
  2828. var self=this;
  2829. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2830. return smalltalk.withContext(function($ctx1) {
  2831. var $1;
  2832. $1=_st(_st($Smalltalk())._current())._classes();
  2833. return $1;
  2834. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})},
  2835. args: [],
  2836. source: "classes\x0a\x09^ Smalltalk current classes",
  2837. messageSends: ["classes", "current"],
  2838. referencedClasses: ["Smalltalk"]
  2839. }),
  2840. smalltalk.Environment);
  2841. smalltalk.addMethod(
  2842. smalltalk.method({
  2843. selector: "commitPackage:",
  2844. category: 'actions',
  2845. fn: function (aPackage){
  2846. var self=this;
  2847. return smalltalk.withContext(function($ctx1) {
  2848. _st(aPackage)._commit();
  2849. return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.HLEnvironment)})},
  2850. args: ["aPackage"],
  2851. source: "commitPackage: aPackage\x0a\x09aPackage commit",
  2852. messageSends: ["commit"],
  2853. referencedClasses: []
  2854. }),
  2855. smalltalk.Environment);
  2856. smalltalk.addMethod(
  2857. smalltalk.method({
  2858. selector: "compileClassComment:for:",
  2859. category: 'compiling',
  2860. fn: function (aString,aClass){
  2861. var self=this;
  2862. return smalltalk.withContext(function($ctx1) {
  2863. _st(aClass)._comment_(aString);
  2864. return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.HLEnvironment)})},
  2865. args: ["aString", "aClass"],
  2866. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  2867. messageSends: ["comment:"],
  2868. referencedClasses: []
  2869. }),
  2870. smalltalk.Environment);
  2871. smalltalk.addMethod(
  2872. smalltalk.method({
  2873. selector: "compileClassDefinition:",
  2874. category: 'compiling',
  2875. fn: function (aString){
  2876. var self=this;
  2877. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  2878. return smalltalk.withContext(function($ctx1) {
  2879. _st(self)._eval_on_(aString,_st($DoIt())._new());
  2880. return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.HLEnvironment)})},
  2881. args: ["aString"],
  2882. source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
  2883. messageSends: ["eval:on:", "new"],
  2884. referencedClasses: ["DoIt"]
  2885. }),
  2886. smalltalk.Environment);
  2887. smalltalk.addMethod(
  2888. smalltalk.method({
  2889. selector: "compileMethod:for:protocol:",
  2890. category: 'compiling',
  2891. fn: function (sourceCode,class_,protocol){
  2892. var self=this;
  2893. return smalltalk.withContext(function($ctx1) {
  2894. var $1;
  2895. $1=_st(class_)._compile_category_(sourceCode,protocol);
  2896. return $1;
  2897. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},smalltalk.HLEnvironment)})},
  2898. args: ["sourceCode", "class", "protocol"],
  2899. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09category: protocol",
  2900. messageSends: ["compile:category:"],
  2901. referencedClasses: []
  2902. }),
  2903. smalltalk.Environment);
  2904. smalltalk.addMethod(
  2905. smalltalk.method({
  2906. selector: "copyClass:to:",
  2907. category: 'actions',
  2908. fn: function (aClass,aClassName){
  2909. var self=this;
  2910. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2911. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  2912. return smalltalk.withContext(function($ctx1) {
  2913. var $1;
  2914. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  2915. if(($receiver = $1) == nil || $receiver == undefined){
  2916. $1;
  2917. } else {
  2918. _st(self)._error_(_st(_st("A class named ").__comma(aClassName)).__comma(" already exists"));
  2919. };
  2920. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  2921. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.HLEnvironment)})},
  2922. args: ["aClass", "aClassName"],
  2923. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName\x0a\x09\x09\x0a\x09",
  2924. messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "copyClass:named:", "new"],
  2925. referencedClasses: ["Smalltalk", "ClassBuilder"]
  2926. }),
  2927. smalltalk.Environment);
  2928. smalltalk.addMethod(
  2929. smalltalk.method({
  2930. selector: "eval:on:",
  2931. category: 'actions',
  2932. fn: function (aString,aReceiver){
  2933. var self=this;
  2934. var compiler;
  2935. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  2936. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2937. return smalltalk.withContext(function($ctx1) {
  2938. var $1,$2;
  2939. var $early={};
  2940. try {
  2941. compiler=_st($Compiler())._new();
  2942. _st((function(){
  2943. return smalltalk.withContext(function($ctx2) {
  2944. return _st(compiler)._parseExpression_(aString);
  2945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  2946. return smalltalk.withContext(function($ctx2) {
  2947. $1=_st(window)._alert_(_st(ex)._messageText());
  2948. throw $early=[$1];
  2949. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  2950. $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
  2951. return $2;
  2952. }
  2953. catch(e) {if(e===$early)return e[0]; throw e}
  2954. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler},smalltalk.HLEnvironment)})},
  2955. args: ["aString", "aReceiver"],
  2956. source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ window alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
  2957. messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "evaluateExpression:on:"],
  2958. referencedClasses: ["Compiler", "Error"]
  2959. }),
  2960. smalltalk.Environment);
  2961. smalltalk.addMethod(
  2962. smalltalk.method({
  2963. selector: "moveClass:toPackage:",
  2964. category: 'actions',
  2965. fn: function (aClass,aPackageName){
  2966. var self=this;
  2967. var package_;
  2968. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2969. return smalltalk.withContext(function($ctx1) {
  2970. var $1,$2,$3;
  2971. package_=_st($Package())._named_(aPackageName);
  2972. $1=package_;
  2973. if(($receiver = $1) == nil || $receiver == undefined){
  2974. _st(self)._error_("Invalid package name");
  2975. } else {
  2976. $1;
  2977. };
  2978. $2=_st(package_).__eq_eq(_st(aClass)._package());
  2979. if(smalltalk.assert($2)){
  2980. $3=self;
  2981. return $3;
  2982. };
  2983. _st(aClass)._package_(package_);
  2984. return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.HLEnvironment)})},
  2985. args: ["aClass", "aPackageName"],
  2986. source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package",
  2987. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
  2988. referencedClasses: ["Package"]
  2989. }),
  2990. smalltalk.Environment);
  2991. smalltalk.addMethod(
  2992. smalltalk.method({
  2993. selector: "moveMethod:toClass:",
  2994. category: 'actions',
  2995. fn: function (aMethod,aClassName){
  2996. var self=this;
  2997. var destinationClass;
  2998. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2999. return smalltalk.withContext(function($ctx1) {
  3000. var $1,$2,$3;
  3001. destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
  3002. $1=destinationClass;
  3003. if(($receiver = $1) == nil || $receiver == undefined){
  3004. _st(self)._error_("Invalid class name");
  3005. } else {
  3006. $1;
  3007. };
  3008. $2=_st(destinationClass).__eq_eq(_st(aMethod)._methodClass());
  3009. if(smalltalk.assert($2)){
  3010. $3=self;
  3011. return $3;
  3012. };
  3013. _st(destinationClass)._compile_category_(_st(aMethod)._source(),_st(aMethod)._protocol());
  3014. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  3015. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.Environment)})},
  3016. args: ["aMethod", "aClassName"],
  3017. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := Smalltalk current at: aClassName asSymbol.\x0a\x09destinationClass ifNil: [ self error: 'Invalid class name' ].\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09category: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod\x0a\x09",
  3018. messageSends: ["at:", "asSymbol", "current", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"],
  3019. referencedClasses: ["Smalltalk"]
  3020. }),
  3021. smalltalk.Environment);
  3022. smalltalk.addMethod(
  3023. smalltalk.method({
  3024. selector: "moveMethod:toProtocol:",
  3025. category: 'actions',
  3026. fn: function (aMethod,aProtocol){
  3027. var self=this;
  3028. return smalltalk.withContext(function($ctx1) {
  3029. _st(aMethod)._category_(aProtocol);
  3030. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.HLEnvironment)})},
  3031. args: ["aMethod", "aProtocol"],
  3032. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol",
  3033. messageSends: ["category:"],
  3034. referencedClasses: []
  3035. }),
  3036. smalltalk.Environment);
  3037. smalltalk.addMethod(
  3038. smalltalk.method({
  3039. selector: "packages",
  3040. category: 'accessing',
  3041. fn: function (){
  3042. var self=this;
  3043. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3044. return smalltalk.withContext(function($ctx1) {
  3045. var $1;
  3046. $1=_st(_st($Smalltalk())._current())._packages();
  3047. return $1;
  3048. }, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.HLEnvironment)})},
  3049. args: [],
  3050. source: "packages\x0a\x09^ Smalltalk current packages",
  3051. messageSends: ["packages", "current"],
  3052. referencedClasses: ["Smalltalk"]
  3053. }),
  3054. smalltalk.Environment);
  3055. smalltalk.addMethod(
  3056. smalltalk.method({
  3057. selector: "removeClass:",
  3058. category: 'actions',
  3059. fn: function (aClass){
  3060. var self=this;
  3061. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3062. return smalltalk.withContext(function($ctx1) {
  3063. _st(_st($Smalltalk())._current())._removeClass_(aClass);
  3064. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.HLEnvironment)})},
  3065. args: ["aClass"],
  3066. source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
  3067. messageSends: ["removeClass:", "current"],
  3068. referencedClasses: ["Smalltalk"]
  3069. }),
  3070. smalltalk.Environment);
  3071. smalltalk.addMethod(
  3072. smalltalk.method({
  3073. selector: "removeMethod:",
  3074. category: 'actions',
  3075. fn: function (aMethod){
  3076. var self=this;
  3077. return smalltalk.withContext(function($ctx1) {
  3078. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  3079. return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},smalltalk.Environment)})},
  3080. args: ["aMethod"],
  3081. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  3082. messageSends: ["removeCompiledMethod:", "methodClass"],
  3083. referencedClasses: []
  3084. }),
  3085. smalltalk.Environment);
  3086. smalltalk.addMethod(
  3087. smalltalk.method({
  3088. selector: "removeProtocol:from:",
  3089. category: 'actions',
  3090. fn: function (aString,aClass){
  3091. var self=this;
  3092. return smalltalk.withContext(function($ctx1) {
  3093. _st(_st(_st(aClass)._methods())._select_((function(each){
  3094. return smalltalk.withContext(function($ctx2) {
  3095. return _st(_st(each)._protocol()).__eq(aString);
  3096. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
  3097. return smalltalk.withContext(function($ctx2) {
  3098. return _st(aClass)._removeCompiledMethod_(each);
  3099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3100. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  3101. args: ["aString", "aClass"],
  3102. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  3103. messageSends: ["do:", "removeCompiledMethod:", "select:", "=", "protocol", "methods"],
  3104. referencedClasses: []
  3105. }),
  3106. smalltalk.Environment);
  3107. smalltalk.addMethod(
  3108. smalltalk.method({
  3109. selector: "renameClass:to:",
  3110. category: 'actions',
  3111. fn: function (aClass,aClassName){
  3112. var self=this;
  3113. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3114. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  3115. return smalltalk.withContext(function($ctx1) {
  3116. var $1;
  3117. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  3118. if(($receiver = $1) == nil || $receiver == undefined){
  3119. $1;
  3120. } else {
  3121. _st(self)._error_(_st(_st("A class named ").__comma(aClassName)).__comma(" already exists"));
  3122. };
  3123. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  3124. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.HLEnvironment)})},
  3125. args: ["aClass", "aClassName"],
  3126. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName\x09\x0a\x09",
  3127. messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "renameClass:to:", "new"],
  3128. referencedClasses: ["Smalltalk", "ClassBuilder"]
  3129. }),
  3130. smalltalk.Environment);
  3131. smalltalk.addMethod(
  3132. smalltalk.method({
  3133. selector: "renameProtocol:to:in:",
  3134. category: 'actions',
  3135. fn: function (aString,anotherString,aClass){
  3136. var self=this;
  3137. return smalltalk.withContext(function($ctx1) {
  3138. _st(_st(_st(aClass)._methods())._select_((function(each){
  3139. return smalltalk.withContext(function($ctx2) {
  3140. return _st(_st(each)._protocol()).__eq(aString);
  3141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
  3142. return smalltalk.withContext(function($ctx2) {
  3143. return _st(each)._protocol_(anotherString);
  3144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3145. return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},smalltalk.Environment)})},
  3146. args: ["aString", "anotherString", "aClass"],
  3147. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  3148. messageSends: ["do:", "protocol:", "select:", "=", "protocol", "methods"],
  3149. referencedClasses: []
  3150. }),
  3151. smalltalk.Environment);
  3152. smalltalk.addMethod(
  3153. smalltalk.method({
  3154. selector: "systemAnnouncer",
  3155. category: 'accessing',
  3156. fn: function (){
  3157. var self=this;
  3158. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3159. return smalltalk.withContext(function($ctx1) {
  3160. var $1;
  3161. $1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
  3162. return $1;
  3163. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})},
  3164. args: [],
  3165. source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current",
  3166. messageSends: ["current", "at:"],
  3167. referencedClasses: ["Smalltalk"]
  3168. }),
  3169. smalltalk.Environment);
  3170. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  3171. smalltalk.JSObjectProxy.comment="JSObjectProxy handles sending messages to JavaScript object, therefore accessing JavaScript objects from Amber is transparent.\x0aJSOjbectProxy makes intensive use of `#doesNotUnderstand:`.\x0a\x0a## Examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aSmalltalk messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`."
  3172. smalltalk.addMethod(
  3173. smalltalk.method({
  3174. selector: "addObjectVariablesTo:",
  3175. category: 'proxy',
  3176. fn: function (aDictionary){
  3177. var self=this;
  3178. return smalltalk.withContext(function($ctx1) {
  3179. for(var i in self['@jsObject']) {
  3180. aDictionary._at_put_(i, self['@jsObject'][i]);
  3181. }
  3182. ;
  3183. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},smalltalk.JSObjectProxy)})},
  3184. args: ["aDictionary"],
  3185. source: "addObjectVariablesTo: aDictionary\x0a\x09<\x0a\x09\x09for(var i in self['@jsObject']) {\x0a\x09\x09\x09aDictionary._at_put_(i, self['@jsObject'][i]);\x0a\x09\x09}\x0a\x09>",
  3186. messageSends: [],
  3187. referencedClasses: []
  3188. }),
  3189. smalltalk.JSObjectProxy);
  3190. smalltalk.addMethod(
  3191. smalltalk.method({
  3192. selector: "at:",
  3193. category: 'accessing',
  3194. fn: function (aString){
  3195. var self=this;
  3196. return smalltalk.withContext(function($ctx1) {
  3197. return self['@jsObject'][aString];
  3198. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})},
  3199. args: ["aString"],
  3200. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  3201. messageSends: [],
  3202. referencedClasses: []
  3203. }),
  3204. smalltalk.JSObjectProxy);
  3205. smalltalk.addMethod(
  3206. smalltalk.method({
  3207. selector: "at:ifAbsent:",
  3208. category: 'accessing',
  3209. fn: function (aString,aBlock){
  3210. var self=this;
  3211. return smalltalk.withContext(function($ctx1) {
  3212. var obj = self['@jsObject'];
  3213. return aString in obj ? obj[aString] : aBlock();
  3214. ;
  3215. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  3216. args: ["aString", "aBlock"],
  3217. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock();\x0a\x09>",
  3218. messageSends: [],
  3219. referencedClasses: []
  3220. }),
  3221. smalltalk.JSObjectProxy);
  3222. smalltalk.addMethod(
  3223. smalltalk.method({
  3224. selector: "at:ifPresent:",
  3225. category: 'accessing',
  3226. fn: function (aString,aBlock){
  3227. var self=this;
  3228. return smalltalk.withContext(function($ctx1) {
  3229. var obj = self['@jsObject'];
  3230. return aString in obj ? aBlock(obj[aString]) : nil;
  3231. ;
  3232. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  3233. args: ["aString", "aBlock"],
  3234. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock(obj[aString]) : nil;\x0a\x09>",
  3235. messageSends: [],
  3236. referencedClasses: []
  3237. }),
  3238. smalltalk.JSObjectProxy);
  3239. smalltalk.addMethod(
  3240. smalltalk.method({
  3241. selector: "at:ifPresent:ifAbsent:",
  3242. category: 'accessing',
  3243. fn: function (aString,aBlock,anotherBlock){
  3244. var self=this;
  3245. return smalltalk.withContext(function($ctx1) {
  3246. var obj = self['@jsObject'];
  3247. return aString in obj ? aBlock(obj[aString]) : anotherBlock();
  3248. ;
  3249. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSObjectProxy)})},
  3250. args: ["aString", "aBlock", "anotherBlock"],
  3251. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock(obj[aString]) : anotherBlock();\x0a\x09>",
  3252. messageSends: [],
  3253. referencedClasses: []
  3254. }),
  3255. smalltalk.JSObjectProxy);
  3256. smalltalk.addMethod(
  3257. smalltalk.method({
  3258. selector: "at:put:",
  3259. category: 'accessing',
  3260. fn: function (aString,anObject){
  3261. var self=this;
  3262. return smalltalk.withContext(function($ctx1) {
  3263. self['@jsObject'][aString] = anObject;
  3264. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.JSObjectProxy)})},
  3265. args: ["aString", "anObject"],
  3266. source: "at: aString put: anObject\x0a\x09<self['@jsObject'][aString] = anObject>",
  3267. messageSends: [],
  3268. referencedClasses: []
  3269. }),
  3270. smalltalk.JSObjectProxy);
  3271. smalltalk.addMethod(
  3272. smalltalk.method({
  3273. selector: "doesNotUnderstand:",
  3274. category: 'proxy',
  3275. fn: function (aMessage){
  3276. var self=this;
  3277. return smalltalk.withContext(function($ctx1) {
  3278. var $2,$1;
  3279. $2=_st(self)._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  3280. if(($receiver = $2) == nil || $receiver == undefined){
  3281. $1=smalltalk.Object.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  3282. } else {
  3283. var jsSelector;
  3284. jsSelector=$receiver;
  3285. $1=_st(self)._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  3286. };
  3287. return $1;
  3288. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.JSObjectProxy)})},
  3289. args: ["aMessage"],
  3290. source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptSelector)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments ]",
  3291. messageSends: ["ifNil:ifNotNil:", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments", "lookupProperty:", "asJavaScriptSelector", "selector"],
  3292. referencedClasses: []
  3293. }),
  3294. smalltalk.JSObjectProxy);
  3295. smalltalk.addMethod(
  3296. smalltalk.method({
  3297. selector: "forwardMessage:withArguments:",
  3298. category: 'proxy',
  3299. fn: function (aString,anArray){
  3300. var self=this;
  3301. return smalltalk.withContext(function($ctx1) {
  3302. return smalltalk.send(self._jsObject(), aString, anArray);
  3303. ;
  3304. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},smalltalk.JSObjectProxy)})},
  3305. args: ["aString", "anArray"],
  3306. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  3307. messageSends: [],
  3308. referencedClasses: []
  3309. }),
  3310. smalltalk.JSObjectProxy);
  3311. smalltalk.addMethod(
  3312. smalltalk.method({
  3313. selector: "inspectOn:",
  3314. category: 'proxy',
  3315. fn: function (anInspector){
  3316. var self=this;
  3317. var variables;
  3318. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3319. return smalltalk.withContext(function($ctx1) {
  3320. variables=_st($Dictionary())._new();
  3321. _st(variables)._at_put_("#self",_st(self)._jsObject());
  3322. _st(anInspector)._setLabel_(_st(self)._printString());
  3323. _st(self)._addObjectVariablesTo_(variables);
  3324. _st(anInspector)._setVariables_(variables);
  3325. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.JSObjectProxy)})},
  3326. args: ["anInspector"],
  3327. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09self addObjectVariablesTo: variables.\x0a\x09anInspector setVariables: variables",
  3328. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  3329. referencedClasses: ["Dictionary"]
  3330. }),
  3331. smalltalk.JSObjectProxy);
  3332. smalltalk.addMethod(
  3333. smalltalk.method({
  3334. selector: "jsObject",
  3335. category: 'accessing',
  3336. fn: function (){
  3337. var self=this;
  3338. return smalltalk.withContext(function($ctx1) {
  3339. var $1;
  3340. $1=self["@jsObject"];
  3341. return $1;
  3342. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
  3343. args: [],
  3344. source: "jsObject\x0a\x09^jsObject",
  3345. messageSends: [],
  3346. referencedClasses: []
  3347. }),
  3348. smalltalk.JSObjectProxy);
  3349. smalltalk.addMethod(
  3350. smalltalk.method({
  3351. selector: "jsObject:",
  3352. category: 'accessing',
  3353. fn: function (aJSObject){
  3354. var self=this;
  3355. return smalltalk.withContext(function($ctx1) {
  3356. self["@jsObject"]=aJSObject;
  3357. return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject},smalltalk.JSObjectProxy)})},
  3358. args: ["aJSObject"],
  3359. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  3360. messageSends: [],
  3361. referencedClasses: []
  3362. }),
  3363. smalltalk.JSObjectProxy);
  3364. smalltalk.addMethod(
  3365. smalltalk.method({
  3366. selector: "keysAndValuesDo:",
  3367. category: 'enumerating',
  3368. fn: function (aBlock){
  3369. var self=this;
  3370. return smalltalk.withContext(function($ctx1) {
  3371. var o = self['@jsObject'];
  3372. for(var i in o) {
  3373. aBlock(i, o[i]);
  3374. }
  3375. ;
  3376. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.JSObjectProxy)})},
  3377. args: ["aBlock"],
  3378. source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock(i, o[i]);\x0a\x09\x09}\x0a\x09>",
  3379. messageSends: [],
  3380. referencedClasses: []
  3381. }),
  3382. smalltalk.JSObjectProxy);
  3383. smalltalk.addMethod(
  3384. smalltalk.method({
  3385. selector: "lookupProperty:",
  3386. category: 'accessing',
  3387. fn: function (aString){
  3388. var self=this;
  3389. return smalltalk.withContext(function($ctx1) {
  3390. return aString in self._jsObject() ? aString : nil;
  3391. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},smalltalk.JSObjectProxy)})},
  3392. args: ["aString"],
  3393. source: "lookupProperty: aString\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<return aString in self._jsObject() ? aString : nil>",
  3394. messageSends: [],
  3395. referencedClasses: []
  3396. }),
  3397. smalltalk.JSObjectProxy);
  3398. smalltalk.addMethod(
  3399. smalltalk.method({
  3400. selector: "printOn:",
  3401. category: 'printing',
  3402. fn: function (aStream){
  3403. var self=this;
  3404. return smalltalk.withContext(function($ctx1) {
  3405. _st(aStream)._nextPutAll_(_st(_st(self)._jsObject())._toString());
  3406. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
  3407. args: ["aStream"],
  3408. source: "printOn: aStream\x0a\x09aStream nextPutAll: self jsObject toString",
  3409. messageSends: ["nextPutAll:", "toString", "jsObject"],
  3410. referencedClasses: []
  3411. }),
  3412. smalltalk.JSObjectProxy);
  3413. smalltalk.addMethod(
  3414. smalltalk.method({
  3415. selector: "value",
  3416. category: 'accessing',
  3417. fn: function (){
  3418. var self=this;
  3419. return smalltalk.withContext(function($ctx1) {
  3420. var $1;
  3421. $1=_st(self)._at_ifAbsent_("value",(function(){
  3422. return smalltalk.withContext(function($ctx2) {
  3423. return smalltalk.Object.fn.prototype._value.apply(_st(self), []);
  3424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3425. return $1;
  3426. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.JSObjectProxy)})},
  3427. args: [],
  3428. source: "value\x0a\x09\x22if attribute 'value' exists on the JS object return it,\x0a\x09otherwise return the result of Object>>value.\x22\x0a\x09\x0a\x09^ self \x0a\x09\x09at: 'value' \x0a\x09\x09ifAbsent: [ super value ]",
  3429. messageSends: ["at:ifAbsent:", "value"],
  3430. referencedClasses: []
  3431. }),
  3432. smalltalk.JSObjectProxy);
  3433. smalltalk.addMethod(
  3434. smalltalk.method({
  3435. selector: "on:",
  3436. category: 'instance creation',
  3437. fn: function (aJSObject){
  3438. var self=this;
  3439. return smalltalk.withContext(function($ctx1) {
  3440. var $2,$3,$1;
  3441. $2=_st(self)._new();
  3442. _st($2)._jsObject_(aJSObject);
  3443. $3=_st($2)._yourself();
  3444. $1=$3;
  3445. return $1;
  3446. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},smalltalk.JSObjectProxy.klass)})},
  3447. args: ["aJSObject"],
  3448. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  3449. messageSends: ["jsObject:", "new", "yourself"],
  3450. referencedClasses: []
  3451. }),
  3452. smalltalk.JSObjectProxy.klass);
  3453. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  3454. smalltalk.Number.comment="Number holds the most general methods for dealing with numbers.\x0aNumber is directly mapped to JavaScript Number.\x0a\x0aMost arithmetic methods like `#+` `#/` `#-` `#max:` are directly inlined into javascript.\x0a\x0a##Enumerating\x0aA Number can be used to evaluate a Block a fixed number of times:\x0a\x0a\x095 timesRepeat: [Transcript show: 'This will be printed 5 times'; cr].\x0a\x09\x0a\x091 to: 5 do: [:aNumber| Transcript show: aNumber asString; cr].\x0a\x09\x0a\x091 to: 10 by: 2 do: [:aNumber| Transcript show: aNumber asString; cr]."
  3455. smalltalk.addMethod(
  3456. smalltalk.method({
  3457. selector: "&",
  3458. category: 'converting',
  3459. fn: function (aNumber){
  3460. var self=this;
  3461. return smalltalk.withContext(function($ctx1) {
  3462. return self & aNumber;
  3463. return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},smalltalk.Number)})},
  3464. args: ["aNumber"],
  3465. source: "& aNumber\x0a\x09<return self & aNumber>",
  3466. messageSends: [],
  3467. referencedClasses: []
  3468. }),
  3469. smalltalk.Number);
  3470. smalltalk.addMethod(
  3471. smalltalk.method({
  3472. selector: "*",
  3473. category: 'arithmetic',
  3474. fn: function (aNumber){
  3475. var self=this;
  3476. return smalltalk.withContext(function($ctx1) {
  3477. return self * aNumber;
  3478. return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},smalltalk.Number)})},
  3479. args: ["aNumber"],
  3480. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3481. messageSends: [],
  3482. referencedClasses: []
  3483. }),
  3484. smalltalk.Number);
  3485. smalltalk.addMethod(
  3486. smalltalk.method({
  3487. selector: "+",
  3488. category: 'arithmetic',
  3489. fn: function (aNumber){
  3490. var self=this;
  3491. return smalltalk.withContext(function($ctx1) {
  3492. return self + aNumber;
  3493. return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},smalltalk.Number)})},
  3494. args: ["aNumber"],
  3495. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3496. messageSends: [],
  3497. referencedClasses: []
  3498. }),
  3499. smalltalk.Number);
  3500. smalltalk.addMethod(
  3501. smalltalk.method({
  3502. selector: "-",
  3503. category: 'arithmetic',
  3504. fn: function (aNumber){
  3505. var self=this;
  3506. return smalltalk.withContext(function($ctx1) {
  3507. return self - aNumber;
  3508. return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},smalltalk.Number)})},
  3509. args: ["aNumber"],
  3510. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3511. messageSends: [],
  3512. referencedClasses: []
  3513. }),
  3514. smalltalk.Number);
  3515. smalltalk.addMethod(
  3516. smalltalk.method({
  3517. selector: "/",
  3518. category: 'arithmetic',
  3519. fn: function (aNumber){
  3520. var self=this;
  3521. return smalltalk.withContext(function($ctx1) {
  3522. return self / aNumber;
  3523. return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},smalltalk.Number)})},
  3524. args: ["aNumber"],
  3525. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3526. messageSends: [],
  3527. referencedClasses: []
  3528. }),
  3529. smalltalk.Number);
  3530. smalltalk.addMethod(
  3531. smalltalk.method({
  3532. selector: "<",
  3533. category: 'comparing',
  3534. fn: function (aNumber){
  3535. var self=this;
  3536. return smalltalk.withContext(function($ctx1) {
  3537. return self < aNumber;
  3538. return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},smalltalk.Number)})},
  3539. args: ["aNumber"],
  3540. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3541. messageSends: [],
  3542. referencedClasses: []
  3543. }),
  3544. smalltalk.Number);
  3545. smalltalk.addMethod(
  3546. smalltalk.method({
  3547. selector: "<=",
  3548. category: 'comparing',
  3549. fn: function (aNumber){
  3550. var self=this;
  3551. return smalltalk.withContext(function($ctx1) {
  3552. return self <= aNumber;
  3553. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},smalltalk.Number)})},
  3554. args: ["aNumber"],
  3555. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3556. messageSends: [],
  3557. referencedClasses: []
  3558. }),
  3559. smalltalk.Number);
  3560. smalltalk.addMethod(
  3561. smalltalk.method({
  3562. selector: "=",
  3563. category: 'comparing',
  3564. fn: function (aNumber){
  3565. var self=this;
  3566. return smalltalk.withContext(function($ctx1) {
  3567. if(! aNumber._isNumber || ! aNumber._isNumber()) {
  3568. return false;
  3569. }
  3570. return Number(self) == aNumber
  3571. ;
  3572. return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},smalltalk.Number)})},
  3573. args: ["aNumber"],
  3574. source: "= aNumber\x0a\x09<\x0a\x09\x09if(! aNumber._isNumber || ! aNumber._isNumber()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Number(self) == aNumber\x0a\x09>",
  3575. messageSends: [],
  3576. referencedClasses: []
  3577. }),
  3578. smalltalk.Number);
  3579. smalltalk.addMethod(
  3580. smalltalk.method({
  3581. selector: ">",
  3582. category: 'comparing',
  3583. fn: function (aNumber){
  3584. var self=this;
  3585. return smalltalk.withContext(function($ctx1) {
  3586. return self > aNumber;
  3587. return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},smalltalk.Number)})},
  3588. args: ["aNumber"],
  3589. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3590. messageSends: [],
  3591. referencedClasses: []
  3592. }),
  3593. smalltalk.Number);
  3594. smalltalk.addMethod(
  3595. smalltalk.method({
  3596. selector: ">=",
  3597. category: 'comparing',
  3598. fn: function (aNumber){
  3599. var self=this;
  3600. return smalltalk.withContext(function($ctx1) {
  3601. return self >= aNumber;
  3602. return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},smalltalk.Number)})},
  3603. args: ["aNumber"],
  3604. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3605. messageSends: [],
  3606. referencedClasses: []
  3607. }),
  3608. smalltalk.Number);
  3609. smalltalk.addMethod(
  3610. smalltalk.method({
  3611. selector: "@",
  3612. category: 'converting',
  3613. fn: function (aNumber){
  3614. var self=this;
  3615. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3616. return smalltalk.withContext(function($ctx1) {
  3617. var $1;
  3618. $1=_st($Point())._x_y_(self,aNumber);
  3619. return $1;
  3620. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},smalltalk.Number)})},
  3621. args: ["aNumber"],
  3622. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  3623. messageSends: ["x:y:"],
  3624. referencedClasses: ["Point"]
  3625. }),
  3626. smalltalk.Number);
  3627. smalltalk.addMethod(
  3628. smalltalk.method({
  3629. selector: "IsImmutable",
  3630. category: 'testing',
  3631. fn: function (){
  3632. var self=this;
  3633. return smalltalk.withContext(function($ctx1) {
  3634. return true;
  3635. }, function($ctx1) {$ctx1.fill(self,"IsImmutable",{},smalltalk.Number)})},
  3636. args: [],
  3637. source: "IsImmutable\x0a\x09^ true",
  3638. messageSends: [],
  3639. referencedClasses: []
  3640. }),
  3641. smalltalk.Number);
  3642. smalltalk.addMethod(
  3643. smalltalk.method({
  3644. selector: "\x5c\x5c",
  3645. category: 'arithmetic',
  3646. fn: function (aNumber){
  3647. var self=this;
  3648. return smalltalk.withContext(function($ctx1) {
  3649. return self % aNumber;
  3650. return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},smalltalk.Number)})},
  3651. args: ["aNumber"],
  3652. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3653. messageSends: [],
  3654. referencedClasses: []
  3655. }),
  3656. smalltalk.Number);
  3657. smalltalk.addMethod(
  3658. smalltalk.method({
  3659. selector: "abs",
  3660. category: 'arithmetic',
  3661. fn: function (){
  3662. var self=this;
  3663. return smalltalk.withContext(function($ctx1) {
  3664. return Math.abs(self);;
  3665. return self}, function($ctx1) {$ctx1.fill(self,"abs",{},smalltalk.Number)})},
  3666. args: [],
  3667. source: "abs\x0a\x09<return Math.abs(self);>",
  3668. messageSends: [],
  3669. referencedClasses: []
  3670. }),
  3671. smalltalk.Number);
  3672. smalltalk.addMethod(
  3673. smalltalk.method({
  3674. selector: "asJSON",
  3675. category: 'converting',
  3676. fn: function (){
  3677. var self=this;
  3678. return smalltalk.withContext(function($ctx1) {
  3679. var $1;
  3680. $1=self;
  3681. return $1;
  3682. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Number)})},
  3683. args: [],
  3684. source: "asJSON\x0a\x09^self",
  3685. messageSends: [],
  3686. referencedClasses: []
  3687. }),
  3688. smalltalk.Number);
  3689. smalltalk.addMethod(
  3690. smalltalk.method({
  3691. selector: "asJavascript",
  3692. category: 'converting',
  3693. fn: function (){
  3694. var self=this;
  3695. return smalltalk.withContext(function($ctx1) {
  3696. var $1;
  3697. $1=_st(_st("(").__comma(_st(self)._printString())).__comma(")");
  3698. return $1;
  3699. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Number)})},
  3700. args: [],
  3701. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  3702. messageSends: [",", "printString"],
  3703. referencedClasses: []
  3704. }),
  3705. smalltalk.Number);
  3706. smalltalk.addMethod(
  3707. smalltalk.method({
  3708. selector: "asPoint",
  3709. category: 'converting',
  3710. fn: function (){
  3711. var self=this;
  3712. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3713. return smalltalk.withContext(function($ctx1) {
  3714. var $1;
  3715. $1=_st($Point())._x_y_(self,self);
  3716. return $1;
  3717. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Number)})},
  3718. args: [],
  3719. source: "asPoint\x0a\x09^Point x: self y: self",
  3720. messageSends: ["x:y:"],
  3721. referencedClasses: ["Point"]
  3722. }),
  3723. smalltalk.Number);
  3724. smalltalk.addMethod(
  3725. smalltalk.method({
  3726. selector: "asString",
  3727. category: 'converting',
  3728. fn: function (){
  3729. var self=this;
  3730. return smalltalk.withContext(function($ctx1) {
  3731. return String(self) ;
  3732. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Number)})},
  3733. args: [],
  3734. source: "asString\x0a\x09< return String(self) >",
  3735. messageSends: [],
  3736. referencedClasses: []
  3737. }),
  3738. smalltalk.Number);
  3739. smalltalk.addMethod(
  3740. smalltalk.method({
  3741. selector: "atRandom",
  3742. category: 'converting',
  3743. fn: function (){
  3744. var self=this;
  3745. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  3746. return smalltalk.withContext(function($ctx1) {
  3747. var $1;
  3748. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3749. return $1;
  3750. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.Number)})},
  3751. args: [],
  3752. source: "atRandom\x0a\x09^(Random new next * self) truncated + 1",
  3753. messageSends: ["+", "truncated", "*", "next", "new"],
  3754. referencedClasses: ["Random"]
  3755. }),
  3756. smalltalk.Number);
  3757. smalltalk.addMethod(
  3758. smalltalk.method({
  3759. selector: "copy",
  3760. category: 'copying',
  3761. fn: function (){
  3762. var self=this;
  3763. return smalltalk.withContext(function($ctx1) {
  3764. var $1;
  3765. $1=self;
  3766. return $1;
  3767. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Number)})},
  3768. args: [],
  3769. source: "copy\x0a\x09^self",
  3770. messageSends: [],
  3771. referencedClasses: []
  3772. }),
  3773. smalltalk.Number);
  3774. smalltalk.addMethod(
  3775. smalltalk.method({
  3776. selector: "deepCopy",
  3777. category: 'copying',
  3778. fn: function (){
  3779. var self=this;
  3780. return smalltalk.withContext(function($ctx1) {
  3781. var $1;
  3782. $1=_st(self)._copy();
  3783. return $1;
  3784. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Number)})},
  3785. args: [],
  3786. source: "deepCopy\x0a\x09^self copy",
  3787. messageSends: ["copy"],
  3788. referencedClasses: []
  3789. }),
  3790. smalltalk.Number);
  3791. smalltalk.addMethod(
  3792. smalltalk.method({
  3793. selector: "even",
  3794. category: 'testing',
  3795. fn: function (){
  3796. var self=this;
  3797. return smalltalk.withContext(function($ctx1) {
  3798. var $1;
  3799. $1=_st((0)).__eq(_st(self).__backslash_backslash((2)));
  3800. return $1;
  3801. }, function($ctx1) {$ctx1.fill(self,"even",{},smalltalk.Number)})},
  3802. args: [],
  3803. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3804. messageSends: ["=", "\x5c\x5c"],
  3805. referencedClasses: []
  3806. }),
  3807. smalltalk.Number);
  3808. smalltalk.addMethod(
  3809. smalltalk.method({
  3810. selector: "identityHash",
  3811. category: 'accessing',
  3812. fn: function (){
  3813. var self=this;
  3814. return smalltalk.withContext(function($ctx1) {
  3815. var $1;
  3816. $1=_st(_st(self)._asString()).__comma("n");
  3817. return $1;
  3818. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Number)})},
  3819. args: [],
  3820. source: "identityHash\x0a\x09^self asString, 'n'",
  3821. messageSends: [",", "asString"],
  3822. referencedClasses: []
  3823. }),
  3824. smalltalk.Number);
  3825. smalltalk.addMethod(
  3826. smalltalk.method({
  3827. selector: "isNumber",
  3828. category: 'testing',
  3829. fn: function (){
  3830. var self=this;
  3831. return smalltalk.withContext(function($ctx1) {
  3832. return true;
  3833. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Number)})},
  3834. args: [],
  3835. source: "isNumber\x0a\x09^true",
  3836. messageSends: [],
  3837. referencedClasses: []
  3838. }),
  3839. smalltalk.Number);
  3840. smalltalk.addMethod(
  3841. smalltalk.method({
  3842. selector: "isZero",
  3843. category: 'testing',
  3844. fn: function (){
  3845. var self=this;
  3846. return smalltalk.withContext(function($ctx1) {
  3847. var $1;
  3848. $1=_st(self).__eq((0));
  3849. return $1;
  3850. }, function($ctx1) {$ctx1.fill(self,"isZero",{},smalltalk.Number)})},
  3851. args: [],
  3852. source: "isZero\x0a\x09^self = 0",
  3853. messageSends: ["="],
  3854. referencedClasses: []
  3855. }),
  3856. smalltalk.Number);
  3857. smalltalk.addMethod(
  3858. smalltalk.method({
  3859. selector: "max:",
  3860. category: 'arithmetic',
  3861. fn: function (aNumber){
  3862. var self=this;
  3863. return smalltalk.withContext(function($ctx1) {
  3864. return Math.max(self, aNumber);;
  3865. return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},smalltalk.Number)})},
  3866. args: ["aNumber"],
  3867. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3868. messageSends: [],
  3869. referencedClasses: []
  3870. }),
  3871. smalltalk.Number);
  3872. smalltalk.addMethod(
  3873. smalltalk.method({
  3874. selector: "min:",
  3875. category: 'arithmetic',
  3876. fn: function (aNumber){
  3877. var self=this;
  3878. return smalltalk.withContext(function($ctx1) {
  3879. return Math.min(self, aNumber);;
  3880. return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},smalltalk.Number)})},
  3881. args: ["aNumber"],
  3882. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3883. messageSends: [],
  3884. referencedClasses: []
  3885. }),
  3886. smalltalk.Number);
  3887. smalltalk.addMethod(
  3888. smalltalk.method({
  3889. selector: "negated",
  3890. category: 'arithmetic',
  3891. fn: function (){
  3892. var self=this;
  3893. return smalltalk.withContext(function($ctx1) {
  3894. var $1;
  3895. $1=_st((0)).__minus(self);
  3896. return $1;
  3897. }, function($ctx1) {$ctx1.fill(self,"negated",{},smalltalk.Number)})},
  3898. args: [],
  3899. source: "negated\x0a\x09^0 - self",
  3900. messageSends: ["-"],
  3901. referencedClasses: []
  3902. }),
  3903. smalltalk.Number);
  3904. smalltalk.addMethod(
  3905. smalltalk.method({
  3906. selector: "negative",
  3907. category: 'testing',
  3908. fn: function (){
  3909. var self=this;
  3910. return smalltalk.withContext(function($ctx1) {
  3911. var $1;
  3912. $1=_st(self).__lt((0));
  3913. return $1;
  3914. }, function($ctx1) {$ctx1.fill(self,"negative",{},smalltalk.Number)})},
  3915. args: [],
  3916. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  3917. messageSends: ["<"],
  3918. referencedClasses: []
  3919. }),
  3920. smalltalk.Number);
  3921. smalltalk.addMethod(
  3922. smalltalk.method({
  3923. selector: "odd",
  3924. category: 'testing',
  3925. fn: function (){
  3926. var self=this;
  3927. return smalltalk.withContext(function($ctx1) {
  3928. var $1;
  3929. $1=_st(_st(self)._even())._not();
  3930. return $1;
  3931. }, function($ctx1) {$ctx1.fill(self,"odd",{},smalltalk.Number)})},
  3932. args: [],
  3933. source: "odd\x0a\x09^ self even not",
  3934. messageSends: ["not", "even"],
  3935. referencedClasses: []
  3936. }),
  3937. smalltalk.Number);
  3938. smalltalk.addMethod(
  3939. smalltalk.method({
  3940. selector: "positive",
  3941. category: 'testing',
  3942. fn: function (){
  3943. var self=this;
  3944. return smalltalk.withContext(function($ctx1) {
  3945. var $1;
  3946. $1=_st(self).__gt_eq((0));
  3947. return $1;
  3948. }, function($ctx1) {$ctx1.fill(self,"positive",{},smalltalk.Number)})},
  3949. args: [],
  3950. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  3951. messageSends: [">="],
  3952. referencedClasses: []
  3953. }),
  3954. smalltalk.Number);
  3955. smalltalk.addMethod(
  3956. smalltalk.method({
  3957. selector: "printOn:",
  3958. category: 'printing',
  3959. fn: function (aStream){
  3960. var self=this;
  3961. return smalltalk.withContext(function($ctx1) {
  3962. _st(aStream)._nextPutAll_(_st(self)._asString());
  3963. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Number)})},
  3964. args: ["aStream"],
  3965. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3966. messageSends: ["nextPutAll:", "asString"],
  3967. referencedClasses: []
  3968. }),
  3969. smalltalk.Number);
  3970. smalltalk.addMethod(
  3971. smalltalk.method({
  3972. selector: "printShowingDecimalPlaces:",
  3973. category: 'printing',
  3974. fn: function (placesDesired){
  3975. var self=this;
  3976. return smalltalk.withContext(function($ctx1) {
  3977. return self.toFixed(placesDesired);
  3978. return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},smalltalk.Number)})},
  3979. args: ["placesDesired"],
  3980. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  3981. messageSends: [],
  3982. referencedClasses: []
  3983. }),
  3984. smalltalk.Number);
  3985. smalltalk.addMethod(
  3986. smalltalk.method({
  3987. selector: "rounded",
  3988. category: 'converting',
  3989. fn: function (){
  3990. var self=this;
  3991. return smalltalk.withContext(function($ctx1) {
  3992. return Math.round(self);;
  3993. return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},smalltalk.Number)})},
  3994. args: [],
  3995. source: "rounded\x0a\x09<return Math.round(self);>",
  3996. messageSends: [],
  3997. referencedClasses: []
  3998. }),
  3999. smalltalk.Number);
  4000. smalltalk.addMethod(
  4001. smalltalk.method({
  4002. selector: "sqrt",
  4003. category: 'arithmetic',
  4004. fn: function (){
  4005. var self=this;
  4006. return smalltalk.withContext(function($ctx1) {
  4007. return Math.sqrt(self);
  4008. return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},smalltalk.Number)})},
  4009. args: [],
  4010. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4011. messageSends: [],
  4012. referencedClasses: []
  4013. }),
  4014. smalltalk.Number);
  4015. smalltalk.addMethod(
  4016. smalltalk.method({
  4017. selector: "squared",
  4018. category: 'arithmetic',
  4019. fn: function (){
  4020. var self=this;
  4021. return smalltalk.withContext(function($ctx1) {
  4022. var $1;
  4023. $1=_st(self).__star(self);
  4024. return $1;
  4025. }, function($ctx1) {$ctx1.fill(self,"squared",{},smalltalk.Number)})},
  4026. args: [],
  4027. source: "squared\x0a\x09^self * self",
  4028. messageSends: ["*"],
  4029. referencedClasses: []
  4030. }),
  4031. smalltalk.Number);
  4032. smalltalk.addMethod(
  4033. smalltalk.method({
  4034. selector: "timesRepeat:",
  4035. category: 'enumerating',
  4036. fn: function (aBlock){
  4037. var self=this;
  4038. var count;
  4039. return smalltalk.withContext(function($ctx1) {
  4040. count=(1);
  4041. _st((function(){
  4042. return smalltalk.withContext(function($ctx2) {
  4043. return _st(count).__gt(self);
  4044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  4045. return smalltalk.withContext(function($ctx2) {
  4046. _st(aBlock)._value();
  4047. count=_st(count).__plus((1));
  4048. return count;
  4049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4050. return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},smalltalk.Number)})},
  4051. args: ["aBlock"],
  4052. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1]",
  4053. messageSends: ["whileFalse:", "value", "+", ">"],
  4054. referencedClasses: []
  4055. }),
  4056. smalltalk.Number);
  4057. smalltalk.addMethod(
  4058. smalltalk.method({
  4059. selector: "to:",
  4060. category: 'converting',
  4061. fn: function (aNumber){
  4062. var self=this;
  4063. var array,first,last,count;
  4064. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4065. return smalltalk.withContext(function($ctx1) {
  4066. var $1;
  4067. first=_st(self)._truncated();
  4068. last=_st(_st(aNumber)._truncated()).__plus((1));
  4069. count=(1);
  4070. array=_st($Array())._new();
  4071. _st(_st(last).__minus(first))._timesRepeat_((function(){
  4072. return smalltalk.withContext(function($ctx2) {
  4073. _st(array)._at_put_(count,first);
  4074. count=_st(count).__plus((1));
  4075. count;
  4076. first=_st(first).__plus((1));
  4077. return first;
  4078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4079. $1=array;
  4080. return $1;
  4081. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},smalltalk.Number)})},
  4082. args: ["aNumber"],
  4083. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1].\x0a\x09^array",
  4084. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  4085. referencedClasses: ["Array"]
  4086. }),
  4087. smalltalk.Number);
  4088. smalltalk.addMethod(
  4089. smalltalk.method({
  4090. selector: "to:by:",
  4091. category: 'converting',
  4092. fn: function (stop,step){
  4093. var self=this;
  4094. var array,value,pos;
  4095. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4096. return smalltalk.withContext(function($ctx1) {
  4097. var $1,$2,$3;
  4098. value=self;
  4099. array=_st($Array())._new();
  4100. pos=(1);
  4101. $1=_st(step).__eq((0));
  4102. if(smalltalk.assert($1)){
  4103. _st(self)._error_("step must be non-zero");
  4104. };
  4105. $2=_st(step).__lt((0));
  4106. if(smalltalk.assert($2)){
  4107. _st((function(){
  4108. return smalltalk.withContext(function($ctx2) {
  4109. return _st(value).__gt_eq(stop);
  4110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4111. return smalltalk.withContext(function($ctx2) {
  4112. _st(array)._at_put_(pos,value);
  4113. pos=_st(pos).__plus((1));
  4114. pos;
  4115. value=_st(value).__plus(step);
  4116. return value;
  4117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4118. } else {
  4119. _st((function(){
  4120. return smalltalk.withContext(function($ctx2) {
  4121. return _st(value).__lt_eq(stop);
  4122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4123. return smalltalk.withContext(function($ctx2) {
  4124. _st(array)._at_put_(pos,value);
  4125. pos=_st(pos).__plus((1));
  4126. pos;
  4127. value=_st(value).__plus(step);
  4128. return value;
  4129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4130. };
  4131. $3=array;
  4132. return $3;
  4133. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},smalltalk.Number)})},
  4134. args: ["stop", "step"],
  4135. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step]].\x0a\x09^array",
  4136. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  4137. referencedClasses: ["Array"]
  4138. }),
  4139. smalltalk.Number);
  4140. smalltalk.addMethod(
  4141. smalltalk.method({
  4142. selector: "to:by:do:",
  4143. category: 'enumerating',
  4144. fn: function (stop,step,aBlock){
  4145. var self=this;
  4146. var value;
  4147. return smalltalk.withContext(function($ctx1) {
  4148. var $1,$2;
  4149. value=self;
  4150. $1=_st(step).__eq((0));
  4151. if(smalltalk.assert($1)){
  4152. _st(self)._error_("step must be non-zero");
  4153. };
  4154. $2=_st(step).__lt((0));
  4155. if(smalltalk.assert($2)){
  4156. _st((function(){
  4157. return smalltalk.withContext(function($ctx2) {
  4158. return _st(value).__gt_eq(stop);
  4159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4160. return smalltalk.withContext(function($ctx2) {
  4161. _st(aBlock)._value_(value);
  4162. value=_st(value).__plus(step);
  4163. return value;
  4164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4165. } else {
  4166. _st((function(){
  4167. return smalltalk.withContext(function($ctx2) {
  4168. return _st(value).__lt_eq(stop);
  4169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4170. return smalltalk.withContext(function($ctx2) {
  4171. _st(aBlock)._value_(value);
  4172. value=_st(value).__plus(step);
  4173. return value;
  4174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4175. };
  4176. return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},smalltalk.Number)})},
  4177. args: ["stop", "step", "aBlock"],
  4178. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step]]",
  4179. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  4180. referencedClasses: []
  4181. }),
  4182. smalltalk.Number);
  4183. smalltalk.addMethod(
  4184. smalltalk.method({
  4185. selector: "to:do:",
  4186. category: 'enumerating',
  4187. fn: function (stop,aBlock){
  4188. var self=this;
  4189. var nextValue;
  4190. return smalltalk.withContext(function($ctx1) {
  4191. nextValue=self;
  4192. _st((function(){
  4193. return smalltalk.withContext(function($ctx2) {
  4194. return _st(nextValue).__lt_eq(stop);
  4195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4196. return smalltalk.withContext(function($ctx2) {
  4197. _st(aBlock)._value_(nextValue);
  4198. nextValue=_st(nextValue).__plus((1));
  4199. return nextValue;
  4200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4201. return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},smalltalk.Number)})},
  4202. args: ["stop", "aBlock"],
  4203. source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[nextValue <= stop]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1]",
  4204. messageSends: ["whileTrue:", "value:", "+", "<="],
  4205. referencedClasses: []
  4206. }),
  4207. smalltalk.Number);
  4208. smalltalk.addMethod(
  4209. smalltalk.method({
  4210. selector: "truncated",
  4211. category: 'converting',
  4212. fn: function (){
  4213. var self=this;
  4214. return smalltalk.withContext(function($ctx1) {
  4215. if(self >= 0) {
  4216. return Math.floor(self);
  4217. } else {
  4218. return Math.floor(self * (-1)) * (-1);
  4219. };
  4220. ;
  4221. return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},smalltalk.Number)})},
  4222. args: [],
  4223. source: "truncated\x0a\x09<\x0a\x09\x09if(self >>= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09>",
  4224. messageSends: [],
  4225. referencedClasses: []
  4226. }),
  4227. smalltalk.Number);
  4228. smalltalk.addMethod(
  4229. smalltalk.method({
  4230. selector: "|",
  4231. category: 'converting',
  4232. fn: function (aNumber){
  4233. var self=this;
  4234. return smalltalk.withContext(function($ctx1) {
  4235. return self | aNumber;
  4236. return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},smalltalk.Number)})},
  4237. args: ["aNumber"],
  4238. source: "| aNumber\x0a\x09<return self | aNumber>",
  4239. messageSends: [],
  4240. referencedClasses: []
  4241. }),
  4242. smalltalk.Number);
  4243. smalltalk.addMethod(
  4244. smalltalk.method({
  4245. selector: "pi",
  4246. category: 'instance creation',
  4247. fn: function (){
  4248. var self=this;
  4249. return smalltalk.withContext(function($ctx1) {
  4250. return Math.PI;
  4251. return self}, function($ctx1) {$ctx1.fill(self,"pi",{},smalltalk.Number.klass)})},
  4252. args: [],
  4253. source: "pi\x0a\x09<return Math.PI>",
  4254. messageSends: [],
  4255. referencedClasses: []
  4256. }),
  4257. smalltalk.Number.klass);
  4258. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  4259. smalltalk.addMethod(
  4260. smalltalk.method({
  4261. selector: "addElement:",
  4262. category: 'accessing',
  4263. fn: function (anObject){
  4264. var self=this;
  4265. return smalltalk.withContext(function($ctx1) {
  4266. self.elements.addElement(anObject);
  4267. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},smalltalk.Organizer)})},
  4268. args: ["anObject"],
  4269. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  4270. messageSends: [],
  4271. referencedClasses: []
  4272. }),
  4273. smalltalk.Organizer);
  4274. smalltalk.addMethod(
  4275. smalltalk.method({
  4276. selector: "elements",
  4277. category: 'accessing',
  4278. fn: function (){
  4279. var self=this;
  4280. return smalltalk.withContext(function($ctx1) {
  4281. var $1;
  4282. $1=_st(_st(self)._basicAt_("elements"))._copy();
  4283. return $1;
  4284. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.Organizer)})},
  4285. args: [],
  4286. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  4287. messageSends: ["copy", "basicAt:"],
  4288. referencedClasses: []
  4289. }),
  4290. smalltalk.Organizer);
  4291. smalltalk.addMethod(
  4292. smalltalk.method({
  4293. selector: "removeElement:",
  4294. category: 'accessing',
  4295. fn: function (anObject){
  4296. var self=this;
  4297. return smalltalk.withContext(function($ctx1) {
  4298. self.elements.removeElement(anObject);
  4299. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},smalltalk.Organizer)})},
  4300. args: ["anObject"],
  4301. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  4302. messageSends: [],
  4303. referencedClasses: []
  4304. }),
  4305. smalltalk.Organizer);
  4306. smalltalk.addClass('ClassOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  4307. smalltalk.addMethod(
  4308. smalltalk.method({
  4309. selector: "addElement:",
  4310. category: 'accessing',
  4311. fn: function (aString){
  4312. var self=this;
  4313. function $ProtocolAdded(){return smalltalk.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  4314. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  4315. return smalltalk.withContext(function($ctx1) {
  4316. var $1,$2;
  4317. smalltalk.Organizer.fn.prototype._addElement_.apply(_st(self), [aString]);
  4318. $1=_st($ProtocolAdded())._new();
  4319. _st($1)._protocol_(aString);
  4320. _st($1)._theClass_(_st(self)._theClass());
  4321. $2=_st($1)._yourself();
  4322. _st(_st($SystemAnnouncer())._current())._announce_($2);
  4323. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  4324. args: ["aString"],
  4325. source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  4326. messageSends: ["addElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  4327. referencedClasses: ["ProtocolAdded", "SystemAnnouncer"]
  4328. }),
  4329. smalltalk.ClassOrganizer);
  4330. smalltalk.addMethod(
  4331. smalltalk.method({
  4332. selector: "removeElement:",
  4333. category: 'accessing',
  4334. fn: function (aString){
  4335. var self=this;
  4336. function $ProtocolRemoved(){return smalltalk.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  4337. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  4338. return smalltalk.withContext(function($ctx1) {
  4339. var $1,$2;
  4340. smalltalk.Organizer.fn.prototype._removeElement_.apply(_st(self), [aString]);
  4341. $1=_st($ProtocolRemoved())._new();
  4342. _st($1)._protocol_(aString);
  4343. _st($1)._theClass_(_st(self)._theClass());
  4344. $2=_st($1)._yourself();
  4345. _st(_st($SystemAnnouncer())._current())._announce_($2);
  4346. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  4347. args: ["aString"],
  4348. source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  4349. messageSends: ["removeElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  4350. referencedClasses: ["ProtocolRemoved", "SystemAnnouncer"]
  4351. }),
  4352. smalltalk.ClassOrganizer);
  4353. smalltalk.addMethod(
  4354. smalltalk.method({
  4355. selector: "theClass",
  4356. category: 'accessing',
  4357. fn: function (){
  4358. var self=this;
  4359. return smalltalk.withContext(function($ctx1) {
  4360. return self.theClass ;
  4361. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassOrganizer)})},
  4362. args: [],
  4363. source: "theClass\x0a\x09< return self.theClass >",
  4364. messageSends: [],
  4365. referencedClasses: []
  4366. }),
  4367. smalltalk.ClassOrganizer);
  4368. smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  4369. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  4370. smalltalk.Package.comment="A Package is similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aA Package has a name, an Array of \x22requires\x22, a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name:\x0a\x0a\x09Smalltalk current packageAt: 'Kernel'\x0a\x0a...but you can also use:\x0a\x0a\x09Package named: 'Kernel'\x0a\x0aA Package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a Package supports \x22class extensions\x22 so a Package\x0acan define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows. This can easily be seen in for example class\x0aString where the method category \x22*IDE\x22 defines #inspectOn: which thus is a method belonging to the IDE package.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package fetch: 'Additional-Examples'"
  4371. smalltalk.addMethod(
  4372. smalltalk.method({
  4373. selector: "classes",
  4374. category: 'classes',
  4375. fn: function (){
  4376. var self=this;
  4377. return smalltalk.withContext(function($ctx1) {
  4378. var $1;
  4379. $1=_st(_st(self)._organization())._elements();
  4380. return $1;
  4381. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Package)})},
  4382. args: [],
  4383. source: "classes\x0a\x09^ self organization elements",
  4384. messageSends: ["elements", "organization"],
  4385. referencedClasses: []
  4386. }),
  4387. smalltalk.Package);
  4388. smalltalk.addMethod(
  4389. smalltalk.method({
  4390. selector: "commitPathJs",
  4391. category: 'accessing',
  4392. fn: function (){
  4393. var self=this;
  4394. return smalltalk.withContext(function($ctx1) {
  4395. var $2,$1;
  4396. $2=self["@commitPathJs"];
  4397. if(($receiver = $2) == nil || $receiver == undefined){
  4398. $1=_st(_st(self)._class())._defaultCommitPathJs();
  4399. } else {
  4400. $1=$2;
  4401. };
  4402. return $1;
  4403. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  4404. args: [],
  4405. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  4406. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  4407. referencedClasses: []
  4408. }),
  4409. smalltalk.Package);
  4410. smalltalk.addMethod(
  4411. smalltalk.method({
  4412. selector: "commitPathJs:",
  4413. category: 'accessing',
  4414. fn: function (aString){
  4415. var self=this;
  4416. return smalltalk.withContext(function($ctx1) {
  4417. self["@commitPathJs"]=aString;
  4418. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  4419. args: ["aString"],
  4420. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  4421. messageSends: [],
  4422. referencedClasses: []
  4423. }),
  4424. smalltalk.Package);
  4425. smalltalk.addMethod(
  4426. smalltalk.method({
  4427. selector: "commitPathSt",
  4428. category: 'accessing',
  4429. fn: function (){
  4430. var self=this;
  4431. return smalltalk.withContext(function($ctx1) {
  4432. var $2,$1;
  4433. $2=self["@commitPathSt"];
  4434. if(($receiver = $2) == nil || $receiver == undefined){
  4435. $1=_st(_st(self)._class())._defaultCommitPathSt();
  4436. } else {
  4437. $1=$2;
  4438. };
  4439. return $1;
  4440. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  4441. args: [],
  4442. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  4443. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  4444. referencedClasses: []
  4445. }),
  4446. smalltalk.Package);
  4447. smalltalk.addMethod(
  4448. smalltalk.method({
  4449. selector: "commitPathSt:",
  4450. category: 'accessing',
  4451. fn: function (aString){
  4452. var self=this;
  4453. return smalltalk.withContext(function($ctx1) {
  4454. self["@commitPathSt"]=aString;
  4455. return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  4456. args: ["aString"],
  4457. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  4458. messageSends: [],
  4459. referencedClasses: []
  4460. }),
  4461. smalltalk.Package);
  4462. smalltalk.addMethod(
  4463. smalltalk.method({
  4464. selector: "isPackage",
  4465. category: 'testing',
  4466. fn: function (){
  4467. var self=this;
  4468. return smalltalk.withContext(function($ctx1) {
  4469. return true;
  4470. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Package)})},
  4471. args: [],
  4472. source: "isPackage\x0a\x09^ true",
  4473. messageSends: [],
  4474. referencedClasses: []
  4475. }),
  4476. smalltalk.Package);
  4477. smalltalk.addMethod(
  4478. smalltalk.method({
  4479. selector: "name",
  4480. category: 'accessing',
  4481. fn: function (){
  4482. var self=this;
  4483. return smalltalk.withContext(function($ctx1) {
  4484. return self.pkgName;
  4485. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Package)})},
  4486. args: [],
  4487. source: "name\x0a\x09<return self.pkgName>",
  4488. messageSends: [],
  4489. referencedClasses: []
  4490. }),
  4491. smalltalk.Package);
  4492. smalltalk.addMethod(
  4493. smalltalk.method({
  4494. selector: "name:",
  4495. category: 'accessing',
  4496. fn: function (aString){
  4497. var self=this;
  4498. return smalltalk.withContext(function($ctx1) {
  4499. self.pkgName = aString;
  4500. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.Package)})},
  4501. args: ["aString"],
  4502. source: "name: aString\x0a\x09<self.pkgName = aString>",
  4503. messageSends: [],
  4504. referencedClasses: []
  4505. }),
  4506. smalltalk.Package);
  4507. smalltalk.addMethod(
  4508. smalltalk.method({
  4509. selector: "organization",
  4510. category: 'accessing',
  4511. fn: function (){
  4512. var self=this;
  4513. return smalltalk.withContext(function($ctx1) {
  4514. var $1;
  4515. $1=_st(self)._basicAt_("organization");
  4516. return $1;
  4517. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Package)})},
  4518. args: [],
  4519. source: "organization\x0a\x09^ self basicAt: 'organization'",
  4520. messageSends: ["basicAt:"],
  4521. referencedClasses: []
  4522. }),
  4523. smalltalk.Package);
  4524. smalltalk.addMethod(
  4525. smalltalk.method({
  4526. selector: "printOn:",
  4527. category: 'printing',
  4528. fn: function (aStream){
  4529. var self=this;
  4530. return smalltalk.withContext(function($ctx1) {
  4531. var $1,$2;
  4532. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  4533. $1=aStream;
  4534. _st($1)._nextPutAll_(" (");
  4535. _st($1)._nextPutAll_(_st(self)._name());
  4536. $2=_st($1)._nextPutAll_(")");
  4537. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Package)})},
  4538. args: ["aStream"],
  4539. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  4540. messageSends: ["printOn:", "nextPutAll:", "name"],
  4541. referencedClasses: []
  4542. }),
  4543. smalltalk.Package);
  4544. smalltalk.addMethod(
  4545. smalltalk.method({
  4546. selector: "setupClasses",
  4547. category: 'classes',
  4548. fn: function (){
  4549. var self=this;
  4550. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  4551. return smalltalk.withContext(function($ctx1) {
  4552. var $1,$2;
  4553. $1=_st(self)._classes();
  4554. _st($1)._do_((function(each){
  4555. return smalltalk.withContext(function($ctx2) {
  4556. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  4557. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4558. $2=_st($1)._do_((function(each){
  4559. return smalltalk.withContext(function($ctx2) {
  4560. return _st(each)._initialize();
  4561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4562. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},smalltalk.Package)})},
  4563. args: [],
  4564. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  4565. messageSends: ["do:", "setupClass:", "new", "classes", "initialize"],
  4566. referencedClasses: ["ClassBuilder"]
  4567. }),
  4568. smalltalk.Package);
  4569. smalltalk.addMethod(
  4570. smalltalk.method({
  4571. selector: "sortedClasses",
  4572. category: 'classes',
  4573. fn: function (){
  4574. var self=this;
  4575. return smalltalk.withContext(function($ctx1) {
  4576. var $1;
  4577. $1=_st(_st(self)._class())._sortedClasses_(_st(self)._classes());
  4578. return $1;
  4579. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},smalltalk.Package)})},
  4580. args: [],
  4581. source: "sortedClasses\x0a\x09\x22Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143).\x22\x0a\x0a\x09^self class sortedClasses: self classes",
  4582. messageSends: ["sortedClasses:", "classes", "class"],
  4583. referencedClasses: []
  4584. }),
  4585. smalltalk.Package);
  4586. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  4587. smalltalk.addMethod(
  4588. smalltalk.method({
  4589. selector: "commitPathsFromLoader",
  4590. category: 'commit paths',
  4591. fn: function (){
  4592. var self=this;
  4593. return smalltalk.withContext(function($ctx1) {
  4594. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  4595. if (!commitPath) return;
  4596. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  4597. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  4598. ;
  4599. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.Package.klass)})},
  4600. args: [],
  4601. source: "commitPathsFromLoader\x0a\x09<\x0a\x09\x09var commitPath = typeof amber !== 'undefined' && amber.commitPath;\x0a\x09\x09if (!commitPath) return;\x0a\x09\x09if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);\x0a\x09\x09if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);\x0a\x09>",
  4602. messageSends: [],
  4603. referencedClasses: []
  4604. }),
  4605. smalltalk.Package.klass);
  4606. smalltalk.addMethod(
  4607. smalltalk.method({
  4608. selector: "defaultCommitPathJs",
  4609. category: 'commit paths',
  4610. fn: function (){
  4611. var self=this;
  4612. return smalltalk.withContext(function($ctx1) {
  4613. var $2,$1;
  4614. $2=self["@defaultCommitPathJs"];
  4615. if(($receiver = $2) == nil || $receiver == undefined){
  4616. self["@defaultCommitPathJs"]="js";
  4617. $1=self["@defaultCommitPathJs"];
  4618. } else {
  4619. $1=$2;
  4620. };
  4621. return $1;
  4622. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.Package.klass)})},
  4623. args: [],
  4624. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  4625. messageSends: ["ifNil:"],
  4626. referencedClasses: []
  4627. }),
  4628. smalltalk.Package.klass);
  4629. smalltalk.addMethod(
  4630. smalltalk.method({
  4631. selector: "defaultCommitPathJs:",
  4632. category: 'commit paths',
  4633. fn: function (aString){
  4634. var self=this;
  4635. return smalltalk.withContext(function($ctx1) {
  4636. self["@defaultCommitPathJs"]=aString;
  4637. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.Package.klass)})},
  4638. args: ["aString"],
  4639. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  4640. messageSends: [],
  4641. referencedClasses: []
  4642. }),
  4643. smalltalk.Package.klass);
  4644. smalltalk.addMethod(
  4645. smalltalk.method({
  4646. selector: "defaultCommitPathSt",
  4647. category: 'commit paths',
  4648. fn: function (){
  4649. var self=this;
  4650. return smalltalk.withContext(function($ctx1) {
  4651. var $2,$1;
  4652. $2=self["@defaultCommitPathSt"];
  4653. if(($receiver = $2) == nil || $receiver == undefined){
  4654. self["@defaultCommitPathSt"]="st";
  4655. $1=self["@defaultCommitPathSt"];
  4656. } else {
  4657. $1=$2;
  4658. };
  4659. return $1;
  4660. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.Package.klass)})},
  4661. args: [],
  4662. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  4663. messageSends: ["ifNil:"],
  4664. referencedClasses: []
  4665. }),
  4666. smalltalk.Package.klass);
  4667. smalltalk.addMethod(
  4668. smalltalk.method({
  4669. selector: "defaultCommitPathSt:",
  4670. category: 'commit paths',
  4671. fn: function (aString){
  4672. var self=this;
  4673. return smalltalk.withContext(function($ctx1) {
  4674. self["@defaultCommitPathSt"]=aString;
  4675. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.Package.klass)})},
  4676. args: ["aString"],
  4677. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  4678. messageSends: [],
  4679. referencedClasses: []
  4680. }),
  4681. smalltalk.Package.klass);
  4682. smalltalk.addMethod(
  4683. smalltalk.method({
  4684. selector: "initialize",
  4685. category: 'initialization',
  4686. fn: function (){
  4687. var self=this;
  4688. return smalltalk.withContext(function($ctx1) {
  4689. smalltalk.Object.klass.fn.prototype._initialize.apply(_st(self), []);
  4690. _st(self)._commitPathsFromLoader();
  4691. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Package.klass)})},
  4692. args: [],
  4693. source: "initialize\x0a\x09super initialize.\x0a\x09self commitPathsFromLoader",
  4694. messageSends: ["initialize", "commitPathsFromLoader"],
  4695. referencedClasses: []
  4696. }),
  4697. smalltalk.Package.klass);
  4698. smalltalk.addMethod(
  4699. smalltalk.method({
  4700. selector: "load:",
  4701. category: 'loading-storing',
  4702. fn: function (aPackageName){
  4703. var self=this;
  4704. return smalltalk.withContext(function($ctx1) {
  4705. _st(self)._load_prefix_(aPackageName,_st(_st(self)._defaultCommitPathJs()).__comma("/"));
  4706. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  4707. args: ["aPackageName"],
  4708. source: "load: aPackageName\x0a\x09self load: aPackageName prefix: self defaultCommitPathJs, '/'",
  4709. messageSends: ["load:prefix:", ",", "defaultCommitPathJs"],
  4710. referencedClasses: []
  4711. }),
  4712. smalltalk.Package.klass);
  4713. smalltalk.addMethod(
  4714. smalltalk.method({
  4715. selector: "load:prefix:",
  4716. category: 'loading-storing',
  4717. fn: function (aPackageName,aPrefix){
  4718. var self=this;
  4719. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  4720. return smalltalk.withContext(function($ctx1) {
  4721. _st(jQuery)._getScript_onSuccess_(_st(_st(aPrefix).__comma(aPackageName)).__comma(".js"),(function(){
  4722. return smalltalk.withContext(function($ctx2) {
  4723. return _st(_st($Package())._named_(aPackageName))._setupClasses();
  4724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4725. return self}, function($ctx1) {$ctx1.fill(self,"load:prefix:",{aPackageName:aPackageName,aPrefix:aPrefix},smalltalk.Package.klass)})},
  4726. args: ["aPackageName", "aPrefix"],
  4727. source: "load: aPackageName prefix: aPrefix\x0a\x09jQuery\x0a\x09\x09getScript: (aPrefix , aPackageName , '.js')\x0a\x09\x09onSuccess: [\x0a\x09\x09\x09(Package named: aPackageName) setupClasses ]",
  4728. messageSends: ["getScript:onSuccess:", ",", "setupClasses", "named:"],
  4729. referencedClasses: ["Package"]
  4730. }),
  4731. smalltalk.Package.klass);
  4732. smalltalk.addMethod(
  4733. smalltalk.method({
  4734. selector: "named:",
  4735. category: 'accessing',
  4736. fn: function (aPackageName){
  4737. var self=this;
  4738. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  4739. return smalltalk.withContext(function($ctx1) {
  4740. var $1;
  4741. $1=_st(_st($Smalltalk())._current())._packageAt_(aPackageName);
  4742. return $1;
  4743. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  4744. args: ["aPackageName"],
  4745. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  4746. messageSends: ["packageAt:", "current"],
  4747. referencedClasses: ["Smalltalk"]
  4748. }),
  4749. smalltalk.Package.klass);
  4750. smalltalk.addMethod(
  4751. smalltalk.method({
  4752. selector: "named:ifAbsent:",
  4753. category: 'accessing',
  4754. fn: function (aPackageName,aBlock){
  4755. var self=this;
  4756. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  4757. return smalltalk.withContext(function($ctx1) {
  4758. var $1;
  4759. $1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock);
  4760. return $1;
  4761. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})},
  4762. args: ["aPackageName", "aBlock"],
  4763. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  4764. messageSends: ["packageAt:ifAbsent:", "current"],
  4765. referencedClasses: ["Smalltalk"]
  4766. }),
  4767. smalltalk.Package.klass);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "resetCommitPaths",
  4771. category: 'commit paths',
  4772. fn: function (){
  4773. var self=this;
  4774. return smalltalk.withContext(function($ctx1) {
  4775. self["@defaultCommitPathJs"]=nil;
  4776. self["@defaultCommitPathSt"]=nil;
  4777. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.Package.klass)})},
  4778. args: [],
  4779. source: "resetCommitPaths\x0a\x09\x09defaultCommitPathJs := nil.\x0a\x09\x09defaultCommitPathSt := nil.",
  4780. messageSends: [],
  4781. referencedClasses: []
  4782. }),
  4783. smalltalk.Package.klass);
  4784. smalltalk.addMethod(
  4785. smalltalk.method({
  4786. selector: "sortedClasses:",
  4787. category: 'sorting',
  4788. fn: function (classes){
  4789. var self=this;
  4790. var children,others,nodes,expandedClasses;
  4791. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  4792. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4793. return smalltalk.withContext(function($ctx1) {
  4794. var $1,$2;
  4795. children=[];
  4796. others=[];
  4797. _st(classes)._do_((function(each){
  4798. return smalltalk.withContext(function($ctx2) {
  4799. $1=_st(classes)._includes_(_st(each)._superclass());
  4800. if(smalltalk.assert($1)){
  4801. return _st(others)._add_(each);
  4802. } else {
  4803. return _st(children)._add_(each);
  4804. };
  4805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4806. nodes=_st(children)._collect_((function(each){
  4807. return smalltalk.withContext(function($ctx2) {
  4808. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  4809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4810. nodes=_st(nodes)._sorted_((function(a,b){
  4811. return smalltalk.withContext(function($ctx2) {
  4812. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  4813. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  4814. expandedClasses=_st($Array())._new();
  4815. _st(nodes)._do_((function(aNode){
  4816. return smalltalk.withContext(function($ctx2) {
  4817. return _st(aNode)._traverseClassesWith_(expandedClasses);
  4818. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  4819. $2=expandedClasses;
  4820. return $2;
  4821. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},smalltalk.Package.klass)})},
  4822. args: ["classes"],
  4823. source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [:each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [children add: each]\x0a\x09\x09\x09ifTrue: [others add: each]].\x0a\x09nodes := children collect: [:each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0].\x0a\x09nodes := nodes sorted: [:a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [:aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses].\x0a\x09^expandedClasses",
  4824. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  4825. referencedClasses: ["ClassSorterNode", "Array"]
  4826. }),
  4827. smalltalk.Package.klass);
  4828. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  4829. smalltalk.Point.comment="A `Point` represents an x-y pair of numbers usually designating a geometric coordinate.\x0aPoints are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a Point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22\x0a\x0aAmber does not have much behavior in this class out-of-the-box."
  4830. smalltalk.addMethod(
  4831. smalltalk.method({
  4832. selector: "*",
  4833. category: 'arithmetic',
  4834. fn: function (aPoint){
  4835. var self=this;
  4836. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4837. return smalltalk.withContext(function($ctx1) {
  4838. var $1;
  4839. $1=_st($Point())._x_y_(_st(_st(self)._x()).__star(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__star(_st(_st(aPoint)._asPoint())._y()));
  4840. return $1;
  4841. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},smalltalk.Point)})},
  4842. args: ["aPoint"],
  4843. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4844. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  4845. referencedClasses: ["Point"]
  4846. }),
  4847. smalltalk.Point);
  4848. smalltalk.addMethod(
  4849. smalltalk.method({
  4850. selector: "+",
  4851. category: 'arithmetic',
  4852. fn: function (aPoint){
  4853. var self=this;
  4854. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4855. return smalltalk.withContext(function($ctx1) {
  4856. var $1;
  4857. $1=_st($Point())._x_y_(_st(_st(self)._x()).__plus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__plus(_st(_st(aPoint)._asPoint())._y()));
  4858. return $1;
  4859. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},smalltalk.Point)})},
  4860. args: ["aPoint"],
  4861. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4862. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  4863. referencedClasses: ["Point"]
  4864. }),
  4865. smalltalk.Point);
  4866. smalltalk.addMethod(
  4867. smalltalk.method({
  4868. selector: "-",
  4869. category: 'arithmetic',
  4870. fn: function (aPoint){
  4871. var self=this;
  4872. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4873. return smalltalk.withContext(function($ctx1) {
  4874. var $1;
  4875. $1=_st($Point())._x_y_(_st(_st(self)._x()).__minus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__minus(_st(_st(aPoint)._asPoint())._y()));
  4876. return $1;
  4877. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},smalltalk.Point)})},
  4878. args: ["aPoint"],
  4879. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4880. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  4881. referencedClasses: ["Point"]
  4882. }),
  4883. smalltalk.Point);
  4884. smalltalk.addMethod(
  4885. smalltalk.method({
  4886. selector: "/",
  4887. category: 'arithmetic',
  4888. fn: function (aPoint){
  4889. var self=this;
  4890. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4891. return smalltalk.withContext(function($ctx1) {
  4892. var $1;
  4893. $1=_st($Point())._x_y_(_st(_st(self)._x()).__slash(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__slash(_st(_st(aPoint)._asPoint())._y()));
  4894. return $1;
  4895. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},smalltalk.Point)})},
  4896. args: ["aPoint"],
  4897. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4898. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  4899. referencedClasses: ["Point"]
  4900. }),
  4901. smalltalk.Point);
  4902. smalltalk.addMethod(
  4903. smalltalk.method({
  4904. selector: "=",
  4905. category: 'arithmetic',
  4906. fn: function (aPoint){
  4907. var self=this;
  4908. return smalltalk.withContext(function($ctx1) {
  4909. var $1;
  4910. $1=_st(_st(_st(aPoint)._class()).__eq(_st(self)._class()))._and_((function(){
  4911. return smalltalk.withContext(function($ctx2) {
  4912. return _st(_st(_st(aPoint)._x()).__eq(_st(self)._x())).__and(_st(_st(aPoint)._y()).__eq(_st(self)._y()));
  4913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4914. return $1;
  4915. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},smalltalk.Point)})},
  4916. args: ["aPoint"],
  4917. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  4918. messageSends: ["and:", "&", "=", "y", "x", "class"],
  4919. referencedClasses: []
  4920. }),
  4921. smalltalk.Point);
  4922. smalltalk.addMethod(
  4923. smalltalk.method({
  4924. selector: "asPoint",
  4925. category: 'converting',
  4926. fn: function (){
  4927. var self=this;
  4928. return smalltalk.withContext(function($ctx1) {
  4929. var $1;
  4930. $1=self;
  4931. return $1;
  4932. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Point)})},
  4933. args: [],
  4934. source: "asPoint\x0a\x09^self",
  4935. messageSends: [],
  4936. referencedClasses: []
  4937. }),
  4938. smalltalk.Point);
  4939. smalltalk.addMethod(
  4940. smalltalk.method({
  4941. selector: "printOn:",
  4942. category: 'printing',
  4943. fn: function (aStream){
  4944. var self=this;
  4945. return smalltalk.withContext(function($ctx1) {
  4946. var $1;
  4947. _st(self["@x"])._printOn_(aStream);
  4948. _st(aStream)._nextPutAll_("@");
  4949. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  4950. return smalltalk.withContext(function($ctx2) {
  4951. return _st(self["@y"])._negative();
  4952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4953. if(smalltalk.assert($1)){
  4954. _st(aStream)._space();
  4955. };
  4956. _st(self["@y"])._printOn_(aStream);
  4957. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Point)})},
  4958. args: ["aStream"],
  4959. source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [y negative]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
  4960. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "space", "and:", "negative", "notNil"],
  4961. referencedClasses: []
  4962. }),
  4963. smalltalk.Point);
  4964. smalltalk.addMethod(
  4965. smalltalk.method({
  4966. selector: "translateBy:",
  4967. category: 'transforming',
  4968. fn: function (delta){
  4969. var self=this;
  4970. return smalltalk.withContext(function($ctx1) {
  4971. var $1;
  4972. $1=_st(_st(_st(delta)._x()).__plus(self["@x"])).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  4973. return $1;
  4974. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},smalltalk.Point)})},
  4975. args: ["delta"],
  4976. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  4977. messageSends: ["@", "+", "y", "x"],
  4978. referencedClasses: []
  4979. }),
  4980. smalltalk.Point);
  4981. smalltalk.addMethod(
  4982. smalltalk.method({
  4983. selector: "x",
  4984. category: 'accessing',
  4985. fn: function (){
  4986. var self=this;
  4987. return smalltalk.withContext(function($ctx1) {
  4988. var $1;
  4989. $1=self["@x"];
  4990. return $1;
  4991. }, function($ctx1) {$ctx1.fill(self,"x",{},smalltalk.Point)})},
  4992. args: [],
  4993. source: "x\x0a\x09^x",
  4994. messageSends: [],
  4995. referencedClasses: []
  4996. }),
  4997. smalltalk.Point);
  4998. smalltalk.addMethod(
  4999. smalltalk.method({
  5000. selector: "x:",
  5001. category: 'accessing',
  5002. fn: function (aNumber){
  5003. var self=this;
  5004. return smalltalk.withContext(function($ctx1) {
  5005. self["@x"]=aNumber;
  5006. return self}, function($ctx1) {$ctx1.fill(self,"x:",{aNumber:aNumber},smalltalk.Point)})},
  5007. args: ["aNumber"],
  5008. source: "x: aNumber\x0a\x09x := aNumber",
  5009. messageSends: [],
  5010. referencedClasses: []
  5011. }),
  5012. smalltalk.Point);
  5013. smalltalk.addMethod(
  5014. smalltalk.method({
  5015. selector: "y",
  5016. category: 'accessing',
  5017. fn: function (){
  5018. var self=this;
  5019. return smalltalk.withContext(function($ctx1) {
  5020. var $1;
  5021. $1=self["@y"];
  5022. return $1;
  5023. }, function($ctx1) {$ctx1.fill(self,"y",{},smalltalk.Point)})},
  5024. args: [],
  5025. source: "y\x0a\x09^y",
  5026. messageSends: [],
  5027. referencedClasses: []
  5028. }),
  5029. smalltalk.Point);
  5030. smalltalk.addMethod(
  5031. smalltalk.method({
  5032. selector: "y:",
  5033. category: 'accessing',
  5034. fn: function (aNumber){
  5035. var self=this;
  5036. return smalltalk.withContext(function($ctx1) {
  5037. self["@y"]=aNumber;
  5038. return self}, function($ctx1) {$ctx1.fill(self,"y:",{aNumber:aNumber},smalltalk.Point)})},
  5039. args: ["aNumber"],
  5040. source: "y: aNumber\x0a\x09y := aNumber",
  5041. messageSends: [],
  5042. referencedClasses: []
  5043. }),
  5044. smalltalk.Point);
  5045. smalltalk.addMethod(
  5046. smalltalk.method({
  5047. selector: "x:y:",
  5048. category: 'instance creation',
  5049. fn: function (aNumber,anotherNumber){
  5050. var self=this;
  5051. return smalltalk.withContext(function($ctx1) {
  5052. var $2,$3,$1;
  5053. $2=_st(self)._new();
  5054. _st($2)._x_(aNumber);
  5055. _st($2)._y_(anotherNumber);
  5056. $3=_st($2)._yourself();
  5057. $1=$3;
  5058. return $1;
  5059. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Point.klass)})},
  5060. args: ["aNumber", "anotherNumber"],
  5061. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5062. messageSends: ["x:", "new", "y:", "yourself"],
  5063. referencedClasses: []
  5064. }),
  5065. smalltalk.Point.klass);
  5066. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  5067. smalltalk.Random.comment="`Random` is a random number generator and is implemented as a trivial wrapper around javascript `Math.random()` and is used like this:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0a...and if you want a random number in a specific interval this also works:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0a...but be aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0a...or perhaps a letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`."
  5068. smalltalk.addMethod(
  5069. smalltalk.method({
  5070. selector: "next",
  5071. category: 'accessing',
  5072. fn: function (){
  5073. var self=this;
  5074. return smalltalk.withContext(function($ctx1) {
  5075. return Math.random();
  5076. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Random)})},
  5077. args: [],
  5078. source: "next\x0a\x09<return Math.random()>",
  5079. messageSends: [],
  5080. referencedClasses: []
  5081. }),
  5082. smalltalk.Random);
  5083. smalltalk.addMethod(
  5084. smalltalk.method({
  5085. selector: "next:",
  5086. category: 'accessing',
  5087. fn: function (anInteger){
  5088. var self=this;
  5089. return smalltalk.withContext(function($ctx1) {
  5090. var $1;
  5091. $1=_st(_st((1))._to_(anInteger))._collect_((function(each){
  5092. return smalltalk.withContext(function($ctx2) {
  5093. return _st(self)._next();
  5094. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5095. return $1;
  5096. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},smalltalk.Random)})},
  5097. args: ["anInteger"],
  5098. source: "next: anInteger\x0a\x09^(1 to: anInteger) collect: [:each | self next]",
  5099. messageSends: ["collect:", "next", "to:"],
  5100. referencedClasses: []
  5101. }),
  5102. smalltalk.Random);
  5103. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  5104. smalltalk.Smalltalk.comment="Smalltalk has only one instance, accessed with `Smalltalk current`.\x0aIt represents the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class of `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific class of `nil`\x0a\x0a__note:__ classes and packages are accessed using strings, not symbols\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Smalltalk source code.\x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work"
  5105. smalltalk.addMethod(
  5106. smalltalk.method({
  5107. selector: "asSmalltalkException:",
  5108. category: 'error handling',
  5109. fn: function (anObject){
  5110. var self=this;
  5111. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5112. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5113. return smalltalk.withContext(function($ctx1) {
  5114. var $2,$1;
  5115. $2=_st(_st(self)._isSmalltalkObject_(anObject))._and_((function(){
  5116. return smalltalk.withContext(function($ctx2) {
  5117. return _st(anObject)._isKindOf_($Error());
  5118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5119. if(smalltalk.assert($2)){
  5120. $1=anObject;
  5121. } else {
  5122. $1=_st($JavaScriptException())._on_(anObject);
  5123. };
  5124. return $1;
  5125. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})},
  5126. args: ["anObject"],
  5127. source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
  5128. messageSends: ["ifTrue:ifFalse:", "on:", "and:", "isKindOf:", "isSmalltalkObject:"],
  5129. referencedClasses: ["JavaScriptException", "Error"]
  5130. }),
  5131. smalltalk.Smalltalk);
  5132. smalltalk.addMethod(
  5133. smalltalk.method({
  5134. selector: "at:",
  5135. category: 'accessing',
  5136. fn: function (aString){
  5137. var self=this;
  5138. return smalltalk.withContext(function($ctx1) {
  5139. return self[aString];
  5140. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
  5141. args: ["aString"],
  5142. source: "at: aString\x0a\x09<return self[aString]>",
  5143. messageSends: [],
  5144. referencedClasses: []
  5145. }),
  5146. smalltalk.Smalltalk);
  5147. smalltalk.addMethod(
  5148. smalltalk.method({
  5149. selector: "basicParse:",
  5150. category: 'private',
  5151. fn: function (aString){
  5152. var self=this;
  5153. return smalltalk.withContext(function($ctx1) {
  5154. return smalltalk.parser.parse(aString);
  5155. return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})},
  5156. args: ["aString"],
  5157. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  5158. messageSends: [],
  5159. referencedClasses: []
  5160. }),
  5161. smalltalk.Smalltalk);
  5162. smalltalk.addMethod(
  5163. smalltalk.method({
  5164. selector: "classes",
  5165. category: 'classes',
  5166. fn: function (){
  5167. var self=this;
  5168. return smalltalk.withContext(function($ctx1) {
  5169. return self.classes();
  5170. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})},
  5171. args: [],
  5172. source: "classes\x0a\x09<return self.classes()>",
  5173. messageSends: [],
  5174. referencedClasses: []
  5175. }),
  5176. smalltalk.Smalltalk);
  5177. smalltalk.addMethod(
  5178. smalltalk.method({
  5179. selector: "createPackage:",
  5180. category: 'packages',
  5181. fn: function (packageName){
  5182. var self=this;
  5183. return smalltalk.withContext(function($ctx1) {
  5184. return smalltalk.addPackage(packageName);
  5185. return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  5186. args: ["packageName"],
  5187. source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  5188. messageSends: [],
  5189. referencedClasses: []
  5190. }),
  5191. smalltalk.Smalltalk);
  5192. smalltalk.addMethod(
  5193. smalltalk.method({
  5194. selector: "createPackage:properties:",
  5195. category: 'private',
  5196. fn: function (packageName,aDict){
  5197. var self=this;
  5198. return smalltalk.withContext(function($ctx1) {
  5199. var $1,$2;
  5200. _st(self)._deprecatedAPI();
  5201. $1=_st(aDict)._isEmpty();
  5202. if(! smalltalk.assert($1)){
  5203. _st(self)._error_("createPackage:properties: called with nonempty properties");
  5204. };
  5205. $2=_st(self)._createPackage_(packageName);
  5206. return $2;
  5207. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})},
  5208. args: ["packageName", "aDict"],
  5209. source: "createPackage: packageName properties: aDict\x0a\x09\x22Needed to import .st files: they begin with this call.\x22\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a\x09^ self createPackage: packageName",
  5210. messageSends: ["deprecatedAPI", "ifFalse:", "error:", "isEmpty", "createPackage:"],
  5211. referencedClasses: []
  5212. }),
  5213. smalltalk.Smalltalk);
  5214. smalltalk.addMethod(
  5215. smalltalk.method({
  5216. selector: "deleteClass:",
  5217. category: 'classes',
  5218. fn: function (aClass){
  5219. var self=this;
  5220. return smalltalk.withContext(function($ctx1) {
  5221. self.removeClass(aClass);
  5222. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  5223. args: ["aClass"],
  5224. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<self.removeClass(aClass)>",
  5225. messageSends: [],
  5226. referencedClasses: []
  5227. }),
  5228. smalltalk.Smalltalk);
  5229. smalltalk.addMethod(
  5230. smalltalk.method({
  5231. selector: "deletePackage:",
  5232. category: 'packages',
  5233. fn: function (packageName){
  5234. var self=this;
  5235. return smalltalk.withContext(function($ctx1) {
  5236. delete smalltalk.packages[packageName];
  5237. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  5238. args: ["packageName"],
  5239. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete smalltalk.packages[packageName]>",
  5240. messageSends: [],
  5241. referencedClasses: []
  5242. }),
  5243. smalltalk.Smalltalk);
  5244. smalltalk.addMethod(
  5245. smalltalk.method({
  5246. selector: "isSmalltalkObject:",
  5247. category: 'testing',
  5248. fn: function (anObject){
  5249. var self=this;
  5250. return smalltalk.withContext(function($ctx1) {
  5251. return typeof anObject.klass !== 'undefined';
  5252. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  5253. args: ["anObject"],
  5254. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<return typeof anObject.klass !== 'undefined'>",
  5255. messageSends: [],
  5256. referencedClasses: []
  5257. }),
  5258. smalltalk.Smalltalk);
  5259. smalltalk.addMethod(
  5260. smalltalk.method({
  5261. selector: "packageAt:",
  5262. category: 'packages',
  5263. fn: function (packageName){
  5264. var self=this;
  5265. return smalltalk.withContext(function($ctx1) {
  5266. return self.packages[packageName];
  5267. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})},
  5268. args: ["packageName"],
  5269. source: "packageAt: packageName\x0a\x09<return self.packages[packageName]>",
  5270. messageSends: [],
  5271. referencedClasses: []
  5272. }),
  5273. smalltalk.Smalltalk);
  5274. smalltalk.addMethod(
  5275. smalltalk.method({
  5276. selector: "packageAt:ifAbsent:",
  5277. category: 'packages',
  5278. fn: function (packageName,aBlock){
  5279. var self=this;
  5280. return smalltalk.withContext(function($ctx1) {
  5281. var $2,$1;
  5282. $2=_st(self)._packageAt_(packageName);
  5283. $1=_st($2)._ifNil_(aBlock);
  5284. return $1;
  5285. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})},
  5286. args: ["packageName", "aBlock"],
  5287. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^(self packageAt: packageName) ifNil: aBlock",
  5288. messageSends: ["ifNil:", "packageAt:"],
  5289. referencedClasses: []
  5290. }),
  5291. smalltalk.Smalltalk);
  5292. smalltalk.addMethod(
  5293. smalltalk.method({
  5294. selector: "packages",
  5295. category: 'packages',
  5296. fn: function (){
  5297. var self=this;
  5298. return smalltalk.withContext(function($ctx1) {
  5299. return self.packages.all();
  5300. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})},
  5301. args: [],
  5302. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  5303. messageSends: [],
  5304. referencedClasses: []
  5305. }),
  5306. smalltalk.Smalltalk);
  5307. smalltalk.addMethod(
  5308. smalltalk.method({
  5309. selector: "parse:",
  5310. category: 'accessing',
  5311. fn: function (aString){
  5312. var self=this;
  5313. var result;
  5314. return smalltalk.withContext(function($ctx1) {
  5315. var $1;
  5316. _st(self)._try_catch_((function(){
  5317. return smalltalk.withContext(function($ctx2) {
  5318. result=_st(self)._basicParse_(aString);
  5319. return result;
  5320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(ex){
  5321. return smalltalk.withContext(function($ctx2) {
  5322. return _st(_st(self)._parseError_parsing_(ex,aString))._signal();
  5323. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  5324. $1=result;
  5325. return $1;
  5326. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
  5327. args: ["aString"],
  5328. source: "parse: aString\x0a\x09| result |\x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
  5329. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
  5330. referencedClasses: []
  5331. }),
  5332. smalltalk.Smalltalk);
  5333. smalltalk.addMethod(
  5334. smalltalk.method({
  5335. selector: "parseError:parsing:",
  5336. category: 'error handling',
  5337. fn: function (anException,aString){
  5338. var self=this;
  5339. function $ParseError(){return smalltalk.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  5340. return smalltalk.withContext(function($ctx1) {
  5341. var $1;
  5342. $1=_st(_st($ParseError())._new())._messageText_(_st(_st(_st(_st(_st("Parse error on line ").__comma(_st(anException)._basicAt_("line"))).__comma(" column ")).__comma(_st(anException)._basicAt_("column"))).__comma(" : Unexpected character ")).__comma(_st(anException)._basicAt_("found")));
  5343. return $1;
  5344. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})},
  5345. args: ["anException", "aString"],
  5346. source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
  5347. messageSends: ["messageText:", ",", "basicAt:", "new"],
  5348. referencedClasses: ["ParseError"]
  5349. }),
  5350. smalltalk.Smalltalk);
  5351. smalltalk.addMethod(
  5352. smalltalk.method({
  5353. selector: "pseudoVariableNames",
  5354. category: 'packages',
  5355. fn: function (){
  5356. var self=this;
  5357. return smalltalk.withContext(function($ctx1) {
  5358. var $1;
  5359. $1=["self", "super", "nil", "true", "false", "thisContext"];
  5360. return $1;
  5361. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})},
  5362. args: [],
  5363. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  5364. messageSends: [],
  5365. referencedClasses: []
  5366. }),
  5367. smalltalk.Smalltalk);
  5368. smalltalk.addMethod(
  5369. smalltalk.method({
  5370. selector: "readJSObject:",
  5371. category: 'accessing',
  5372. fn: function (anObject){
  5373. var self=this;
  5374. return smalltalk.withContext(function($ctx1) {
  5375. return self.readJSObject(anObject);
  5376. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  5377. args: ["anObject"],
  5378. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  5379. messageSends: [],
  5380. referencedClasses: []
  5381. }),
  5382. smalltalk.Smalltalk);
  5383. smalltalk.addMethod(
  5384. smalltalk.method({
  5385. selector: "removeClass:",
  5386. category: 'classes',
  5387. fn: function (aClass){
  5388. var self=this;
  5389. function $ClassRemoved(){return smalltalk.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  5390. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5391. return smalltalk.withContext(function($ctx1) {
  5392. var $1,$2,$3;
  5393. $1=_st(aClass)._isMetaclass();
  5394. if(smalltalk.assert($1)){
  5395. _st(self)._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  5396. };
  5397. _st(self)._deleteClass_(aClass);
  5398. $2=_st($ClassRemoved())._new();
  5399. _st($2)._theClass_(aClass);
  5400. $3=_st($2)._yourself();
  5401. _st(_st($SystemAnnouncer())._current())._announce_($3);
  5402. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  5403. args: ["aClass"],
  5404. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!'].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  5405. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  5406. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  5407. }),
  5408. smalltalk.Smalltalk);
  5409. smalltalk.addMethod(
  5410. smalltalk.method({
  5411. selector: "removePackage:",
  5412. category: 'packages',
  5413. fn: function (packageName){
  5414. var self=this;
  5415. var pkg;
  5416. return smalltalk.withContext(function($ctx1) {
  5417. pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){
  5418. return smalltalk.withContext(function($ctx2) {
  5419. return _st(self)._error_(_st("Missing package: ").__comma(packageName));
  5420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5421. _st(_st(pkg)._classes())._do_((function(each){
  5422. return smalltalk.withContext(function($ctx2) {
  5423. return _st(self)._removeClass_(each);
  5424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5425. _st(self)._deletePackage_(packageName);
  5426. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})},
  5427. args: ["packageName"],
  5428. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09pkg classes do: [:each |\x0a\x09\x09\x09self removeClass: each].\x0a\x09self deletePackage: packageName",
  5429. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  5430. referencedClasses: []
  5431. }),
  5432. smalltalk.Smalltalk);
  5433. smalltalk.addMethod(
  5434. smalltalk.method({
  5435. selector: "renamePackage:to:",
  5436. category: 'packages',
  5437. fn: function (packageName,newName){
  5438. var self=this;
  5439. var pkg;
  5440. return smalltalk.withContext(function($ctx1) {
  5441. var $1;
  5442. pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){
  5443. return smalltalk.withContext(function($ctx2) {
  5444. return _st(self)._error_(_st("Missing package: ").__comma(packageName));
  5445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5446. $1=_st(self)._packageAt_(newName);
  5447. if(($receiver = $1) == nil || $receiver == undefined){
  5448. $1;
  5449. } else {
  5450. _st(self)._error_(_st("Already exists a package called: ").__comma(newName));
  5451. };
  5452. _st(_st(self)._basicAt_("packages"))._at_put_(newName,pkg);
  5453. _st(pkg)._name_(newName);
  5454. _st(self)._deletePackage_(packageName);
  5455. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
  5456. args: ["packageName", "newName"],
  5457. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].\x0a\x09(self basicAt: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  5458. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "basicAt:", "name:", "deletePackage:"],
  5459. referencedClasses: []
  5460. }),
  5461. smalltalk.Smalltalk);
  5462. smalltalk.addMethod(
  5463. smalltalk.method({
  5464. selector: "reservedWords",
  5465. category: 'accessing',
  5466. fn: function (){
  5467. var self=this;
  5468. return smalltalk.withContext(function($ctx1) {
  5469. return self.reservedWords;
  5470. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})},
  5471. args: [],
  5472. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  5473. messageSends: [],
  5474. referencedClasses: []
  5475. }),
  5476. smalltalk.Smalltalk);
  5477. smalltalk.addMethod(
  5478. smalltalk.method({
  5479. selector: "version",
  5480. category: 'accessing',
  5481. fn: function (){
  5482. var self=this;
  5483. return smalltalk.withContext(function($ctx1) {
  5484. return "0.10";
  5485. }, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})},
  5486. args: [],
  5487. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.10'",
  5488. messageSends: [],
  5489. referencedClasses: []
  5490. }),
  5491. smalltalk.Smalltalk);
  5492. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  5493. smalltalk.addMethod(
  5494. smalltalk.method({
  5495. selector: "current",
  5496. category: 'accessing',
  5497. fn: function (){
  5498. var self=this;
  5499. return smalltalk.withContext(function($ctx1) {
  5500. return smalltalk;
  5501. return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})},
  5502. args: [],
  5503. source: "current\x0a\x09<return smalltalk>",
  5504. messageSends: [],
  5505. referencedClasses: []
  5506. }),
  5507. smalltalk.Smalltalk.klass);
  5508. smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects');
  5509. smalltalk.Timeout.comment="I am wrapping the returns from set{Timeout,Interval}.\x0a\x0aNumber suffices in browsers, but node.js returns an object."
  5510. smalltalk.addMethod(
  5511. smalltalk.method({
  5512. selector: "clearInterval",
  5513. category: 'timeout/interval',
  5514. fn: function (){
  5515. var self=this;
  5516. return smalltalk.withContext(function($ctx1) {
  5517. var interval = self["@rawTimeout"];
  5518. clearInterval(interval);
  5519. ;
  5520. return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},smalltalk.Timeout)})},
  5521. args: [],
  5522. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  5523. messageSends: [],
  5524. referencedClasses: []
  5525. }),
  5526. smalltalk.Timeout);
  5527. smalltalk.addMethod(
  5528. smalltalk.method({
  5529. selector: "clearTimeout",
  5530. category: 'timeout/interval',
  5531. fn: function (){
  5532. var self=this;
  5533. return smalltalk.withContext(function($ctx1) {
  5534. var timeout = self["@rawTimeout"];
  5535. clearTimeout(timeout);
  5536. ;
  5537. return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},smalltalk.Timeout)})},
  5538. args: [],
  5539. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  5540. messageSends: [],
  5541. referencedClasses: []
  5542. }),
  5543. smalltalk.Timeout);
  5544. smalltalk.addMethod(
  5545. smalltalk.method({
  5546. selector: "rawTimeout:",
  5547. category: 'accessing',
  5548. fn: function (anObject){
  5549. var self=this;
  5550. return smalltalk.withContext(function($ctx1) {
  5551. self["@rawTimeout"]=anObject;
  5552. return self}, function($ctx1) {$ctx1.fill(self,"rawTimeout:",{anObject:anObject},smalltalk.Timeout)})},
  5553. args: ["anObject"],
  5554. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  5555. messageSends: [],
  5556. referencedClasses: []
  5557. }),
  5558. smalltalk.Timeout);
  5559. smalltalk.addMethod(
  5560. smalltalk.method({
  5561. selector: "on:",
  5562. category: 'instance creation',
  5563. fn: function (anObject){
  5564. var self=this;
  5565. return smalltalk.withContext(function($ctx1) {
  5566. var $2,$3,$1;
  5567. $2=_st(self)._new();
  5568. _st($2)._rawTimeout_(anObject);
  5569. $3=_st($2)._yourself();
  5570. $1=$3;
  5571. return $1;
  5572. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},smalltalk.Timeout.klass)})},
  5573. args: ["anObject"],
  5574. source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
  5575. messageSends: ["rawTimeout:", "new", "yourself"],
  5576. referencedClasses: []
  5577. }),
  5578. smalltalk.Timeout.klass);
  5579. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  5580. smalltalk.UndefinedObject.comment="UndefinedObject describes the behavior of its sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk representation of the `undefined` JavaScript object."
  5581. smalltalk.addMethod(
  5582. smalltalk.method({
  5583. selector: "asJSON",
  5584. category: 'converting',
  5585. fn: function (){
  5586. var self=this;
  5587. return smalltalk.withContext(function($ctx1) {
  5588. var $1;
  5589. $1=null;
  5590. return $1;
  5591. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.UndefinedObject)})},
  5592. args: [],
  5593. source: "asJSON\x0a\x09^null",
  5594. messageSends: [],
  5595. referencedClasses: []
  5596. }),
  5597. smalltalk.UndefinedObject);
  5598. smalltalk.addMethod(
  5599. smalltalk.method({
  5600. selector: "deepCopy",
  5601. category: 'copying',
  5602. fn: function (){
  5603. var self=this;
  5604. return smalltalk.withContext(function($ctx1) {
  5605. var $1;
  5606. $1=self;
  5607. return $1;
  5608. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.UndefinedObject)})},
  5609. args: [],
  5610. source: "deepCopy\x0a\x09^self",
  5611. messageSends: [],
  5612. referencedClasses: []
  5613. }),
  5614. smalltalk.UndefinedObject);
  5615. smalltalk.addMethod(
  5616. smalltalk.method({
  5617. selector: "ifNil:",
  5618. category: 'testing',
  5619. fn: function (aBlock){
  5620. var self=this;
  5621. return smalltalk.withContext(function($ctx1) {
  5622. var $2,$1;
  5623. $2=self;
  5624. $1=_st($2)._ifNil_ifNotNil_(aBlock,(function(){
  5625. return smalltalk.withContext(function($ctx2) {
  5626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5627. return $1;
  5628. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  5629. args: ["aBlock"],
  5630. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  5631. messageSends: ["ifNil:ifNotNil:"],
  5632. referencedClasses: []
  5633. }),
  5634. smalltalk.UndefinedObject);
  5635. smalltalk.addMethod(
  5636. smalltalk.method({
  5637. selector: "ifNil:ifNotNil:",
  5638. category: 'testing',
  5639. fn: function (aBlock,anotherBlock){
  5640. var self=this;
  5641. return smalltalk.withContext(function($ctx1) {
  5642. var $1;
  5643. $1=_st(aBlock)._value();
  5644. return $1;
  5645. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  5646. args: ["aBlock", "anotherBlock"],
  5647. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  5648. messageSends: ["value"],
  5649. referencedClasses: []
  5650. }),
  5651. smalltalk.UndefinedObject);
  5652. smalltalk.addMethod(
  5653. smalltalk.method({
  5654. selector: "ifNotNil:",
  5655. category: 'testing',
  5656. fn: function (aBlock){
  5657. var self=this;
  5658. return smalltalk.withContext(function($ctx1) {
  5659. var $1;
  5660. $1=self;
  5661. return $1;
  5662. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  5663. args: ["aBlock"],
  5664. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  5665. messageSends: [],
  5666. referencedClasses: []
  5667. }),
  5668. smalltalk.UndefinedObject);
  5669. smalltalk.addMethod(
  5670. smalltalk.method({
  5671. selector: "ifNotNil:ifNil:",
  5672. category: 'testing',
  5673. fn: function (aBlock,anotherBlock){
  5674. var self=this;
  5675. return smalltalk.withContext(function($ctx1) {
  5676. var $1;
  5677. $1=_st(anotherBlock)._value();
  5678. return $1;
  5679. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  5680. args: ["aBlock", "anotherBlock"],
  5681. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  5682. messageSends: ["value"],
  5683. referencedClasses: []
  5684. }),
  5685. smalltalk.UndefinedObject);
  5686. smalltalk.addMethod(
  5687. smalltalk.method({
  5688. selector: "isImmutable",
  5689. category: 'testing',
  5690. fn: function (){
  5691. var self=this;
  5692. return smalltalk.withContext(function($ctx1) {
  5693. return true;
  5694. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.UndefinedObject)})},
  5695. args: [],
  5696. source: "isImmutable\x0a\x09^ true",
  5697. messageSends: [],
  5698. referencedClasses: []
  5699. }),
  5700. smalltalk.UndefinedObject);
  5701. smalltalk.addMethod(
  5702. smalltalk.method({
  5703. selector: "isNil",
  5704. category: 'testing',
  5705. fn: function (){
  5706. var self=this;
  5707. return smalltalk.withContext(function($ctx1) {
  5708. return true;
  5709. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.UndefinedObject)})},
  5710. args: [],
  5711. source: "isNil\x0a\x09^true",
  5712. messageSends: [],
  5713. referencedClasses: []
  5714. }),
  5715. smalltalk.UndefinedObject);
  5716. smalltalk.addMethod(
  5717. smalltalk.method({
  5718. selector: "notNil",
  5719. category: 'testing',
  5720. fn: function (){
  5721. var self=this;
  5722. return smalltalk.withContext(function($ctx1) {
  5723. return false;
  5724. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.UndefinedObject)})},
  5725. args: [],
  5726. source: "notNil\x0a\x09^false",
  5727. messageSends: [],
  5728. referencedClasses: []
  5729. }),
  5730. smalltalk.UndefinedObject);
  5731. smalltalk.addMethod(
  5732. smalltalk.method({
  5733. selector: "printOn:",
  5734. category: 'printing',
  5735. fn: function (aStream){
  5736. var self=this;
  5737. return smalltalk.withContext(function($ctx1) {
  5738. _st(aStream)._nextPutAll_("nil");
  5739. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.UndefinedObject)})},
  5740. args: ["aStream"],
  5741. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5742. messageSends: ["nextPutAll:"],
  5743. referencedClasses: []
  5744. }),
  5745. smalltalk.UndefinedObject);
  5746. smalltalk.addMethod(
  5747. smalltalk.method({
  5748. selector: "shallowCopy",
  5749. category: 'copying',
  5750. fn: function (){
  5751. var self=this;
  5752. return smalltalk.withContext(function($ctx1) {
  5753. var $1;
  5754. $1=self;
  5755. return $1;
  5756. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.UndefinedObject)})},
  5757. args: [],
  5758. source: "shallowCopy\x0a\x09^self",
  5759. messageSends: [],
  5760. referencedClasses: []
  5761. }),
  5762. smalltalk.UndefinedObject);
  5763. smalltalk.addMethod(
  5764. smalltalk.method({
  5765. selector: "subclass:instanceVariableNames:",
  5766. category: 'class creation',
  5767. fn: function (aString,anotherString){
  5768. var self=this;
  5769. return smalltalk.withContext(function($ctx1) {
  5770. var $1;
  5771. $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5772. return $1;
  5773. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.UndefinedObject)})},
  5774. args: ["aString", "anotherString"],
  5775. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  5776. messageSends: ["subclass:instanceVariableNames:package:"],
  5777. referencedClasses: []
  5778. }),
  5779. smalltalk.UndefinedObject);
  5780. smalltalk.addMethod(
  5781. smalltalk.method({
  5782. selector: "subclass:instanceVariableNames:category:",
  5783. category: 'class creation',
  5784. fn: function (aString,aString2,aString3){
  5785. var self=this;
  5786. return smalltalk.withContext(function($ctx1) {
  5787. var $1;
  5788. _st(self)._deprecatedAPI();
  5789. $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5790. return $1;
  5791. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  5792. args: ["aString", "aString2", "aString3"],
  5793. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3",
  5794. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  5795. referencedClasses: []
  5796. }),
  5797. smalltalk.UndefinedObject);
  5798. smalltalk.addMethod(
  5799. smalltalk.method({
  5800. selector: "subclass:instanceVariableNames:package:",
  5801. category: 'class creation',
  5802. fn: function (aString,aString2,aString3){
  5803. var self=this;
  5804. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5805. return smalltalk.withContext(function($ctx1) {
  5806. var $1;
  5807. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  5808. return $1;
  5809. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  5810. args: ["aString", "aString2", "aString3"],
  5811. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5812. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  5813. referencedClasses: ["ClassBuilder"]
  5814. }),
  5815. smalltalk.UndefinedObject);
  5816. smalltalk.addMethod(
  5817. smalltalk.method({
  5818. selector: "new",
  5819. category: 'instance creation',
  5820. fn: function (){
  5821. var self=this;
  5822. return smalltalk.withContext(function($ctx1) {
  5823. _st(self)._error_("You cannot create new instances of UndefinedObject. Use nil");
  5824. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.UndefinedObject.klass)})},
  5825. args: [],
  5826. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5827. messageSends: ["error:"],
  5828. referencedClasses: []
  5829. }),
  5830. smalltalk.UndefinedObject.klass);
  5831. smalltalk.addMethod(
  5832. smalltalk.method({
  5833. selector: "asJavaScriptSelector",
  5834. category: '*Kernel-Objects',
  5835. fn: function (){
  5836. var self=this;
  5837. return smalltalk.withContext(function($ctx1) {
  5838. var $1;
  5839. $1=_st(self)._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  5840. return $1;
  5841. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
  5842. args: [],
  5843. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  5844. messageSends: ["replace:with:"],
  5845. referencedClasses: []
  5846. }),
  5847. smalltalk.String);
  5848. smalltalk.addPackage('Kernel-Classes');
  5849. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  5850. smalltalk.Behavior.comment="Behavior is the superclass of all class objects.\x0a\x0aIt defines the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0aInstances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aBehavior also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy."
  5851. smalltalk.addMethod(
  5852. smalltalk.method({
  5853. selector: "addCompiledMethod:",
  5854. category: 'compiling',
  5855. fn: function (aMethod){
  5856. var self=this;
  5857. var oldMethod,announcement;
  5858. function $MethodAdded(){return smalltalk.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  5859. function $MethodModified(){return smalltalk.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  5860. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5861. return smalltalk.withContext(function($ctx1) {
  5862. var $1,$2,$3,$4,$5,$6;
  5863. oldMethod=_st(_st(self)._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
  5864. return smalltalk.withContext(function($ctx2) {
  5865. return nil;
  5866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5867. $1=_st(_st(self)._protocols())._includes_(_st(aMethod)._protocol());
  5868. if(! smalltalk.assert($1)){
  5869. _st(_st(self)._organization())._addElement_(_st(aMethod)._protocol());
  5870. };
  5871. _st(self)._basicAddCompiledMethod_(aMethod);
  5872. $2=oldMethod;
  5873. if(($receiver = $2) == nil || $receiver == undefined){
  5874. $3=_st($MethodAdded())._new();
  5875. _st($3)._method_(aMethod);
  5876. $4=_st($3)._yourself();
  5877. announcement=$4;
  5878. } else {
  5879. $5=_st($MethodModified())._new();
  5880. _st($5)._oldMethod_(oldMethod);
  5881. _st($5)._method_(aMethod);
  5882. $6=_st($5)._yourself();
  5883. announcement=$6;
  5884. };
  5885. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  5886. return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},smalltalk.Behavior)})},
  5887. args: ["aMethod"],
  5888. 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\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\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",
  5889. messageSends: ["at:ifAbsent:", "selector", "methodDictionary", "ifFalse:", "addElement:", "protocol", "organization", "includes:", "protocols", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"],
  5890. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
  5891. }),
  5892. smalltalk.Behavior);
  5893. smalltalk.addMethod(
  5894. smalltalk.method({
  5895. selector: "allInstanceVariableNames",
  5896. category: 'accessing',
  5897. fn: function (){
  5898. var self=this;
  5899. var result;
  5900. return smalltalk.withContext(function($ctx1) {
  5901. var $1,$2;
  5902. result=_st(_st(self)._instanceVariableNames())._copy();
  5903. $1=_st(self)._superclass();
  5904. if(($receiver = $1) == nil || $receiver == undefined){
  5905. $1;
  5906. } else {
  5907. _st(result)._addAll_(_st(_st(self)._superclass())._allInstanceVariableNames());
  5908. };
  5909. $2=result;
  5910. return $2;
  5911. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},smalltalk.Behavior)})},
  5912. args: [],
  5913. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  5914. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"],
  5915. referencedClasses: []
  5916. }),
  5917. smalltalk.Behavior);
  5918. smalltalk.addMethod(
  5919. smalltalk.method({
  5920. selector: "allSelectors",
  5921. category: 'accessing',
  5922. fn: function (){
  5923. var self=this;
  5924. return smalltalk.withContext(function($ctx1) {
  5925. var $2,$3,$1;
  5926. $1=_st(_st(self)._allSuperclasses())._inject_into_(_st(self)._selectors(),(function(soFar,aBehavior){
  5927. return smalltalk.withContext(function($ctx2) {
  5928. $2=soFar;
  5929. _st($2)._addAll_(_st(aBehavior)._selectors());
  5930. $3=_st($2)._yourself();
  5931. return $3;
  5932. }, function($ctx2) {$ctx2.fillBlock({soFar:soFar,aBehavior:aBehavior},$ctx1)})}));
  5933. return $1;
  5934. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Behavior)})},
  5935. args: [],
  5936. source: "allSelectors\x0a\x09^self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :soFar :aBehavior | soFar addAll: aBehavior selectors; yourself ]",
  5937. messageSends: ["inject:into:", "selectors", "addAll:", "yourself", "allSuperclasses"],
  5938. referencedClasses: []
  5939. }),
  5940. smalltalk.Behavior);
  5941. smalltalk.addMethod(
  5942. smalltalk.method({
  5943. selector: "allSubclasses",
  5944. category: 'accessing',
  5945. fn: function (){
  5946. var self=this;
  5947. var result;
  5948. return smalltalk.withContext(function($ctx1) {
  5949. var $1;
  5950. result=_st(self)._subclasses();
  5951. _st(_st(self)._subclasses())._do_((function(each){
  5952. return smalltalk.withContext(function($ctx2) {
  5953. return _st(result)._addAll_(_st(each)._allSubclasses());
  5954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5955. $1=result;
  5956. return $1;
  5957. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{result:result},smalltalk.Behavior)})},
  5958. args: [],
  5959. source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09\x09result addAll: each allSubclasses].\x0a\x09^result",
  5960. messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
  5961. referencedClasses: []
  5962. }),
  5963. smalltalk.Behavior);
  5964. smalltalk.addMethod(
  5965. smalltalk.method({
  5966. selector: "allSubclassesDo:",
  5967. category: 'enumerating',
  5968. fn: function (aBlock){
  5969. var self=this;
  5970. return smalltalk.withContext(function($ctx1) {
  5971. _st(_st(self)._subclasses())._do_((function(each){
  5972. return smalltalk.withContext(function($ctx2) {
  5973. _st(aBlock)._value_(each);
  5974. return _st(each)._allSubclassesDo_(aBlock);
  5975. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5976. return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},smalltalk.Behavior)})},
  5977. args: ["aBlock"],
  5978. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self subclasses do: [ :each |\x0a \x09aBlock value: each.\x0a each allSubclassesDo: aBlock ].",
  5979. messageSends: ["do:", "value:", "allSubclassesDo:", "subclasses"],
  5980. referencedClasses: []
  5981. }),
  5982. smalltalk.Behavior);
  5983. smalltalk.addMethod(
  5984. smalltalk.method({
  5985. selector: "allSuperclasses",
  5986. category: 'accessing',
  5987. fn: function (){
  5988. var self=this;
  5989. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5990. return smalltalk.withContext(function($ctx1) {
  5991. var $1,$2,$4,$5,$3;
  5992. $1=_st(self)._superclass();
  5993. if(($receiver = $1) == nil || $receiver == undefined){
  5994. $2=[];
  5995. return $2;
  5996. } else {
  5997. $1;
  5998. };
  5999. $4=_st($OrderedCollection())._with_(_st(self)._superclass());
  6000. _st($4)._addAll_(_st(_st(self)._superclass())._allSuperclasses());
  6001. $5=_st($4)._yourself();
  6002. $3=$5;
  6003. return $3;
  6004. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},smalltalk.Behavior)})},
  6005. args: [],
  6006. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  6007. messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"],
  6008. referencedClasses: ["OrderedCollection"]
  6009. }),
  6010. smalltalk.Behavior);
  6011. smalltalk.addMethod(
  6012. smalltalk.method({
  6013. selector: "basicAddCompiledMethod:",
  6014. category: 'private',
  6015. fn: function (aMethod){
  6016. var self=this;
  6017. return smalltalk.withContext(function($ctx1) {
  6018. smalltalk.addMethod(aMethod, self);
  6019. return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  6020. args: ["aMethod"],
  6021. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
  6022. messageSends: [],
  6023. referencedClasses: []
  6024. }),
  6025. smalltalk.Behavior);
  6026. smalltalk.addMethod(
  6027. smalltalk.method({
  6028. selector: "basicNew",
  6029. category: 'instance creation',
  6030. fn: function (){
  6031. var self=this;
  6032. return smalltalk.withContext(function($ctx1) {
  6033. return new self.fn();
  6034. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},smalltalk.Behavior)})},
  6035. args: [],
  6036. source: "basicNew\x0a\x09<return new self.fn()>",
  6037. messageSends: [],
  6038. referencedClasses: []
  6039. }),
  6040. smalltalk.Behavior);
  6041. smalltalk.addMethod(
  6042. smalltalk.method({
  6043. selector: "basicRemoveCompiledMethod:",
  6044. category: 'private',
  6045. fn: function (aMethod){
  6046. var self=this;
  6047. return smalltalk.withContext(function($ctx1) {
  6048. smalltalk.removeMethod(aMethod)
  6049. smalltalk.init(self);
  6050. ;
  6051. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  6052. args: ["aMethod"],
  6053. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<\x0a\x09\x09smalltalk.removeMethod(aMethod)\x0a\x09\x09smalltalk.init(self);\x0a\x09>",
  6054. messageSends: [],
  6055. referencedClasses: []
  6056. }),
  6057. smalltalk.Behavior);
  6058. smalltalk.addMethod(
  6059. smalltalk.method({
  6060. selector: "canUnderstand:",
  6061. category: 'testing',
  6062. fn: function (aSelector){
  6063. var self=this;
  6064. return smalltalk.withContext(function($ctx1) {
  6065. var $1;
  6066. $1=_st(_st(_st(_st(self)._methodDictionary())._keys())._includes_(_st(aSelector)._asString()))._or_((function(){
  6067. return smalltalk.withContext(function($ctx2) {
  6068. return _st(_st(_st(self)._superclass())._notNil())._and_((function(){
  6069. return smalltalk.withContext(function($ctx3) {
  6070. return _st(_st(self)._superclass())._canUnderstand_(aSelector);
  6071. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  6072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6073. return $1;
  6074. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},smalltalk.Behavior)})},
  6075. args: ["aSelector"],
  6076. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  6077. messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"],
  6078. referencedClasses: []
  6079. }),
  6080. smalltalk.Behavior);
  6081. smalltalk.addMethod(
  6082. smalltalk.method({
  6083. selector: "comment",
  6084. category: 'accessing',
  6085. fn: function (){
  6086. var self=this;
  6087. return smalltalk.withContext(function($ctx1) {
  6088. var $2,$1;
  6089. $2=_st(self)._basicAt_("comment");
  6090. if(($receiver = $2) == nil || $receiver == undefined){
  6091. $1="";
  6092. } else {
  6093. $1=$2;
  6094. };
  6095. return $1;
  6096. }, function($ctx1) {$ctx1.fill(self,"comment",{},smalltalk.Behavior)})},
  6097. args: [],
  6098. source: "comment\x0a\x09^(self basicAt: 'comment') ifNil: ['']",
  6099. messageSends: ["ifNil:", "basicAt:"],
  6100. referencedClasses: []
  6101. }),
  6102. smalltalk.Behavior);
  6103. smalltalk.addMethod(
  6104. smalltalk.method({
  6105. selector: "comment:",
  6106. category: 'accessing',
  6107. fn: function (aString){
  6108. var self=this;
  6109. function $ClassCommentChanged(){return smalltalk.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  6110. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6111. return smalltalk.withContext(function($ctx1) {
  6112. var $1,$2;
  6113. _st(self)._basicAt_put_("comment",aString);
  6114. $1=_st($ClassCommentChanged())._new();
  6115. _st($1)._theClass_(self);
  6116. $2=_st($1)._yourself();
  6117. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6118. return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},smalltalk.Behavior)})},
  6119. args: ["aString"],
  6120. 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)",
  6121. messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"],
  6122. referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"]
  6123. }),
  6124. smalltalk.Behavior);
  6125. smalltalk.addMethod(
  6126. smalltalk.method({
  6127. selector: "commentStamp",
  6128. category: 'accessing',
  6129. fn: function (){
  6130. var self=this;
  6131. function $ClassCommentReader(){return smalltalk.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  6132. return smalltalk.withContext(function($ctx1) {
  6133. var $2,$3,$1;
  6134. $2=_st($ClassCommentReader())._new();
  6135. _st($2)._class_(self);
  6136. $3=_st($2)._yourself();
  6137. $1=$3;
  6138. return $1;
  6139. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},smalltalk.Behavior)})},
  6140. args: [],
  6141. source: "commentStamp\x0a\x09^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  6142. messageSends: ["class:", "new", "yourself"],
  6143. referencedClasses: ["ClassCommentReader"]
  6144. }),
  6145. smalltalk.Behavior);
  6146. smalltalk.addMethod(
  6147. smalltalk.method({
  6148. selector: "commentStamp:prior:",
  6149. category: 'accessing',
  6150. fn: function (aStamp,prior){
  6151. var self=this;
  6152. return smalltalk.withContext(function($ctx1) {
  6153. var $1;
  6154. $1=_st(self)._commentStamp();
  6155. return $1;
  6156. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},smalltalk.Behavior)})},
  6157. args: ["aStamp", "prior"],
  6158. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^self commentStamp",
  6159. messageSends: ["commentStamp"],
  6160. referencedClasses: []
  6161. }),
  6162. smalltalk.Behavior);
  6163. smalltalk.addMethod(
  6164. smalltalk.method({
  6165. selector: "compile:",
  6166. category: 'compiling',
  6167. fn: function (aString){
  6168. var self=this;
  6169. return smalltalk.withContext(function($ctx1) {
  6170. var $1;
  6171. $1=_st(self)._compile_category_(aString,"");
  6172. return $1;
  6173. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Behavior)})},
  6174. args: ["aString"],
  6175. source: "compile: aString\x0a\x09^ self compile: aString category: ''",
  6176. messageSends: ["compile:category:"],
  6177. referencedClasses: []
  6178. }),
  6179. smalltalk.Behavior);
  6180. smalltalk.addMethod(
  6181. smalltalk.method({
  6182. selector: "compile:category:",
  6183. category: 'compiling',
  6184. fn: function (aString,anotherString){
  6185. var self=this;
  6186. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6187. return smalltalk.withContext(function($ctx1) {
  6188. var $1;
  6189. $1=_st(_st($Compiler())._new())._install_forClass_category_(aString,self,anotherString);
  6190. return $1;
  6191. }, function($ctx1) {$ctx1.fill(self,"compile:category:",{aString:aString,anotherString:anotherString},smalltalk.Behavior)})},
  6192. args: ["aString", "anotherString"],
  6193. source: "compile: aString category: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09category: anotherString",
  6194. messageSends: ["install:forClass:category:", "new"],
  6195. referencedClasses: ["Compiler"]
  6196. }),
  6197. smalltalk.Behavior);
  6198. smalltalk.addMethod(
  6199. smalltalk.method({
  6200. selector: "definition",
  6201. category: 'accessing',
  6202. fn: function (){
  6203. var self=this;
  6204. return smalltalk.withContext(function($ctx1) {
  6205. return "";
  6206. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Behavior)})},
  6207. args: [],
  6208. source: "definition\x0a\x09^ ''",
  6209. messageSends: [],
  6210. referencedClasses: []
  6211. }),
  6212. smalltalk.Behavior);
  6213. smalltalk.addMethod(
  6214. smalltalk.method({
  6215. selector: "includesBehavior:",
  6216. category: 'testing',
  6217. fn: function (aClass){
  6218. var self=this;
  6219. return smalltalk.withContext(function($ctx1) {
  6220. var $1;
  6221. $1=_st(_st(self).__eq_eq(aClass))._or_((function(){
  6222. return smalltalk.withContext(function($ctx2) {
  6223. return _st(self)._inheritsFrom_(aClass);
  6224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6225. return $1;
  6226. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},smalltalk.Behavior)})},
  6227. args: ["aClass"],
  6228. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  6229. messageSends: ["or:", "inheritsFrom:", "=="],
  6230. referencedClasses: []
  6231. }),
  6232. smalltalk.Behavior);
  6233. smalltalk.addMethod(
  6234. smalltalk.method({
  6235. selector: "includesSelector:",
  6236. category: 'testing',
  6237. fn: function (aString){
  6238. var self=this;
  6239. return smalltalk.withContext(function($ctx1) {
  6240. var $1;
  6241. $1=_st(_st(self)._methodDictionary())._includesKey_(aString);
  6242. return $1;
  6243. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},smalltalk.Behavior)})},
  6244. args: ["aString"],
  6245. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  6246. messageSends: ["includesKey:", "methodDictionary"],
  6247. referencedClasses: []
  6248. }),
  6249. smalltalk.Behavior);
  6250. smalltalk.addMethod(
  6251. smalltalk.method({
  6252. selector: "inheritsFrom:",
  6253. category: 'testing',
  6254. fn: function (aClass){
  6255. var self=this;
  6256. return smalltalk.withContext(function($ctx1) {
  6257. var $1;
  6258. $1=_st(_st(aClass)._allSubclasses())._includes_(self);
  6259. return $1;
  6260. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},smalltalk.Behavior)})},
  6261. args: ["aClass"],
  6262. source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self",
  6263. messageSends: ["includes:", "allSubclasses"],
  6264. referencedClasses: []
  6265. }),
  6266. smalltalk.Behavior);
  6267. smalltalk.addMethod(
  6268. smalltalk.method({
  6269. selector: "instanceVariableNames",
  6270. category: 'accessing',
  6271. fn: function (){
  6272. var self=this;
  6273. return smalltalk.withContext(function($ctx1) {
  6274. return self.iVarNames;
  6275. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},smalltalk.Behavior)})},
  6276. args: [],
  6277. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  6278. messageSends: [],
  6279. referencedClasses: []
  6280. }),
  6281. smalltalk.Behavior);
  6282. smalltalk.addMethod(
  6283. smalltalk.method({
  6284. selector: "isBehavior",
  6285. category: 'testing',
  6286. fn: function (){
  6287. var self=this;
  6288. return smalltalk.withContext(function($ctx1) {
  6289. return true;
  6290. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Behavior)})},
  6291. args: [],
  6292. source: "isBehavior\x0a\x09^ true",
  6293. messageSends: [],
  6294. referencedClasses: []
  6295. }),
  6296. smalltalk.Behavior);
  6297. smalltalk.addMethod(
  6298. smalltalk.method({
  6299. selector: "lookupSelector:",
  6300. category: 'accessing',
  6301. fn: function (selector){
  6302. var self=this;
  6303. var lookupClass;
  6304. return smalltalk.withContext(function($ctx1) {
  6305. var $1,$2;
  6306. var $early={};
  6307. try {
  6308. lookupClass=self;
  6309. _st((function(){
  6310. return smalltalk.withContext(function($ctx2) {
  6311. return _st(lookupClass).__eq(nil);
  6312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  6313. return smalltalk.withContext(function($ctx2) {
  6314. $1=_st(lookupClass)._includesSelector_(selector);
  6315. if(smalltalk.assert($1)){
  6316. $2=_st(lookupClass)._methodAt_(selector);
  6317. throw $early=[$2];
  6318. };
  6319. lookupClass=_st(lookupClass)._superclass();
  6320. return lookupClass;
  6321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6322. return nil;
  6323. }
  6324. catch(e) {if(e===$early)return e[0]; throw e}
  6325. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},smalltalk.Behavior)})},
  6326. args: ["selector"],
  6327. 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| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  6328. messageSends: ["whileFalse:", "ifTrue:", "methodAt:", "includesSelector:", "superclass", "="],
  6329. referencedClasses: []
  6330. }),
  6331. smalltalk.Behavior);
  6332. smalltalk.addMethod(
  6333. smalltalk.method({
  6334. selector: "methodAt:",
  6335. category: 'accessing',
  6336. fn: function (aString){
  6337. var self=this;
  6338. return smalltalk.withContext(function($ctx1) {
  6339. var $1;
  6340. $1=_st(_st(self)._methodDictionary())._at_(aString);
  6341. return $1;
  6342. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},smalltalk.Behavior)})},
  6343. args: ["aString"],
  6344. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  6345. messageSends: ["at:", "methodDictionary"],
  6346. referencedClasses: []
  6347. }),
  6348. smalltalk.Behavior);
  6349. smalltalk.addMethod(
  6350. smalltalk.method({
  6351. selector: "methodDictionary",
  6352. category: 'accessing',
  6353. fn: function (){
  6354. var self=this;
  6355. return smalltalk.withContext(function($ctx1) {
  6356. var dict = smalltalk.HashedCollection._new();
  6357. var methods = self.methods;
  6358. for(var i in methods) {
  6359. if(methods[i].selector) {
  6360. dict._at_put_(methods[i].selector, methods[i]);
  6361. }
  6362. };
  6363. return dict;
  6364. return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},smalltalk.Behavior)})},
  6365. args: [],
  6366. source: "methodDictionary\x0a\x09<var dict = smalltalk.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09for(var i in methods) {\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>",
  6367. messageSends: [],
  6368. referencedClasses: []
  6369. }),
  6370. smalltalk.Behavior);
  6371. smalltalk.addMethod(
  6372. smalltalk.method({
  6373. selector: "methods",
  6374. category: 'accessing',
  6375. fn: function (){
  6376. var self=this;
  6377. return smalltalk.withContext(function($ctx1) {
  6378. var $1;
  6379. $1=_st(_st(self)._methodDictionary())._values();
  6380. return $1;
  6381. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.Behavior)})},
  6382. args: [],
  6383. source: "methods\x0a\x09^ self methodDictionary values",
  6384. messageSends: ["values", "methodDictionary"],
  6385. referencedClasses: []
  6386. }),
  6387. smalltalk.Behavior);
  6388. smalltalk.addMethod(
  6389. smalltalk.method({
  6390. selector: "methodsFor:",
  6391. category: 'accessing',
  6392. fn: function (aString){
  6393. var self=this;
  6394. function $ClassCategoryReader(){return smalltalk.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
  6395. return smalltalk.withContext(function($ctx1) {
  6396. var $2,$3,$1;
  6397. $2=_st($ClassCategoryReader())._new();
  6398. _st($2)._class_category_(self,aString);
  6399. $3=_st($2)._yourself();
  6400. $1=$3;
  6401. return $1;
  6402. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},smalltalk.Behavior)})},
  6403. args: ["aString"],
  6404. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  6405. messageSends: ["class:category:", "new", "yourself"],
  6406. referencedClasses: ["ClassCategoryReader"]
  6407. }),
  6408. smalltalk.Behavior);
  6409. smalltalk.addMethod(
  6410. smalltalk.method({
  6411. selector: "methodsFor:stamp:",
  6412. category: 'accessing',
  6413. fn: function (aString,aStamp){
  6414. var self=this;
  6415. return smalltalk.withContext(function($ctx1) {
  6416. var $1;
  6417. $1=_st(self)._methodsFor_(aString);
  6418. return $1;
  6419. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},smalltalk.Behavior)})},
  6420. args: ["aString", "aStamp"],
  6421. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  6422. messageSends: ["methodsFor:"],
  6423. referencedClasses: []
  6424. }),
  6425. smalltalk.Behavior);
  6426. smalltalk.addMethod(
  6427. smalltalk.method({
  6428. selector: "methodsInProtocol:",
  6429. category: 'accessing',
  6430. fn: function (aString){
  6431. var self=this;
  6432. return smalltalk.withContext(function($ctx1) {
  6433. var $1;
  6434. $1=_st(_st(_st(self)._methodDictionary())._values())._select_((function(each){
  6435. return smalltalk.withContext(function($ctx2) {
  6436. return _st(_st(each)._protocol()).__eq(aString);
  6437. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6438. return $1;
  6439. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},smalltalk.Behavior)})},
  6440. args: ["aString"],
  6441. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  6442. messageSends: ["select:", "=", "protocol", "values", "methodDictionary"],
  6443. referencedClasses: []
  6444. }),
  6445. smalltalk.Behavior);
  6446. smalltalk.addMethod(
  6447. smalltalk.method({
  6448. selector: "name",
  6449. category: 'accessing',
  6450. fn: function (){
  6451. var self=this;
  6452. return smalltalk.withContext(function($ctx1) {
  6453. return self.className || nil;
  6454. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Behavior)})},
  6455. args: [],
  6456. source: "name\x0a\x09<return self.className || nil>",
  6457. messageSends: [],
  6458. referencedClasses: []
  6459. }),
  6460. smalltalk.Behavior);
  6461. smalltalk.addMethod(
  6462. smalltalk.method({
  6463. selector: "new",
  6464. category: 'instance creation',
  6465. fn: function (){
  6466. var self=this;
  6467. return smalltalk.withContext(function($ctx1) {
  6468. var $1;
  6469. $1=_st(_st(self)._basicNew())._initialize();
  6470. return $1;
  6471. }, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Behavior)})},
  6472. args: [],
  6473. source: "new\x0a\x09^self basicNew initialize",
  6474. messageSends: ["initialize", "basicNew"],
  6475. referencedClasses: []
  6476. }),
  6477. smalltalk.Behavior);
  6478. smalltalk.addMethod(
  6479. smalltalk.method({
  6480. selector: "organization",
  6481. category: 'accessing',
  6482. fn: function (){
  6483. var self=this;
  6484. return smalltalk.withContext(function($ctx1) {
  6485. var $1;
  6486. $1=_st(self)._basicAt_("organization");
  6487. return $1;
  6488. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Behavior)})},
  6489. args: [],
  6490. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6491. messageSends: ["basicAt:"],
  6492. referencedClasses: []
  6493. }),
  6494. smalltalk.Behavior);
  6495. smalltalk.addMethod(
  6496. smalltalk.method({
  6497. selector: "protocols",
  6498. category: 'accessing',
  6499. fn: function (){
  6500. var self=this;
  6501. return smalltalk.withContext(function($ctx1) {
  6502. var $1;
  6503. $1=_st(_st(_st(self)._organization())._elements())._sorted();
  6504. return $1;
  6505. }, function($ctx1) {$ctx1.fill(self,"protocols",{},smalltalk.Behavior)})},
  6506. args: [],
  6507. source: "protocols\x0a\x09^ self organization elements sorted",
  6508. messageSends: ["sorted", "elements", "organization"],
  6509. referencedClasses: []
  6510. }),
  6511. smalltalk.Behavior);
  6512. smalltalk.addMethod(
  6513. smalltalk.method({
  6514. selector: "protocolsDo:",
  6515. category: 'enumerating',
  6516. fn: function (aBlock){
  6517. var self=this;
  6518. var methodsByCategory;
  6519. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  6520. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6521. return smalltalk.withContext(function($ctx1) {
  6522. methodsByCategory=_st($HashedCollection())._new();
  6523. _st(_st(_st(self)._methodDictionary())._values())._do_((function(m){
  6524. return smalltalk.withContext(function($ctx2) {
  6525. return _st(_st(methodsByCategory)._at_ifAbsentPut_(_st(m)._category(),(function(){
  6526. return smalltalk.withContext(function($ctx3) {
  6527. return _st($Array())._new();
  6528. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._add_(m);
  6529. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1)})}));
  6530. _st(_st(self)._protocols())._do_((function(category){
  6531. return smalltalk.withContext(function($ctx2) {
  6532. return _st(aBlock)._value_value_(category,_st(methodsByCategory)._at_(category));
  6533. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  6534. return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByCategory:methodsByCategory},smalltalk.Behavior)})},
  6535. args: ["aBlock"],
  6536. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method category with\x0a\x09its collection of methods in the sort order of category name.\x22\x0a\x0a\x09| methodsByCategory |\x0a\x09methodsByCategory := HashedCollection new.\x0a\x09self methodDictionary values do: [:m |\x0a\x09\x09(methodsByCategory at: m category ifAbsentPut: [Array new])\x0a\x09\x09\x09add: m].\x0a\x09self protocols do: [:category |\x0a\x09\x09aBlock value: category value: (methodsByCategory at: category)]",
  6537. messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"],
  6538. referencedClasses: ["HashedCollection", "Array"]
  6539. }),
  6540. smalltalk.Behavior);
  6541. smalltalk.addMethod(
  6542. smalltalk.method({
  6543. selector: "prototype",
  6544. category: 'accessing',
  6545. fn: function (){
  6546. var self=this;
  6547. return smalltalk.withContext(function($ctx1) {
  6548. return self.fn.prototype;
  6549. return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},smalltalk.Behavior)})},
  6550. args: [],
  6551. source: "prototype\x0a\x09<return self.fn.prototype>",
  6552. messageSends: [],
  6553. referencedClasses: []
  6554. }),
  6555. smalltalk.Behavior);
  6556. smalltalk.addMethod(
  6557. smalltalk.method({
  6558. selector: "removeCompiledMethod:",
  6559. category: 'compiling',
  6560. fn: function (aMethod){
  6561. var self=this;
  6562. function $MethodRemoved(){return smalltalk.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  6563. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6564. return smalltalk.withContext(function($ctx1) {
  6565. var $1,$2;
  6566. _st(self)._basicRemoveCompiledMethod_(aMethod);
  6567. _st(_st(self)._methods())._detect_ifNone_((function(each){
  6568. return smalltalk.withContext(function($ctx2) {
  6569. return _st(_st(each)._protocol()).__eq(_st(aMethod)._protocol());
  6570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  6571. return smalltalk.withContext(function($ctx2) {
  6572. return _st(_st(self)._organization())._removeElement_(_st(aMethod)._protocol());
  6573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6574. $1=_st($MethodRemoved())._new();
  6575. _st($1)._method_(aMethod);
  6576. $2=_st($1)._yourself();
  6577. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6578. return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  6579. args: ["aMethod"],
  6580. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aMethod protocol ]\x0a\x09\x09ifNone: [ self organization removeElement: aMethod protocol ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  6581. messageSends: ["basicRemoveCompiledMethod:", "detect:ifNone:", "=", "protocol", "removeElement:", "organization", "methods", "announce:", "method:", "new", "yourself", "current"],
  6582. referencedClasses: ["MethodRemoved", "SystemAnnouncer"]
  6583. }),
  6584. smalltalk.Behavior);
  6585. smalltalk.addMethod(
  6586. smalltalk.method({
  6587. selector: "selectors",
  6588. category: 'accessing',
  6589. fn: function (){
  6590. var self=this;
  6591. return smalltalk.withContext(function($ctx1) {
  6592. var $1;
  6593. $1=_st(_st(self)._methodDictionary())._keys();
  6594. return $1;
  6595. }, function($ctx1) {$ctx1.fill(self,"selectors",{},smalltalk.Behavior)})},
  6596. args: [],
  6597. source: "selectors\x0a\x09^ self methodDictionary keys",
  6598. messageSends: ["keys", "methodDictionary"],
  6599. referencedClasses: []
  6600. }),
  6601. smalltalk.Behavior);
  6602. smalltalk.addMethod(
  6603. smalltalk.method({
  6604. selector: "subclasses",
  6605. category: 'accessing',
  6606. fn: function (){
  6607. var self=this;
  6608. return smalltalk.withContext(function($ctx1) {
  6609. return smalltalk.subclasses(self);
  6610. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Behavior)})},
  6611. args: [],
  6612. source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
  6613. messageSends: [],
  6614. referencedClasses: []
  6615. }),
  6616. smalltalk.Behavior);
  6617. smalltalk.addMethod(
  6618. smalltalk.method({
  6619. selector: "superclass",
  6620. category: 'accessing',
  6621. fn: function (){
  6622. var self=this;
  6623. return smalltalk.withContext(function($ctx1) {
  6624. return self.superclass || nil;
  6625. return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},smalltalk.Behavior)})},
  6626. args: [],
  6627. source: "superclass\x0a\x09<return self.superclass || nil>",
  6628. messageSends: [],
  6629. referencedClasses: []
  6630. }),
  6631. smalltalk.Behavior);
  6632. smalltalk.addMethod(
  6633. smalltalk.method({
  6634. selector: "theMetaClass",
  6635. category: 'accessing',
  6636. fn: function (){
  6637. var self=this;
  6638. return smalltalk.withContext(function($ctx1) {
  6639. var $1;
  6640. $1=_st(self)._class();
  6641. return $1;
  6642. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Behavior)})},
  6643. args: [],
  6644. source: "theMetaClass\x0a\x09^ self class",
  6645. messageSends: ["class"],
  6646. referencedClasses: []
  6647. }),
  6648. smalltalk.Behavior);
  6649. smalltalk.addMethod(
  6650. smalltalk.method({
  6651. selector: "theNonMetaClass",
  6652. category: 'accessing',
  6653. fn: function (){
  6654. var self=this;
  6655. return smalltalk.withContext(function($ctx1) {
  6656. var $1;
  6657. $1=self;
  6658. return $1;
  6659. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Behavior)})},
  6660. args: [],
  6661. source: "theNonMetaClass\x0a\x09^ self",
  6662. messageSends: [],
  6663. referencedClasses: []
  6664. }),
  6665. smalltalk.Behavior);
  6666. smalltalk.addMethod(
  6667. smalltalk.method({
  6668. selector: "withAllSubclasses",
  6669. category: 'accessing',
  6670. fn: function (){
  6671. var self=this;
  6672. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6673. return smalltalk.withContext(function($ctx1) {
  6674. var $2,$3,$1;
  6675. $2=_st($Array())._with_(self);
  6676. _st($2)._addAll_(_st(self)._allSubclasses());
  6677. $3=_st($2)._yourself();
  6678. $1=$3;
  6679. return $1;
  6680. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},smalltalk.Behavior)})},
  6681. args: [],
  6682. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  6683. messageSends: ["addAll:", "allSubclasses", "with:", "yourself"],
  6684. referencedClasses: ["Array"]
  6685. }),
  6686. smalltalk.Behavior);
  6687. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  6688. smalltalk.Class.comment="Class is __the__ class object.\x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`"
  6689. smalltalk.addMethod(
  6690. smalltalk.method({
  6691. selector: "asJavascript",
  6692. category: 'converting',
  6693. fn: function (){
  6694. var self=this;
  6695. return smalltalk.withContext(function($ctx1) {
  6696. var $1;
  6697. $1=_st("smalltalk.").__comma(_st(self)._name());
  6698. return $1;
  6699. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Class)})},
  6700. args: [],
  6701. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  6702. messageSends: [",", "name"],
  6703. referencedClasses: []
  6704. }),
  6705. smalltalk.Class);
  6706. smalltalk.addMethod(
  6707. smalltalk.method({
  6708. selector: "category",
  6709. category: 'accessing',
  6710. fn: function (){
  6711. var self=this;
  6712. return smalltalk.withContext(function($ctx1) {
  6713. var $2,$1;
  6714. $2=_st(self)._package();
  6715. if(($receiver = $2) == nil || $receiver == undefined){
  6716. $1="Unclassified";
  6717. } else {
  6718. $1=_st(_st(self)._package())._name();
  6719. };
  6720. return $1;
  6721. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.Class)})},
  6722. args: [],
  6723. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  6724. messageSends: ["ifNil:ifNotNil:", "name", "package"],
  6725. referencedClasses: []
  6726. }),
  6727. smalltalk.Class);
  6728. smalltalk.addMethod(
  6729. smalltalk.method({
  6730. selector: "definition",
  6731. category: 'accessing',
  6732. fn: function (){
  6733. var self=this;
  6734. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6735. return smalltalk.withContext(function($ctx1) {
  6736. var $2,$3,$4,$5,$1;
  6737. $1=_st($String())._streamContents_((function(stream){
  6738. return smalltalk.withContext(function($ctx2) {
  6739. $2=stream;
  6740. _st($2)._nextPutAll_(_st(_st(self)._superclass())._asString());
  6741. _st($2)._nextPutAll_(" subclass: #");
  6742. _st($2)._nextPutAll_(_st(self)._name());
  6743. _st($2)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
  6744. $3=_st($2)._nextPutAll_("instanceVariableNames: '");
  6745. $3;
  6746. _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){
  6747. return smalltalk.withContext(function($ctx3) {
  6748. return _st(stream)._nextPutAll_(each);
  6749. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  6750. return smalltalk.withContext(function($ctx3) {
  6751. return _st(stream)._nextPutAll_(" ");
  6752. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  6753. $4=stream;
  6754. _st($4)._nextPutAll_(_st(_st("'").__comma(_st($String())._lf())).__comma(_st($String())._tab()));
  6755. _st($4)._nextPutAll_("package: '");
  6756. _st($4)._nextPutAll_(_st(self)._category());
  6757. $5=_st($4)._nextPutAll_("'");
  6758. return $5;
  6759. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  6760. return $1;
  6761. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Class)})},
  6762. args: [],
  6763. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  6764. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"],
  6765. referencedClasses: ["String"]
  6766. }),
  6767. smalltalk.Class);
  6768. smalltalk.addMethod(
  6769. smalltalk.method({
  6770. selector: "isClass",
  6771. category: 'testing',
  6772. fn: function (){
  6773. var self=this;
  6774. return smalltalk.withContext(function($ctx1) {
  6775. return true;
  6776. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Class)})},
  6777. args: [],
  6778. source: "isClass\x0a\x09^true",
  6779. messageSends: [],
  6780. referencedClasses: []
  6781. }),
  6782. smalltalk.Class);
  6783. smalltalk.addMethod(
  6784. smalltalk.method({
  6785. selector: "package",
  6786. category: 'accessing',
  6787. fn: function (){
  6788. var self=this;
  6789. return smalltalk.withContext(function($ctx1) {
  6790. var $1;
  6791. $1=_st(self)._basicAt_("pkg");
  6792. return $1;
  6793. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.Class)})},
  6794. args: [],
  6795. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6796. messageSends: ["basicAt:"],
  6797. referencedClasses: []
  6798. }),
  6799. smalltalk.Class);
  6800. smalltalk.addMethod(
  6801. smalltalk.method({
  6802. selector: "package:",
  6803. category: 'accessing',
  6804. fn: function (aPackage){
  6805. var self=this;
  6806. var oldPackage;
  6807. function $ClassMoved(){return smalltalk.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  6808. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6809. return smalltalk.withContext(function($ctx1) {
  6810. var $1,$2;
  6811. oldPackage=_st(self)._package();
  6812. _st(self)._basicAt_put_("pkg",aPackage);
  6813. _st(_st(oldPackage)._organization())._removeElement_(self);
  6814. _st(_st(aPackage)._organization())._addElement_(self);
  6815. $1=_st($ClassMoved())._new();
  6816. _st($1)._theClass_(self);
  6817. _st($1)._oldPackage_(oldPackage);
  6818. $2=_st($1)._yourself();
  6819. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6820. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},smalltalk.Class)})},
  6821. args: ["aPackage"],
  6822. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  6823. messageSends: ["package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "theClass:", "new", "oldPackage:", "yourself", "current"],
  6824. referencedClasses: ["ClassMoved", "SystemAnnouncer"]
  6825. }),
  6826. smalltalk.Class);
  6827. smalltalk.addMethod(
  6828. smalltalk.method({
  6829. selector: "printOn:",
  6830. category: 'printing',
  6831. fn: function (aStream){
  6832. var self=this;
  6833. return smalltalk.withContext(function($ctx1) {
  6834. _st(aStream)._nextPutAll_(_st(self)._name());
  6835. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Class)})},
  6836. args: ["aStream"],
  6837. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  6838. messageSends: ["nextPutAll:", "name"],
  6839. referencedClasses: []
  6840. }),
  6841. smalltalk.Class);
  6842. smalltalk.addMethod(
  6843. smalltalk.method({
  6844. selector: "rename:",
  6845. category: 'accessing',
  6846. fn: function (aString){
  6847. var self=this;
  6848. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6849. return smalltalk.withContext(function($ctx1) {
  6850. _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
  6851. return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},smalltalk.Class)})},
  6852. args: ["aString"],
  6853. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6854. messageSends: ["renameClass:to:", "new"],
  6855. referencedClasses: ["ClassBuilder"]
  6856. }),
  6857. smalltalk.Class);
  6858. smalltalk.addMethod(
  6859. smalltalk.method({
  6860. selector: "subclass:instanceVariableNames:",
  6861. category: 'class creation',
  6862. fn: function (aString,anotherString){
  6863. var self=this;
  6864. return smalltalk.withContext(function($ctx1) {
  6865. var $1;
  6866. $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6867. return $1;
  6868. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.Class)})},
  6869. args: ["aString", "anotherString"],
  6870. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  6871. messageSends: ["subclass:instanceVariableNames:package:"],
  6872. referencedClasses: []
  6873. }),
  6874. smalltalk.Class);
  6875. smalltalk.addMethod(
  6876. smalltalk.method({
  6877. selector: "subclass:instanceVariableNames:category:",
  6878. category: 'class creation',
  6879. fn: function (aString,aString2,aString3){
  6880. var self=this;
  6881. return smalltalk.withContext(function($ctx1) {
  6882. var $1;
  6883. _st(self)._deprecatedAPI();
  6884. $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6885. return $1;
  6886. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  6887. args: ["aString", "aString2", "aString3"],
  6888. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3",
  6889. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  6890. referencedClasses: []
  6891. }),
  6892. smalltalk.Class);
  6893. smalltalk.addMethod(
  6894. smalltalk.method({
  6895. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6896. category: 'class creation',
  6897. fn: function (aString,aString2,classVars,pools,aString3){
  6898. var self=this;
  6899. return smalltalk.withContext(function($ctx1) {
  6900. var $1;
  6901. $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6902. return $1;
  6903. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},smalltalk.Class)})},
  6904. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6905. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Just ignore class variables and pools. Added for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3",
  6906. messageSends: ["subclass:instanceVariableNames:package:"],
  6907. referencedClasses: []
  6908. }),
  6909. smalltalk.Class);
  6910. smalltalk.addMethod(
  6911. smalltalk.method({
  6912. selector: "subclass:instanceVariableNames:package:",
  6913. category: 'class creation',
  6914. fn: function (aString,aString2,aString3){
  6915. var self=this;
  6916. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6917. return smalltalk.withContext(function($ctx1) {
  6918. var $1;
  6919. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  6920. return $1;
  6921. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  6922. args: ["aString", "aString2", "aString3"],
  6923. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6924. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  6925. referencedClasses: ["ClassBuilder"]
  6926. }),
  6927. smalltalk.Class);
  6928. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  6929. smalltalk.Metaclass.comment="Metaclass is the root of the class hierarchy.\x0a\x0aMetaclass instances are metaclasses, one for each real class.\x0aMetaclass instances have a single instance, which they hold onto, which is the class that they are the metaclass of."
  6930. smalltalk.addMethod(
  6931. smalltalk.method({
  6932. selector: "asJavascript",
  6933. category: 'converting',
  6934. fn: function (){
  6935. var self=this;
  6936. return smalltalk.withContext(function($ctx1) {
  6937. var $1;
  6938. $1=_st(_st("smalltalk.").__comma(_st(_st(self)._instanceClass())._name())).__comma(".klass");
  6939. return $1;
  6940. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Metaclass)})},
  6941. args: [],
  6942. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  6943. messageSends: [",", "name", "instanceClass"],
  6944. referencedClasses: []
  6945. }),
  6946. smalltalk.Metaclass);
  6947. smalltalk.addMethod(
  6948. smalltalk.method({
  6949. selector: "definition",
  6950. category: 'accessing',
  6951. fn: function (){
  6952. var self=this;
  6953. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6954. return smalltalk.withContext(function($ctx1) {
  6955. var $2,$3,$1;
  6956. $1=_st($String())._streamContents_((function(stream){
  6957. return smalltalk.withContext(function($ctx2) {
  6958. $2=stream;
  6959. _st($2)._nextPutAll_(_st(self)._asString());
  6960. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  6961. $3;
  6962. _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){
  6963. return smalltalk.withContext(function($ctx3) {
  6964. return _st(stream)._nextPutAll_(each);
  6965. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  6966. return smalltalk.withContext(function($ctx3) {
  6967. return _st(stream)._nextPutAll_(" ");
  6968. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  6969. return _st(stream)._nextPutAll_("'");
  6970. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  6971. return $1;
  6972. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Metaclass)})},
  6973. args: [],
  6974. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  6975. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  6976. referencedClasses: ["String"]
  6977. }),
  6978. smalltalk.Metaclass);
  6979. smalltalk.addMethod(
  6980. smalltalk.method({
  6981. selector: "instanceClass",
  6982. category: 'accessing',
  6983. fn: function (){
  6984. var self=this;
  6985. return smalltalk.withContext(function($ctx1) {
  6986. return self.instanceClass;
  6987. return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},smalltalk.Metaclass)})},
  6988. args: [],
  6989. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6990. messageSends: [],
  6991. referencedClasses: []
  6992. }),
  6993. smalltalk.Metaclass);
  6994. smalltalk.addMethod(
  6995. smalltalk.method({
  6996. selector: "instanceVariableNames:",
  6997. category: 'accessing',
  6998. fn: function (aCollection){
  6999. var self=this;
  7000. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7001. return smalltalk.withContext(function($ctx1) {
  7002. _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  7003. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},smalltalk.Metaclass)})},
  7004. args: ["aCollection"],
  7005. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  7006. messageSends: ["class:instanceVariableNames:", "new"],
  7007. referencedClasses: ["ClassBuilder"]
  7008. }),
  7009. smalltalk.Metaclass);
  7010. smalltalk.addMethod(
  7011. smalltalk.method({
  7012. selector: "isMetaclass",
  7013. category: 'testing',
  7014. fn: function (){
  7015. var self=this;
  7016. return smalltalk.withContext(function($ctx1) {
  7017. return true;
  7018. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Metaclass)})},
  7019. args: [],
  7020. source: "isMetaclass\x0a\x09^true",
  7021. messageSends: [],
  7022. referencedClasses: []
  7023. }),
  7024. smalltalk.Metaclass);
  7025. smalltalk.addMethod(
  7026. smalltalk.method({
  7027. selector: "printOn:",
  7028. category: 'printing',
  7029. fn: function (aStream){
  7030. var self=this;
  7031. return smalltalk.withContext(function($ctx1) {
  7032. var $1,$2;
  7033. $1=aStream;
  7034. _st($1)._nextPutAll_(_st(_st(self)._instanceClass())._name());
  7035. $2=_st($1)._nextPutAll_(" class");
  7036. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Metaclass)})},
  7037. args: ["aStream"],
  7038. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  7039. messageSends: ["nextPutAll:", "name", "instanceClass"],
  7040. referencedClasses: []
  7041. }),
  7042. smalltalk.Metaclass);
  7043. smalltalk.addMethod(
  7044. smalltalk.method({
  7045. selector: "theMetaClass",
  7046. category: 'accessing',
  7047. fn: function (){
  7048. var self=this;
  7049. return smalltalk.withContext(function($ctx1) {
  7050. var $1;
  7051. $1=self;
  7052. return $1;
  7053. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Metaclass)})},
  7054. args: [],
  7055. source: "theMetaClass\x0a\x09^ self",
  7056. messageSends: [],
  7057. referencedClasses: []
  7058. }),
  7059. smalltalk.Metaclass);
  7060. smalltalk.addMethod(
  7061. smalltalk.method({
  7062. selector: "theNonMetaClass",
  7063. category: 'accessing',
  7064. fn: function (){
  7065. var self=this;
  7066. return smalltalk.withContext(function($ctx1) {
  7067. var $1;
  7068. $1=_st(self)._instanceClass();
  7069. return $1;
  7070. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Metaclass)})},
  7071. args: [],
  7072. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  7073. messageSends: ["instanceClass"],
  7074. referencedClasses: []
  7075. }),
  7076. smalltalk.Metaclass);
  7077. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  7078. smalltalk.ClassBuilder.comment="ClassBuilder is responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using ClassBuilder directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`."
  7079. smalltalk.addMethod(
  7080. smalltalk.method({
  7081. selector: "addSubclassOf:named:instanceVariableNames:package:",
  7082. category: 'class definition',
  7083. fn: function (aClass,aString,aCollection,packageName){
  7084. var self=this;
  7085. var theClass;
  7086. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7087. return smalltalk.withContext(function($ctx1) {
  7088. var $1,$2,$3,$4;
  7089. theClass=_st(_st($Smalltalk())._current())._at_(aString);
  7090. $1=theClass;
  7091. if(($receiver = $1) == nil || $receiver == undefined){
  7092. $1;
  7093. } else {
  7094. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  7095. if(! smalltalk.assert($2)){
  7096. $3=_st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(aString,aClass,aCollection,packageName);
  7097. return $3;
  7098. };
  7099. };
  7100. $4=_st(self)._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,aString,aCollection,packageName);
  7101. return $4;
  7102. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName,theClass:theClass},smalltalk.ClassBuilder)})},
  7103. args: ["aClass", "aString", "aCollection", "packageName"],
  7104. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09| theClass |\x0a\x09\x0a\x09theClass := Smalltalk current at: aString.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: aString\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: aString\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  7105. messageSends: ["at:", "current", "ifNotNil:", "ifFalse:", "migrateClassNamed:superclass:instanceVariableNames:package:", "==", "superclass", "basicAddSubclassOf:named:instanceVariableNames:package:"],
  7106. referencedClasses: ["Smalltalk"]
  7107. }),
  7108. smalltalk.ClassBuilder);
  7109. smalltalk.addMethod(
  7110. smalltalk.method({
  7111. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7112. category: 'private',
  7113. fn: function (aClass,aString,aCollection,packageName){
  7114. var self=this;
  7115. return smalltalk.withContext(function($ctx1) {
  7116. smalltalk.addClass(aString, aClass, aCollection, packageName);
  7117. return smalltalk[aString]
  7118. ;
  7119. return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},smalltalk.ClassBuilder)})},
  7120. args: ["aClass", "aString", "aCollection", "packageName"],
  7121. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return smalltalk[aString]\x0a\x09>",
  7122. messageSends: [],
  7123. referencedClasses: []
  7124. }),
  7125. smalltalk.ClassBuilder);
  7126. smalltalk.addMethod(
  7127. smalltalk.method({
  7128. selector: "basicClass:instanceVariableNames:",
  7129. category: 'private',
  7130. fn: function (aClass,aString){
  7131. var self=this;
  7132. return smalltalk.withContext(function($ctx1) {
  7133. _st(self)._basicClass_instanceVariables_(aClass,_st(self)._instanceVariableNamesFor_(aString));
  7134. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7135. args: ["aClass", "aString"],
  7136. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7137. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
  7138. referencedClasses: []
  7139. }),
  7140. smalltalk.ClassBuilder);
  7141. smalltalk.addMethod(
  7142. smalltalk.method({
  7143. selector: "basicClass:instanceVariables:",
  7144. category: 'private',
  7145. fn: function (aClass,aCollection){
  7146. var self=this;
  7147. return smalltalk.withContext(function($ctx1) {
  7148. var $1;
  7149. $1=_st(aClass)._isMetaclass();
  7150. if(! smalltalk.assert($1)){
  7151. _st(self)._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  7152. };
  7153. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  7154. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},smalltalk.ClassBuilder)})},
  7155. args: ["aClass", "aCollection"],
  7156. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7157. messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:"],
  7158. referencedClasses: []
  7159. }),
  7160. smalltalk.ClassBuilder);
  7161. smalltalk.addMethod(
  7162. smalltalk.method({
  7163. selector: "basicRemoveClass:",
  7164. category: 'private',
  7165. fn: function (aClass){
  7166. var self=this;
  7167. return smalltalk.withContext(function($ctx1) {
  7168. smalltalk.removeClass(aClass);
  7169. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  7170. args: ["aClass"],
  7171. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  7172. messageSends: [],
  7173. referencedClasses: []
  7174. }),
  7175. smalltalk.ClassBuilder);
  7176. smalltalk.addMethod(
  7177. smalltalk.method({
  7178. selector: "basicRenameClass:to:",
  7179. category: 'private',
  7180. fn: function (aClass,aString){
  7181. var self=this;
  7182. return smalltalk.withContext(function($ctx1) {
  7183. smalltalk[aString] = aClass;
  7184. delete smalltalk[aClass.className];
  7185. aClass.className = aString;
  7186. ;
  7187. return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7188. args: ["aClass", "aString"],
  7189. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09\x09delete smalltalk[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  7190. messageSends: [],
  7191. referencedClasses: []
  7192. }),
  7193. smalltalk.ClassBuilder);
  7194. smalltalk.addMethod(
  7195. smalltalk.method({
  7196. selector: "basicSwapClassNames:with:",
  7197. category: 'private',
  7198. fn: function (aClass,anotherClass){
  7199. var self=this;
  7200. return smalltalk.withContext(function($ctx1) {
  7201. var tmp = aClass.className;
  7202. aClass.className = anotherClass.className;
  7203. anotherClass.className = tmp;
  7204. ;
  7205. return self}, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  7206. args: ["aClass", "anotherClass"],
  7207. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
  7208. messageSends: [],
  7209. referencedClasses: []
  7210. }),
  7211. smalltalk.ClassBuilder);
  7212. smalltalk.addMethod(
  7213. smalltalk.method({
  7214. selector: "class:instanceVariableNames:",
  7215. category: 'class definition',
  7216. fn: function (aClass,aString){
  7217. var self=this;
  7218. function $ClassDefinitionChanged(){return smalltalk.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  7219. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7220. return smalltalk.withContext(function($ctx1) {
  7221. var $1,$2;
  7222. _st(self)._basicClass_instanceVariableNames_(aClass,aString);
  7223. _st(self)._setupClass_(aClass);
  7224. $1=_st($ClassDefinitionChanged())._new();
  7225. _st($1)._theClass_(aClass);
  7226. $2=_st($1)._yourself();
  7227. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7228. return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7229. args: ["aClass", "aString"],
  7230. source: "class: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariableNames: aString.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7231. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  7232. referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"]
  7233. }),
  7234. smalltalk.ClassBuilder);
  7235. smalltalk.addMethod(
  7236. smalltalk.method({
  7237. selector: "copyClass:named:",
  7238. category: 'copying',
  7239. fn: function (aClass,aString){
  7240. var self=this;
  7241. var newClass;
  7242. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7243. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7244. return smalltalk.withContext(function($ctx1) {
  7245. var $1,$2,$3;
  7246. newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),aString,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  7247. _st(self)._copyClass_to_(aClass,newClass);
  7248. $1=_st($ClassAdded())._new();
  7249. _st($1)._theClass_(newClass);
  7250. $2=_st($1)._yourself();
  7251. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7252. $3=newClass;
  7253. return $3;
  7254. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,aString:aString,newClass:newClass},smalltalk.ClassBuilder)})},
  7255. args: ["aClass", "aString"],
  7256. source: "copyClass: aClass named: aString\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: aString\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\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",
  7257. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
  7258. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  7259. }),
  7260. smalltalk.ClassBuilder);
  7261. smalltalk.addMethod(
  7262. smalltalk.method({
  7263. selector: "copyClass:to:",
  7264. category: 'copying',
  7265. fn: function (aClass,anotherClass){
  7266. var self=this;
  7267. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7268. return smalltalk.withContext(function($ctx1) {
  7269. _st(anotherClass)._comment_(_st(aClass)._comment());
  7270. _st(_st(_st(aClass)._methodDictionary())._values())._do_((function(each){
  7271. return smalltalk.withContext(function($ctx2) {
  7272. return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),anotherClass,_st(each)._category());
  7273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7274. _st(self)._basicClass_instanceVariables_(_st(anotherClass)._class(),_st(_st(aClass)._class())._instanceVariableNames());
  7275. _st(_st(_st(_st(aClass)._class())._methodDictionary())._values())._do_((function(each){
  7276. return smalltalk.withContext(function($ctx2) {
  7277. return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._category());
  7278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7279. _st(self)._setupClass_(anotherClass);
  7280. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  7281. args: ["aClass", "anotherClass"],
  7282. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass category: each category ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class category: each category ].\x0a\x0a\x09self setupClass: anotherClass",
  7283. messageSends: ["comment:", "comment", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
  7284. referencedClasses: ["Compiler"]
  7285. }),
  7286. smalltalk.ClassBuilder);
  7287. smalltalk.addMethod(
  7288. smalltalk.method({
  7289. selector: "installMethod:forClass:category:",
  7290. category: 'method definition',
  7291. fn: function (aCompiledMethod,aBehavior,aString){
  7292. var self=this;
  7293. return smalltalk.withContext(function($ctx1) {
  7294. var $1;
  7295. _st(aCompiledMethod)._category_(aString);
  7296. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7297. _st(self)._setupClass_(aBehavior);
  7298. $1=aCompiledMethod;
  7299. return $1;
  7300. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},smalltalk.ClassBuilder)})},
  7301. args: ["aCompiledMethod", "aBehavior", "aString"],
  7302. source: "installMethod: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^aCompiledMethod",
  7303. messageSends: ["category:", "addCompiledMethod:", "setupClass:"],
  7304. referencedClasses: []
  7305. }),
  7306. smalltalk.ClassBuilder);
  7307. smalltalk.addMethod(
  7308. smalltalk.method({
  7309. selector: "instanceVariableNamesFor:",
  7310. category: 'accessing',
  7311. fn: function (aString){
  7312. var self=this;
  7313. return smalltalk.withContext(function($ctx1) {
  7314. var $1;
  7315. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  7316. return smalltalk.withContext(function($ctx2) {
  7317. return _st(each)._isEmpty();
  7318. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7319. return $1;
  7320. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},smalltalk.ClassBuilder)})},
  7321. args: ["aString"],
  7322. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7323. messageSends: ["reject:", "isEmpty", "tokenize:"],
  7324. referencedClasses: []
  7325. }),
  7326. smalltalk.ClassBuilder);
  7327. smalltalk.addMethod(
  7328. smalltalk.method({
  7329. selector: "migrateClass:superclass:",
  7330. category: 'class migration',
  7331. fn: function (aClass,anotherClass){
  7332. var self=this;
  7333. return smalltalk.withContext(function($ctx1) {
  7334. _st(console)._log_(_st(aClass)._name());
  7335. _st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(_st(aClass)._name(),anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  7336. return self}, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  7337. args: ["aClass", "anotherClass"],
  7338. source: "migrateClass: aClass superclass: anotherClass\x0a\x09console log: aClass name.\x0a\x09self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  7339. messageSends: ["log:", "name", "migrateClassNamed:superclass:instanceVariableNames:package:", "instanceVariableNames", "package"],
  7340. referencedClasses: []
  7341. }),
  7342. smalltalk.ClassBuilder);
  7343. smalltalk.addMethod(
  7344. smalltalk.method({
  7345. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7346. category: 'class migration',
  7347. fn: function (aString,aClass,aCollection,packageName){
  7348. var self=this;
  7349. var oldClass,newClass,tmp;
  7350. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7351. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7352. return smalltalk.withContext(function($ctx1) {
  7353. var $1,$2,$3,$4,$5;
  7354. tmp=_st("new*").__comma(aString);
  7355. oldClass=_st(_st($Smalltalk())._current())._at_(aString);
  7356. newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7357. _st(self)._basicSwapClassNames_with_(oldClass,newClass);
  7358. _st((function(){
  7359. return smalltalk.withContext(function($ctx2) {
  7360. return _st(self)._copyClass_to_(oldClass,newClass);
  7361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(exception){
  7362. return smalltalk.withContext(function($ctx2) {
  7363. $1=self;
  7364. _st($1)._basicSwapClassNames_with_(oldClass,newClass);
  7365. $2=_st($1)._basicRemoveClass_(newClass);
  7366. $2;
  7367. return _st(exception)._signal();
  7368. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
  7369. $3=self;
  7370. _st($3)._rawRenameClass_to_(oldClass,tmp);
  7371. $4=_st($3)._rawRenameClass_to_(newClass,aString);
  7372. _st(_st(oldClass)._subclasses())._do_((function(each){
  7373. return smalltalk.withContext(function($ctx2) {
  7374. return _st(self)._migrateClass_superclass_(each,newClass);
  7375. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7376. _st(self)._basicRemoveClass_(oldClass);
  7377. $5=newClass;
  7378. return $5;
  7379. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{aString:aString,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},smalltalk.ClassBuilder)})},
  7380. args: ["aString", "aClass", "aCollection", "packageName"],
  7381. source: "migrateClassNamed: aString superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', aString.\x0a\x09oldClass := Smalltalk current at: aString.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: 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\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: aString.\x0a\x0a\x09oldClass subclasses do: [ :each |\x0a\x09\x09self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09^newClass",
  7382. messageSends: [",", "at:", "current", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "basicRemoveClass:", "signal", "copyClass:to:", "rawRenameClass:to:", "do:", "migrateClass:superclass:", "subclasses"],
  7383. referencedClasses: ["Smalltalk", "Error"]
  7384. }),
  7385. smalltalk.ClassBuilder);
  7386. smalltalk.addMethod(
  7387. smalltalk.method({
  7388. selector: "rawRenameClass:to:",
  7389. category: 'private',
  7390. fn: function (aClass,aString){
  7391. var self=this;
  7392. return smalltalk.withContext(function($ctx1) {
  7393. smalltalk[aString] = aClass;
  7394. ;
  7395. return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7396. args: ["aClass", "aString"],
  7397. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09>",
  7398. messageSends: [],
  7399. referencedClasses: []
  7400. }),
  7401. smalltalk.ClassBuilder);
  7402. smalltalk.addMethod(
  7403. smalltalk.method({
  7404. selector: "renameClass:to:",
  7405. category: 'class migration',
  7406. fn: function (aClass,aString){
  7407. var self=this;
  7408. function $ClassRenamed(){return smalltalk.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7409. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7410. return smalltalk.withContext(function($ctx1) {
  7411. var $1,$2;
  7412. _st(self)._basicRenameClass_to_(aClass,aString);
  7413. $1=_st($ClassRenamed())._new();
  7414. _st($1)._theClass_(aClass);
  7415. $2=_st($1)._yourself();
  7416. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7417. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7418. args: ["aClass", "aString"],
  7419. source: "renameClass: aClass to: aString\x0a\x09self basicRenameClass: aClass to: aString.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7420. messageSends: ["basicRenameClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
  7421. referencedClasses: ["ClassRenamed", "SystemAnnouncer"]
  7422. }),
  7423. smalltalk.ClassBuilder);
  7424. smalltalk.addMethod(
  7425. smalltalk.method({
  7426. selector: "setupClass:",
  7427. category: 'public',
  7428. fn: function (aClass){
  7429. var self=this;
  7430. return smalltalk.withContext(function($ctx1) {
  7431. smalltalk.init(aClass);;
  7432. return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  7433. args: ["aClass"],
  7434. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  7435. messageSends: [],
  7436. referencedClasses: []
  7437. }),
  7438. smalltalk.ClassBuilder);
  7439. smalltalk.addMethod(
  7440. smalltalk.method({
  7441. selector: "superclass:subclass:",
  7442. category: 'class definition',
  7443. fn: function (aClass,aString){
  7444. var self=this;
  7445. return smalltalk.withContext(function($ctx1) {
  7446. var $1;
  7447. $1=_st(self)._superclass_subclass_instanceVariableNames_package_(aClass,aString,"",nil);
  7448. return $1;
  7449. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7450. args: ["aClass", "aString"],
  7451. source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil",
  7452. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  7453. referencedClasses: []
  7454. }),
  7455. smalltalk.ClassBuilder);
  7456. smalltalk.addMethod(
  7457. smalltalk.method({
  7458. selector: "superclass:subclass:instanceVariableNames:package:",
  7459. category: 'class definition',
  7460. fn: function (aClass,aString,aString2,aString3){
  7461. var self=this;
  7462. var newClass;
  7463. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7464. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7465. return smalltalk.withContext(function($ctx1) {
  7466. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  7467. $1=self;
  7468. $2=aClass;
  7469. $3=aString;
  7470. $4=_st(self)._instanceVariableNamesFor_(aString2);
  7471. $6=aString3;
  7472. if(($receiver = $6) == nil || $receiver == undefined){
  7473. $5="unclassified";
  7474. } else {
  7475. $5=$6;
  7476. };
  7477. newClass=_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$5);
  7478. _st(self)._setupClass_(newClass);
  7479. $7=_st($ClassAdded())._new();
  7480. _st($7)._theClass_(newClass);
  7481. $8=_st($7)._yourself();
  7482. _st(_st($SystemAnnouncer())._current())._announce_($8);
  7483. $9=newClass;
  7484. return $9;
  7485. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,aString:aString,aString2:aString2,aString3:aString3,newClass:newClass},smalltalk.ClassBuilder)})},
  7486. args: ["aClass", "aString", "aString2", "aString3"],
  7487. source: "superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)\x0a\x09\x09package: (aString3 ifNil: ['unclassified']).\x0a\x09self setupClass: 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",
  7488. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  7489. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  7490. }),
  7491. smalltalk.ClassBuilder);
  7492. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes');
  7493. smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file."
  7494. smalltalk.addMethod(
  7495. smalltalk.method({
  7496. selector: "class:category:",
  7497. category: 'accessing',
  7498. fn: function (aClass,aString){
  7499. var self=this;
  7500. return smalltalk.withContext(function($ctx1) {
  7501. self["@class"]=aClass;
  7502. self["@category"]=aString;
  7503. return self}, function($ctx1) {$ctx1.fill(self,"class:category:",{aClass:aClass,aString:aString},smalltalk.ClassCategoryReader)})},
  7504. args: ["aClass", "aString"],
  7505. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  7506. messageSends: [],
  7507. referencedClasses: []
  7508. }),
  7509. smalltalk.ClassCategoryReader);
  7510. smalltalk.addMethod(
  7511. smalltalk.method({
  7512. selector: "compileMethod:",
  7513. category: 'private',
  7514. fn: function (aString){
  7515. var self=this;
  7516. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7517. return smalltalk.withContext(function($ctx1) {
  7518. _st(_st($Compiler())._new())._install_forClass_category_(aString,self["@class"],self["@category"]);
  7519. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},smalltalk.ClassCategoryReader)})},
  7520. args: ["aString"],
  7521. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  7522. messageSends: ["install:forClass:category:", "new"],
  7523. referencedClasses: ["Compiler"]
  7524. }),
  7525. smalltalk.ClassCategoryReader);
  7526. smalltalk.addMethod(
  7527. smalltalk.method({
  7528. selector: "initialize",
  7529. category: 'initialization',
  7530. fn: function (){
  7531. var self=this;
  7532. return smalltalk.withContext(function($ctx1) {
  7533. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  7534. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCategoryReader)})},
  7535. args: [],
  7536. source: "initialize\x0a\x09super initialize.",
  7537. messageSends: ["initialize"],
  7538. referencedClasses: []
  7539. }),
  7540. smalltalk.ClassCategoryReader);
  7541. smalltalk.addMethod(
  7542. smalltalk.method({
  7543. selector: "scanFrom:",
  7544. category: 'fileIn',
  7545. fn: function (aChunkParser){
  7546. var self=this;
  7547. var chunk;
  7548. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7549. return smalltalk.withContext(function($ctx1) {
  7550. _st((function(){
  7551. return smalltalk.withContext(function($ctx2) {
  7552. chunk=_st(aChunkParser)._nextChunk();
  7553. chunk;
  7554. return _st(chunk)._isEmpty();
  7555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  7556. return smalltalk.withContext(function($ctx2) {
  7557. return _st(self)._compileMethod_(chunk);
  7558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  7559. _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
  7560. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCategoryReader)})},
  7561. args: ["aChunkParser"],
  7562. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09\x09self compileMethod: chunk].\x0a\x09ClassBuilder new setupClass: class",
  7563. messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
  7564. referencedClasses: ["ClassBuilder"]
  7565. }),
  7566. smalltalk.ClassCategoryReader);
  7567. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes');
  7568. smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class comments stored on a file.\x0aSee `ClassCategoryReader` too."
  7569. smalltalk.addMethod(
  7570. smalltalk.method({
  7571. selector: "class:",
  7572. category: 'accessing',
  7573. fn: function (aClass){
  7574. var self=this;
  7575. return smalltalk.withContext(function($ctx1) {
  7576. self["@class"]=aClass;
  7577. return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},smalltalk.ClassCommentReader)})},
  7578. args: ["aClass"],
  7579. source: "class: aClass\x0a\x09class := aClass",
  7580. messageSends: [],
  7581. referencedClasses: []
  7582. }),
  7583. smalltalk.ClassCommentReader);
  7584. smalltalk.addMethod(
  7585. smalltalk.method({
  7586. selector: "initialize",
  7587. category: 'initialization',
  7588. fn: function (){
  7589. var self=this;
  7590. return smalltalk.withContext(function($ctx1) {
  7591. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  7592. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCommentReader)})},
  7593. args: [],
  7594. source: "initialize\x0a\x09super initialize.",
  7595. messageSends: ["initialize"],
  7596. referencedClasses: []
  7597. }),
  7598. smalltalk.ClassCommentReader);
  7599. smalltalk.addMethod(
  7600. smalltalk.method({
  7601. selector: "scanFrom:",
  7602. category: 'fileIn',
  7603. fn: function (aChunkParser){
  7604. var self=this;
  7605. var chunk;
  7606. return smalltalk.withContext(function($ctx1) {
  7607. var $1;
  7608. chunk=_st(aChunkParser)._nextChunk();
  7609. $1=_st(chunk)._isEmpty();
  7610. if(! smalltalk.assert($1)){
  7611. _st(self)._setComment_(chunk);
  7612. };
  7613. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCommentReader)})},
  7614. args: ["aChunkParser"],
  7615. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk].",
  7616. messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"],
  7617. referencedClasses: []
  7618. }),
  7619. smalltalk.ClassCommentReader);
  7620. smalltalk.addMethod(
  7621. smalltalk.method({
  7622. selector: "setComment:",
  7623. category: 'private',
  7624. fn: function (aString){
  7625. var self=this;
  7626. return smalltalk.withContext(function($ctx1) {
  7627. _st(self["@class"])._comment_(aString);
  7628. return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},smalltalk.ClassCommentReader)})},
  7629. args: ["aString"],
  7630. source: "setComment: aString\x0a\x09class comment: aString",
  7631. messageSends: ["comment:"],
  7632. referencedClasses: []
  7633. }),
  7634. smalltalk.ClassCommentReader);
  7635. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7636. smalltalk.addMethod(
  7637. smalltalk.method({
  7638. selector: "getNodesFrom:",
  7639. category: 'accessing',
  7640. fn: function (aCollection){
  7641. var self=this;
  7642. var children,others;
  7643. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  7644. return smalltalk.withContext(function($ctx1) {
  7645. var $1;
  7646. children=[];
  7647. others=[];
  7648. _st(aCollection)._do_((function(each){
  7649. return smalltalk.withContext(function($ctx2) {
  7650. $1=_st(_st(each)._superclass()).__eq(_st(self)._theClass());
  7651. if(smalltalk.assert($1)){
  7652. return _st(children)._add_(each);
  7653. } else {
  7654. return _st(others)._add_(each);
  7655. };
  7656. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7657. self["@nodes"]=_st(children)._collect_((function(each){
  7658. return smalltalk.withContext(function($ctx2) {
  7659. return _st($ClassSorterNode())._on_classes_level_(each,others,_st(_st(self)._level()).__plus((1)));
  7660. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7661. return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},smalltalk.ClassSorterNode)})},
  7662. args: ["aCollection"],
  7663. source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [:each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [children add: each]\x0a\x09\x09\x09ifFalse: [others add: each]].\x0a\x09nodes:= children collect: [:each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1]",
  7664. messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"],
  7665. referencedClasses: ["ClassSorterNode"]
  7666. }),
  7667. smalltalk.ClassSorterNode);
  7668. smalltalk.addMethod(
  7669. smalltalk.method({
  7670. selector: "level",
  7671. category: 'accessing',
  7672. fn: function (){
  7673. var self=this;
  7674. return smalltalk.withContext(function($ctx1) {
  7675. var $1;
  7676. $1=self["@level"];
  7677. return $1;
  7678. }, function($ctx1) {$ctx1.fill(self,"level",{},smalltalk.ClassSorterNode)})},
  7679. args: [],
  7680. source: "level\x0a\x09^level",
  7681. messageSends: [],
  7682. referencedClasses: []
  7683. }),
  7684. smalltalk.ClassSorterNode);
  7685. smalltalk.addMethod(
  7686. smalltalk.method({
  7687. selector: "level:",
  7688. category: 'accessing',
  7689. fn: function (anInteger){
  7690. var self=this;
  7691. return smalltalk.withContext(function($ctx1) {
  7692. self["@level"]=anInteger;
  7693. return self}, function($ctx1) {$ctx1.fill(self,"level:",{anInteger:anInteger},smalltalk.ClassSorterNode)})},
  7694. args: ["anInteger"],
  7695. source: "level: anInteger\x0a\x09level := anInteger",
  7696. messageSends: [],
  7697. referencedClasses: []
  7698. }),
  7699. smalltalk.ClassSorterNode);
  7700. smalltalk.addMethod(
  7701. smalltalk.method({
  7702. selector: "nodes",
  7703. category: 'accessing',
  7704. fn: function (){
  7705. var self=this;
  7706. return smalltalk.withContext(function($ctx1) {
  7707. var $1;
  7708. $1=self["@nodes"];
  7709. return $1;
  7710. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.ClassSorterNode)})},
  7711. args: [],
  7712. source: "nodes\x0a\x09^nodes",
  7713. messageSends: [],
  7714. referencedClasses: []
  7715. }),
  7716. smalltalk.ClassSorterNode);
  7717. smalltalk.addMethod(
  7718. smalltalk.method({
  7719. selector: "theClass",
  7720. category: 'accessing',
  7721. fn: function (){
  7722. var self=this;
  7723. return smalltalk.withContext(function($ctx1) {
  7724. var $1;
  7725. $1=self["@theClass"];
  7726. return $1;
  7727. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassSorterNode)})},
  7728. args: [],
  7729. source: "theClass\x0a\x09^theClass",
  7730. messageSends: [],
  7731. referencedClasses: []
  7732. }),
  7733. smalltalk.ClassSorterNode);
  7734. smalltalk.addMethod(
  7735. smalltalk.method({
  7736. selector: "theClass:",
  7737. category: 'accessing',
  7738. fn: function (aClass){
  7739. var self=this;
  7740. return smalltalk.withContext(function($ctx1) {
  7741. self["@theClass"]=aClass;
  7742. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassSorterNode)})},
  7743. args: ["aClass"],
  7744. source: "theClass: aClass\x0a\x09theClass := aClass",
  7745. messageSends: [],
  7746. referencedClasses: []
  7747. }),
  7748. smalltalk.ClassSorterNode);
  7749. smalltalk.addMethod(
  7750. smalltalk.method({
  7751. selector: "traverseClassesWith:",
  7752. category: 'visiting',
  7753. fn: function (aCollection){
  7754. var self=this;
  7755. return smalltalk.withContext(function($ctx1) {
  7756. _st(aCollection)._add_(_st(self)._theClass());
  7757. _st(_st(_st(self)._nodes())._sorted_((function(a,b){
  7758. return smalltalk.withContext(function($ctx2) {
  7759. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  7760. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(aNode){
  7761. return smalltalk.withContext(function($ctx2) {
  7762. return _st(aNode)._traverseClassesWith_(aCollection);
  7763. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  7764. return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},smalltalk.ClassSorterNode)})},
  7765. args: ["aCollection"],
  7766. source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [:a :b | a theClass name <= b theClass name ]) do: [:aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
  7767. messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"],
  7768. referencedClasses: []
  7769. }),
  7770. smalltalk.ClassSorterNode);
  7771. smalltalk.addMethod(
  7772. smalltalk.method({
  7773. selector: "on:classes:level:",
  7774. category: 'instance creation',
  7775. fn: function (aClass,aCollection,anInteger){
  7776. var self=this;
  7777. return smalltalk.withContext(function($ctx1) {
  7778. var $2,$3,$1;
  7779. $2=_st(self)._new();
  7780. _st($2)._theClass_(aClass);
  7781. _st($2)._level_(anInteger);
  7782. _st($2)._getNodesFrom_(aCollection);
  7783. $3=_st($2)._yourself();
  7784. $1=$3;
  7785. return $1;
  7786. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},smalltalk.ClassSorterNode.klass)})},
  7787. args: ["aClass", "aCollection", "anInteger"],
  7788. source: "on: aClass classes: aCollection level: anInteger\x0a\x09^self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
  7789. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  7790. referencedClasses: []
  7791. }),
  7792. smalltalk.ClassSorterNode.klass);
  7793. smalltalk.addPackage('Kernel-Methods');
  7794. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  7795. smalltalk.BlockClosure.comment="A BlockClosure is a lexical closure.\x0aThe JavaScript representation is a function.\x0a\x0aA BlockClosure is evaluated with the `#value*` methods in the 'evaluating' protocol."
  7796. smalltalk.addMethod(
  7797. smalltalk.method({
  7798. selector: "applyTo:arguments:",
  7799. category: 'evaluating',
  7800. fn: function (anObject,aCollection){
  7801. var self=this;
  7802. return smalltalk.withContext(function($ctx1) {
  7803. return self.apply(anObject, aCollection);
  7804. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.BlockClosure)})},
  7805. args: ["anObject", "aCollection"],
  7806. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7807. messageSends: [],
  7808. referencedClasses: []
  7809. }),
  7810. smalltalk.BlockClosure);
  7811. smalltalk.addMethod(
  7812. smalltalk.method({
  7813. selector: "asCompiledMethod:",
  7814. category: 'converting',
  7815. fn: function (aString){
  7816. var self=this;
  7817. return smalltalk.withContext(function($ctx1) {
  7818. return smalltalk.method({selector:aString, fn:self});;
  7819. return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},smalltalk.BlockClosure)})},
  7820. args: ["aString"],
  7821. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  7822. messageSends: [],
  7823. referencedClasses: []
  7824. }),
  7825. smalltalk.BlockClosure);
  7826. smalltalk.addMethod(
  7827. smalltalk.method({
  7828. selector: "compiledSource",
  7829. category: 'accessing',
  7830. fn: function (){
  7831. var self=this;
  7832. return smalltalk.withContext(function($ctx1) {
  7833. return self.toString();
  7834. return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.BlockClosure)})},
  7835. args: [],
  7836. source: "compiledSource\x0a\x09<return self.toString()>",
  7837. messageSends: [],
  7838. referencedClasses: []
  7839. }),
  7840. smalltalk.BlockClosure);
  7841. smalltalk.addMethod(
  7842. smalltalk.method({
  7843. selector: "currySelf",
  7844. category: 'converting',
  7845. fn: function (){
  7846. var self=this;
  7847. return smalltalk.withContext(function($ctx1) {
  7848. return function () {
  7849. var args = [ this ];
  7850. args.push.apply(args, arguments);
  7851. return self.apply(null, args);
  7852. }
  7853. ;
  7854. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},smalltalk.BlockClosure)})},
  7855. args: [],
  7856. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09>",
  7857. messageSends: [],
  7858. referencedClasses: []
  7859. }),
  7860. smalltalk.BlockClosure);
  7861. smalltalk.addMethod(
  7862. smalltalk.method({
  7863. selector: "ensure:",
  7864. category: 'evaluating',
  7865. fn: function (aBlock){
  7866. var self=this;
  7867. return smalltalk.withContext(function($ctx1) {
  7868. try{return self()}finally{aBlock._value()};
  7869. return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  7870. args: ["aBlock"],
  7871. source: "ensure: aBlock\x0a\x09<try{return self()}finally{aBlock._value()}>",
  7872. messageSends: [],
  7873. referencedClasses: []
  7874. }),
  7875. smalltalk.BlockClosure);
  7876. smalltalk.addMethod(
  7877. smalltalk.method({
  7878. selector: "fork",
  7879. category: 'timeout/interval',
  7880. fn: function (){
  7881. var self=this;
  7882. function $ForkPool(){return smalltalk.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  7883. return smalltalk.withContext(function($ctx1) {
  7884. _st(_st($ForkPool())._default())._fork_(self);
  7885. return self}, function($ctx1) {$ctx1.fill(self,"fork",{},smalltalk.BlockClosure)})},
  7886. args: [],
  7887. source: "fork\x0a\x09ForkPool default fork: self",
  7888. messageSends: ["fork:", "default"],
  7889. referencedClasses: ["ForkPool"]
  7890. }),
  7891. smalltalk.BlockClosure);
  7892. smalltalk.addMethod(
  7893. smalltalk.method({
  7894. selector: "new",
  7895. category: 'evaluating',
  7896. fn: function (){
  7897. var self=this;
  7898. return smalltalk.withContext(function($ctx1) {
  7899. return new self();
  7900. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.BlockClosure)})},
  7901. args: [],
  7902. source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self()>",
  7903. messageSends: [],
  7904. referencedClasses: []
  7905. }),
  7906. smalltalk.BlockClosure);
  7907. smalltalk.addMethod(
  7908. smalltalk.method({
  7909. selector: "newValue:",
  7910. category: 'evaluating',
  7911. fn: function (anObject){
  7912. var self=this;
  7913. return smalltalk.withContext(function($ctx1) {
  7914. return new self(anObject);
  7915. return self}, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},smalltalk.BlockClosure)})},
  7916. args: ["anObject"],
  7917. source: "newValue: anObject\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject)>",
  7918. messageSends: [],
  7919. referencedClasses: []
  7920. }),
  7921. smalltalk.BlockClosure);
  7922. smalltalk.addMethod(
  7923. smalltalk.method({
  7924. selector: "newValue:value:",
  7925. category: 'evaluating',
  7926. fn: function (anObject,anObject2){
  7927. var self=this;
  7928. return smalltalk.withContext(function($ctx1) {
  7929. return new self(anObject, anObject2);
  7930. return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},smalltalk.BlockClosure)})},
  7931. args: ["anObject", "anObject2"],
  7932. source: "newValue: anObject value: anObject2\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject, anObject2)>",
  7933. messageSends: [],
  7934. referencedClasses: []
  7935. }),
  7936. smalltalk.BlockClosure);
  7937. smalltalk.addMethod(
  7938. smalltalk.method({
  7939. selector: "newValue:value:value:",
  7940. category: 'evaluating',
  7941. fn: function (anObject,anObject2,anObject3){
  7942. var self=this;
  7943. return smalltalk.withContext(function($ctx1) {
  7944. return new self(anObject, anObject2,anObject3);
  7945. return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.BlockClosure)})},
  7946. args: ["anObject", "anObject2", "anObject3"],
  7947. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject, anObject2,anObject3)>",
  7948. messageSends: [],
  7949. referencedClasses: []
  7950. }),
  7951. smalltalk.BlockClosure);
  7952. smalltalk.addMethod(
  7953. smalltalk.method({
  7954. selector: "numArgs",
  7955. category: 'accessing',
  7956. fn: function (){
  7957. var self=this;
  7958. return smalltalk.withContext(function($ctx1) {
  7959. return self.length;
  7960. return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.BlockClosure)})},
  7961. args: [],
  7962. source: "numArgs\x0a\x09<return self.length>",
  7963. messageSends: [],
  7964. referencedClasses: []
  7965. }),
  7966. smalltalk.BlockClosure);
  7967. smalltalk.addMethod(
  7968. smalltalk.method({
  7969. selector: "on:do:",
  7970. category: 'error handling',
  7971. fn: function (anErrorClass,aBlock){
  7972. var self=this;
  7973. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7974. return smalltalk.withContext(function($ctx1) {
  7975. var $2,$1;
  7976. $1=_st(self)._try_catch_(self,(function(error){
  7977. var smalltalkError;
  7978. return smalltalk.withContext(function($ctx2) {
  7979. smalltalkError=_st(_st($Smalltalk())._current())._asSmalltalkException_(error);
  7980. smalltalkError;
  7981. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  7982. if(smalltalk.assert($2)){
  7983. return _st(aBlock)._value_(smalltalkError);
  7984. } else {
  7985. return _st(smalltalkError)._signal();
  7986. };
  7987. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1)})}));
  7988. return $1;
  7989. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},smalltalk.BlockClosure)})},
  7990. args: ["anErrorClass", "aBlock"],
  7991. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^self try: self catch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk current asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError signal ] ]",
  7992. messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
  7993. referencedClasses: ["Smalltalk"]
  7994. }),
  7995. smalltalk.BlockClosure);
  7996. smalltalk.addMethod(
  7997. smalltalk.method({
  7998. selector: "timeToRun",
  7999. category: 'evaluating',
  8000. fn: function (){
  8001. var self=this;
  8002. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  8003. return smalltalk.withContext(function($ctx1) {
  8004. var $1;
  8005. $1=_st($Date())._millisecondsToRun_(self);
  8006. return $1;
  8007. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},smalltalk.BlockClosure)})},
  8008. args: [],
  8009. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  8010. messageSends: ["millisecondsToRun:"],
  8011. referencedClasses: ["Date"]
  8012. }),
  8013. smalltalk.BlockClosure);
  8014. smalltalk.addMethod(
  8015. smalltalk.method({
  8016. selector: "value",
  8017. category: 'evaluating',
  8018. fn: function (){
  8019. var self=this;
  8020. return smalltalk.withContext(function($ctx1) {
  8021. return self();;
  8022. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.BlockClosure)})},
  8023. args: [],
  8024. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  8025. messageSends: [],
  8026. referencedClasses: []
  8027. }),
  8028. smalltalk.BlockClosure);
  8029. smalltalk.addMethod(
  8030. smalltalk.method({
  8031. selector: "value:",
  8032. category: 'evaluating',
  8033. fn: function (anArg){
  8034. var self=this;
  8035. return smalltalk.withContext(function($ctx1) {
  8036. return self(anArg);;
  8037. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},smalltalk.BlockClosure)})},
  8038. args: ["anArg"],
  8039. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  8040. messageSends: [],
  8041. referencedClasses: []
  8042. }),
  8043. smalltalk.BlockClosure);
  8044. smalltalk.addMethod(
  8045. smalltalk.method({
  8046. selector: "value:value:",
  8047. category: 'evaluating',
  8048. fn: function (firstArg,secondArg){
  8049. var self=this;
  8050. return smalltalk.withContext(function($ctx1) {
  8051. return self(firstArg, secondArg);;
  8052. return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},smalltalk.BlockClosure)})},
  8053. args: ["firstArg", "secondArg"],
  8054. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  8055. messageSends: [],
  8056. referencedClasses: []
  8057. }),
  8058. smalltalk.BlockClosure);
  8059. smalltalk.addMethod(
  8060. smalltalk.method({
  8061. selector: "value:value:value:",
  8062. category: 'evaluating',
  8063. fn: function (firstArg,secondArg,thirdArg){
  8064. var self=this;
  8065. return smalltalk.withContext(function($ctx1) {
  8066. return self(firstArg, secondArg, thirdArg);;
  8067. return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},smalltalk.BlockClosure)})},
  8068. args: ["firstArg", "secondArg", "thirdArg"],
  8069. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  8070. messageSends: [],
  8071. referencedClasses: []
  8072. }),
  8073. smalltalk.BlockClosure);
  8074. smalltalk.addMethod(
  8075. smalltalk.method({
  8076. selector: "valueWithInterval:",
  8077. category: 'timeout/interval',
  8078. fn: function (aNumber){
  8079. var self=this;
  8080. return smalltalk.withContext(function($ctx1) {
  8081. var interval = setInterval(self, aNumber);
  8082. return smalltalk.Timeout._on_(interval);
  8083. ;
  8084. return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  8085. args: ["aNumber"],
  8086. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(interval);\x0a\x09>",
  8087. messageSends: [],
  8088. referencedClasses: []
  8089. }),
  8090. smalltalk.BlockClosure);
  8091. smalltalk.addMethod(
  8092. smalltalk.method({
  8093. selector: "valueWithPossibleArguments:",
  8094. category: 'evaluating',
  8095. fn: function (aCollection){
  8096. var self=this;
  8097. return smalltalk.withContext(function($ctx1) {
  8098. return self.apply(null, aCollection);;
  8099. return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.BlockClosure)})},
  8100. args: ["aCollection"],
  8101. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8102. messageSends: [],
  8103. referencedClasses: []
  8104. }),
  8105. smalltalk.BlockClosure);
  8106. smalltalk.addMethod(
  8107. smalltalk.method({
  8108. selector: "valueWithTimeout:",
  8109. category: 'timeout/interval',
  8110. fn: function (aNumber){
  8111. var self=this;
  8112. return smalltalk.withContext(function($ctx1) {
  8113. var timeout = setTimeout(self, aNumber);
  8114. return smalltalk.Timeout._on_(timeout);
  8115. ;
  8116. return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  8117. args: ["aNumber"],
  8118. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(timeout);\x0a\x09>",
  8119. messageSends: [],
  8120. referencedClasses: []
  8121. }),
  8122. smalltalk.BlockClosure);
  8123. smalltalk.addMethod(
  8124. smalltalk.method({
  8125. selector: "whileFalse",
  8126. category: 'controlling',
  8127. fn: function (){
  8128. var self=this;
  8129. return smalltalk.withContext(function($ctx1) {
  8130. _st(self)._whileFalse_((function(){
  8131. return smalltalk.withContext(function($ctx2) {
  8132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8133. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},smalltalk.BlockClosure)})},
  8134. args: [],
  8135. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  8136. messageSends: ["whileFalse:"],
  8137. referencedClasses: []
  8138. }),
  8139. smalltalk.BlockClosure);
  8140. smalltalk.addMethod(
  8141. smalltalk.method({
  8142. selector: "whileFalse:",
  8143. category: 'controlling',
  8144. fn: function (aBlock){
  8145. var self=this;
  8146. return smalltalk.withContext(function($ctx1) {
  8147. while(!self()) {aBlock()};
  8148. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  8149. args: ["aBlock"],
  8150. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
  8151. messageSends: [],
  8152. referencedClasses: []
  8153. }),
  8154. smalltalk.BlockClosure);
  8155. smalltalk.addMethod(
  8156. smalltalk.method({
  8157. selector: "whileTrue",
  8158. category: 'controlling',
  8159. fn: function (){
  8160. var self=this;
  8161. return smalltalk.withContext(function($ctx1) {
  8162. _st(self)._whileTrue_((function(){
  8163. return smalltalk.withContext(function($ctx2) {
  8164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8165. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},smalltalk.BlockClosure)})},
  8166. args: [],
  8167. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  8168. messageSends: ["whileTrue:"],
  8169. referencedClasses: []
  8170. }),
  8171. smalltalk.BlockClosure);
  8172. smalltalk.addMethod(
  8173. smalltalk.method({
  8174. selector: "whileTrue:",
  8175. category: 'controlling',
  8176. fn: function (aBlock){
  8177. var self=this;
  8178. return smalltalk.withContext(function($ctx1) {
  8179. while(self()) {aBlock()};
  8180. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  8181. args: ["aBlock"],
  8182. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
  8183. messageSends: [],
  8184. referencedClasses: []
  8185. }),
  8186. smalltalk.BlockClosure);
  8187. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  8188. smalltalk.CompiledMethod.comment="CompiledMethod hold the source and compiled code of a class method.\x0a\x0aYou can get a CompiledMethod using `Behavior>>methodAt:`\x0a\x0a\x09String methodAt: 'lines'\x0a\x0aand read the source code\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aSee referenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aor messages sent from this method:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends"
  8189. smalltalk.addMethod(
  8190. smalltalk.method({
  8191. selector: "arguments",
  8192. category: 'accessing',
  8193. fn: function (){
  8194. var self=this;
  8195. return smalltalk.withContext(function($ctx1) {
  8196. return self.args || [];
  8197. return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.CompiledMethod)})},
  8198. args: [],
  8199. source: "arguments\x0a\x09<return self.args || []>",
  8200. messageSends: [],
  8201. referencedClasses: []
  8202. }),
  8203. smalltalk.CompiledMethod);
  8204. smalltalk.addMethod(
  8205. smalltalk.method({
  8206. selector: "category",
  8207. category: 'accessing',
  8208. fn: function (){
  8209. var self=this;
  8210. return smalltalk.withContext(function($ctx1) {
  8211. var $2,$1;
  8212. $2=_st(self)._basicAt_("category");
  8213. if(($receiver = $2) == nil || $receiver == undefined){
  8214. $1=_st(self)._defaultCategory();
  8215. } else {
  8216. $1=$2;
  8217. };
  8218. return $1;
  8219. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.CompiledMethod)})},
  8220. args: [],
  8221. source: "category\x0a\x09^(self basicAt: 'category') ifNil: [ self defaultCategory ]",
  8222. messageSends: ["ifNil:", "defaultCategory", "basicAt:"],
  8223. referencedClasses: []
  8224. }),
  8225. smalltalk.CompiledMethod);
  8226. smalltalk.addMethod(
  8227. smalltalk.method({
  8228. selector: "category:",
  8229. category: 'accessing',
  8230. fn: function (aString){
  8231. var self=this;
  8232. var oldProtocol;
  8233. function $MethodMoved(){return smalltalk.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8234. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8235. return smalltalk.withContext(function($ctx1) {
  8236. var $1,$2,$3;
  8237. oldProtocol=_st(self)._protocol();
  8238. _st(self)._basicAt_put_("category",aString);
  8239. $1=_st($MethodMoved())._new();
  8240. _st($1)._method_(self);
  8241. _st($1)._oldProtocol_(oldProtocol);
  8242. $2=_st($1)._yourself();
  8243. _st(_st($SystemAnnouncer())._current())._announce_($2);
  8244. $3=_st(self)._methodClass();
  8245. if(($receiver = $3) == nil || $receiver == undefined){
  8246. $3;
  8247. } else {
  8248. _st(_st(_st(self)._methodClass())._organization())._addElement_(aString);
  8249. _st(_st(_st(_st(self)._methodClass())._methods())._select_((function(each){
  8250. return smalltalk.withContext(function($ctx2) {
  8251. return _st(_st(each)._protocol()).__eq(oldProtocol);
  8252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._ifEmpty_((function(){
  8253. return smalltalk.withContext(function($ctx2) {
  8254. return _st(_st(_st(self)._methodClass())._organization())._removeElement_(oldProtocol);
  8255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8256. };
  8257. return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldProtocol:oldProtocol},smalltalk.CompiledMethod)})},
  8258. args: ["aString"],
  8259. source: "category: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'category' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [\x0a\x09\x09self methodClass organization addElement: aString.\x0a\x09\x0a\x09\x09(self methodClass methods\x0a\x09\x09\x09select: [ :each | each protocol = oldProtocol ])\x0a\x09\x09\x09ifEmpty: [ self methodClass organization removeElement: oldProtocol ] ]",
  8260. messageSends: ["protocol", "basicAt:put:", "announce:", "method:", "new", "oldProtocol:", "yourself", "current", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
  8261. referencedClasses: ["MethodMoved", "SystemAnnouncer"]
  8262. }),
  8263. smalltalk.CompiledMethod);
  8264. smalltalk.addMethod(
  8265. smalltalk.method({
  8266. selector: "defaultCategory",
  8267. category: 'defaults',
  8268. fn: function (){
  8269. var self=this;
  8270. return smalltalk.withContext(function($ctx1) {
  8271. return "as yet unclassified";
  8272. }, function($ctx1) {$ctx1.fill(self,"defaultCategory",{},smalltalk.CompiledMethod)})},
  8273. args: [],
  8274. source: "defaultCategory\x0a\x09^ 'as yet unclassified'",
  8275. messageSends: [],
  8276. referencedClasses: []
  8277. }),
  8278. smalltalk.CompiledMethod);
  8279. smalltalk.addMethod(
  8280. smalltalk.method({
  8281. selector: "fn",
  8282. category: 'accessing',
  8283. fn: function (){
  8284. var self=this;
  8285. return smalltalk.withContext(function($ctx1) {
  8286. var $1;
  8287. $1=_st(self)._basicAt_("fn");
  8288. return $1;
  8289. }, function($ctx1) {$ctx1.fill(self,"fn",{},smalltalk.CompiledMethod)})},
  8290. args: [],
  8291. source: "fn\x0a\x09^self basicAt: 'fn'",
  8292. messageSends: ["basicAt:"],
  8293. referencedClasses: []
  8294. }),
  8295. smalltalk.CompiledMethod);
  8296. smalltalk.addMethod(
  8297. smalltalk.method({
  8298. selector: "fn:",
  8299. category: 'accessing',
  8300. fn: function (aBlock){
  8301. var self=this;
  8302. return smalltalk.withContext(function($ctx1) {
  8303. _st(self)._basicAt_put_("fn",aBlock);
  8304. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},smalltalk.CompiledMethod)})},
  8305. args: ["aBlock"],
  8306. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8307. messageSends: ["basicAt:put:"],
  8308. referencedClasses: []
  8309. }),
  8310. smalltalk.CompiledMethod);
  8311. smalltalk.addMethod(
  8312. smalltalk.method({
  8313. selector: "isCompiledMethod",
  8314. category: 'testing',
  8315. fn: function (){
  8316. var self=this;
  8317. return smalltalk.withContext(function($ctx1) {
  8318. return true;
  8319. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.CompiledMethod)})},
  8320. args: [],
  8321. source: "isCompiledMethod\x0a\x09^ true",
  8322. messageSends: [],
  8323. referencedClasses: []
  8324. }),
  8325. smalltalk.CompiledMethod);
  8326. smalltalk.addMethod(
  8327. smalltalk.method({
  8328. selector: "isOverridden",
  8329. category: 'testing',
  8330. fn: function (){
  8331. var self=this;
  8332. var selector;
  8333. return smalltalk.withContext(function($ctx1) {
  8334. var $1;
  8335. var $early={};
  8336. try {
  8337. selector=_st(self)._selector();
  8338. _st(_st(self)._methodClass())._allSubclassesDo_((function(each){
  8339. return smalltalk.withContext(function($ctx2) {
  8340. $1=_st(each)._includesSelector_(selector);
  8341. if(smalltalk.assert($1)){
  8342. throw $early=[true];
  8343. };
  8344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8345. return false;
  8346. }
  8347. catch(e) {if(e===$early)return e[0]; throw e}
  8348. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},smalltalk.CompiledMethod)})},
  8349. args: [],
  8350. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  8351. messageSends: ["selector", "allSubclassesDo:", "ifTrue:", "includesSelector:", "methodClass"],
  8352. referencedClasses: []
  8353. }),
  8354. smalltalk.CompiledMethod);
  8355. smalltalk.addMethod(
  8356. smalltalk.method({
  8357. selector: "isOverride",
  8358. category: 'testing',
  8359. fn: function (){
  8360. var self=this;
  8361. var superclass;
  8362. return smalltalk.withContext(function($ctx1) {
  8363. var $1,$2;
  8364. superclass=_st(_st(self)._methodClass())._superclass();
  8365. $1=superclass;
  8366. if(($receiver = $1) == nil || $receiver == undefined){
  8367. return false;
  8368. } else {
  8369. $1;
  8370. };
  8371. $2=_st(_st(_st(_st(self)._methodClass())._superclass())._lookupSelector_(_st(self)._selector()))._notNil();
  8372. return $2;
  8373. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},smalltalk.CompiledMethod)})},
  8374. args: [],
  8375. source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
  8376. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"],
  8377. referencedClasses: []
  8378. }),
  8379. smalltalk.CompiledMethod);
  8380. smalltalk.addMethod(
  8381. smalltalk.method({
  8382. selector: "messageSends",
  8383. category: 'accessing',
  8384. fn: function (){
  8385. var self=this;
  8386. return smalltalk.withContext(function($ctx1) {
  8387. var $1;
  8388. $1=_st(self)._basicAt_("messageSends");
  8389. return $1;
  8390. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.CompiledMethod)})},
  8391. args: [],
  8392. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  8393. messageSends: ["basicAt:"],
  8394. referencedClasses: []
  8395. }),
  8396. smalltalk.CompiledMethod);
  8397. smalltalk.addMethod(
  8398. smalltalk.method({
  8399. selector: "methodClass",
  8400. category: 'accessing',
  8401. fn: function (){
  8402. var self=this;
  8403. return smalltalk.withContext(function($ctx1) {
  8404. var $1;
  8405. $1=_st(self)._basicAt_("methodClass");
  8406. return $1;
  8407. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},smalltalk.CompiledMethod)})},
  8408. args: [],
  8409. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  8410. messageSends: ["basicAt:"],
  8411. referencedClasses: []
  8412. }),
  8413. smalltalk.CompiledMethod);
  8414. smalltalk.addMethod(
  8415. smalltalk.method({
  8416. selector: "protocol",
  8417. category: 'accessing',
  8418. fn: function (){
  8419. var self=this;
  8420. return smalltalk.withContext(function($ctx1) {
  8421. var $1;
  8422. $1=_st(self)._category();
  8423. return $1;
  8424. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.CompiledMethod)})},
  8425. args: [],
  8426. source: "protocol\x0a\x09^ self category",
  8427. messageSends: ["category"],
  8428. referencedClasses: []
  8429. }),
  8430. smalltalk.CompiledMethod);
  8431. smalltalk.addMethod(
  8432. smalltalk.method({
  8433. selector: "protocol:",
  8434. category: 'accessing',
  8435. fn: function (aString){
  8436. var self=this;
  8437. return smalltalk.withContext(function($ctx1) {
  8438. _st(self)._category_(aString);
  8439. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.CompiledMethod)})},
  8440. args: ["aString"],
  8441. source: "protocol: aString\x0a\x09self category: aString",
  8442. messageSends: ["category:"],
  8443. referencedClasses: []
  8444. }),
  8445. smalltalk.CompiledMethod);
  8446. smalltalk.addMethod(
  8447. smalltalk.method({
  8448. selector: "referencedClasses",
  8449. category: 'accessing',
  8450. fn: function (){
  8451. var self=this;
  8452. return smalltalk.withContext(function($ctx1) {
  8453. var $1;
  8454. $1=_st(self)._basicAt_("referencedClasses");
  8455. return $1;
  8456. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},smalltalk.CompiledMethod)})},
  8457. args: [],
  8458. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  8459. messageSends: ["basicAt:"],
  8460. referencedClasses: []
  8461. }),
  8462. smalltalk.CompiledMethod);
  8463. smalltalk.addMethod(
  8464. smalltalk.method({
  8465. selector: "selector",
  8466. category: 'accessing',
  8467. fn: function (){
  8468. var self=this;
  8469. return smalltalk.withContext(function($ctx1) {
  8470. var $1;
  8471. $1=_st(self)._basicAt_("selector");
  8472. return $1;
  8473. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.CompiledMethod)})},
  8474. args: [],
  8475. source: "selector\x0a\x09^self basicAt: 'selector'",
  8476. messageSends: ["basicAt:"],
  8477. referencedClasses: []
  8478. }),
  8479. smalltalk.CompiledMethod);
  8480. smalltalk.addMethod(
  8481. smalltalk.method({
  8482. selector: "selector:",
  8483. category: 'accessing',
  8484. fn: function (aString){
  8485. var self=this;
  8486. return smalltalk.withContext(function($ctx1) {
  8487. _st(self)._basicAt_put_("selector",aString);
  8488. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.CompiledMethod)})},
  8489. args: ["aString"],
  8490. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8491. messageSends: ["basicAt:put:"],
  8492. referencedClasses: []
  8493. }),
  8494. smalltalk.CompiledMethod);
  8495. smalltalk.addMethod(
  8496. smalltalk.method({
  8497. selector: "source",
  8498. category: 'accessing',
  8499. fn: function (){
  8500. var self=this;
  8501. return smalltalk.withContext(function($ctx1) {
  8502. var $2,$1;
  8503. $2=_st(self)._basicAt_("source");
  8504. if(($receiver = $2) == nil || $receiver == undefined){
  8505. $1="";
  8506. } else {
  8507. $1=$2;
  8508. };
  8509. return $1;
  8510. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.CompiledMethod)})},
  8511. args: [],
  8512. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  8513. messageSends: ["ifNil:", "basicAt:"],
  8514. referencedClasses: []
  8515. }),
  8516. smalltalk.CompiledMethod);
  8517. smalltalk.addMethod(
  8518. smalltalk.method({
  8519. selector: "source:",
  8520. category: 'accessing',
  8521. fn: function (aString){
  8522. var self=this;
  8523. return smalltalk.withContext(function($ctx1) {
  8524. _st(self)._basicAt_put_("source",aString);
  8525. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.CompiledMethod)})},
  8526. args: ["aString"],
  8527. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8528. messageSends: ["basicAt:put:"],
  8529. referencedClasses: []
  8530. }),
  8531. smalltalk.CompiledMethod);
  8532. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8533. smalltalk.ForkPool.comment="A ForkPool is responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0aThe default instance is accessed with `ForkPool default`"
  8534. smalltalk.addMethod(
  8535. smalltalk.method({
  8536. selector: "addWorker",
  8537. category: 'private',
  8538. fn: function (){
  8539. var self=this;
  8540. return smalltalk.withContext(function($ctx1) {
  8541. _st(self["@worker"])._valueWithTimeout_((0));
  8542. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  8543. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},smalltalk.ForkPool)})},
  8544. args: [],
  8545. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8546. messageSends: ["valueWithTimeout:", "+"],
  8547. referencedClasses: []
  8548. }),
  8549. smalltalk.ForkPool);
  8550. smalltalk.addMethod(
  8551. smalltalk.method({
  8552. selector: "defaultMaxPoolSize",
  8553. category: 'defaults',
  8554. fn: function (){
  8555. var self=this;
  8556. return smalltalk.withContext(function($ctx1) {
  8557. var $1;
  8558. $1=_st(_st(self)._class())._defaultMaxPoolSize();
  8559. return $1;
  8560. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool)})},
  8561. args: [],
  8562. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8563. messageSends: ["defaultMaxPoolSize", "class"],
  8564. referencedClasses: []
  8565. }),
  8566. smalltalk.ForkPool);
  8567. smalltalk.addMethod(
  8568. smalltalk.method({
  8569. selector: "fork:",
  8570. category: 'actions',
  8571. fn: function (aBlock){
  8572. var self=this;
  8573. return smalltalk.withContext(function($ctx1) {
  8574. var $1;
  8575. $1=_st(self["@poolSize"]).__lt(_st(self)._maxPoolSize());
  8576. if(smalltalk.assert($1)){
  8577. _st(self)._addWorker();
  8578. };
  8579. _st(self["@queue"])._nextPut_(aBlock);
  8580. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},smalltalk.ForkPool)})},
  8581. args: ["aBlock"],
  8582. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8583. messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "nextPut:"],
  8584. referencedClasses: []
  8585. }),
  8586. smalltalk.ForkPool);
  8587. smalltalk.addMethod(
  8588. smalltalk.method({
  8589. selector: "initialize",
  8590. category: 'initialization',
  8591. fn: function (){
  8592. var self=this;
  8593. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8594. return smalltalk.withContext(function($ctx1) {
  8595. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  8596. self["@poolSize"]=(0);
  8597. self["@queue"]=_st($Queue())._new();
  8598. self["@worker"]=_st(self)._makeWorker();
  8599. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ForkPool)})},
  8600. args: [],
  8601. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8602. messageSends: ["initialize", "new", "makeWorker"],
  8603. referencedClasses: ["Queue"]
  8604. }),
  8605. smalltalk.ForkPool);
  8606. smalltalk.addMethod(
  8607. smalltalk.method({
  8608. selector: "makeWorker",
  8609. category: 'initialization',
  8610. fn: function (){
  8611. var self=this;
  8612. var sentinel;
  8613. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  8614. return smalltalk.withContext(function($ctx1) {
  8615. var $2,$1;
  8616. sentinel=_st($Object())._new();
  8617. $1=(function(){
  8618. var block;
  8619. return smalltalk.withContext(function($ctx2) {
  8620. self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  8621. self["@poolSize"];
  8622. block=_st(self["@queue"])._nextIfAbsent_((function(){
  8623. return smalltalk.withContext(function($ctx3) {
  8624. return sentinel;
  8625. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  8626. block;
  8627. $2=_st(block).__eq_eq(sentinel);
  8628. if(! smalltalk.assert($2)){
  8629. return _st((function(){
  8630. return smalltalk.withContext(function($ctx3) {
  8631. return _st(block)._value();
  8632. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  8633. return smalltalk.withContext(function($ctx3) {
  8634. return _st(self)._addWorker();
  8635. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  8636. };
  8637. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})});
  8638. return $1;
  8639. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},smalltalk.ForkPool)})},
  8640. args: [],
  8641. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^[ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ]]]",
  8642. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
  8643. referencedClasses: ["Object"]
  8644. }),
  8645. smalltalk.ForkPool);
  8646. smalltalk.addMethod(
  8647. smalltalk.method({
  8648. selector: "maxPoolSize",
  8649. category: 'accessing',
  8650. fn: function (){
  8651. var self=this;
  8652. return smalltalk.withContext(function($ctx1) {
  8653. var $2,$1;
  8654. $2=self["@maxPoolSize"];
  8655. if(($receiver = $2) == nil || $receiver == undefined){
  8656. $1=_st(self)._defaultMaxPoolSize();
  8657. } else {
  8658. $1=$2;
  8659. };
  8660. return $1;
  8661. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},smalltalk.ForkPool)})},
  8662. args: [],
  8663. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8664. messageSends: ["ifNil:", "defaultMaxPoolSize"],
  8665. referencedClasses: []
  8666. }),
  8667. smalltalk.ForkPool);
  8668. smalltalk.addMethod(
  8669. smalltalk.method({
  8670. selector: "maxPoolSize:",
  8671. category: 'accessing',
  8672. fn: function (anInteger){
  8673. var self=this;
  8674. return smalltalk.withContext(function($ctx1) {
  8675. self["@maxPoolSize"]=anInteger;
  8676. return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger},smalltalk.ForkPool)})},
  8677. args: ["anInteger"],
  8678. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8679. messageSends: [],
  8680. referencedClasses: []
  8681. }),
  8682. smalltalk.ForkPool);
  8683. smalltalk.ForkPool.klass.iVarNames = ['default'];
  8684. smalltalk.addMethod(
  8685. smalltalk.method({
  8686. selector: "default",
  8687. category: 'accessing',
  8688. fn: function (){
  8689. var self=this;
  8690. return smalltalk.withContext(function($ctx1) {
  8691. var $2,$1;
  8692. $2=self["@default"];
  8693. if(($receiver = $2) == nil || $receiver == undefined){
  8694. self["@default"]=_st(self)._new();
  8695. $1=self["@default"];
  8696. } else {
  8697. $1=$2;
  8698. };
  8699. return $1;
  8700. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ForkPool.klass)})},
  8701. args: [],
  8702. source: "default\x0a\x09^default ifNil: [ default := self new ]",
  8703. messageSends: ["ifNil:", "new"],
  8704. referencedClasses: []
  8705. }),
  8706. smalltalk.ForkPool.klass);
  8707. smalltalk.addMethod(
  8708. smalltalk.method({
  8709. selector: "defaultMaxPoolSize",
  8710. category: 'accessing',
  8711. fn: function (){
  8712. var self=this;
  8713. return smalltalk.withContext(function($ctx1) {
  8714. var $1;
  8715. $1=(100);
  8716. return $1;
  8717. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool.klass)})},
  8718. args: [],
  8719. source: "defaultMaxPoolSize\x0a\x09^100",
  8720. messageSends: [],
  8721. referencedClasses: []
  8722. }),
  8723. smalltalk.ForkPool.klass);
  8724. smalltalk.addMethod(
  8725. smalltalk.method({
  8726. selector: "resetDefault",
  8727. category: 'accessing',
  8728. fn: function (){
  8729. var self=this;
  8730. return smalltalk.withContext(function($ctx1) {
  8731. self["@default"]=nil;
  8732. return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{},smalltalk.ForkPool.klass)})},
  8733. args: [],
  8734. source: "resetDefault\x0a\x09default := nil",
  8735. messageSends: [],
  8736. referencedClasses: []
  8737. }),
  8738. smalltalk.ForkPool.klass);
  8739. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  8740. smalltalk.Message.comment="Generally, the system does not use instances of Message for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object>>doesNotUnderstand:`"
  8741. smalltalk.addMethod(
  8742. smalltalk.method({
  8743. selector: "arguments",
  8744. category: 'accessing',
  8745. fn: function (){
  8746. var self=this;
  8747. return smalltalk.withContext(function($ctx1) {
  8748. var $1;
  8749. $1=self["@arguments"];
  8750. return $1;
  8751. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.Message)})},
  8752. args: [],
  8753. source: "arguments\x0a\x09^arguments",
  8754. messageSends: [],
  8755. referencedClasses: []
  8756. }),
  8757. smalltalk.Message);
  8758. smalltalk.addMethod(
  8759. smalltalk.method({
  8760. selector: "arguments:",
  8761. category: 'accessing',
  8762. fn: function (anArray){
  8763. var self=this;
  8764. return smalltalk.withContext(function($ctx1) {
  8765. self["@arguments"]=anArray;
  8766. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray},smalltalk.Message)})},
  8767. args: ["anArray"],
  8768. source: "arguments: anArray\x0a\x09arguments := anArray",
  8769. messageSends: [],
  8770. referencedClasses: []
  8771. }),
  8772. smalltalk.Message);
  8773. smalltalk.addMethod(
  8774. smalltalk.method({
  8775. selector: "printOn:",
  8776. category: 'printing',
  8777. fn: function (aStream){
  8778. var self=this;
  8779. return smalltalk.withContext(function($ctx1) {
  8780. var $1,$2;
  8781. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  8782. $1=aStream;
  8783. _st($1)._nextPutAll_("(");
  8784. _st($1)._nextPutAll_(_st(self)._selector());
  8785. $2=_st($1)._nextPutAll_(")");
  8786. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Message)})},
  8787. args: ["aStream"],
  8788. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8789. messageSends: ["printOn:", "nextPutAll:", "selector"],
  8790. referencedClasses: []
  8791. }),
  8792. smalltalk.Message);
  8793. smalltalk.addMethod(
  8794. smalltalk.method({
  8795. selector: "selector",
  8796. category: 'accessing',
  8797. fn: function (){
  8798. var self=this;
  8799. return smalltalk.withContext(function($ctx1) {
  8800. var $1;
  8801. $1=self["@selector"];
  8802. return $1;
  8803. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.Message)})},
  8804. args: [],
  8805. source: "selector\x0a\x09^selector",
  8806. messageSends: [],
  8807. referencedClasses: []
  8808. }),
  8809. smalltalk.Message);
  8810. smalltalk.addMethod(
  8811. smalltalk.method({
  8812. selector: "selector:",
  8813. category: 'accessing',
  8814. fn: function (aString){
  8815. var self=this;
  8816. return smalltalk.withContext(function($ctx1) {
  8817. self["@selector"]=aString;
  8818. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.Message)})},
  8819. args: ["aString"],
  8820. source: "selector: aString\x0a\x09selector := aString",
  8821. messageSends: [],
  8822. referencedClasses: []
  8823. }),
  8824. smalltalk.Message);
  8825. smalltalk.addMethod(
  8826. smalltalk.method({
  8827. selector: "sendTo:",
  8828. category: 'actions',
  8829. fn: function (anObject){
  8830. var self=this;
  8831. return smalltalk.withContext(function($ctx1) {
  8832. var $1;
  8833. $1=_st(anObject)._perform_withArguments_(_st(self)._selector(),_st(self)._arguments());
  8834. return $1;
  8835. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},smalltalk.Message)})},
  8836. args: ["anObject"],
  8837. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  8838. messageSends: ["perform:withArguments:", "selector", "arguments"],
  8839. referencedClasses: []
  8840. }),
  8841. smalltalk.Message);
  8842. smalltalk.addMethod(
  8843. smalltalk.method({
  8844. selector: "selector:arguments:",
  8845. category: 'instance creation',
  8846. fn: function (aString,anArray){
  8847. var self=this;
  8848. return smalltalk.withContext(function($ctx1) {
  8849. var $2,$3,$1;
  8850. $2=_st(self)._new();
  8851. _st($2)._selector_(aString);
  8852. _st($2)._arguments_(anArray);
  8853. $3=_st($2)._yourself();
  8854. $1=$3;
  8855. return $1;
  8856. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},smalltalk.Message.klass)})},
  8857. args: ["aString", "anArray"],
  8858. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  8859. messageSends: ["selector:", "new", "arguments:", "yourself"],
  8860. referencedClasses: []
  8861. }),
  8862. smalltalk.Message.klass);
  8863. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  8864. smalltalk.MethodContext.comment="MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.\x0a\x0aMethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js"
  8865. smalltalk.addMethod(
  8866. smalltalk.method({
  8867. selector: "asString",
  8868. category: 'converting',
  8869. fn: function (){
  8870. var self=this;
  8871. return smalltalk.withContext(function($ctx1) {
  8872. var $2,$1;
  8873. $2=_st(self)._isBlockContext();
  8874. if(smalltalk.assert($2)){
  8875. $1=_st(_st("a block (in ").__comma(_st(_st(_st(_st(self)._methodContext())._receiver())._class())._printString())).__comma(")");
  8876. } else {
  8877. $1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector());
  8878. };
  8879. return $1;
  8880. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.MethodContext)})},
  8881. args: [],
  8882. source: "asString\x0a\x09^self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext receiver class printString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class printString, ' >> ', self selector ]",
  8883. messageSends: ["ifTrue:ifFalse:", ",", "printString", "class", "receiver", "methodContext", "selector", "isBlockContext"],
  8884. referencedClasses: []
  8885. }),
  8886. smalltalk.MethodContext);
  8887. smalltalk.addMethod(
  8888. smalltalk.method({
  8889. selector: "home",
  8890. category: 'accessing',
  8891. fn: function (){
  8892. var self=this;
  8893. return smalltalk.withContext(function($ctx1) {
  8894. return self.methodContext || self.homeContext;
  8895. return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})},
  8896. args: [],
  8897. source: "home\x0a\x09<return self.methodContext || self.homeContext>",
  8898. messageSends: [],
  8899. referencedClasses: []
  8900. }),
  8901. smalltalk.MethodContext);
  8902. smalltalk.addMethod(
  8903. smalltalk.method({
  8904. selector: "isBlockContext",
  8905. category: 'testing',
  8906. fn: function (){
  8907. var self=this;
  8908. return smalltalk.withContext(function($ctx1) {
  8909. var $1;
  8910. $1=_st(_st(self)._selector())._isNil();
  8911. return $1;
  8912. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.MethodContext)})},
  8913. args: [],
  8914. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  8915. messageSends: ["isNil", "selector"],
  8916. referencedClasses: []
  8917. }),
  8918. smalltalk.MethodContext);
  8919. smalltalk.addMethod(
  8920. smalltalk.method({
  8921. selector: "locals",
  8922. category: 'accessing',
  8923. fn: function (){
  8924. var self=this;
  8925. return smalltalk.withContext(function($ctx1) {
  8926. return self.locals;
  8927. return self}, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.MethodContext)})},
  8928. args: [],
  8929. source: "locals\x0a\x09<return self.locals>",
  8930. messageSends: [],
  8931. referencedClasses: []
  8932. }),
  8933. smalltalk.MethodContext);
  8934. smalltalk.addMethod(
  8935. smalltalk.method({
  8936. selector: "method",
  8937. category: 'accessing',
  8938. fn: function (){
  8939. var self=this;
  8940. return smalltalk.withContext(function($ctx1) {
  8941. var $1;
  8942. $1=_st(_st(_st(_st(self)._methodContext())._receiver())._class())._lookupSelector_(_st(_st(self)._methodContext())._selector());
  8943. return $1;
  8944. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodContext)})},
  8945. args: [],
  8946. source: "method\x0a\x09^self methodContext receiver class lookupSelector: self methodContext selector",
  8947. messageSends: ["lookupSelector:", "selector", "methodContext", "class", "receiver"],
  8948. referencedClasses: []
  8949. }),
  8950. smalltalk.MethodContext);
  8951. smalltalk.addMethod(
  8952. smalltalk.method({
  8953. selector: "methodContext",
  8954. category: 'accessing',
  8955. fn: function (){
  8956. var self=this;
  8957. return smalltalk.withContext(function($ctx1) {
  8958. var $1,$2,$3;
  8959. $1=_st(self)._isBlockContext();
  8960. if(! smalltalk.assert($1)){
  8961. $2=self;
  8962. return $2;
  8963. };
  8964. $3=_st(self)._home();
  8965. return $3;
  8966. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})},
  8967. args: [],
  8968. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self home",
  8969. messageSends: ["ifFalse:", "isBlockContext", "home"],
  8970. referencedClasses: []
  8971. }),
  8972. smalltalk.MethodContext);
  8973. smalltalk.addMethod(
  8974. smalltalk.method({
  8975. selector: "outerContext",
  8976. category: 'accessing',
  8977. fn: function (){
  8978. var self=this;
  8979. return smalltalk.withContext(function($ctx1) {
  8980. return self.homeContext;
  8981. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})},
  8982. args: [],
  8983. source: "outerContext\x0a\x09<return self.homeContext>",
  8984. messageSends: [],
  8985. referencedClasses: []
  8986. }),
  8987. smalltalk.MethodContext);
  8988. smalltalk.addMethod(
  8989. smalltalk.method({
  8990. selector: "pc",
  8991. category: 'accessing',
  8992. fn: function (){
  8993. var self=this;
  8994. return smalltalk.withContext(function($ctx1) {
  8995. return self.pc;
  8996. return self}, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.MethodContext)})},
  8997. args: [],
  8998. source: "pc\x0a\x09<return self.pc>",
  8999. messageSends: [],
  9000. referencedClasses: []
  9001. }),
  9002. smalltalk.MethodContext);
  9003. smalltalk.addMethod(
  9004. smalltalk.method({
  9005. selector: "printOn:",
  9006. category: 'printing',
  9007. fn: function (aStream){
  9008. var self=this;
  9009. return smalltalk.withContext(function($ctx1) {
  9010. var $1,$2;
  9011. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  9012. $1=aStream;
  9013. _st($1)._nextPutAll_("(");
  9014. _st($1)._nextPutAll_(_st(self)._asString());
  9015. $2=_st($1)._nextPutAll_(")");
  9016. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MethodContext)})},
  9017. args: ["aStream"],
  9018. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9019. messageSends: ["printOn:", "nextPutAll:", "asString"],
  9020. referencedClasses: []
  9021. }),
  9022. smalltalk.MethodContext);
  9023. smalltalk.addMethod(
  9024. smalltalk.method({
  9025. selector: "receiver",
  9026. category: 'accessing',
  9027. fn: function (){
  9028. var self=this;
  9029. return smalltalk.withContext(function($ctx1) {
  9030. return self.receiver;
  9031. return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MethodContext)})},
  9032. args: [],
  9033. source: "receiver\x0a\x09<return self.receiver>",
  9034. messageSends: [],
  9035. referencedClasses: []
  9036. }),
  9037. smalltalk.MethodContext);
  9038. smalltalk.addMethod(
  9039. smalltalk.method({
  9040. selector: "selector",
  9041. category: 'accessing',
  9042. fn: function (){
  9043. var self=this;
  9044. return smalltalk.withContext(function($ctx1) {
  9045. if(self.selector) {
  9046. return smalltalk.convertSelector(self.selector);
  9047. } else {
  9048. return nil;
  9049. }
  9050. ;
  9051. return self}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodContext)})},
  9052. args: [],
  9053. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.convertSelector(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  9054. messageSends: [],
  9055. referencedClasses: []
  9056. }),
  9057. smalltalk.MethodContext);
  9058. smalltalk.addMethod(
  9059. smalltalk.method({
  9060. selector: "temps",
  9061. category: 'accessing',
  9062. fn: function (){
  9063. var self=this;
  9064. return smalltalk.withContext(function($ctx1) {
  9065. var $1;
  9066. _st(self)._deprecatedAPI();
  9067. $1=_st(self)._locals();
  9068. return $1;
  9069. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.MethodContext)})},
  9070. args: [],
  9071. source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
  9072. messageSends: ["deprecatedAPI", "locals"],
  9073. referencedClasses: []
  9074. }),
  9075. smalltalk.MethodContext);
  9076. smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
  9077. smalltalk.NativeFunction.comment="NativeFunction is a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0aSee the class-side `instance creation` methods.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0aUsage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]"
  9078. smalltalk.addMethod(
  9079. smalltalk.method({
  9080. selector: "constructor:",
  9081. category: 'instance creation',
  9082. fn: function (aString){
  9083. var self=this;
  9084. return smalltalk.withContext(function($ctx1) {
  9085. var native=eval(aString);
  9086. return new native();
  9087. ;
  9088. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},smalltalk.NativeFunction.klass)})},
  9089. args: ["aString"],
  9090. source: "constructor: aString\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native();\x0a\x09>",
  9091. messageSends: [],
  9092. referencedClasses: []
  9093. }),
  9094. smalltalk.NativeFunction.klass);
  9095. smalltalk.addMethod(
  9096. smalltalk.method({
  9097. selector: "constructor:value:",
  9098. category: 'instance creation',
  9099. fn: function (aString,anObject){
  9100. var self=this;
  9101. return smalltalk.withContext(function($ctx1) {
  9102. var native=eval(aString);
  9103. return new native(anObject);
  9104. ;
  9105. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},smalltalk.NativeFunction.klass)})},
  9106. args: ["aString", "anObject"],
  9107. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject);\x0a\x09>",
  9108. messageSends: [],
  9109. referencedClasses: []
  9110. }),
  9111. smalltalk.NativeFunction.klass);
  9112. smalltalk.addMethod(
  9113. smalltalk.method({
  9114. selector: "constructor:value:value:",
  9115. category: 'instance creation',
  9116. fn: function (aString,anObject,anObject2){
  9117. var self=this;
  9118. return smalltalk.withContext(function($ctx1) {
  9119. var native=eval(aString);
  9120. return new native(anObject,anObject2);
  9121. ;
  9122. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},smalltalk.NativeFunction.klass)})},
  9123. args: ["aString", "anObject", "anObject2"],
  9124. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2);\x0a\x09>",
  9125. messageSends: [],
  9126. referencedClasses: []
  9127. }),
  9128. smalltalk.NativeFunction.klass);
  9129. smalltalk.addMethod(
  9130. smalltalk.method({
  9131. selector: "constructor:value:value:value:",
  9132. category: 'instance creation',
  9133. fn: function (aString,anObject,anObject2,anObject3){
  9134. var self=this;
  9135. return smalltalk.withContext(function($ctx1) {
  9136. var native=eval(aString);
  9137. return new native(anObject,anObject2, anObject3);
  9138. ;
  9139. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.NativeFunction.klass)})},
  9140. args: ["aString", "anObject", "anObject2", "anObject3"],
  9141. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2, anObject3);\x0a\x09>",
  9142. messageSends: [],
  9143. referencedClasses: []
  9144. }),
  9145. smalltalk.NativeFunction.klass);
  9146. smalltalk.addMethod(
  9147. smalltalk.method({
  9148. selector: "exists:",
  9149. category: 'testing',
  9150. fn: function (aString){
  9151. var self=this;
  9152. return smalltalk.withContext(function($ctx1) {
  9153. if(aString in window) {
  9154. return true
  9155. } else {
  9156. return false
  9157. }
  9158. ;
  9159. return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},smalltalk.NativeFunction.klass)})},
  9160. args: ["aString"],
  9161. source: "exists: aString\x0a\x09<\x0a\x09\x09if(aString in window) {\x0a\x09\x09\x09return true\x0a\x09\x09} else {\x0a\x09\x09\x09return false\x0a\x09\x09}\x0a\x09>",
  9162. messageSends: [],
  9163. referencedClasses: []
  9164. }),
  9165. smalltalk.NativeFunction.klass);
  9166. smalltalk.addPackage('Kernel-Collections');
  9167. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  9168. smalltalk.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`"
  9169. smalltalk.addMethod(
  9170. smalltalk.method({
  9171. selector: "=",
  9172. category: 'comparing',
  9173. fn: function (anAssociation){
  9174. var self=this;
  9175. return smalltalk.withContext(function($ctx1) {
  9176. var $1;
  9177. $1=_st(_st(_st(self)._class()).__eq(_st(anAssociation)._class()))._and_((function(){
  9178. return smalltalk.withContext(function($ctx2) {
  9179. return _st(_st(_st(self)._key()).__eq(_st(anAssociation)._key()))._and_((function(){
  9180. return smalltalk.withContext(function($ctx3) {
  9181. return _st(_st(self)._value()).__eq(_st(anAssociation)._value());
  9182. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  9183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  9184. return $1;
  9185. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},smalltalk.Association)})},
  9186. args: ["anAssociation"],
  9187. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  9188. messageSends: ["and:", "=", "value", "key", "class"],
  9189. referencedClasses: []
  9190. }),
  9191. smalltalk.Association);
  9192. smalltalk.addMethod(
  9193. smalltalk.method({
  9194. selector: "key",
  9195. category: 'accessing',
  9196. fn: function (){
  9197. var self=this;
  9198. return smalltalk.withContext(function($ctx1) {
  9199. var $1;
  9200. $1=self["@key"];
  9201. return $1;
  9202. }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.Association)})},
  9203. args: [],
  9204. source: "key\x0a\x09^key",
  9205. messageSends: [],
  9206. referencedClasses: []
  9207. }),
  9208. smalltalk.Association);
  9209. smalltalk.addMethod(
  9210. smalltalk.method({
  9211. selector: "key:",
  9212. category: 'accessing',
  9213. fn: function (aKey){
  9214. var self=this;
  9215. return smalltalk.withContext(function($ctx1) {
  9216. self["@key"]=aKey;
  9217. return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey},smalltalk.Association)})},
  9218. args: ["aKey"],
  9219. source: "key: aKey\x0a\x09key := aKey",
  9220. messageSends: [],
  9221. referencedClasses: []
  9222. }),
  9223. smalltalk.Association);
  9224. smalltalk.addMethod(
  9225. smalltalk.method({
  9226. selector: "printOn:",
  9227. category: 'printing',
  9228. fn: function (aStream){
  9229. var self=this;
  9230. return smalltalk.withContext(function($ctx1) {
  9231. _st(_st(self)._key())._printOn_(aStream);
  9232. _st(aStream)._nextPutAll_(" -> ");
  9233. _st(_st(self)._value())._printOn_(aStream);
  9234. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Association)})},
  9235. args: ["aStream"],
  9236. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  9237. messageSends: ["printOn:", "key", "nextPutAll:", "value"],
  9238. referencedClasses: []
  9239. }),
  9240. smalltalk.Association);
  9241. smalltalk.addMethod(
  9242. smalltalk.method({
  9243. selector: "value",
  9244. category: 'accessing',
  9245. fn: function (){
  9246. var self=this;
  9247. return smalltalk.withContext(function($ctx1) {
  9248. var $1;
  9249. $1=self["@value"];
  9250. return $1;
  9251. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Association)})},
  9252. args: [],
  9253. source: "value\x0a\x09^value",
  9254. messageSends: [],
  9255. referencedClasses: []
  9256. }),
  9257. smalltalk.Association);
  9258. smalltalk.addMethod(
  9259. smalltalk.method({
  9260. selector: "value:",
  9261. category: 'accessing',
  9262. fn: function (aValue){
  9263. var self=this;
  9264. return smalltalk.withContext(function($ctx1) {
  9265. self["@value"]=aValue;
  9266. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue},smalltalk.Association)})},
  9267. args: ["aValue"],
  9268. source: "value: aValue\x0a\x09value := aValue",
  9269. messageSends: [],
  9270. referencedClasses: []
  9271. }),
  9272. smalltalk.Association);
  9273. smalltalk.addMethod(
  9274. smalltalk.method({
  9275. selector: "key:value:",
  9276. category: 'instance creation',
  9277. fn: function (aKey,aValue){
  9278. var self=this;
  9279. return smalltalk.withContext(function($ctx1) {
  9280. var $2,$3,$1;
  9281. $2=_st(self)._new();
  9282. _st($2)._key_(aKey);
  9283. _st($2)._value_(aValue);
  9284. $3=_st($2)._yourself();
  9285. $1=$3;
  9286. return $1;
  9287. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},smalltalk.Association.klass)})},
  9288. args: ["aKey", "aValue"],
  9289. source: "key: aKey value: aValue\x0a\x09\x09^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  9290. messageSends: ["key:", "new", "value:", "yourself"],
  9291. referencedClasses: []
  9292. }),
  9293. smalltalk.Association.klass);
  9294. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  9295. smalltalk.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collectiohn hierarchy such as enumerating and converting methods."
  9296. smalltalk.addMethod(
  9297. smalltalk.method({
  9298. selector: ",",
  9299. category: 'copying',
  9300. fn: function (aCollection){
  9301. var self=this;
  9302. return smalltalk.withContext(function($ctx1) {
  9303. var $2,$3,$1;
  9304. $2=_st(self)._copy();
  9305. _st($2)._addAll_(aCollection);
  9306. $3=_st($2)._yourself();
  9307. $1=$3;
  9308. return $1;
  9309. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.Collection)})},
  9310. args: ["aCollection"],
  9311. source: ", aCollection\x0a\x09^self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  9312. messageSends: ["addAll:", "copy", "yourself"],
  9313. referencedClasses: []
  9314. }),
  9315. smalltalk.Collection);
  9316. smalltalk.addMethod(
  9317. smalltalk.method({
  9318. selector: "add:",
  9319. category: 'adding/removing',
  9320. fn: function (anObject){
  9321. var self=this;
  9322. return smalltalk.withContext(function($ctx1) {
  9323. _st(self)._subclassResponsibility();
  9324. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Collection)})},
  9325. args: ["anObject"],
  9326. source: "add: anObject\x0a\x09self subclassResponsibility",
  9327. messageSends: ["subclassResponsibility"],
  9328. referencedClasses: []
  9329. }),
  9330. smalltalk.Collection);
  9331. smalltalk.addMethod(
  9332. smalltalk.method({
  9333. selector: "addAll:",
  9334. category: 'adding/removing',
  9335. fn: function (aCollection){
  9336. var self=this;
  9337. return smalltalk.withContext(function($ctx1) {
  9338. var $1;
  9339. _st(aCollection)._do_((function(each){
  9340. return smalltalk.withContext(function($ctx2) {
  9341. return _st(self)._add_(each);
  9342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9343. $1=aCollection;
  9344. return $1;
  9345. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},smalltalk.Collection)})},
  9346. args: ["aCollection"],
  9347. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self add: each].\x0a\x09^aCollection",
  9348. messageSends: ["do:", "add:"],
  9349. referencedClasses: []
  9350. }),
  9351. smalltalk.Collection);
  9352. smalltalk.addMethod(
  9353. smalltalk.method({
  9354. selector: "asArray",
  9355. category: 'converting',
  9356. fn: function (){
  9357. var self=this;
  9358. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  9359. return smalltalk.withContext(function($ctx1) {
  9360. var $1;
  9361. $1=_st($Array())._withAll_(self);
  9362. return $1;
  9363. }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Collection)})},
  9364. args: [],
  9365. source: "asArray\x0a\x09^Array withAll: self",
  9366. messageSends: ["withAll:"],
  9367. referencedClasses: ["Array"]
  9368. }),
  9369. smalltalk.Collection);
  9370. smalltalk.addMethod(
  9371. smalltalk.method({
  9372. selector: "asJSON",
  9373. category: 'converting',
  9374. fn: function (){
  9375. var self=this;
  9376. return smalltalk.withContext(function($ctx1) {
  9377. var $1;
  9378. $1=_st(_st(self)._asArray())._collect_((function(each){
  9379. return smalltalk.withContext(function($ctx2) {
  9380. return _st(each)._asJSON();
  9381. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9382. return $1;
  9383. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Collection)})},
  9384. args: [],
  9385. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  9386. messageSends: ["collect:", "asJSON", "asArray"],
  9387. referencedClasses: []
  9388. }),
  9389. smalltalk.Collection);
  9390. smalltalk.addMethod(
  9391. smalltalk.method({
  9392. selector: "asOrderedCollection",
  9393. category: 'converting',
  9394. fn: function (){
  9395. var self=this;
  9396. return smalltalk.withContext(function($ctx1) {
  9397. var $1;
  9398. $1=_st(self)._asArray();
  9399. return $1;
  9400. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},smalltalk.Collection)})},
  9401. args: [],
  9402. source: "asOrderedCollection\x0a\x09^self asArray",
  9403. messageSends: ["asArray"],
  9404. referencedClasses: []
  9405. }),
  9406. smalltalk.Collection);
  9407. smalltalk.addMethod(
  9408. smalltalk.method({
  9409. selector: "asSet",
  9410. category: 'converting',
  9411. fn: function (){
  9412. var self=this;
  9413. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  9414. return smalltalk.withContext(function($ctx1) {
  9415. var $1;
  9416. $1=_st($Set())._withAll_(self);
  9417. return $1;
  9418. }, function($ctx1) {$ctx1.fill(self,"asSet",{},smalltalk.Collection)})},
  9419. args: [],
  9420. source: "asSet\x0a\x09^Set withAll: self",
  9421. messageSends: ["withAll:"],
  9422. referencedClasses: ["Set"]
  9423. }),
  9424. smalltalk.Collection);
  9425. smalltalk.addMethod(
  9426. smalltalk.method({
  9427. selector: "collect:",
  9428. category: 'enumerating',
  9429. fn: function (aBlock){
  9430. var self=this;
  9431. var stream;
  9432. return smalltalk.withContext(function($ctx1) {
  9433. var $1;
  9434. stream=_st(_st(_st(self)._class())._new())._writeStream();
  9435. _st(self)._do_((function(each){
  9436. return smalltalk.withContext(function($ctx2) {
  9437. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  9438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9439. $1=_st(stream)._contents();
  9440. return $1;
  9441. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})},
  9442. args: ["aBlock"],
  9443. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^stream contents",
  9444. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  9445. referencedClasses: []
  9446. }),
  9447. smalltalk.Collection);
  9448. smalltalk.addMethod(
  9449. smalltalk.method({
  9450. selector: "copyWith:",
  9451. category: 'copying',
  9452. fn: function (anObject){
  9453. var self=this;
  9454. return smalltalk.withContext(function($ctx1) {
  9455. var $2,$3,$1;
  9456. $2=_st(self)._copy();
  9457. _st($2)._add_(anObject);
  9458. $3=_st($2)._yourself();
  9459. $1=$3;
  9460. return $1;
  9461. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},smalltalk.Collection)})},
  9462. args: ["anObject"],
  9463. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  9464. messageSends: ["add:", "copy", "yourself"],
  9465. referencedClasses: []
  9466. }),
  9467. smalltalk.Collection);
  9468. smalltalk.addMethod(
  9469. smalltalk.method({
  9470. selector: "copyWithAll:",
  9471. category: 'copying',
  9472. fn: function (aCollection){
  9473. var self=this;
  9474. return smalltalk.withContext(function($ctx1) {
  9475. var $2,$3,$1;
  9476. $2=_st(self)._copy();
  9477. _st($2)._addAll_(aCollection);
  9478. $3=_st($2)._yourself();
  9479. $1=$3;
  9480. return $1;
  9481. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},smalltalk.Collection)})},
  9482. args: ["aCollection"],
  9483. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  9484. messageSends: ["addAll:", "copy", "yourself"],
  9485. referencedClasses: []
  9486. }),
  9487. smalltalk.Collection);
  9488. smalltalk.addMethod(
  9489. smalltalk.method({
  9490. selector: "copyWithoutAll:",
  9491. category: 'copying',
  9492. fn: function (aCollection){
  9493. var self=this;
  9494. return smalltalk.withContext(function($ctx1) {
  9495. var $1;
  9496. $1=_st(self)._reject_((function(each){
  9497. return smalltalk.withContext(function($ctx2) {
  9498. return _st(aCollection)._includes_(each);
  9499. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9500. return $1;
  9501. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},smalltalk.Collection)})},
  9502. args: ["aCollection"],
  9503. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [:each | aCollection includes: each]",
  9504. messageSends: ["reject:", "includes:"],
  9505. referencedClasses: []
  9506. }),
  9507. smalltalk.Collection);
  9508. smalltalk.addMethod(
  9509. smalltalk.method({
  9510. selector: "detect:",
  9511. category: 'enumerating',
  9512. fn: function (aBlock){
  9513. var self=this;
  9514. return smalltalk.withContext(function($ctx1) {
  9515. var $1;
  9516. $1=_st(self)._detect_ifNone_(aBlock,(function(){
  9517. return smalltalk.withContext(function($ctx2) {
  9518. return _st(self)._errorNotFound();
  9519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  9520. return $1;
  9521. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},smalltalk.Collection)})},
  9522. args: ["aBlock"],
  9523. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  9524. messageSends: ["detect:ifNone:", "errorNotFound"],
  9525. referencedClasses: []
  9526. }),
  9527. smalltalk.Collection);
  9528. smalltalk.addMethod(
  9529. smalltalk.method({
  9530. selector: "detect:ifNone:",
  9531. category: 'enumerating',
  9532. fn: function (aBlock,anotherBlock){
  9533. var self=this;
  9534. return smalltalk.withContext(function($ctx1) {
  9535. _st(self)._subclassResponsibility();
  9536. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Collection)})},
  9537. args: ["aBlock", "anotherBlock"],
  9538. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  9539. messageSends: ["subclassResponsibility"],
  9540. referencedClasses: []
  9541. }),
  9542. smalltalk.Collection);
  9543. smalltalk.addMethod(
  9544. smalltalk.method({
  9545. selector: "do:",
  9546. category: 'enumerating',
  9547. fn: function (aBlock){
  9548. var self=this;
  9549. return smalltalk.withContext(function($ctx1) {
  9550. _st(self)._subclassResponsibility();
  9551. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Collection)})},
  9552. args: ["aBlock"],
  9553. source: "do: aBlock\x0a\x09self subclassResponsibility",
  9554. messageSends: ["subclassResponsibility"],
  9555. referencedClasses: []
  9556. }),
  9557. smalltalk.Collection);
  9558. smalltalk.addMethod(
  9559. smalltalk.method({
  9560. selector: "do:separatedBy:",
  9561. category: 'enumerating',
  9562. fn: function (aBlock,anotherBlock){
  9563. var self=this;
  9564. var actionBeforeElement;
  9565. return smalltalk.withContext(function($ctx1) {
  9566. actionBeforeElement=(function(){
  9567. return smalltalk.withContext(function($ctx2) {
  9568. actionBeforeElement=anotherBlock;
  9569. return actionBeforeElement;
  9570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  9571. _st(self)._do_((function(each){
  9572. return smalltalk.withContext(function($ctx2) {
  9573. _st(actionBeforeElement)._value();
  9574. return _st(aBlock)._value_(each);
  9575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9576. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},smalltalk.Collection)})},
  9577. args: ["aBlock", "anotherBlock"],
  9578. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [actionBeforeElement := anotherBlock].\x0a\x09self do: [:each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each]",
  9579. messageSends: ["do:", "value", "value:"],
  9580. referencedClasses: []
  9581. }),
  9582. smalltalk.Collection);
  9583. smalltalk.addMethod(
  9584. smalltalk.method({
  9585. selector: "errorNotFound",
  9586. category: 'error handling',
  9587. fn: function (){
  9588. var self=this;
  9589. return smalltalk.withContext(function($ctx1) {
  9590. _st(self)._error_("Object is not in the collection");
  9591. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},smalltalk.Collection)})},
  9592. args: [],
  9593. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  9594. messageSends: ["error:"],
  9595. referencedClasses: []
  9596. }),
  9597. smalltalk.Collection);
  9598. smalltalk.addMethod(
  9599. smalltalk.method({
  9600. selector: "ifEmpty:",
  9601. category: 'testing',
  9602. fn: function (aBlock){
  9603. var self=this;
  9604. return smalltalk.withContext(function($ctx1) {
  9605. var $2,$1;
  9606. $2=_st(self)._isEmpty();
  9607. if(smalltalk.assert($2)){
  9608. $1=_st(aBlock)._value();
  9609. } else {
  9610. $1=self;
  9611. };
  9612. return $1;
  9613. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},smalltalk.Collection)})},
  9614. args: ["aBlock"],
  9615. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: self classifyMethodAs:\x0a\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  9616. messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
  9617. referencedClasses: []
  9618. }),
  9619. smalltalk.Collection);
  9620. smalltalk.addMethod(
  9621. smalltalk.method({
  9622. selector: "ifNotEmpty:",
  9623. category: 'testing',
  9624. fn: function (aBlock){
  9625. var self=this;
  9626. return smalltalk.withContext(function($ctx1) {
  9627. var $1;
  9628. $1=_st(self)._notEmpty();
  9629. _st($1)._ifTrue_(aBlock);
  9630. return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},smalltalk.Collection)})},
  9631. args: ["aBlock"],
  9632. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  9633. messageSends: ["ifTrue:", "notEmpty"],
  9634. referencedClasses: []
  9635. }),
  9636. smalltalk.Collection);
  9637. smalltalk.addMethod(
  9638. smalltalk.method({
  9639. selector: "includes:",
  9640. category: 'testing',
  9641. fn: function (anObject){
  9642. var self=this;
  9643. var sentinel;
  9644. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  9645. return smalltalk.withContext(function($ctx1) {
  9646. var $1;
  9647. sentinel=_st($Object())._new();
  9648. $1=_st(_st(self)._detect_ifNone_((function(each){
  9649. return smalltalk.withContext(function($ctx2) {
  9650. return _st(each).__eq(anObject);
  9651. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  9652. return smalltalk.withContext(function($ctx2) {
  9653. return sentinel;
  9654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__tild_eq(sentinel);
  9655. return $1;
  9656. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel},smalltalk.Collection)})},
  9657. args: ["anObject"],
  9658. source: "includes: anObject\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel",
  9659. messageSends: ["new", "~=", "detect:ifNone:", "="],
  9660. referencedClasses: ["Object"]
  9661. }),
  9662. smalltalk.Collection);
  9663. smalltalk.addMethod(
  9664. smalltalk.method({
  9665. selector: "inject:into:",
  9666. category: 'enumerating',
  9667. fn: function (anObject,aBlock){
  9668. var self=this;
  9669. var result;
  9670. return smalltalk.withContext(function($ctx1) {
  9671. var $1;
  9672. result=anObject;
  9673. _st(self)._do_((function(each){
  9674. return smalltalk.withContext(function($ctx2) {
  9675. result=_st(aBlock)._value_value_(result,each);
  9676. return result;
  9677. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9678. $1=result;
  9679. return $1;
  9680. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},smalltalk.Collection)})},
  9681. args: ["anObject", "aBlock"],
  9682. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [:each |\x0a\x09\x09result := aBlock value: result value: each].\x0a\x09^result",
  9683. messageSends: ["do:", "value:value:"],
  9684. referencedClasses: []
  9685. }),
  9686. smalltalk.Collection);
  9687. smalltalk.addMethod(
  9688. smalltalk.method({
  9689. selector: "intersection:",
  9690. category: 'enumerating',
  9691. fn: function (aCollection){
  9692. var self=this;
  9693. var set,outputSet;
  9694. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  9695. return smalltalk.withContext(function($ctx1) {
  9696. var $1,$2;
  9697. set=_st(self)._asSet();
  9698. outputSet=_st($Set())._new();
  9699. _st(aCollection)._do_((function(each){
  9700. return smalltalk.withContext(function($ctx2) {
  9701. $1=_st(_st(set)._includes_(each))._and_((function(){
  9702. return smalltalk.withContext(function($ctx3) {
  9703. return _st(_st(outputSet)._includes_(each))._not();
  9704. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  9705. if(smalltalk.assert($1)){
  9706. return _st(outputSet)._add_(each);
  9707. };
  9708. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9709. $2=_st(_st(self)._class())._withAll_(_st(outputSet)._asArray());
  9710. return $2;
  9711. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},smalltalk.Collection)})},
  9712. args: ["aCollection"],
  9713. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [(outputSet includes: each) not])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  9714. messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
  9715. referencedClasses: ["Set"]
  9716. }),
  9717. smalltalk.Collection);
  9718. smalltalk.addMethod(
  9719. smalltalk.method({
  9720. selector: "isEmpty",
  9721. category: 'testing',
  9722. fn: function (){
  9723. var self=this;
  9724. return smalltalk.withContext(function($ctx1) {
  9725. var $1;
  9726. $1=_st(_st(self)._size()).__eq((0));
  9727. return $1;
  9728. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Collection)})},
  9729. args: [],
  9730. source: "isEmpty\x0a\x09^self size = 0",
  9731. messageSends: ["=", "size"],
  9732. referencedClasses: []
  9733. }),
  9734. smalltalk.Collection);
  9735. smalltalk.addMethod(
  9736. smalltalk.method({
  9737. selector: "notEmpty",
  9738. category: 'testing',
  9739. fn: function (){
  9740. var self=this;
  9741. return smalltalk.withContext(function($ctx1) {
  9742. var $1;
  9743. $1=_st(_st(self)._isEmpty())._not();
  9744. return $1;
  9745. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},smalltalk.Collection)})},
  9746. args: [],
  9747. source: "notEmpty\x0a\x09^self isEmpty not",
  9748. messageSends: ["not", "isEmpty"],
  9749. referencedClasses: []
  9750. }),
  9751. smalltalk.Collection);
  9752. smalltalk.addMethod(
  9753. smalltalk.method({
  9754. selector: "occurrencesOf:",
  9755. category: 'accessing',
  9756. fn: function (anObject){
  9757. var self=this;
  9758. var tally;
  9759. return smalltalk.withContext(function($ctx1) {
  9760. var $1,$2;
  9761. tally=(0);
  9762. _st(self)._do_((function(each){
  9763. return smalltalk.withContext(function($ctx2) {
  9764. $1=_st(anObject).__eq(each);
  9765. if(smalltalk.assert($1)){
  9766. tally=_st(tally).__plus((1));
  9767. return tally;
  9768. };
  9769. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9770. $2=tally;
  9771. return $2;
  9772. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},smalltalk.Collection)})},
  9773. args: ["anObject"],
  9774. source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [:each | anObject = each ifTrue: [tally := tally + 1]].\x0a\x09^tally",
  9775. messageSends: ["do:", "ifTrue:", "+", "="],
  9776. referencedClasses: []
  9777. }),
  9778. smalltalk.Collection);
  9779. smalltalk.addMethod(
  9780. smalltalk.method({
  9781. selector: "putOn:",
  9782. category: 'streaming',
  9783. fn: function (aStream){
  9784. var self=this;
  9785. return smalltalk.withContext(function($ctx1) {
  9786. _st(self)._do_((function(each){
  9787. return smalltalk.withContext(function($ctx2) {
  9788. return _st(each)._putOn_(aStream);
  9789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9790. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Collection)})},
  9791. args: ["aStream"],
  9792. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  9793. messageSends: ["do:", "putOn:"],
  9794. referencedClasses: []
  9795. }),
  9796. smalltalk.Collection);
  9797. smalltalk.addMethod(
  9798. smalltalk.method({
  9799. selector: "reject:",
  9800. category: 'enumerating',
  9801. fn: function (aBlock){
  9802. var self=this;
  9803. return smalltalk.withContext(function($ctx1) {
  9804. var $1;
  9805. $1=_st(self)._select_((function(each){
  9806. return smalltalk.withContext(function($ctx2) {
  9807. return _st(_st(aBlock)._value_(each)).__eq(false);
  9808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9809. return $1;
  9810. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},smalltalk.Collection)})},
  9811. args: ["aBlock"],
  9812. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  9813. messageSends: ["select:", "=", "value:"],
  9814. referencedClasses: []
  9815. }),
  9816. smalltalk.Collection);
  9817. smalltalk.addMethod(
  9818. smalltalk.method({
  9819. selector: "remove:",
  9820. category: 'adding/removing',
  9821. fn: function (anObject){
  9822. var self=this;
  9823. return smalltalk.withContext(function($ctx1) {
  9824. var $1;
  9825. $1=_st(self)._remove_ifAbsent_(anObject,(function(){
  9826. return smalltalk.withContext(function($ctx2) {
  9827. return _st(self)._errorNotFound();
  9828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  9829. return $1;
  9830. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Collection)})},
  9831. args: ["anObject"],
  9832. source: "remove: anObject\x0a\x09^self remove: anObject ifAbsent: [self errorNotFound]",
  9833. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  9834. referencedClasses: []
  9835. }),
  9836. smalltalk.Collection);
  9837. smalltalk.addMethod(
  9838. smalltalk.method({
  9839. selector: "remove:ifAbsent:",
  9840. category: 'adding/removing',
  9841. fn: function (anObject,aBlock){
  9842. var self=this;
  9843. return smalltalk.withContext(function($ctx1) {
  9844. _st(self)._subclassResponsibility();
  9845. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Collection)})},
  9846. args: ["anObject", "aBlock"],
  9847. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9848. messageSends: ["subclassResponsibility"],
  9849. referencedClasses: []
  9850. }),
  9851. smalltalk.Collection);
  9852. smalltalk.addMethod(
  9853. smalltalk.method({
  9854. selector: "select:",
  9855. category: 'enumerating',
  9856. fn: function (aBlock){
  9857. var self=this;
  9858. var stream;
  9859. return smalltalk.withContext(function($ctx1) {
  9860. var $1,$2;
  9861. stream=_st(_st(_st(self)._class())._new())._writeStream();
  9862. _st(self)._do_((function(each){
  9863. return smalltalk.withContext(function($ctx2) {
  9864. $1=_st(aBlock)._value_(each);
  9865. if(smalltalk.assert($1)){
  9866. return _st(stream)._nextPut_(each);
  9867. };
  9868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9869. $2=_st(stream)._contents();
  9870. return $2;
  9871. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})},
  9872. args: ["aBlock"],
  9873. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [:each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each]].\x0a\x09^stream contents",
  9874. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
  9875. referencedClasses: []
  9876. }),
  9877. smalltalk.Collection);
  9878. smalltalk.addMethod(
  9879. smalltalk.method({
  9880. selector: "size",
  9881. category: 'accessing',
  9882. fn: function (){
  9883. var self=this;
  9884. return smalltalk.withContext(function($ctx1) {
  9885. _st(self)._subclassResponsibility();
  9886. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Collection)})},
  9887. args: [],
  9888. source: "size\x0a\x09self subclassResponsibility",
  9889. messageSends: ["subclassResponsibility"],
  9890. referencedClasses: []
  9891. }),
  9892. smalltalk.Collection);
  9893. smalltalk.addMethod(
  9894. smalltalk.method({
  9895. selector: "new:",
  9896. category: 'instance creation',
  9897. fn: function (anInteger){
  9898. var self=this;
  9899. return smalltalk.withContext(function($ctx1) {
  9900. var $1;
  9901. $1=_st(self)._new();
  9902. return $1;
  9903. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Collection.klass)})},
  9904. args: ["anInteger"],
  9905. source: "new: anInteger\x0a\x09^self new",
  9906. messageSends: ["new"],
  9907. referencedClasses: []
  9908. }),
  9909. smalltalk.Collection.klass);
  9910. smalltalk.addMethod(
  9911. smalltalk.method({
  9912. selector: "with:",
  9913. category: 'instance creation',
  9914. fn: function (anObject){
  9915. var self=this;
  9916. return smalltalk.withContext(function($ctx1) {
  9917. var $2,$3,$1;
  9918. $2=_st(self)._new();
  9919. _st($2)._add_(anObject);
  9920. $3=_st($2)._yourself();
  9921. $1=$3;
  9922. return $1;
  9923. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Collection.klass)})},
  9924. args: ["anObject"],
  9925. source: "with: anObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  9926. messageSends: ["add:", "new", "yourself"],
  9927. referencedClasses: []
  9928. }),
  9929. smalltalk.Collection.klass);
  9930. smalltalk.addMethod(
  9931. smalltalk.method({
  9932. selector: "with:with:",
  9933. category: 'instance creation',
  9934. fn: function (anObject,anotherObject){
  9935. var self=this;
  9936. return smalltalk.withContext(function($ctx1) {
  9937. var $2,$3,$1;
  9938. $2=_st(self)._new();
  9939. _st($2)._add_(anObject);
  9940. _st($2)._add_(anotherObject);
  9941. $3=_st($2)._yourself();
  9942. $1=$3;
  9943. return $1;
  9944. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},smalltalk.Collection.klass)})},
  9945. args: ["anObject", "anotherObject"],
  9946. source: "with: anObject with: anotherObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  9947. messageSends: ["add:", "new", "yourself"],
  9948. referencedClasses: []
  9949. }),
  9950. smalltalk.Collection.klass);
  9951. smalltalk.addMethod(
  9952. smalltalk.method({
  9953. selector: "with:with:with:",
  9954. category: 'instance creation',
  9955. fn: function (firstObject,secondObject,thirdObject){
  9956. var self=this;
  9957. return smalltalk.withContext(function($ctx1) {
  9958. var $2,$3,$1;
  9959. $2=_st(self)._new();
  9960. _st($2)._add_(firstObject);
  9961. _st($2)._add_(secondObject);
  9962. _st($2)._add_(thirdObject);
  9963. $3=_st($2)._yourself();
  9964. $1=$3;
  9965. return $1;
  9966. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},smalltalk.Collection.klass)})},
  9967. args: ["firstObject", "secondObject", "thirdObject"],
  9968. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  9969. messageSends: ["add:", "new", "yourself"],
  9970. referencedClasses: []
  9971. }),
  9972. smalltalk.Collection.klass);
  9973. smalltalk.addMethod(
  9974. smalltalk.method({
  9975. selector: "withAll:",
  9976. category: 'instance creation',
  9977. fn: function (aCollection){
  9978. var self=this;
  9979. return smalltalk.withContext(function($ctx1) {
  9980. var $2,$3,$1;
  9981. $2=_st(self)._new();
  9982. _st($2)._addAll_(aCollection);
  9983. $3=_st($2)._yourself();
  9984. $1=$3;
  9985. return $1;
  9986. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},smalltalk.Collection.klass)})},
  9987. args: ["aCollection"],
  9988. source: "withAll: aCollection\x0a\x09\x09^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  9989. messageSends: ["addAll:", "new", "yourself"],
  9990. referencedClasses: []
  9991. }),
  9992. smalltalk.Collection.klass);
  9993. smalltalk.addClass('IndexableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  9994. smalltalk.IndexableCollection.comment="I am a key-value store, that is,\x0ait stores values under indexes.\x0a\x0aAs a rule of thumb, if a collection has at: and at:put:,\x0ait is an IndexableCollection."
  9995. smalltalk.addMethod(
  9996. smalltalk.method({
  9997. selector: "at:",
  9998. category: 'accessing',
  9999. fn: function (anIndex){
  10000. var self=this;
  10001. return smalltalk.withContext(function($ctx1) {
  10002. var $1;
  10003. $1=_st(self)._at_ifAbsent_(anIndex,(function(){
  10004. return smalltalk.withContext(function($ctx2) {
  10005. return _st(self)._errorNotFound();
  10006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10007. return $1;
  10008. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},smalltalk.IndexableCollection)})},
  10009. args: ["anIndex"],
  10010. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^self at: anIndex ifAbsent: [ self errorNotFound ]",
  10011. messageSends: ["at:ifAbsent:", "errorNotFound"],
  10012. referencedClasses: []
  10013. }),
  10014. smalltalk.IndexableCollection);
  10015. smalltalk.addMethod(
  10016. smalltalk.method({
  10017. selector: "at:ifAbsent:",
  10018. category: 'accessing',
  10019. fn: function (anIndex,aBlock){
  10020. var self=this;
  10021. return smalltalk.withContext(function($ctx1) {
  10022. _st(self)._subclassReponsibility();
  10023. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10024. args: ["anIndex", "aBlock"],
  10025. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassReponsibility",
  10026. messageSends: ["subclassReponsibility"],
  10027. referencedClasses: []
  10028. }),
  10029. smalltalk.IndexableCollection);
  10030. smalltalk.addMethod(
  10031. smalltalk.method({
  10032. selector: "at:ifPresent:",
  10033. category: 'accessing',
  10034. fn: function (anIndex,aBlock){
  10035. var self=this;
  10036. return smalltalk.withContext(function($ctx1) {
  10037. var $1;
  10038. $1=_st(self)._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  10039. return smalltalk.withContext(function($ctx2) {
  10040. return nil;
  10041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10042. return $1;
  10043. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10044. args: ["anIndex", "aBlock"],
  10045. source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
  10046. messageSends: ["at:ifPresent:ifAbsent:"],
  10047. referencedClasses: []
  10048. }),
  10049. smalltalk.IndexableCollection);
  10050. smalltalk.addMethod(
  10051. smalltalk.method({
  10052. selector: "at:ifPresent:ifAbsent:",
  10053. category: 'accessing',
  10054. fn: function (anIndex,aBlock,anotherBlock){
  10055. var self=this;
  10056. return smalltalk.withContext(function($ctx1) {
  10057. _st(self)._subclassReponsibility();
  10058. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.IndexableCollection)})},
  10059. args: ["anIndex", "aBlock", "anotherBlock"],
  10060. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassReponsibility",
  10061. messageSends: ["subclassReponsibility"],
  10062. referencedClasses: []
  10063. }),
  10064. smalltalk.IndexableCollection);
  10065. smalltalk.addMethod(
  10066. smalltalk.method({
  10067. selector: "at:put:",
  10068. category: 'accessing',
  10069. fn: function (anIndex,anObject){
  10070. var self=this;
  10071. return smalltalk.withContext(function($ctx1) {
  10072. _st(self)._subclassReponsibility();
  10073. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.IndexableCollection)})},
  10074. args: ["anIndex", "anObject"],
  10075. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassReponsibility",
  10076. messageSends: ["subclassReponsibility"],
  10077. referencedClasses: []
  10078. }),
  10079. smalltalk.IndexableCollection);
  10080. smalltalk.addMethod(
  10081. smalltalk.method({
  10082. selector: "indexOf:",
  10083. category: 'accessing',
  10084. fn: function (anObject){
  10085. var self=this;
  10086. return smalltalk.withContext(function($ctx1) {
  10087. var $1;
  10088. $1=_st(self)._indexOf_ifAbsent_(anObject,(function(){
  10089. return smalltalk.withContext(function($ctx2) {
  10090. return _st(self)._errorNotFound();
  10091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10092. return $1;
  10093. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},smalltalk.IndexableCollection)})},
  10094. args: ["anObject"],
  10095. source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^self indexOf: anObject ifAbsent: [ self errorNotFound ]",
  10096. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  10097. referencedClasses: []
  10098. }),
  10099. smalltalk.IndexableCollection);
  10100. smalltalk.addMethod(
  10101. smalltalk.method({
  10102. selector: "indexOf:ifAbsent:",
  10103. category: 'accessing',
  10104. fn: function (anObject,aBlock){
  10105. var self=this;
  10106. return smalltalk.withContext(function($ctx1) {
  10107. _st(self)._subclassResponsibility();
  10108. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10109. args: ["anObject", "aBlock"],
  10110. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  10111. messageSends: ["subclassResponsibility"],
  10112. referencedClasses: []
  10113. }),
  10114. smalltalk.IndexableCollection);
  10115. smalltalk.addMethod(
  10116. smalltalk.method({
  10117. selector: "with:do:",
  10118. category: 'enumarating',
  10119. fn: function (anotherCollection,aBlock){
  10120. var self=this;
  10121. return smalltalk.withContext(function($ctx1) {
  10122. _st(self)._withIndexDo_((function(each,index){
  10123. return smalltalk.withContext(function($ctx2) {
  10124. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  10125. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  10126. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10127. args: ["anotherCollection", "aBlock"],
  10128. source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
  10129. messageSends: ["withIndexDo:", "value:value:", "at:"],
  10130. referencedClasses: []
  10131. }),
  10132. smalltalk.IndexableCollection);
  10133. smalltalk.addMethod(
  10134. smalltalk.method({
  10135. selector: "withIndexDo:",
  10136. category: 'enumarating',
  10137. fn: function (aBlock){
  10138. var self=this;
  10139. return smalltalk.withContext(function($ctx1) {
  10140. _st(self)._subclassReponsibility();
  10141. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.IndexableCollection)})},
  10142. args: ["aBlock"],
  10143. source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassReponsibility",
  10144. messageSends: ["subclassReponsibility"],
  10145. referencedClasses: []
  10146. }),
  10147. smalltalk.IndexableCollection);
  10148. smalltalk.addClass('HashedCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  10149. smalltalk.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, it can only have strings as keys."
  10150. smalltalk.addMethod(
  10151. smalltalk.method({
  10152. selector: ",",
  10153. category: 'copying',
  10154. fn: function (aCollection){
  10155. var self=this;
  10156. return smalltalk.withContext(function($ctx1) {
  10157. _st(self)._shouldNotImplement();
  10158. return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.HashedCollection)})},
  10159. args: ["aCollection"],
  10160. source: ", aCollection\x0a\x09self shouldNotImplement",
  10161. messageSends: ["shouldNotImplement"],
  10162. referencedClasses: []
  10163. }),
  10164. smalltalk.HashedCollection);
  10165. smalltalk.addMethod(
  10166. smalltalk.method({
  10167. selector: "=",
  10168. category: 'comparing',
  10169. fn: function (aHashedCollection){
  10170. var self=this;
  10171. return smalltalk.withContext(function($ctx1) {
  10172. var $1,$2,$3;
  10173. $1=_st(_st(self)._class()).__eq(_st(aHashedCollection)._class());
  10174. if(! smalltalk.assert($1)){
  10175. return false;
  10176. };
  10177. $2=_st(_st(self)._size()).__eq(_st(aHashedCollection)._size());
  10178. if(! smalltalk.assert($2)){
  10179. return false;
  10180. };
  10181. $3=_st(_st(self)._associations()).__eq(_st(aHashedCollection)._associations());
  10182. return $3;
  10183. }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
  10184. args: ["aHashedCollection"],
  10185. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  10186. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  10187. referencedClasses: []
  10188. }),
  10189. smalltalk.HashedCollection);
  10190. smalltalk.addMethod(
  10191. smalltalk.method({
  10192. selector: "add:",
  10193. category: 'adding/removing',
  10194. fn: function (anAssociation){
  10195. var self=this;
  10196. return smalltalk.withContext(function($ctx1) {
  10197. _st(self)._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  10198. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},smalltalk.HashedCollection)})},
  10199. args: ["anAssociation"],
  10200. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  10201. messageSends: ["at:put:", "key", "value"],
  10202. referencedClasses: []
  10203. }),
  10204. smalltalk.HashedCollection);
  10205. smalltalk.addMethod(
  10206. smalltalk.method({
  10207. selector: "addAll:",
  10208. category: 'adding/removing',
  10209. fn: function (aHashedCollection){
  10210. var self=this;
  10211. return smalltalk.withContext(function($ctx1) {
  10212. var $1;
  10213. smalltalk.IndexableCollection.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]);
  10214. $1=aHashedCollection;
  10215. return $1;
  10216. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
  10217. args: ["aHashedCollection"],
  10218. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  10219. messageSends: ["addAll:", "associations"],
  10220. referencedClasses: []
  10221. }),
  10222. smalltalk.HashedCollection);
  10223. smalltalk.addMethod(
  10224. smalltalk.method({
  10225. selector: "asDictionary",
  10226. category: 'converting',
  10227. fn: function (){
  10228. var self=this;
  10229. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  10230. return smalltalk.withContext(function($ctx1) {
  10231. var $1;
  10232. $1=_st($Dictionary())._fromPairs_(_st(self)._associations());
  10233. return $1;
  10234. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},smalltalk.HashedCollection)})},
  10235. args: [],
  10236. source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations",
  10237. messageSends: ["fromPairs:", "associations"],
  10238. referencedClasses: ["Dictionary"]
  10239. }),
  10240. smalltalk.HashedCollection);
  10241. smalltalk.addMethod(
  10242. smalltalk.method({
  10243. selector: "asJSON",
  10244. category: 'converting',
  10245. fn: function (){
  10246. var self=this;
  10247. var c;
  10248. return smalltalk.withContext(function($ctx1) {
  10249. var $1;
  10250. c=_st(_st(self)._class())._new();
  10251. _st(self)._keysAndValuesDo_((function(key,value){
  10252. return smalltalk.withContext(function($ctx2) {
  10253. return _st(c)._at_put_(key,_st(value)._asJSON());
  10254. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  10255. $1=c;
  10256. return $1;
  10257. }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c},smalltalk.HashedCollection)})},
  10258. args: [],
  10259. source: "asJSON\x0a\x09| c |\x0a\x09c := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09c at: key put: value asJSON].\x0a\x09^c",
  10260. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  10261. referencedClasses: []
  10262. }),
  10263. smalltalk.HashedCollection);
  10264. smalltalk.addMethod(
  10265. smalltalk.method({
  10266. selector: "associations",
  10267. category: 'accessing',
  10268. fn: function (){
  10269. var self=this;
  10270. var associations;
  10271. return smalltalk.withContext(function($ctx1) {
  10272. var $1;
  10273. associations=[];
  10274. _st(self)._associationsDo_((function(each){
  10275. return smalltalk.withContext(function($ctx2) {
  10276. return _st(associations)._add_(each);
  10277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10278. $1=associations;
  10279. return $1;
  10280. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},smalltalk.HashedCollection)})},
  10281. args: [],
  10282. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [:each | associations add: each].\x0a\x09^associations",
  10283. messageSends: ["associationsDo:", "add:"],
  10284. referencedClasses: []
  10285. }),
  10286. smalltalk.HashedCollection);
  10287. smalltalk.addMethod(
  10288. smalltalk.method({
  10289. selector: "associationsDo:",
  10290. category: 'enumerating',
  10291. fn: function (aBlock){
  10292. var self=this;
  10293. function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
  10294. return smalltalk.withContext(function($ctx1) {
  10295. _st(self)._keysAndValuesDo_((function(key,value){
  10296. return smalltalk.withContext(function($ctx2) {
  10297. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  10298. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  10299. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  10300. args: ["aBlock"],
  10301. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09aBlock value: (Association key: key value: value)]",
  10302. messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
  10303. referencedClasses: ["Association"]
  10304. }),
  10305. smalltalk.HashedCollection);
  10306. smalltalk.addMethod(
  10307. smalltalk.method({
  10308. selector: "at:ifAbsent:",
  10309. category: 'accessing',
  10310. fn: function (aKey,aBlock){
  10311. var self=this;
  10312. return smalltalk.withContext(function($ctx1) {
  10313. var $2,$1;
  10314. $2=_st(self)._includesKey_(aKey);
  10315. $1=_st($2)._ifTrue_ifFalse_((function(){
  10316. return smalltalk.withContext(function($ctx2) {
  10317. return _st(self)._basicAt_(aKey);
  10318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  10319. return $1;
  10320. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  10321. args: ["aKey", "aBlock"],
  10322. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  10323. messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
  10324. referencedClasses: []
  10325. }),
  10326. smalltalk.HashedCollection);
  10327. smalltalk.addMethod(
  10328. smalltalk.method({
  10329. selector: "at:ifAbsentPut:",
  10330. category: 'accessing',
  10331. fn: function (aKey,aBlock){
  10332. var self=this;
  10333. return smalltalk.withContext(function($ctx1) {
  10334. var $1;
  10335. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  10336. return smalltalk.withContext(function($ctx2) {
  10337. return _st(self)._at_put_(aKey,_st(aBlock)._value());
  10338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10339. return $1;
  10340. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  10341. args: ["aKey", "aBlock"],
  10342. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value]",
  10343. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  10344. referencedClasses: []
  10345. }),
  10346. smalltalk.HashedCollection);
  10347. smalltalk.addMethod(
  10348. smalltalk.method({
  10349. selector: "at:ifPresent:ifAbsent:",
  10350. category: 'accessing',
  10351. fn: function (aKey,aBlock,anotherBlock){
  10352. var self=this;
  10353. return smalltalk.withContext(function($ctx1) {
  10354. var $2,$1;
  10355. $2=_st(self)._includesKey_(aKey);
  10356. $1=_st($2)._ifTrue_ifFalse_((function(){
  10357. return smalltalk.withContext(function($ctx2) {
  10358. return _st(aBlock)._value_(_st(self)._at_(aKey));
  10359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),anotherBlock);
  10360. return $1;
  10361. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
  10362. args: ["aKey", "aBlock", "anotherBlock"],
  10363. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock with the value associated with the key,\x0a\x09otherwise answer the value of absentBlock.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: anotherBlock",
  10364. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  10365. referencedClasses: []
  10366. }),
  10367. smalltalk.HashedCollection);
  10368. smalltalk.addMethod(
  10369. smalltalk.method({
  10370. selector: "at:put:",
  10371. category: 'accessing',
  10372. fn: function (aKey,aValue){
  10373. var self=this;
  10374. return smalltalk.withContext(function($ctx1) {
  10375. var $1;
  10376. $1=_st(self)._basicAt_put_(aKey,aValue);
  10377. return $1;
  10378. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.HashedCollection)})},
  10379. args: ["aKey", "aValue"],
  10380. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  10381. messageSends: ["basicAt:put:"],
  10382. referencedClasses: []
  10383. }),
  10384. smalltalk.HashedCollection);
  10385. smalltalk.addMethod(
  10386. smalltalk.method({
  10387. selector: "collect:",
  10388. category: 'enumerating',
  10389. fn: function (aBlock){
  10390. var self=this;
  10391. var newDict;
  10392. return smalltalk.withContext(function($ctx1) {
  10393. var $1;
  10394. newDict=_st(_st(self)._class())._new();
  10395. _st(self)._keysAndValuesDo_((function(key,value){
  10396. return smalltalk.withContext(function($ctx2) {
  10397. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  10398. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  10399. $1=newDict;
  10400. return $1;
  10401. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
  10402. args: ["aBlock"],
  10403. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value)].\x0a\x09^newDict",
  10404. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  10405. referencedClasses: []
  10406. }),
  10407. smalltalk.HashedCollection);
  10408. smalltalk.addMethod(
  10409. smalltalk.method({
  10410. selector: "deepCopy",
  10411. category: 'copying',
  10412. fn: function (){
  10413. var self=this;
  10414. var copy;
  10415. return smalltalk.withContext(function($ctx1) {
  10416. var $1;
  10417. copy=_st(_st(self)._class())._new();
  10418. _st(self)._keysAndValuesDo_((function(key,value){
  10419. return smalltalk.withContext(function($ctx2) {
  10420. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  10421. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  10422. $1=copy;
  10423. return $1;
  10424. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},smalltalk.HashedCollection)})},
  10425. args: [],
  10426. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09copy at: key put: value deepCopy].\x0a\x09^copy",
  10427. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
  10428. referencedClasses: []
  10429. }),
  10430. smalltalk.HashedCollection);
  10431. smalltalk.addMethod(
  10432. smalltalk.method({
  10433. selector: "detect:ifNone:",
  10434. category: 'enumerating',
  10435. fn: function (aBlock,anotherBlock){
  10436. var self=this;
  10437. return smalltalk.withContext(function($ctx1) {
  10438. var $1;
  10439. $1=_st(_st(self)._values())._detect_ifNone_(aBlock,anotherBlock);
  10440. return $1;
  10441. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
  10442. args: ["aBlock", "anotherBlock"],
  10443. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  10444. messageSends: ["detect:ifNone:", "values"],
  10445. referencedClasses: []
  10446. }),
  10447. smalltalk.HashedCollection);
  10448. smalltalk.addMethod(
  10449. smalltalk.method({
  10450. selector: "do:",
  10451. category: 'enumerating',
  10452. fn: function (aBlock){
  10453. var self=this;
  10454. return smalltalk.withContext(function($ctx1) {
  10455. _st(self)._valuesDo_(aBlock);
  10456. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  10457. args: ["aBlock"],
  10458. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  10459. messageSends: ["valuesDo:"],
  10460. referencedClasses: []
  10461. }),
  10462. smalltalk.HashedCollection);
  10463. smalltalk.addMethod(
  10464. smalltalk.method({
  10465. selector: "includes:",
  10466. category: 'enumerating',
  10467. fn: function (anObject){
  10468. var self=this;
  10469. return smalltalk.withContext(function($ctx1) {
  10470. var $1;
  10471. $1=_st(_st(self)._values())._includes_(anObject);
  10472. return $1;
  10473. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.HashedCollection)})},
  10474. args: ["anObject"],
  10475. source: "includes: anObject\x0a\x09^self values includes: anObject",
  10476. messageSends: ["includes:", "values"],
  10477. referencedClasses: []
  10478. }),
  10479. smalltalk.HashedCollection);
  10480. smalltalk.addMethod(
  10481. smalltalk.method({
  10482. selector: "includesKey:",
  10483. category: 'testing',
  10484. fn: function (aKey){
  10485. var self=this;
  10486. return smalltalk.withContext(function($ctx1) {
  10487. return self.hasOwnProperty(aKey);
  10488. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.HashedCollection)})},
  10489. args: ["aKey"],
  10490. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  10491. messageSends: [],
  10492. referencedClasses: []
  10493. }),
  10494. smalltalk.HashedCollection);
  10495. smalltalk.addMethod(
  10496. smalltalk.method({
  10497. selector: "indexOf:ifAbsent:",
  10498. category: 'accessing',
  10499. fn: function (anObject,aBlock){
  10500. var self=this;
  10501. return smalltalk.withContext(function($ctx1) {
  10502. var $1;
  10503. $1=_st(_st(self)._keys())._detect_ifNone_((function(each){
  10504. return smalltalk.withContext(function($ctx2) {
  10505. return _st(_st(self)._at_(each)).__eq(anObject);
  10506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),aBlock);
  10507. return $1;
  10508. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.HashedCollection)})},
  10509. args: ["anObject", "aBlock"],
  10510. source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09^ self keys detect: [ :each | (self at: each) = anObject ] ifNone: aBlock",
  10511. messageSends: ["detect:ifNone:", "=", "at:", "keys"],
  10512. referencedClasses: []
  10513. }),
  10514. smalltalk.HashedCollection);
  10515. smalltalk.addMethod(
  10516. smalltalk.method({
  10517. selector: "keys",
  10518. category: 'accessing',
  10519. fn: function (){
  10520. var self=this;
  10521. return smalltalk.withContext(function($ctx1) {
  10522. if ('function'===typeof Object.keys) return Object.keys(self);
  10523. var keys = [];
  10524. for(var i in self) {
  10525. if(self.hasOwnProperty(i)) {
  10526. keys.push(i);
  10527. }
  10528. };
  10529. return keys;
  10530. ;
  10531. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.HashedCollection)})},
  10532. args: [],
  10533. source: "keys\x0a\x09<\x0a\x09\x09if ('function'===typeof Object.keys) return Object.keys(self);\x0a\x09\x09var keys = [];\x0a\x09\x09for(var i in self) {\x0a\x09\x09\x09if(self.hasOwnProperty(i)) {\x0a\x09\x09\x09\x09keys.push(i);\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09return keys;\x0a\x09>",
  10534. messageSends: [],
  10535. referencedClasses: []
  10536. }),
  10537. smalltalk.HashedCollection);
  10538. smalltalk.addMethod(
  10539. smalltalk.method({
  10540. selector: "keysAndValuesDo:",
  10541. category: 'enumerating',
  10542. fn: function (aBlock){
  10543. var self=this;
  10544. return smalltalk.withContext(function($ctx1) {
  10545. _st(self)._keysDo_((function(each){
  10546. return smalltalk.withContext(function($ctx2) {
  10547. return _st(aBlock)._value_value_(each,_st(self)._at_(each));
  10548. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10549. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  10550. args: ["aBlock"],
  10551. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [:each |\x0a\x09\x09aBlock value: each value: (self at: each)]",
  10552. messageSends: ["keysDo:", "value:value:", "at:"],
  10553. referencedClasses: []
  10554. }),
  10555. smalltalk.HashedCollection);
  10556. smalltalk.addMethod(
  10557. smalltalk.method({
  10558. selector: "keysDo:",
  10559. category: 'enumerating',
  10560. fn: function (aBlock){
  10561. var self=this;
  10562. return smalltalk.withContext(function($ctx1) {
  10563. _st(_st(self)._keys())._do_(aBlock);
  10564. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  10565. args: ["aBlock"],
  10566. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  10567. messageSends: ["do:", "keys"],
  10568. referencedClasses: []
  10569. }),
  10570. smalltalk.HashedCollection);
  10571. smalltalk.addMethod(
  10572. smalltalk.method({
  10573. selector: "printOn:",
  10574. category: 'printing',
  10575. fn: function (aStream){
  10576. var self=this;
  10577. return smalltalk.withContext(function($ctx1) {
  10578. smalltalk.IndexableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]);
  10579. _st(aStream)._nextPutAll_(" (");
  10580. _st(_st(self)._associations())._do_separatedBy_((function(each){
  10581. return smalltalk.withContext(function($ctx2) {
  10582. return _st(each)._printOn_(aStream);
  10583. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  10584. return smalltalk.withContext(function($ctx2) {
  10585. return _st(aStream)._nextPutAll_(" , ");
  10586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10587. _st(aStream)._nextPutAll_(")");
  10588. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.HashedCollection)})},
  10589. args: ["aStream"],
  10590. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [:each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  10591. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"],
  10592. referencedClasses: []
  10593. }),
  10594. smalltalk.HashedCollection);
  10595. smalltalk.addMethod(
  10596. smalltalk.method({
  10597. selector: "remove:ifAbsent:",
  10598. category: 'adding/removing',
  10599. fn: function (aKey,aBlock){
  10600. var self=this;
  10601. return smalltalk.withContext(function($ctx1) {
  10602. var $1;
  10603. $1=_st(self)._removeKey_ifAbsent_(aKey,aBlock);
  10604. return $1;
  10605. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  10606. args: ["aKey", "aBlock"],
  10607. source: "remove: aKey ifAbsent: aBlock\x0a\x09^self removeKey: aKey ifAbsent: aBlock",
  10608. messageSends: ["removeKey:ifAbsent:"],
  10609. referencedClasses: []
  10610. }),
  10611. smalltalk.HashedCollection);
  10612. smalltalk.addMethod(
  10613. smalltalk.method({
  10614. selector: "removeKey:",
  10615. category: 'adding/removing',
  10616. fn: function (aKey){
  10617. var self=this;
  10618. return smalltalk.withContext(function($ctx1) {
  10619. var $1;
  10620. $1=_st(self)._remove_(aKey);
  10621. return $1;
  10622. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},smalltalk.HashedCollection)})},
  10623. args: ["aKey"],
  10624. source: "removeKey: aKey\x0a\x09^self remove: aKey",
  10625. messageSends: ["remove:"],
  10626. referencedClasses: []
  10627. }),
  10628. smalltalk.HashedCollection);
  10629. smalltalk.addMethod(
  10630. smalltalk.method({
  10631. selector: "removeKey:ifAbsent:",
  10632. category: 'adding/removing',
  10633. fn: function (aKey,aBlock){
  10634. var self=this;
  10635. return smalltalk.withContext(function($ctx1) {
  10636. var $2,$1;
  10637. $2=_st(self)._includesKey_(aKey);
  10638. if(smalltalk.assert($2)){
  10639. $1=_st(self)._basicDelete_(aKey);
  10640. } else {
  10641. $1=_st(aBlock)._value();
  10642. };
  10643. return $1;
  10644. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  10645. args: ["aKey", "aBlock"],
  10646. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  10647. messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
  10648. referencedClasses: []
  10649. }),
  10650. smalltalk.HashedCollection);
  10651. smalltalk.addMethod(
  10652. smalltalk.method({
  10653. selector: "select:",
  10654. category: 'enumerating',
  10655. fn: function (aBlock){
  10656. var self=this;
  10657. var newDict;
  10658. return smalltalk.withContext(function($ctx1) {
  10659. var $1,$2;
  10660. newDict=_st(_st(self)._class())._new();
  10661. _st(self)._keysAndValuesDo_((function(key,value){
  10662. return smalltalk.withContext(function($ctx2) {
  10663. $1=_st(aBlock)._value_(value);
  10664. if(smalltalk.assert($1)){
  10665. return _st(newDict)._at_put_(key,value);
  10666. };
  10667. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  10668. $2=newDict;
  10669. return $2;
  10670. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
  10671. args: ["aBlock"],
  10672. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [newDict at: key put: value]].\x0a\x09^newDict",
  10673. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
  10674. referencedClasses: []
  10675. }),
  10676. smalltalk.HashedCollection);
  10677. smalltalk.addMethod(
  10678. smalltalk.method({
  10679. selector: "shallowCopy",
  10680. category: 'copying',
  10681. fn: function (){
  10682. var self=this;
  10683. var copy;
  10684. return smalltalk.withContext(function($ctx1) {
  10685. var $1;
  10686. copy=_st(_st(self)._class())._new();
  10687. _st(self)._keysAndValuesDo_((function(key,value){
  10688. return smalltalk.withContext(function($ctx2) {
  10689. return _st(copy)._at_put_(key,value);
  10690. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  10691. $1=copy;
  10692. return $1;
  10693. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},smalltalk.HashedCollection)})},
  10694. args: [],
  10695. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09copy at: key put: value].\x0a\x09^copy",
  10696. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
  10697. referencedClasses: []
  10698. }),
  10699. smalltalk.HashedCollection);
  10700. smalltalk.addMethod(
  10701. smalltalk.method({
  10702. selector: "size",
  10703. category: 'accessing',
  10704. fn: function (){
  10705. var self=this;
  10706. return smalltalk.withContext(function($ctx1) {
  10707. var $1;
  10708. $1=_st(_st(self)._keys())._size();
  10709. return $1;
  10710. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.HashedCollection)})},
  10711. args: [],
  10712. source: "size\x0a\x09^self keys size",
  10713. messageSends: ["size", "keys"],
  10714. referencedClasses: []
  10715. }),
  10716. smalltalk.HashedCollection);
  10717. smalltalk.addMethod(
  10718. smalltalk.method({
  10719. selector: "values",
  10720. category: 'accessing',
  10721. fn: function (){
  10722. var self=this;
  10723. return smalltalk.withContext(function($ctx1) {
  10724. var $1;
  10725. $1=_st(_st(self)._keys())._collect_((function(each){
  10726. return smalltalk.withContext(function($ctx2) {
  10727. return _st(self)._at_(each);
  10728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10729. return $1;
  10730. }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.HashedCollection)})},
  10731. args: [],
  10732. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  10733. messageSends: ["collect:", "at:", "keys"],
  10734. referencedClasses: []
  10735. }),
  10736. smalltalk.HashedCollection);
  10737. smalltalk.addMethod(
  10738. smalltalk.method({
  10739. selector: "valuesDo:",
  10740. category: 'enumerating',
  10741. fn: function (aBlock){
  10742. var self=this;
  10743. return smalltalk.withContext(function($ctx1) {
  10744. _st(self)._keysAndValuesDo_((function(key,value){
  10745. return smalltalk.withContext(function($ctx2) {
  10746. return _st(aBlock)._value_(value);
  10747. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  10748. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  10749. args: ["aBlock"],
  10750. source: "valuesDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value ]",
  10751. messageSends: ["keysAndValuesDo:", "value:"],
  10752. referencedClasses: []
  10753. }),
  10754. smalltalk.HashedCollection);
  10755. smalltalk.addMethod(
  10756. smalltalk.method({
  10757. selector: "withIndexDo:",
  10758. category: 'enumerating',
  10759. fn: function (aBlock){
  10760. var self=this;
  10761. return smalltalk.withContext(function($ctx1) {
  10762. _st(self)._keysAndValuesDo_((function(key,value){
  10763. return smalltalk.withContext(function($ctx2) {
  10764. return _st(aBlock)._value_value_(value,key);
  10765. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  10766. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  10767. args: ["aBlock"],
  10768. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  10769. messageSends: ["keysAndValuesDo:", "value:value:"],
  10770. referencedClasses: []
  10771. }),
  10772. smalltalk.HashedCollection);
  10773. smalltalk.addMethod(
  10774. smalltalk.method({
  10775. selector: "fromPairs:",
  10776. category: 'instance creation',
  10777. fn: function (aCollection){
  10778. var self=this;
  10779. var dict;
  10780. return smalltalk.withContext(function($ctx1) {
  10781. var $1;
  10782. dict=_st(self)._new();
  10783. _st(aCollection)._do_((function(each){
  10784. return smalltalk.withContext(function($ctx2) {
  10785. return _st(dict)._add_(each);
  10786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10787. $1=dict;
  10788. return $1;
  10789. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection,dict:dict},smalltalk.HashedCollection.klass)})},
  10790. args: ["aCollection"],
  10791. source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict",
  10792. messageSends: ["new", "do:", "add:"],
  10793. referencedClasses: []
  10794. }),
  10795. smalltalk.HashedCollection.klass);
  10796. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  10797. smalltalk.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key."
  10798. smalltalk.addMethod(
  10799. smalltalk.method({
  10800. selector: "asHashedCollection",
  10801. category: 'converting',
  10802. fn: function (){
  10803. var self=this;
  10804. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  10805. return smalltalk.withContext(function($ctx1) {
  10806. var $1;
  10807. $1=_st($HashedCollection())._fromPairs_(_st(self)._associations());
  10808. return $1;
  10809. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},smalltalk.Dictionary)})},
  10810. args: [],
  10811. source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations",
  10812. messageSends: ["fromPairs:", "associations"],
  10813. referencedClasses: ["HashedCollection"]
  10814. }),
  10815. smalltalk.Dictionary);
  10816. smalltalk.addMethod(
  10817. smalltalk.method({
  10818. selector: "asJSON",
  10819. category: 'converting',
  10820. fn: function (){
  10821. var self=this;
  10822. return smalltalk.withContext(function($ctx1) {
  10823. var $1;
  10824. $1=_st(_st(self)._asHashedCollection())._asJSON();
  10825. return $1;
  10826. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Dictionary)})},
  10827. args: [],
  10828. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  10829. messageSends: ["asJSON", "asHashedCollection"],
  10830. referencedClasses: []
  10831. }),
  10832. smalltalk.Dictionary);
  10833. smalltalk.addMethod(
  10834. smalltalk.method({
  10835. selector: "at:ifAbsent:",
  10836. category: 'accessing',
  10837. fn: function (aKey,aBlock){
  10838. var self=this;
  10839. return smalltalk.withContext(function($ctx1) {
  10840. var index = self._positionOfKey_(aKey);
  10841. return index >=0 ? self['@values'][index] : aBlock();
  10842. ;
  10843. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})},
  10844. args: ["aKey", "aBlock"],
  10845. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock();\x0a\x09>",
  10846. messageSends: [],
  10847. referencedClasses: []
  10848. }),
  10849. smalltalk.Dictionary);
  10850. smalltalk.addMethod(
  10851. smalltalk.method({
  10852. selector: "at:put:",
  10853. category: 'accessing',
  10854. fn: function (aKey,aValue){
  10855. var self=this;
  10856. return smalltalk.withContext(function($ctx1) {
  10857. var index = self._positionOfKey_(aKey);
  10858. if(index === -1) {
  10859. var keys = self['@keys'];
  10860. index = keys.length;
  10861. keys.push(aKey);
  10862. }
  10863. return self['@values'][index] = aValue;
  10864. ;
  10865. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.Dictionary)})},
  10866. args: ["aKey", "aValue"],
  10867. source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self['@keys'];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self['@values'][index] = aValue;\x0a\x09>",
  10868. messageSends: [],
  10869. referencedClasses: []
  10870. }),
  10871. smalltalk.Dictionary);
  10872. smalltalk.addMethod(
  10873. smalltalk.method({
  10874. selector: "includesKey:",
  10875. category: 'testing',
  10876. fn: function (aKey){
  10877. var self=this;
  10878. return smalltalk.withContext(function($ctx1) {
  10879. return self._positionOfKey_(aKey) >= 0; ;
  10880. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.Dictionary)})},
  10881. args: ["aKey"],
  10882. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  10883. messageSends: [],
  10884. referencedClasses: []
  10885. }),
  10886. smalltalk.Dictionary);
  10887. smalltalk.addMethod(
  10888. smalltalk.method({
  10889. selector: "indexOf:ifAbsent:",
  10890. category: 'accessing',
  10891. fn: function (anObject,aBlock){
  10892. var self=this;
  10893. var index;
  10894. return smalltalk.withContext(function($ctx1) {
  10895. var $2,$1;
  10896. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  10897. return smalltalk.withContext(function($ctx2) {
  10898. return (0);
  10899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10900. $2=_st(index).__eq((0));
  10901. if(smalltalk.assert($2)){
  10902. $1=_st(aBlock)._value();
  10903. } else {
  10904. $1=_st(self["@keys"])._at_(index);
  10905. };
  10906. return $1;
  10907. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},smalltalk.Dictionary)})},
  10908. args: ["anObject", "aBlock"],
  10909. source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09| index |\x0a\x09index := values indexOf: anObject ifAbsent: [0].\x0a\x09^ index = 0 ifTrue: [ aBlock value ] ifFalse: [ keys at: index ]",
  10910. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "value", "at:", "="],
  10911. referencedClasses: []
  10912. }),
  10913. smalltalk.Dictionary);
  10914. smalltalk.addMethod(
  10915. smalltalk.method({
  10916. selector: "initialize",
  10917. category: 'initialization',
  10918. fn: function (){
  10919. var self=this;
  10920. return smalltalk.withContext(function($ctx1) {
  10921. smalltalk.HashedCollection.fn.prototype._initialize.apply(_st(self), []);
  10922. self["@keys"]=[];
  10923. self["@values"]=[];
  10924. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Dictionary)})},
  10925. args: [],
  10926. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  10927. messageSends: ["initialize"],
  10928. referencedClasses: []
  10929. }),
  10930. smalltalk.Dictionary);
  10931. smalltalk.addMethod(
  10932. smalltalk.method({
  10933. selector: "keys",
  10934. category: 'accessing',
  10935. fn: function (){
  10936. var self=this;
  10937. return smalltalk.withContext(function($ctx1) {
  10938. var $1;
  10939. $1=_st(self["@keys"])._copy();
  10940. return $1;
  10941. }, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.Dictionary)})},
  10942. args: [],
  10943. source: "keys\x0a\x09^keys copy",
  10944. messageSends: ["copy"],
  10945. referencedClasses: []
  10946. }),
  10947. smalltalk.Dictionary);
  10948. smalltalk.addMethod(
  10949. smalltalk.method({
  10950. selector: "keysAndValuesDo:",
  10951. category: 'enumerating',
  10952. fn: function (aBlock){
  10953. var self=this;
  10954. return smalltalk.withContext(function($ctx1) {
  10955. var $1;
  10956. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  10957. return $1;
  10958. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  10959. args: ["aBlock"],
  10960. source: "keysAndValuesDo: aBlock\x0a\x09^keys with: values do: aBlock",
  10961. messageSends: ["with:do:"],
  10962. referencedClasses: []
  10963. }),
  10964. smalltalk.Dictionary);
  10965. smalltalk.addMethod(
  10966. smalltalk.method({
  10967. selector: "keysDo:",
  10968. category: 'enumerating',
  10969. fn: function (aBlock){
  10970. var self=this;
  10971. return smalltalk.withContext(function($ctx1) {
  10972. var $1;
  10973. $1=_st(self["@keys"])._do_(aBlock);
  10974. return $1;
  10975. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  10976. args: ["aBlock"],
  10977. source: "keysDo: aBlock\x0a\x09^keys do: aBlock",
  10978. messageSends: ["do:"],
  10979. referencedClasses: []
  10980. }),
  10981. smalltalk.Dictionary);
  10982. smalltalk.addMethod(
  10983. smalltalk.method({
  10984. selector: "positionOfKey:",
  10985. category: 'private',
  10986. fn: function (anObject){
  10987. var self=this;
  10988. return smalltalk.withContext(function($ctx1) {
  10989. var keys = self['@keys'];
  10990. for(var i=0;i<keys.length;i++){
  10991. if(keys[i].__eq(anObject)) { return i;}
  10992. }
  10993. return -1;
  10994. ;
  10995. return self}, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},smalltalk.Dictionary)})},
  10996. args: ["anObject"],
  10997. source: "positionOfKey: anObject\x0a\x09<\x0a\x09\x09var keys = self['@keys'];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09>",
  10998. messageSends: [],
  10999. referencedClasses: []
  11000. }),
  11001. smalltalk.Dictionary);
  11002. smalltalk.addMethod(
  11003. smalltalk.method({
  11004. selector: "removeKey:ifAbsent:",
  11005. category: 'adding/removing',
  11006. fn: function (aKey,aBlock){
  11007. var self=this;
  11008. return smalltalk.withContext(function($ctx1) {
  11009. var index = self._positionOfKey_(aKey);
  11010. if(index === -1) {
  11011. return aBlock()
  11012. } else {
  11013. var keys = self['@keys'], values = self['@values'];
  11014. var value = values[index], l = keys.length;
  11015. keys[index] = keys[l-1];
  11016. keys.pop();
  11017. values[index] = values[l-1];
  11018. values.pop();
  11019. return value;
  11020. }
  11021. ;
  11022. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})},
  11023. args: ["aKey", "aBlock"],
  11024. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self['@keys'], values = self['@values'];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09>",
  11025. messageSends: [],
  11026. referencedClasses: []
  11027. }),
  11028. smalltalk.Dictionary);
  11029. smalltalk.addMethod(
  11030. smalltalk.method({
  11031. selector: "values",
  11032. category: 'accessing',
  11033. fn: function (){
  11034. var self=this;
  11035. return smalltalk.withContext(function($ctx1) {
  11036. var $1;
  11037. $1=_st(self["@values"])._copy();
  11038. return $1;
  11039. }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.Dictionary)})},
  11040. args: [],
  11041. source: "values\x0a\x09^values copy",
  11042. messageSends: ["copy"],
  11043. referencedClasses: []
  11044. }),
  11045. smalltalk.Dictionary);
  11046. smalltalk.addMethod(
  11047. smalltalk.method({
  11048. selector: "valuesDo:",
  11049. category: 'enumerating',
  11050. fn: function (aBlock){
  11051. var self=this;
  11052. return smalltalk.withContext(function($ctx1) {
  11053. var $1;
  11054. $1=_st(self["@values"])._do_(aBlock);
  11055. return $1;
  11056. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  11057. args: ["aBlock"],
  11058. source: "valuesDo: aBlock\x0a\x09^values do: aBlock",
  11059. messageSends: ["do:"],
  11060. referencedClasses: []
  11061. }),
  11062. smalltalk.Dictionary);
  11063. smalltalk.addClass('SequenceableCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  11064. smalltalk.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1."
  11065. smalltalk.addMethod(
  11066. smalltalk.method({
  11067. selector: "=",
  11068. category: 'comparing',
  11069. fn: function (aCollection){
  11070. var self=this;
  11071. return smalltalk.withContext(function($ctx1) {
  11072. var $1,$2;
  11073. var $early={};
  11074. try {
  11075. $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
  11076. return smalltalk.withContext(function($ctx2) {
  11077. return _st(_st(self)._size()).__eq(_st(aCollection)._size());
  11078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11079. if(! smalltalk.assert($1)){
  11080. return false;
  11081. };
  11082. _st(self)._withIndexDo_((function(each,i){
  11083. return smalltalk.withContext(function($ctx2) {
  11084. $2=_st(_st(aCollection)._at_(i)).__eq(each);
  11085. if(! smalltalk.assert($2)){
  11086. throw $early=[false];
  11087. };
  11088. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  11089. return true;
  11090. }
  11091. catch(e) {if(e===$early)return e[0]; throw e}
  11092. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.SequenceableCollection)})},
  11093. args: ["aCollection"],
  11094. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size]) ifFalse: [^false].\x0a\x09self withIndexDo: [:each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [^false]].\x0a\x09^true",
  11095. messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
  11096. referencedClasses: []
  11097. }),
  11098. smalltalk.SequenceableCollection);
  11099. smalltalk.addMethod(
  11100. smalltalk.method({
  11101. selector: "addLast:",
  11102. category: 'adding',
  11103. fn: function (anObject){
  11104. var self=this;
  11105. return smalltalk.withContext(function($ctx1) {
  11106. _st(self)._add_(anObject);
  11107. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},smalltalk.SequenceableCollection)})},
  11108. args: ["anObject"],
  11109. source: "addLast: anObject\x0a\x09self add: anObject",
  11110. messageSends: ["add:"],
  11111. referencedClasses: []
  11112. }),
  11113. smalltalk.SequenceableCollection);
  11114. smalltalk.addMethod(
  11115. smalltalk.method({
  11116. selector: "allButFirst",
  11117. category: 'accessing',
  11118. fn: function (){
  11119. var self=this;
  11120. return smalltalk.withContext(function($ctx1) {
  11121. var $1;
  11122. $1=_st(self)._copyFrom_to_((2),_st(self)._size());
  11123. return $1;
  11124. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},smalltalk.SequenceableCollection)})},
  11125. args: [],
  11126. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  11127. messageSends: ["copyFrom:to:", "size"],
  11128. referencedClasses: []
  11129. }),
  11130. smalltalk.SequenceableCollection);
  11131. smalltalk.addMethod(
  11132. smalltalk.method({
  11133. selector: "allButLast",
  11134. category: 'accessing',
  11135. fn: function (){
  11136. var self=this;
  11137. return smalltalk.withContext(function($ctx1) {
  11138. var $1;
  11139. $1=_st(self)._copyFrom_to_((1),_st(_st(self)._size()).__minus((1)));
  11140. return $1;
  11141. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},smalltalk.SequenceableCollection)})},
  11142. args: [],
  11143. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  11144. messageSends: ["copyFrom:to:", "-", "size"],
  11145. referencedClasses: []
  11146. }),
  11147. smalltalk.SequenceableCollection);
  11148. smalltalk.addMethod(
  11149. smalltalk.method({
  11150. selector: "atRandom",
  11151. category: 'accessing',
  11152. fn: function (){
  11153. var self=this;
  11154. return smalltalk.withContext(function($ctx1) {
  11155. var $1;
  11156. $1=_st(self)._at_(_st(_st(self)._size())._atRandom());
  11157. return $1;
  11158. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.SequenceableCollection)})},
  11159. args: [],
  11160. source: "atRandom\x0a\x09^ self at: self size atRandom",
  11161. messageSends: ["at:", "atRandom", "size"],
  11162. referencedClasses: []
  11163. }),
  11164. smalltalk.SequenceableCollection);
  11165. smalltalk.addMethod(
  11166. smalltalk.method({
  11167. selector: "copyFrom:to:",
  11168. category: 'copying',
  11169. fn: function (anIndex,anotherIndex){
  11170. var self=this;
  11171. var range,newCollection;
  11172. return smalltalk.withContext(function($ctx1) {
  11173. var $1;
  11174. range=_st(anIndex)._to_(anotherIndex);
  11175. newCollection=_st(_st(self)._class())._new_(_st(range)._size());
  11176. _st(range)._withIndexDo_((function(each,i){
  11177. return smalltalk.withContext(function($ctx2) {
  11178. return _st(newCollection)._at_put_(i,_st(self)._at_(each));
  11179. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  11180. $1=newCollection;
  11181. return $1;
  11182. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},smalltalk.SequenceableCollection)})},
  11183. args: ["anIndex", "anotherIndex"],
  11184. source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [:each :i |\x0a\x09\x09newCollection at: i put: (self at: each)].\x0a\x09^newCollection",
  11185. messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
  11186. referencedClasses: []
  11187. }),
  11188. smalltalk.SequenceableCollection);
  11189. smalltalk.addMethod(
  11190. smalltalk.method({
  11191. selector: "deepCopy",
  11192. category: 'copying',
  11193. fn: function (){
  11194. var self=this;
  11195. var newCollection;
  11196. return smalltalk.withContext(function($ctx1) {
  11197. var $1;
  11198. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  11199. _st(self)._withIndexDo_((function(each,index){
  11200. return smalltalk.withContext(function($ctx2) {
  11201. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  11202. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  11203. $1=newCollection;
  11204. return $1;
  11205. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
  11206. args: [],
  11207. source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [:each :index |\x0a\x09\x09newCollection at: index put: each deepCopy].\x0a\x09^newCollection",
  11208. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
  11209. referencedClasses: []
  11210. }),
  11211. smalltalk.SequenceableCollection);
  11212. smalltalk.addMethod(
  11213. smalltalk.method({
  11214. selector: "detect:ifNone:",
  11215. category: 'enumerating',
  11216. fn: function (aBlock,anotherBlock){
  11217. var self=this;
  11218. return smalltalk.withContext(function($ctx1) {
  11219. for(var i = 0; i < self.length; i++)
  11220. if(aBlock(self[i]))
  11221. return self[i];
  11222. return anotherBlock();
  11223. ;
  11224. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.SequenceableCollection)})},
  11225. args: ["aBlock", "anotherBlock"],
  11226. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock();\x0a\x09>",
  11227. messageSends: [],
  11228. referencedClasses: []
  11229. }),
  11230. smalltalk.SequenceableCollection);
  11231. smalltalk.addMethod(
  11232. smalltalk.method({
  11233. selector: "do:",
  11234. category: 'enumerating',
  11235. fn: function (aBlock){
  11236. var self=this;
  11237. return smalltalk.withContext(function($ctx1) {
  11238. for(var i=0;i<self.length;i++){aBlock(self[i]);};
  11239. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
  11240. args: ["aBlock"],
  11241. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i]);}>",
  11242. messageSends: [],
  11243. referencedClasses: []
  11244. }),
  11245. smalltalk.SequenceableCollection);
  11246. smalltalk.addMethod(
  11247. smalltalk.method({
  11248. selector: "first",
  11249. category: 'accessing',
  11250. fn: function (){
  11251. var self=this;
  11252. return smalltalk.withContext(function($ctx1) {
  11253. var $1;
  11254. $1=_st(self)._at_((1));
  11255. return $1;
  11256. }, function($ctx1) {$ctx1.fill(self,"first",{},smalltalk.SequenceableCollection)})},
  11257. args: [],
  11258. source: "first\x0a\x09^self at: 1",
  11259. messageSends: ["at:"],
  11260. referencedClasses: []
  11261. }),
  11262. smalltalk.SequenceableCollection);
  11263. smalltalk.addMethod(
  11264. smalltalk.method({
  11265. selector: "first:",
  11266. category: 'accessing',
  11267. fn: function (n){
  11268. var self=this;
  11269. return smalltalk.withContext(function($ctx1) {
  11270. var $1;
  11271. $1=_st(self)._copyFrom_to_((1),n);
  11272. return $1;
  11273. }, function($ctx1) {$ctx1.fill(self,"first:",{n:n},smalltalk.SequenceableCollection)})},
  11274. args: ["n"],
  11275. source: "first: n\x0a\x09\x22Answer the first n elements of the receiver.\x0a\x09Raise an error if there are not enough elements.\x22\x0a\x0a\x09^ self copyFrom: 1 to: n",
  11276. messageSends: ["copyFrom:to:"],
  11277. referencedClasses: []
  11278. }),
  11279. smalltalk.SequenceableCollection);
  11280. smalltalk.addMethod(
  11281. smalltalk.method({
  11282. selector: "fourth",
  11283. category: 'accessing',
  11284. fn: function (){
  11285. var self=this;
  11286. return smalltalk.withContext(function($ctx1) {
  11287. var $1;
  11288. $1=_st(self)._at_((4));
  11289. return $1;
  11290. }, function($ctx1) {$ctx1.fill(self,"fourth",{},smalltalk.SequenceableCollection)})},
  11291. args: [],
  11292. source: "fourth\x0a\x09^self at: 4",
  11293. messageSends: ["at:"],
  11294. referencedClasses: []
  11295. }),
  11296. smalltalk.SequenceableCollection);
  11297. smalltalk.addMethod(
  11298. smalltalk.method({
  11299. selector: "includes:",
  11300. category: 'testing',
  11301. fn: function (anObject){
  11302. var self=this;
  11303. return smalltalk.withContext(function($ctx1) {
  11304. var $1;
  11305. $1=_st(_st(self)._indexOf_ifAbsent_(anObject,(function(){
  11306. return smalltalk.withContext(function($ctx2) {
  11307. return nil;
  11308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._notNil();
  11309. return $1;
  11310. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.SequenceableCollection)})},
  11311. args: ["anObject"],
  11312. source: "includes: anObject\x0a\x09^(self indexOf: anObject ifAbsent: [nil]) notNil",
  11313. messageSends: ["notNil", "indexOf:ifAbsent:"],
  11314. referencedClasses: []
  11315. }),
  11316. smalltalk.SequenceableCollection);
  11317. smalltalk.addMethod(
  11318. smalltalk.method({
  11319. selector: "indexOf:ifAbsent:",
  11320. category: 'accessing',
  11321. fn: function (anObject,aBlock){
  11322. var self=this;
  11323. return smalltalk.withContext(function($ctx1) {
  11324. for(var i=0;i<self.length;i++) {
  11325. if(self[i].__eq(anObject)) {return i+1}
  11326. };
  11327. return aBlock();
  11328. ;
  11329. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  11330. args: ["anObject", "aBlock"],
  11331. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock();\x0a\x09>",
  11332. messageSends: [],
  11333. referencedClasses: []
  11334. }),
  11335. smalltalk.SequenceableCollection);
  11336. smalltalk.addMethod(
  11337. smalltalk.method({
  11338. selector: "indexOf:startingAt:",
  11339. category: 'accessing',
  11340. fn: function (anObject,start){
  11341. var self=this;
  11342. return smalltalk.withContext(function($ctx1) {
  11343. var $1;
  11344. $1=_st(self)._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  11345. return smalltalk.withContext(function($ctx2) {
  11346. return (0);
  11347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11348. return $1;
  11349. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},smalltalk.SequenceableCollection)})},
  11350. args: ["anObject", "start"],
  11351. source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^self indexOf: anObject startingAt: start ifAbsent: [0]",
  11352. messageSends: ["indexOf:startingAt:ifAbsent:"],
  11353. referencedClasses: []
  11354. }),
  11355. smalltalk.SequenceableCollection);
  11356. smalltalk.addMethod(
  11357. smalltalk.method({
  11358. selector: "indexOf:startingAt:ifAbsent:",
  11359. category: 'accessing',
  11360. fn: function (anObject,start,aBlock){
  11361. var self=this;
  11362. return smalltalk.withContext(function($ctx1) {
  11363. for(var i=start-1;i<self.length;i++){
  11364. if(self[i].__eq(anObject)) {return i+1}
  11365. }
  11366. return aBlock();
  11367. ;
  11368. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  11369. args: ["anObject", "start", "aBlock"],
  11370. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=start-1;i<self.length;i++){\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock();\x0a\x09>",
  11371. messageSends: [],
  11372. referencedClasses: []
  11373. }),
  11374. smalltalk.SequenceableCollection);
  11375. smalltalk.addMethod(
  11376. smalltalk.method({
  11377. selector: "last",
  11378. category: 'accessing',
  11379. fn: function (){
  11380. var self=this;
  11381. return smalltalk.withContext(function($ctx1) {
  11382. var $1;
  11383. $1=_st(self)._at_(_st(self)._size());
  11384. return $1;
  11385. }, function($ctx1) {$ctx1.fill(self,"last",{},smalltalk.SequenceableCollection)})},
  11386. args: [],
  11387. source: "last\x0a\x09^self at: self size",
  11388. messageSends: ["at:", "size"],
  11389. referencedClasses: []
  11390. }),
  11391. smalltalk.SequenceableCollection);
  11392. smalltalk.addMethod(
  11393. smalltalk.method({
  11394. selector: "newStream",
  11395. category: 'streaming',
  11396. fn: function (){
  11397. var self=this;
  11398. return smalltalk.withContext(function($ctx1) {
  11399. var $1;
  11400. $1=_st(_st(self)._streamClass())._on_(self);
  11401. return $1;
  11402. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.SequenceableCollection)})},
  11403. args: [],
  11404. source: "newStream\x0a\x09^self streamClass on: self",
  11405. messageSends: ["on:", "streamClass"],
  11406. referencedClasses: []
  11407. }),
  11408. smalltalk.SequenceableCollection);
  11409. smalltalk.addMethod(
  11410. smalltalk.method({
  11411. selector: "readStream",
  11412. category: 'streaming',
  11413. fn: function (){
  11414. var self=this;
  11415. return smalltalk.withContext(function($ctx1) {
  11416. var $1;
  11417. $1=_st(self)._stream();
  11418. return $1;
  11419. }, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.SequenceableCollection)})},
  11420. args: [],
  11421. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
  11422. messageSends: ["stream"],
  11423. referencedClasses: []
  11424. }),
  11425. smalltalk.SequenceableCollection);
  11426. smalltalk.addMethod(
  11427. smalltalk.method({
  11428. selector: "removeLast",
  11429. category: 'adding',
  11430. fn: function (){
  11431. var self=this;
  11432. return smalltalk.withContext(function($ctx1) {
  11433. _st(self)._remove_(_st(self)._last());
  11434. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},smalltalk.SequenceableCollection)})},
  11435. args: [],
  11436. source: "removeLast\x0a\x09self remove: self last",
  11437. messageSends: ["remove:", "last"],
  11438. referencedClasses: []
  11439. }),
  11440. smalltalk.SequenceableCollection);
  11441. smalltalk.addMethod(
  11442. smalltalk.method({
  11443. selector: "reversed",
  11444. category: 'converting',
  11445. fn: function (){
  11446. var self=this;
  11447. return smalltalk.withContext(function($ctx1) {
  11448. _st(self)._subclassResponsibility();
  11449. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.SequenceableCollection)})},
  11450. args: [],
  11451. source: "reversed\x0a\x09self subclassResponsibility",
  11452. messageSends: ["subclassResponsibility"],
  11453. referencedClasses: []
  11454. }),
  11455. smalltalk.SequenceableCollection);
  11456. smalltalk.addMethod(
  11457. smalltalk.method({
  11458. selector: "second",
  11459. category: 'accessing',
  11460. fn: function (){
  11461. var self=this;
  11462. return smalltalk.withContext(function($ctx1) {
  11463. var $1;
  11464. $1=_st(self)._at_((2));
  11465. return $1;
  11466. }, function($ctx1) {$ctx1.fill(self,"second",{},smalltalk.SequenceableCollection)})},
  11467. args: [],
  11468. source: "second\x0a\x09^self at: 2",
  11469. messageSends: ["at:"],
  11470. referencedClasses: []
  11471. }),
  11472. smalltalk.SequenceableCollection);
  11473. smalltalk.addMethod(
  11474. smalltalk.method({
  11475. selector: "shallowCopy",
  11476. category: 'copying',
  11477. fn: function (){
  11478. var self=this;
  11479. var newCollection;
  11480. return smalltalk.withContext(function($ctx1) {
  11481. var $1;
  11482. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  11483. _st(self)._withIndexDo_((function(each,index){
  11484. return smalltalk.withContext(function($ctx2) {
  11485. return _st(newCollection)._at_put_(index,each);
  11486. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  11487. $1=newCollection;
  11488. return $1;
  11489. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
  11490. args: [],
  11491. source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each].\x0a\x09^newCollection",
  11492. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
  11493. referencedClasses: []
  11494. }),
  11495. smalltalk.SequenceableCollection);
  11496. smalltalk.addMethod(
  11497. smalltalk.method({
  11498. selector: "stream",
  11499. category: 'streaming',
  11500. fn: function (){
  11501. var self=this;
  11502. return smalltalk.withContext(function($ctx1) {
  11503. var $1;
  11504. $1=_st(self)._newStream();
  11505. return $1;
  11506. }, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.SequenceableCollection)})},
  11507. args: [],
  11508. source: "stream\x0a\x09^self newStream",
  11509. messageSends: ["newStream"],
  11510. referencedClasses: []
  11511. }),
  11512. smalltalk.SequenceableCollection);
  11513. smalltalk.addMethod(
  11514. smalltalk.method({
  11515. selector: "streamClass",
  11516. category: 'streaming',
  11517. fn: function (){
  11518. var self=this;
  11519. return smalltalk.withContext(function($ctx1) {
  11520. var $1;
  11521. $1=_st(_st(self)._class())._streamClass();
  11522. return $1;
  11523. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection)})},
  11524. args: [],
  11525. source: "streamClass\x0a\x09^self class streamClass",
  11526. messageSends: ["streamClass", "class"],
  11527. referencedClasses: []
  11528. }),
  11529. smalltalk.SequenceableCollection);
  11530. smalltalk.addMethod(
  11531. smalltalk.method({
  11532. selector: "third",
  11533. category: 'accessing',
  11534. fn: function (){
  11535. var self=this;
  11536. return smalltalk.withContext(function($ctx1) {
  11537. var $1;
  11538. $1=_st(self)._at_((3));
  11539. return $1;
  11540. }, function($ctx1) {$ctx1.fill(self,"third",{},smalltalk.SequenceableCollection)})},
  11541. args: [],
  11542. source: "third\x0a\x09^self at: 3",
  11543. messageSends: ["at:"],
  11544. referencedClasses: []
  11545. }),
  11546. smalltalk.SequenceableCollection);
  11547. smalltalk.addMethod(
  11548. smalltalk.method({
  11549. selector: "with:do:",
  11550. category: 'enumerating',
  11551. fn: function (anotherCollection,aBlock){
  11552. var self=this;
  11553. return smalltalk.withContext(function($ctx1) {
  11554. for(var i=0;i<self.length;i++){aBlock(self[i], anotherCollection[i]);};
  11555. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  11556. args: ["anotherCollection", "aBlock"],
  11557. source: "with: anotherCollection do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], anotherCollection[i]);}>",
  11558. messageSends: [],
  11559. referencedClasses: []
  11560. }),
  11561. smalltalk.SequenceableCollection);
  11562. smalltalk.addMethod(
  11563. smalltalk.method({
  11564. selector: "withIndexDo:",
  11565. category: 'enumerating',
  11566. fn: function (aBlock){
  11567. var self=this;
  11568. return smalltalk.withContext(function($ctx1) {
  11569. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  11570. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
  11571. args: ["aBlock"],
  11572. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
  11573. messageSends: [],
  11574. referencedClasses: []
  11575. }),
  11576. smalltalk.SequenceableCollection);
  11577. smalltalk.addMethod(
  11578. smalltalk.method({
  11579. selector: "writeStream",
  11580. category: 'streaming',
  11581. fn: function (){
  11582. var self=this;
  11583. return smalltalk.withContext(function($ctx1) {
  11584. var $1;
  11585. $1=_st(self)._stream();
  11586. return $1;
  11587. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.SequenceableCollection)})},
  11588. args: [],
  11589. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
  11590. messageSends: ["stream"],
  11591. referencedClasses: []
  11592. }),
  11593. smalltalk.SequenceableCollection);
  11594. smalltalk.addMethod(
  11595. smalltalk.method({
  11596. selector: "streamClass",
  11597. category: 'accessing',
  11598. fn: function (){
  11599. var self=this;
  11600. function $Stream(){return smalltalk.Stream||(typeof Stream=="undefined"?nil:Stream)}
  11601. return smalltalk.withContext(function($ctx1) {
  11602. var $1;
  11603. $1=$Stream();
  11604. return $1;
  11605. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection.klass)})},
  11606. args: [],
  11607. source: "streamClass\x0a\x09\x09^Stream",
  11608. messageSends: [],
  11609. referencedClasses: ["Stream"]
  11610. }),
  11611. smalltalk.SequenceableCollection.klass);
  11612. smalltalk.addMethod(
  11613. smalltalk.method({
  11614. selector: "streamContents:",
  11615. category: 'streaming',
  11616. fn: function (aBlock){
  11617. var self=this;
  11618. var stream;
  11619. return smalltalk.withContext(function($ctx1) {
  11620. var $1;
  11621. stream=_st(_st(self)._streamClass())._on_(_st(self)._new());
  11622. _st(aBlock)._value_(stream);
  11623. $1=_st(stream)._contents();
  11624. return $1;
  11625. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},smalltalk.SequenceableCollection.klass)})},
  11626. args: ["aBlock"],
  11627. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  11628. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  11629. referencedClasses: []
  11630. }),
  11631. smalltalk.SequenceableCollection.klass);
  11632. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  11633. smalltalk.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0aIn Amber, OrderedCollection is an alias for Array."
  11634. smalltalk.addMethod(
  11635. smalltalk.method({
  11636. selector: "add:",
  11637. category: 'adding/removing',
  11638. fn: function (anObject){
  11639. var self=this;
  11640. return smalltalk.withContext(function($ctx1) {
  11641. self.push(anObject); return anObject;;
  11642. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Array)})},
  11643. args: ["anObject"],
  11644. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  11645. messageSends: [],
  11646. referencedClasses: []
  11647. }),
  11648. smalltalk.Array);
  11649. smalltalk.addMethod(
  11650. smalltalk.method({
  11651. selector: "asJavascript",
  11652. category: 'converting',
  11653. fn: function (){
  11654. var self=this;
  11655. return smalltalk.withContext(function($ctx1) {
  11656. var $1;
  11657. $1=_st(_st("[").__comma(_st(_st(self)._collect_((function(each){
  11658. return smalltalk.withContext(function($ctx2) {
  11659. return _st(each)._asJavascript();
  11660. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(", "))).__comma("]");
  11661. return $1;
  11662. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Array)})},
  11663. args: [],
  11664. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  11665. messageSends: [",", "join:", "collect:", "asJavascript"],
  11666. referencedClasses: []
  11667. }),
  11668. smalltalk.Array);
  11669. smalltalk.addMethod(
  11670. smalltalk.method({
  11671. selector: "at:ifAbsent:",
  11672. category: 'accessing',
  11673. fn: function (anIndex,aBlock){
  11674. var self=this;
  11675. return smalltalk.withContext(function($ctx1) {
  11676. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  11677. return self[anIndex - 1];
  11678. ;
  11679. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.Array)})},
  11680. args: ["anIndex", "aBlock"],
  11681. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};\x0a\x09\x09return self[anIndex - 1];\x0a\x09>",
  11682. messageSends: [],
  11683. referencedClasses: []
  11684. }),
  11685. smalltalk.Array);
  11686. smalltalk.addMethod(
  11687. smalltalk.method({
  11688. selector: "at:put:",
  11689. category: 'accessing',
  11690. fn: function (anIndex,anObject){
  11691. var self=this;
  11692. return smalltalk.withContext(function($ctx1) {
  11693. return self[anIndex - 1] = anObject;
  11694. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.Array)})},
  11695. args: ["anIndex", "anObject"],
  11696. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  11697. messageSends: [],
  11698. referencedClasses: []
  11699. }),
  11700. smalltalk.Array);
  11701. smalltalk.addMethod(
  11702. smalltalk.method({
  11703. selector: "join:",
  11704. category: 'enumerating',
  11705. fn: function (aString){
  11706. var self=this;
  11707. return smalltalk.withContext(function($ctx1) {
  11708. return self.join(aString);
  11709. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},smalltalk.Array)})},
  11710. args: ["aString"],
  11711. source: "join: aString\x0a\x09<return self.join(aString)>",
  11712. messageSends: [],
  11713. referencedClasses: []
  11714. }),
  11715. smalltalk.Array);
  11716. smalltalk.addMethod(
  11717. smalltalk.method({
  11718. selector: "printOn:",
  11719. category: 'printing',
  11720. fn: function (aStream){
  11721. var self=this;
  11722. return smalltalk.withContext(function($ctx1) {
  11723. smalltalk.SequenceableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]);
  11724. _st(aStream)._nextPutAll_(" (");
  11725. _st(self)._do_separatedBy_((function(each){
  11726. return smalltalk.withContext(function($ctx2) {
  11727. return _st(each)._printOn_(aStream);
  11728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  11729. return smalltalk.withContext(function($ctx2) {
  11730. return _st(aStream)._nextPutAll_(" ");
  11731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11732. _st(aStream)._nextPutAll_(")");
  11733. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Array)})},
  11734. args: ["aStream"],
  11735. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  11736. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  11737. referencedClasses: []
  11738. }),
  11739. smalltalk.Array);
  11740. smalltalk.addMethod(
  11741. smalltalk.method({
  11742. selector: "remove:ifAbsent:",
  11743. category: 'adding/removing',
  11744. fn: function (anObject,aBlock){
  11745. var self=this;
  11746. return smalltalk.withContext(function($ctx1) {
  11747. for(var i=0;i<self.length;i++) {
  11748. if(self[i] == anObject) {
  11749. self.splice(i,1);
  11750. return self;
  11751. }
  11752. };
  11753. aBlock._value();
  11754. ;
  11755. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Array)})},
  11756. args: ["anObject", "aBlock"],
  11757. source: "remove: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i] == anObject) {\x0a\x09\x09\x09\x09self.splice(i,1);\x0a\x09\x09\x09\x09return self;\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09aBlock._value();\x0a\x09>",
  11758. messageSends: [],
  11759. referencedClasses: []
  11760. }),
  11761. smalltalk.Array);
  11762. smalltalk.addMethod(
  11763. smalltalk.method({
  11764. selector: "removeFrom:to:",
  11765. category: 'adding/removing',
  11766. fn: function (aNumber,anotherNumber){
  11767. var self=this;
  11768. return smalltalk.withContext(function($ctx1) {
  11769. self.splice(aNumber - 1,anotherNumber - 1);
  11770. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Array)})},
  11771. args: ["aNumber", "anotherNumber"],
  11772. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  11773. messageSends: [],
  11774. referencedClasses: []
  11775. }),
  11776. smalltalk.Array);
  11777. smalltalk.addMethod(
  11778. smalltalk.method({
  11779. selector: "reversed",
  11780. category: 'converting',
  11781. fn: function (){
  11782. var self=this;
  11783. return smalltalk.withContext(function($ctx1) {
  11784. return self._copy().reverse();
  11785. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.Array)})},
  11786. args: [],
  11787. source: "reversed\x0a\x09<return self._copy().reverse()>",
  11788. messageSends: [],
  11789. referencedClasses: []
  11790. }),
  11791. smalltalk.Array);
  11792. smalltalk.addMethod(
  11793. smalltalk.method({
  11794. selector: "size",
  11795. category: 'accessing',
  11796. fn: function (){
  11797. var self=this;
  11798. return smalltalk.withContext(function($ctx1) {
  11799. return self.length;
  11800. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Array)})},
  11801. args: [],
  11802. source: "size\x0a\x09<return self.length>",
  11803. messageSends: [],
  11804. referencedClasses: []
  11805. }),
  11806. smalltalk.Array);
  11807. smalltalk.addMethod(
  11808. smalltalk.method({
  11809. selector: "sort",
  11810. category: 'enumerating',
  11811. fn: function (){
  11812. var self=this;
  11813. return smalltalk.withContext(function($ctx1) {
  11814. var $1;
  11815. $1=_st(self)._basicPerform_("sort");
  11816. return $1;
  11817. }, function($ctx1) {$ctx1.fill(self,"sort",{},smalltalk.Array)})},
  11818. args: [],
  11819. source: "sort\x0a\x09^self basicPerform: 'sort'",
  11820. messageSends: ["basicPerform:"],
  11821. referencedClasses: []
  11822. }),
  11823. smalltalk.Array);
  11824. smalltalk.addMethod(
  11825. smalltalk.method({
  11826. selector: "sort:",
  11827. category: 'enumerating',
  11828. fn: function (aBlock){
  11829. var self=this;
  11830. return smalltalk.withContext(function($ctx1) {
  11831. return self.sort(function(a, b) {
  11832. if(aBlock(a,b)) {return -1} else {return 1}
  11833. })
  11834. ;
  11835. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},smalltalk.Array)})},
  11836. args: ["aBlock"],
  11837. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  11838. messageSends: [],
  11839. referencedClasses: []
  11840. }),
  11841. smalltalk.Array);
  11842. smalltalk.addMethod(
  11843. smalltalk.method({
  11844. selector: "sorted",
  11845. category: 'enumerating',
  11846. fn: function (){
  11847. var self=this;
  11848. return smalltalk.withContext(function($ctx1) {
  11849. var $1;
  11850. $1=_st(_st(self)._copy())._sort();
  11851. return $1;
  11852. }, function($ctx1) {$ctx1.fill(self,"sorted",{},smalltalk.Array)})},
  11853. args: [],
  11854. source: "sorted\x0a\x09^self copy sort",
  11855. messageSends: ["sort", "copy"],
  11856. referencedClasses: []
  11857. }),
  11858. smalltalk.Array);
  11859. smalltalk.addMethod(
  11860. smalltalk.method({
  11861. selector: "sorted:",
  11862. category: 'enumerating',
  11863. fn: function (aBlock){
  11864. var self=this;
  11865. return smalltalk.withContext(function($ctx1) {
  11866. var $1;
  11867. $1=_st(_st(self)._copy())._sort_(aBlock);
  11868. return $1;
  11869. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},smalltalk.Array)})},
  11870. args: ["aBlock"],
  11871. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  11872. messageSends: ["sort:", "copy"],
  11873. referencedClasses: []
  11874. }),
  11875. smalltalk.Array);
  11876. smalltalk.addMethod(
  11877. smalltalk.method({
  11878. selector: "new:",
  11879. category: 'instance creation',
  11880. fn: function (anInteger){
  11881. var self=this;
  11882. return smalltalk.withContext(function($ctx1) {
  11883. return new Array(anInteger);
  11884. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Array.klass)})},
  11885. args: ["anInteger"],
  11886. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  11887. messageSends: [],
  11888. referencedClasses: []
  11889. }),
  11890. smalltalk.Array.klass);
  11891. smalltalk.addMethod(
  11892. smalltalk.method({
  11893. selector: "with:",
  11894. category: 'instance creation',
  11895. fn: function (anObject){
  11896. var self=this;
  11897. return smalltalk.withContext(function($ctx1) {
  11898. var $2,$3,$1;
  11899. $2=_st(self)._new_((1));
  11900. _st($2)._at_put_((1),anObject);
  11901. $3=_st($2)._yourself();
  11902. $1=$3;
  11903. return $1;
  11904. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Array.klass)})},
  11905. args: ["anObject"],
  11906. source: "with: anObject\x0a\x09\x09^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  11907. messageSends: ["at:put:", "new:", "yourself"],
  11908. referencedClasses: []
  11909. }),
  11910. smalltalk.Array.klass);
  11911. smalltalk.addMethod(
  11912. smalltalk.method({
  11913. selector: "with:with:",
  11914. category: 'instance creation',
  11915. fn: function (anObject,anObject2){
  11916. var self=this;
  11917. return smalltalk.withContext(function($ctx1) {
  11918. var $2,$3,$1;
  11919. $2=_st(self)._new_((2));
  11920. _st($2)._at_put_((1),anObject);
  11921. _st($2)._at_put_((2),anObject2);
  11922. $3=_st($2)._yourself();
  11923. $1=$3;
  11924. return $1;
  11925. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},smalltalk.Array.klass)})},
  11926. args: ["anObject", "anObject2"],
  11927. source: "with: anObject with: anObject2\x0a\x09\x09^(self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  11928. messageSends: ["at:put:", "new:", "yourself"],
  11929. referencedClasses: []
  11930. }),
  11931. smalltalk.Array.klass);
  11932. smalltalk.addMethod(
  11933. smalltalk.method({
  11934. selector: "with:with:with:",
  11935. category: 'instance creation',
  11936. fn: function (anObject,anObject2,anObject3){
  11937. var self=this;
  11938. return smalltalk.withContext(function($ctx1) {
  11939. var $2,$3,$1;
  11940. $2=_st(self)._new_((3));
  11941. _st($2)._at_put_((1),anObject);
  11942. _st($2)._at_put_((2),anObject2);
  11943. _st($2)._at_put_((3),anObject3);
  11944. $3=_st($2)._yourself();
  11945. $1=$3;
  11946. return $1;
  11947. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.Array.klass)})},
  11948. args: ["anObject", "anObject2", "anObject3"],
  11949. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^(self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  11950. messageSends: ["at:put:", "new:", "yourself"],
  11951. referencedClasses: []
  11952. }),
  11953. smalltalk.Array.klass);
  11954. smalltalk.addMethod(
  11955. smalltalk.method({
  11956. selector: "withAll:",
  11957. category: 'instance creation',
  11958. fn: function (aCollection){
  11959. var self=this;
  11960. var instance,index;
  11961. return smalltalk.withContext(function($ctx1) {
  11962. var $1;
  11963. index=(1);
  11964. instance=_st(self)._new_(_st(aCollection)._size());
  11965. _st(aCollection)._do_((function(each){
  11966. return smalltalk.withContext(function($ctx2) {
  11967. _st(instance)._at_put_(index,each);
  11968. index=_st(index).__plus((1));
  11969. return index;
  11970. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11971. $1=instance;
  11972. return $1;
  11973. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},smalltalk.Array.klass)})},
  11974. args: ["aCollection"],
  11975. source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [:each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1].\x0a\x09^instance",
  11976. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  11977. referencedClasses: []
  11978. }),
  11979. smalltalk.Array.klass);
  11980. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  11981. smalltalk.CharacterArray.comment="I am the abstract superclass of string-like collections."
  11982. smalltalk.addMethod(
  11983. smalltalk.method({
  11984. selector: ",",
  11985. category: 'copying',
  11986. fn: function (aString){
  11987. var self=this;
  11988. return smalltalk.withContext(function($ctx1) {
  11989. var $1;
  11990. $1=_st(_st(self)._asString()).__comma(_st(aString)._asString());
  11991. return $1;
  11992. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.CharacterArray)})},
  11993. args: ["aString"],
  11994. source: ", aString\x0a\x09^self asString, aString asString",
  11995. messageSends: [",", "asString"],
  11996. referencedClasses: []
  11997. }),
  11998. smalltalk.CharacterArray);
  11999. smalltalk.addMethod(
  12000. smalltalk.method({
  12001. selector: "add:",
  12002. category: 'adding',
  12003. fn: function (anObject){
  12004. var self=this;
  12005. return smalltalk.withContext(function($ctx1) {
  12006. _st(self)._errorReadOnly();
  12007. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.CharacterArray)})},
  12008. args: ["anObject"],
  12009. source: "add: anObject\x0a\x09self errorReadOnly",
  12010. messageSends: ["errorReadOnly"],
  12011. referencedClasses: []
  12012. }),
  12013. smalltalk.CharacterArray);
  12014. smalltalk.addMethod(
  12015. smalltalk.method({
  12016. selector: "asLowercase",
  12017. category: 'converting',
  12018. fn: function (){
  12019. var self=this;
  12020. return smalltalk.withContext(function($ctx1) {
  12021. var $1;
  12022. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asLowercase());
  12023. return $1;
  12024. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.CharacterArray)})},
  12025. args: [],
  12026. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  12027. messageSends: ["fromString:", "asLowercase", "asString", "class"],
  12028. referencedClasses: []
  12029. }),
  12030. smalltalk.CharacterArray);
  12031. smalltalk.addMethod(
  12032. smalltalk.method({
  12033. selector: "asNumber",
  12034. category: 'converting',
  12035. fn: function (){
  12036. var self=this;
  12037. return smalltalk.withContext(function($ctx1) {
  12038. var $1;
  12039. $1=_st(_st(self)._asString())._asNumber();
  12040. return $1;
  12041. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.CharacterArray)})},
  12042. args: [],
  12043. source: "asNumber\x0a\x09^self asString asNumber",
  12044. messageSends: ["asNumber", "asString"],
  12045. referencedClasses: []
  12046. }),
  12047. smalltalk.CharacterArray);
  12048. smalltalk.addMethod(
  12049. smalltalk.method({
  12050. selector: "asString",
  12051. category: 'converting',
  12052. fn: function (){
  12053. var self=this;
  12054. return smalltalk.withContext(function($ctx1) {
  12055. var $1;
  12056. $1=_st(self)._subclassResponsibility();
  12057. return $1;
  12058. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.CharacterArray)})},
  12059. args: [],
  12060. source: "asString\x0a\x09^self subclassResponsibility",
  12061. messageSends: ["subclassResponsibility"],
  12062. referencedClasses: []
  12063. }),
  12064. smalltalk.CharacterArray);
  12065. smalltalk.addMethod(
  12066. smalltalk.method({
  12067. selector: "asSymbol",
  12068. category: 'converting',
  12069. fn: function (){
  12070. var self=this;
  12071. return smalltalk.withContext(function($ctx1) {
  12072. var $1;
  12073. $1=_st(self)._asString();
  12074. return $1;
  12075. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.CharacterArray)})},
  12076. args: [],
  12077. source: "asSymbol\x0a\x09^self asString",
  12078. messageSends: ["asString"],
  12079. referencedClasses: []
  12080. }),
  12081. smalltalk.CharacterArray);
  12082. smalltalk.addMethod(
  12083. smalltalk.method({
  12084. selector: "asUppercase",
  12085. category: 'converting',
  12086. fn: function (){
  12087. var self=this;
  12088. return smalltalk.withContext(function($ctx1) {
  12089. var $1;
  12090. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asUppercase());
  12091. return $1;
  12092. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.CharacterArray)})},
  12093. args: [],
  12094. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  12095. messageSends: ["fromString:", "asUppercase", "asString", "class"],
  12096. referencedClasses: []
  12097. }),
  12098. smalltalk.CharacterArray);
  12099. smalltalk.addMethod(
  12100. smalltalk.method({
  12101. selector: "at:put:",
  12102. category: 'accessing',
  12103. fn: function (anIndex,anObject){
  12104. var self=this;
  12105. return smalltalk.withContext(function($ctx1) {
  12106. _st(self)._errorReadOnly();
  12107. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.CharacterArray)})},
  12108. args: ["anIndex", "anObject"],
  12109. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  12110. messageSends: ["errorReadOnly"],
  12111. referencedClasses: []
  12112. }),
  12113. smalltalk.CharacterArray);
  12114. smalltalk.addMethod(
  12115. smalltalk.method({
  12116. selector: "errorReadOnly",
  12117. category: 'error handling',
  12118. fn: function (){
  12119. var self=this;
  12120. return smalltalk.withContext(function($ctx1) {
  12121. _st(self)._error_("Object is read-only");
  12122. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},smalltalk.CharacterArray)})},
  12123. args: [],
  12124. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  12125. messageSends: ["error:"],
  12126. referencedClasses: []
  12127. }),
  12128. smalltalk.CharacterArray);
  12129. smalltalk.addMethod(
  12130. smalltalk.method({
  12131. selector: "printOn:",
  12132. category: 'printing',
  12133. fn: function (aStream){
  12134. var self=this;
  12135. return smalltalk.withContext(function($ctx1) {
  12136. _st(_st(self)._asString())._printOn_(aStream);
  12137. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.CharacterArray)})},
  12138. args: ["aStream"],
  12139. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  12140. messageSends: ["printOn:", "asString"],
  12141. referencedClasses: []
  12142. }),
  12143. smalltalk.CharacterArray);
  12144. smalltalk.addMethod(
  12145. smalltalk.method({
  12146. selector: "putOn:",
  12147. category: 'streaming',
  12148. fn: function (aStream){
  12149. var self=this;
  12150. return smalltalk.withContext(function($ctx1) {
  12151. _st(aStream)._nextPutString_(self);
  12152. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.CharacterArray)})},
  12153. args: ["aStream"],
  12154. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  12155. messageSends: ["nextPutString:"],
  12156. referencedClasses: []
  12157. }),
  12158. smalltalk.CharacterArray);
  12159. smalltalk.addMethod(
  12160. smalltalk.method({
  12161. selector: "remove:",
  12162. category: 'adding',
  12163. fn: function (anObject){
  12164. var self=this;
  12165. return smalltalk.withContext(function($ctx1) {
  12166. _st(self)._errorReadOnly();
  12167. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.CharacterArray)})},
  12168. args: ["anObject"],
  12169. source: "remove: anObject\x0a\x09self errorReadOnly",
  12170. messageSends: ["errorReadOnly"],
  12171. referencedClasses: []
  12172. }),
  12173. smalltalk.CharacterArray);
  12174. smalltalk.addMethod(
  12175. smalltalk.method({
  12176. selector: "fromString:",
  12177. category: 'instance creation',
  12178. fn: function (aString){
  12179. var self=this;
  12180. return smalltalk.withContext(function($ctx1) {
  12181. _st(self)._subclassResponsibility();
  12182. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.CharacterArray.klass)})},
  12183. args: ["aString"],
  12184. source: "fromString: aString\x0a\x09self subclassResponsibility",
  12185. messageSends: ["subclassResponsibility"],
  12186. referencedClasses: []
  12187. }),
  12188. smalltalk.CharacterArray.klass);
  12189. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  12190. smalltalk.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`"
  12191. smalltalk.addMethod(
  12192. smalltalk.method({
  12193. selector: ",",
  12194. category: 'copying',
  12195. fn: function (aString){
  12196. var self=this;
  12197. return smalltalk.withContext(function($ctx1) {
  12198. return self + aString;
  12199. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.String)})},
  12200. args: ["aString"],
  12201. source: ", aString\x0a\x09<return self + aString>",
  12202. messageSends: [],
  12203. referencedClasses: []
  12204. }),
  12205. smalltalk.String);
  12206. smalltalk.addMethod(
  12207. smalltalk.method({
  12208. selector: "<",
  12209. category: 'comparing',
  12210. fn: function (aString){
  12211. var self=this;
  12212. return smalltalk.withContext(function($ctx1) {
  12213. return String(self) < aString._asString();
  12214. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},smalltalk.String)})},
  12215. args: ["aString"],
  12216. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  12217. messageSends: [],
  12218. referencedClasses: []
  12219. }),
  12220. smalltalk.String);
  12221. smalltalk.addMethod(
  12222. smalltalk.method({
  12223. selector: "<=",
  12224. category: 'comparing',
  12225. fn: function (aString){
  12226. var self=this;
  12227. return smalltalk.withContext(function($ctx1) {
  12228. return String(self) <= aString._asString();
  12229. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},smalltalk.String)})},
  12230. args: ["aString"],
  12231. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  12232. messageSends: [],
  12233. referencedClasses: []
  12234. }),
  12235. smalltalk.String);
  12236. smalltalk.addMethod(
  12237. smalltalk.method({
  12238. selector: "=",
  12239. category: 'comparing',
  12240. fn: function (aString){
  12241. var self=this;
  12242. return smalltalk.withContext(function($ctx1) {
  12243. if(typeof aString === 'undefined') { return false }
  12244. if(!aString._isString || ! aString._isString()) {
  12245. return false;
  12246. }
  12247. return String(self) === String(aString)
  12248. ;
  12249. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},smalltalk.String)})},
  12250. args: ["aString"],
  12251. source: "= aString\x0a\x09<\x0a\x09\x09if(typeof aString === 'undefined') { return false }\x0a\x09\x09if(!aString._isString || ! aString._isString()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return String(self) === String(aString)\x0a\x09>",
  12252. messageSends: [],
  12253. referencedClasses: []
  12254. }),
  12255. smalltalk.String);
  12256. smalltalk.addMethod(
  12257. smalltalk.method({
  12258. selector: "==",
  12259. category: 'comparing',
  12260. fn: function (aString){
  12261. var self=this;
  12262. return smalltalk.withContext(function($ctx1) {
  12263. var $1;
  12264. $1=_st(self).__eq(aString);
  12265. return $1;
  12266. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},smalltalk.String)})},
  12267. args: ["aString"],
  12268. source: "== aString\x0a\x09^self = aString",
  12269. messageSends: ["="],
  12270. referencedClasses: []
  12271. }),
  12272. smalltalk.String);
  12273. smalltalk.addMethod(
  12274. smalltalk.method({
  12275. selector: ">",
  12276. category: 'comparing',
  12277. fn: function (aString){
  12278. var self=this;
  12279. return smalltalk.withContext(function($ctx1) {
  12280. return String(self) > aString._asString();
  12281. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},smalltalk.String)})},
  12282. args: ["aString"],
  12283. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  12284. messageSends: [],
  12285. referencedClasses: []
  12286. }),
  12287. smalltalk.String);
  12288. smalltalk.addMethod(
  12289. smalltalk.method({
  12290. selector: ">=",
  12291. category: 'comparing',
  12292. fn: function (aString){
  12293. var self=this;
  12294. return smalltalk.withContext(function($ctx1) {
  12295. return String(self) >= aString._asString();
  12296. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},smalltalk.String)})},
  12297. args: ["aString"],
  12298. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  12299. messageSends: [],
  12300. referencedClasses: []
  12301. }),
  12302. smalltalk.String);
  12303. smalltalk.addMethod(
  12304. smalltalk.method({
  12305. selector: "asJSON",
  12306. category: 'converting',
  12307. fn: function (){
  12308. var self=this;
  12309. return smalltalk.withContext(function($ctx1) {
  12310. var $1;
  12311. $1=self;
  12312. return $1;
  12313. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.String)})},
  12314. args: [],
  12315. source: "asJSON\x0a\x09^self",
  12316. messageSends: [],
  12317. referencedClasses: []
  12318. }),
  12319. smalltalk.String);
  12320. smalltalk.addMethod(
  12321. smalltalk.method({
  12322. selector: "asJavascript",
  12323. category: 'converting',
  12324. fn: function (){
  12325. var self=this;
  12326. return smalltalk.withContext(function($ctx1) {
  12327. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  12328. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  12329. else
  12330. return "\"" + self + "\"";
  12331. ;
  12332. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.String)})},
  12333. args: [],
  12334. source: "asJavascript\x0a\x09<\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09>",
  12335. messageSends: [],
  12336. referencedClasses: []
  12337. }),
  12338. smalltalk.String);
  12339. smalltalk.addMethod(
  12340. smalltalk.method({
  12341. selector: "asLowercase",
  12342. category: 'converting',
  12343. fn: function (){
  12344. var self=this;
  12345. return smalltalk.withContext(function($ctx1) {
  12346. return self.toLowerCase();
  12347. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.String)})},
  12348. args: [],
  12349. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  12350. messageSends: [],
  12351. referencedClasses: []
  12352. }),
  12353. smalltalk.String);
  12354. smalltalk.addMethod(
  12355. smalltalk.method({
  12356. selector: "asNumber",
  12357. category: 'converting',
  12358. fn: function (){
  12359. var self=this;
  12360. return smalltalk.withContext(function($ctx1) {
  12361. return Number(self);
  12362. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.String)})},
  12363. args: [],
  12364. source: "asNumber\x0a\x09<return Number(self)>",
  12365. messageSends: [],
  12366. referencedClasses: []
  12367. }),
  12368. smalltalk.String);
  12369. smalltalk.addMethod(
  12370. smalltalk.method({
  12371. selector: "asRegexp",
  12372. category: 'converting',
  12373. fn: function (){
  12374. var self=this;
  12375. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  12376. return smalltalk.withContext(function($ctx1) {
  12377. var $1;
  12378. $1=_st($RegularExpression())._fromString_(self);
  12379. return $1;
  12380. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},smalltalk.String)})},
  12381. args: [],
  12382. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  12383. messageSends: ["fromString:"],
  12384. referencedClasses: ["RegularExpression"]
  12385. }),
  12386. smalltalk.String);
  12387. smalltalk.addMethod(
  12388. smalltalk.method({
  12389. selector: "asSelector",
  12390. category: 'converting',
  12391. fn: function (){
  12392. var self=this;
  12393. return smalltalk.withContext(function($ctx1) {
  12394. return smalltalk.selector(self);
  12395. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},smalltalk.String)})},
  12396. args: [],
  12397. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  12398. messageSends: [],
  12399. referencedClasses: []
  12400. }),
  12401. smalltalk.String);
  12402. smalltalk.addMethod(
  12403. smalltalk.method({
  12404. selector: "asString",
  12405. category: 'converting',
  12406. fn: function (){
  12407. var self=this;
  12408. return smalltalk.withContext(function($ctx1) {
  12409. var $1;
  12410. $1=self;
  12411. return $1;
  12412. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.String)})},
  12413. args: [],
  12414. source: "asString\x0a\x09^self",
  12415. messageSends: [],
  12416. referencedClasses: []
  12417. }),
  12418. smalltalk.String);
  12419. smalltalk.addMethod(
  12420. smalltalk.method({
  12421. selector: "asSymbol",
  12422. category: 'converting',
  12423. fn: function (){
  12424. var self=this;
  12425. return smalltalk.withContext(function($ctx1) {
  12426. var $1;
  12427. $1=self;
  12428. return $1;
  12429. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.String)})},
  12430. args: [],
  12431. source: "asSymbol\x0a\x09^ self",
  12432. messageSends: [],
  12433. referencedClasses: []
  12434. }),
  12435. smalltalk.String);
  12436. smalltalk.addMethod(
  12437. smalltalk.method({
  12438. selector: "asUppercase",
  12439. category: 'converting',
  12440. fn: function (){
  12441. var self=this;
  12442. return smalltalk.withContext(function($ctx1) {
  12443. return self.toUpperCase();
  12444. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.String)})},
  12445. args: [],
  12446. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  12447. messageSends: [],
  12448. referencedClasses: []
  12449. }),
  12450. smalltalk.String);
  12451. smalltalk.addMethod(
  12452. smalltalk.method({
  12453. selector: "asciiValue",
  12454. category: 'accessing',
  12455. fn: function (){
  12456. var self=this;
  12457. return smalltalk.withContext(function($ctx1) {
  12458. return self.charCodeAt(0);;
  12459. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},smalltalk.String)})},
  12460. args: [],
  12461. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  12462. messageSends: [],
  12463. referencedClasses: []
  12464. }),
  12465. smalltalk.String);
  12466. smalltalk.addMethod(
  12467. smalltalk.method({
  12468. selector: "at:ifAbsent:",
  12469. category: 'accessing',
  12470. fn: function (anIndex,aBlock){
  12471. var self=this;
  12472. return smalltalk.withContext(function($ctx1) {
  12473. return String(self).charAt(anIndex - 1) || aBlock();
  12474. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.String)})},
  12475. args: ["anIndex", "aBlock"],
  12476. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock()>",
  12477. messageSends: [],
  12478. referencedClasses: []
  12479. }),
  12480. smalltalk.String);
  12481. smalltalk.addMethod(
  12482. smalltalk.method({
  12483. selector: "charCodeAt:",
  12484. category: 'accessing',
  12485. fn: function (anInteger){
  12486. var self=this;
  12487. return smalltalk.withContext(function($ctx1) {
  12488. return self.charCodeAt(anInteger - 1) ;
  12489. return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},smalltalk.String)})},
  12490. args: ["anInteger"],
  12491. source: "charCodeAt: anInteger\x0a\x09< return self.charCodeAt(anInteger - 1) >",
  12492. messageSends: [],
  12493. referencedClasses: []
  12494. }),
  12495. smalltalk.String);
  12496. smalltalk.addMethod(
  12497. smalltalk.method({
  12498. selector: "copyFrom:to:",
  12499. category: 'copying',
  12500. fn: function (anIndex,anotherIndex){
  12501. var self=this;
  12502. return smalltalk.withContext(function($ctx1) {
  12503. return self.substring(anIndex - 1, anotherIndex);
  12504. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},smalltalk.String)})},
  12505. args: ["anIndex", "anotherIndex"],
  12506. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  12507. messageSends: [],
  12508. referencedClasses: []
  12509. }),
  12510. smalltalk.String);
  12511. smalltalk.addMethod(
  12512. smalltalk.method({
  12513. selector: "crlfSanitized",
  12514. category: 'converting',
  12515. fn: function (){
  12516. var self=this;
  12517. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  12518. return smalltalk.withContext(function($ctx1) {
  12519. var $1;
  12520. $1=_st(_st(self)._lines())._join_(_st($String())._lf());
  12521. return $1;
  12522. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},smalltalk.String)})},
  12523. args: [],
  12524. source: "crlfSanitized\x0a\x09^self lines join: String lf",
  12525. messageSends: ["join:", "lf", "lines"],
  12526. referencedClasses: ["String"]
  12527. }),
  12528. smalltalk.String);
  12529. smalltalk.addMethod(
  12530. smalltalk.method({
  12531. selector: "deepCopy",
  12532. category: 'copying',
  12533. fn: function (){
  12534. var self=this;
  12535. return smalltalk.withContext(function($ctx1) {
  12536. var $1;
  12537. $1=_st(self)._shallowCopy();
  12538. return $1;
  12539. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.String)})},
  12540. args: [],
  12541. source: "deepCopy\x0a\x09^self shallowCopy",
  12542. messageSends: ["shallowCopy"],
  12543. referencedClasses: []
  12544. }),
  12545. smalltalk.String);
  12546. smalltalk.addMethod(
  12547. smalltalk.method({
  12548. selector: "do:",
  12549. category: 'enumerating',
  12550. fn: function (aBlock){
  12551. var self=this;
  12552. return smalltalk.withContext(function($ctx1) {
  12553. for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  12554. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.String)})},
  12555. args: ["aBlock"],
  12556. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
  12557. messageSends: [],
  12558. referencedClasses: []
  12559. }),
  12560. smalltalk.String);
  12561. smalltalk.addMethod(
  12562. smalltalk.method({
  12563. selector: "escaped",
  12564. category: 'accessing',
  12565. fn: function (){
  12566. var self=this;
  12567. return smalltalk.withContext(function($ctx1) {
  12568. return escape(self);
  12569. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},smalltalk.String)})},
  12570. args: [],
  12571. source: "escaped\x0a\x09<return escape(self)>",
  12572. messageSends: [],
  12573. referencedClasses: []
  12574. }),
  12575. smalltalk.String);
  12576. smalltalk.addMethod(
  12577. smalltalk.method({
  12578. selector: "includesSubString:",
  12579. category: 'testing',
  12580. fn: function (subString){
  12581. var self=this;
  12582. return smalltalk.withContext(function($ctx1) {
  12583. return self.indexOf(subString) != -1 ;
  12584. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},smalltalk.String)})},
  12585. args: ["subString"],
  12586. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  12587. messageSends: [],
  12588. referencedClasses: []
  12589. }),
  12590. smalltalk.String);
  12591. smalltalk.addMethod(
  12592. smalltalk.method({
  12593. selector: "isImmutable",
  12594. category: 'testing',
  12595. fn: function (){
  12596. var self=this;
  12597. return smalltalk.withContext(function($ctx1) {
  12598. return true;
  12599. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.String)})},
  12600. args: [],
  12601. source: "isImmutable\x0a\x09^ true",
  12602. messageSends: [],
  12603. referencedClasses: []
  12604. }),
  12605. smalltalk.String);
  12606. smalltalk.addMethod(
  12607. smalltalk.method({
  12608. selector: "isString",
  12609. category: 'testing',
  12610. fn: function (){
  12611. var self=this;
  12612. return smalltalk.withContext(function($ctx1) {
  12613. return true;
  12614. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.String)})},
  12615. args: [],
  12616. source: "isString\x0a\x09^true",
  12617. messageSends: [],
  12618. referencedClasses: []
  12619. }),
  12620. smalltalk.String);
  12621. smalltalk.addMethod(
  12622. smalltalk.method({
  12623. selector: "isVowel",
  12624. category: 'testing',
  12625. fn: function (){
  12626. var self=this;
  12627. return smalltalk.withContext(function($ctx1) {
  12628. var $1;
  12629. $1=_st(_st(_st(self)._size()).__eq((1)))._and_((function(){
  12630. return smalltalk.withContext(function($ctx2) {
  12631. return _st("aeiou")._includes_(_st(self)._asLowercase());
  12632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12633. return $1;
  12634. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},smalltalk.String)})},
  12635. args: [],
  12636. source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
  12637. messageSends: ["and:", "includes:", "asLowercase", "=", "size"],
  12638. referencedClasses: []
  12639. }),
  12640. smalltalk.String);
  12641. smalltalk.addMethod(
  12642. smalltalk.method({
  12643. selector: "join:",
  12644. category: 'split join',
  12645. fn: function (aCollection){
  12646. var self=this;
  12647. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  12648. return smalltalk.withContext(function($ctx1) {
  12649. var $1;
  12650. $1=_st($String())._streamContents_((function(stream){
  12651. return smalltalk.withContext(function($ctx2) {
  12652. return _st(aCollection)._do_separatedBy_((function(each){
  12653. return smalltalk.withContext(function($ctx3) {
  12654. return _st(stream)._nextPutAll_(_st(each)._asString());
  12655. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  12656. return smalltalk.withContext(function($ctx3) {
  12657. return _st(stream)._nextPutAll_(self);
  12658. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  12659. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  12660. return $1;
  12661. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},smalltalk.String)})},
  12662. args: ["aCollection"],
  12663. source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [:stream | aCollection\x0a\x09\x09\x09\x09do: [:each | stream nextPutAll: each asString]\x0a\x09\x09\x09\x09separatedBy: [stream nextPutAll: self]]",
  12664. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  12665. referencedClasses: ["String"]
  12666. }),
  12667. smalltalk.String);
  12668. smalltalk.addMethod(
  12669. smalltalk.method({
  12670. selector: "lineIndicesDo:",
  12671. category: 'split join',
  12672. fn: function (aBlock){
  12673. var self=this;
  12674. var cr,lf,start,sz,nextLF,nextCR;
  12675. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  12676. return smalltalk.withContext(function($ctx1) {
  12677. var $1,$2,$3,$4;
  12678. var $early={};
  12679. try {
  12680. start=(1);
  12681. sz=_st(self)._size();
  12682. cr=_st($String())._cr();
  12683. nextCR=_st(self)._indexOf_startingAt_(cr,(1));
  12684. lf=_st($String())._lf();
  12685. nextLF=_st(self)._indexOf_startingAt_(lf,(1));
  12686. _st((function(){
  12687. return smalltalk.withContext(function($ctx2) {
  12688. return _st(start).__lt_eq(sz);
  12689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  12690. return smalltalk.withContext(function($ctx2) {
  12691. $1=_st(_st(nextLF).__eq((0)))._and_((function(){
  12692. return smalltalk.withContext(function($ctx3) {
  12693. return _st(nextCR).__eq((0));
  12694. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  12695. if(smalltalk.assert($1)){
  12696. _st(aBlock)._value_value_value_(start,sz,sz);
  12697. $2=self;
  12698. throw $early=[$2];
  12699. };
  12700. $3=_st(_st(nextCR).__eq((0)))._or_((function(){
  12701. return smalltalk.withContext(function($ctx3) {
  12702. return _st(_st((0)).__lt(nextLF))._and_((function(){
  12703. return smalltalk.withContext(function($ctx4) {
  12704. return _st(nextLF).__lt(nextCR);
  12705. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  12706. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  12707. if(smalltalk.assert($3)){
  12708. _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  12709. start=_st((1)).__plus(nextLF);
  12710. start;
  12711. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  12712. return nextLF;
  12713. } else {
  12714. $4=_st(_st((1)).__plus(nextCR)).__eq(nextLF);
  12715. if(smalltalk.assert($4)){
  12716. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  12717. start=_st((1)).__plus(nextLF);
  12718. start;
  12719. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  12720. nextCR;
  12721. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  12722. return nextLF;
  12723. } else {
  12724. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  12725. start=_st((1)).__plus(nextCR);
  12726. start;
  12727. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  12728. return nextCR;
  12729. };
  12730. };
  12731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12732. return self}
  12733. catch(e) {if(e===$early)return e[0]; throw e}
  12734. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},smalltalk.String)})},
  12735. args: ["aBlock"],
  12736. source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [\x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ]]]",
  12737. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  12738. referencedClasses: ["String"]
  12739. }),
  12740. smalltalk.String);
  12741. smalltalk.addMethod(
  12742. smalltalk.method({
  12743. selector: "lineNumber:",
  12744. category: 'split join',
  12745. fn: function (anIndex){
  12746. var self=this;
  12747. var lineCount;
  12748. return smalltalk.withContext(function($ctx1) {
  12749. var $1,$2;
  12750. var $early={};
  12751. try {
  12752. lineCount=(0);
  12753. _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12754. return smalltalk.withContext(function($ctx2) {
  12755. lineCount=_st(lineCount).__plus((1));
  12756. $1=_st(lineCount).__eq(anIndex);
  12757. if(smalltalk.assert($1)){
  12758. $2=_st(self)._copyFrom_to_(start,endWithoutDelimiters);
  12759. throw $early=[$2];
  12760. };
  12761. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  12762. return nil;
  12763. }
  12764. catch(e) {if(e===$early)return e[0]; throw e}
  12765. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},smalltalk.String)})},
  12766. args: ["anIndex"],
  12767. source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [:start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [^self copyFrom: start to: endWithoutDelimiters]].\x0a\x09^nil",
  12768. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  12769. referencedClasses: []
  12770. }),
  12771. smalltalk.String);
  12772. smalltalk.addMethod(
  12773. smalltalk.method({
  12774. selector: "lines",
  12775. category: 'split join',
  12776. fn: function (){
  12777. var self=this;
  12778. var lines;
  12779. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  12780. return smalltalk.withContext(function($ctx1) {
  12781. var $1;
  12782. lines=_st($Array())._new();
  12783. _st(self)._linesDo_((function(aLine){
  12784. return smalltalk.withContext(function($ctx2) {
  12785. return _st(lines)._add_(aLine);
  12786. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})}));
  12787. $1=lines;
  12788. return $1;
  12789. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},smalltalk.String)})},
  12790. args: [],
  12791. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [:aLine | lines add: aLine].\x0a\x09^lines",
  12792. messageSends: ["new", "linesDo:", "add:"],
  12793. referencedClasses: ["Array"]
  12794. }),
  12795. smalltalk.String);
  12796. smalltalk.addMethod(
  12797. smalltalk.method({
  12798. selector: "linesDo:",
  12799. category: 'split join',
  12800. fn: function (aBlock){
  12801. var self=this;
  12802. return smalltalk.withContext(function($ctx1) {
  12803. _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12804. return smalltalk.withContext(function($ctx2) {
  12805. return _st(aBlock)._value_(_st(self)._copyFrom_to_(start,endWithoutDelimiters));
  12806. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  12807. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},smalltalk.String)})},
  12808. args: ["aBlock"],
  12809. source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lineIndicesDo: [:start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters)]",
  12810. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  12811. referencedClasses: []
  12812. }),
  12813. smalltalk.String);
  12814. smalltalk.addMethod(
  12815. smalltalk.method({
  12816. selector: "match:",
  12817. category: 'regular expressions',
  12818. fn: function (aRegexp){
  12819. var self=this;
  12820. return smalltalk.withContext(function($ctx1) {
  12821. return self.search(aRegexp) != -1;
  12822. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},smalltalk.String)})},
  12823. args: ["aRegexp"],
  12824. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  12825. messageSends: [],
  12826. referencedClasses: []
  12827. }),
  12828. smalltalk.String);
  12829. smalltalk.addMethod(
  12830. smalltalk.method({
  12831. selector: "matchesOf:",
  12832. category: 'regular expressions',
  12833. fn: function (aRegularExpression){
  12834. var self=this;
  12835. return smalltalk.withContext(function($ctx1) {
  12836. return self.match(aRegularExpression);
  12837. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},smalltalk.String)})},
  12838. args: ["aRegularExpression"],
  12839. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  12840. messageSends: [],
  12841. referencedClasses: []
  12842. }),
  12843. smalltalk.String);
  12844. smalltalk.addMethod(
  12845. smalltalk.method({
  12846. selector: "printNl",
  12847. category: 'printing',
  12848. fn: function (){
  12849. var self=this;
  12850. return smalltalk.withContext(function($ctx1) {
  12851. console.log(self);
  12852. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},smalltalk.String)})},
  12853. args: [],
  12854. source: "printNl\x0a\x09<console.log(self)>",
  12855. messageSends: [],
  12856. referencedClasses: []
  12857. }),
  12858. smalltalk.String);
  12859. smalltalk.addMethod(
  12860. smalltalk.method({
  12861. selector: "printOn:",
  12862. category: 'printing',
  12863. fn: function (aStream){
  12864. var self=this;
  12865. return smalltalk.withContext(function($ctx1) {
  12866. var $1,$2;
  12867. $1=aStream;
  12868. _st($1)._nextPutAll_("'");
  12869. _st($1)._nextPutAll_(self);
  12870. $2=_st($1)._nextPutAll_("'");
  12871. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.String)})},
  12872. args: ["aStream"],
  12873. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  12874. messageSends: ["nextPutAll:"],
  12875. referencedClasses: []
  12876. }),
  12877. smalltalk.String);
  12878. smalltalk.addMethod(
  12879. smalltalk.method({
  12880. selector: "replace:with:",
  12881. category: 'regular expressions',
  12882. fn: function (aString,anotherString){
  12883. var self=this;
  12884. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  12885. return smalltalk.withContext(function($ctx1) {
  12886. var $1;
  12887. $1=_st(self)._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  12888. return $1;
  12889. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},smalltalk.String)})},
  12890. args: ["aString", "anotherString"],
  12891. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12892. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  12893. referencedClasses: ["RegularExpression"]
  12894. }),
  12895. smalltalk.String);
  12896. smalltalk.addMethod(
  12897. smalltalk.method({
  12898. selector: "replaceRegexp:with:",
  12899. category: 'regular expressions',
  12900. fn: function (aRegexp,aString){
  12901. var self=this;
  12902. return smalltalk.withContext(function($ctx1) {
  12903. return self.replace(aRegexp, aString);
  12904. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},smalltalk.String)})},
  12905. args: ["aRegexp", "aString"],
  12906. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  12907. messageSends: [],
  12908. referencedClasses: []
  12909. }),
  12910. smalltalk.String);
  12911. smalltalk.addMethod(
  12912. smalltalk.method({
  12913. selector: "reversed",
  12914. category: 'converting',
  12915. fn: function (){
  12916. var self=this;
  12917. return smalltalk.withContext(function($ctx1) {
  12918. return self.split("").reverse().join("");
  12919. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.String)})},
  12920. args: [],
  12921. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  12922. messageSends: [],
  12923. referencedClasses: []
  12924. }),
  12925. smalltalk.String);
  12926. smalltalk.addMethod(
  12927. smalltalk.method({
  12928. selector: "shallowCopy",
  12929. category: 'copying',
  12930. fn: function (){
  12931. var self=this;
  12932. return smalltalk.withContext(function($ctx1) {
  12933. var $1;
  12934. $1=_st(_st(self)._class())._fromString_(self);
  12935. return $1;
  12936. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.String)})},
  12937. args: [],
  12938. source: "shallowCopy\x0a\x09^self class fromString: self",
  12939. messageSends: ["fromString:", "class"],
  12940. referencedClasses: []
  12941. }),
  12942. smalltalk.String);
  12943. smalltalk.addMethod(
  12944. smalltalk.method({
  12945. selector: "size",
  12946. category: 'accessing',
  12947. fn: function (){
  12948. var self=this;
  12949. return smalltalk.withContext(function($ctx1) {
  12950. return self.length;
  12951. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.String)})},
  12952. args: [],
  12953. source: "size\x0a\x09<return self.length>",
  12954. messageSends: [],
  12955. referencedClasses: []
  12956. }),
  12957. smalltalk.String);
  12958. smalltalk.addMethod(
  12959. smalltalk.method({
  12960. selector: "tokenize:",
  12961. category: 'converting',
  12962. fn: function (aString){
  12963. var self=this;
  12964. return smalltalk.withContext(function($ctx1) {
  12965. return self.split(aString);
  12966. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},smalltalk.String)})},
  12967. args: ["aString"],
  12968. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  12969. messageSends: [],
  12970. referencedClasses: []
  12971. }),
  12972. smalltalk.String);
  12973. smalltalk.addMethod(
  12974. smalltalk.method({
  12975. selector: "trimBoth",
  12976. category: 'regular expressions',
  12977. fn: function (){
  12978. var self=this;
  12979. return smalltalk.withContext(function($ctx1) {
  12980. var $1;
  12981. $1=_st(self)._trimBoth_("\x5cs");
  12982. return $1;
  12983. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},smalltalk.String)})},
  12984. args: [],
  12985. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  12986. messageSends: ["trimBoth:"],
  12987. referencedClasses: []
  12988. }),
  12989. smalltalk.String);
  12990. smalltalk.addMethod(
  12991. smalltalk.method({
  12992. selector: "trimBoth:",
  12993. category: 'regular expressions',
  12994. fn: function (separators){
  12995. var self=this;
  12996. return smalltalk.withContext(function($ctx1) {
  12997. var $1;
  12998. $1=_st(_st(self)._trimLeft_(separators))._trimRight_(separators);
  12999. return $1;
  13000. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},smalltalk.String)})},
  13001. args: ["separators"],
  13002. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  13003. messageSends: ["trimRight:", "trimLeft:"],
  13004. referencedClasses: []
  13005. }),
  13006. smalltalk.String);
  13007. smalltalk.addMethod(
  13008. smalltalk.method({
  13009. selector: "trimLeft",
  13010. category: 'regular expressions',
  13011. fn: function (){
  13012. var self=this;
  13013. return smalltalk.withContext(function($ctx1) {
  13014. var $1;
  13015. $1=_st(self)._trimLeft_("\x5cs");
  13016. return $1;
  13017. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},smalltalk.String)})},
  13018. args: [],
  13019. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  13020. messageSends: ["trimLeft:"],
  13021. referencedClasses: []
  13022. }),
  13023. smalltalk.String);
  13024. smalltalk.addMethod(
  13025. smalltalk.method({
  13026. selector: "trimLeft:",
  13027. category: 'regular expressions',
  13028. fn: function (separators){
  13029. var self=this;
  13030. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13031. return smalltalk.withContext(function($ctx1) {
  13032. var $1;
  13033. $1=_st(self)._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st(_st("^[").__comma(separators)).__comma("]+"),"g"),"");
  13034. return $1;
  13035. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},smalltalk.String)})},
  13036. args: ["separators"],
  13037. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  13038. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  13039. referencedClasses: ["RegularExpression"]
  13040. }),
  13041. smalltalk.String);
  13042. smalltalk.addMethod(
  13043. smalltalk.method({
  13044. selector: "trimRight",
  13045. category: 'regular expressions',
  13046. fn: function (){
  13047. var self=this;
  13048. return smalltalk.withContext(function($ctx1) {
  13049. var $1;
  13050. $1=_st(self)._trimRight_("\x5cs");
  13051. return $1;
  13052. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},smalltalk.String)})},
  13053. args: [],
  13054. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  13055. messageSends: ["trimRight:"],
  13056. referencedClasses: []
  13057. }),
  13058. smalltalk.String);
  13059. smalltalk.addMethod(
  13060. smalltalk.method({
  13061. selector: "trimRight:",
  13062. category: 'regular expressions',
  13063. fn: function (separators){
  13064. var self=this;
  13065. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13066. return smalltalk.withContext(function($ctx1) {
  13067. var $1;
  13068. $1=_st(self)._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st(_st("[").__comma(separators)).__comma("]+$"),"g"),"");
  13069. return $1;
  13070. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},smalltalk.String)})},
  13071. args: ["separators"],
  13072. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  13073. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  13074. referencedClasses: ["RegularExpression"]
  13075. }),
  13076. smalltalk.String);
  13077. smalltalk.addMethod(
  13078. smalltalk.method({
  13079. selector: "unescaped",
  13080. category: 'accessing',
  13081. fn: function (){
  13082. var self=this;
  13083. return smalltalk.withContext(function($ctx1) {
  13084. return unescape(self);
  13085. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},smalltalk.String)})},
  13086. args: [],
  13087. source: "unescaped\x0a\x09<return unescape(self)>",
  13088. messageSends: [],
  13089. referencedClasses: []
  13090. }),
  13091. smalltalk.String);
  13092. smalltalk.addMethod(
  13093. smalltalk.method({
  13094. selector: "withIndexDo:",
  13095. category: 'enumerating',
  13096. fn: function (aBlock){
  13097. var self=this;
  13098. return smalltalk.withContext(function($ctx1) {
  13099. for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  13100. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.String)})},
  13101. args: ["aBlock"],
  13102. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>",
  13103. messageSends: [],
  13104. referencedClasses: []
  13105. }),
  13106. smalltalk.String);
  13107. smalltalk.addMethod(
  13108. smalltalk.method({
  13109. selector: "cr",
  13110. category: 'accessing',
  13111. fn: function (){
  13112. var self=this;
  13113. return smalltalk.withContext(function($ctx1) {
  13114. return '\r';
  13115. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.String.klass)})},
  13116. args: [],
  13117. source: "cr\x0a\x09<return '\x5cr'>",
  13118. messageSends: [],
  13119. referencedClasses: []
  13120. }),
  13121. smalltalk.String.klass);
  13122. smalltalk.addMethod(
  13123. smalltalk.method({
  13124. selector: "crlf",
  13125. category: 'accessing',
  13126. fn: function (){
  13127. var self=this;
  13128. return smalltalk.withContext(function($ctx1) {
  13129. return '\r\n';
  13130. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.String.klass)})},
  13131. args: [],
  13132. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  13133. messageSends: [],
  13134. referencedClasses: []
  13135. }),
  13136. smalltalk.String.klass);
  13137. smalltalk.addMethod(
  13138. smalltalk.method({
  13139. selector: "fromCharCode:",
  13140. category: 'instance creation',
  13141. fn: function (anInteger){
  13142. var self=this;
  13143. return smalltalk.withContext(function($ctx1) {
  13144. return String.fromCharCode(anInteger);
  13145. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},smalltalk.String.klass)})},
  13146. args: ["anInteger"],
  13147. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  13148. messageSends: [],
  13149. referencedClasses: []
  13150. }),
  13151. smalltalk.String.klass);
  13152. smalltalk.addMethod(
  13153. smalltalk.method({
  13154. selector: "fromString:",
  13155. category: 'instance creation',
  13156. fn: function (aString){
  13157. var self=this;
  13158. return smalltalk.withContext(function($ctx1) {
  13159. return String(aString);
  13160. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.String.klass)})},
  13161. args: ["aString"],
  13162. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  13163. messageSends: [],
  13164. referencedClasses: []
  13165. }),
  13166. smalltalk.String.klass);
  13167. smalltalk.addMethod(
  13168. smalltalk.method({
  13169. selector: "lf",
  13170. category: 'accessing',
  13171. fn: function (){
  13172. var self=this;
  13173. return smalltalk.withContext(function($ctx1) {
  13174. return '\n';
  13175. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.String.klass)})},
  13176. args: [],
  13177. source: "lf\x0a\x09<return '\x5cn'>",
  13178. messageSends: [],
  13179. referencedClasses: []
  13180. }),
  13181. smalltalk.String.klass);
  13182. smalltalk.addMethod(
  13183. smalltalk.method({
  13184. selector: "random",
  13185. category: 'random',
  13186. fn: function (){
  13187. var self=this;
  13188. return smalltalk.withContext(function($ctx1) {
  13189. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  13190. return self}, function($ctx1) {$ctx1.fill(self,"random",{},smalltalk.String.klass)})},
  13191. args: [],
  13192. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
  13193. messageSends: [],
  13194. referencedClasses: []
  13195. }),
  13196. smalltalk.String.klass);
  13197. smalltalk.addMethod(
  13198. smalltalk.method({
  13199. selector: "randomNotIn:",
  13200. category: 'random',
  13201. fn: function (aString){
  13202. var self=this;
  13203. var result;
  13204. return smalltalk.withContext(function($ctx1) {
  13205. var $1;
  13206. _st((function(){
  13207. return smalltalk.withContext(function($ctx2) {
  13208. result=_st(self)._random();
  13209. result;
  13210. return _st(aString)._includesSubString_(result);
  13211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  13212. $1=result;
  13213. return $1;
  13214. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},smalltalk.String.klass)})},
  13215. args: ["aString"],
  13216. source: "randomNotIn: aString\x0a\x09| result |\x0a [ result := self random. aString includesSubString: result ] whileTrue.\x0a ^result",
  13217. messageSends: ["whileTrue", "random", "includesSubString:"],
  13218. referencedClasses: []
  13219. }),
  13220. smalltalk.String.klass);
  13221. smalltalk.addMethod(
  13222. smalltalk.method({
  13223. selector: "space",
  13224. category: 'accessing',
  13225. fn: function (){
  13226. var self=this;
  13227. return smalltalk.withContext(function($ctx1) {
  13228. return ' ';
  13229. return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.String.klass)})},
  13230. args: [],
  13231. source: "space\x0a\x09<return ' '>",
  13232. messageSends: [],
  13233. referencedClasses: []
  13234. }),
  13235. smalltalk.String.klass);
  13236. smalltalk.addMethod(
  13237. smalltalk.method({
  13238. selector: "streamClass",
  13239. category: 'accessing',
  13240. fn: function (){
  13241. var self=this;
  13242. function $StringStream(){return smalltalk.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  13243. return smalltalk.withContext(function($ctx1) {
  13244. var $1;
  13245. $1=$StringStream();
  13246. return $1;
  13247. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.String.klass)})},
  13248. args: [],
  13249. source: "streamClass\x0a\x09\x09^StringStream",
  13250. messageSends: [],
  13251. referencedClasses: ["StringStream"]
  13252. }),
  13253. smalltalk.String.klass);
  13254. smalltalk.addMethod(
  13255. smalltalk.method({
  13256. selector: "tab",
  13257. category: 'accessing',
  13258. fn: function (){
  13259. var self=this;
  13260. return smalltalk.withContext(function($ctx1) {
  13261. return '\t';
  13262. return self}, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.String.klass)})},
  13263. args: [],
  13264. source: "tab\x0a\x09<return '\x5ct'>",
  13265. messageSends: [],
  13266. referencedClasses: []
  13267. }),
  13268. smalltalk.String.klass);
  13269. smalltalk.addMethod(
  13270. smalltalk.method({
  13271. selector: "value:",
  13272. category: 'instance creation',
  13273. fn: function (aUTFCharCode){
  13274. var self=this;
  13275. return smalltalk.withContext(function($ctx1) {
  13276. return String.fromCharCode(aUTFCharCode);;
  13277. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},smalltalk.String.klass)})},
  13278. args: ["aUTFCharCode"],
  13279. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  13280. messageSends: [],
  13281. referencedClasses: []
  13282. }),
  13283. smalltalk.String.klass);
  13284. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  13285. smalltalk.Set.comment="I represent an unordered set of objects without duplicates."
  13286. smalltalk.addMethod(
  13287. smalltalk.method({
  13288. selector: "=",
  13289. category: 'comparing',
  13290. fn: function (aCollection){
  13291. var self=this;
  13292. return smalltalk.withContext(function($ctx1) {
  13293. var $1,$2,$3;
  13294. var $early={};
  13295. try {
  13296. $1=_st(_st(self)._class()).__eq(_st(aCollection)._class());
  13297. if(! smalltalk.assert($1)){
  13298. return false;
  13299. };
  13300. $2=_st(_st(self)._size()).__eq(_st(aCollection)._size());
  13301. if(! smalltalk.assert($2)){
  13302. return false;
  13303. };
  13304. _st(self)._do_((function(each){
  13305. return smalltalk.withContext(function($ctx2) {
  13306. $3=_st(aCollection)._includes_(each);
  13307. if(! smalltalk.assert($3)){
  13308. throw $early=[false];
  13309. };
  13310. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  13311. return true;
  13312. }
  13313. catch(e) {if(e===$early)return e[0]; throw e}
  13314. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.Set)})},
  13315. args: ["aCollection"],
  13316. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [:each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  13317. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  13318. referencedClasses: []
  13319. }),
  13320. smalltalk.Set);
  13321. smalltalk.addMethod(
  13322. smalltalk.method({
  13323. selector: "add:",
  13324. category: 'adding/removing',
  13325. fn: function (anObject){
  13326. var self=this;
  13327. return smalltalk.withContext(function($ctx1) {
  13328. var found;
  13329. for(var i=0; i < self['@elements'].length; i++) {
  13330. if(anObject == self['@elements'][i]) {
  13331. found = true;
  13332. break;
  13333. }
  13334. }
  13335. if(!found) {self['@elements'].push(anObject)}
  13336. ;
  13337. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Set)})},
  13338. args: ["anObject"],
  13339. source: "add: anObject\x0a\x09<\x0a\x09\x09var found;\x0a\x09\x09for(var i=0; i < self['@elements'].length; i++) {\x0a\x09\x09\x09if(anObject == self['@elements'][i]) {\x0a\x09\x09\x09\x09found = true;\x0a\x09\x09\x09\x09break;\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09if(!found) {self['@elements'].push(anObject)}\x0a\x09>",
  13340. messageSends: [],
  13341. referencedClasses: []
  13342. }),
  13343. smalltalk.Set);
  13344. smalltalk.addMethod(
  13345. smalltalk.method({
  13346. selector: "asArray",
  13347. category: 'converting',
  13348. fn: function (){
  13349. var self=this;
  13350. return smalltalk.withContext(function($ctx1) {
  13351. var $1;
  13352. $1=_st(self["@elements"])._copy();
  13353. return $1;
  13354. }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Set)})},
  13355. args: [],
  13356. source: "asArray\x0a\x09^elements copy",
  13357. messageSends: ["copy"],
  13358. referencedClasses: []
  13359. }),
  13360. smalltalk.Set);
  13361. smalltalk.addMethod(
  13362. smalltalk.method({
  13363. selector: "collect:",
  13364. category: 'enumerating',
  13365. fn: function (aBlock){
  13366. var self=this;
  13367. return smalltalk.withContext(function($ctx1) {
  13368. var $1;
  13369. $1=_st(_st(self)._class())._withAll_(_st(self["@elements"])._collect_(aBlock));
  13370. return $1;
  13371. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},smalltalk.Set)})},
  13372. args: ["aBlock"],
  13373. source: "collect: aBlock\x0a\x09^self class withAll: (elements collect: aBlock)",
  13374. messageSends: ["withAll:", "collect:", "class"],
  13375. referencedClasses: []
  13376. }),
  13377. smalltalk.Set);
  13378. smalltalk.addMethod(
  13379. smalltalk.method({
  13380. selector: "detect:ifNone:",
  13381. category: 'enumerating',
  13382. fn: function (aBlock,anotherBlock){
  13383. var self=this;
  13384. return smalltalk.withContext(function($ctx1) {
  13385. var $1;
  13386. $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
  13387. return $1;
  13388. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Set)})},
  13389. args: ["aBlock", "anotherBlock"],
  13390. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  13391. messageSends: ["detect:ifNone:"],
  13392. referencedClasses: []
  13393. }),
  13394. smalltalk.Set);
  13395. smalltalk.addMethod(
  13396. smalltalk.method({
  13397. selector: "do:",
  13398. category: 'enumerating',
  13399. fn: function (aBlock){
  13400. var self=this;
  13401. return smalltalk.withContext(function($ctx1) {
  13402. _st(self["@elements"])._do_(aBlock);
  13403. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Set)})},
  13404. args: ["aBlock"],
  13405. source: "do: aBlock\x0a\x09elements do: aBlock",
  13406. messageSends: ["do:"],
  13407. referencedClasses: []
  13408. }),
  13409. smalltalk.Set);
  13410. smalltalk.addMethod(
  13411. smalltalk.method({
  13412. selector: "includes:",
  13413. category: 'testing',
  13414. fn: function (anObject){
  13415. var self=this;
  13416. return smalltalk.withContext(function($ctx1) {
  13417. var $1;
  13418. $1=_st(self["@elements"])._includes_(anObject);
  13419. return $1;
  13420. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.Set)})},
  13421. args: ["anObject"],
  13422. source: "includes: anObject\x0a\x09^elements includes: anObject",
  13423. messageSends: ["includes:"],
  13424. referencedClasses: []
  13425. }),
  13426. smalltalk.Set);
  13427. smalltalk.addMethod(
  13428. smalltalk.method({
  13429. selector: "initialize",
  13430. category: 'initialization',
  13431. fn: function (){
  13432. var self=this;
  13433. return smalltalk.withContext(function($ctx1) {
  13434. smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []);
  13435. self["@elements"]=[];
  13436. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Set)})},
  13437. args: [],
  13438. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  13439. messageSends: ["initialize"],
  13440. referencedClasses: []
  13441. }),
  13442. smalltalk.Set);
  13443. smalltalk.addMethod(
  13444. smalltalk.method({
  13445. selector: "printOn:",
  13446. category: 'printing',
  13447. fn: function (aStream){
  13448. var self=this;
  13449. return smalltalk.withContext(function($ctx1) {
  13450. smalltalk.Collection.fn.prototype._printOn_.apply(_st(self), [aStream]);
  13451. _st(aStream)._nextPutAll_(" (");
  13452. _st(self)._do_separatedBy_((function(each){
  13453. return smalltalk.withContext(function($ctx2) {
  13454. return _st(each)._printOn_(aStream);
  13455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  13456. return smalltalk.withContext(function($ctx2) {
  13457. return _st(aStream)._nextPutAll_(" ");
  13458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13459. _st(aStream)._nextPutAll_(")");
  13460. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Set)})},
  13461. args: ["aStream"],
  13462. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  13463. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  13464. referencedClasses: []
  13465. }),
  13466. smalltalk.Set);
  13467. smalltalk.addMethod(
  13468. smalltalk.method({
  13469. selector: "remove:",
  13470. category: 'adding/removing',
  13471. fn: function (anObject){
  13472. var self=this;
  13473. return smalltalk.withContext(function($ctx1) {
  13474. _st(self["@elements"])._remove_(anObject);
  13475. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Set)})},
  13476. args: ["anObject"],
  13477. source: "remove: anObject\x0a\x09elements remove: anObject",
  13478. messageSends: ["remove:"],
  13479. referencedClasses: []
  13480. }),
  13481. smalltalk.Set);
  13482. smalltalk.addMethod(
  13483. smalltalk.method({
  13484. selector: "select:",
  13485. category: 'enumerating',
  13486. fn: function (aBlock){
  13487. var self=this;
  13488. var collection;
  13489. return smalltalk.withContext(function($ctx1) {
  13490. var $1,$2;
  13491. collection=_st(_st(self)._class())._new();
  13492. _st(self)._do_((function(each){
  13493. return smalltalk.withContext(function($ctx2) {
  13494. $1=_st(aBlock)._value_(each);
  13495. if(smalltalk.assert($1)){
  13496. return _st(collection)._add_(each);
  13497. };
  13498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  13499. $2=collection;
  13500. return $2;
  13501. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},smalltalk.Set)})},
  13502. args: ["aBlock"],
  13503. source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [:each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each]].\x0a\x09^collection",
  13504. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  13505. referencedClasses: []
  13506. }),
  13507. smalltalk.Set);
  13508. smalltalk.addMethod(
  13509. smalltalk.method({
  13510. selector: "size",
  13511. category: 'accessing',
  13512. fn: function (){
  13513. var self=this;
  13514. return smalltalk.withContext(function($ctx1) {
  13515. var $1;
  13516. $1=_st(self["@elements"])._size();
  13517. return $1;
  13518. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Set)})},
  13519. args: [],
  13520. source: "size\x0a\x09^elements size",
  13521. messageSends: ["size"],
  13522. referencedClasses: []
  13523. }),
  13524. smalltalk.Set);
  13525. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  13526. smalltalk.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to."
  13527. smalltalk.addMethod(
  13528. smalltalk.method({
  13529. selector: "initialize",
  13530. category: 'initialization',
  13531. fn: function (){
  13532. var self=this;
  13533. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  13534. return smalltalk.withContext(function($ctx1) {
  13535. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  13536. self["@read"]=_st($OrderedCollection())._new();
  13537. self["@write"]=_st($OrderedCollection())._new();
  13538. self["@readIndex"]=(1);
  13539. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Queue)})},
  13540. args: [],
  13541. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13542. messageSends: ["initialize", "new"],
  13543. referencedClasses: ["OrderedCollection"]
  13544. }),
  13545. smalltalk.Queue);
  13546. smalltalk.addMethod(
  13547. smalltalk.method({
  13548. selector: "next",
  13549. category: 'accessing',
  13550. fn: function (){
  13551. var self=this;
  13552. return smalltalk.withContext(function($ctx1) {
  13553. var $1;
  13554. $1=_st(self)._nextIfAbsent_((function(){
  13555. return smalltalk.withContext(function($ctx2) {
  13556. return _st(self)._error_("Cannot read from empty Queue.");
  13557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13558. return $1;
  13559. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Queue)})},
  13560. args: [],
  13561. source: "next\x0a\x09^self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13562. messageSends: ["nextIfAbsent:", "error:"],
  13563. referencedClasses: []
  13564. }),
  13565. smalltalk.Queue);
  13566. smalltalk.addMethod(
  13567. smalltalk.method({
  13568. selector: "nextIfAbsent:",
  13569. category: 'accessing',
  13570. fn: function (aBlock){
  13571. var self=this;
  13572. var result;
  13573. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  13574. return smalltalk.withContext(function($ctx1) {
  13575. var $1,$2,$3,$4;
  13576. var $early={};
  13577. try {
  13578. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  13579. return smalltalk.withContext(function($ctx2) {
  13580. $1=_st(self["@write"])._isEmpty();
  13581. if(smalltalk.assert($1)){
  13582. $2=_st(self["@readIndex"]).__gt((1));
  13583. if(smalltalk.assert($2)){
  13584. self["@read"]=[];
  13585. self["@read"];
  13586. self["@readIndex"]=(1);
  13587. self["@readIndex"];
  13588. };
  13589. $3=_st(aBlock)._value();
  13590. throw $early=[$3];
  13591. };
  13592. self["@read"]=self["@write"];
  13593. self["@read"];
  13594. self["@readIndex"]=(1);
  13595. self["@readIndex"];
  13596. self["@write"]=_st($OrderedCollection())._new();
  13597. self["@write"];
  13598. return _st(self["@read"])._first();
  13599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13600. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  13601. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  13602. $4=result;
  13603. return $4;
  13604. }
  13605. catch(e) {if(e===$early)return e[0]; throw e}
  13606. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},smalltalk.Queue)})},
  13607. args: ["aBlock"],
  13608. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^result",
  13609. messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
  13610. referencedClasses: ["OrderedCollection"]
  13611. }),
  13612. smalltalk.Queue);
  13613. smalltalk.addMethod(
  13614. smalltalk.method({
  13615. selector: "nextPut:",
  13616. category: 'accessing',
  13617. fn: function (anObject){
  13618. var self=this;
  13619. return smalltalk.withContext(function($ctx1) {
  13620. _st(self["@write"])._add_(anObject);
  13621. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Queue)})},
  13622. args: ["anObject"],
  13623. source: "nextPut: anObject\x0a\x09write add: anObject",
  13624. messageSends: ["add:"],
  13625. referencedClasses: []
  13626. }),
  13627. smalltalk.Queue);
  13628. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  13629. smalltalk.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object."
  13630. smalltalk.addMethod(
  13631. smalltalk.method({
  13632. selector: "compile:",
  13633. category: 'evaluating',
  13634. fn: function (aString){
  13635. var self=this;
  13636. return smalltalk.withContext(function($ctx1) {
  13637. return self.compile(aString);
  13638. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.RegularExpression)})},
  13639. args: ["aString"],
  13640. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  13641. messageSends: [],
  13642. referencedClasses: []
  13643. }),
  13644. smalltalk.RegularExpression);
  13645. smalltalk.addMethod(
  13646. smalltalk.method({
  13647. selector: "exec:",
  13648. category: 'evaluating',
  13649. fn: function (aString){
  13650. var self=this;
  13651. return smalltalk.withContext(function($ctx1) {
  13652. return self.exec(aString) || nil;
  13653. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},smalltalk.RegularExpression)})},
  13654. args: ["aString"],
  13655. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  13656. messageSends: [],
  13657. referencedClasses: []
  13658. }),
  13659. smalltalk.RegularExpression);
  13660. smalltalk.addMethod(
  13661. smalltalk.method({
  13662. selector: "test:",
  13663. category: 'evaluating',
  13664. fn: function (aString){
  13665. var self=this;
  13666. return smalltalk.withContext(function($ctx1) {
  13667. return self.test(aString);
  13668. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},smalltalk.RegularExpression)})},
  13669. args: ["aString"],
  13670. source: "test: aString\x0a\x09<return self.test(aString)>",
  13671. messageSends: [],
  13672. referencedClasses: []
  13673. }),
  13674. smalltalk.RegularExpression);
  13675. smalltalk.addMethod(
  13676. smalltalk.method({
  13677. selector: "fromString:",
  13678. category: 'instance creation',
  13679. fn: function (aString){
  13680. var self=this;
  13681. return smalltalk.withContext(function($ctx1) {
  13682. var $1;
  13683. $1=_st(self)._fromString_flag_(aString,"");
  13684. return $1;
  13685. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.RegularExpression.klass)})},
  13686. args: ["aString"],
  13687. source: "fromString: aString\x0a\x09\x09^self fromString: aString flag: ''",
  13688. messageSends: ["fromString:flag:"],
  13689. referencedClasses: []
  13690. }),
  13691. smalltalk.RegularExpression.klass);
  13692. smalltalk.addMethod(
  13693. smalltalk.method({
  13694. selector: "fromString:flag:",
  13695. category: 'instance creation',
  13696. fn: function (aString,anotherString){
  13697. var self=this;
  13698. return smalltalk.withContext(function($ctx1) {
  13699. return new RegExp(aString, anotherString);
  13700. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},smalltalk.RegularExpression.klass)})},
  13701. args: ["aString", "anotherString"],
  13702. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  13703. messageSends: [],
  13704. referencedClasses: []
  13705. }),
  13706. smalltalk.RegularExpression.klass);
  13707. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  13708. smalltalk.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection."
  13709. smalltalk.addMethod(
  13710. smalltalk.method({
  13711. selector: "<<",
  13712. category: 'writing',
  13713. fn: function (anObject){
  13714. var self=this;
  13715. return smalltalk.withContext(function($ctx1) {
  13716. _st(self)._write_(anObject);
  13717. return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},smalltalk.Stream)})},
  13718. args: ["anObject"],
  13719. source: "<< anObject\x0a\x09self write: anObject",
  13720. messageSends: ["write:"],
  13721. referencedClasses: []
  13722. }),
  13723. smalltalk.Stream);
  13724. smalltalk.addMethod(
  13725. smalltalk.method({
  13726. selector: "atEnd",
  13727. category: 'testing',
  13728. fn: function (){
  13729. var self=this;
  13730. return smalltalk.withContext(function($ctx1) {
  13731. var $1;
  13732. $1=_st(_st(self)._position()).__eq(_st(self)._size());
  13733. return $1;
  13734. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.Stream)})},
  13735. args: [],
  13736. source: "atEnd\x0a\x09^self position = self size",
  13737. messageSends: ["=", "size", "position"],
  13738. referencedClasses: []
  13739. }),
  13740. smalltalk.Stream);
  13741. smalltalk.addMethod(
  13742. smalltalk.method({
  13743. selector: "atStart",
  13744. category: 'testing',
  13745. fn: function (){
  13746. var self=this;
  13747. return smalltalk.withContext(function($ctx1) {
  13748. var $1;
  13749. $1=_st(_st(self)._position()).__eq((0));
  13750. return $1;
  13751. }, function($ctx1) {$ctx1.fill(self,"atStart",{},smalltalk.Stream)})},
  13752. args: [],
  13753. source: "atStart\x0a\x09^self position = 0",
  13754. messageSends: ["=", "position"],
  13755. referencedClasses: []
  13756. }),
  13757. smalltalk.Stream);
  13758. smalltalk.addMethod(
  13759. smalltalk.method({
  13760. selector: "close",
  13761. category: 'actions',
  13762. fn: function (){
  13763. var self=this;
  13764. return smalltalk.withContext(function($ctx1) {
  13765. return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Stream)})},
  13766. args: [],
  13767. source: "close",
  13768. messageSends: [],
  13769. referencedClasses: []
  13770. }),
  13771. smalltalk.Stream);
  13772. smalltalk.addMethod(
  13773. smalltalk.method({
  13774. selector: "collection",
  13775. category: 'accessing',
  13776. fn: function (){
  13777. var self=this;
  13778. return smalltalk.withContext(function($ctx1) {
  13779. var $1;
  13780. $1=self["@collection"];
  13781. return $1;
  13782. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.Stream)})},
  13783. args: [],
  13784. source: "collection\x0a\x09^collection",
  13785. messageSends: [],
  13786. referencedClasses: []
  13787. }),
  13788. smalltalk.Stream);
  13789. smalltalk.addMethod(
  13790. smalltalk.method({
  13791. selector: "contents",
  13792. category: 'accessing',
  13793. fn: function (){
  13794. var self=this;
  13795. return smalltalk.withContext(function($ctx1) {
  13796. var $1;
  13797. $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize());
  13798. return $1;
  13799. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.Stream)})},
  13800. args: [],
  13801. source: "contents\x0a\x09^self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13802. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  13803. referencedClasses: []
  13804. }),
  13805. smalltalk.Stream);
  13806. smalltalk.addMethod(
  13807. smalltalk.method({
  13808. selector: "do:",
  13809. category: 'enumerating',
  13810. fn: function (aBlock){
  13811. var self=this;
  13812. return smalltalk.withContext(function($ctx1) {
  13813. _st((function(){
  13814. return smalltalk.withContext(function($ctx2) {
  13815. return _st(self)._atEnd();
  13816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  13817. return smalltalk.withContext(function($ctx2) {
  13818. return _st(aBlock)._value_(_st(self)._next());
  13819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13820. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Stream)})},
  13821. args: ["aBlock"],
  13822. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  13823. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  13824. referencedClasses: []
  13825. }),
  13826. smalltalk.Stream);
  13827. smalltalk.addMethod(
  13828. smalltalk.method({
  13829. selector: "flush",
  13830. category: 'actions',
  13831. fn: function (){
  13832. var self=this;
  13833. return smalltalk.withContext(function($ctx1) {
  13834. return self}, function($ctx1) {$ctx1.fill(self,"flush",{},smalltalk.Stream)})},
  13835. args: [],
  13836. source: "flush",
  13837. messageSends: [],
  13838. referencedClasses: []
  13839. }),
  13840. smalltalk.Stream);
  13841. smalltalk.addMethod(
  13842. smalltalk.method({
  13843. selector: "isEmpty",
  13844. category: 'testing',
  13845. fn: function (){
  13846. var self=this;
  13847. return smalltalk.withContext(function($ctx1) {
  13848. var $1;
  13849. $1=_st(_st(self)._size()).__eq((0));
  13850. return $1;
  13851. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Stream)})},
  13852. args: [],
  13853. source: "isEmpty\x0a\x09^self size = 0",
  13854. messageSends: ["=", "size"],
  13855. referencedClasses: []
  13856. }),
  13857. smalltalk.Stream);
  13858. smalltalk.addMethod(
  13859. smalltalk.method({
  13860. selector: "next",
  13861. category: 'reading',
  13862. fn: function (){
  13863. var self=this;
  13864. return smalltalk.withContext(function($ctx1) {
  13865. var $2,$1;
  13866. $2=_st(self)._atEnd();
  13867. if(smalltalk.assert($2)){
  13868. $1=nil;
  13869. } else {
  13870. _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  13871. $1=_st(self["@collection"])._at_(_st(self)._position());
  13872. };
  13873. return $1;
  13874. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Stream)})},
  13875. args: [],
  13876. source: "next\x0a\x09^self atEnd\x0a\x09\x09ifTrue: [nil]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position]",
  13877. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  13878. referencedClasses: []
  13879. }),
  13880. smalltalk.Stream);
  13881. smalltalk.addMethod(
  13882. smalltalk.method({
  13883. selector: "next:",
  13884. category: 'reading',
  13885. fn: function (anInteger){
  13886. var self=this;
  13887. var tempCollection;
  13888. return smalltalk.withContext(function($ctx1) {
  13889. var $1,$2;
  13890. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  13891. _st(anInteger)._timesRepeat_((function(){
  13892. return smalltalk.withContext(function($ctx2) {
  13893. $1=_st(self)._atEnd();
  13894. if(! smalltalk.assert($1)){
  13895. return _st(tempCollection)._add_(_st(self)._next());
  13896. };
  13897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13898. $2=tempCollection;
  13899. return $2;
  13900. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.Stream)})},
  13901. args: ["anInteger"],
  13902. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next]].\x0a\x09^tempCollection",
  13903. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  13904. referencedClasses: []
  13905. }),
  13906. smalltalk.Stream);
  13907. smalltalk.addMethod(
  13908. smalltalk.method({
  13909. selector: "nextPut:",
  13910. category: 'writing',
  13911. fn: function (anObject){
  13912. var self=this;
  13913. return smalltalk.withContext(function($ctx1) {
  13914. _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  13915. _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject);
  13916. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  13917. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Stream)})},
  13918. args: ["anObject"],
  13919. source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  13920. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  13921. referencedClasses: []
  13922. }),
  13923. smalltalk.Stream);
  13924. smalltalk.addMethod(
  13925. smalltalk.method({
  13926. selector: "nextPutAll:",
  13927. category: 'writing',
  13928. fn: function (aCollection){
  13929. var self=this;
  13930. return smalltalk.withContext(function($ctx1) {
  13931. _st(aCollection)._do_((function(each){
  13932. return smalltalk.withContext(function($ctx2) {
  13933. return _st(self)._nextPut_(each);
  13934. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  13935. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},smalltalk.Stream)})},
  13936. args: ["aCollection"],
  13937. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self nextPut: each]",
  13938. messageSends: ["do:", "nextPut:"],
  13939. referencedClasses: []
  13940. }),
  13941. smalltalk.Stream);
  13942. smalltalk.addMethod(
  13943. smalltalk.method({
  13944. selector: "nextPutString:",
  13945. category: 'writing',
  13946. fn: function (aString){
  13947. var self=this;
  13948. return smalltalk.withContext(function($ctx1) {
  13949. _st(self)._nextPut_(aString);
  13950. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.Stream)})},
  13951. args: ["aString"],
  13952. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13953. messageSends: ["nextPut:"],
  13954. referencedClasses: []
  13955. }),
  13956. smalltalk.Stream);
  13957. smalltalk.addMethod(
  13958. smalltalk.method({
  13959. selector: "peek",
  13960. category: 'reading',
  13961. fn: function (){
  13962. var self=this;
  13963. return smalltalk.withContext(function($ctx1) {
  13964. var $2,$1;
  13965. $2=_st(self)._atEnd();
  13966. if(! smalltalk.assert($2)){
  13967. $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1)));
  13968. };
  13969. return $1;
  13970. }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.Stream)})},
  13971. args: [],
  13972. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1]",
  13973. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  13974. referencedClasses: []
  13975. }),
  13976. smalltalk.Stream);
  13977. smalltalk.addMethod(
  13978. smalltalk.method({
  13979. selector: "position",
  13980. category: 'accessing',
  13981. fn: function (){
  13982. var self=this;
  13983. return smalltalk.withContext(function($ctx1) {
  13984. var $2,$1;
  13985. $2=self["@position"];
  13986. if(($receiver = $2) == nil || $receiver == undefined){
  13987. self["@position"]=(0);
  13988. $1=self["@position"];
  13989. } else {
  13990. $1=$2;
  13991. };
  13992. return $1;
  13993. }, function($ctx1) {$ctx1.fill(self,"position",{},smalltalk.Stream)})},
  13994. args: [],
  13995. source: "position\x0a\x09^position ifNil: [position := 0]",
  13996. messageSends: ["ifNil:"],
  13997. referencedClasses: []
  13998. }),
  13999. smalltalk.Stream);
  14000. smalltalk.addMethod(
  14001. smalltalk.method({
  14002. selector: "position:",
  14003. category: 'accessing',
  14004. fn: function (anInteger){
  14005. var self=this;
  14006. return smalltalk.withContext(function($ctx1) {
  14007. self["@position"]=anInteger;
  14008. return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger},smalltalk.Stream)})},
  14009. args: ["anInteger"],
  14010. source: "position: anInteger\x0a\x09position := anInteger",
  14011. messageSends: [],
  14012. referencedClasses: []
  14013. }),
  14014. smalltalk.Stream);
  14015. smalltalk.addMethod(
  14016. smalltalk.method({
  14017. selector: "reset",
  14018. category: 'actions',
  14019. fn: function (){
  14020. var self=this;
  14021. return smalltalk.withContext(function($ctx1) {
  14022. _st(self)._position_((0));
  14023. return self}, function($ctx1) {$ctx1.fill(self,"reset",{},smalltalk.Stream)})},
  14024. args: [],
  14025. source: "reset\x0a\x09self position: 0",
  14026. messageSends: ["position:"],
  14027. referencedClasses: []
  14028. }),
  14029. smalltalk.Stream);
  14030. smalltalk.addMethod(
  14031. smalltalk.method({
  14032. selector: "resetContents",
  14033. category: 'actions',
  14034. fn: function (){
  14035. var self=this;
  14036. return smalltalk.withContext(function($ctx1) {
  14037. _st(self)._reset();
  14038. _st(self)._setStreamSize_((0));
  14039. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},smalltalk.Stream)})},
  14040. args: [],
  14041. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  14042. messageSends: ["reset", "setStreamSize:"],
  14043. referencedClasses: []
  14044. }),
  14045. smalltalk.Stream);
  14046. smalltalk.addMethod(
  14047. smalltalk.method({
  14048. selector: "setCollection:",
  14049. category: 'accessing',
  14050. fn: function (aCollection){
  14051. var self=this;
  14052. return smalltalk.withContext(function($ctx1) {
  14053. self["@collection"]=aCollection;
  14054. return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection},smalltalk.Stream)})},
  14055. args: ["aCollection"],
  14056. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  14057. messageSends: [],
  14058. referencedClasses: []
  14059. }),
  14060. smalltalk.Stream);
  14061. smalltalk.addMethod(
  14062. smalltalk.method({
  14063. selector: "setStreamSize:",
  14064. category: 'accessing',
  14065. fn: function (anInteger){
  14066. var self=this;
  14067. return smalltalk.withContext(function($ctx1) {
  14068. self["@streamSize"]=anInteger;
  14069. return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger},smalltalk.Stream)})},
  14070. args: ["anInteger"],
  14071. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  14072. messageSends: [],
  14073. referencedClasses: []
  14074. }),
  14075. smalltalk.Stream);
  14076. smalltalk.addMethod(
  14077. smalltalk.method({
  14078. selector: "setToEnd",
  14079. category: 'positioning',
  14080. fn: function (){
  14081. var self=this;
  14082. return smalltalk.withContext(function($ctx1) {
  14083. _st(self)._position_(_st(self)._size());
  14084. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},smalltalk.Stream)})},
  14085. args: [],
  14086. source: "setToEnd\x0a\x09self position: self size",
  14087. messageSends: ["position:", "size"],
  14088. referencedClasses: []
  14089. }),
  14090. smalltalk.Stream);
  14091. smalltalk.addMethod(
  14092. smalltalk.method({
  14093. selector: "size",
  14094. category: 'accessing',
  14095. fn: function (){
  14096. var self=this;
  14097. return smalltalk.withContext(function($ctx1) {
  14098. var $1;
  14099. $1=_st(self)._streamSize();
  14100. return $1;
  14101. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Stream)})},
  14102. args: [],
  14103. source: "size\x0a\x09^self streamSize",
  14104. messageSends: ["streamSize"],
  14105. referencedClasses: []
  14106. }),
  14107. smalltalk.Stream);
  14108. smalltalk.addMethod(
  14109. smalltalk.method({
  14110. selector: "skip:",
  14111. category: 'positioning',
  14112. fn: function (anInteger){
  14113. var self=this;
  14114. return smalltalk.withContext(function($ctx1) {
  14115. _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0)));
  14116. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},smalltalk.Stream)})},
  14117. args: ["anInteger"],
  14118. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  14119. messageSends: ["position:", "min:max:", "size", "+", "position"],
  14120. referencedClasses: []
  14121. }),
  14122. smalltalk.Stream);
  14123. smalltalk.addMethod(
  14124. smalltalk.method({
  14125. selector: "streamSize",
  14126. category: 'accessing',
  14127. fn: function (){
  14128. var self=this;
  14129. return smalltalk.withContext(function($ctx1) {
  14130. var $1;
  14131. $1=self["@streamSize"];
  14132. return $1;
  14133. }, function($ctx1) {$ctx1.fill(self,"streamSize",{},smalltalk.Stream)})},
  14134. args: [],
  14135. source: "streamSize\x0a\x09^streamSize",
  14136. messageSends: [],
  14137. referencedClasses: []
  14138. }),
  14139. smalltalk.Stream);
  14140. smalltalk.addMethod(
  14141. smalltalk.method({
  14142. selector: "write:",
  14143. category: 'writing',
  14144. fn: function (anObject){
  14145. var self=this;
  14146. return smalltalk.withContext(function($ctx1) {
  14147. _st(anObject)._putOn_(self);
  14148. return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},smalltalk.Stream)})},
  14149. args: ["anObject"],
  14150. source: "write: anObject\x0a\x09anObject putOn: self",
  14151. messageSends: ["putOn:"],
  14152. referencedClasses: []
  14153. }),
  14154. smalltalk.Stream);
  14155. smalltalk.addMethod(
  14156. smalltalk.method({
  14157. selector: "on:",
  14158. category: 'instance creation',
  14159. fn: function (aCollection){
  14160. var self=this;
  14161. return smalltalk.withContext(function($ctx1) {
  14162. var $2,$3,$1;
  14163. $2=_st(self)._new();
  14164. _st($2)._setCollection_(aCollection);
  14165. _st($2)._setStreamSize_(_st(aCollection)._size());
  14166. $3=_st($2)._yourself();
  14167. $1=$3;
  14168. return $1;
  14169. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},smalltalk.Stream.klass)})},
  14170. args: ["aCollection"],
  14171. source: "on: aCollection\x0a\x09\x09^self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  14172. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  14173. referencedClasses: []
  14174. }),
  14175. smalltalk.Stream.klass);
  14176. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  14177. smalltalk.StringStream.comment="I am a Stream specific to `String` objects."
  14178. smalltalk.addMethod(
  14179. smalltalk.method({
  14180. selector: "cr",
  14181. category: 'writing',
  14182. fn: function (){
  14183. var self=this;
  14184. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  14185. return smalltalk.withContext(function($ctx1) {
  14186. var $1;
  14187. $1=_st(self)._nextPutAll_(_st($String())._cr());
  14188. return $1;
  14189. }, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.StringStream)})},
  14190. args: [],
  14191. source: "cr\x0a\x09^self nextPutAll: String cr",
  14192. messageSends: ["nextPutAll:", "cr"],
  14193. referencedClasses: ["String"]
  14194. }),
  14195. smalltalk.StringStream);
  14196. smalltalk.addMethod(
  14197. smalltalk.method({
  14198. selector: "crlf",
  14199. category: 'writing',
  14200. fn: function (){
  14201. var self=this;
  14202. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  14203. return smalltalk.withContext(function($ctx1) {
  14204. var $1;
  14205. $1=_st(self)._nextPutAll_(_st($String())._crlf());
  14206. return $1;
  14207. }, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.StringStream)})},
  14208. args: [],
  14209. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  14210. messageSends: ["nextPutAll:", "crlf"],
  14211. referencedClasses: ["String"]
  14212. }),
  14213. smalltalk.StringStream);
  14214. smalltalk.addMethod(
  14215. smalltalk.method({
  14216. selector: "lf",
  14217. category: 'writing',
  14218. fn: function (){
  14219. var self=this;
  14220. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  14221. return smalltalk.withContext(function($ctx1) {
  14222. var $1;
  14223. $1=_st(self)._nextPutAll_(_st($String())._lf());
  14224. return $1;
  14225. }, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.StringStream)})},
  14226. args: [],
  14227. source: "lf\x0a\x09^self nextPutAll: String lf",
  14228. messageSends: ["nextPutAll:", "lf"],
  14229. referencedClasses: ["String"]
  14230. }),
  14231. smalltalk.StringStream);
  14232. smalltalk.addMethod(
  14233. smalltalk.method({
  14234. selector: "next:",
  14235. category: 'reading',
  14236. fn: function (anInteger){
  14237. var self=this;
  14238. var tempCollection;
  14239. return smalltalk.withContext(function($ctx1) {
  14240. var $1,$2;
  14241. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  14242. _st(anInteger)._timesRepeat_((function(){
  14243. return smalltalk.withContext(function($ctx2) {
  14244. $1=_st(self)._atEnd();
  14245. if(! smalltalk.assert($1)){
  14246. tempCollection=_st(tempCollection).__comma(_st(self)._next());
  14247. return tempCollection;
  14248. };
  14249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14250. $2=tempCollection;
  14251. return $2;
  14252. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.StringStream)})},
  14253. args: ["anInteger"],
  14254. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next]].\x0a\x09^tempCollection",
  14255. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  14256. referencedClasses: []
  14257. }),
  14258. smalltalk.StringStream);
  14259. smalltalk.addMethod(
  14260. smalltalk.method({
  14261. selector: "nextPut:",
  14262. category: 'writing',
  14263. fn: function (aString){
  14264. var self=this;
  14265. return smalltalk.withContext(function($ctx1) {
  14266. _st(self)._nextPutAll_(aString);
  14267. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},smalltalk.StringStream)})},
  14268. args: ["aString"],
  14269. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14270. messageSends: ["nextPutAll:"],
  14271. referencedClasses: []
  14272. }),
  14273. smalltalk.StringStream);
  14274. smalltalk.addMethod(
  14275. smalltalk.method({
  14276. selector: "nextPutAll:",
  14277. category: 'writing',
  14278. fn: function (aString){
  14279. var self=this;
  14280. var pre,post;
  14281. return smalltalk.withContext(function($ctx1) {
  14282. var $1;
  14283. $1=_st(self)._atEnd();
  14284. if(smalltalk.assert($1)){
  14285. _st(self)._setCollection_(_st(_st(self)._collection()).__comma(aString));
  14286. } else {
  14287. pre=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._position());
  14288. pre;
  14289. post=_st(_st(self)._collection())._copyFrom_to_(_st(_st(_st(self)._position()).__plus((1))).__plus(_st(aString)._size()),_st(_st(self)._collection())._size());
  14290. post;
  14291. _st(self)._setCollection_(_st(_st(pre).__comma(aString)).__comma(post));
  14292. };
  14293. _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size()));
  14294. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  14295. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},smalltalk.StringStream)})},
  14296. args: ["aString"],
  14297. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  14298. messageSends: ["ifTrue:ifFalse:", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "atEnd", "position:", "setStreamSize:", "max:", "streamSize"],
  14299. referencedClasses: []
  14300. }),
  14301. smalltalk.StringStream);
  14302. smalltalk.addMethod(
  14303. smalltalk.method({
  14304. selector: "nextPutString:",
  14305. category: 'writing',
  14306. fn: function (aString){
  14307. var self=this;
  14308. return smalltalk.withContext(function($ctx1) {
  14309. _st(self)._nextPutAll_(aString);
  14310. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.StringStream)})},
  14311. args: ["aString"],
  14312. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14313. messageSends: ["nextPutAll:"],
  14314. referencedClasses: []
  14315. }),
  14316. smalltalk.StringStream);
  14317. smalltalk.addMethod(
  14318. smalltalk.method({
  14319. selector: "space",
  14320. category: 'writing',
  14321. fn: function (){
  14322. var self=this;
  14323. return smalltalk.withContext(function($ctx1) {
  14324. _st(self)._nextPut_(" ");
  14325. return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.StringStream)})},
  14326. args: [],
  14327. source: "space\x0a\x09self nextPut: ' '",
  14328. messageSends: ["nextPut:"],
  14329. referencedClasses: []
  14330. }),
  14331. smalltalk.StringStream);
  14332. smalltalk.addMethod(
  14333. smalltalk.method({
  14334. selector: "tab",
  14335. category: 'writing',
  14336. fn: function (){
  14337. var self=this;
  14338. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  14339. return smalltalk.withContext(function($ctx1) {
  14340. var $1;
  14341. $1=_st(self)._nextPutAll_(_st($String())._tab());
  14342. return $1;
  14343. }, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.StringStream)})},
  14344. args: [],
  14345. source: "tab\x0a\x09^self nextPutAll: String tab",
  14346. messageSends: ["nextPutAll:", "tab"],
  14347. referencedClasses: ["String"]
  14348. }),
  14349. smalltalk.StringStream);
  14350. smalltalk.addPackage('Kernel-Exceptions');
  14351. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  14352. smalltalk.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner."
  14353. smalltalk.addMethod(
  14354. smalltalk.method({
  14355. selector: "context",
  14356. category: 'accessing',
  14357. fn: function (){
  14358. var self=this;
  14359. return smalltalk.withContext(function($ctx1) {
  14360. return self.context;
  14361. return self}, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.Error)})},
  14362. args: [],
  14363. source: "context\x0a\x09<return self.context>",
  14364. messageSends: [],
  14365. referencedClasses: []
  14366. }),
  14367. smalltalk.Error);
  14368. smalltalk.addMethod(
  14369. smalltalk.method({
  14370. selector: "initialize",
  14371. category: 'initialization',
  14372. fn: function (){
  14373. var self=this;
  14374. return smalltalk.withContext(function($ctx1) {
  14375. _st(self)._messageText_(_st("Errorclass: ").__comma(_st(_st(self)._class())._name()));
  14376. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Error)})},
  14377. args: [],
  14378. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  14379. messageSends: ["messageText:", ",", "name", "class"],
  14380. referencedClasses: []
  14381. }),
  14382. smalltalk.Error);
  14383. smalltalk.addMethod(
  14384. smalltalk.method({
  14385. selector: "isSmalltalkError",
  14386. category: 'testing',
  14387. fn: function (){
  14388. var self=this;
  14389. return smalltalk.withContext(function($ctx1) {
  14390. return self.smalltalkError === true;
  14391. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},smalltalk.Error)})},
  14392. args: [],
  14393. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  14394. messageSends: [],
  14395. referencedClasses: []
  14396. }),
  14397. smalltalk.Error);
  14398. smalltalk.addMethod(
  14399. smalltalk.method({
  14400. selector: "jsStack",
  14401. category: 'accessing',
  14402. fn: function (){
  14403. var self=this;
  14404. return smalltalk.withContext(function($ctx1) {
  14405. return self.stack;
  14406. return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},smalltalk.Error)})},
  14407. args: [],
  14408. source: "jsStack\x0a\x09<return self.stack>",
  14409. messageSends: [],
  14410. referencedClasses: []
  14411. }),
  14412. smalltalk.Error);
  14413. smalltalk.addMethod(
  14414. smalltalk.method({
  14415. selector: "messageText",
  14416. category: 'accessing',
  14417. fn: function (){
  14418. var self=this;
  14419. return smalltalk.withContext(function($ctx1) {
  14420. var $1;
  14421. $1=self["@messageText"];
  14422. return $1;
  14423. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.Error)})},
  14424. args: [],
  14425. source: "messageText\x0a\x09^messageText",
  14426. messageSends: [],
  14427. referencedClasses: []
  14428. }),
  14429. smalltalk.Error);
  14430. smalltalk.addMethod(
  14431. smalltalk.method({
  14432. selector: "messageText:",
  14433. category: 'accessing',
  14434. fn: function (aString){
  14435. var self=this;
  14436. return smalltalk.withContext(function($ctx1) {
  14437. self["@messageText"]=aString;
  14438. return self}, function($ctx1) {$ctx1.fill(self,"messageText:",{aString:aString},smalltalk.Error)})},
  14439. args: ["aString"],
  14440. source: "messageText: aString\x0a\x09messageText := aString",
  14441. messageSends: [],
  14442. referencedClasses: []
  14443. }),
  14444. smalltalk.Error);
  14445. smalltalk.addMethod(
  14446. smalltalk.method({
  14447. selector: "signal",
  14448. category: 'signaling',
  14449. fn: function (){
  14450. var self=this;
  14451. return smalltalk.withContext(function($ctx1) {
  14452. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  14453. return self}, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error)})},
  14454. args: [],
  14455. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  14456. messageSends: [],
  14457. referencedClasses: []
  14458. }),
  14459. smalltalk.Error);
  14460. smalltalk.addMethod(
  14461. smalltalk.method({
  14462. selector: "signal:",
  14463. category: 'signaling',
  14464. fn: function (aString){
  14465. var self=this;
  14466. return smalltalk.withContext(function($ctx1) {
  14467. _st(self)._messageText_(aString);
  14468. _st(self)._signal();
  14469. return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error)})},
  14470. args: ["aString"],
  14471. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  14472. messageSends: ["messageText:", "signal"],
  14473. referencedClasses: []
  14474. }),
  14475. smalltalk.Error);
  14476. smalltalk.addMethod(
  14477. smalltalk.method({
  14478. selector: "signal",
  14479. category: 'instance creation',
  14480. fn: function (){
  14481. var self=this;
  14482. return smalltalk.withContext(function($ctx1) {
  14483. var $1;
  14484. $1=_st(_st(self)._new())._signal();
  14485. return $1;
  14486. }, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error.klass)})},
  14487. args: [],
  14488. source: "signal\x0a\x09^self new signal",
  14489. messageSends: ["signal", "new"],
  14490. referencedClasses: []
  14491. }),
  14492. smalltalk.Error.klass);
  14493. smalltalk.addMethod(
  14494. smalltalk.method({
  14495. selector: "signal:",
  14496. category: 'instance creation',
  14497. fn: function (aString){
  14498. var self=this;
  14499. return smalltalk.withContext(function($ctx1) {
  14500. var $1;
  14501. $1=_st(_st(self)._new())._signal_(aString);
  14502. return $1;
  14503. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error.klass)})},
  14504. args: ["aString"],
  14505. source: "signal: aString\x0a\x09\x09^self new\x0a\x09\x09signal: aString",
  14506. messageSends: ["signal:", "new"],
  14507. referencedClasses: []
  14508. }),
  14509. smalltalk.Error.klass);
  14510. smalltalk.addClass('JavaScriptException', smalltalk.Error, ['exception'], 'Kernel-Exceptions');
  14511. smalltalk.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`"
  14512. smalltalk.addMethod(
  14513. smalltalk.method({
  14514. selector: "context:",
  14515. category: 'accessing',
  14516. fn: function (aMethodContext){
  14517. var self=this;
  14518. return smalltalk.withContext(function($ctx1) {
  14519. self.context = aMethodContext;
  14520. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},smalltalk.JavaScriptException)})},
  14521. args: ["aMethodContext"],
  14522. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<self.context = aMethodContext>",
  14523. messageSends: [],
  14524. referencedClasses: []
  14525. }),
  14526. smalltalk.JavaScriptException);
  14527. smalltalk.addMethod(
  14528. smalltalk.method({
  14529. selector: "exception",
  14530. category: 'accessing',
  14531. fn: function (){
  14532. var self=this;
  14533. return smalltalk.withContext(function($ctx1) {
  14534. var $1;
  14535. $1=self["@exception"];
  14536. return $1;
  14537. }, function($ctx1) {$ctx1.fill(self,"exception",{},smalltalk.JavaScriptException)})},
  14538. args: [],
  14539. source: "exception\x0a\x09^ exception",
  14540. messageSends: [],
  14541. referencedClasses: []
  14542. }),
  14543. smalltalk.JavaScriptException);
  14544. smalltalk.addMethod(
  14545. smalltalk.method({
  14546. selector: "exception:",
  14547. category: 'accessing',
  14548. fn: function (anException){
  14549. var self=this;
  14550. return smalltalk.withContext(function($ctx1) {
  14551. self["@exception"]=anException;
  14552. return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException},smalltalk.JavaScriptException)})},
  14553. args: ["anException"],
  14554. source: "exception: anException\x0a\x09exception := anException",
  14555. messageSends: [],
  14556. referencedClasses: []
  14557. }),
  14558. smalltalk.JavaScriptException);
  14559. smalltalk.addMethod(
  14560. smalltalk.method({
  14561. selector: "messageText",
  14562. category: 'accessing',
  14563. fn: function (){
  14564. var self=this;
  14565. return smalltalk.withContext(function($ctx1) {
  14566. return 'JavaScript exception: ' + self["@exception"].toString();
  14567. return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.JavaScriptException)})},
  14568. args: [],
  14569. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  14570. messageSends: [],
  14571. referencedClasses: []
  14572. }),
  14573. smalltalk.JavaScriptException);
  14574. smalltalk.addMethod(
  14575. smalltalk.method({
  14576. selector: "on:",
  14577. category: 'instance creation',
  14578. fn: function (anException){
  14579. var self=this;
  14580. return smalltalk.withContext(function($ctx1) {
  14581. var $2,$3,$1;
  14582. $2=_st(self)._new();
  14583. _st($2)._exception_(anException);
  14584. $3=_st($2)._yourself();
  14585. $1=$3;
  14586. return $1;
  14587. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},smalltalk.JavaScriptException.klass)})},
  14588. args: ["anException"],
  14589. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  14590. messageSends: ["exception:", "new", "yourself"],
  14591. referencedClasses: []
  14592. }),
  14593. smalltalk.JavaScriptException.klass);
  14594. smalltalk.addMethod(
  14595. smalltalk.method({
  14596. selector: "on:context:",
  14597. category: 'instance creation',
  14598. fn: function (anException,aMethodContext){
  14599. var self=this;
  14600. return smalltalk.withContext(function($ctx1) {
  14601. var $2,$3,$1;
  14602. $2=_st(self)._new();
  14603. _st($2)._exception_(anException);
  14604. _st($2)._context_(aMethodContext);
  14605. $3=_st($2)._yourself();
  14606. $1=$3;
  14607. return $1;
  14608. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},smalltalk.JavaScriptException.klass)})},
  14609. args: ["anException", "aMethodContext"],
  14610. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  14611. messageSends: ["exception:", "new", "context:", "yourself"],
  14612. referencedClasses: []
  14613. }),
  14614. smalltalk.JavaScriptException.klass);
  14615. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  14616. smalltalk.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`."
  14617. smalltalk.addMethod(
  14618. smalltalk.method({
  14619. selector: "message",
  14620. category: 'accessing',
  14621. fn: function (){
  14622. var self=this;
  14623. return smalltalk.withContext(function($ctx1) {
  14624. var $1;
  14625. $1=self["@message"];
  14626. return $1;
  14627. }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.MessageNotUnderstood)})},
  14628. args: [],
  14629. source: "message\x0a\x09^message",
  14630. messageSends: [],
  14631. referencedClasses: []
  14632. }),
  14633. smalltalk.MessageNotUnderstood);
  14634. smalltalk.addMethod(
  14635. smalltalk.method({
  14636. selector: "message:",
  14637. category: 'accessing',
  14638. fn: function (aMessage){
  14639. var self=this;
  14640. return smalltalk.withContext(function($ctx1) {
  14641. self["@message"]=aMessage;
  14642. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aMessage:aMessage},smalltalk.MessageNotUnderstood)})},
  14643. args: ["aMessage"],
  14644. source: "message: aMessage\x0a\x09message := aMessage",
  14645. messageSends: [],
  14646. referencedClasses: []
  14647. }),
  14648. smalltalk.MessageNotUnderstood);
  14649. smalltalk.addMethod(
  14650. smalltalk.method({
  14651. selector: "messageText",
  14652. category: 'accessing',
  14653. fn: function (){
  14654. var self=this;
  14655. return smalltalk.withContext(function($ctx1) {
  14656. var $1;
  14657. $1=_st(_st(_st(_st(self)._receiver())._asString()).__comma(" does not understand #")).__comma(_st(_st(self)._message())._selector());
  14658. return $1;
  14659. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.MessageNotUnderstood)})},
  14660. args: [],
  14661. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  14662. messageSends: [",", "selector", "message", "asString", "receiver"],
  14663. referencedClasses: []
  14664. }),
  14665. smalltalk.MessageNotUnderstood);
  14666. smalltalk.addMethod(
  14667. smalltalk.method({
  14668. selector: "receiver",
  14669. category: 'accessing',
  14670. fn: function (){
  14671. var self=this;
  14672. return smalltalk.withContext(function($ctx1) {
  14673. var $1;
  14674. $1=self["@receiver"];
  14675. return $1;
  14676. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageNotUnderstood)})},
  14677. args: [],
  14678. source: "receiver\x0a\x09^receiver",
  14679. messageSends: [],
  14680. referencedClasses: []
  14681. }),
  14682. smalltalk.MessageNotUnderstood);
  14683. smalltalk.addMethod(
  14684. smalltalk.method({
  14685. selector: "receiver:",
  14686. category: 'accessing',
  14687. fn: function (anObject){
  14688. var self=this;
  14689. return smalltalk.withContext(function($ctx1) {
  14690. self["@receiver"]=anObject;
  14691. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageNotUnderstood)})},
  14692. args: ["anObject"],
  14693. source: "receiver: anObject\x0a\x09receiver := anObject",
  14694. messageSends: [],
  14695. referencedClasses: []
  14696. }),
  14697. smalltalk.MessageNotUnderstood);
  14698. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  14699. smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver."
  14700. smalltalk.addMethod(
  14701. smalltalk.method({
  14702. selector: "object",
  14703. category: 'accessing',
  14704. fn: function (){
  14705. var self=this;
  14706. return smalltalk.withContext(function($ctx1) {
  14707. var $1;
  14708. $1=self["@object"];
  14709. return $1;
  14710. }, function($ctx1) {$ctx1.fill(self,"object",{},smalltalk.NonBooleanReceiver)})},
  14711. args: [],
  14712. source: "object\x0a\x09^ object",
  14713. messageSends: [],
  14714. referencedClasses: []
  14715. }),
  14716. smalltalk.NonBooleanReceiver);
  14717. smalltalk.addMethod(
  14718. smalltalk.method({
  14719. selector: "object:",
  14720. category: 'accessing',
  14721. fn: function (anObject){
  14722. var self=this;
  14723. return smalltalk.withContext(function($ctx1) {
  14724. self["@object"]=anObject;
  14725. return self}, function($ctx1) {$ctx1.fill(self,"object:",{anObject:anObject},smalltalk.NonBooleanReceiver)})},
  14726. args: ["anObject"],
  14727. source: "object: anObject\x0a\x09object := anObject",
  14728. messageSends: [],
  14729. referencedClasses: []
  14730. }),
  14731. smalltalk.NonBooleanReceiver);
  14732. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  14733. smalltalk.ErrorHandler.comment="ErrorHandler is used to manage Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aSubclasses of `ErrorHandler` can register themselves as the current handler with\x0a`ErrorHandler class >> register`.\x0a\x0aSubclasses may override `#handleError:` to perform an action on the thrown exception.\x0aThe default behavior is to log the error and the context stack to the JavaScript console."
  14734. smalltalk.addMethod(
  14735. smalltalk.method({
  14736. selector: "handleError:",
  14737. category: 'error handling',
  14738. fn: function (anError){
  14739. var self=this;
  14740. return smalltalk.withContext(function($ctx1) {
  14741. var $1;
  14742. $1=_st(anError)._context();
  14743. if(($receiver = $1) == nil || $receiver == undefined){
  14744. $1;
  14745. } else {
  14746. _st(self)._logErrorContext_(_st(anError)._context());
  14747. };
  14748. _st(self)._logError_(anError);
  14749. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.ErrorHandler)})},
  14750. args: ["anError"],
  14751. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  14752. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  14753. referencedClasses: []
  14754. }),
  14755. smalltalk.ErrorHandler);
  14756. smalltalk.addMethod(
  14757. smalltalk.method({
  14758. selector: "log:",
  14759. category: 'private',
  14760. fn: function (aString){
  14761. var self=this;
  14762. return smalltalk.withContext(function($ctx1) {
  14763. _st(console)._log_(aString);
  14764. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},smalltalk.ErrorHandler)})},
  14765. args: ["aString"],
  14766. source: "log: aString\x0a\x09console log: aString",
  14767. messageSends: ["log:"],
  14768. referencedClasses: []
  14769. }),
  14770. smalltalk.ErrorHandler);
  14771. smalltalk.addMethod(
  14772. smalltalk.method({
  14773. selector: "logContext:",
  14774. category: 'private',
  14775. fn: function (aContext){
  14776. var self=this;
  14777. return smalltalk.withContext(function($ctx1) {
  14778. var $1;
  14779. $1=_st(aContext)._home();
  14780. if(($receiver = $1) == nil || $receiver == undefined){
  14781. $1;
  14782. } else {
  14783. _st(self)._logContext_(_st(aContext)._home());
  14784. };
  14785. _st(self)._log_(_st(_st(_st(_st(aContext)._receiver())._asString()).__comma(">>")).__comma(_st(_st(aContext)._selector())._asString()));
  14786. return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  14787. args: ["aContext"],
  14788. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector asString",
  14789. messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "asString", "selector", "receiver"],
  14790. referencedClasses: []
  14791. }),
  14792. smalltalk.ErrorHandler);
  14793. smalltalk.addMethod(
  14794. smalltalk.method({
  14795. selector: "logError:",
  14796. category: 'private',
  14797. fn: function (anError){
  14798. var self=this;
  14799. return smalltalk.withContext(function($ctx1) {
  14800. _st(self)._log_(_st(anError)._messageText());
  14801. return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},smalltalk.ErrorHandler)})},
  14802. args: ["anError"],
  14803. source: "logError: anError\x0a\x09self log: anError messageText",
  14804. messageSends: ["log:", "messageText"],
  14805. referencedClasses: []
  14806. }),
  14807. smalltalk.ErrorHandler);
  14808. smalltalk.addMethod(
  14809. smalltalk.method({
  14810. selector: "logErrorContext:",
  14811. category: 'private',
  14812. fn: function (aContext){
  14813. var self=this;
  14814. return smalltalk.withContext(function($ctx1) {
  14815. var $1,$2;
  14816. $1=aContext;
  14817. if(($receiver = $1) == nil || $receiver == undefined){
  14818. $1;
  14819. } else {
  14820. $2=_st(aContext)._home();
  14821. if(($receiver = $2) == nil || $receiver == undefined){
  14822. $2;
  14823. } else {
  14824. _st(self)._logContext_(_st(aContext)._home());
  14825. };
  14826. };
  14827. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  14828. args: ["aContext"],
  14829. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  14830. messageSends: ["ifNotNil:", "logContext:", "home"],
  14831. referencedClasses: []
  14832. }),
  14833. smalltalk.ErrorHandler);
  14834. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  14835. smalltalk.addMethod(
  14836. smalltalk.method({
  14837. selector: "current",
  14838. category: 'accessing',
  14839. fn: function (){
  14840. var self=this;
  14841. return smalltalk.withContext(function($ctx1) {
  14842. var $2,$1;
  14843. $2=self["@current"];
  14844. if(($receiver = $2) == nil || $receiver == undefined){
  14845. self["@current"]=_st(self)._new();
  14846. $1=self["@current"];
  14847. } else {
  14848. $1=$2;
  14849. };
  14850. return $1;
  14851. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ErrorHandler.klass)})},
  14852. args: [],
  14853. source: "current\x0a\x09^current ifNil: [current := self new]",
  14854. messageSends: ["ifNil:", "new"],
  14855. referencedClasses: []
  14856. }),
  14857. smalltalk.ErrorHandler.klass);
  14858. smalltalk.addMethod(
  14859. smalltalk.method({
  14860. selector: "initialize",
  14861. category: 'initialization',
  14862. fn: function (){
  14863. var self=this;
  14864. return smalltalk.withContext(function($ctx1) {
  14865. _st(self)._register();
  14866. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ErrorHandler.klass)})},
  14867. args: [],
  14868. source: "initialize\x0a\x09self register",
  14869. messageSends: ["register"],
  14870. referencedClasses: []
  14871. }),
  14872. smalltalk.ErrorHandler.klass);
  14873. smalltalk.addMethod(
  14874. smalltalk.method({
  14875. selector: "register",
  14876. category: 'initialization',
  14877. fn: function (){
  14878. var self=this;
  14879. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  14880. return smalltalk.withContext(function($ctx1) {
  14881. _st($ErrorHandler())._setCurrent_(_st(self)._new());
  14882. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ErrorHandler.klass)})},
  14883. args: [],
  14884. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  14885. messageSends: ["setCurrent:", "new"],
  14886. referencedClasses: ["ErrorHandler"]
  14887. }),
  14888. smalltalk.ErrorHandler.klass);
  14889. smalltalk.addMethod(
  14890. smalltalk.method({
  14891. selector: "setCurrent:",
  14892. category: 'accessing',
  14893. fn: function (anHandler){
  14894. var self=this;
  14895. return smalltalk.withContext(function($ctx1) {
  14896. self["@current"]=anHandler;
  14897. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ErrorHandler.klass)})},
  14898. args: ["anHandler"],
  14899. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  14900. messageSends: [],
  14901. referencedClasses: []
  14902. }),
  14903. smalltalk.ErrorHandler.klass);
  14904. smalltalk.addPackage('Kernel-Transcript');
  14905. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  14906. smalltalk.addMethod(
  14907. smalltalk.method({
  14908. selector: "clear",
  14909. category: 'printing',
  14910. fn: function (){
  14911. var self=this;
  14912. return smalltalk.withContext(function($ctx1) {
  14913. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.ConsoleTranscript)})},
  14914. args: [],
  14915. source: "clear\x0a\x09\x22no op\x22",
  14916. messageSends: [],
  14917. referencedClasses: []
  14918. }),
  14919. smalltalk.ConsoleTranscript);
  14920. smalltalk.addMethod(
  14921. smalltalk.method({
  14922. selector: "cr",
  14923. category: 'printing',
  14924. fn: function (){
  14925. var self=this;
  14926. return smalltalk.withContext(function($ctx1) {
  14927. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.ConsoleTranscript)})},
  14928. args: [],
  14929. source: "cr\x0a\x09\x22no op\x22",
  14930. messageSends: [],
  14931. referencedClasses: []
  14932. }),
  14933. smalltalk.ConsoleTranscript);
  14934. smalltalk.addMethod(
  14935. smalltalk.method({
  14936. selector: "open",
  14937. category: 'actions',
  14938. fn: function (){
  14939. var self=this;
  14940. return smalltalk.withContext(function($ctx1) {
  14941. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.ConsoleTranscript)})},
  14942. args: [],
  14943. source: "open",
  14944. messageSends: [],
  14945. referencedClasses: []
  14946. }),
  14947. smalltalk.ConsoleTranscript);
  14948. smalltalk.addMethod(
  14949. smalltalk.method({
  14950. selector: "show:",
  14951. category: 'printing',
  14952. fn: function (anObject){
  14953. var self=this;
  14954. return smalltalk.withContext(function($ctx1) {
  14955. console.log(String(string._asString()));
  14956. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.ConsoleTranscript)})},
  14957. args: ["anObject"],
  14958. source: "show: anObject\x0a\x09<console.log(String(string._asString()))>",
  14959. messageSends: [],
  14960. referencedClasses: []
  14961. }),
  14962. smalltalk.ConsoleTranscript);
  14963. smalltalk.addMethod(
  14964. smalltalk.method({
  14965. selector: "initialize",
  14966. category: 'initialization',
  14967. fn: function (){
  14968. var self=this;
  14969. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  14970. return smalltalk.withContext(function($ctx1) {
  14971. _st($Transcript())._register_(_st(self)._new());
  14972. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ConsoleTranscript.klass)})},
  14973. args: [],
  14974. source: "initialize\x0a\x09Transcript register: self new",
  14975. messageSends: ["register:", "new"],
  14976. referencedClasses: ["Transcript"]
  14977. }),
  14978. smalltalk.ConsoleTranscript.klass);
  14979. smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  14980. smalltalk.Transcript.klass.iVarNames = ['current'];
  14981. smalltalk.addMethod(
  14982. smalltalk.method({
  14983. selector: "clear",
  14984. category: 'printing',
  14985. fn: function (){
  14986. var self=this;
  14987. return smalltalk.withContext(function($ctx1) {
  14988. _st(_st(self)._current())._clear();
  14989. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.Transcript.klass)})},
  14990. args: [],
  14991. source: "clear\x0a\x09self current clear",
  14992. messageSends: ["clear", "current"],
  14993. referencedClasses: []
  14994. }),
  14995. smalltalk.Transcript.klass);
  14996. smalltalk.addMethod(
  14997. smalltalk.method({
  14998. selector: "cr",
  14999. category: 'printing',
  15000. fn: function (){
  15001. var self=this;
  15002. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15003. return smalltalk.withContext(function($ctx1) {
  15004. _st(_st(self)._current())._show_(_st($String())._cr());
  15005. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.Transcript.klass)})},
  15006. args: [],
  15007. source: "cr\x0a\x09self current show: String cr",
  15008. messageSends: ["show:", "cr", "current"],
  15009. referencedClasses: ["String"]
  15010. }),
  15011. smalltalk.Transcript.klass);
  15012. smalltalk.addMethod(
  15013. smalltalk.method({
  15014. selector: "current",
  15015. category: 'instance creation',
  15016. fn: function (){
  15017. var self=this;
  15018. return smalltalk.withContext(function($ctx1) {
  15019. var $1;
  15020. $1=self["@current"];
  15021. return $1;
  15022. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Transcript.klass)})},
  15023. args: [],
  15024. source: "current\x0a\x09^current",
  15025. messageSends: [],
  15026. referencedClasses: []
  15027. }),
  15028. smalltalk.Transcript.klass);
  15029. smalltalk.addMethod(
  15030. smalltalk.method({
  15031. selector: "new",
  15032. category: 'instance creation',
  15033. fn: function (){
  15034. var self=this;
  15035. return smalltalk.withContext(function($ctx1) {
  15036. _st(self)._shouldNotImplement();
  15037. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Transcript.klass)})},
  15038. args: [],
  15039. source: "new\x0a\x09self shouldNotImplement",
  15040. messageSends: ["shouldNotImplement"],
  15041. referencedClasses: []
  15042. }),
  15043. smalltalk.Transcript.klass);
  15044. smalltalk.addMethod(
  15045. smalltalk.method({
  15046. selector: "open",
  15047. category: 'instance creation',
  15048. fn: function (){
  15049. var self=this;
  15050. return smalltalk.withContext(function($ctx1) {
  15051. _st(_st(self)._current())._open();
  15052. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.Transcript.klass)})},
  15053. args: [],
  15054. source: "open\x0a\x09self current open",
  15055. messageSends: ["open", "current"],
  15056. referencedClasses: []
  15057. }),
  15058. smalltalk.Transcript.klass);
  15059. smalltalk.addMethod(
  15060. smalltalk.method({
  15061. selector: "register:",
  15062. category: 'instance creation',
  15063. fn: function (aTranscript){
  15064. var self=this;
  15065. return smalltalk.withContext(function($ctx1) {
  15066. self["@current"]=aTranscript;
  15067. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aTranscript:aTranscript},smalltalk.Transcript.klass)})},
  15068. args: ["aTranscript"],
  15069. source: "register: aTranscript\x0a\x09current := aTranscript",
  15070. messageSends: [],
  15071. referencedClasses: []
  15072. }),
  15073. smalltalk.Transcript.klass);
  15074. smalltalk.addMethod(
  15075. smalltalk.method({
  15076. selector: "show:",
  15077. category: 'printing',
  15078. fn: function (anObject){
  15079. var self=this;
  15080. return smalltalk.withContext(function($ctx1) {
  15081. _st(_st(self)._current())._show_(anObject);
  15082. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.Transcript.klass)})},
  15083. args: ["anObject"],
  15084. source: "show: anObject\x0a\x09self current show: anObject",
  15085. messageSends: ["show:", "current"],
  15086. referencedClasses: []
  15087. }),
  15088. smalltalk.Transcript.klass);
  15089. smalltalk.addPackage('Kernel-Announcements');
  15090. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
  15091. smalltalk.AnnouncementSubscription.comment="The subscription is a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible."
  15092. smalltalk.addMethod(
  15093. smalltalk.method({
  15094. selector: "announcementClass",
  15095. category: 'accessing',
  15096. fn: function (){
  15097. var self=this;
  15098. return smalltalk.withContext(function($ctx1) {
  15099. var $1;
  15100. $1=self["@announcementClass"];
  15101. return $1;
  15102. }, function($ctx1) {$ctx1.fill(self,"announcementClass",{},smalltalk.AnnouncementSubscription)})},
  15103. args: [],
  15104. source: "announcementClass\x0a\x09^ announcementClass",
  15105. messageSends: [],
  15106. referencedClasses: []
  15107. }),
  15108. smalltalk.AnnouncementSubscription);
  15109. smalltalk.addMethod(
  15110. smalltalk.method({
  15111. selector: "announcementClass:",
  15112. category: 'accessing',
  15113. fn: function (aClass){
  15114. var self=this;
  15115. return smalltalk.withContext(function($ctx1) {
  15116. self["@announcementClass"]=aClass;
  15117. return self}, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},smalltalk.AnnouncementSubscription)})},
  15118. args: ["aClass"],
  15119. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  15120. messageSends: [],
  15121. referencedClasses: []
  15122. }),
  15123. smalltalk.AnnouncementSubscription);
  15124. smalltalk.addMethod(
  15125. smalltalk.method({
  15126. selector: "block",
  15127. category: 'accessing',
  15128. fn: function (){
  15129. var self=this;
  15130. return smalltalk.withContext(function($ctx1) {
  15131. var $1;
  15132. $1=self["@block"];
  15133. return $1;
  15134. }, function($ctx1) {$ctx1.fill(self,"block",{},smalltalk.AnnouncementSubscription)})},
  15135. args: [],
  15136. source: "block\x0a\x09^block",
  15137. messageSends: [],
  15138. referencedClasses: []
  15139. }),
  15140. smalltalk.AnnouncementSubscription);
  15141. smalltalk.addMethod(
  15142. smalltalk.method({
  15143. selector: "block:",
  15144. category: 'accessing',
  15145. fn: function (aBlock){
  15146. var self=this;
  15147. return smalltalk.withContext(function($ctx1) {
  15148. self["@block"]=aBlock;
  15149. return self}, function($ctx1) {$ctx1.fill(self,"block:",{aBlock:aBlock},smalltalk.AnnouncementSubscription)})},
  15150. args: ["aBlock"],
  15151. source: "block: aBlock\x0a\x09block := aBlock",
  15152. messageSends: [],
  15153. referencedClasses: []
  15154. }),
  15155. smalltalk.AnnouncementSubscription);
  15156. smalltalk.addMethod(
  15157. smalltalk.method({
  15158. selector: "deliver:",
  15159. category: 'announcing',
  15160. fn: function (anAnnouncement){
  15161. var self=this;
  15162. return smalltalk.withContext(function($ctx1) {
  15163. var $1;
  15164. $1=_st(self)._handlesAnnouncement_(anAnnouncement);
  15165. if(smalltalk.assert($1)){
  15166. _st(_st(self)._block())._value_(anAnnouncement);
  15167. };
  15168. return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  15169. args: ["anAnnouncement"],
  15170. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self block value: anAnnouncement]",
  15171. messageSends: ["ifTrue:", "value:", "block", "handlesAnnouncement:"],
  15172. referencedClasses: []
  15173. }),
  15174. smalltalk.AnnouncementSubscription);
  15175. smalltalk.addMethod(
  15176. smalltalk.method({
  15177. selector: "handlesAnnouncement:",
  15178. category: 'announcing',
  15179. fn: function (anAnnouncement){
  15180. var self=this;
  15181. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15182. return smalltalk.withContext(function($ctx1) {
  15183. var $2,$1;
  15184. $2=_st(_st($Smalltalk())._current())._at_(_st(_st(self)._announcementClass())._name());
  15185. if(($receiver = $2) == nil || $receiver == undefined){
  15186. return false;
  15187. } else {
  15188. var class_;
  15189. class_=$receiver;
  15190. $1=_st(class_)._includesBehavior_(_st(_st($Smalltalk())._current())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()));
  15191. };
  15192. return $1;
  15193. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  15194. args: ["anAnnouncement"],
  15195. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk current at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09class includesBehavior: (Smalltalk current at: anAnnouncement class theNonMetaClass name) ]",
  15196. messageSends: ["ifNil:ifNotNil:", "includesBehavior:", "at:", "name", "theNonMetaClass", "class", "current", "announcementClass"],
  15197. referencedClasses: ["Smalltalk"]
  15198. }),
  15199. smalltalk.AnnouncementSubscription);
  15200. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  15201. smalltalk.Announcer.comment="The code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0aThe Announcer holds annoncement subscriptions (`AnnouncementSubscription`) in a private registry.\x0a\x0aUse `#on:do:` to register subscriptions."
  15202. smalltalk.addMethod(
  15203. smalltalk.method({
  15204. selector: "announce:",
  15205. category: 'announcing',
  15206. fn: function (anAnnouncement){
  15207. var self=this;
  15208. return smalltalk.withContext(function($ctx1) {
  15209. _st(self["@subscriptions"])._do_((function(each){
  15210. return smalltalk.withContext(function($ctx2) {
  15211. return _st(each)._deliver_(anAnnouncement);
  15212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  15213. return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.Announcer)})},
  15214. args: ["anAnnouncement"],
  15215. source: "announce: anAnnouncement\x0a\x09subscriptions do: [:each |\x0a\x09\x09each deliver: anAnnouncement]",
  15216. messageSends: ["do:", "deliver:"],
  15217. referencedClasses: []
  15218. }),
  15219. smalltalk.Announcer);
  15220. smalltalk.addMethod(
  15221. smalltalk.method({
  15222. selector: "initialize",
  15223. category: 'initialization',
  15224. fn: function (){
  15225. var self=this;
  15226. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  15227. return smalltalk.withContext(function($ctx1) {
  15228. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  15229. self["@subscriptions"]=_st($Array())._new();
  15230. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Announcer)})},
  15231. args: [],
  15232. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := Array new",
  15233. messageSends: ["initialize", "new"],
  15234. referencedClasses: ["Array"]
  15235. }),
  15236. smalltalk.Announcer);
  15237. smalltalk.addMethod(
  15238. smalltalk.method({
  15239. selector: "on:do:",
  15240. category: 'subscribing',
  15241. fn: function (aClass,aBlock){
  15242. var self=this;
  15243. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15244. return smalltalk.withContext(function($ctx1) {
  15245. var $1,$2;
  15246. $1=_st($AnnouncementSubscription())._new();
  15247. _st($1)._block_(aBlock);
  15248. _st($1)._announcementClass_(aClass);
  15249. $2=_st($1)._yourself();
  15250. _st(self["@subscriptions"])._add_($2);
  15251. return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},smalltalk.Announcer)})},
  15252. args: ["aClass", "aBlock"],
  15253. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09block: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  15254. messageSends: ["add:", "block:", "new", "announcementClass:", "yourself"],
  15255. referencedClasses: ["AnnouncementSubscription"]
  15256. }),
  15257. smalltalk.Announcer);
  15258. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  15259. smalltalk.SystemAnnouncer.comment="My unique instance #current is the global announcer handling all Amber system-related announces"
  15260. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  15261. smalltalk.addMethod(
  15262. smalltalk.method({
  15263. selector: "current",
  15264. category: 'accessing',
  15265. fn: function (){
  15266. var self=this;
  15267. return smalltalk.withContext(function($ctx1) {
  15268. var $2,$1;
  15269. $2=self["@current"];
  15270. if(($receiver = $2) == nil || $receiver == undefined){
  15271. self["@current"]=smalltalk.Announcer.klass.fn.prototype._new.apply(_st(self), []);
  15272. $1=self["@current"];
  15273. } else {
  15274. $1=$2;
  15275. };
  15276. return $1;
  15277. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SystemAnnouncer.klass)})},
  15278. args: [],
  15279. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  15280. messageSends: ["ifNil:", "new"],
  15281. referencedClasses: []
  15282. }),
  15283. smalltalk.SystemAnnouncer.klass);
  15284. smalltalk.addMethod(
  15285. smalltalk.method({
  15286. selector: "new",
  15287. category: 'instance creation',
  15288. fn: function (){
  15289. var self=this;
  15290. return smalltalk.withContext(function($ctx1) {
  15291. _st(self)._shouldNotImplement();
  15292. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.SystemAnnouncer.klass)})},
  15293. args: [],
  15294. source: "new\x0a\x09self shouldNotImplement",
  15295. messageSends: ["shouldNotImplement"],
  15296. referencedClasses: []
  15297. }),
  15298. smalltalk.SystemAnnouncer.klass);
  15299. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  15300. smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements"
  15301. smalltalk.addMethod(
  15302. smalltalk.method({
  15303. selector: "theClass",
  15304. category: 'accessing',
  15305. fn: function (){
  15306. var self=this;
  15307. return smalltalk.withContext(function($ctx1) {
  15308. var $1;
  15309. $1=self["@theClass"];
  15310. return $1;
  15311. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SystemAnnouncement)})},
  15312. args: [],
  15313. source: "theClass\x0a\x09^ theClass",
  15314. messageSends: [],
  15315. referencedClasses: []
  15316. }),
  15317. smalltalk.SystemAnnouncement);
  15318. smalltalk.addMethod(
  15319. smalltalk.method({
  15320. selector: "theClass:",
  15321. category: 'accessing',
  15322. fn: function (aClass){
  15323. var self=this;
  15324. return smalltalk.withContext(function($ctx1) {
  15325. self["@theClass"]=aClass;
  15326. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SystemAnnouncement)})},
  15327. args: ["aClass"],
  15328. source: "theClass: aClass\x0a\x09theClass := aClass",
  15329. messageSends: [],
  15330. referencedClasses: []
  15331. }),
  15332. smalltalk.SystemAnnouncement);
  15333. smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  15334. smalltalk.addMethod(
  15335. smalltalk.method({
  15336. selector: "theClass",
  15337. category: 'accessing',
  15338. fn: function (){
  15339. var self=this;
  15340. return smalltalk.withContext(function($ctx1) {
  15341. var $1;
  15342. $1=self["@theClass"];
  15343. return $1;
  15344. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassAnnouncement)})},
  15345. args: [],
  15346. source: "theClass\x0a\x09^ theClass",
  15347. messageSends: [],
  15348. referencedClasses: []
  15349. }),
  15350. smalltalk.ClassAnnouncement);
  15351. smalltalk.addMethod(
  15352. smalltalk.method({
  15353. selector: "theClass:",
  15354. category: 'accessing',
  15355. fn: function (aClass){
  15356. var self=this;
  15357. return smalltalk.withContext(function($ctx1) {
  15358. self["@theClass"]=aClass;
  15359. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassAnnouncement)})},
  15360. args: ["aClass"],
  15361. source: "theClass: aClass\x0a\x09theClass := aClass",
  15362. messageSends: [],
  15363. referencedClasses: []
  15364. }),
  15365. smalltalk.ClassAnnouncement);
  15366. smalltalk.addClass('ClassAdded', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  15367. smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods"
  15368. smalltalk.addClass('ClassCommentChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  15369. smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)"
  15370. smalltalk.addClass('ClassDefinitionChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  15371. smalltalk.ClassDefinitionChanged.comment="I am emitted when the defintion of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:"
  15372. smalltalk.addClass('ClassMoved', smalltalk.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  15373. smalltalk.addMethod(
  15374. smalltalk.method({
  15375. selector: "oldPackage",
  15376. category: 'accessing',
  15377. fn: function (){
  15378. var self=this;
  15379. return smalltalk.withContext(function($ctx1) {
  15380. var $1;
  15381. $1=self["@oldPackage"];
  15382. return $1;
  15383. }, function($ctx1) {$ctx1.fill(self,"oldPackage",{},smalltalk.ClassMoved)})},
  15384. args: [],
  15385. source: "oldPackage\x0a\x09^ oldPackage",
  15386. messageSends: [],
  15387. referencedClasses: []
  15388. }),
  15389. smalltalk.ClassMoved);
  15390. smalltalk.addMethod(
  15391. smalltalk.method({
  15392. selector: "oldPackage:",
  15393. category: 'accessing',
  15394. fn: function (aPackage){
  15395. var self=this;
  15396. return smalltalk.withContext(function($ctx1) {
  15397. self["@oldPackage"]=aPackage;
  15398. return self}, function($ctx1) {$ctx1.fill(self,"oldPackage:",{aPackage:aPackage},smalltalk.ClassMoved)})},
  15399. args: ["aPackage"],
  15400. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  15401. messageSends: [],
  15402. referencedClasses: []
  15403. }),
  15404. smalltalk.ClassMoved);
  15405. smalltalk.addClass('ClassRemoved', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  15406. smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:"
  15407. smalltalk.addClass('ClassRenamed', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  15408. smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:"
  15409. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  15410. smalltalk.addMethod(
  15411. smalltalk.method({
  15412. selector: "method",
  15413. category: 'accessing',
  15414. fn: function (){
  15415. var self=this;
  15416. return smalltalk.withContext(function($ctx1) {
  15417. var $1;
  15418. $1=self["@method"];
  15419. return $1;
  15420. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodAnnouncement)})},
  15421. args: [],
  15422. source: "method\x0a\x09^ method",
  15423. messageSends: [],
  15424. referencedClasses: []
  15425. }),
  15426. smalltalk.MethodAnnouncement);
  15427. smalltalk.addMethod(
  15428. smalltalk.method({
  15429. selector: "method:",
  15430. category: 'accessing',
  15431. fn: function (aCompiledMethod){
  15432. var self=this;
  15433. return smalltalk.withContext(function($ctx1) {
  15434. self["@method"]=aCompiledMethod;
  15435. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.MethodAnnouncement)})},
  15436. args: ["aCompiledMethod"],
  15437. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  15438. messageSends: [],
  15439. referencedClasses: []
  15440. }),
  15441. smalltalk.MethodAnnouncement);
  15442. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  15443. smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  15444. smalltalk.addMethod(
  15445. smalltalk.method({
  15446. selector: "oldMethod",
  15447. category: 'accessing',
  15448. fn: function (){
  15449. var self=this;
  15450. return smalltalk.withContext(function($ctx1) {
  15451. var $1;
  15452. $1=self["@oldMethod"];
  15453. return $1;
  15454. }, function($ctx1) {$ctx1.fill(self,"oldMethod",{},smalltalk.MethodModified)})},
  15455. args: [],
  15456. source: "oldMethod\x0a\x09^ oldMethod",
  15457. messageSends: [],
  15458. referencedClasses: []
  15459. }),
  15460. smalltalk.MethodModified);
  15461. smalltalk.addMethod(
  15462. smalltalk.method({
  15463. selector: "oldMethod:",
  15464. category: 'accessing',
  15465. fn: function (aMethod){
  15466. var self=this;
  15467. return smalltalk.withContext(function($ctx1) {
  15468. self["@oldMethod"]=aMethod;
  15469. return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod},smalltalk.MethodModified)})},
  15470. args: ["aMethod"],
  15471. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  15472. messageSends: [],
  15473. referencedClasses: []
  15474. }),
  15475. smalltalk.MethodModified);
  15476. smalltalk.addClass('MethodMoved', smalltalk.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  15477. smalltalk.addMethod(
  15478. smalltalk.method({
  15479. selector: "oldProtocol",
  15480. category: 'accessing',
  15481. fn: function (){
  15482. var self=this;
  15483. return smalltalk.withContext(function($ctx1) {
  15484. var $1;
  15485. $1=self["@oldProtocol"];
  15486. return $1;
  15487. }, function($ctx1) {$ctx1.fill(self,"oldProtocol",{},smalltalk.MethodMoved)})},
  15488. args: [],
  15489. source: "oldProtocol\x0a\x09^ oldProtocol",
  15490. messageSends: [],
  15491. referencedClasses: []
  15492. }),
  15493. smalltalk.MethodMoved);
  15494. smalltalk.addMethod(
  15495. smalltalk.method({
  15496. selector: "oldProtocol:",
  15497. category: 'accessing',
  15498. fn: function (aString){
  15499. var self=this;
  15500. return smalltalk.withContext(function($ctx1) {
  15501. self["@oldProtocol"]=aString;
  15502. return self}, function($ctx1) {$ctx1.fill(self,"oldProtocol:",{aString:aString},smalltalk.MethodMoved)})},
  15503. args: ["aString"],
  15504. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  15505. messageSends: [],
  15506. referencedClasses: []
  15507. }),
  15508. smalltalk.MethodMoved);
  15509. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  15510. smalltalk.addClass('PackageAnnouncement', smalltalk.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  15511. smalltalk.addMethod(
  15512. smalltalk.method({
  15513. selector: "package",
  15514. category: 'accessing',
  15515. fn: function (){
  15516. var self=this;
  15517. return smalltalk.withContext(function($ctx1) {
  15518. var $1;
  15519. $1=self["@package"];
  15520. return $1;
  15521. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageAnnouncement)})},
  15522. args: [],
  15523. source: "package\x0a\x09^ package",
  15524. messageSends: [],
  15525. referencedClasses: []
  15526. }),
  15527. smalltalk.PackageAnnouncement);
  15528. smalltalk.addMethod(
  15529. smalltalk.method({
  15530. selector: "package:",
  15531. category: 'accessing',
  15532. fn: function (aPackage){
  15533. var self=this;
  15534. return smalltalk.withContext(function($ctx1) {
  15535. self["@package"]=aPackage;
  15536. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageAnnouncement)})},
  15537. args: ["aPackage"],
  15538. source: "package: aPackage\x0a\x09package := aPackage",
  15539. messageSends: [],
  15540. referencedClasses: []
  15541. }),
  15542. smalltalk.PackageAnnouncement);
  15543. smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  15544. smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  15545. smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  15546. smalltalk.addMethod(
  15547. smalltalk.method({
  15548. selector: "protocol",
  15549. category: 'accessing',
  15550. fn: function (){
  15551. var self=this;
  15552. return smalltalk.withContext(function($ctx1) {
  15553. var $1;
  15554. $1=self["@protocol"];
  15555. return $1;
  15556. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.ProtocolAnnouncement)})},
  15557. args: [],
  15558. source: "protocol\x0a\x09^ protocol",
  15559. messageSends: [],
  15560. referencedClasses: []
  15561. }),
  15562. smalltalk.ProtocolAnnouncement);
  15563. smalltalk.addMethod(
  15564. smalltalk.method({
  15565. selector: "protocol:",
  15566. category: 'accessing',
  15567. fn: function (aString){
  15568. var self=this;
  15569. return smalltalk.withContext(function($ctx1) {
  15570. self["@protocol"]=aString;
  15571. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.ProtocolAnnouncement)})},
  15572. args: ["aString"],
  15573. source: "protocol: aString\x0a\x09protocol := aString",
  15574. messageSends: [],
  15575. referencedClasses: []
  15576. }),
  15577. smalltalk.ProtocolAnnouncement);
  15578. smalltalk.addMethod(
  15579. smalltalk.method({
  15580. selector: "theClass",
  15581. category: 'accessing',
  15582. fn: function (){
  15583. var self=this;
  15584. return smalltalk.withContext(function($ctx1) {
  15585. var $1;
  15586. $1=self["@theClass"];
  15587. return $1;
  15588. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ProtocolAnnouncement)})},
  15589. args: [],
  15590. source: "theClass\x0a\x09^ theClass",
  15591. messageSends: [],
  15592. referencedClasses: []
  15593. }),
  15594. smalltalk.ProtocolAnnouncement);
  15595. smalltalk.addMethod(
  15596. smalltalk.method({
  15597. selector: "theClass:",
  15598. category: 'accessing',
  15599. fn: function (aClass){
  15600. var self=this;
  15601. return smalltalk.withContext(function($ctx1) {
  15602. self["@theClass"]=aClass;
  15603. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ProtocolAnnouncement)})},
  15604. args: ["aClass"],
  15605. source: "theClass: aClass\x0a\x09theClass := aClass",
  15606. messageSends: [],
  15607. referencedClasses: []
  15608. }),
  15609. smalltalk.ProtocolAnnouncement);
  15610. smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  15611. smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  15612. smalltalk.addPackage('FileServer');
  15613. smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'FileServer');
  15614. smalltalk.addMethod(
  15615. smalltalk.method({
  15616. selector: "base64Decode:",
  15617. category: 'private',
  15618. fn: function (aString){
  15619. var self=this;
  15620. return smalltalk.withContext(function($ctx1) {
  15621. return (new Buffer(aString, 'base64').toString());
  15622. return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},smalltalk.FileServer)})},
  15623. args: ["aString"],
  15624. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  15625. messageSends: [],
  15626. referencedClasses: []
  15627. }),
  15628. smalltalk.FileServer);
  15629. smalltalk.addMethod(
  15630. smalltalk.method({
  15631. selector: "basePath",
  15632. category: 'accessing',
  15633. fn: function (){
  15634. var self=this;
  15635. return smalltalk.withContext(function($ctx1) {
  15636. var $2,$1;
  15637. $2=self["@basePath"];
  15638. if(($receiver = $2) == nil || $receiver == undefined){
  15639. $1="./";
  15640. } else {
  15641. $1=$2;
  15642. };
  15643. return $1;
  15644. }, function($ctx1) {$ctx1.fill(self,"basePath",{},smalltalk.FileServer)})},
  15645. args: [],
  15646. source: "basePath\x0a\x09^basePath ifNil: ['./']",
  15647. messageSends: ["ifNil:"],
  15648. referencedClasses: []
  15649. }),
  15650. smalltalk.FileServer);
  15651. smalltalk.addMethod(
  15652. smalltalk.method({
  15653. selector: "basePath:",
  15654. category: 'accessing',
  15655. fn: function (aString){
  15656. var self=this;
  15657. return smalltalk.withContext(function($ctx1) {
  15658. self["@basePath"]=aString;
  15659. return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})},
  15660. args: ["aString"],
  15661. source: "basePath: aString\x0a\x09basePath := aString",
  15662. messageSends: [],
  15663. referencedClasses: []
  15664. }),
  15665. smalltalk.FileServer);
  15666. smalltalk.addMethod(
  15667. smalltalk.method({
  15668. selector: "checkDirectoryLayout",
  15669. category: 'initialization',
  15670. fn: function (){
  15671. var self=this;
  15672. return smalltalk.withContext(function($ctx1) {
  15673. var $1,$2,$3;
  15674. $1=_st(self["@fs"])._existsSync_(_st(_st(self)._basePath()).__comma("index.html"));
  15675. if(! smalltalk.assert($1)){
  15676. _st(console)._warn_("Warning: project directory does not contain index.html");
  15677. };
  15678. $2=_st(self["@fs"])._existsSync_(_st(_st(self)._basePath()).__comma("st"));
  15679. if(! smalltalk.assert($2)){
  15680. _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
  15681. };
  15682. $3=_st(self["@fs"])._existsSync_(_st(_st(self)._basePath()).__comma("js"));
  15683. if(! smalltalk.assert($3)){
  15684. _st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory");
  15685. };
  15686. return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})},
  15687. args: [],
  15688. source: "checkDirectoryLayout\x0a\x09(fs existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html'].\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
  15689. messageSends: ["ifFalse:", "warn:", "existsSync:", ",", "basePath"],
  15690. referencedClasses: []
  15691. }),
  15692. smalltalk.FileServer);
  15693. smalltalk.addMethod(
  15694. smalltalk.method({
  15695. selector: "fallbackPage",
  15696. category: 'accessing',
  15697. fn: function (){
  15698. var self=this;
  15699. return smalltalk.withContext(function($ctx1) {
  15700. var $1;
  15701. $1=self["@fallbackPage"];
  15702. return $1;
  15703. }, function($ctx1) {$ctx1.fill(self,"fallbackPage",{},smalltalk.FileServer)})},
  15704. args: [],
  15705. source: "fallbackPage\x0a\x09^fallbackPage",
  15706. messageSends: [],
  15707. referencedClasses: []
  15708. }),
  15709. smalltalk.FileServer);
  15710. smalltalk.addMethod(
  15711. smalltalk.method({
  15712. selector: "fallbackPage:",
  15713. category: 'accessing',
  15714. fn: function (aString){
  15715. var self=this;
  15716. return smalltalk.withContext(function($ctx1) {
  15717. self["@fallbackPage"]=aString;
  15718. return self}, function($ctx1) {$ctx1.fill(self,"fallbackPage:",{aString:aString},smalltalk.FileServer)})},
  15719. args: ["aString"],
  15720. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  15721. messageSends: [],
  15722. referencedClasses: []
  15723. }),
  15724. smalltalk.FileServer);
  15725. smalltalk.addMethod(
  15726. smalltalk.method({
  15727. selector: "handleGETRequest:respondTo:",
  15728. category: 'request handling',
  15729. fn: function (aRequest,aResponse){
  15730. var self=this;
  15731. var uri,filename;
  15732. return smalltalk.withContext(function($ctx1) {
  15733. var $1;
  15734. uri=_st(_st(self["@url"])._parse_(_st(aRequest)._url()))._pathname();
  15735. filename=_st(self["@path"])._join_with_(_st(self)._basePath(),uri);
  15736. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  15737. return smalltalk.withContext(function($ctx2) {
  15738. $1=aBoolean;
  15739. if(smalltalk.assert($1)){
  15740. return _st(self)._respondFileNamed_to_(filename,aResponse);
  15741. } else {
  15742. return _st(self)._respondNotFoundTo_(aResponse);
  15743. };
  15744. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1)})}));
  15745. return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},smalltalk.FileServer)})},
  15746. args: ["aRequest", "aResponse"],
  15747. source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := (url parse: aRequest url) pathname.\x0a\x09filename := path join: self basePath with: uri.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [self respondFileNamed: filename to: aResponse]]",
  15748. messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"],
  15749. referencedClasses: []
  15750. }),
  15751. smalltalk.FileServer);
  15752. smalltalk.addMethod(
  15753. smalltalk.method({
  15754. selector: "handleOPTIONSRequest:respondTo:",
  15755. category: 'request handling',
  15756. fn: function (aRequest,aResponse){
  15757. var self=this;
  15758. return smalltalk.withContext(function($ctx1) {
  15759. _st(aResponse)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Access-Control-Allow-Origin").__minus_gt("*"),_st("Access-Control-Allow-Methods").__minus_gt("GET, PUT, POST, DELETE, OPTIONS"),_st("Access-Control-Allow-Headers").__minus_gt("Content-Type, Accept"),_st("Content-Length").__minus_gt((0)),_st("Access-Control-Max-Age").__minus_gt((10))]));
  15760. _st(aResponse)._end();
  15761. return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  15762. args: ["aRequest", "aResponse"],
  15763. source: "handleOPTIONSRequest: aRequest respondTo: aResponse\x0a\x09aResponse writeHead: 200 options: #{'Access-Control-Allow-Origin' -> '*'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Methods' -> 'GET, PUT, POST, DELETE, OPTIONS'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Headers' -> 'Content-Type, Accept'.\x0a\x09\x09\x09\x09\x09'Content-Length' -> 0.\x0a\x09\x09\x09\x09\x09'Access-Control-Max-Age' -> 10}.\x0a\x09aResponse end",
  15764. messageSends: ["writeHead:options:", "->", "end"],
  15765. referencedClasses: []
  15766. }),
  15767. smalltalk.FileServer);
  15768. smalltalk.addMethod(
  15769. smalltalk.method({
  15770. selector: "handlePUTRequest:respondTo:",
  15771. category: 'request handling',
  15772. fn: function (aRequest,aResponse){
  15773. var self=this;
  15774. var file,stream;
  15775. return smalltalk.withContext(function($ctx1) {
  15776. var $1,$2;
  15777. $1=_st(self)._isAuthenticated_(aRequest);
  15778. if(! smalltalk.assert($1)){
  15779. _st(self)._respondAuthenticationRequiredTo_(aResponse);
  15780. return nil;
  15781. };
  15782. file=_st(".").__comma(_st(aRequest)._url());
  15783. stream=_st(self["@fs"])._createWriteStream_(file);
  15784. _st(stream)._on_do_("error",(function(error){
  15785. return smalltalk.withContext(function($ctx2) {
  15786. _st(console)._warn_(_st("Error creating WriteStream for file ").__comma(file));
  15787. _st(console)._warn_(" Did you forget to create the necessary js/ or st/ directory in your project?");
  15788. _st(console)._warn_(_st(" The exact error is: ").__comma(error));
  15789. return _st(self)._respondNotCreatedTo_(aResponse);
  15790. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  15791. _st(stream)._on_do_("close",(function(){
  15792. return smalltalk.withContext(function($ctx2) {
  15793. return _st(self)._respondCreatedTo_(aResponse);
  15794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15795. _st(aRequest)._setEncoding_("utf8");
  15796. _st(aRequest)._on_do_("data",(function(data){
  15797. return smalltalk.withContext(function($ctx2) {
  15798. return _st(stream)._write_(data);
  15799. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1)})}));
  15800. _st(aRequest)._on_do_("end",(function(){
  15801. return smalltalk.withContext(function($ctx2) {
  15802. $2=_st(stream)._writable();
  15803. if(smalltalk.assert($2)){
  15804. return _st(stream)._end();
  15805. };
  15806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15807. return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},smalltalk.FileServer)})},
  15808. args: ["aRequest", "aResponse"],
  15809. source: "handlePUTRequest: aRequest respondTo: aResponse\x0a\x09| file stream |\x0a\x09(self isAuthenticated: aRequest)\x0a\x09\x09ifFalse: [self respondAuthenticationRequiredTo: aResponse. ^nil].\x0a\x0a\x09file := '.', aRequest url.\x0a\x09stream := fs createWriteStream: file.\x0a\x0a\x09stream on: 'error' do: [:error |\x0a\x09\x09console warn: 'Error creating WriteStream for file ', file.\x0a\x09\x09console warn: ' Did you forget to create the necessary js/ or st/ directory in your project?'.\x0a\x09\x09console warn: ' The exact error is: ', error.\x0a\x09\x09self respondNotCreatedTo: aResponse].\x0a\x0a\x09stream on: 'close' do: [\x0a\x09\x09self respondCreatedTo: aResponse].\x0a\x0a\x09aRequest setEncoding: 'utf8'.\x0a\x09aRequest on: 'data' do: [:data |\x0a\x09\x09stream write: data].\x0a\x0a\x09aRequest on: 'end' do: [\x0a\x09\x09stream writable ifTrue: [stream end]]",
  15810. messageSends: ["ifFalse:", "respondAuthenticationRequiredTo:", "isAuthenticated:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "end", "writable"],
  15811. referencedClasses: []
  15812. }),
  15813. smalltalk.FileServer);
  15814. smalltalk.addMethod(
  15815. smalltalk.method({
  15816. selector: "handleRequest:respondTo:",
  15817. category: 'request handling',
  15818. fn: function (aRequest,aResponse){
  15819. var self=this;
  15820. return smalltalk.withContext(function($ctx1) {
  15821. var $1,$2,$3;
  15822. $1=_st(_st(aRequest)._method()).__eq("PUT");
  15823. if(smalltalk.assert($1)){
  15824. _st(self)._handlePUTRequest_respondTo_(aRequest,aResponse);
  15825. };
  15826. $2=_st(_st(aRequest)._method()).__eq("GET");
  15827. if(smalltalk.assert($2)){
  15828. _st(self)._handleGETRequest_respondTo_(aRequest,aResponse);
  15829. };
  15830. $3=_st(_st(aRequest)._method()).__eq("OPTIONS");
  15831. if(smalltalk.assert($3)){
  15832. _st(self)._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  15833. };
  15834. return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  15835. args: ["aRequest", "aResponse"],
  15836. source: "handleRequest: aRequest respondTo: aResponse\x0a\x09aRequest method = 'PUT'\x0a\x09\x09ifTrue: [self handlePUTRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'GET'\x0a\x09\x09ifTrue:[self handleGETRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'OPTIONS'\x0a\x09\x09ifTrue:[self handleOPTIONSRequest: aRequest respondTo: aResponse]",
  15837. messageSends: ["ifTrue:", "handlePUTRequest:respondTo:", "=", "method", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  15838. referencedClasses: []
  15839. }),
  15840. smalltalk.FileServer);
  15841. smalltalk.addMethod(
  15842. smalltalk.method({
  15843. selector: "host",
  15844. category: 'accessing',
  15845. fn: function (){
  15846. var self=this;
  15847. return smalltalk.withContext(function($ctx1) {
  15848. var $1;
  15849. $1=self["@host"];
  15850. return $1;
  15851. }, function($ctx1) {$ctx1.fill(self,"host",{},smalltalk.FileServer)})},
  15852. args: [],
  15853. source: "host\x0a\x09^host",
  15854. messageSends: [],
  15855. referencedClasses: []
  15856. }),
  15857. smalltalk.FileServer);
  15858. smalltalk.addMethod(
  15859. smalltalk.method({
  15860. selector: "host:",
  15861. category: 'accessing',
  15862. fn: function (hostname){
  15863. var self=this;
  15864. return smalltalk.withContext(function($ctx1) {
  15865. self["@host"]=hostname;
  15866. return self}, function($ctx1) {$ctx1.fill(self,"host:",{hostname:hostname},smalltalk.FileServer)})},
  15867. args: ["hostname"],
  15868. source: "host: hostname\x0a\x09host := hostname",
  15869. messageSends: [],
  15870. referencedClasses: []
  15871. }),
  15872. smalltalk.FileServer);
  15873. smalltalk.addMethod(
  15874. smalltalk.method({
  15875. selector: "initialize",
  15876. category: 'initialization',
  15877. fn: function (){
  15878. var self=this;
  15879. return smalltalk.withContext(function($ctx1) {
  15880. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  15881. self["@path"]=_st(self)._require_("path");
  15882. self["@http"]=_st(self)._require_("http");
  15883. self["@fs"]=_st(self)._require_("fs");
  15884. self["@util"]=_st(self)._require_("util");
  15885. self["@url"]=_st(self)._require_("url");
  15886. self["@host"]=_st(_st(self)._class())._defaultHost();
  15887. self["@port"]=_st(_st(self)._class())._defaultPort();
  15888. self["@username"]=nil;
  15889. self["@password"]=nil;
  15890. self["@fallbackPage"]=nil;
  15891. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.FileServer)})},
  15892. args: [],
  15893. source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09host := self class defaultHost.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.\x0a\x09fallbackPage := nil.",
  15894. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"],
  15895. referencedClasses: []
  15896. }),
  15897. smalltalk.FileServer);
  15898. smalltalk.addMethod(
  15899. smalltalk.method({
  15900. selector: "isAuthenticated:",
  15901. category: 'private',
  15902. fn: function (aRequest){
  15903. var self=this;
  15904. var header,token,auth,parts;
  15905. return smalltalk.withContext(function($ctx1) {
  15906. var $1,$2,$3,$4,$5;
  15907. $1=_st(_st(self["@username"])._isNil())._and_((function(){
  15908. return smalltalk.withContext(function($ctx2) {
  15909. return _st(self["@password"])._isNil();
  15910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15911. if(smalltalk.assert($1)){
  15912. return true;
  15913. };
  15914. $2=_st(_st(aRequest)._headers())._at_("authorization");
  15915. if(($receiver = $2) == nil || $receiver == undefined){
  15916. header="";
  15917. } else {
  15918. header=$2;
  15919. };
  15920. $3=_st(header)._isEmpty();
  15921. if(smalltalk.assert($3)){
  15922. return false;
  15923. } else {
  15924. $4=_st(header)._tokenize_(" ");
  15925. if(($receiver = $4) == nil || $receiver == undefined){
  15926. token="";
  15927. } else {
  15928. token=$4;
  15929. };
  15930. token;
  15931. auth=_st(self)._base64Decode_(_st(token)._at_((2)));
  15932. auth;
  15933. parts=_st(auth)._tokenize_(":");
  15934. parts;
  15935. $5=_st(_st(self["@username"]).__eq(_st(parts)._at_((1))))._and_((function(){
  15936. return smalltalk.withContext(function($ctx2) {
  15937. return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  15938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15939. if(smalltalk.assert($5)){
  15940. return true;
  15941. } else {
  15942. return false;
  15943. };
  15944. };
  15945. return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},smalltalk.FileServer)})},
  15946. args: ["aRequest"],
  15947. source: "isAuthenticated: aRequest\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09(header isEmpty)\x0a\x09ifTrue: [^false]\x0a\x09ifFalse: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09auth := self base64Decode: (token at: 2).\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^true]\x0a\x09\x09\x09ifFalse: [^false]\x0a\x09].",
  15948. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "tokenize:", "base64Decode:", "=", "isEmpty"],
  15949. referencedClasses: []
  15950. }),
  15951. smalltalk.FileServer);
  15952. smalltalk.addMethod(
  15953. smalltalk.method({
  15954. selector: "password:",
  15955. category: 'accessing',
  15956. fn: function (aPassword){
  15957. var self=this;
  15958. return smalltalk.withContext(function($ctx1) {
  15959. self["@password"]=aPassword;
  15960. return self}, function($ctx1) {$ctx1.fill(self,"password:",{aPassword:aPassword},smalltalk.FileServer)})},
  15961. args: ["aPassword"],
  15962. source: "password: aPassword\x0a\x09password := aPassword.",
  15963. messageSends: [],
  15964. referencedClasses: []
  15965. }),
  15966. smalltalk.FileServer);
  15967. smalltalk.addMethod(
  15968. smalltalk.method({
  15969. selector: "port",
  15970. category: 'accessing',
  15971. fn: function (){
  15972. var self=this;
  15973. return smalltalk.withContext(function($ctx1) {
  15974. var $1;
  15975. $1=self["@port"];
  15976. return $1;
  15977. }, function($ctx1) {$ctx1.fill(self,"port",{},smalltalk.FileServer)})},
  15978. args: [],
  15979. source: "port\x0a\x09^port",
  15980. messageSends: [],
  15981. referencedClasses: []
  15982. }),
  15983. smalltalk.FileServer);
  15984. smalltalk.addMethod(
  15985. smalltalk.method({
  15986. selector: "port:",
  15987. category: 'accessing',
  15988. fn: function (aNumber){
  15989. var self=this;
  15990. return smalltalk.withContext(function($ctx1) {
  15991. self["@port"]=aNumber;
  15992. return self}, function($ctx1) {$ctx1.fill(self,"port:",{aNumber:aNumber},smalltalk.FileServer)})},
  15993. args: ["aNumber"],
  15994. source: "port: aNumber\x0a\x09port := aNumber",
  15995. messageSends: [],
  15996. referencedClasses: []
  15997. }),
  15998. smalltalk.FileServer);
  15999. smalltalk.addMethod(
  16000. smalltalk.method({
  16001. selector: "require:",
  16002. category: 'private',
  16003. fn: function (aModuleString){
  16004. var self=this;
  16005. return smalltalk.withContext(function($ctx1) {
  16006. var $1;
  16007. $1=_st(require)._value_(aModuleString);
  16008. return $1;
  16009. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},smalltalk.FileServer)})},
  16010. args: ["aModuleString"],
  16011. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  16012. messageSends: ["value:"],
  16013. referencedClasses: []
  16014. }),
  16015. smalltalk.FileServer);
  16016. smalltalk.addMethod(
  16017. smalltalk.method({
  16018. selector: "respondAuthenticationRequiredTo:",
  16019. category: 'request handling',
  16020. fn: function (aResponse){
  16021. var self=this;
  16022. return smalltalk.withContext(function($ctx1) {
  16023. var $1,$2;
  16024. $1=aResponse;
  16025. _st($1)._writeHead_options_((401),smalltalk.HashedCollection._fromPairs_([_st("WWW-Authenticate").__minus_gt("Basic realm=\x22Secured Developer Area\x22")]));
  16026. _st($1)._write_("<html><body>Authentication needed</body></html>");
  16027. $2=_st($1)._end();
  16028. return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  16029. args: ["aResponse"],
  16030. source: "respondAuthenticationRequiredTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 401 options: #{'WWW-Authenticate' -> 'Basic realm=\x22Secured Developer Area\x22'};\x0a\x09\x09write: '<html><body>Authentication needed</body></html>';\x0a\x09\x09end.",
  16031. messageSends: ["writeHead:options:", "->", "write:", "end"],
  16032. referencedClasses: []
  16033. }),
  16034. smalltalk.FileServer);
  16035. smalltalk.addMethod(
  16036. smalltalk.method({
  16037. selector: "respondCreatedTo:",
  16038. category: 'request handling',
  16039. fn: function (aResponse){
  16040. var self=this;
  16041. return smalltalk.withContext(function($ctx1) {
  16042. var $1,$2;
  16043. $1=aResponse;
  16044. _st($1)._writeHead_options_((201),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain"),_st("Access-Control-Allow-Origin").__minus_gt("*")]));
  16045. $2=_st($1)._end();
  16046. return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  16047. args: ["aResponse"],
  16048. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  16049. messageSends: ["writeHead:options:", "->", "end"],
  16050. referencedClasses: []
  16051. }),
  16052. smalltalk.FileServer);
  16053. smalltalk.addMethod(
  16054. smalltalk.method({
  16055. selector: "respondFileNamed:to:",
  16056. category: 'request handling',
  16057. fn: function (aFilename,aResponse){
  16058. var self=this;
  16059. var type,filename;
  16060. return smalltalk.withContext(function($ctx1) {
  16061. var $1,$2,$3,$4,$5;
  16062. filename=aFilename;
  16063. $1=_st(_st(self["@fs"])._statSync_(aFilename))._isDirectory();
  16064. if(smalltalk.assert($1)){
  16065. filename=_st(filename).__comma("index.html");
  16066. filename;
  16067. };
  16068. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  16069. return smalltalk.withContext(function($ctx2) {
  16070. $2=_st(ex)._notNil();
  16071. if(smalltalk.assert($2)){
  16072. _st(console)._log_(_st(filename).__comma(" does not exist"));
  16073. return _st(self)._respondInternalErrorTo_(aResponse);
  16074. } else {
  16075. type=_st(_st(self)._class())._mimeTypeFor_(filename);
  16076. type;
  16077. $3=_st(type).__eq("application/javascript");
  16078. if(smalltalk.assert($3)){
  16079. type=_st(type).__comma(";charset=utf-8");
  16080. type;
  16081. };
  16082. $4=aResponse;
  16083. _st($4)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt(type)]));
  16084. _st($4)._write_encoding_(file,"binary");
  16085. $5=_st($4)._end();
  16086. return $5;
  16087. };
  16088. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1)})}));
  16089. return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},smalltalk.FileServer)})},
  16090. args: ["aFilename", "aResponse"],
  16091. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x09(fs statSync: aFilename) isDirectory ifTrue: [\x0a\x09\x09filename := filename, 'index.html'].\x0a\x0a\x09fs readFile: filename do: [:ex :file |\x0a\x09\x09ex notNil \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09console log: filename, ' does not exist'.\x0a\x09\x09\x09\x09self respondInternalErrorTo: aResponse]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09type := self class mimeTypeFor: filename.\x0a\x09\x09\x09\x09type = 'application/javascript'\x0a\x09\x09\x09\x09\x09ifTrue: [ type:=type,';charset=utf-8' ].\x0a\x09\x09\x09\x09aResponse \x0a\x09\x09\x09\x09\x09writeHead: 200 options: #{'Content-Type' -> type};\x0a\x09\x09\x09\x09\x09write: file encoding: 'binary';\x0a\x09\x09\x09\x09\x09end]]",
  16092. messageSends: ["ifTrue:", ",", "isDirectory", "statSync:", "readFile:do:", "ifTrue:ifFalse:", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end", "notNil"],
  16093. referencedClasses: []
  16094. }),
  16095. smalltalk.FileServer);
  16096. smalltalk.addMethod(
  16097. smalltalk.method({
  16098. selector: "respondInternalErrorTo:",
  16099. category: 'request handling',
  16100. fn: function (aResponse){
  16101. var self=this;
  16102. return smalltalk.withContext(function($ctx1) {
  16103. var $1,$2;
  16104. $1=aResponse;
  16105. _st($1)._writeHead_options_((500),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")]));
  16106. _st($1)._write_("500 Internal server error");
  16107. $2=_st($1)._end();
  16108. return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  16109. args: ["aResponse"],
  16110. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  16111. messageSends: ["writeHead:options:", "->", "write:", "end"],
  16112. referencedClasses: []
  16113. }),
  16114. smalltalk.FileServer);
  16115. smalltalk.addMethod(
  16116. smalltalk.method({
  16117. selector: "respondNotCreatedTo:",
  16118. category: 'request handling',
  16119. fn: function (aResponse){
  16120. var self=this;
  16121. return smalltalk.withContext(function($ctx1) {
  16122. var $1,$2;
  16123. $1=aResponse;
  16124. _st($1)._writeHead_options_((400),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")]));
  16125. _st($1)._write_("File could not be created. Did you forget to create the st/js directories on the server?");
  16126. $2=_st($1)._end();
  16127. return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  16128. args: ["aResponse"],
  16129. source: "respondNotCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 400 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: 'File could not be created. Did you forget to create the st/js directories on the server?';\x0a\x09\x09end.",
  16130. messageSends: ["writeHead:options:", "->", "write:", "end"],
  16131. referencedClasses: []
  16132. }),
  16133. smalltalk.FileServer);
  16134. smalltalk.addMethod(
  16135. smalltalk.method({
  16136. selector: "respondNotFoundTo:",
  16137. category: 'request handling',
  16138. fn: function (aResponse){
  16139. var self=this;
  16140. return smalltalk.withContext(function($ctx1) {
  16141. var $1,$2,$3,$4;
  16142. $1=_st(_st(self)._fallbackPage())._isNil();
  16143. if(! smalltalk.assert($1)){
  16144. $2=_st(self)._respondFileNamed_to_(_st(self)._fallbackPage(),aResponse);
  16145. return $2;
  16146. };
  16147. $3=aResponse;
  16148. _st($3)._writeHead_options_((404),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")]));
  16149. _st($3)._write_("404 Not found");
  16150. $4=_st($3)._end();
  16151. return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  16152. args: ["aResponse"],
  16153. source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '404 Not found';\x0a\x09\x09end",
  16154. messageSends: ["ifFalse:", "respondFileNamed:to:", "fallbackPage", "isNil", "writeHead:options:", "->", "write:", "end"],
  16155. referencedClasses: []
  16156. }),
  16157. smalltalk.FileServer);
  16158. smalltalk.addMethod(
  16159. smalltalk.method({
  16160. selector: "respondOKTo:",
  16161. category: 'request handling',
  16162. fn: function (aResponse){
  16163. var self=this;
  16164. return smalltalk.withContext(function($ctx1) {
  16165. var $1,$2;
  16166. $1=aResponse;
  16167. _st($1)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain"),_st("Access-Control-Allow-Origin").__minus_gt("*")]));
  16168. $2=_st($1)._end();
  16169. return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  16170. args: ["aResponse"],
  16171. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  16172. messageSends: ["writeHead:options:", "->", "end"],
  16173. referencedClasses: []
  16174. }),
  16175. smalltalk.FileServer);
  16176. smalltalk.addMethod(
  16177. smalltalk.method({
  16178. selector: "start",
  16179. category: 'starting',
  16180. fn: function (){
  16181. var self=this;
  16182. return smalltalk.withContext(function($ctx1) {
  16183. var $1,$2;
  16184. _st(self)._checkDirectoryLayout();
  16185. $1=_st(self["@http"])._createServer_((function(request,response){
  16186. return smalltalk.withContext(function($ctx2) {
  16187. return _st(self)._handleRequest_respondTo_(request,response);
  16188. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1)})}));
  16189. _st($1)._on_do_("error",(function(error){
  16190. return smalltalk.withContext(function($ctx2) {
  16191. return _st(console)._log_(_st("Error starting server: ").__comma(error));
  16192. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  16193. _st($1)._on_do_("listening",(function(){
  16194. return smalltalk.withContext(function($ctx2) {
  16195. return _st(console)._log_(_st(_st(_st("Starting file server on ").__comma(_st(self)._host())).__comma(":")).__comma(_st(_st(self)._port())._asString()));
  16196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  16197. $2=_st($1)._listen_host_(_st(self)._port(),_st(self)._host());
  16198. return self}, function($ctx1) {$ctx1.fill(self,"start",{},smalltalk.FileServer)})},
  16199. args: [],
  16200. source: "start\x0a\x09\x22Checks if required directory layout is present (issue warning if not).\x0a\x09 Afterwards start the server.\x22\x0a\x09self checkDirectoryLayout.\x0a\x09(http createServer: [:request :response |\x0a\x09 self handleRequest: request respondTo: response])\x0a\x09 on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09 on: 'listening' do: [console log: 'Starting file server on ', self host, ':', self port asString];\x0a\x09 listen: self port host: self host.",
  16201. messageSends: ["checkDirectoryLayout", "on:do:", "log:", ",", "createServer:", "handleRequest:respondTo:", "asString", "port", "host", "listen:host:"],
  16202. referencedClasses: []
  16203. }),
  16204. smalltalk.FileServer);
  16205. smalltalk.addMethod(
  16206. smalltalk.method({
  16207. selector: "startOn:",
  16208. category: 'starting',
  16209. fn: function (aPort){
  16210. var self=this;
  16211. return smalltalk.withContext(function($ctx1) {
  16212. _st(self)._port_(aPort);
  16213. _st(self)._start();
  16214. return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},smalltalk.FileServer)})},
  16215. args: ["aPort"],
  16216. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  16217. messageSends: ["port:", "start"],
  16218. referencedClasses: []
  16219. }),
  16220. smalltalk.FileServer);
  16221. smalltalk.addMethod(
  16222. smalltalk.method({
  16223. selector: "username:",
  16224. category: 'accessing',
  16225. fn: function (aUsername){
  16226. var self=this;
  16227. return smalltalk.withContext(function($ctx1) {
  16228. self["@username"]=aUsername;
  16229. return self}, function($ctx1) {$ctx1.fill(self,"username:",{aUsername:aUsername},smalltalk.FileServer)})},
  16230. args: ["aUsername"],
  16231. source: "username: aUsername\x0a\x09username := aUsername.",
  16232. messageSends: [],
  16233. referencedClasses: []
  16234. }),
  16235. smalltalk.FileServer);
  16236. smalltalk.addMethod(
  16237. smalltalk.method({
  16238. selector: "username:password:",
  16239. category: 'accessing',
  16240. fn: function (aUsername,aPassword){
  16241. var self=this;
  16242. return smalltalk.withContext(function($ctx1) {
  16243. self["@username"]=aUsername;
  16244. self["@password"]=aPassword;
  16245. return self}, function($ctx1) {$ctx1.fill(self,"username:password:",{aUsername:aUsername,aPassword:aPassword},smalltalk.FileServer)})},
  16246. args: ["aUsername", "aPassword"],
  16247. source: "username: aUsername password: aPassword\x0a\x09username := aUsername.\x0a\x09password := aPassword.",
  16248. messageSends: [],
  16249. referencedClasses: []
  16250. }),
  16251. smalltalk.FileServer);
  16252. smalltalk.addMethod(
  16253. smalltalk.method({
  16254. selector: "writeData:toFileNamed:",
  16255. category: 'private',
  16256. fn: function (data,aFilename){
  16257. var self=this;
  16258. return smalltalk.withContext(function($ctx1) {
  16259. _st(console)._log_(aFilename);
  16260. return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},smalltalk.FileServer)})},
  16261. args: ["data", "aFilename"],
  16262. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  16263. messageSends: ["log:"],
  16264. referencedClasses: []
  16265. }),
  16266. smalltalk.FileServer);
  16267. smalltalk.FileServer.klass.iVarNames = ['mimeTypes'];
  16268. smalltalk.addMethod(
  16269. smalltalk.method({
  16270. selector: "commandLineSwitches",
  16271. category: 'accessing',
  16272. fn: function (){
  16273. var self=this;
  16274. var switches;
  16275. return smalltalk.withContext(function($ctx1) {
  16276. var $1;
  16277. switches=_st(_st(self)._methodsInProtocol_("accessing"))._collect_((function(each){
  16278. return smalltalk.withContext(function($ctx2) {
  16279. return _st(each)._selector();
  16280. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  16281. switches=_st(switches)._select_((function(each){
  16282. return smalltalk.withContext(function($ctx2) {
  16283. return _st(each)._match_("^[^:]*:$");
  16284. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  16285. switches=_st(switches)._collect_((function(each){
  16286. return smalltalk.withContext(function($ctx2) {
  16287. return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  16288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  16289. $1=switches;
  16290. return $1;
  16291. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.FileServer.klass)})},
  16292. args: [],
  16293. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'accessing' protocol\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name\x0a\x09 and add a '--' at the beginning.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self methodsInProtocol: 'accessing') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase replace: '^([a-z])' with: '--$1' ].\x0a\x09^switches",
  16294. messageSends: ["collect:", "selector", "methodsInProtocol:", "select:", "match:", "replace:with:", "asLowercase", "allButLast"],
  16295. referencedClasses: []
  16296. }),
  16297. smalltalk.FileServer.klass);
  16298. smalltalk.addMethod(
  16299. smalltalk.method({
  16300. selector: "createServerWithArguments:",
  16301. category: 'initialization',
  16302. fn: function (options){
  16303. var self=this;
  16304. var server,popFront,front,optionName,optionValue,switches;
  16305. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  16306. return smalltalk.withContext(function($ctx1) {
  16307. var $1,$2,$3,$4,$5;
  16308. var $early={};
  16309. try {
  16310. switches=_st(self)._commandLineSwitches();
  16311. server=_st(self)._new();
  16312. _st(options)._ifEmpty_((function(){
  16313. return smalltalk.withContext(function($ctx2) {
  16314. $1=server;
  16315. throw $early=[$1];
  16316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  16317. $2=_st(_st(options)._size())._even();
  16318. if(! smalltalk.assert($2)){
  16319. _st(console)._log_("Using default parameters.");
  16320. _st(console)._log_(_st("Wrong commandline options or not enough arguments for: ").__comma(options));
  16321. _st(console)._log_(_st("Use any of the following ones: ").__comma(switches));
  16322. $3=server;
  16323. return $3;
  16324. };
  16325. popFront=(function(args){
  16326. return smalltalk.withContext(function($ctx2) {
  16327. front=_st(args)._first();
  16328. front;
  16329. _st(args)._remove_(front);
  16330. return front;
  16331. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})});
  16332. _st((function(){
  16333. return smalltalk.withContext(function($ctx2) {
  16334. return _st(options)._notEmpty();
  16335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  16336. return smalltalk.withContext(function($ctx2) {
  16337. optionName=_st(popFront)._value_(options);
  16338. optionName;
  16339. optionValue=_st(popFront)._value_(options);
  16340. optionValue;
  16341. $4=_st(switches)._includes_(optionName);
  16342. if(smalltalk.assert($4)){
  16343. optionName=_st(self)._selectorForCommandLineSwitch_(optionName);
  16344. optionName;
  16345. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  16346. } else {
  16347. _st(console)._log_(_st(optionName).__comma(" is not a valid commandline option"));
  16348. return _st(console)._log_(_st("Use any of the following ones: ").__comma(switches));
  16349. };
  16350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  16351. $5=server;
  16352. return $5;
  16353. }
  16354. catch(e) {if(e===$early)return e[0]; throw e}
  16355. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},smalltalk.FileServer.klass)})},
  16356. args: ["options"],
  16357. source: "createServerWithArguments: options\x0a\x09\x22If options are empty return a default FileServer instance.\x0a\x09 If options are given loop through them and set the passed in values\x0a\x09 on the FileServer instance.\x0a\x09 \x0a\x09 Commanline options map directly to methods in the 'accessing' protocol\x0a\x09 taking one parameter.\x0a\x09 Adding a method to this protocol makes it directly settable through\x0a\x09 command line options.\x0a\x09 \x22\x0a\x09| server popFront front optionName optionValue switches |\x0a\x0a\x09switches := self commandLineSwitches.\x0a\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x0a\x09(options size even) ifFalse: [\x0a\x09\x09console log: 'Using default parameters.'.\x0a\x09\x09console log: 'Wrong commandline options or not enough arguments for: ' , options.\x0a\x09\x09console log: 'Use any of the following ones: ', switches.\x0a\x09\x09^server].\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x0a\x09\x09(switches includes: optionName) ifTrue: [\x0a\x09\x09\x09optionName := self selectorForCommandLineSwitch: optionName.\x0a\x09\x09\x09server perform: optionName withArguments: (Array with: optionValue)]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09console log: optionName, ' is not a valid commandline option'.\x0a\x09\x09\x09\x09console log: 'Use any of the following ones: ', switches ]].\x0a\x09^server.",
  16358. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "log:", ",", "even", "size", "first", "remove:", "whileTrue:", "value:", "ifTrue:ifFalse:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:", "includes:", "notEmpty"],
  16359. referencedClasses: ["Array"]
  16360. }),
  16361. smalltalk.FileServer.klass);
  16362. smalltalk.addMethod(
  16363. smalltalk.method({
  16364. selector: "defaultHost",
  16365. category: 'accessing',
  16366. fn: function (){
  16367. var self=this;
  16368. return smalltalk.withContext(function($ctx1) {
  16369. return "127.0.0.1";
  16370. }, function($ctx1) {$ctx1.fill(self,"defaultHost",{},smalltalk.FileServer.klass)})},
  16371. args: [],
  16372. source: "defaultHost\x0a\x09^'127.0.0.1'",
  16373. messageSends: [],
  16374. referencedClasses: []
  16375. }),
  16376. smalltalk.FileServer.klass);
  16377. smalltalk.addMethod(
  16378. smalltalk.method({
  16379. selector: "defaultMimeTypes",
  16380. category: 'accessing',
  16381. fn: function (){
  16382. var self=this;
  16383. return smalltalk.withContext(function($ctx1) {
  16384. var $1;
  16385. $1=smalltalk.HashedCollection._fromPairs_([_st("%").__minus_gt("application/x-trash"),_st("323").__minus_gt("text/h323"),_st("abw").__minus_gt("application/x-abiword"),_st("ai").__minus_gt("application/postscript"),_st("aif").__minus_gt("audio/x-aiff"),_st("aifc").__minus_gt("audio/x-aiff"),_st("aiff").__minus_gt("audio/x-aiff"),_st("alc").__minus_gt("chemical/x-alchemy"),_st("art").__minus_gt("image/x-jg"),_st("asc").__minus_gt("text/plain"),_st("asf").__minus_gt("video/x-ms-asf"),_st("asn").__minus_gt("chemical/x-ncbi-asn1-spec"),_st("aso").__minus_gt("chemical/x-ncbi-asn1-binary"),_st("asx").__minus_gt("video/x-ms-asf"),_st("au").__minus_gt("audio/basic"),_st("avi").__minus_gt("video/x-msvideo"),_st("b").__minus_gt("chemical/x-molconn-Z"),_st("bak").__minus_gt("application/x-trash"),_st("bat").__minus_gt("application/x-msdos-program"),_st("bcpio").__minus_gt("application/x-bcpio"),_st("bib").__minus_gt("text/x-bibtex"),_st("bin").__minus_gt("application/octet-stream"),_st("bmp").__minus_gt("image/x-ms-bmp"),_st("book").__minus_gt("application/x-maker"),_st("bsd").__minus_gt("chemical/x-crossfire"),_st("c").__minus_gt("text/x-csrc"),_st("c++").__minus_gt("text/x-c++src"),_st("c3d").__minus_gt("chemical/x-chem3d"),_st("cac").__minus_gt("chemical/x-cache"),_st("cache").__minus_gt("chemical/x-cache"),_st("cascii").__minus_gt("chemical/x-cactvs-binary"),_st("cat").__minus_gt("application/vnd.ms-pki.seccat"),_st("cbin").__minus_gt("chemical/x-cactvs-binary"),_st("cc").__minus_gt("text/x-c++src"),_st("cdf").__minus_gt("application/x-cdf"),_st("cdr").__minus_gt("image/x-coreldraw"),_st("cdt").__minus_gt("image/x-coreldrawtemplate"),_st("cdx").__minus_gt("chemical/x-cdx"),_st("cdy").__minus_gt("application/vnd.cinderella"),_st("cef").__minus_gt("chemical/x-cxf"),_st("cer").__minus_gt("chemical/x-cerius"),_st("chm").__minus_gt("chemical/x-chemdraw"),_st("chrt").__minus_gt("application/x-kchart"),_st("cif").__minus_gt("chemical/x-cif"),_st("class").__minus_gt("application/java-vm"),_st("cls").__minus_gt("text/x-tex"),_st("cmdf").__minus_gt("chemical/x-cmdf"),_st("cml").__minus_gt("chemical/x-cml"),_st("cod").__minus_gt("application/vnd.rim.cod"),_st("com").__minus_gt("application/x-msdos-program"),_st("cpa").__minus_gt("chemical/x-compass"),_st("cpio").__minus_gt("application/x-cpio"),_st("cpp").__minus_gt("text/x-c++src"),_st("cpt").__minus_gt("image/x-corelphotopaint"),_st("crl").__minus_gt("application/x-pkcs7-crl"),_st("crt").__minus_gt("application/x-x509-ca-cert"),_st("csf").__minus_gt("chemical/x-cache-csf"),_st("csh").__minus_gt("text/x-csh"),_st("csm").__minus_gt("chemical/x-csml"),_st("csml").__minus_gt("chemical/x-csml"),_st("css").__minus_gt("text/css"),_st("csv").__minus_gt("text/comma-separated-values"),_st("ctab").__minus_gt("chemical/x-cactvs-binary"),_st("ctx").__minus_gt("chemical/x-ctx"),_st("cu").__minus_gt("application/cu-seeme"),_st("cub").__minus_gt("chemical/x-gaussian-cube"),_st("cxf").__minus_gt("chemical/x-cxf"),_st("cxx").__minus_gt("text/x-c++src"),_st("dat").__minus_gt("chemical/x-mopac-input"),_st("dcr").__minus_gt("application/x-director"),_st("deb").__minus_gt("application/x-debian-package"),_st("dif").__minus_gt("video/dv"),_st("diff").__minus_gt("text/plain"),_st("dir").__minus_gt("application/x-director"),_st("djv").__minus_gt("image/vnd.djvu"),_st("djvu").__minus_gt("image/vnd.djvu"),_st("dl").__minus_gt("video/dl"),_st("dll").__minus_gt("application/x-msdos-program"),_st("dmg").__minus_gt("application/x-apple-diskimage"),_st("dms").__minus_gt("application/x-dms"),_st("doc").__minus_gt("application/msword"),_st("dot").__minus_gt("application/msword"),_st("dv").__minus_gt("video/dv"),_st("dvi").__minus_gt("application/x-dvi"),_st("dx").__minus_gt("chemical/x-jcamp-dx"),_st("dxr").__minus_gt("application/x-director"),_st("emb").__minus_gt("chemical/x-embl-dl-nucleotide"),_st("embl").__minus_gt("chemical/x-embl-dl-nucleotide"),_st("ent").__minus_gt("chemical/x-pdb"),_st("eps").__minus_gt("application/postscript"),_st("etx").__minus_gt("text/x-setext"),_st("exe").__minus_gt("application/x-msdos-program"),_st("ez").__minus_gt("application/andrew-inset"),_st("fb").__minus_gt("application/x-maker"),_st("fbdoc").__minus_gt("application/x-maker"),_st("fch").__minus_gt("chemical/x-gaussian-checkpoint"),_st("fchk").__minus_gt("chemical/x-gaussian-checkpoint"),_st("fig").__minus_gt("application/x-xfig"),_st("flac").__minus_gt("application/x-flac"),_st("fli").__minus_gt("video/fli"),_st("fm").__minus_gt("application/x-maker"),_st("frame").__minus_gt("application/x-maker"),_st("frm").__minus_gt("application/x-maker"),_st("gal").__minus_gt("chemical/x-gaussian-log"),_st("gam").__minus_gt("chemical/x-gamess-input"),_st("gamin").__minus_gt("chemical/x-gamess-input"),_st("gau").__minus_gt("chemical/x-gaussian-input"),_st("gcd").__minus_gt("text/x-pcs-gcd"),_st("gcf").__minus_gt("application/x-graphing-calculator"),_st("gcg").__minus_gt("chemical/x-gcg8-sequence"),_st("gen").__minus_gt("chemical/x-genbank"),_st("gf").__minus_gt("application/x-tex-gf"),_st("gif").__minus_gt("image/gif"),_st("gjc").__minus_gt("chemical/x-gaussian-input"),_st("gjf").__minus_gt("chemical/x-gaussian-input"),_st("gl").__minus_gt("video/gl"),_st("gnumeric").__minus_gt("application/x-gnumeric"),_st("gpt").__minus_gt("chemical/x-mopac-graph"),_st("gsf").__minus_gt("application/x-font"),_st("gsm").__minus_gt("audio/x-gsm"),_st("gtar").__minus_gt("application/x-gtar"),_st("h").__minus_gt("text/x-chdr"),_st("h++").__minus_gt("text/x-c++hdr"),_st("hdf").__minus_gt("application/x-hdf"),_st("hh").__minus_gt("text/x-c++hdr"),_st("hin").__minus_gt("chemical/x-hin"),_st("hpp").__minus_gt("text/x-c++hdr"),_st("hqx").__minus_gt("application/mac-binhex40"),_st("hs").__minus_gt("text/x-haskell"),_st("hta").__minus_gt("application/hta"),_st("htc").__minus_gt("text/x-component"),_st("htm").__minus_gt("text/html"),_st("html").__minus_gt("text/html"),_st("hxx").__minus_gt("text/x-c++hdr"),_st("ica").__minus_gt("application/x-ica"),_st("ice").__minus_gt("x-conference/x-cooltalk"),_st("ico").__minus_gt("image/x-icon"),_st("ics").__minus_gt("text/calendar"),_st("icz").__minus_gt("text/calendar"),_st("ief").__minus_gt("image/ief"),_st("iges").__minus_gt("model/iges"),_st("igs").__minus_gt("model/iges"),_st("iii").__minus_gt("application/x-iphone"),_st("inp").__minus_gt("chemical/x-gamess-input"),_st("ins").__minus_gt("application/x-internet-signup"),_st("iso").__minus_gt("application/x-iso9660-image"),_st("isp").__minus_gt("application/x-internet-signup"),_st("ist").__minus_gt("chemical/x-isostar"),_st("istr").__minus_gt("chemical/x-isostar"),_st("jad").__minus_gt("text/vnd.sun.j2me.app-descriptor"),_st("jar").__minus_gt("application/java-archive"),_st("java").__minus_gt("text/x-java"),_st("jdx").__minus_gt("chemical/x-jcamp-dx"),_st("jmz").__minus_gt("application/x-jmol"),_st("jng").__minus_gt("image/x-jng"),_st("jnlp").__minus_gt("application/x-java-jnlp-file"),_st("jpe").__minus_gt("image/jpeg"),_st("jpeg").__minus_gt("image/jpeg"),_st("jpg").__minus_gt("image/jpeg"),_st("js").__minus_gt("application/javascript"),_st("kar").__minus_gt("audio/midi"),_st("key").__minus_gt("application/pgp-keys"),_st("kil").__minus_gt("application/x-killustrator"),_st("kin").__minus_gt("chemical/x-kinemage"),_st("kpr").__minus_gt("application/x-kpresenter"),_st("kpt").__minus_gt("application/x-kpresenter"),_st("ksp").__minus_gt("application/x-kspread"),_st("kwd").__minus_gt("application/x-kword"),_st("kwt").__minus_gt("application/x-kword"),_st("latex").__minus_gt("application/x-latex"),_st("lha").__minus_gt("application/x-lha"),_st("lhs").__minus_gt("text/x-literate-haskell"),_st("lsf").__minus_gt("video/x-la-asf"),_st("lsx").__minus_gt("video/x-la-asf"),_st("ltx").__minus_gt("text/x-tex"),_st("lzh").__minus_gt("application/x-lzh"),_st("lzx").__minus_gt("application/x-lzx"),_st("m3u").__minus_gt("audio/x-mpegurl"),_st("m4a").__minus_gt("audio/mpeg"),_st("maker").__minus_gt("application/x-maker"),_st("man").__minus_gt("application/x-troff-man"),_st("mcif").__minus_gt("chemical/x-mmcif"),_st("mcm").__minus_gt("chemical/x-macmolecule"),_st("mdb").__minus_gt("application/msaccess"),_st("me").__minus_gt("application/x-troff-me"),_st("mesh").__minus_gt("model/mesh"),_st("mid").__minus_gt("audio/midi"),_st("midi").__minus_gt("audio/midi"),_st("mif").__minus_gt("application/x-mif"),_st("mm").__minus_gt("application/x-freemind"),_st("mmd").__minus_gt("chemical/x-macromodel-input"),_st("mmf").__minus_gt("application/vnd.smaf"),_st("mml").__minus_gt("text/mathml"),_st("mmod").__minus_gt("chemical/x-macromodel-input"),_st("mng").__minus_gt("video/x-mng"),_st("moc").__minus_gt("text/x-moc"),_st("mol").__minus_gt("chemical/x-mdl-molfile"),_st("mol2").__minus_gt("chemical/x-mol2"),_st("moo").__minus_gt("chemical/x-mopac-out"),_st("mop").__minus_gt("chemical/x-mopac-input"),_st("mopcrt").__minus_gt("chemical/x-mopac-input"),_st("mov").__minus_gt("video/quicktime"),_st("movie").__minus_gt("video/x-sgi-movie"),_st("mp2").__minus_gt("audio/mpeg"),_st("mp3").__minus_gt("audio/mpeg"),_st("mp4").__minus_gt("video/mp4"),_st("mpc").__minus_gt("chemical/x-mopac-input"),_st("mpe").__minus_gt("video/mpeg"),_st("mpeg").__minus_gt("video/mpeg"),_st("mpega").__minus_gt("audio/mpeg"),_st("mpg").__minus_gt("video/mpeg"),_st("mpga").__minus_gt("audio/mpeg"),_st("ms").__minus_gt("application/x-troff-ms"),_st("msh").__minus_gt("model/mesh"),_st("msi").__minus_gt("application/x-msi"),_st("mvb").__minus_gt("chemical/x-mopac-vib"),_st("mxu").__minus_gt("video/vnd.mpegurl"),_st("nb").__minus_gt("application/mathematica"),_st("nc").__minus_gt("application/x-netcdf"),_st("nwc").__minus_gt("application/x-nwc"),_st("o").__minus_gt("application/x-object"),_st("oda").__minus_gt("application/oda"),_st("odb").__minus_gt("application/vnd.oasis.opendocument.database"),_st("odc").__minus_gt("application/vnd.oasis.opendocument.chart"),_st("odf").__minus_gt("application/vnd.oasis.opendocument.formula"),_st("odg").__minus_gt("application/vnd.oasis.opendocument.graphics"),_st("odi").__minus_gt("application/vnd.oasis.opendocument.image"),_st("odm").__minus_gt("application/vnd.oasis.opendocument.text-master"),_st("odp").__minus_gt("application/vnd.oasis.opendocument.presentation"),_st("ods").__minus_gt("application/vnd.oasis.opendocument.spreadsheet"),_st("odt").__minus_gt("application/vnd.oasis.opendocument.text"),_st("ogg").__minus_gt("application/ogg"),_st("old").__minus_gt("application/x-trash"),_st("oth").__minus_gt("application/vnd.oasis.opendocument.text-web"),_st("oza").__minus_gt("application/x-oz-application"),_st("p").__minus_gt("text/x-pascal"),_st("p7r").__minus_gt("application/x-pkcs7-certreqresp"),_st("pac").__minus_gt("application/x-ns-proxy-autoconfig"),_st("pas").__minus_gt("text/x-pascal"),_st("pat").__minus_gt("image/x-coreldrawpattern"),_st("pbm").__minus_gt("image/x-portable-bitmap"),_st("pcf").__minus_gt("application/x-font"),_st("pcf.Z").__minus_gt("application/x-font"),_st("pcx").__minus_gt("image/pcx"),_st("pdb").__minus_gt("chemical/x-pdb"),_st("pdf").__minus_gt("application/pdf"),_st("pfa").__minus_gt("application/x-font"),_st("pfb").__minus_gt("application/x-font"),_st("pgm").__minus_gt("image/x-portable-graymap"),_st("pgn").__minus_gt("application/x-chess-pgn"),_st("pgp").__minus_gt("application/pgp-signature"),_st("pk").__minus_gt("application/x-tex-pk"),_st("pl").__minus_gt("text/x-perl"),_st("pls").__minus_gt("audio/x-scpls"),_st("pm").__minus_gt("text/x-perl"),_st("png").__minus_gt("image/png"),_st("pnm").__minus_gt("image/x-portable-anymap"),_st("pot").__minus_gt("text/plain"),_st("ppm").__minus_gt("image/x-portable-pixmap"),_st("pps").__minus_gt("application/vnd.ms-powerpoint"),_st("ppt").__minus_gt("application/vnd.ms-powerpoint"),_st("prf").__minus_gt("application/pics-rules"),_st("prt").__minus_gt("chemical/x-ncbi-asn1-ascii"),_st("ps").__minus_gt("application/postscript"),_st("psd").__minus_gt("image/x-photoshop"),_st("psp").__minus_gt("text/x-psp"),_st("py").__minus_gt("text/x-python"),_st("pyc").__minus_gt("application/x-python-code"),_st("pyo").__minus_gt("application/x-python-code"),_st("qt").__minus_gt("video/quicktime"),_st("qtl").__minus_gt("application/x-quicktimeplayer"),_st("ra").__minus_gt("audio/x-realaudio"),_st("ram").__minus_gt("audio/x-pn-realaudio"),_st("rar").__minus_gt("application/rar"),_st("ras").__minus_gt("image/x-cmu-raster"),_st("rd").__minus_gt("chemical/x-mdl-rdfile"),_st("rdf").__minus_gt("application/rdf+xml"),_st("rgb").__minus_gt("image/x-rgb"),_st("rm").__minus_gt("audio/x-pn-realaudio"),_st("roff").__minus_gt("application/x-troff"),_st("ros").__minus_gt("chemical/x-rosdal"),_st("rpm").__minus_gt("application/x-redhat-package-manager"),_st("rss").__minus_gt("application/rss+xml"),_st("rtf").__minus_gt("text/rtf"),_st("rtx").__minus_gt("text/richtext"),_st("rxn").__minus_gt("chemical/x-mdl-rxnfile"),_st("sct").__minus_gt("text/scriptlet"),_st("sd").__minus_gt("chemical/x-mdl-sdfile"),_st("sd2").__minus_gt("audio/x-sd2"),_st("sda").__minus_gt("application/vnd.stardivision.draw"),_st("sdc").__minus_gt("application/vnd.stardivision.calc"),_st("sdd").__minus_gt("application/vnd.stardivision.impress"),_st("sdf").__minus_gt("chemical/x-mdl-sdfile"),_st("sdp").__minus_gt("application/vnd.stardivision.impress"),_st("sdw").__minus_gt("application/vnd.stardivision.writer"),_st("ser").__minus_gt("application/java-serialized-object"),_st("sgf").__minus_gt("application/x-go-sgf"),_st("sgl").__minus_gt("application/vnd.stardivision.writer-global"),_st("sh").__minus_gt("text/x-sh"),_st("shar").__minus_gt("application/x-shar"),_st("shtml").__minus_gt("text/html"),_st("sid").__minus_gt("audio/prs.sid"),_st("sik").__minus_gt("application/x-trash"),_st("silo").__minus_gt("model/mesh"),_st("sis").__minus_gt("application/vnd.symbian.install"),_st("sit").__minus_gt("application/x-stuffit"),_st("skd").__minus_gt("application/x-koan"),_st("skm").__minus_gt("application/x-koan"),_st("skp").__minus_gt("application/x-koan"),_st("skt").__minus_gt("application/x-koan"),_st("smf").__minus_gt("application/vnd.stardivision.math"),_st("smi").__minus_gt("application/smil"),_st("smil").__minus_gt("application/smil"),_st("snd").__minus_gt("audio/basic"),_st("spc").__minus_gt("chemical/x-galactic-spc"),_st("spl").__minus_gt("application/x-futuresplash"),_st("src").__minus_gt("application/x-wais-source"),_st("stc").__minus_gt("application/vnd.sun.xml.calc.template"),_st("std").__minus_gt("application/vnd.sun.xml.draw.template"),_st("sti").__minus_gt("application/vnd.sun.xml.impress.template"),_st("stl").__minus_gt("application/vnd.ms-pki.stl"),_st("stw").__minus_gt("application/vnd.sun.xml.writer.template"),_st("sty").__minus_gt("text/x-tex"),_st("sv4cpio").__minus_gt("application/x-sv4cpio"),_st("sv4crc").__minus_gt("application/x-sv4crc"),_st("svg").__minus_gt("image/svg+xml"),_st("svgz").__minus_gt("image/svg+xml"),_st("sw").__minus_gt("chemical/x-swissprot"),_st("swf").__minus_gt("application/x-shockwave-flash"),_st("swfl").__minus_gt("application/x-shockwave-flash"),_st("sxc").__minus_gt("application/vnd.sun.xml.calc"),_st("sxd").__minus_gt("application/vnd.sun.xml.draw"),_st("sxg").__minus_gt("application/vnd.sun.xml.writer.global"),_st("sxi").__minus_gt("application/vnd.sun.xml.impress"),_st("sxm").__minus_gt("application/vnd.sun.xml.math"),_st("sxw").__minus_gt("application/vnd.sun.xml.writer"),_st("t").__minus_gt("application/x-troff"),_st("tar").__minus_gt("application/x-tar"),_st("taz").__minus_gt("application/x-gtar"),_st("tcl").__minus_gt("text/x-tcl"),_st("tex").__minus_gt("text/x-tex"),_st("texi").__minus_gt("application/x-texinfo"),_st("texinfo").__minus_gt("application/x-texinfo"),_st("text").__minus_gt("text/plain"),_st("tgf").__minus_gt("chemical/x-mdl-tgf"),_st("tgz").__minus_gt("application/x-gtar"),_st("tif").__minus_gt("image/tiff"),_st("tiff").__minus_gt("image/tiff"),_st("tk").__minus_gt("text/x-tcl"),_st("tm").__minus_gt("text/texmacs"),_st("torrent").__minus_gt("application/x-bittorrent"),_st("tr").__minus_gt("application/x-troff"),_st("ts").__minus_gt("text/texmacs"),_st("tsp").__minus_gt("application/dsptype"),_st("tsv").__minus_gt("text/tab-separated-values"),_st("txt").__minus_gt("text/plain"),_st("udeb").__minus_gt("application/x-debian-package"),_st("uls").__minus_gt("text/iuls"),_st("ustar").__minus_gt("application/x-ustar"),_st("val").__minus_gt("chemical/x-ncbi-asn1-binary"),_st("vcd").__minus_gt("application/x-cdlink"),_st("vcf").__minus_gt("text/x-vcard"),_st("vcs").__minus_gt("text/x-vcalendar"),_st("vmd").__minus_gt("chemical/x-vmd"),_st("vms").__minus_gt("chemical/x-vamas-iso14976"),_st("vor").__minus_gt("application/vnd.stardivision.writer"),_st("vrm").__minus_gt("x-world/x-vrml"),_st("vrml").__minus_gt("x-world/x-vrml"),_st("vsd").__minus_gt("application/vnd.visio"),_st("wad").__minus_gt("application/x-doom"),_st("wav").__minus_gt("audio/x-wav"),_st("wax").__minus_gt("audio/x-ms-wax"),_st("wbmp").__minus_gt("image/vnd.wap.wbmp"),_st("wbxml").__minus_gt("application/vnd.wap.wbxml"),_st("wk").__minus_gt("application/x-123"),_st("wm").__minus_gt("video/x-ms-wm"),_st("wma").__minus_gt("audio/x-ms-wma"),_st("wmd").__minus_gt("application/x-ms-wmd"),_st("wml").__minus_gt("text/vnd.wap.wml"),_st("wmlc").__minus_gt("application/vnd.wap.wmlc"),_st("wmls").__minus_gt("text/vnd.wap.wmlscript"),_st("wmlsc").__minus_gt("application/vnd.wap.wmlscriptc"),_st("wmv").__minus_gt("video/x-ms-wmv"),_st("wmx").__minus_gt("video/x-ms-wmx"),_st("wmz").__minus_gt("application/x-ms-wmz"),_st("wp5").__minus_gt("application/wordperfect5.1"),_st("wpd").__minus_gt("application/wordperfect"),_st("wrl").__minus_gt("x-world/x-vrml"),_st("wsc").__minus_gt("text/scriptlet"),_st("wvx").__minus_gt("video/x-ms-wvx"),_st("wz").__minus_gt("application/x-wingz"),_st("xbm").__minus_gt("image/x-xbitmap"),_st("xcf").__minus_gt("application/x-xcf"),_st("xht").__minus_gt("application/xhtml+xml"),_st("xhtml").__minus_gt("application/xhtml+xml"),_st("xlb").__minus_gt("application/vnd.ms-excel"),_st("xls").__minus_gt("application/vnd.ms-excel"),_st("xlt").__minus_gt("application/vnd.ms-excel"),_st("xml").__minus_gt("application/xml"),_st("xpi").__minus_gt("application/x-xpinstall"),_st("xpm").__minus_gt("image/x-xpixmap"),_st("xsl").__minus_gt("application/xml"),_st("xtel").__minus_gt("chemical/x-xtel"),_st("xul").__minus_gt("application/vnd.mozilla.xul+xml"),_st("xwd").__minus_gt("image/x-xwindowdump"),_st("xyz").__minus_gt("chemical/x-xyz"),_st("zip").__minus_gt("application/zip"),_st("zmt").__minus_gt("chemical/x-mopac-input"),_st("~").__minus_gt("application/x-trash")]);
  16386. return $1;
  16387. }, function($ctx1) {$ctx1.fill(self,"defaultMimeTypes",{},smalltalk.FileServer.klass)})},
  16388. args: [],
  16389. source: "defaultMimeTypes\x0a\x09^ #{\x0a\x09\x09'%' -> 'application/x-trash'.\x0a\x09\x09'323' -> 'text/h323'.\x0a\x09\x09'abw' -> 'application/x-abiword'.\x0a\x09\x09'ai' -> 'application/postscript'.\x0a\x09\x09'aif' -> 'audio/x-aiff'.\x0a\x09\x09'aifc' -> 'audio/x-aiff'.\x0a\x09\x09'aiff' -> 'audio/x-aiff'.\x0a\x09\x09'alc' -> 'chemical/x-alchemy'.\x0a\x09\x09'art' -> 'image/x-jg'.\x0a\x09\x09'asc' -> 'text/plain'.\x0a\x09\x09'asf' -> 'video/x-ms-asf'.\x0a\x09\x09'asn' -> 'chemical/x-ncbi-asn1-spec'.\x0a\x09\x09'aso' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'asx' -> 'video/x-ms-asf'.\x0a\x09\x09'au' -> 'audio/basic'.\x0a\x09\x09'avi' -> 'video/x-msvideo'.\x0a\x09\x09'b' -> 'chemical/x-molconn-Z'.\x0a\x09\x09'bak' -> 'application/x-trash'.\x0a\x09\x09'bat' -> 'application/x-msdos-program'.\x0a\x09\x09'bcpio' -> 'application/x-bcpio'.\x0a\x09\x09'bib' -> 'text/x-bibtex'.\x0a\x09\x09'bin' -> 'application/octet-stream'.\x0a\x09\x09'bmp' -> 'image/x-ms-bmp'.\x0a\x09\x09'book' -> 'application/x-maker'.\x0a\x09\x09'bsd' -> 'chemical/x-crossfire'.\x0a\x09\x09'c' -> 'text/x-csrc'.\x0a\x09\x09'c++' -> 'text/x-c++src'.\x0a\x09\x09'c3d' -> 'chemical/x-chem3d'.\x0a\x09\x09'cac' -> 'chemical/x-cache'.\x0a\x09\x09'cache' -> 'chemical/x-cache'.\x0a\x09\x09'cascii' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cat' -> 'application/vnd.ms-pki.seccat'.\x0a\x09\x09'cbin' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cc' -> 'text/x-c++src'.\x0a\x09\x09'cdf' -> 'application/x-cdf'.\x0a\x09\x09'cdr' -> 'image/x-coreldraw'.\x0a\x09\x09'cdt' -> 'image/x-coreldrawtemplate'.\x0a\x09\x09'cdx' -> 'chemical/x-cdx'.\x0a\x09\x09'cdy' -> 'application/vnd.cinderella'.\x0a\x09\x09'cef' -> 'chemical/x-cxf'.\x0a\x09\x09'cer' -> 'chemical/x-cerius'.\x0a\x09\x09'chm' -> 'chemical/x-chemdraw'.\x0a\x09\x09'chrt' -> 'application/x-kchart'.\x0a\x09\x09'cif' -> 'chemical/x-cif'.\x0a\x09\x09'class' -> 'application/java-vm'.\x0a\x09\x09'cls' -> 'text/x-tex'.\x0a\x09\x09'cmdf' -> 'chemical/x-cmdf'.\x0a\x09\x09'cml' -> 'chemical/x-cml'.\x0a\x09\x09'cod' -> 'application/vnd.rim.cod'.\x0a\x09\x09'com' -> 'application/x-msdos-program'.\x0a\x09\x09'cpa' -> 'chemical/x-compass'.\x0a\x09\x09'cpio' -> 'application/x-cpio'.\x0a\x09\x09'cpp' -> 'text/x-c++src'.\x0a\x09\x09'cpt' -> 'image/x-corelphotopaint'.\x0a\x09\x09'crl' -> 'application/x-pkcs7-crl'.\x0a\x09\x09'crt' -> 'application/x-x509-ca-cert'.\x0a\x09\x09'csf' -> 'chemical/x-cache-csf'.\x0a\x09\x09'csh' -> 'text/x-csh'.\x0a\x09\x09'csm' -> 'chemical/x-csml'.\x0a\x09\x09'csml' -> 'chemical/x-csml'.\x0a\x09\x09'css' -> 'text/css'.\x0a\x09\x09'csv' -> 'text/comma-separated-values'.\x0a\x09\x09'ctab' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'ctx' -> 'chemical/x-ctx'.\x0a\x09\x09'cu' -> 'application/cu-seeme'.\x0a\x09\x09'cub' -> 'chemical/x-gaussian-cube'.\x0a\x09\x09'cxf' -> 'chemical/x-cxf'.\x0a\x09\x09'cxx' -> 'text/x-c++src'.\x0a\x09\x09'dat' -> 'chemical/x-mopac-input'.\x0a\x09\x09'dcr' -> 'application/x-director'.\x0a\x09\x09'deb' -> 'application/x-debian-package'.\x0a\x09\x09'dif' -> 'video/dv'.\x0a\x09\x09'diff' -> 'text/plain'.\x0a\x09\x09'dir' -> 'application/x-director'.\x0a\x09\x09'djv' -> 'image/vnd.djvu'.\x0a\x09\x09'djvu' -> 'image/vnd.djvu'.\x0a\x09\x09'dl' -> 'video/dl'.\x0a\x09\x09'dll' -> 'application/x-msdos-program'.\x0a\x09\x09'dmg' -> 'application/x-apple-diskimage'.\x0a\x09\x09'dms' -> 'application/x-dms'.\x0a\x09\x09'doc' -> 'application/msword'.\x0a\x09\x09'dot' -> 'application/msword'.\x0a\x09\x09'dv' -> 'video/dv'.\x0a\x09\x09'dvi' -> 'application/x-dvi'.\x0a\x09\x09'dx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'dxr' -> 'application/x-director'.\x0a\x09\x09'emb' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'embl' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'ent' -> 'chemical/x-pdb'.\x0a\x09\x09'eps' -> 'application/postscript'.\x0a\x09\x09'etx' -> 'text/x-setext'.\x0a\x09\x09'exe' -> 'application/x-msdos-program'.\x0a\x09\x09'ez' -> 'application/andrew-inset'.\x0a\x09\x09'fb' -> 'application/x-maker'.\x0a\x09\x09'fbdoc' -> 'application/x-maker'.\x0a\x09\x09'fch' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fchk' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fig' -> 'application/x-xfig'.\x0a\x09\x09'flac' -> 'application/x-flac'.\x0a\x09\x09'fli' -> 'video/fli'.\x0a\x09\x09'fm' -> 'application/x-maker'.\x0a\x09\x09'frame' -> 'application/x-maker'.\x0a\x09\x09'frm' -> 'application/x-maker'.\x0a\x09\x09'gal' -> 'chemical/x-gaussian-log'.\x0a\x09\x09'gam' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gamin' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gau' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gcd' -> 'text/x-pcs-gcd'.\x0a\x09\x09'gcf' -> 'application/x-graphing-calculator'.\x0a\x09\x09'gcg' -> 'chemical/x-gcg8-sequence'.\x0a\x09\x09'gen' -> 'chemical/x-genbank'.\x0a\x09\x09'gf' -> 'application/x-tex-gf'.\x0a\x09\x09'gif' -> 'image/gif'.\x0a\x09\x09'gjc' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gjf' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gl' -> 'video/gl'.\x0a\x09\x09'gnumeric' -> 'application/x-gnumeric'.\x0a\x09\x09'gpt' -> 'chemical/x-mopac-graph'.\x0a\x09\x09'gsf' -> 'application/x-font'.\x0a\x09\x09'gsm' -> 'audio/x-gsm'.\x0a\x09\x09'gtar' -> 'application/x-gtar'.\x0a\x09\x09'h' -> 'text/x-chdr'.\x0a\x09\x09'h++' -> 'text/x-c++hdr'.\x0a\x09\x09'hdf' -> 'application/x-hdf'.\x0a\x09\x09'hh' -> 'text/x-c++hdr'.\x0a\x09\x09'hin' -> 'chemical/x-hin'.\x0a\x09\x09'hpp' -> 'text/x-c++hdr'.\x0a\x09\x09'hqx' -> 'application/mac-binhex40'.\x0a\x09\x09'hs' -> 'text/x-haskell'.\x0a\x09\x09'hta' -> 'application/hta'.\x0a\x09\x09'htc' -> 'text/x-component'.\x0a\x09\x09'htm' -> 'text/html'.\x0a\x09\x09'html' -> 'text/html'.\x0a\x09\x09'hxx' -> 'text/x-c++hdr'.\x0a\x09\x09'ica' -> 'application/x-ica'.\x0a\x09\x09'ice' -> 'x-conference/x-cooltalk'.\x0a\x09\x09'ico' -> 'image/x-icon'.\x0a\x09\x09'ics' -> 'text/calendar'.\x0a\x09\x09'icz' -> 'text/calendar'.\x0a\x09\x09'ief' -> 'image/ief'.\x0a\x09\x09'iges' -> 'model/iges'.\x0a\x09\x09'igs' -> 'model/iges'.\x0a\x09\x09'iii' -> 'application/x-iphone'.\x0a\x09\x09'inp' -> 'chemical/x-gamess-input'.\x0a\x09\x09'ins' -> 'application/x-internet-signup'.\x0a\x09\x09'iso' -> 'application/x-iso9660-image'.\x0a\x09\x09'isp' -> 'application/x-internet-signup'.\x0a\x09\x09'ist' -> 'chemical/x-isostar'.\x0a\x09\x09'istr' -> 'chemical/x-isostar'.\x0a\x09\x09'jad' -> 'text/vnd.sun.j2me.app-descriptor'.\x0a\x09\x09'jar' -> 'application/java-archive'.\x0a\x09\x09'java' -> 'text/x-java'.\x0a\x09\x09'jdx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'jmz' -> 'application/x-jmol'.\x0a\x09\x09'jng' -> 'image/x-jng'.\x0a\x09\x09'jnlp' -> 'application/x-java-jnlp-file'.\x0a\x09\x09'jpe' -> 'image/jpeg'.\x0a\x09\x09'jpeg' -> 'image/jpeg'.\x0a\x09\x09'jpg' -> 'image/jpeg'.\x0a\x09\x09'js' -> 'application/javascript'.\x0a\x09\x09'kar' -> 'audio/midi'.\x0a\x09\x09'key' -> 'application/pgp-keys'.\x0a\x09\x09'kil' -> 'application/x-killustrator'.\x0a\x09\x09'kin' -> 'chemical/x-kinemage'.\x0a\x09\x09'kpr' -> 'application/x-kpresenter'.\x0a\x09\x09'kpt' -> 'application/x-kpresenter'.\x0a\x09\x09'ksp' -> 'application/x-kspread'.\x0a\x09\x09'kwd' -> 'application/x-kword'.\x0a\x09\x09'kwt' -> 'application/x-kword'.\x0a\x09\x09'latex' -> 'application/x-latex'.\x0a\x09\x09'lha' -> 'application/x-lha'.\x0a\x09\x09'lhs' -> 'text/x-literate-haskell'.\x0a\x09\x09'lsf' -> 'video/x-la-asf'.\x0a\x09\x09'lsx' -> 'video/x-la-asf'.\x0a\x09\x09'ltx' -> 'text/x-tex'.\x0a\x09\x09'lzh' -> 'application/x-lzh'.\x0a\x09\x09'lzx' -> 'application/x-lzx'.\x0a\x09\x09'm3u' -> 'audio/x-mpegurl'.\x0a\x09\x09'm4a' -> 'audio/mpeg'.\x0a\x09\x09'maker' -> 'application/x-maker'.\x0a\x09\x09'man' -> 'application/x-troff-man'.\x0a\x09\x09'mcif' -> 'chemical/x-mmcif'.\x0a\x09\x09'mcm' -> 'chemical/x-macmolecule'.\x0a\x09\x09'mdb' -> 'application/msaccess'.\x0a\x09\x09'me' -> 'application/x-troff-me'.\x0a\x09\x09'mesh' -> 'model/mesh'.\x0a\x09\x09'mid' -> 'audio/midi'.\x0a\x09\x09'midi' -> 'audio/midi'.\x0a\x09\x09'mif' -> 'application/x-mif'.\x0a\x09\x09'mm' -> 'application/x-freemind'.\x0a\x09\x09'mmd' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mmf' -> 'application/vnd.smaf'.\x0a\x09\x09'mml' -> 'text/mathml'.\x0a\x09\x09'mmod' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mng' -> 'video/x-mng'.\x0a\x09\x09'moc' -> 'text/x-moc'.\x0a\x09\x09'mol' -> 'chemical/x-mdl-molfile'.\x0a\x09\x09'mol2' -> 'chemical/x-mol2'.\x0a\x09\x09'moo' -> 'chemical/x-mopac-out'.\x0a\x09\x09'mop' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mopcrt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mov' -> 'video/quicktime'.\x0a\x09\x09'movie' -> 'video/x-sgi-movie'.\x0a\x09\x09'mp2' -> 'audio/mpeg'.\x0a\x09\x09'mp3' -> 'audio/mpeg'.\x0a\x09\x09'mp4' -> 'video/mp4'.\x0a\x09\x09'mpc' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mpe' -> 'video/mpeg'.\x0a\x09\x09'mpeg' -> 'video/mpeg'.\x0a\x09\x09'mpega' -> 'audio/mpeg'.\x0a\x09\x09'mpg' -> 'video/mpeg'.\x0a\x09\x09'mpga' -> 'audio/mpeg'.\x0a\x09\x09'ms' -> 'application/x-troff-ms'.\x0a\x09\x09'msh' -> 'model/mesh'.\x0a\x09\x09'msi' -> 'application/x-msi'.\x0a\x09\x09'mvb' -> 'chemical/x-mopac-vib'.\x0a\x09\x09'mxu' -> 'video/vnd.mpegurl'.\x0a\x09\x09'nb' -> 'application/mathematica'.\x0a\x09\x09'nc' -> 'application/x-netcdf'.\x0a\x09\x09'nwc' -> 'application/x-nwc'.\x0a\x09\x09'o' -> 'application/x-object'.\x0a\x09\x09'oda' -> 'application/oda'.\x0a\x09\x09'odb' -> 'application/vnd.oasis.opendocument.database'.\x0a\x09\x09'odc' -> 'application/vnd.oasis.opendocument.chart'.\x0a\x09\x09'odf' -> 'application/vnd.oasis.opendocument.formula'.\x0a\x09\x09'odg' -> 'application/vnd.oasis.opendocument.graphics'.\x0a\x09\x09'odi' -> 'application/vnd.oasis.opendocument.image'.\x0a\x09\x09'odm' -> 'application/vnd.oasis.opendocument.text-master'.\x0a\x09\x09'odp' -> 'application/vnd.oasis.opendocument.presentation'.\x0a\x09\x09'ods' -> 'application/vnd.oasis.opendocument.spreadsheet'.\x0a\x09\x09'odt' -> 'application/vnd.oasis.opendocument.text'.\x0a\x09\x09'ogg' -> 'application/ogg'.\x0a\x09\x09'old' -> 'application/x-trash'.\x0a\x09\x09'oth' -> 'application/vnd.oasis.opendocument.text-web'.\x0a\x09\x09'oza' -> 'application/x-oz-application'.\x0a\x09\x09'p' -> 'text/x-pascal'.\x0a\x09\x09'p7r' -> 'application/x-pkcs7-certreqresp'.\x0a\x09\x09'pac' -> 'application/x-ns-proxy-autoconfig'.\x0a\x09\x09'pas' -> 'text/x-pascal'.\x0a\x09\x09'pat' -> 'image/x-coreldrawpattern'.\x0a\x09\x09'pbm' -> 'image/x-portable-bitmap'.\x0a\x09\x09'pcf' -> 'application/x-font'.\x0a\x09\x09'pcf.Z' -> 'application/x-font'.\x0a\x09\x09'pcx' -> 'image/pcx'.\x0a\x09\x09'pdb' -> 'chemical/x-pdb'.\x0a\x09\x09'pdf' -> 'application/pdf'.\x0a\x09\x09'pfa' -> 'application/x-font'.\x0a\x09\x09'pfb' -> 'application/x-font'.\x0a\x09\x09'pgm' -> 'image/x-portable-graymap'.\x0a\x09\x09'pgn' -> 'application/x-chess-pgn'.\x0a\x09\x09'pgp' -> 'application/pgp-signature'.\x0a\x09\x09'pk' -> 'application/x-tex-pk'.\x0a\x09\x09'pl' -> 'text/x-perl'.\x0a\x09\x09'pls' -> 'audio/x-scpls'.\x0a\x09\x09'pm' -> 'text/x-perl'.\x0a\x09\x09'png' -> 'image/png'.\x0a\x09\x09'pnm' -> 'image/x-portable-anymap'.\x0a\x09\x09'pot' -> 'text/plain'.\x0a\x09\x09'ppm' -> 'image/x-portable-pixmap'.\x0a\x09\x09'pps' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'ppt' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'prf' -> 'application/pics-rules'.\x0a\x09\x09'prt' -> 'chemical/x-ncbi-asn1-ascii'.\x0a\x09\x09'ps' -> 'application/postscript'.\x0a\x09\x09'psd' -> 'image/x-photoshop'.\x0a\x09\x09'psp' -> 'text/x-psp'.\x0a\x09\x09'py' -> 'text/x-python'.\x0a\x09\x09'pyc' -> 'application/x-python-code'.\x0a\x09\x09'pyo' -> 'application/x-python-code'.\x0a\x09\x09'qt' -> 'video/quicktime'.\x0a\x09\x09'qtl' -> 'application/x-quicktimeplayer'.\x0a\x09\x09'ra' -> 'audio/x-realaudio'.\x0a\x09\x09'ram' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'rar' -> 'application/rar'.\x0a\x09\x09'ras' -> 'image/x-cmu-raster'.\x0a\x09\x09'rd' -> 'chemical/x-mdl-rdfile'.\x0a\x09\x09'rdf' -> 'application/rdf+xml'.\x0a\x09\x09'rgb' -> 'image/x-rgb'.\x0a\x09\x09'rm' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'roff' -> 'application/x-troff'.\x0a\x09\x09'ros' -> 'chemical/x-rosdal'.\x0a\x09\x09'rpm' -> 'application/x-redhat-package-manager'.\x0a\x09\x09'rss' -> 'application/rss+xml'.\x0a\x09\x09'rtf' -> 'text/rtf'.\x0a\x09\x09'rtx' -> 'text/richtext'.\x0a\x09\x09'rxn' -> 'chemical/x-mdl-rxnfile'.\x0a\x09\x09'sct' -> 'text/scriptlet'.\x0a\x09\x09'sd' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sd2' -> 'audio/x-sd2'.\x0a\x09\x09'sda' -> 'application/vnd.stardivision.draw'.\x0a\x09\x09'sdc' -> 'application/vnd.stardivision.calc'.\x0a\x09\x09'sdd' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdf' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sdp' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdw' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'ser' -> 'application/java-serialized-object'.\x0a\x09\x09'sgf' -> 'application/x-go-sgf'.\x0a\x09\x09'sgl' -> 'application/vnd.stardivision.writer-global'.\x0a\x09\x09'sh' -> 'text/x-sh'.\x0a\x09\x09'shar' -> 'application/x-shar'.\x0a\x09\x09'shtml' -> 'text/html'.\x0a\x09\x09'sid' -> 'audio/prs.sid'.\x0a\x09\x09'sik' -> 'application/x-trash'.\x0a\x09\x09'silo' -> 'model/mesh'.\x0a\x09\x09'sis' -> 'application/vnd.symbian.install'.\x0a\x09\x09'sit' -> 'application/x-stuffit'.\x0a\x09\x09'skd' -> 'application/x-koan'.\x0a\x09\x09'skm' -> 'application/x-koan'.\x0a\x09\x09'skp' -> 'application/x-koan'.\x0a\x09\x09'skt' -> 'application/x-koan'.\x0a\x09\x09'smf' -> 'application/vnd.stardivision.math'.\x0a\x09\x09'smi' -> 'application/smil'.\x0a\x09\x09'smil' -> 'application/smil'.\x0a\x09\x09'snd' -> 'audio/basic'.\x0a\x09\x09'spc' -> 'chemical/x-galactic-spc'.\x0a\x09\x09'spl' -> 'application/x-futuresplash'.\x0a\x09\x09'src' -> 'application/x-wais-source'.\x0a\x09\x09'stc' -> 'application/vnd.sun.xml.calc.template'.\x0a\x09\x09'std' -> 'application/vnd.sun.xml.draw.template'.\x0a\x09\x09'sti' -> 'application/vnd.sun.xml.impress.template'.\x0a\x09\x09'stl' -> 'application/vnd.ms-pki.stl'.\x0a\x09\x09'stw' -> 'application/vnd.sun.xml.writer.template'.\x0a\x09\x09'sty' -> 'text/x-tex'.\x0a\x09\x09'sv4cpio' -> 'application/x-sv4cpio'.\x0a\x09\x09'sv4crc' -> 'application/x-sv4crc'.\x0a\x09\x09'svg' -> 'image/svg+xml'.\x0a\x09\x09'svgz' -> 'image/svg+xml'.\x0a\x09\x09'sw' -> 'chemical/x-swissprot'.\x0a\x09\x09'swf' -> 'application/x-shockwave-flash'.\x0a\x09\x09'swfl' -> 'application/x-shockwave-flash'.\x0a\x09\x09'sxc' -> 'application/vnd.sun.xml.calc'.\x0a\x09\x09'sxd' -> 'application/vnd.sun.xml.draw'.\x0a\x09\x09'sxg' -> 'application/vnd.sun.xml.writer.global'.\x0a\x09\x09'sxi' -> 'application/vnd.sun.xml.impress'.\x0a\x09\x09'sxm' -> 'application/vnd.sun.xml.math'.\x0a\x09\x09'sxw' -> 'application/vnd.sun.xml.writer'.\x0a\x09\x09't' -> 'application/x-troff'.\x0a\x09\x09'tar' -> 'application/x-tar'.\x0a\x09\x09'taz' -> 'application/x-gtar'.\x0a\x09\x09'tcl' -> 'text/x-tcl'.\x0a\x09\x09'tex' -> 'text/x-tex'.\x0a\x09\x09'texi' -> 'application/x-texinfo'.\x0a\x09\x09'texinfo' -> 'application/x-texinfo'.\x0a\x09\x09'text' -> 'text/plain'.\x0a\x09\x09'tgf' -> 'chemical/x-mdl-tgf'.\x0a\x09\x09'tgz' -> 'application/x-gtar'.\x0a\x09\x09'tif' -> 'image/tiff'.\x0a\x09\x09'tiff' -> 'image/tiff'.\x0a\x09\x09'tk' -> 'text/x-tcl'.\x0a\x09\x09'tm' -> 'text/texmacs'.\x0a\x09\x09'torrent' -> 'application/x-bittorrent'.\x0a\x09\x09'tr' -> 'application/x-troff'.\x0a\x09\x09'ts' -> 'text/texmacs'.\x0a\x09\x09'tsp' -> 'application/dsptype'.\x0a\x09\x09'tsv' -> 'text/tab-separated-values'.\x0a\x09\x09'txt' -> 'text/plain'.\x0a\x09\x09'udeb' -> 'application/x-debian-package'.\x0a\x09\x09'uls' -> 'text/iuls'.\x0a\x09\x09'ustar' -> 'application/x-ustar'.\x0a\x09\x09'val' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'vcd' -> 'application/x-cdlink'.\x0a\x09\x09'vcf' -> 'text/x-vcard'.\x0a\x09\x09'vcs' -> 'text/x-vcalendar'.\x0a\x09\x09'vmd' -> 'chemical/x-vmd'.\x0a\x09\x09'vms' -> 'chemical/x-vamas-iso14976'.\x0a\x09\x09'vor' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'vrm' -> 'x-world/x-vrml'.\x0a\x09\x09'vrml' -> 'x-world/x-vrml'.\x0a\x09\x09'vsd' -> 'application/vnd.visio'.\x0a\x09\x09'wad' -> 'application/x-doom'.\x0a\x09\x09'wav' -> 'audio/x-wav'.\x0a\x09\x09'wax' -> 'audio/x-ms-wax'.\x0a\x09\x09'wbmp' -> 'image/vnd.wap.wbmp'.\x0a\x09\x09'wbxml' -> 'application/vnd.wap.wbxml'.\x0a\x09\x09'wk' -> 'application/x-123'.\x0a\x09\x09'wm' -> 'video/x-ms-wm'.\x0a\x09\x09'wma' -> 'audio/x-ms-wma'.\x0a\x09\x09'wmd' -> 'application/x-ms-wmd'.\x0a\x09\x09'wml' -> 'text/vnd.wap.wml'.\x0a\x09\x09'wmlc' -> 'application/vnd.wap.wmlc'.\x0a\x09\x09'wmls' -> 'text/vnd.wap.wmlscript'.\x0a\x09\x09'wmlsc' -> 'application/vnd.wap.wmlscriptc'.\x0a\x09\x09'wmv' -> 'video/x-ms-wmv'.\x0a\x09\x09'wmx' -> 'video/x-ms-wmx'.\x0a\x09\x09'wmz' -> 'application/x-ms-wmz'.\x0a\x09\x09'wp5' -> 'application/wordperfect5.1'.\x0a\x09\x09'wpd' -> 'application/wordperfect'.\x0a\x09\x09'wrl' -> 'x-world/x-vrml'.\x0a\x09\x09'wsc' -> 'text/scriptlet'.\x0a\x09\x09'wvx' -> 'video/x-ms-wvx'.\x0a\x09\x09'wz' -> 'application/x-wingz'.\x0a\x09\x09'xbm' -> 'image/x-xbitmap'.\x0a\x09\x09'xcf' -> 'application/x-xcf'.\x0a\x09\x09'xht' -> 'application/xhtml+xml'.\x0a\x09\x09'xhtml' -> 'application/xhtml+xml'.\x0a\x09\x09'xlb' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xls' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xlt' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xml' -> 'application/xml'.\x0a\x09\x09'xpi' -> 'application/x-xpinstall'.\x0a\x09\x09'xpm' -> 'image/x-xpixmap'.\x0a\x09\x09'xsl' -> 'application/xml'.\x0a\x09\x09'xtel' -> 'chemical/x-xtel'.\x0a\x09\x09'xul' -> 'application/vnd.mozilla.xul+xml'.\x0a\x09\x09'xwd' -> 'image/x-xwindowdump'.\x0a\x09\x09'xyz' -> 'chemical/x-xyz'.\x0a\x09\x09'zip' -> 'application/zip'.\x0a\x09\x09'zmt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'~' -> 'application/x-trash'\x0a\x09}",
  16390. messageSends: ["->"],
  16391. referencedClasses: []
  16392. }),
  16393. smalltalk.FileServer.klass);
  16394. smalltalk.addMethod(
  16395. smalltalk.method({
  16396. selector: "defaultPort",
  16397. category: 'accessing',
  16398. fn: function (){
  16399. var self=this;
  16400. return smalltalk.withContext(function($ctx1) {
  16401. var $1;
  16402. $1=(4000);
  16403. return $1;
  16404. }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})},
  16405. args: [],
  16406. source: "defaultPort\x0a\x09^4000",
  16407. messageSends: [],
  16408. referencedClasses: []
  16409. }),
  16410. smalltalk.FileServer.klass);
  16411. smalltalk.addMethod(
  16412. smalltalk.method({
  16413. selector: "main",
  16414. category: 'initialization',
  16415. fn: function (){
  16416. var self=this;
  16417. var fileServer,args;
  16418. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  16419. return smalltalk.withContext(function($ctx1) {
  16420. var $1,$2;
  16421. var $early={};
  16422. try {
  16423. args=_st(process)._argv();
  16424. _st(args)._removeFrom_to_((1),(3));
  16425. _st(args)._detect_ifNone_((function(each){
  16426. return smalltalk.withContext(function($ctx2) {
  16427. $1=_st(each).__eq("--help");
  16428. if(smalltalk.assert($1)){
  16429. return _st($FileServer())._printHelp();
  16430. };
  16431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  16432. return smalltalk.withContext(function($ctx2) {
  16433. fileServer=_st($FileServer())._createServerWithArguments_(args);
  16434. fileServer;
  16435. $2=_st(fileServer)._start();
  16436. throw $early=[$2];
  16437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  16438. return self}
  16439. catch(e) {if(e===$early)return e[0]; throw e}
  16440. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},smalltalk.FileServer.klass)})},
  16441. args: [],
  16442. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09 Creates and starts a FileServer instance.\x22\x0a\x09| fileServer args |\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 3.\x0a\x0a\x09args detect: [ :each |\x0a\x09\x09(each = '--help') ifTrue: [FileServer printHelp]]\x0a\x09ifNone: [\x0a\x09\x09fileServer := FileServer createServerWithArguments: args.\x0a\x09\x09^fileServer start]",
  16443. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "printHelp", "=", "createServerWithArguments:", "start"],
  16444. referencedClasses: ["FileServer"]
  16445. }),
  16446. smalltalk.FileServer.klass);
  16447. smalltalk.addMethod(
  16448. smalltalk.method({
  16449. selector: "mimeTypeFor:",
  16450. category: 'accessing',
  16451. fn: function (aString){
  16452. var self=this;
  16453. return smalltalk.withContext(function($ctx1) {
  16454. var $1;
  16455. $1=_st(_st(self)._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  16456. return smalltalk.withContext(function($ctx2) {
  16457. return "text/plain";
  16458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  16459. return $1;
  16460. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},smalltalk.FileServer.klass)})},
  16461. args: ["aString"],
  16462. source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  16463. messageSends: ["at:ifAbsent:", "replace:with:", "mimeTypes"],
  16464. referencedClasses: []
  16465. }),
  16466. smalltalk.FileServer.klass);
  16467. smalltalk.addMethod(
  16468. smalltalk.method({
  16469. selector: "mimeTypes",
  16470. category: 'accessing',
  16471. fn: function (){
  16472. var self=this;
  16473. return smalltalk.withContext(function($ctx1) {
  16474. var $2,$1;
  16475. $2=self["@mimeTypes"];
  16476. if(($receiver = $2) == nil || $receiver == undefined){
  16477. self["@mimeTypes"]=_st(self)._defaultMimeTypes();
  16478. $1=self["@mimeTypes"];
  16479. } else {
  16480. $1=$2;
  16481. };
  16482. return $1;
  16483. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},smalltalk.FileServer.klass)})},
  16484. args: [],
  16485. source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  16486. messageSends: ["ifNil:", "defaultMimeTypes"],
  16487. referencedClasses: []
  16488. }),
  16489. smalltalk.FileServer.klass);
  16490. smalltalk.addMethod(
  16491. smalltalk.method({
  16492. selector: "printHelp",
  16493. category: 'accessing',
  16494. fn: function (){
  16495. var self=this;
  16496. return smalltalk.withContext(function($ctx1) {
  16497. _st(console)._log_("Available commandline options are:");
  16498. _st(console)._log_("--help");
  16499. _st(_st(self)._commandLineSwitches())._do_((function(each){
  16500. return smalltalk.withContext(function($ctx2) {
  16501. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  16502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  16503. return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},smalltalk.FileServer.klass)})},
  16504. args: [],
  16505. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  16506. messageSends: ["log:", "do:", ",", "commandLineSwitches"],
  16507. referencedClasses: []
  16508. }),
  16509. smalltalk.FileServer.klass);
  16510. smalltalk.addMethod(
  16511. smalltalk.method({
  16512. selector: "selectorForCommandLineSwitch:",
  16513. category: 'accessing',
  16514. fn: function (aSwitch){
  16515. var self=this;
  16516. return smalltalk.withContext(function($ctx1) {
  16517. var $1;
  16518. $1=_st(_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  16519. return smalltalk.withContext(function($ctx2) {
  16520. return _st(_st(each)._second())._asUppercase();
  16521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
  16522. return $1;
  16523. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.FileServer.klass)})},
  16524. args: ["aSwitch"],
  16525. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Remove the trailing '--', add ':' at the end\x0a\x09 and replace all occurences of a lowercase letter preceded by a '-' with\x0a\x09 the Uppercase letter.\x0a\x09 Example: --fallback-page becomes fallbackPage:\x22\x0a\x09^((aSwitch replace: '^--' with: '')\x0a\x09\x09replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':'",
  16526. messageSends: [",", "replace:with:", "asUppercase", "second"],
  16527. referencedClasses: []
  16528. }),
  16529. smalltalk.FileServer.klass);
  16530. (function () {
  16531. var inBrowser = typeof amber !== "undefined" && typeof amber.load === "function";
  16532. function init() {
  16533. smalltalk.initialize();
  16534. /* Similar to jQuery(document).ready() */
  16535. if (inBrowser && amber.smalltalkReady) {
  16536. amber.smalltalkReady();
  16537. }
  16538. }
  16539. if (inBrowser) {
  16540. // init is lengthy process done in JavaScript.
  16541. // setTimeout here postpones it, so DOM ready
  16542. // event can occur sooner, thus load process
  16543. // may appear optically faster.
  16544. setTimeout(init, 0);
  16545. } else {
  16546. // In certain configurations, setTimeout is not feasible.
  16547. // It is mainly for `amberc`-produced concatenated
  16548. // node.js programs. There, the actual "main" appears
  16549. // immediately after init, so it must happens synchronously.
  16550. init();
  16551. }
  16552. })();smalltalk.FileServer._main()