1
0

amber-cli.js 2.7 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423
  1. #!/usr/bin/env node
  2. var define = (function amdefine(module, requireFn) {
  3. 'use strict';
  4. var defineCache = {},
  5. loaderCache = {},
  6. alreadyCalled = false,
  7. path = require('path'),
  8. makeRequire, stringRequire;
  9. /**
  10. * Trims the . and .. from an array of path segments.
  11. * It will keep a leading path segment if a .. will become
  12. * the first path segment, to help with module name lookups,
  13. * which act like paths, but can be remapped. But the end result,
  14. * all paths that use this function should look normalized.
  15. * NOTE: this method MODIFIES the input array.
  16. * @param {Array} ary the array of path segments.
  17. */
  18. function trimDots(ary) {
  19. var i, part;
  20. for (i = 0; ary[i]; i+= 1) {
  21. part = ary[i];
  22. if (part === '.') {
  23. ary.splice(i, 1);
  24. i -= 1;
  25. } else if (part === '..') {
  26. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  27. //End of the line. Keep at least one non-dot
  28. //path segment at the front so it can be mapped
  29. //correctly to disk. Otherwise, there is likely
  30. //no path mapping for a path starting with '..'.
  31. //This can still fail, but catches the most reasonable
  32. //uses of ..
  33. break;
  34. } else if (i > 0) {
  35. ary.splice(i - 1, 2);
  36. i -= 2;
  37. }
  38. }
  39. }
  40. }
  41. function normalize(name, baseName) {
  42. var baseParts;
  43. //Adjust any relative paths.
  44. if (name && name.charAt(0) === '.') {
  45. //If have a base name, try to normalize against it,
  46. //otherwise, assume it is a top-level require that will
  47. //be relative to baseUrl in the end.
  48. if (baseName) {
  49. baseParts = baseName.split('/');
  50. baseParts = baseParts.slice(0, baseParts.length - 1);
  51. baseParts = baseParts.concat(name.split('/'));
  52. trimDots(baseParts);
  53. name = baseParts.join('/');
  54. }
  55. }
  56. return name;
  57. }
  58. /**
  59. * Create the normalize() function passed to a loader plugin's
  60. * normalize method.
  61. */
  62. function makeNormalize(relName) {
  63. return function (name) {
  64. return normalize(name, relName);
  65. };
  66. }
  67. function makeLoad(id) {
  68. function load(value) {
  69. loaderCache[id] = value;
  70. }
  71. load.fromText = function (id, text) {
  72. //This one is difficult because the text can/probably uses
  73. //define, and any relative paths and requires should be relative
  74. //to that id was it would be found on disk. But this would require
  75. //bootstrapping a module/require fairly deeply from node core.
  76. //Not sure how best to go about that yet.
  77. throw new Error('amdefine does not implement load.fromText');
  78. };
  79. return load;
  80. }
  81. makeRequire = function (systemRequire, exports, module, relId) {
  82. function amdRequire(deps, callback) {
  83. if (typeof deps === 'string') {
  84. //Synchronous, single module require('')
  85. return stringRequire(systemRequire, exports, module, deps, relId);
  86. } else {
  87. //Array of dependencies with a callback.
  88. //Convert the dependencies to modules.
  89. deps = deps.map(function (depName) {
  90. return stringRequire(systemRequire, exports, module, depName, relId);
  91. });
  92. //Wait for next tick to call back the require call.
  93. process.nextTick(function () {
  94. callback.apply(null, deps);
  95. });
  96. }
  97. }
  98. amdRequire.toUrl = function (filePath) {
  99. if (filePath.indexOf('.') === 0) {
  100. return normalize(filePath, path.dirname(module.filename));
  101. } else {
  102. return filePath;
  103. }
  104. };
  105. return amdRequire;
  106. };
  107. //Favor explicit value, passed in if the module wants to support Node 0.4.
  108. requireFn = requireFn || function req() {
  109. return module.require.apply(module, arguments);
  110. };
  111. function runFactory(id, deps, factory) {
  112. var r, e, m, result;
  113. if (id) {
  114. e = loaderCache[id] = {};
  115. m = {
  116. id: id,
  117. uri: __filename,
  118. exports: e
  119. };
  120. r = makeRequire(requireFn, e, m, id);
  121. } else {
  122. //Only support one define call per file
  123. if (alreadyCalled) {
  124. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  125. }
  126. alreadyCalled = true;
  127. //Use the real variables from node
  128. //Use module.exports for exports, since
  129. //the exports in here is amdefine exports.
  130. e = module.exports;
  131. m = module;
  132. r = makeRequire(requireFn, e, m, module.id);
  133. }
  134. //If there are dependencies, they are strings, so need
  135. //to convert them to dependency values.
  136. if (deps) {
  137. deps = deps.map(function (depName) {
  138. return r(depName);
  139. });
  140. }
  141. //Call the factory with the right dependencies.
  142. if (typeof factory === 'function') {
  143. result = factory.apply(m.exports, deps);
  144. } else {
  145. result = factory;
  146. }
  147. if (result !== undefined) {
  148. m.exports = result;
  149. if (id) {
  150. loaderCache[id] = m.exports;
  151. }
  152. }
  153. }
  154. stringRequire = function (systemRequire, exports, module, id, relId) {
  155. //Split the ID by a ! so that
  156. var index = id.indexOf('!'),
  157. originalId = id,
  158. prefix, plugin;
  159. if (index === -1) {
  160. id = normalize(id, relId);
  161. //Straight module lookup. If it is one of the special dependencies,
  162. //deal with it, otherwise, delegate to node.
  163. if (id === 'require') {
  164. return makeRequire(systemRequire, exports, module, relId);
  165. } else if (id === 'exports') {
  166. return exports;
  167. } else if (id === 'module') {
  168. return module;
  169. } else if (loaderCache.hasOwnProperty(id)) {
  170. return loaderCache[id];
  171. } else if (defineCache[id]) {
  172. runFactory.apply(null, defineCache[id]);
  173. return loaderCache[id];
  174. } else {
  175. if(systemRequire) {
  176. return systemRequire(originalId);
  177. } else {
  178. throw new Error('No module with ID: ' + id);
  179. }
  180. }
  181. } else {
  182. //There is a plugin in play.
  183. prefix = id.substring(0, index);
  184. id = id.substring(index + 1, id.length);
  185. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  186. if (plugin.normalize) {
  187. id = plugin.normalize(id, makeNormalize(relId));
  188. } else {
  189. //Normalize the ID normally.
  190. id = normalize(id, relId);
  191. }
  192. if (loaderCache[id]) {
  193. return loaderCache[id];
  194. } else {
  195. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  196. return loaderCache[id];
  197. }
  198. }
  199. };
  200. //Create a define function specific to the module asking for amdefine.
  201. function define(id, deps, factory) {
  202. if (Array.isArray(id)) {
  203. factory = deps;
  204. deps = id;
  205. id = undefined;
  206. } else if (typeof id !== 'string') {
  207. factory = id;
  208. id = deps = undefined;
  209. }
  210. if (deps && !Array.isArray(deps)) {
  211. factory = deps;
  212. deps = undefined;
  213. }
  214. if (!deps) {
  215. deps = ['require', 'exports', 'module'];
  216. }
  217. //Set up properties for this module. If an ID, then use
  218. //internal cache. If no ID, then use the external variables
  219. //for this node module.
  220. if (id) {
  221. //Put the module in deep freeze until there is a
  222. //require call for it.
  223. defineCache[id] = [id, deps, factory];
  224. } else {
  225. runFactory(id, deps, factory);
  226. }
  227. }
  228. //define.require, which has access to all the values in the
  229. //cache. Useful for AMD modules that all have IDs in the file,
  230. //but need to finally export a value to node based on one of those
  231. //IDs.
  232. define.require = function (id) {
  233. if (loaderCache[id]) {
  234. return loaderCache[id];
  235. }
  236. if (defineCache[id]) {
  237. runFactory.apply(null, defineCache[id]);
  238. return loaderCache[id];
  239. }
  240. };
  241. define.amd = {};
  242. return define;
  243. })(null, function (id) { throw new Error("Dependency not found: " + id); }), requirejs = define.require;
  244. define("amber_vm/browser-compatibility", [], {});
  245. define("amber/browser-compatibility", [], {});
  246. /* ====================================================================
  247. |
  248. | Amber Smalltalk
  249. | http://amber-lang.net
  250. |
  251. ======================================================================
  252. ======================================================================
  253. |
  254. | Copyright (c) 2010-2014
  255. | Nicolas Petton <petton.nicolas@gmail.com>
  256. |
  257. | Copyright (c) 2012-2014
  258. | The Amber team https://github.com/amber-smalltalk?tab=members
  259. | Amber contributors https://github.com/amber-smalltalk/amber/graphs/contributors
  260. |
  261. | Amber is released under the MIT license
  262. |
  263. | Permission is hereby granted, free of charge, to any person obtaining
  264. | a copy of this software and associated documentation files (the
  265. | 'Software'), to deal in the Software without restriction, including
  266. | without limitation the rights to use, copy, modify, merge, publish,
  267. | distribute, sublicense, and/or sell copies of the Software, and to
  268. | permit persons to whom the Software is furnished to do so, subject to
  269. | the following conditions:
  270. |
  271. | The above copyright notice and this permission notice shall be
  272. | included in all copies or substantial portions of the Software.
  273. |
  274. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  275. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  276. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  277. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  278. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  279. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  280. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  281. |
  282. ==================================================================== */
  283. define("amber/boot", [ 'require', './browser-compatibility' ], function (require) {
  284. /* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
  285. function Brikz(api, apiKey, initKey) {
  286. var brikz = this, backup = {};
  287. apiKey = apiKey || 'exports';
  288. initKey = initKey || '__init__';
  289. function mixin(src, target, what) {
  290. for (var keys = Object.keys(what||src), l=keys.length, i=0; i<l; ++i) {
  291. if (src == null) { target[keys[i]] = undefined; } else {
  292. var value = src[keys[i]];
  293. if (typeof value !== "undefined") { target[keys[i]] = value; }
  294. }
  295. }
  296. return target;
  297. }
  298. var d={value: null, enumerable: false, configurable: true, writable: true};
  299. Object.defineProperties(this, { ensure: d, rebuild: d });
  300. var exclude = mixin(this, {});
  301. this.rebuild = function () {
  302. Object.keys(backup).forEach(function (key) {
  303. mixin(null, api, (backup[key]||0)[apiKey]||{});
  304. });
  305. var oapi = mixin(api, {}), order = [], chk = {};
  306. brikz.ensure = function(key) {
  307. if (key in exclude) { return null; }
  308. var b = brikz[key], bak = backup[key];
  309. mixin(null, api, api);
  310. while (typeof b === "function") { b = new b(brikz, api, bak); }
  311. if (b && !chk[key]) { chk[key]=true; order.push(b); }
  312. if (b && !b[apiKey]) { b[apiKey] = mixin(api, {}); }
  313. return brikz[key] = b;
  314. };
  315. Object.keys(brikz).forEach(function (key) { brikz.ensure(key); });
  316. brikz.ensure = null;
  317. mixin(oapi, mixin(null, api, api));
  318. order.forEach(function(brik) { mixin(brik[apiKey] || {}, api); });
  319. order.forEach(function(brik) { brik[initKey] && brik[initKey](); });
  320. backup = mixin(brikz, {});
  321. };
  322. }
  323. /* Brikz end */
  324. function inherits(child, parent) {
  325. child.prototype = Object.create(parent.prototype, {
  326. constructor: { value: child,
  327. enumerable: false, configurable: true, writable: true }
  328. });
  329. return child;
  330. }
  331. var globals = {};
  332. globals.SmalltalkSettings = {};
  333. var api = Object.create(globals);
  334. var brikz = new Brikz(api);
  335. function RootBrik(brikz, st) {
  336. /* Smalltalk foundational objects */
  337. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  338. All objects including `Object` inherit from SmalltalkRoot */
  339. function SmalltalkRoot() {}
  340. function SmalltalkProtoObject() {}
  341. inherits(SmalltalkProtoObject, SmalltalkRoot);
  342. function SmalltalkObject() {}
  343. inherits(SmalltalkObject, SmalltalkProtoObject);
  344. function SmalltalkNil() {}
  345. inherits(SmalltalkNil, SmalltalkObject);
  346. this.Object = SmalltalkObject;
  347. this.nil = new SmalltalkNil();
  348. // Adds an `isNil` property to the `nil` object. When sending
  349. // nil objects from one environment to another, doing
  350. // `anObject == nil` (in JavaScript) does not always answer
  351. // true as the referenced nil object might come from the other
  352. // environment.
  353. Object.defineProperty(this.nil, 'isNil', {
  354. value: true,
  355. enumerable: false, configurable: false, writable: false
  356. });
  357. // Hidden root class of the system.
  358. this.rootAsClass = {fn: SmalltalkRoot};
  359. this.__init__ = function () {
  360. st.addPackage("Kernel-Objects");
  361. st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
  362. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
  363. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
  364. };
  365. }
  366. function OrganizeBrik(brikz, st) {
  367. brikz.ensure("augments");
  368. var SmalltalkObject = brikz.ensure("root").Object;
  369. function SmalltalkOrganizer () {}
  370. function SmalltalkPackageOrganizer () {
  371. this.elements = [];
  372. }
  373. function SmalltalkClassOrganizer () {
  374. this.elements = [];
  375. }
  376. inherits(SmalltalkOrganizer, SmalltalkObject);
  377. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  378. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  379. this.__init__ = function () {
  380. st.addPackage("Kernel-Infrastructure");
  381. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
  382. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
  383. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
  384. };
  385. this.setupClassOrganization = function (klass) {
  386. klass.organization = new SmalltalkClassOrganizer();
  387. klass.organization.theClass = klass;
  388. };
  389. this.setupPackageOrganization = function (pkg) {
  390. pkg.organization = new SmalltalkPackageOrganizer();
  391. };
  392. this.addOrganizationElement = function (owner, element) {
  393. owner.organization.elements.addElement(element);
  394. };
  395. this.removeOrganizationElement = function (owner, element) {
  396. owner.organization.elements.removeElement(element);
  397. };
  398. }
  399. function DNUBrik(brikz, st) {
  400. brikz.ensure("selectorConversion");
  401. brikz.ensure("messageSend");
  402. var manip = brikz.ensure("manipulation");
  403. var rootAsClass = brikz.ensure("root").rootAsClass;
  404. /* Method not implemented handlers */
  405. var methods = [], checker = Object.create(null);
  406. this.selectors = [];
  407. this.get = function (stSelector) {
  408. var index = this.selectors.indexOf(stSelector);
  409. if(index !== -1) {
  410. return methods[index];
  411. }
  412. this.selectors.push(stSelector);
  413. var jsSelector = st.selector(stSelector);
  414. checker[jsSelector] = true;
  415. var method = {jsSelector: jsSelector, fn: createHandler(stSelector)};
  416. methods.push(method);
  417. manip.installMethod(method, rootAsClass);
  418. return method;
  419. };
  420. this.isSelector = function (jsSelector) {
  421. return checker[jsSelector];
  422. };
  423. /* Dnu handler method */
  424. function createHandler(stSelector) {
  425. return function() {
  426. return brikz.messageSend.messageNotUnderstood(this, stSelector, arguments);
  427. };
  428. }
  429. this.installHandlers = function (klass) {
  430. for(var i=0; i<methods.length; i++) {
  431. manip.installMethodIfAbsent(methods[i], klass);
  432. }
  433. };
  434. }
  435. function ClassInitBrik(brikz, st) {
  436. var dnu = brikz.ensure("dnu");
  437. var manip = brikz.ensure("manipulation");
  438. var nil = brikz.ensure("root").nil;
  439. /* Initialize a class in its class hierarchy. Handle both classes and
  440. metaclasses. */
  441. st.init = function(klass) {
  442. st.initClass(klass);
  443. if(klass.klass && !klass.meta) {
  444. st.initClass(klass.klass);
  445. }
  446. };
  447. st.initClass = function(klass) {
  448. if(klass.wrapped) {
  449. copySuperclass(klass);
  450. dnu.installHandlers(klass);
  451. }
  452. };
  453. function copySuperclass(klass, superclass) {
  454. var inheritedMethods = Object.create(null);
  455. deinstallAllMethods(klass);
  456. for (superclass = superclass || klass.superclass;
  457. superclass && superclass !== nil;
  458. superclass = superclass.superclass) {
  459. for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
  460. inheritMethodIfAbsent(superclass.methods[keys[i]]);
  461. }
  462. }
  463. manip.reinstallMethods(klass);
  464. function inheritMethodIfAbsent(method) {
  465. var selector = method.selector;
  466. //TODO: prepare klass methods into inheritedMethods to only test once
  467. if(klass.methods[selector] || inheritedMethods[selector]) {
  468. return;
  469. }
  470. manip.installMethod(method, klass);
  471. inheritedMethods[method.selector] = true;
  472. }
  473. }
  474. function deinstallAllMethods(klass) {
  475. var proto = klass.fn.prototype;
  476. for(var keys = Object.getOwnPropertyNames(proto), i=0; i<keys.length; i++) {
  477. var key = keys[i];
  478. if (dnu.isSelector(key)) {
  479. proto[key] = null;
  480. }
  481. }
  482. }
  483. }
  484. function ManipulationBrik(brikz, st) {
  485. this.installMethodIfAbsent = function (handler, klass) {
  486. if(!klass.fn.prototype[handler.jsSelector]) {
  487. installMethod(handler, klass);
  488. }
  489. };
  490. function installMethod (method, klass) {
  491. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  492. value: method.fn,
  493. enumerable: false, configurable: true, writable: true
  494. });
  495. }
  496. this.installMethod = installMethod;
  497. this.reinstallMethods = function (klass) {
  498. var methods = klass.methods;
  499. for(var keys = Object.keys(methods), i=0; i<keys.length; i++) {
  500. installMethod(methods[keys[i]], klass);
  501. }
  502. };
  503. }
  504. function ClassesBrik(brikz, st) {
  505. var org = brikz.ensure("organize");
  506. var root = brikz.ensure("root");
  507. brikz.ensure("classInit");
  508. var nil = root.nil;
  509. var rootAsClass = root.rootAsClass;
  510. var SmalltalkObject = root.Object;
  511. rootAsClass.klass = {fn: SmalltalkClass};
  512. function SmalltalkPackage() {}
  513. function SmalltalkBehavior() {}
  514. function SmalltalkClass() {}
  515. function SmalltalkMetaclass() {}
  516. inherits(SmalltalkPackage, SmalltalkObject);
  517. inherits(SmalltalkBehavior, SmalltalkObject);
  518. inherits(SmalltalkClass, SmalltalkBehavior);
  519. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  520. SmalltalkMetaclass.prototype.meta = true;
  521. this.__init__ = function () {
  522. st.addPackage("Kernel-Classes");
  523. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
  524. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
  525. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
  526. // Manually bootstrap the metaclass hierarchy
  527. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  528. addSubclass(globals.ProtoObject.klass);
  529. st.addPackage("Kernel-Infrastructure");
  530. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
  531. };
  532. /* Smalltalk classes */
  533. var classes = [];
  534. var wrappedClasses = [];
  535. /* We hold all Packages in a separate Object */
  536. st.packages = {};
  537. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  538. function pkg(spec) {
  539. var that = new SmalltalkPackage();
  540. that.pkgName = spec.pkgName;
  541. org.setupPackageOrganization(that);
  542. that.properties = spec.properties || {};
  543. return that;
  544. }
  545. /* Smalltalk class creation. A class is an instance of an automatically
  546. created metaclass object. Newly created classes (not their metaclass)
  547. should be added to the smalltalk object, see smalltalk.addClass().
  548. Superclass linking is *not* handled here, see smalltalk.init() */
  549. function klass(spec) {
  550. spec = spec || {};
  551. var setSuperClass = spec.superclass;
  552. if(!spec.superclass) {
  553. spec.superclass = rootAsClass;
  554. }
  555. var meta = metaclass(spec);
  556. var that = meta.instanceClass;
  557. that.superclass = setSuperClass;
  558. that.fn = spec.fn || inherits(function () {}, spec.superclass.fn);
  559. that.subclasses = [];
  560. setupClass(that, spec);
  561. that.className = spec.className;
  562. that.wrapped = spec.wrapped || false;
  563. meta.className = spec.className + ' class';
  564. meta.superclass = spec.superclass.klass;
  565. return that;
  566. }
  567. function metaclass(spec) {
  568. spec = spec || {};
  569. var that = new SmalltalkMetaclass();
  570. that.fn = inherits(function () {}, spec.superclass.klass.fn);
  571. that.instanceClass = new that.fn();
  572. setupClass(that);
  573. return that;
  574. }
  575. SmalltalkBehavior.prototype.toString = function () {
  576. return 'Smalltalk ' + this.className;
  577. };
  578. function wireKlass(klass) {
  579. Object.defineProperty(klass.fn.prototype, "klass", {
  580. value: klass,
  581. enumerable: false, configurable: true, writable: true
  582. });
  583. }
  584. function setupClass(klass, spec) {
  585. spec = spec || {};
  586. klass.iVarNames = spec.iVarNames || [];
  587. klass.pkg = spec.pkg;
  588. org.setupClassOrganization(klass);
  589. Object.defineProperty(klass, "methods", {
  590. value: Object.create(null),
  591. enumerable: false, configurable: true, writable: true
  592. });
  593. wireKlass(klass);
  594. }
  595. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  596. If pkgName is null or empty we return nil, which is an allowed package for a class.
  597. If package already exists we still update the properties of it. */
  598. st.addPackage = function(pkgName, properties) {
  599. if(!pkgName) {return nil;}
  600. if(!(st.packages[pkgName])) {
  601. st.packages[pkgName] = pkg({
  602. pkgName: pkgName,
  603. properties: properties
  604. });
  605. } else {
  606. if(properties) {
  607. st.packages[pkgName].properties = properties;
  608. }
  609. }
  610. return st.packages[pkgName];
  611. };
  612. /* Add a class to the smalltalk object, creating a new one if needed.
  613. A Package is lazily created if it does not exist with given name. */
  614. st.addClass = function(className, superclass, iVarNames, pkgName) {
  615. // While subclassing nil is allowed, it might be an error, so
  616. // warn about it.
  617. if (typeof superclass == 'undefined' || superclass == nil) {
  618. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  619. }
  620. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  621. };
  622. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  623. var pkg = st.packages[pkgName];
  624. if (!pkg) {
  625. throw new Error("Missing package "+pkgName);
  626. }
  627. if (!superclass || superclass == nil) { superclass = null; }
  628. if(globals[className] && globals[className].superclass == superclass) {
  629. // globals[className].superclass = superclass;
  630. globals[className].iVarNames = iVarNames || [];
  631. if (pkg) globals[className].pkg = pkg;
  632. if (fn) {
  633. fn.prototype = globals[className].fn.prototype;
  634. globals[className].fn = fn;
  635. fn.prototype.constructor = fn;
  636. }
  637. } else {
  638. if(globals[className]) {
  639. st.removeClass(globals[className]);
  640. }
  641. globals[className] = klass({
  642. className: className,
  643. superclass: superclass,
  644. pkg: pkg,
  645. iVarNames: iVarNames,
  646. fn: fn,
  647. wrapped: wrapped
  648. });
  649. addSubclass(globals[className]);
  650. }
  651. classes.addElement(globals[className]);
  652. org.addOrganizationElement(pkg, globals[className]);
  653. }
  654. st.removeClass = function(klass) {
  655. org.removeOrganizationElement(klass.pkg, klass);
  656. classes.removeElement(klass);
  657. removeSubclass(klass);
  658. delete globals[klass.className];
  659. };
  660. function addSubclass(klass) {
  661. if(klass.superclass) {
  662. klass.superclass.subclasses.addElement(klass);
  663. }
  664. }
  665. function removeSubclass(klass) {
  666. if(klass.superclass) {
  667. klass.superclass.subclasses.removeElement(klass);
  668. }
  669. }
  670. /* Create a new class wrapping a JavaScript constructor, and add it to the
  671. global smalltalk object. Package is lazily created if it does not exist with given name. */
  672. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  673. wrapped = wrapped !== false;
  674. rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
  675. if(wrapped) {
  676. wrappedClasses.addElement(globals[className]);
  677. }
  678. };
  679. /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
  680. st.setClassConstructor = function(klass, constructor) {
  681. wrappedClasses.addElement(klass);
  682. klass.wrapped = true;
  683. klass.fn = constructor;
  684. // The fn property changed. We need to add back the klass property to the prototype
  685. wireKlass(klass);
  686. st.initClass(klass);
  687. };
  688. /* Create an alias for an existing class */
  689. st.alias = function(klass, alias) {
  690. globals[alias] = klass;
  691. };
  692. /* Answer all registered Smalltalk classes */
  693. //TODO: remove the function and make smalltalk.classes an array
  694. st.classes = function() {
  695. return classes;
  696. };
  697. st.wrappedClasses = function() {
  698. return wrappedClasses;
  699. };
  700. // Still used, but could go away now that subclasses are stored
  701. // into classes directly.
  702. st.allSubclasses = function(klass) {
  703. return klass._allSubclasses();
  704. };
  705. }
  706. function MethodsBrik(brikz, st) {
  707. var manip = brikz.ensure("manipulation");
  708. var org = brikz.ensure("organize");
  709. var stInit = brikz.ensure("stInit");
  710. var dnu = brikz.ensure("dnu");
  711. var SmalltalkObject = brikz.ensure("root").Object;
  712. brikz.ensure("selectorConversion");
  713. brikz.ensure("classes");
  714. brikz.ensure("classInit");
  715. function SmalltalkMethod() {}
  716. inherits(SmalltalkMethod, SmalltalkObject);
  717. this.__init__ = function () {
  718. st.addPackage("Kernel-Methods");
  719. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
  720. };
  721. /* Smalltalk method object. To add a method to a class,
  722. use smalltalk.addMethod() */
  723. st.method = function(spec) {
  724. var that = new SmalltalkMethod();
  725. that.selector = spec.selector;
  726. that.jsSelector = spec.jsSelector;
  727. that.args = spec.args || {};
  728. // spec.category is kept for compatibility
  729. that.protocol = spec.protocol || spec.category;
  730. that.source = spec.source;
  731. that.messageSends = spec.messageSends || [];
  732. that.referencedClasses = spec.referencedClasses || [];
  733. that.fn = spec.fn;
  734. return that;
  735. };
  736. function installNewDnuHandler(newHandler) {
  737. var wrappedClasses = st.wrappedClasses();
  738. for(var i = 0; i < wrappedClasses.length; i++) {
  739. manip.installMethodIfAbsent(newHandler, wrappedClasses[i]);
  740. }
  741. }
  742. /* Add/remove a method to/from a class */
  743. st.addMethod = function (method, klass) {
  744. if (!(method.jsSelector)) {
  745. method.jsSelector = st.selector(method.selector);
  746. }
  747. manip.installMethod(method, klass);
  748. klass.methods[method.selector] = method;
  749. method.methodClass = klass;
  750. // During the bootstrap, #addCompiledMethod is not used.
  751. // Therefore we populate the organizer here too
  752. org.addOrganizationElement(klass, method.protocol);
  753. propagateMethodChange(klass);
  754. var usedSelectors = method.messageSends;
  755. var dnuHandlers = [];
  756. dnuHandlers.push(dnu.get(method.selector));
  757. for(var i=0; i<usedSelectors.length; i++) {
  758. dnuHandlers.push(dnu.get(usedSelectors[i]));
  759. }
  760. if(stInit.initialized()) {
  761. dnuHandlers.forEach(function(each) {
  762. installNewDnuHandler(each);
  763. });
  764. }
  765. };
  766. function propagateMethodChange(klass) {
  767. // If already initialized (else it will be done later anyway),
  768. // re-initialize all subclasses to ensure the method change
  769. // propagation (for wrapped classes, not using the prototype
  770. // chain).
  771. //TODO: optimize, only one method need to be updated, not all of them
  772. if (stInit.initialized()) {
  773. st.allSubclasses(klass).forEach(function (subclass) {
  774. st.initClass(subclass);
  775. });
  776. }
  777. }
  778. st.removeMethod = function(method, klass) {
  779. if (klass !== method.methodClass) {
  780. throw new Error(
  781. "Refusing to remove method "
  782. + method.methodClass.className+">>"+method.selector
  783. + " from different class "
  784. + klass.className);
  785. }
  786. delete klass.fn.prototype[st.selector(method.selector)];
  787. delete klass.methods[method.selector];
  788. st.initClass(klass);
  789. propagateMethodChange(klass);
  790. // Do *not* delete protocols from here.
  791. // This is handled by #removeCompiledMethod
  792. };
  793. /* Answer all method selectors based on dnu handlers */
  794. st.allSelectors = function() {
  795. return dnu.selectors;
  796. };
  797. }
  798. function AugmentsBrik(brikz, st) {
  799. /* Array extensions */
  800. Array.prototype.addElement = function(el) {
  801. if(typeof el === 'undefined') { return; }
  802. if(this.indexOf(el) == -1) {
  803. this.push(el);
  804. }
  805. };
  806. Array.prototype.removeElement = function(el) {
  807. var i = this.indexOf(el);
  808. if (i !== -1) { this.splice(i, 1); }
  809. };
  810. }
  811. function SmalltalkInitBrik(brikz, st) {
  812. brikz.ensure("classInit");
  813. brikz.ensure("classes");
  814. var nil = brikz.ensure("root").nil;
  815. var initialized = false;
  816. /* Smalltalk initialization. Called on page load */
  817. st.initialize = function() {
  818. if(initialized) { return; }
  819. st.classes().forEach(function(klass) {
  820. st.init(klass);
  821. });
  822. runnable();
  823. st.classes().forEach(function(klass) {
  824. klass._initialize();
  825. });
  826. initialized = true;
  827. };
  828. this.initialized = function () {
  829. return initialized;
  830. };
  831. this.__init__ = function () {
  832. st.addPackage("Kernel-Methods");
  833. st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
  834. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
  835. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
  836. st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
  837. st.addPackage("Kernel-Collections");
  838. st.addClass("Collection", globals.Object, null, "Kernel-Collections");
  839. st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
  840. st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
  841. st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
  842. st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
  843. st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
  844. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
  845. st.addPackage("Kernel-Exceptions");
  846. st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
  847. /* Alias definitions */
  848. st.alias(globals.Array, "OrderedCollection");
  849. st.alias(globals.Date, "Time");
  850. };
  851. }
  852. function PrimitivesBrik(brikz, st) {
  853. /* Unique ID number generator */
  854. var oid = 0;
  855. st.nextId = function() {
  856. oid += 1;
  857. return oid;
  858. };
  859. /* Converts a JavaScript object to valid Smalltalk Object */
  860. st.readJSObject = function(js) {
  861. var readObject = js.constructor === Object;
  862. var readArray = js.constructor === Array;
  863. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  864. for(var i in js) {
  865. if(readObject) {
  866. object._at_put_(i, st.readJSObject(js[i]));
  867. }
  868. if(readArray) {
  869. object[i] = st.readJSObject(js[i]);
  870. }
  871. }
  872. return object;
  873. };
  874. /* Boolean assertion */
  875. st.assert = function(shouldBeBoolean) {
  876. if (undefined !== shouldBeBoolean && shouldBeBoolean.klass === globals.Boolean) {
  877. return shouldBeBoolean == true;
  878. } else {
  879. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  880. }
  881. };
  882. /* List of all reserved words in JavaScript. They may not be used as variables
  883. in Smalltalk. */
  884. // list of reserved JavaScript keywords as of
  885. // http://es5.github.com/#x7.6.1.1
  886. // and
  887. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  888. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  889. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  890. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  891. 'try', 'typeof', 'var', 'void', 'while', 'with',
  892. // ES5: future use: http://es5.github.com/#x7.6.1.2
  893. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  894. // ES5: future use in strict mode
  895. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  896. 'public', 'static', 'yield'];
  897. st.globalJsVariables = ['jQuery', 'window', 'document', 'process', 'global'];
  898. }
  899. function RuntimeBrik(brikz, st) {
  900. brikz.ensure("selectorConversion");
  901. var root = brikz.ensure("root");
  902. var nil = root.nil;
  903. var SmalltalkObject = root.Object;
  904. function SmalltalkMethodContext(home, setup) {
  905. this.sendIdx = {};
  906. this.homeContext = home;
  907. this.setup = setup || function() {};
  908. this.supercall = false;
  909. }
  910. inherits(SmalltalkMethodContext, SmalltalkObject);
  911. this.__init__ = function () {
  912. st.addPackage("Kernel-Methods");
  913. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  914. // Fallbacks
  915. SmalltalkMethodContext.prototype.locals = {};
  916. SmalltalkMethodContext.prototype.receiver = null;
  917. SmalltalkMethodContext.prototype.selector = null;
  918. SmalltalkMethodContext.prototype.lookupClass = null;
  919. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  920. this.receiver = receiver;
  921. this.selector = selector;
  922. this.locals = locals || {};
  923. this.lookupClass = lookupClass;
  924. if(this.homeContext) {
  925. this.homeContext.evaluatedSelector = selector;
  926. }
  927. };
  928. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx, index) {
  929. this.locals = locals || {};
  930. this.outerContext = ctx;
  931. this.index = index || 0;
  932. };
  933. SmalltalkMethodContext.prototype.init = function() {
  934. var home = this.homeContext;
  935. if(home) {
  936. home.init();
  937. }
  938. this.setup(this);
  939. };
  940. SmalltalkMethodContext.prototype.method = function() {
  941. var method;
  942. var lookup = this.lookupClass || this.receiver.klass;
  943. while(!method && lookup) {
  944. method = lookup.methods[st.convertSelector(this.selector)];
  945. lookup = lookup.superclass;
  946. }
  947. return method;
  948. };
  949. };
  950. /* This is the current call context object. While it is publicly available,
  951. Use smalltalk.getThisContext() instead which will answer a safe copy of
  952. the current context */
  953. st.thisContext = undefined;
  954. st.withContext = function(worker, setup) {
  955. if(st.thisContext) {
  956. return inContext(worker, setup);
  957. } else {
  958. try {
  959. return inContext(worker, setup);
  960. } catch(error) {
  961. handleError(error);
  962. st.thisContext = null;
  963. // Rethrow the error in any case.
  964. error.amberHandled = true;
  965. throw error;
  966. }
  967. }
  968. };
  969. function inContext(worker, setup) {
  970. var context = pushContext(setup);
  971. var result = worker(context);
  972. popContext(context);
  973. return result;
  974. }
  975. /* Wrap a JavaScript exception in a Smalltalk Exception.
  976. In case of a RangeError, stub the stack after 100 contexts to
  977. avoid another RangeError later when the stack is manipulated. */
  978. function wrappedError(error) {
  979. var errorWrapper = globals.JavaScriptException._on_(error);
  980. // Add the error to the context, so it is visible in the stack
  981. try { errorWrapper._signal(); } catch (ex) {}
  982. var context = st.getThisContext();
  983. if(isRangeError(error)) {
  984. stubContextStack(context);
  985. }
  986. errorWrapper._context_(context);
  987. return errorWrapper;
  988. }
  989. /* Stub the context stack after 100 contexts */
  990. function stubContextStack(context) {
  991. var currentContext = context;
  992. var contexts = 0;
  993. while(contexts < 100) {
  994. if(currentContext) {
  995. currentContext = currentContext.homeContext;
  996. }
  997. contexts++;
  998. }
  999. if(currentContext) {
  1000. currentContext.homeContext = undefined;
  1001. }
  1002. }
  1003. function isRangeError(error) {
  1004. return error instanceof RangeError;
  1005. }
  1006. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  1007. (See the Smalltalk class ErrorHandler and its subclasses */
  1008. function handleError(error) {
  1009. if (!error.smalltalkError) {
  1010. error = wrappedError(error);
  1011. }
  1012. globals.ErrorHandler._handleError_(error);
  1013. }
  1014. /* Handle thisContext pseudo variable */
  1015. st.getThisContext = function() {
  1016. if(st.thisContext) {
  1017. st.thisContext.init();
  1018. return st.thisContext;
  1019. } else {
  1020. return nil;
  1021. }
  1022. };
  1023. function pushContext(setup) {
  1024. return st.thisContext = new SmalltalkMethodContext(st.thisContext, setup);
  1025. }
  1026. function popContext(context) {
  1027. st.thisContext = context.homeContext;
  1028. }
  1029. }
  1030. function MessageSendBrik(brikz, st) {
  1031. brikz.ensure("selectorConversion");
  1032. var nil = brikz.ensure("root").nil;
  1033. /* Handles unhandled errors during message sends */
  1034. // simply send the message and handle #dnu:
  1035. st.send = function(receiver, jsSelector, args, klass) {
  1036. var method;
  1037. if(receiver === null) {
  1038. receiver = nil;
  1039. }
  1040. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  1041. if(method) {
  1042. return method.apply(receiver, args);
  1043. } else {
  1044. return messageNotUnderstood(receiver, st.convertSelector(jsSelector), args);
  1045. }
  1046. };
  1047. function invokeDnuMethod(receiver, stSelector, args) {
  1048. return receiver._doesNotUnderstand_(
  1049. globals.Message._new()
  1050. ._selector_(stSelector)
  1051. ._arguments_([].slice.call(args))
  1052. );
  1053. }
  1054. /* Handles #dnu: *and* JavaScript method calls.
  1055. if the receiver has no klass, we consider it a JS object (outside of the
  1056. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  1057. function messageNotUnderstood(receiver, stSelector, args) {
  1058. if (receiver.klass !== undefined && !receiver.allowJavaScriptCalls) {
  1059. return invokeDnuMethod(receiver, stSelector, args);
  1060. }
  1061. /* Call a method of a JS object, or answer a property if it exists.
  1062. Else try wrapping a JSObjectProxy around the receiver. */
  1063. var propertyName = st.st2prop(stSelector);
  1064. if (!(propertyName in receiver)) {
  1065. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  1066. }
  1067. return accessJavaScript(receiver, propertyName, args);
  1068. }
  1069. /* If the object property is a function, then call it, except if it starts with
  1070. an uppercase character (we probably want to answer the function itself in this
  1071. case and send it #new from Amber).
  1072. Converts keyword-based selectors by using the first
  1073. keyword only, but keeping all message arguments.
  1074. Example:
  1075. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  1076. function accessJavaScript(receiver, propertyName, args) {
  1077. var propertyValue = receiver[propertyName];
  1078. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1079. return propertyValue.apply(receiver, args);
  1080. } else if (args.length > 0) {
  1081. receiver[propertyName] = args[0];
  1082. return nil;
  1083. } else {
  1084. return propertyValue;
  1085. }
  1086. }
  1087. st.accessJavaScript = accessJavaScript;
  1088. this.messageNotUnderstood = messageNotUnderstood;
  1089. }
  1090. function SelectorConversionBrik(brikz, st) {
  1091. /* Convert a Smalltalk selector into a JS selector */
  1092. st.st2js = function(string) {
  1093. var selector = '_' + string;
  1094. selector = selector.replace(/:/g, '_');
  1095. selector = selector.replace(/[\&]/g, '_and');
  1096. selector = selector.replace(/[\|]/g, '_or');
  1097. selector = selector.replace(/[+]/g, '_plus');
  1098. selector = selector.replace(/-/g, '_minus');
  1099. selector = selector.replace(/[*]/g ,'_star');
  1100. selector = selector.replace(/[\/]/g ,'_slash');
  1101. selector = selector.replace(/[\\]/g ,'_backslash');
  1102. selector = selector.replace(/[\~]/g ,'_tild');
  1103. selector = selector.replace(/>/g ,'_gt');
  1104. selector = selector.replace(/</g ,'_lt');
  1105. selector = selector.replace(/=/g ,'_eq');
  1106. selector = selector.replace(/,/g ,'_comma');
  1107. selector = selector.replace(/[@]/g ,'_at');
  1108. return selector;
  1109. };
  1110. /* Convert a string to a valid smalltalk selector.
  1111. if you modify the following functions, also change st2js
  1112. accordingly */
  1113. st.js2st = function(selector) {
  1114. if(selector.match(/__/)) {
  1115. return binaryJsToSt(selector);
  1116. } else {
  1117. return keywordJsToSt(selector);
  1118. }
  1119. };
  1120. function keywordJsToSt(selector) {
  1121. return selector.replace(/^_/, '').replace(/_/g, ':');
  1122. }
  1123. function binaryJsToSt(selector) {
  1124. return selector
  1125. .replace(/^_/, '')
  1126. .replace(/_and/g, '&')
  1127. .replace(/_or/g, '|')
  1128. .replace(/_plus/g, '+')
  1129. .replace(/_minus/g, '-')
  1130. .replace(/_star/g, '*')
  1131. .replace(/_slash/g, '/')
  1132. .replace(/_backslash/g, '\\')
  1133. .replace(/_tild/g, '~')
  1134. .replace(/_gt/g, '>')
  1135. .replace(/_lt/g, '<')
  1136. .replace(/_eq/g, '=')
  1137. .replace(/_comma/g, ',')
  1138. .replace(/_at/g, '@');
  1139. }
  1140. st.st2prop = function (stSelector) {
  1141. var colonPosition = stSelector.indexOf(':');
  1142. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1143. };
  1144. // Backward-compatible names, deprecated.
  1145. st.selector = st.st2js;
  1146. st.convertSelector = st.js2st;
  1147. }
  1148. /* Adds AMD and requirejs related methods to the smalltalk object */
  1149. function AMDBrik(brikz, st) {
  1150. this.__init__ = function () {
  1151. st.amdRequire = require;
  1152. st.defaultTransportType = st.defaultTransportType || "amd";
  1153. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1154. };
  1155. }
  1156. /* Defines asReceiver to be present at load time */
  1157. /* (logically it belongs more to PrimitiveBrik) */
  1158. function AsReceiverBrik(brikz, st) {
  1159. var nil = brikz.ensure("root").nil;
  1160. /**
  1161. * This function is used all over the compiled amber code.
  1162. * It takes any value (JavaScript or Smalltalk)
  1163. * and returns a proper Amber Smalltalk receiver.
  1164. *
  1165. * null or undefined -> nil,
  1166. * plain JS object -> wrapped JS object,
  1167. * otherwise unchanged
  1168. */
  1169. this.asReceiver = function (o) {
  1170. if (o == null) { return nil; }
  1171. if (o.klass) { return o; }
  1172. return globals.JSObjectProxy._on_(o);
  1173. };
  1174. }
  1175. /* Making smalltalk that can load */
  1176. brikz.root = RootBrik;
  1177. brikz.dnu = DNUBrik;
  1178. brikz.organize = OrganizeBrik;
  1179. brikz.selectorConversion = SelectorConversionBrik;
  1180. brikz.classInit = ClassInitBrik;
  1181. brikz.manipulation = ManipulationBrik;
  1182. brikz.classes = ClassesBrik;
  1183. brikz.methods = MethodsBrik;
  1184. brikz.stInit = SmalltalkInitBrik;
  1185. brikz.augments = AugmentsBrik;
  1186. brikz.asReceiver = AsReceiverBrik;
  1187. brikz.amd = AMDBrik;
  1188. brikz.rebuild();
  1189. /* Making smalltalk that can run */
  1190. function runnable () {
  1191. brikz.messageSend = MessageSendBrik;
  1192. brikz.runtime = RuntimeBrik;
  1193. brikz.primitives = PrimitivesBrik;
  1194. brikz.rebuild();
  1195. };
  1196. return { vm: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiver.asReceiver };
  1197. });
  1198. define("amber_vm/smalltalk", ["./boot"], function (boot) {
  1199. return boot.vm;
  1200. });
  1201. define("amber_vm/globals", ["./boot"], function (boot) {
  1202. return boot.globals;
  1203. });
  1204. define("amber_vm/nil", ["./boot"], function (boot) {
  1205. return boot.nil;
  1206. });
  1207. define("amber_vm/_st", ["./boot"], function (boot) {
  1208. return boot.asReceiver;
  1209. });
  1210. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){
  1211. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  1212. smalltalk.addPackage('Kernel-Objects');
  1213. smalltalk.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1214. smalltalk.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1215. //>>excludeStart("ide", pragmas.excludeIdeData);
  1216. globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
  1217. //>>excludeEnd("ide");
  1218. smalltalk.addMethod(
  1219. smalltalk.method({
  1220. selector: "=",
  1221. protocol: 'comparing',
  1222. fn: function (anObject){
  1223. var self=this;
  1224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1225. return smalltalk.withContext(function($ctx1) {
  1226. //>>excludeEnd("ctx");
  1227. var $1;
  1228. $1=self.__eq_eq(anObject);
  1229. return $1;
  1230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1231. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.ProtoObject)});
  1232. //>>excludeEnd("ctx");
  1233. },
  1234. //>>excludeStart("ide", pragmas.excludeIdeData);
  1235. args: ["anObject"],
  1236. source: "= anObject\x0a\x09^ self == anObject",
  1237. referencedClasses: [],
  1238. //>>excludeEnd("ide");
  1239. messageSends: ["=="]
  1240. }),
  1241. globals.ProtoObject);
  1242. smalltalk.addMethod(
  1243. smalltalk.method({
  1244. selector: "==",
  1245. protocol: 'comparing',
  1246. fn: function (anObject){
  1247. var self=this;
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. return smalltalk.withContext(function($ctx1) {
  1250. //>>excludeEnd("ctx");
  1251. var $2,$1;
  1252. $2=self._identityHash();
  1253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1254. $ctx1.sendIdx["identityHash"]=1;
  1255. //>>excludeEnd("ctx");
  1256. $1=_st($2).__eq(_st(anObject)._identityHash());
  1257. return $1;
  1258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1259. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},globals.ProtoObject)});
  1260. //>>excludeEnd("ctx");
  1261. },
  1262. //>>excludeStart("ide", pragmas.excludeIdeData);
  1263. args: ["anObject"],
  1264. source: "== anObject\x0a\x09^ self identityHash = anObject identityHash",
  1265. referencedClasses: [],
  1266. //>>excludeEnd("ide");
  1267. messageSends: ["=", "identityHash"]
  1268. }),
  1269. globals.ProtoObject);
  1270. smalltalk.addMethod(
  1271. smalltalk.method({
  1272. selector: "asString",
  1273. protocol: 'converting',
  1274. fn: function (){
  1275. var self=this;
  1276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1277. return smalltalk.withContext(function($ctx1) {
  1278. //>>excludeEnd("ctx");
  1279. var $1;
  1280. $1=self._printString();
  1281. return $1;
  1282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1283. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.ProtoObject)});
  1284. //>>excludeEnd("ctx");
  1285. },
  1286. //>>excludeStart("ide", pragmas.excludeIdeData);
  1287. args: [],
  1288. source: "asString\x0a\x09^ self printString",
  1289. referencedClasses: [],
  1290. //>>excludeEnd("ide");
  1291. messageSends: ["printString"]
  1292. }),
  1293. globals.ProtoObject);
  1294. smalltalk.addMethod(
  1295. smalltalk.method({
  1296. selector: "class",
  1297. protocol: 'accessing',
  1298. fn: function (){
  1299. var self=this;
  1300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1301. return smalltalk.withContext(function($ctx1) {
  1302. //>>excludeEnd("ctx");
  1303. return self.klass;
  1304. return self;
  1305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1306. }, function($ctx1) {$ctx1.fill(self,"class",{},globals.ProtoObject)});
  1307. //>>excludeEnd("ctx");
  1308. },
  1309. //>>excludeStart("ide", pragmas.excludeIdeData);
  1310. args: [],
  1311. source: "class\x0a\x09<return self.klass>",
  1312. referencedClasses: [],
  1313. //>>excludeEnd("ide");
  1314. messageSends: []
  1315. }),
  1316. globals.ProtoObject);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "doesNotUnderstand:",
  1320. protocol: 'error handling',
  1321. fn: function (aMessage){
  1322. var self=this;
  1323. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1325. return smalltalk.withContext(function($ctx1) {
  1326. //>>excludeEnd("ctx");
  1327. var $1,$2;
  1328. $1=_st($MessageNotUnderstood())._new();
  1329. _st($1)._receiver_(self);
  1330. _st($1)._message_(aMessage);
  1331. $2=_st($1)._signal();
  1332. return self;
  1333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1334. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.ProtoObject)});
  1335. //>>excludeEnd("ctx");
  1336. },
  1337. //>>excludeStart("ide", pragmas.excludeIdeData);
  1338. args: ["aMessage"],
  1339. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1340. referencedClasses: ["MessageNotUnderstood"],
  1341. //>>excludeEnd("ide");
  1342. messageSends: ["receiver:", "new", "message:", "signal"]
  1343. }),
  1344. globals.ProtoObject);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "evaluate:on:",
  1348. protocol: 'evaluating',
  1349. fn: function (aString,anEvaluator){
  1350. var self=this;
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. return smalltalk.withContext(function($ctx1) {
  1353. //>>excludeEnd("ctx");
  1354. var $1;
  1355. $1=_st(anEvaluator)._evaluate_receiver_(aString,self);
  1356. return $1;
  1357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1358. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},globals.ProtoObject)});
  1359. //>>excludeEnd("ctx");
  1360. },
  1361. //>>excludeStart("ide", pragmas.excludeIdeData);
  1362. args: ["aString", "anEvaluator"],
  1363. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1364. referencedClasses: [],
  1365. //>>excludeEnd("ide");
  1366. messageSends: ["evaluate:receiver:"]
  1367. }),
  1368. globals.ProtoObject);
  1369. smalltalk.addMethod(
  1370. smalltalk.method({
  1371. selector: "identityHash",
  1372. protocol: 'accessing',
  1373. fn: function (){
  1374. var self=this;
  1375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1376. return smalltalk.withContext(function($ctx1) {
  1377. //>>excludeEnd("ctx");
  1378. var hash=self.identityHash;
  1379. if (hash) return hash;
  1380. hash=smalltalk.nextId();
  1381. Object.defineProperty(self, 'identityHash', {value:hash});
  1382. return hash;
  1383. ;
  1384. return self;
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.ProtoObject)});
  1387. //>>excludeEnd("ctx");
  1388. },
  1389. //>>excludeStart("ide", pragmas.excludeIdeData);
  1390. args: [],
  1391. source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=smalltalk.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>",
  1392. referencedClasses: [],
  1393. //>>excludeEnd("ide");
  1394. messageSends: []
  1395. }),
  1396. globals.ProtoObject);
  1397. smalltalk.addMethod(
  1398. smalltalk.method({
  1399. selector: "initialize",
  1400. protocol: 'initialization',
  1401. fn: function (){
  1402. var self=this;
  1403. return self;
  1404. },
  1405. //>>excludeStart("ide", pragmas.excludeIdeData);
  1406. args: [],
  1407. source: "initialize",
  1408. referencedClasses: [],
  1409. //>>excludeEnd("ide");
  1410. messageSends: []
  1411. }),
  1412. globals.ProtoObject);
  1413. smalltalk.addMethod(
  1414. smalltalk.method({
  1415. selector: "inspect",
  1416. protocol: 'inspecting',
  1417. fn: function (){
  1418. var self=this;
  1419. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1421. return smalltalk.withContext(function($ctx1) {
  1422. //>>excludeEnd("ctx");
  1423. _st($Inspector())._inspect_(self);
  1424. return self;
  1425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1426. }, function($ctx1) {$ctx1.fill(self,"inspect",{},globals.ProtoObject)});
  1427. //>>excludeEnd("ctx");
  1428. },
  1429. //>>excludeStart("ide", pragmas.excludeIdeData);
  1430. args: [],
  1431. source: "inspect\x0a\x09Inspector inspect: self",
  1432. referencedClasses: ["Inspector"],
  1433. //>>excludeEnd("ide");
  1434. messageSends: ["inspect:"]
  1435. }),
  1436. globals.ProtoObject);
  1437. smalltalk.addMethod(
  1438. smalltalk.method({
  1439. selector: "inspectOn:",
  1440. protocol: 'inspecting',
  1441. fn: function (anInspector){
  1442. var self=this;
  1443. return self;
  1444. },
  1445. //>>excludeStart("ide", pragmas.excludeIdeData);
  1446. args: ["anInspector"],
  1447. source: "inspectOn: anInspector",
  1448. referencedClasses: [],
  1449. //>>excludeEnd("ide");
  1450. messageSends: []
  1451. }),
  1452. globals.ProtoObject);
  1453. smalltalk.addMethod(
  1454. smalltalk.method({
  1455. selector: "instVarAt:",
  1456. protocol: 'accessing',
  1457. fn: function (aString){
  1458. var self=this;
  1459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1460. return smalltalk.withContext(function($ctx1) {
  1461. //>>excludeEnd("ctx");
  1462. return self['@'+aString] ;
  1463. return self;
  1464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1465. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},globals.ProtoObject)});
  1466. //>>excludeEnd("ctx");
  1467. },
  1468. //>>excludeStart("ide", pragmas.excludeIdeData);
  1469. args: ["aString"],
  1470. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1471. referencedClasses: [],
  1472. //>>excludeEnd("ide");
  1473. messageSends: []
  1474. }),
  1475. globals.ProtoObject);
  1476. smalltalk.addMethod(
  1477. smalltalk.method({
  1478. selector: "instVarAt:put:",
  1479. protocol: 'accessing',
  1480. fn: function (aString,anObject){
  1481. var self=this;
  1482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1483. return smalltalk.withContext(function($ctx1) {
  1484. //>>excludeEnd("ctx");
  1485. self['@' + aString] = anObject ;
  1486. return self;
  1487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1488. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},globals.ProtoObject)});
  1489. //>>excludeEnd("ctx");
  1490. },
  1491. //>>excludeStart("ide", pragmas.excludeIdeData);
  1492. args: ["aString", "anObject"],
  1493. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1494. referencedClasses: [],
  1495. //>>excludeEnd("ide");
  1496. messageSends: []
  1497. }),
  1498. globals.ProtoObject);
  1499. smalltalk.addMethod(
  1500. smalltalk.method({
  1501. selector: "isKindOf:",
  1502. protocol: 'testing',
  1503. fn: function (aClass){
  1504. var self=this;
  1505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1506. return smalltalk.withContext(function($ctx1) {
  1507. //>>excludeEnd("ctx");
  1508. var $2,$1;
  1509. $2=self._isMemberOf_(aClass);
  1510. if(smalltalk.assert($2)){
  1511. $1=true;
  1512. } else {
  1513. $1=_st(self._class())._inheritsFrom_(aClass);
  1514. };
  1515. return $1;
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},globals.ProtoObject)});
  1518. //>>excludeEnd("ctx");
  1519. },
  1520. //>>excludeStart("ide", pragmas.excludeIdeData);
  1521. args: ["aClass"],
  1522. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1523. referencedClasses: [],
  1524. //>>excludeEnd("ide");
  1525. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1526. }),
  1527. globals.ProtoObject);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "perform:",
  1531. protocol: 'message handling',
  1532. fn: function (aString){
  1533. var self=this;
  1534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1535. return smalltalk.withContext(function($ctx1) {
  1536. //>>excludeEnd("ctx");
  1537. var $1;
  1538. $1=self._perform_withArguments_(aString,[]);
  1539. return $1;
  1540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1541. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},globals.ProtoObject)});
  1542. //>>excludeEnd("ctx");
  1543. },
  1544. //>>excludeStart("ide", pragmas.excludeIdeData);
  1545. args: ["aString"],
  1546. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1547. referencedClasses: [],
  1548. //>>excludeEnd("ide");
  1549. messageSends: ["perform:withArguments:"]
  1550. }),
  1551. globals.ProtoObject);
  1552. smalltalk.addMethod(
  1553. smalltalk.method({
  1554. selector: "perform:withArguments:",
  1555. protocol: 'message handling',
  1556. fn: function (aString,aCollection){
  1557. var self=this;
  1558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1559. return smalltalk.withContext(function($ctx1) {
  1560. //>>excludeEnd("ctx");
  1561. return smalltalk.send(self, aString._asJavaScriptMethodName(), aCollection);
  1562. return self;
  1563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1564. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},globals.ProtoObject)});
  1565. //>>excludeEnd("ctx");
  1566. },
  1567. //>>excludeStart("ide", pragmas.excludeIdeData);
  1568. args: ["aString", "aCollection"],
  1569. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asJavaScriptMethodName(), aCollection)>",
  1570. referencedClasses: [],
  1571. //>>excludeEnd("ide");
  1572. messageSends: []
  1573. }),
  1574. globals.ProtoObject);
  1575. smalltalk.addMethod(
  1576. smalltalk.method({
  1577. selector: "printOn:",
  1578. protocol: 'printing',
  1579. fn: function (aStream){
  1580. var self=this;
  1581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1582. return smalltalk.withContext(function($ctx1) {
  1583. //>>excludeEnd("ctx");
  1584. var $5,$4,$3,$2,$1;
  1585. $5=self._class();
  1586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1587. $ctx1.sendIdx["class"]=1;
  1588. //>>excludeEnd("ctx");
  1589. $4=_st($5)._name();
  1590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1591. $ctx1.sendIdx["name"]=1;
  1592. //>>excludeEnd("ctx");
  1593. $3=_st($4)._first();
  1594. $2=_st($3)._isVowel();
  1595. if(smalltalk.assert($2)){
  1596. $1="an ";
  1597. } else {
  1598. $1="a ";
  1599. };
  1600. _st(aStream)._nextPutAll_($1);
  1601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1602. $ctx1.sendIdx["nextPutAll:"]=1;
  1603. //>>excludeEnd("ctx");
  1604. _st(aStream)._nextPutAll_(_st(self._class())._name());
  1605. return self;
  1606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1607. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.ProtoObject)});
  1608. //>>excludeEnd("ctx");
  1609. },
  1610. //>>excludeStart("ide", pragmas.excludeIdeData);
  1611. args: ["aStream"],
  1612. source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  1613. referencedClasses: [],
  1614. //>>excludeEnd("ide");
  1615. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  1616. }),
  1617. globals.ProtoObject);
  1618. smalltalk.addMethod(
  1619. smalltalk.method({
  1620. selector: "printString",
  1621. protocol: 'printing',
  1622. fn: function (){
  1623. var self=this;
  1624. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1626. return smalltalk.withContext(function($ctx1) {
  1627. //>>excludeEnd("ctx");
  1628. var $1;
  1629. $1=_st($String())._streamContents_((function(str){
  1630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1631. return smalltalk.withContext(function($ctx2) {
  1632. //>>excludeEnd("ctx");
  1633. return self._printOn_(str);
  1634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1635. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  1636. //>>excludeEnd("ctx");
  1637. }));
  1638. return $1;
  1639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1640. }, function($ctx1) {$ctx1.fill(self,"printString",{},globals.ProtoObject)});
  1641. //>>excludeEnd("ctx");
  1642. },
  1643. //>>excludeStart("ide", pragmas.excludeIdeData);
  1644. args: [],
  1645. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1646. referencedClasses: ["String"],
  1647. //>>excludeEnd("ide");
  1648. messageSends: ["streamContents:", "printOn:"]
  1649. }),
  1650. globals.ProtoObject);
  1651. smalltalk.addMethod(
  1652. smalltalk.method({
  1653. selector: "yourself",
  1654. protocol: 'accessing',
  1655. fn: function (){
  1656. var self=this;
  1657. return self;
  1658. },
  1659. //>>excludeStart("ide", pragmas.excludeIdeData);
  1660. args: [],
  1661. source: "yourself\x0a\x09^ self",
  1662. referencedClasses: [],
  1663. //>>excludeEnd("ide");
  1664. messageSends: []
  1665. }),
  1666. globals.ProtoObject);
  1667. smalltalk.addMethod(
  1668. smalltalk.method({
  1669. selector: "~=",
  1670. protocol: 'comparing',
  1671. fn: function (anObject){
  1672. var self=this;
  1673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1674. return smalltalk.withContext(function($ctx1) {
  1675. //>>excludeEnd("ctx");
  1676. var $1;
  1677. $1=_st(self.__eq(anObject)).__eq(false);
  1678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1679. $ctx1.sendIdx["="]=1;
  1680. //>>excludeEnd("ctx");
  1681. return $1;
  1682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1683. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},globals.ProtoObject)});
  1684. //>>excludeEnd("ctx");
  1685. },
  1686. //>>excludeStart("ide", pragmas.excludeIdeData);
  1687. args: ["anObject"],
  1688. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1689. referencedClasses: [],
  1690. //>>excludeEnd("ide");
  1691. messageSends: ["="]
  1692. }),
  1693. globals.ProtoObject);
  1694. smalltalk.addMethod(
  1695. smalltalk.method({
  1696. selector: "~~",
  1697. protocol: 'comparing',
  1698. fn: function (anObject){
  1699. var self=this;
  1700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1701. return smalltalk.withContext(function($ctx1) {
  1702. //>>excludeEnd("ctx");
  1703. var $1;
  1704. $1=_st(self.__eq_eq(anObject)).__eq(false);
  1705. return $1;
  1706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1707. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},globals.ProtoObject)});
  1708. //>>excludeEnd("ctx");
  1709. },
  1710. //>>excludeStart("ide", pragmas.excludeIdeData);
  1711. args: ["anObject"],
  1712. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1713. referencedClasses: [],
  1714. //>>excludeEnd("ide");
  1715. messageSends: ["=", "=="]
  1716. }),
  1717. globals.ProtoObject);
  1718. smalltalk.addMethod(
  1719. smalltalk.method({
  1720. selector: "initialize",
  1721. protocol: 'initialization',
  1722. fn: function (){
  1723. var self=this;
  1724. return self;
  1725. },
  1726. //>>excludeStart("ide", pragmas.excludeIdeData);
  1727. args: [],
  1728. source: "initialize",
  1729. referencedClasses: [],
  1730. //>>excludeEnd("ide");
  1731. messageSends: []
  1732. }),
  1733. globals.ProtoObject.klass);
  1734. smalltalk.addClass('Object', globals.ProtoObject, [], 'Kernel-Objects');
  1735. //>>excludeStart("ide", pragmas.excludeIdeData);
  1736. globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:\x0a\x0a- accessing\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\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#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\x0aI 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.";
  1737. //>>excludeEnd("ide");
  1738. smalltalk.addMethod(
  1739. smalltalk.method({
  1740. selector: "->",
  1741. protocol: 'converting',
  1742. fn: function (anObject){
  1743. var self=this;
  1744. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  1745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1746. return smalltalk.withContext(function($ctx1) {
  1747. //>>excludeEnd("ctx");
  1748. var $1;
  1749. $1=_st($Association())._key_value_(self,anObject);
  1750. return $1;
  1751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1752. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},globals.Object)});
  1753. //>>excludeEnd("ctx");
  1754. },
  1755. //>>excludeStart("ide", pragmas.excludeIdeData);
  1756. args: ["anObject"],
  1757. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1758. referencedClasses: ["Association"],
  1759. //>>excludeEnd("ide");
  1760. messageSends: ["key:value:"]
  1761. }),
  1762. globals.Object);
  1763. smalltalk.addMethod(
  1764. smalltalk.method({
  1765. selector: "asJSON",
  1766. protocol: 'converting',
  1767. fn: function (){
  1768. var self=this;
  1769. var variables;
  1770. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1772. return smalltalk.withContext(function($ctx1) {
  1773. //>>excludeEnd("ctx");
  1774. var $1;
  1775. variables=_st($HashedCollection())._new();
  1776. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1778. return smalltalk.withContext(function($ctx2) {
  1779. //>>excludeEnd("ctx");
  1780. return _st(variables)._at_put_(each,_st(self._instVarAt_(each))._asJSON());
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1783. //>>excludeEnd("ctx");
  1784. }));
  1785. $1=variables;
  1786. return $1;
  1787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1788. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},globals.Object)});
  1789. //>>excludeEnd("ctx");
  1790. },
  1791. //>>excludeStart("ide", pragmas.excludeIdeData);
  1792. args: [],
  1793. 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",
  1794. referencedClasses: ["HashedCollection"],
  1795. //>>excludeEnd("ide");
  1796. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  1797. }),
  1798. globals.Object);
  1799. smalltalk.addMethod(
  1800. smalltalk.method({
  1801. selector: "asJSONString",
  1802. protocol: 'converting',
  1803. fn: function (){
  1804. var self=this;
  1805. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1807. return smalltalk.withContext(function($ctx1) {
  1808. //>>excludeEnd("ctx");
  1809. var $1;
  1810. $1=_st($JSON())._stringify_(self._asJSON());
  1811. return $1;
  1812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1813. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},globals.Object)});
  1814. //>>excludeEnd("ctx");
  1815. },
  1816. //>>excludeStart("ide", pragmas.excludeIdeData);
  1817. args: [],
  1818. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1819. referencedClasses: ["JSON"],
  1820. //>>excludeEnd("ide");
  1821. messageSends: ["stringify:", "asJSON"]
  1822. }),
  1823. globals.Object);
  1824. smalltalk.addMethod(
  1825. smalltalk.method({
  1826. selector: "asJavascript",
  1827. protocol: 'converting',
  1828. fn: function (){
  1829. var self=this;
  1830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1831. return smalltalk.withContext(function($ctx1) {
  1832. //>>excludeEnd("ctx");
  1833. var $1;
  1834. $1=self._asString();
  1835. return $1;
  1836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1837. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Object)});
  1838. //>>excludeEnd("ctx");
  1839. },
  1840. //>>excludeStart("ide", pragmas.excludeIdeData);
  1841. args: [],
  1842. source: "asJavascript\x0a\x09^ self asString",
  1843. referencedClasses: [],
  1844. //>>excludeEnd("ide");
  1845. messageSends: ["asString"]
  1846. }),
  1847. globals.Object);
  1848. smalltalk.addMethod(
  1849. smalltalk.method({
  1850. selector: "basicAt:",
  1851. protocol: 'accessing',
  1852. fn: function (aString){
  1853. var self=this;
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. return smalltalk.withContext(function($ctx1) {
  1856. //>>excludeEnd("ctx");
  1857. return self[aString];
  1858. return self;
  1859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1860. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},globals.Object)});
  1861. //>>excludeEnd("ctx");
  1862. },
  1863. //>>excludeStart("ide", pragmas.excludeIdeData);
  1864. args: ["aString"],
  1865. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1866. referencedClasses: [],
  1867. //>>excludeEnd("ide");
  1868. messageSends: []
  1869. }),
  1870. globals.Object);
  1871. smalltalk.addMethod(
  1872. smalltalk.method({
  1873. selector: "basicAt:put:",
  1874. protocol: 'accessing',
  1875. fn: function (aString,anObject){
  1876. var self=this;
  1877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1878. return smalltalk.withContext(function($ctx1) {
  1879. //>>excludeEnd("ctx");
  1880. return self[aString] = anObject;
  1881. return self;
  1882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1883. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},globals.Object)});
  1884. //>>excludeEnd("ctx");
  1885. },
  1886. //>>excludeStart("ide", pragmas.excludeIdeData);
  1887. args: ["aString", "anObject"],
  1888. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1889. referencedClasses: [],
  1890. //>>excludeEnd("ide");
  1891. messageSends: []
  1892. }),
  1893. globals.Object);
  1894. smalltalk.addMethod(
  1895. smalltalk.method({
  1896. selector: "basicDelete:",
  1897. protocol: 'accessing',
  1898. fn: function (aString){
  1899. var self=this;
  1900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1901. return smalltalk.withContext(function($ctx1) {
  1902. //>>excludeEnd("ctx");
  1903. delete self[aString]; return aString;
  1904. return self;
  1905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1906. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},globals.Object)});
  1907. //>>excludeEnd("ctx");
  1908. },
  1909. //>>excludeStart("ide", pragmas.excludeIdeData);
  1910. args: ["aString"],
  1911. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1912. referencedClasses: [],
  1913. //>>excludeEnd("ide");
  1914. messageSends: []
  1915. }),
  1916. globals.Object);
  1917. smalltalk.addMethod(
  1918. smalltalk.method({
  1919. selector: "basicPerform:",
  1920. protocol: 'message handling',
  1921. fn: function (aString){
  1922. var self=this;
  1923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1924. return smalltalk.withContext(function($ctx1) {
  1925. //>>excludeEnd("ctx");
  1926. var $1;
  1927. $1=self._basicPerform_withArguments_(aString,[]);
  1928. return $1;
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},globals.Object)});
  1931. //>>excludeEnd("ctx");
  1932. },
  1933. //>>excludeStart("ide", pragmas.excludeIdeData);
  1934. args: ["aString"],
  1935. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1936. referencedClasses: [],
  1937. //>>excludeEnd("ide");
  1938. messageSends: ["basicPerform:withArguments:"]
  1939. }),
  1940. globals.Object);
  1941. smalltalk.addMethod(
  1942. smalltalk.method({
  1943. selector: "basicPerform:withArguments:",
  1944. protocol: 'message handling',
  1945. fn: function (aString,aCollection){
  1946. var self=this;
  1947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1948. return smalltalk.withContext(function($ctx1) {
  1949. //>>excludeEnd("ctx");
  1950. return self[aString].apply(self, aCollection);;
  1951. return self;
  1952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1953. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},globals.Object)});
  1954. //>>excludeEnd("ctx");
  1955. },
  1956. //>>excludeStart("ide", pragmas.excludeIdeData);
  1957. args: ["aString", "aCollection"],
  1958. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1959. referencedClasses: [],
  1960. //>>excludeEnd("ide");
  1961. messageSends: []
  1962. }),
  1963. globals.Object);
  1964. smalltalk.addMethod(
  1965. smalltalk.method({
  1966. selector: "browse",
  1967. protocol: 'browsing',
  1968. fn: function (){
  1969. var self=this;
  1970. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1972. return smalltalk.withContext(function($ctx1) {
  1973. //>>excludeEnd("ctx");
  1974. _st($Finder())._findClass_(self._class());
  1975. return self;
  1976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1977. }, function($ctx1) {$ctx1.fill(self,"browse",{},globals.Object)});
  1978. //>>excludeEnd("ctx");
  1979. },
  1980. //>>excludeStart("ide", pragmas.excludeIdeData);
  1981. args: [],
  1982. source: "browse\x0a\x09Finder findClass: self class",
  1983. referencedClasses: ["Finder"],
  1984. //>>excludeEnd("ide");
  1985. messageSends: ["findClass:", "class"]
  1986. }),
  1987. globals.Object);
  1988. smalltalk.addMethod(
  1989. smalltalk.method({
  1990. selector: "copy",
  1991. protocol: 'copying',
  1992. fn: function (){
  1993. var self=this;
  1994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1995. return smalltalk.withContext(function($ctx1) {
  1996. //>>excludeEnd("ctx");
  1997. var $1;
  1998. $1=_st(self._shallowCopy())._postCopy();
  1999. return $1;
  2000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2001. }, function($ctx1) {$ctx1.fill(self,"copy",{},globals.Object)});
  2002. //>>excludeEnd("ctx");
  2003. },
  2004. //>>excludeStart("ide", pragmas.excludeIdeData);
  2005. args: [],
  2006. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2007. referencedClasses: [],
  2008. //>>excludeEnd("ide");
  2009. messageSends: ["postCopy", "shallowCopy"]
  2010. }),
  2011. globals.Object);
  2012. smalltalk.addMethod(
  2013. smalltalk.method({
  2014. selector: "deepCopy",
  2015. protocol: 'copying',
  2016. fn: function (){
  2017. var self=this;
  2018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2019. return smalltalk.withContext(function($ctx1) {
  2020. //>>excludeEnd("ctx");
  2021. var copy = self.klass._new();
  2022. Object.keys(self).forEach(function (i) {
  2023. if(/^@.+/.test(i)) {
  2024. copy[i] = self[i]._deepCopy();
  2025. }
  2026. });
  2027. return copy;
  2028. ;
  2029. return self;
  2030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2031. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Object)});
  2032. //>>excludeEnd("ctx");
  2033. },
  2034. //>>excludeStart("ide", pragmas.excludeIdeData);
  2035. args: [],
  2036. source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\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>",
  2037. referencedClasses: [],
  2038. //>>excludeEnd("ide");
  2039. messageSends: []
  2040. }),
  2041. globals.Object);
  2042. smalltalk.addMethod(
  2043. smalltalk.method({
  2044. selector: "deprecatedAPI",
  2045. protocol: 'error handling',
  2046. fn: function (){
  2047. var self=this;
  2048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2049. return smalltalk.withContext(function($ctx1) {
  2050. //>>excludeEnd("ctx");
  2051. var $1,$6,$5,$4,$8,$7,$3,$2;
  2052. $1=console;
  2053. $6=smalltalk.getThisContext()._home();
  2054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2055. $ctx1.sendIdx["home"]=1;
  2056. //>>excludeEnd("ctx");
  2057. $5=_st($6)._asString();
  2058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2059. $ctx1.sendIdx["asString"]=1;
  2060. //>>excludeEnd("ctx");
  2061. $4=_st($5).__comma(" is deprecated! (in ");
  2062. $8=_st(smalltalk.getThisContext()._home())._home();
  2063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2064. $ctx1.sendIdx["home"]=2;
  2065. //>>excludeEnd("ctx");
  2066. $7=_st($8)._asString();
  2067. $3=_st($4).__comma($7);
  2068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2069. $ctx1.sendIdx[","]=2;
  2070. //>>excludeEnd("ctx");
  2071. $2=_st($3).__comma(")");
  2072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2073. $ctx1.sendIdx[","]=1;
  2074. //>>excludeEnd("ctx");
  2075. _st($1)._warn_($2);
  2076. return self;
  2077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2078. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},globals.Object)});
  2079. //>>excludeEnd("ctx");
  2080. },
  2081. //>>excludeStart("ide", pragmas.excludeIdeData);
  2082. args: [],
  2083. 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, ')'.",
  2084. referencedClasses: [],
  2085. //>>excludeEnd("ide");
  2086. messageSends: ["warn:", ",", "asString", "home"]
  2087. }),
  2088. globals.Object);
  2089. smalltalk.addMethod(
  2090. smalltalk.method({
  2091. selector: "deprecatedAPI:",
  2092. protocol: 'error handling',
  2093. fn: function (aString){
  2094. var self=this;
  2095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2096. return smalltalk.withContext(function($ctx1) {
  2097. //>>excludeEnd("ctx");
  2098. var $1,$6,$5,$4,$8,$7,$3,$2;
  2099. $1=console;
  2100. $6=smalltalk.getThisContext()._home();
  2101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2102. $ctx1.sendIdx["home"]=1;
  2103. //>>excludeEnd("ctx");
  2104. $5=_st($6)._asString();
  2105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2106. $ctx1.sendIdx["asString"]=1;
  2107. //>>excludeEnd("ctx");
  2108. $4=_st($5).__comma(" is deprecated! (in ");
  2109. $8=_st(smalltalk.getThisContext()._home())._home();
  2110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2111. $ctx1.sendIdx["home"]=2;
  2112. //>>excludeEnd("ctx");
  2113. $7=_st($8)._asString();
  2114. $3=_st($4).__comma($7);
  2115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2116. $ctx1.sendIdx[","]=2;
  2117. //>>excludeEnd("ctx");
  2118. $2=_st($3).__comma(")");
  2119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2120. $ctx1.sendIdx[","]=1;
  2121. //>>excludeEnd("ctx");
  2122. _st($1)._warn_($2);
  2123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2124. $ctx1.sendIdx["warn:"]=1;
  2125. //>>excludeEnd("ctx");
  2126. _st(console)._warn_(aString);
  2127. return self;
  2128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2129. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},globals.Object)});
  2130. //>>excludeEnd("ctx");
  2131. },
  2132. //>>excludeStart("ide", pragmas.excludeIdeData);
  2133. args: ["aString"],
  2134. source: "deprecatedAPI: aString\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, ')'.\x0a\x09console warn: aString",
  2135. referencedClasses: [],
  2136. //>>excludeEnd("ide");
  2137. messageSends: ["warn:", ",", "asString", "home"]
  2138. }),
  2139. globals.Object);
  2140. smalltalk.addMethod(
  2141. smalltalk.method({
  2142. selector: "error:",
  2143. protocol: 'error handling',
  2144. fn: function (aString){
  2145. var self=this;
  2146. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2148. return smalltalk.withContext(function($ctx1) {
  2149. //>>excludeEnd("ctx");
  2150. _st($Error())._signal_(aString);
  2151. return self;
  2152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2153. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},globals.Object)});
  2154. //>>excludeEnd("ctx");
  2155. },
  2156. //>>excludeStart("ide", pragmas.excludeIdeData);
  2157. args: ["aString"],
  2158. source: "error: aString\x0a\x09Error signal: aString",
  2159. referencedClasses: ["Error"],
  2160. //>>excludeEnd("ide");
  2161. messageSends: ["signal:"]
  2162. }),
  2163. globals.Object);
  2164. smalltalk.addMethod(
  2165. smalltalk.method({
  2166. selector: "halt",
  2167. protocol: 'error handling',
  2168. fn: function (){
  2169. var self=this;
  2170. function $Halt(){return globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
  2171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2172. return smalltalk.withContext(function($ctx1) {
  2173. //>>excludeEnd("ctx");
  2174. _st($Halt())._signal();
  2175. return self;
  2176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2177. }, function($ctx1) {$ctx1.fill(self,"halt",{},globals.Object)});
  2178. //>>excludeEnd("ctx");
  2179. },
  2180. //>>excludeStart("ide", pragmas.excludeIdeData);
  2181. args: [],
  2182. source: "halt\x0a\x09Halt signal",
  2183. referencedClasses: ["Halt"],
  2184. //>>excludeEnd("ide");
  2185. messageSends: ["signal"]
  2186. }),
  2187. globals.Object);
  2188. smalltalk.addMethod(
  2189. smalltalk.method({
  2190. selector: "ifNil:",
  2191. protocol: 'testing',
  2192. fn: function (aBlock){
  2193. var self=this;
  2194. return self;
  2195. },
  2196. //>>excludeStart("ide", pragmas.excludeIdeData);
  2197. args: ["aBlock"],
  2198. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2199. referencedClasses: [],
  2200. //>>excludeEnd("ide");
  2201. messageSends: []
  2202. }),
  2203. globals.Object);
  2204. smalltalk.addMethod(
  2205. smalltalk.method({
  2206. selector: "ifNil:ifNotNil:",
  2207. protocol: 'testing',
  2208. fn: function (aBlock,anotherBlock){
  2209. var self=this;
  2210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2211. return smalltalk.withContext(function($ctx1) {
  2212. //>>excludeEnd("ctx");
  2213. var $1;
  2214. $1=_st(anotherBlock)._value_(self);
  2215. return $1;
  2216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2217. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)});
  2218. //>>excludeEnd("ctx");
  2219. },
  2220. //>>excludeStart("ide", pragmas.excludeIdeData);
  2221. args: ["aBlock", "anotherBlock"],
  2222. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2223. referencedClasses: [],
  2224. //>>excludeEnd("ide");
  2225. messageSends: ["value:"]
  2226. }),
  2227. globals.Object);
  2228. smalltalk.addMethod(
  2229. smalltalk.method({
  2230. selector: "ifNotNil:",
  2231. protocol: 'testing',
  2232. fn: function (aBlock){
  2233. var self=this;
  2234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2235. return smalltalk.withContext(function($ctx1) {
  2236. //>>excludeEnd("ctx");
  2237. var $1;
  2238. $1=_st(aBlock)._value_(self);
  2239. return $1;
  2240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2241. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},globals.Object)});
  2242. //>>excludeEnd("ctx");
  2243. },
  2244. //>>excludeStart("ide", pragmas.excludeIdeData);
  2245. args: ["aBlock"],
  2246. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2247. referencedClasses: [],
  2248. //>>excludeEnd("ide");
  2249. messageSends: ["value:"]
  2250. }),
  2251. globals.Object);
  2252. smalltalk.addMethod(
  2253. smalltalk.method({
  2254. selector: "ifNotNil:ifNil:",
  2255. protocol: 'testing',
  2256. fn: function (aBlock,anotherBlock){
  2257. var self=this;
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. return smalltalk.withContext(function($ctx1) {
  2260. //>>excludeEnd("ctx");
  2261. var $1;
  2262. $1=_st(aBlock)._value_(self);
  2263. return $1;
  2264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2265. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)});
  2266. //>>excludeEnd("ctx");
  2267. },
  2268. //>>excludeStart("ide", pragmas.excludeIdeData);
  2269. args: ["aBlock", "anotherBlock"],
  2270. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2271. referencedClasses: [],
  2272. //>>excludeEnd("ide");
  2273. messageSends: ["value:"]
  2274. }),
  2275. globals.Object);
  2276. smalltalk.addMethod(
  2277. smalltalk.method({
  2278. selector: "inspectOn:",
  2279. protocol: 'inspecting',
  2280. fn: function (anInspector){
  2281. var self=this;
  2282. var variables;
  2283. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. return smalltalk.withContext(function($ctx1) {
  2286. //>>excludeEnd("ctx");
  2287. var $1;
  2288. variables=_st($Dictionary())._new();
  2289. _st(variables)._at_put_("#self",self);
  2290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2291. $ctx1.sendIdx["at:put:"]=1;
  2292. //>>excludeEnd("ctx");
  2293. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  2294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2295. return smalltalk.withContext(function($ctx2) {
  2296. //>>excludeEnd("ctx");
  2297. return _st(variables)._at_put_(each,self._instVarAt_(each));
  2298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2299. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2300. //>>excludeEnd("ctx");
  2301. }));
  2302. _st(anInspector)._setLabel_(self._printString());
  2303. $1=_st(anInspector)._setVariables_(variables);
  2304. return self;
  2305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2306. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.Object)});
  2307. //>>excludeEnd("ctx");
  2308. },
  2309. //>>excludeStart("ide", pragmas.excludeIdeData);
  2310. args: ["anInspector"],
  2311. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  2312. referencedClasses: ["Dictionary"],
  2313. //>>excludeEnd("ide");
  2314. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  2315. }),
  2316. globals.Object);
  2317. smalltalk.addMethod(
  2318. smalltalk.method({
  2319. selector: "isBehavior",
  2320. protocol: 'testing',
  2321. fn: function (){
  2322. var self=this;
  2323. return false;
  2324. },
  2325. //>>excludeStart("ide", pragmas.excludeIdeData);
  2326. args: [],
  2327. source: "isBehavior\x0a\x09^ false",
  2328. referencedClasses: [],
  2329. //>>excludeEnd("ide");
  2330. messageSends: []
  2331. }),
  2332. globals.Object);
  2333. smalltalk.addMethod(
  2334. smalltalk.method({
  2335. selector: "isBoolean",
  2336. protocol: 'testing',
  2337. fn: function (){
  2338. var self=this;
  2339. return false;
  2340. },
  2341. //>>excludeStart("ide", pragmas.excludeIdeData);
  2342. args: [],
  2343. source: "isBoolean\x0a\x09^ false",
  2344. referencedClasses: [],
  2345. //>>excludeEnd("ide");
  2346. messageSends: []
  2347. }),
  2348. globals.Object);
  2349. smalltalk.addMethod(
  2350. smalltalk.method({
  2351. selector: "isClass",
  2352. protocol: 'testing',
  2353. fn: function (){
  2354. var self=this;
  2355. return false;
  2356. },
  2357. //>>excludeStart("ide", pragmas.excludeIdeData);
  2358. args: [],
  2359. source: "isClass\x0a\x09^ false",
  2360. referencedClasses: [],
  2361. //>>excludeEnd("ide");
  2362. messageSends: []
  2363. }),
  2364. globals.Object);
  2365. smalltalk.addMethod(
  2366. smalltalk.method({
  2367. selector: "isCompiledMethod",
  2368. protocol: 'testing',
  2369. fn: function (){
  2370. var self=this;
  2371. return false;
  2372. },
  2373. //>>excludeStart("ide", pragmas.excludeIdeData);
  2374. args: [],
  2375. source: "isCompiledMethod\x0a\x09^ false",
  2376. referencedClasses: [],
  2377. //>>excludeEnd("ide");
  2378. messageSends: []
  2379. }),
  2380. globals.Object);
  2381. smalltalk.addMethod(
  2382. smalltalk.method({
  2383. selector: "isImmutable",
  2384. protocol: 'testing',
  2385. fn: function (){
  2386. var self=this;
  2387. return false;
  2388. },
  2389. //>>excludeStart("ide", pragmas.excludeIdeData);
  2390. args: [],
  2391. source: "isImmutable\x0a\x09^ false",
  2392. referencedClasses: [],
  2393. //>>excludeEnd("ide");
  2394. messageSends: []
  2395. }),
  2396. globals.Object);
  2397. smalltalk.addMethod(
  2398. smalltalk.method({
  2399. selector: "isMemberOf:",
  2400. protocol: 'testing',
  2401. fn: function (aClass){
  2402. var self=this;
  2403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2404. return smalltalk.withContext(function($ctx1) {
  2405. //>>excludeEnd("ctx");
  2406. var $1;
  2407. $1=_st(self._class()).__eq(aClass);
  2408. return $1;
  2409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2410. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},globals.Object)});
  2411. //>>excludeEnd("ctx");
  2412. },
  2413. //>>excludeStart("ide", pragmas.excludeIdeData);
  2414. args: ["aClass"],
  2415. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2416. referencedClasses: [],
  2417. //>>excludeEnd("ide");
  2418. messageSends: ["=", "class"]
  2419. }),
  2420. globals.Object);
  2421. smalltalk.addMethod(
  2422. smalltalk.method({
  2423. selector: "isMetaclass",
  2424. protocol: 'testing',
  2425. fn: function (){
  2426. var self=this;
  2427. return false;
  2428. },
  2429. //>>excludeStart("ide", pragmas.excludeIdeData);
  2430. args: [],
  2431. source: "isMetaclass\x0a\x09^ false",
  2432. referencedClasses: [],
  2433. //>>excludeEnd("ide");
  2434. messageSends: []
  2435. }),
  2436. globals.Object);
  2437. smalltalk.addMethod(
  2438. smalltalk.method({
  2439. selector: "isNil",
  2440. protocol: 'testing',
  2441. fn: function (){
  2442. var self=this;
  2443. return false;
  2444. },
  2445. //>>excludeStart("ide", pragmas.excludeIdeData);
  2446. args: [],
  2447. source: "isNil\x0a\x09^ false",
  2448. referencedClasses: [],
  2449. //>>excludeEnd("ide");
  2450. messageSends: []
  2451. }),
  2452. globals.Object);
  2453. smalltalk.addMethod(
  2454. smalltalk.method({
  2455. selector: "isNumber",
  2456. protocol: 'testing',
  2457. fn: function (){
  2458. var self=this;
  2459. return false;
  2460. },
  2461. //>>excludeStart("ide", pragmas.excludeIdeData);
  2462. args: [],
  2463. source: "isNumber\x0a\x09^ false",
  2464. referencedClasses: [],
  2465. //>>excludeEnd("ide");
  2466. messageSends: []
  2467. }),
  2468. globals.Object);
  2469. smalltalk.addMethod(
  2470. smalltalk.method({
  2471. selector: "isPackage",
  2472. protocol: 'testing',
  2473. fn: function (){
  2474. var self=this;
  2475. return false;
  2476. },
  2477. //>>excludeStart("ide", pragmas.excludeIdeData);
  2478. args: [],
  2479. source: "isPackage\x0a\x09^ false",
  2480. referencedClasses: [],
  2481. //>>excludeEnd("ide");
  2482. messageSends: []
  2483. }),
  2484. globals.Object);
  2485. smalltalk.addMethod(
  2486. smalltalk.method({
  2487. selector: "isParseFailure",
  2488. protocol: 'testing',
  2489. fn: function (){
  2490. var self=this;
  2491. return false;
  2492. },
  2493. //>>excludeStart("ide", pragmas.excludeIdeData);
  2494. args: [],
  2495. source: "isParseFailure\x0a\x09^ false",
  2496. referencedClasses: [],
  2497. //>>excludeEnd("ide");
  2498. messageSends: []
  2499. }),
  2500. globals.Object);
  2501. smalltalk.addMethod(
  2502. smalltalk.method({
  2503. selector: "isString",
  2504. protocol: 'testing',
  2505. fn: function (){
  2506. var self=this;
  2507. return false;
  2508. },
  2509. //>>excludeStart("ide", pragmas.excludeIdeData);
  2510. args: [],
  2511. source: "isString\x0a\x09^ false",
  2512. referencedClasses: [],
  2513. //>>excludeEnd("ide");
  2514. messageSends: []
  2515. }),
  2516. globals.Object);
  2517. smalltalk.addMethod(
  2518. smalltalk.method({
  2519. selector: "isSymbol",
  2520. protocol: 'testing',
  2521. fn: function (){
  2522. var self=this;
  2523. return false;
  2524. },
  2525. //>>excludeStart("ide", pragmas.excludeIdeData);
  2526. args: [],
  2527. source: "isSymbol\x0a\x09^ false",
  2528. referencedClasses: [],
  2529. //>>excludeEnd("ide");
  2530. messageSends: []
  2531. }),
  2532. globals.Object);
  2533. smalltalk.addMethod(
  2534. smalltalk.method({
  2535. selector: "notNil",
  2536. protocol: 'testing',
  2537. fn: function (){
  2538. var self=this;
  2539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2540. return smalltalk.withContext(function($ctx1) {
  2541. //>>excludeEnd("ctx");
  2542. var $1;
  2543. $1=_st(self._isNil())._not();
  2544. return $1;
  2545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2546. }, function($ctx1) {$ctx1.fill(self,"notNil",{},globals.Object)});
  2547. //>>excludeEnd("ctx");
  2548. },
  2549. //>>excludeStart("ide", pragmas.excludeIdeData);
  2550. args: [],
  2551. source: "notNil\x0a\x09^ self isNil not",
  2552. referencedClasses: [],
  2553. //>>excludeEnd("ide");
  2554. messageSends: ["not", "isNil"]
  2555. }),
  2556. globals.Object);
  2557. smalltalk.addMethod(
  2558. smalltalk.method({
  2559. selector: "postCopy",
  2560. protocol: 'copying',
  2561. fn: function (){
  2562. var self=this;
  2563. return self;
  2564. },
  2565. //>>excludeStart("ide", pragmas.excludeIdeData);
  2566. args: [],
  2567. source: "postCopy",
  2568. referencedClasses: [],
  2569. //>>excludeEnd("ide");
  2570. messageSends: []
  2571. }),
  2572. globals.Object);
  2573. smalltalk.addMethod(
  2574. smalltalk.method({
  2575. selector: "putOn:",
  2576. protocol: 'streaming',
  2577. fn: function (aStream){
  2578. var self=this;
  2579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2580. return smalltalk.withContext(function($ctx1) {
  2581. //>>excludeEnd("ctx");
  2582. _st(aStream)._nextPut_(self);
  2583. return self;
  2584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2585. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Object)});
  2586. //>>excludeEnd("ctx");
  2587. },
  2588. //>>excludeStart("ide", pragmas.excludeIdeData);
  2589. args: ["aStream"],
  2590. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2591. referencedClasses: [],
  2592. //>>excludeEnd("ide");
  2593. messageSends: ["nextPut:"]
  2594. }),
  2595. globals.Object);
  2596. smalltalk.addMethod(
  2597. smalltalk.method({
  2598. selector: "respondsTo:",
  2599. protocol: 'testing',
  2600. fn: function (aSelector){
  2601. var self=this;
  2602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2603. return smalltalk.withContext(function($ctx1) {
  2604. //>>excludeEnd("ctx");
  2605. var $1;
  2606. $1=_st(self._class())._canUnderstand_(aSelector);
  2607. return $1;
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},globals.Object)});
  2610. //>>excludeEnd("ctx");
  2611. },
  2612. //>>excludeStart("ide", pragmas.excludeIdeData);
  2613. args: ["aSelector"],
  2614. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2615. referencedClasses: [],
  2616. //>>excludeEnd("ide");
  2617. messageSends: ["canUnderstand:", "class"]
  2618. }),
  2619. globals.Object);
  2620. smalltalk.addMethod(
  2621. smalltalk.method({
  2622. selector: "shallowCopy",
  2623. protocol: 'copying',
  2624. fn: function (){
  2625. var self=this;
  2626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2627. return smalltalk.withContext(function($ctx1) {
  2628. //>>excludeEnd("ctx");
  2629. var copy = self.klass._new();
  2630. Object.keys(self).forEach(function(i) {
  2631. if(/^@.+/.test(i)) {
  2632. copy[i] = self[i];
  2633. }
  2634. });
  2635. return copy;
  2636. ;
  2637. return self;
  2638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2639. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.Object)});
  2640. //>>excludeEnd("ctx");
  2641. },
  2642. //>>excludeStart("ide", pragmas.excludeIdeData);
  2643. args: [],
  2644. source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
  2645. referencedClasses: [],
  2646. //>>excludeEnd("ide");
  2647. messageSends: []
  2648. }),
  2649. globals.Object);
  2650. smalltalk.addMethod(
  2651. smalltalk.method({
  2652. selector: "shouldNotImplement",
  2653. protocol: 'error handling',
  2654. fn: function (){
  2655. var self=this;
  2656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2657. return smalltalk.withContext(function($ctx1) {
  2658. //>>excludeEnd("ctx");
  2659. self._error_("This method should not be implemented in ".__comma(_st(self._class())._name()));
  2660. return self;
  2661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2662. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},globals.Object)});
  2663. //>>excludeEnd("ctx");
  2664. },
  2665. //>>excludeStart("ide", pragmas.excludeIdeData);
  2666. args: [],
  2667. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2668. referencedClasses: [],
  2669. //>>excludeEnd("ide");
  2670. messageSends: ["error:", ",", "name", "class"]
  2671. }),
  2672. globals.Object);
  2673. smalltalk.addMethod(
  2674. smalltalk.method({
  2675. selector: "size",
  2676. protocol: 'accessing',
  2677. fn: function (){
  2678. var self=this;
  2679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2680. return smalltalk.withContext(function($ctx1) {
  2681. //>>excludeEnd("ctx");
  2682. self._error_("Object not indexable");
  2683. return self;
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Object)});
  2686. //>>excludeEnd("ctx");
  2687. },
  2688. //>>excludeStart("ide", pragmas.excludeIdeData);
  2689. args: [],
  2690. source: "size\x0a\x09self error: 'Object not indexable'",
  2691. referencedClasses: [],
  2692. //>>excludeEnd("ide");
  2693. messageSends: ["error:"]
  2694. }),
  2695. globals.Object);
  2696. smalltalk.addMethod(
  2697. smalltalk.method({
  2698. selector: "subclassResponsibility",
  2699. protocol: 'error handling',
  2700. fn: function (){
  2701. var self=this;
  2702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2703. return smalltalk.withContext(function($ctx1) {
  2704. //>>excludeEnd("ctx");
  2705. self._error_("This method is a responsibility of a subclass");
  2706. return self;
  2707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2708. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},globals.Object)});
  2709. //>>excludeEnd("ctx");
  2710. },
  2711. //>>excludeStart("ide", pragmas.excludeIdeData);
  2712. args: [],
  2713. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2714. referencedClasses: [],
  2715. //>>excludeEnd("ide");
  2716. messageSends: ["error:"]
  2717. }),
  2718. globals.Object);
  2719. smalltalk.addMethod(
  2720. smalltalk.method({
  2721. selector: "throw:",
  2722. protocol: 'error handling',
  2723. fn: function (anObject){
  2724. var self=this;
  2725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2726. return smalltalk.withContext(function($ctx1) {
  2727. //>>excludeEnd("ctx");
  2728. throw anObject ;
  2729. return self;
  2730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2731. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},globals.Object)});
  2732. //>>excludeEnd("ctx");
  2733. },
  2734. //>>excludeStart("ide", pragmas.excludeIdeData);
  2735. args: ["anObject"],
  2736. source: "throw: anObject\x0a\x09< throw anObject >",
  2737. referencedClasses: [],
  2738. //>>excludeEnd("ide");
  2739. messageSends: []
  2740. }),
  2741. globals.Object);
  2742. smalltalk.addMethod(
  2743. smalltalk.method({
  2744. selector: "try:catch:",
  2745. protocol: 'error handling',
  2746. fn: function (aBlock,anotherBlock){
  2747. var self=this;
  2748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2749. return smalltalk.withContext(function($ctx1) {
  2750. //>>excludeEnd("ctx");
  2751. var $1;
  2752. self._deprecatedAPI();
  2753. $1=_st(aBlock)._tryCatch_(anotherBlock);
  2754. return $1;
  2755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2756. }, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)});
  2757. //>>excludeEnd("ctx");
  2758. },
  2759. //>>excludeStart("ide", pragmas.excludeIdeData);
  2760. args: ["aBlock", "anotherBlock"],
  2761. source: "try: aBlock catch: anotherBlock\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ aBlock tryCatch: anotherBlock",
  2762. referencedClasses: [],
  2763. //>>excludeEnd("ide");
  2764. messageSends: ["deprecatedAPI", "tryCatch:"]
  2765. }),
  2766. globals.Object);
  2767. smalltalk.addMethod(
  2768. smalltalk.method({
  2769. selector: "value",
  2770. protocol: 'accessing',
  2771. fn: function (){
  2772. var self=this;
  2773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2774. return smalltalk.withContext(function($ctx1) {
  2775. //>>excludeEnd("ctx");
  2776. return self.valueOf();
  2777. return self;
  2778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2779. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.Object)});
  2780. //>>excludeEnd("ctx");
  2781. },
  2782. //>>excludeStart("ide", pragmas.excludeIdeData);
  2783. args: [],
  2784. source: "value\x0a\x09<return self.valueOf()>",
  2785. referencedClasses: [],
  2786. //>>excludeEnd("ide");
  2787. messageSends: []
  2788. }),
  2789. globals.Object);
  2790. smalltalk.addMethod(
  2791. smalltalk.method({
  2792. selector: "accessorProtocolWith:",
  2793. protocol: 'helios',
  2794. fn: function (aGenerator){
  2795. var self=this;
  2796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2797. return smalltalk.withContext(function($ctx1) {
  2798. //>>excludeEnd("ctx");
  2799. _st(aGenerator)._accessorProtocolForObject();
  2800. return self;
  2801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2802. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)});
  2803. //>>excludeEnd("ctx");
  2804. },
  2805. //>>excludeStart("ide", pragmas.excludeIdeData);
  2806. args: ["aGenerator"],
  2807. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2808. referencedClasses: [],
  2809. //>>excludeEnd("ide");
  2810. messageSends: ["accessorProtocolForObject"]
  2811. }),
  2812. globals.Object.klass);
  2813. smalltalk.addMethod(
  2814. smalltalk.method({
  2815. selector: "accessorsSourceCodesWith:",
  2816. protocol: 'helios',
  2817. fn: function (aGenerator){
  2818. var self=this;
  2819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2820. return smalltalk.withContext(function($ctx1) {
  2821. //>>excludeEnd("ctx");
  2822. _st(aGenerator)._accessorsForObject();
  2823. return self;
  2824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2825. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)});
  2826. //>>excludeEnd("ctx");
  2827. },
  2828. //>>excludeStart("ide", pragmas.excludeIdeData);
  2829. args: ["aGenerator"],
  2830. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2831. referencedClasses: [],
  2832. //>>excludeEnd("ide");
  2833. messageSends: ["accessorsForObject"]
  2834. }),
  2835. globals.Object.klass);
  2836. smalltalk.addMethod(
  2837. smalltalk.method({
  2838. selector: "initialize",
  2839. protocol: 'initialization',
  2840. fn: function (){
  2841. var self=this;
  2842. return self;
  2843. },
  2844. //>>excludeStart("ide", pragmas.excludeIdeData);
  2845. args: [],
  2846. source: "initialize\x0a\x09\x22no op\x22",
  2847. referencedClasses: [],
  2848. //>>excludeEnd("ide");
  2849. messageSends: []
  2850. }),
  2851. globals.Object.klass);
  2852. smalltalk.addMethod(
  2853. smalltalk.method({
  2854. selector: "initializeProtocolWith:",
  2855. protocol: 'helios',
  2856. fn: function (aGenerator){
  2857. var self=this;
  2858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2859. return smalltalk.withContext(function($ctx1) {
  2860. //>>excludeEnd("ctx");
  2861. _st(aGenerator)._initializeProtocolForObject();
  2862. return self;
  2863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2864. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)});
  2865. //>>excludeEnd("ctx");
  2866. },
  2867. //>>excludeStart("ide", pragmas.excludeIdeData);
  2868. args: ["aGenerator"],
  2869. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2870. referencedClasses: [],
  2871. //>>excludeEnd("ide");
  2872. messageSends: ["initializeProtocolForObject"]
  2873. }),
  2874. globals.Object.klass);
  2875. smalltalk.addMethod(
  2876. smalltalk.method({
  2877. selector: "initializeSourceCodesWith:",
  2878. protocol: 'helios',
  2879. fn: function (aGenerator){
  2880. var self=this;
  2881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2882. return smalltalk.withContext(function($ctx1) {
  2883. //>>excludeEnd("ctx");
  2884. _st(aGenerator)._initializeForObject();
  2885. return self;
  2886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2887. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)});
  2888. //>>excludeEnd("ctx");
  2889. },
  2890. //>>excludeStart("ide", pragmas.excludeIdeData);
  2891. args: ["aGenerator"],
  2892. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2893. referencedClasses: [],
  2894. //>>excludeEnd("ide");
  2895. messageSends: ["initializeForObject"]
  2896. }),
  2897. globals.Object.klass);
  2898. smalltalk.addClass('Boolean', globals.Object, [], 'Kernel-Objects');
  2899. //>>excludeStart("ide", pragmas.excludeIdeData);
  2900. globals.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
  2901. //>>excludeEnd("ide");
  2902. smalltalk.addMethod(
  2903. smalltalk.method({
  2904. selector: "&",
  2905. protocol: 'controlling',
  2906. fn: function (aBoolean){
  2907. var self=this;
  2908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2909. return smalltalk.withContext(function($ctx1) {
  2910. //>>excludeEnd("ctx");
  2911. if(self == true) {
  2912. return aBoolean;
  2913. } else {
  2914. return false;
  2915. }
  2916. ;
  2917. return self;
  2918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2919. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},globals.Boolean)});
  2920. //>>excludeEnd("ctx");
  2921. },
  2922. //>>excludeStart("ide", pragmas.excludeIdeData);
  2923. args: ["aBoolean"],
  2924. 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>",
  2925. referencedClasses: [],
  2926. //>>excludeEnd("ide");
  2927. messageSends: []
  2928. }),
  2929. globals.Boolean);
  2930. smalltalk.addMethod(
  2931. smalltalk.method({
  2932. selector: "=",
  2933. protocol: 'comparing',
  2934. fn: function (aBoolean){
  2935. var self=this;
  2936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2937. return smalltalk.withContext(function($ctx1) {
  2938. //>>excludeEnd("ctx");
  2939. return aBoolean != null &&
  2940. typeof aBoolean._isBoolean === "function" &&
  2941. aBoolean._isBoolean() &&
  2942. Boolean(self == true) == aBoolean
  2943. ;
  2944. return self;
  2945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2946. }, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},globals.Boolean)});
  2947. //>>excludeEnd("ctx");
  2948. },
  2949. //>>excludeStart("ide", pragmas.excludeIdeData);
  2950. args: ["aBoolean"],
  2951. source: "= aBoolean\x0a\x09<\x0a\x09\x09return aBoolean != null &&\x0a\x09\x09\x09typeof aBoolean._isBoolean === \x22function\x22 &&\x0a\x09\x09\x09aBoolean._isBoolean() &&\x0a\x09\x09\x09Boolean(self == true) == aBoolean\x0a\x09>",
  2952. referencedClasses: [],
  2953. //>>excludeEnd("ide");
  2954. messageSends: []
  2955. }),
  2956. globals.Boolean);
  2957. smalltalk.addMethod(
  2958. smalltalk.method({
  2959. selector: "==",
  2960. protocol: 'comparing',
  2961. fn: function (aBoolean){
  2962. var self=this;
  2963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2964. return smalltalk.withContext(function($ctx1) {
  2965. //>>excludeEnd("ctx");
  2966. var $1;
  2967. $1=self.__eq(aBoolean);
  2968. return $1;
  2969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2970. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},globals.Boolean)});
  2971. //>>excludeEnd("ctx");
  2972. },
  2973. //>>excludeStart("ide", pragmas.excludeIdeData);
  2974. args: ["aBoolean"],
  2975. source: "== aBoolean\x0a\x09^ self = aBoolean",
  2976. referencedClasses: [],
  2977. //>>excludeEnd("ide");
  2978. messageSends: ["="]
  2979. }),
  2980. globals.Boolean);
  2981. smalltalk.addMethod(
  2982. smalltalk.method({
  2983. selector: "and:",
  2984. protocol: 'controlling',
  2985. fn: function (aBlock){
  2986. var self=this;
  2987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2988. return smalltalk.withContext(function($ctx1) {
  2989. //>>excludeEnd("ctx");
  2990. var $2,$1;
  2991. $2=self.__eq(true);
  2992. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  2993. return false;
  2994. }));
  2995. return $1;
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},globals.Boolean)});
  2998. //>>excludeEnd("ctx");
  2999. },
  3000. //>>excludeStart("ide", pragmas.excludeIdeData);
  3001. args: ["aBlock"],
  3002. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  3003. referencedClasses: [],
  3004. //>>excludeEnd("ide");
  3005. messageSends: ["ifTrue:ifFalse:", "="]
  3006. }),
  3007. globals.Boolean);
  3008. smalltalk.addMethod(
  3009. smalltalk.method({
  3010. selector: "asBit",
  3011. protocol: 'converting',
  3012. fn: function (){
  3013. var self=this;
  3014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3015. return smalltalk.withContext(function($ctx1) {
  3016. //>>excludeEnd("ctx");
  3017. var $1;
  3018. if(smalltalk.assert(self)){
  3019. $1=(1);
  3020. } else {
  3021. $1=(0);
  3022. };
  3023. return $1;
  3024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3025. }, function($ctx1) {$ctx1.fill(self,"asBit",{},globals.Boolean)});
  3026. //>>excludeEnd("ctx");
  3027. },
  3028. //>>excludeStart("ide", pragmas.excludeIdeData);
  3029. args: [],
  3030. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3031. referencedClasses: [],
  3032. //>>excludeEnd("ide");
  3033. messageSends: ["ifTrue:ifFalse:"]
  3034. }),
  3035. globals.Boolean);
  3036. smalltalk.addMethod(
  3037. smalltalk.method({
  3038. selector: "asJSON",
  3039. protocol: 'converting',
  3040. fn: function (){
  3041. var self=this;
  3042. return self;
  3043. },
  3044. //>>excludeStart("ide", pragmas.excludeIdeData);
  3045. args: [],
  3046. source: "asJSON\x0a\x09^ self",
  3047. referencedClasses: [],
  3048. //>>excludeEnd("ide");
  3049. messageSends: []
  3050. }),
  3051. globals.Boolean);
  3052. smalltalk.addMethod(
  3053. smalltalk.method({
  3054. selector: "asString",
  3055. protocol: 'converting',
  3056. fn: function (){
  3057. var self=this;
  3058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3059. return smalltalk.withContext(function($ctx1) {
  3060. //>>excludeEnd("ctx");
  3061. return self.toString() ;
  3062. return self;
  3063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3064. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Boolean)});
  3065. //>>excludeEnd("ctx");
  3066. },
  3067. //>>excludeStart("ide", pragmas.excludeIdeData);
  3068. args: [],
  3069. source: "asString\x0a\x09< return self.toString() >",
  3070. referencedClasses: [],
  3071. //>>excludeEnd("ide");
  3072. messageSends: []
  3073. }),
  3074. globals.Boolean);
  3075. smalltalk.addMethod(
  3076. smalltalk.method({
  3077. selector: "deepCopy",
  3078. protocol: 'copying',
  3079. fn: function (){
  3080. var self=this;
  3081. return self;
  3082. },
  3083. //>>excludeStart("ide", pragmas.excludeIdeData);
  3084. args: [],
  3085. source: "deepCopy\x0a\x09^ self",
  3086. referencedClasses: [],
  3087. //>>excludeEnd("ide");
  3088. messageSends: []
  3089. }),
  3090. globals.Boolean);
  3091. smalltalk.addMethod(
  3092. smalltalk.method({
  3093. selector: "ifFalse:",
  3094. protocol: 'controlling',
  3095. fn: function (aBlock){
  3096. var self=this;
  3097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3098. return smalltalk.withContext(function($ctx1) {
  3099. //>>excludeEnd("ctx");
  3100. var $1;
  3101. $1=self._ifTrue_ifFalse_((function(){
  3102. }),aBlock);
  3103. return $1;
  3104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3105. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},globals.Boolean)});
  3106. //>>excludeEnd("ctx");
  3107. },
  3108. //>>excludeStart("ide", pragmas.excludeIdeData);
  3109. args: ["aBlock"],
  3110. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3111. referencedClasses: [],
  3112. //>>excludeEnd("ide");
  3113. messageSends: ["ifTrue:ifFalse:"]
  3114. }),
  3115. globals.Boolean);
  3116. smalltalk.addMethod(
  3117. smalltalk.method({
  3118. selector: "ifFalse:ifTrue:",
  3119. protocol: 'controlling',
  3120. fn: function (aBlock,anotherBlock){
  3121. var self=this;
  3122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3123. return smalltalk.withContext(function($ctx1) {
  3124. //>>excludeEnd("ctx");
  3125. var $1;
  3126. $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3127. return $1;
  3128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3129. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)});
  3130. //>>excludeEnd("ctx");
  3131. },
  3132. //>>excludeStart("ide", pragmas.excludeIdeData);
  3133. args: ["aBlock", "anotherBlock"],
  3134. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3135. referencedClasses: [],
  3136. //>>excludeEnd("ide");
  3137. messageSends: ["ifTrue:ifFalse:"]
  3138. }),
  3139. globals.Boolean);
  3140. smalltalk.addMethod(
  3141. smalltalk.method({
  3142. selector: "ifTrue:",
  3143. protocol: 'controlling',
  3144. fn: function (aBlock){
  3145. var self=this;
  3146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3147. return smalltalk.withContext(function($ctx1) {
  3148. //>>excludeEnd("ctx");
  3149. var $1;
  3150. $1=self._ifTrue_ifFalse_(aBlock,(function(){
  3151. }));
  3152. return $1;
  3153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3154. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},globals.Boolean)});
  3155. //>>excludeEnd("ctx");
  3156. },
  3157. //>>excludeStart("ide", pragmas.excludeIdeData);
  3158. args: ["aBlock"],
  3159. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3160. referencedClasses: [],
  3161. //>>excludeEnd("ide");
  3162. messageSends: ["ifTrue:ifFalse:"]
  3163. }),
  3164. globals.Boolean);
  3165. smalltalk.addMethod(
  3166. smalltalk.method({
  3167. selector: "ifTrue:ifFalse:",
  3168. protocol: 'controlling',
  3169. fn: function (aBlock,anotherBlock){
  3170. var self=this;
  3171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3172. return smalltalk.withContext(function($ctx1) {
  3173. //>>excludeEnd("ctx");
  3174. if(self == true) {
  3175. return aBlock._value();
  3176. } else {
  3177. return anotherBlock._value();
  3178. }
  3179. ;
  3180. return self;
  3181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3182. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)});
  3183. //>>excludeEnd("ctx");
  3184. },
  3185. //>>excludeStart("ide", pragmas.excludeIdeData);
  3186. args: ["aBlock", "anotherBlock"],
  3187. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>",
  3188. referencedClasses: [],
  3189. //>>excludeEnd("ide");
  3190. messageSends: []
  3191. }),
  3192. globals.Boolean);
  3193. smalltalk.addMethod(
  3194. smalltalk.method({
  3195. selector: "isBoolean",
  3196. protocol: 'testing',
  3197. fn: function (){
  3198. var self=this;
  3199. return true;
  3200. },
  3201. //>>excludeStart("ide", pragmas.excludeIdeData);
  3202. args: [],
  3203. source: "isBoolean\x0a\x09^ true",
  3204. referencedClasses: [],
  3205. //>>excludeEnd("ide");
  3206. messageSends: []
  3207. }),
  3208. globals.Boolean);
  3209. smalltalk.addMethod(
  3210. smalltalk.method({
  3211. selector: "isImmutable",
  3212. protocol: 'testing',
  3213. fn: function (){
  3214. var self=this;
  3215. return true;
  3216. },
  3217. //>>excludeStart("ide", pragmas.excludeIdeData);
  3218. args: [],
  3219. source: "isImmutable\x0a\x09^ true",
  3220. referencedClasses: [],
  3221. //>>excludeEnd("ide");
  3222. messageSends: []
  3223. }),
  3224. globals.Boolean);
  3225. smalltalk.addMethod(
  3226. smalltalk.method({
  3227. selector: "not",
  3228. protocol: 'controlling',
  3229. fn: function (){
  3230. var self=this;
  3231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3232. return smalltalk.withContext(function($ctx1) {
  3233. //>>excludeEnd("ctx");
  3234. var $1;
  3235. $1=self.__eq(false);
  3236. return $1;
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. }, function($ctx1) {$ctx1.fill(self,"not",{},globals.Boolean)});
  3239. //>>excludeEnd("ctx");
  3240. },
  3241. //>>excludeStart("ide", pragmas.excludeIdeData);
  3242. args: [],
  3243. source: "not\x0a\x09^ self = false",
  3244. referencedClasses: [],
  3245. //>>excludeEnd("ide");
  3246. messageSends: ["="]
  3247. }),
  3248. globals.Boolean);
  3249. smalltalk.addMethod(
  3250. smalltalk.method({
  3251. selector: "or:",
  3252. protocol: 'controlling',
  3253. fn: function (aBlock){
  3254. var self=this;
  3255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3256. return smalltalk.withContext(function($ctx1) {
  3257. //>>excludeEnd("ctx");
  3258. var $2,$1;
  3259. $2=self.__eq(true);
  3260. $1=_st($2)._ifTrue_ifFalse_((function(){
  3261. return true;
  3262. }),aBlock);
  3263. return $1;
  3264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3265. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},globals.Boolean)});
  3266. //>>excludeEnd("ctx");
  3267. },
  3268. //>>excludeStart("ide", pragmas.excludeIdeData);
  3269. args: ["aBlock"],
  3270. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  3271. referencedClasses: [],
  3272. //>>excludeEnd("ide");
  3273. messageSends: ["ifTrue:ifFalse:", "="]
  3274. }),
  3275. globals.Boolean);
  3276. smalltalk.addMethod(
  3277. smalltalk.method({
  3278. selector: "printOn:",
  3279. protocol: 'printing',
  3280. fn: function (aStream){
  3281. var self=this;
  3282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3283. return smalltalk.withContext(function($ctx1) {
  3284. //>>excludeEnd("ctx");
  3285. _st(aStream)._nextPutAll_(self._asString());
  3286. return self;
  3287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3288. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Boolean)});
  3289. //>>excludeEnd("ctx");
  3290. },
  3291. //>>excludeStart("ide", pragmas.excludeIdeData);
  3292. args: ["aStream"],
  3293. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3294. referencedClasses: [],
  3295. //>>excludeEnd("ide");
  3296. messageSends: ["nextPutAll:", "asString"]
  3297. }),
  3298. globals.Boolean);
  3299. smalltalk.addMethod(
  3300. smalltalk.method({
  3301. selector: "shallowCopy",
  3302. protocol: 'copying',
  3303. fn: function (){
  3304. var self=this;
  3305. return self;
  3306. },
  3307. //>>excludeStart("ide", pragmas.excludeIdeData);
  3308. args: [],
  3309. source: "shallowCopy\x0a\x09^ self",
  3310. referencedClasses: [],
  3311. //>>excludeEnd("ide");
  3312. messageSends: []
  3313. }),
  3314. globals.Boolean);
  3315. smalltalk.addMethod(
  3316. smalltalk.method({
  3317. selector: "|",
  3318. protocol: 'controlling',
  3319. fn: function (aBoolean){
  3320. var self=this;
  3321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3322. return smalltalk.withContext(function($ctx1) {
  3323. //>>excludeEnd("ctx");
  3324. if(self == true) {
  3325. return true;
  3326. } else {
  3327. return aBoolean;
  3328. }
  3329. ;
  3330. return self;
  3331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3332. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},globals.Boolean)});
  3333. //>>excludeEnd("ctx");
  3334. },
  3335. //>>excludeStart("ide", pragmas.excludeIdeData);
  3336. args: ["aBoolean"],
  3337. 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>",
  3338. referencedClasses: [],
  3339. //>>excludeEnd("ide");
  3340. messageSends: []
  3341. }),
  3342. globals.Boolean);
  3343. smalltalk.addClass('Date', globals.Object, [], 'Kernel-Objects');
  3344. //>>excludeStart("ide", pragmas.excludeIdeData);
  3345. globals.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
  3346. //>>excludeEnd("ide");
  3347. smalltalk.addMethod(
  3348. smalltalk.method({
  3349. selector: "+",
  3350. protocol: 'arithmetic',
  3351. fn: function (aDate){
  3352. var self=this;
  3353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3354. return smalltalk.withContext(function($ctx1) {
  3355. //>>excludeEnd("ctx");
  3356. return self + aDate;
  3357. return self;
  3358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3359. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},globals.Date)});
  3360. //>>excludeEnd("ctx");
  3361. },
  3362. //>>excludeStart("ide", pragmas.excludeIdeData);
  3363. args: ["aDate"],
  3364. source: "+ aDate\x0a\x09<return self + aDate>",
  3365. referencedClasses: [],
  3366. //>>excludeEnd("ide");
  3367. messageSends: []
  3368. }),
  3369. globals.Date);
  3370. smalltalk.addMethod(
  3371. smalltalk.method({
  3372. selector: "-",
  3373. protocol: 'arithmetic',
  3374. fn: function (aDate){
  3375. var self=this;
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. return smalltalk.withContext(function($ctx1) {
  3378. //>>excludeEnd("ctx");
  3379. return self - aDate;
  3380. return self;
  3381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3382. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},globals.Date)});
  3383. //>>excludeEnd("ctx");
  3384. },
  3385. //>>excludeStart("ide", pragmas.excludeIdeData);
  3386. args: ["aDate"],
  3387. source: "- aDate\x0a\x09<return self - aDate>",
  3388. referencedClasses: [],
  3389. //>>excludeEnd("ide");
  3390. messageSends: []
  3391. }),
  3392. globals.Date);
  3393. smalltalk.addMethod(
  3394. smalltalk.method({
  3395. selector: "<",
  3396. protocol: 'comparing',
  3397. fn: function (aDate){
  3398. var self=this;
  3399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3400. return smalltalk.withContext(function($ctx1) {
  3401. //>>excludeEnd("ctx");
  3402. return self < aDate;
  3403. return self;
  3404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3405. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},globals.Date)});
  3406. //>>excludeEnd("ctx");
  3407. },
  3408. //>>excludeStart("ide", pragmas.excludeIdeData);
  3409. args: ["aDate"],
  3410. source: "< aDate\x0a\x09<return self < aDate>",
  3411. referencedClasses: [],
  3412. //>>excludeEnd("ide");
  3413. messageSends: []
  3414. }),
  3415. globals.Date);
  3416. smalltalk.addMethod(
  3417. smalltalk.method({
  3418. selector: "<=",
  3419. protocol: 'comparing',
  3420. fn: function (aDate){
  3421. var self=this;
  3422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3423. return smalltalk.withContext(function($ctx1) {
  3424. //>>excludeEnd("ctx");
  3425. return self <= aDate;
  3426. return self;
  3427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3428. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},globals.Date)});
  3429. //>>excludeEnd("ctx");
  3430. },
  3431. //>>excludeStart("ide", pragmas.excludeIdeData);
  3432. args: ["aDate"],
  3433. source: "<= aDate\x0a\x09<return self <= aDate>",
  3434. referencedClasses: [],
  3435. //>>excludeEnd("ide");
  3436. messageSends: []
  3437. }),
  3438. globals.Date);
  3439. smalltalk.addMethod(
  3440. smalltalk.method({
  3441. selector: ">",
  3442. protocol: 'comparing',
  3443. fn: function (aDate){
  3444. var self=this;
  3445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3446. return smalltalk.withContext(function($ctx1) {
  3447. //>>excludeEnd("ctx");
  3448. return self > aDate;
  3449. return self;
  3450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3451. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},globals.Date)});
  3452. //>>excludeEnd("ctx");
  3453. },
  3454. //>>excludeStart("ide", pragmas.excludeIdeData);
  3455. args: ["aDate"],
  3456. source: "> aDate\x0a\x09<return self >> aDate>",
  3457. referencedClasses: [],
  3458. //>>excludeEnd("ide");
  3459. messageSends: []
  3460. }),
  3461. globals.Date);
  3462. smalltalk.addMethod(
  3463. smalltalk.method({
  3464. selector: ">=",
  3465. protocol: 'comparing',
  3466. fn: function (aDate){
  3467. var self=this;
  3468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3469. return smalltalk.withContext(function($ctx1) {
  3470. //>>excludeEnd("ctx");
  3471. return self >= aDate;
  3472. return self;
  3473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3474. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},globals.Date)});
  3475. //>>excludeEnd("ctx");
  3476. },
  3477. //>>excludeStart("ide", pragmas.excludeIdeData);
  3478. args: ["aDate"],
  3479. source: ">= aDate\x0a\x09<return self >>= aDate>",
  3480. referencedClasses: [],
  3481. //>>excludeEnd("ide");
  3482. messageSends: []
  3483. }),
  3484. globals.Date);
  3485. smalltalk.addMethod(
  3486. smalltalk.method({
  3487. selector: "asDateString",
  3488. protocol: 'converting',
  3489. fn: function (){
  3490. var self=this;
  3491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3492. return smalltalk.withContext(function($ctx1) {
  3493. //>>excludeEnd("ctx");
  3494. return self.toDateString();
  3495. return self;
  3496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3497. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},globals.Date)});
  3498. //>>excludeEnd("ctx");
  3499. },
  3500. //>>excludeStart("ide", pragmas.excludeIdeData);
  3501. args: [],
  3502. source: "asDateString\x0a\x09<return self.toDateString()>",
  3503. referencedClasses: [],
  3504. //>>excludeEnd("ide");
  3505. messageSends: []
  3506. }),
  3507. globals.Date);
  3508. smalltalk.addMethod(
  3509. smalltalk.method({
  3510. selector: "asLocaleString",
  3511. protocol: 'converting',
  3512. fn: function (){
  3513. var self=this;
  3514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3515. return smalltalk.withContext(function($ctx1) {
  3516. //>>excludeEnd("ctx");
  3517. return self.toLocaleString();
  3518. return self;
  3519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3520. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},globals.Date)});
  3521. //>>excludeEnd("ctx");
  3522. },
  3523. //>>excludeStart("ide", pragmas.excludeIdeData);
  3524. args: [],
  3525. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  3526. referencedClasses: [],
  3527. //>>excludeEnd("ide");
  3528. messageSends: []
  3529. }),
  3530. globals.Date);
  3531. smalltalk.addMethod(
  3532. smalltalk.method({
  3533. selector: "asMilliseconds",
  3534. protocol: 'converting',
  3535. fn: function (){
  3536. var self=this;
  3537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3538. return smalltalk.withContext(function($ctx1) {
  3539. //>>excludeEnd("ctx");
  3540. var $1;
  3541. $1=self._time();
  3542. return $1;
  3543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3544. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},globals.Date)});
  3545. //>>excludeEnd("ctx");
  3546. },
  3547. //>>excludeStart("ide", pragmas.excludeIdeData);
  3548. args: [],
  3549. source: "asMilliseconds\x0a\x09^ self time",
  3550. referencedClasses: [],
  3551. //>>excludeEnd("ide");
  3552. messageSends: ["time"]
  3553. }),
  3554. globals.Date);
  3555. smalltalk.addMethod(
  3556. smalltalk.method({
  3557. selector: "asNumber",
  3558. protocol: 'converting',
  3559. fn: function (){
  3560. var self=this;
  3561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3562. return smalltalk.withContext(function($ctx1) {
  3563. //>>excludeEnd("ctx");
  3564. var $1;
  3565. $1=self._asMilliseconds();
  3566. return $1;
  3567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3568. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.Date)});
  3569. //>>excludeEnd("ctx");
  3570. },
  3571. //>>excludeStart("ide", pragmas.excludeIdeData);
  3572. args: [],
  3573. source: "asNumber\x0a\x09^ self asMilliseconds",
  3574. referencedClasses: [],
  3575. //>>excludeEnd("ide");
  3576. messageSends: ["asMilliseconds"]
  3577. }),
  3578. globals.Date);
  3579. smalltalk.addMethod(
  3580. smalltalk.method({
  3581. selector: "asString",
  3582. protocol: 'converting',
  3583. fn: function (){
  3584. var self=this;
  3585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3586. return smalltalk.withContext(function($ctx1) {
  3587. //>>excludeEnd("ctx");
  3588. return self.toString();
  3589. return self;
  3590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3591. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Date)});
  3592. //>>excludeEnd("ctx");
  3593. },
  3594. //>>excludeStart("ide", pragmas.excludeIdeData);
  3595. args: [],
  3596. source: "asString\x0a\x09<return self.toString()>",
  3597. referencedClasses: [],
  3598. //>>excludeEnd("ide");
  3599. messageSends: []
  3600. }),
  3601. globals.Date);
  3602. smalltalk.addMethod(
  3603. smalltalk.method({
  3604. selector: "asTimeString",
  3605. protocol: 'converting',
  3606. fn: function (){
  3607. var self=this;
  3608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3609. return smalltalk.withContext(function($ctx1) {
  3610. //>>excludeEnd("ctx");
  3611. return self.toTimeString();
  3612. return self;
  3613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3614. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},globals.Date)});
  3615. //>>excludeEnd("ctx");
  3616. },
  3617. //>>excludeStart("ide", pragmas.excludeIdeData);
  3618. args: [],
  3619. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  3620. referencedClasses: [],
  3621. //>>excludeEnd("ide");
  3622. messageSends: []
  3623. }),
  3624. globals.Date);
  3625. smalltalk.addMethod(
  3626. smalltalk.method({
  3627. selector: "day",
  3628. protocol: 'accessing',
  3629. fn: function (){
  3630. var self=this;
  3631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3632. return smalltalk.withContext(function($ctx1) {
  3633. //>>excludeEnd("ctx");
  3634. var $1;
  3635. $1=self._dayOfWeek();
  3636. return $1;
  3637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3638. }, function($ctx1) {$ctx1.fill(self,"day",{},globals.Date)});
  3639. //>>excludeEnd("ctx");
  3640. },
  3641. //>>excludeStart("ide", pragmas.excludeIdeData);
  3642. args: [],
  3643. source: "day\x0a\x09^ self dayOfWeek",
  3644. referencedClasses: [],
  3645. //>>excludeEnd("ide");
  3646. messageSends: ["dayOfWeek"]
  3647. }),
  3648. globals.Date);
  3649. smalltalk.addMethod(
  3650. smalltalk.method({
  3651. selector: "day:",
  3652. protocol: 'accessing',
  3653. fn: function (aNumber){
  3654. var self=this;
  3655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3656. return smalltalk.withContext(function($ctx1) {
  3657. //>>excludeEnd("ctx");
  3658. self._dayOfWeek_(aNumber);
  3659. return self;
  3660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3661. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},globals.Date)});
  3662. //>>excludeEnd("ctx");
  3663. },
  3664. //>>excludeStart("ide", pragmas.excludeIdeData);
  3665. args: ["aNumber"],
  3666. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3667. referencedClasses: [],
  3668. //>>excludeEnd("ide");
  3669. messageSends: ["dayOfWeek:"]
  3670. }),
  3671. globals.Date);
  3672. smalltalk.addMethod(
  3673. smalltalk.method({
  3674. selector: "dayOfMonth",
  3675. protocol: 'accessing',
  3676. fn: function (){
  3677. var self=this;
  3678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3679. return smalltalk.withContext(function($ctx1) {
  3680. //>>excludeEnd("ctx");
  3681. return self.getDate();
  3682. return self;
  3683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3684. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},globals.Date)});
  3685. //>>excludeEnd("ctx");
  3686. },
  3687. //>>excludeStart("ide", pragmas.excludeIdeData);
  3688. args: [],
  3689. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  3690. referencedClasses: [],
  3691. //>>excludeEnd("ide");
  3692. messageSends: []
  3693. }),
  3694. globals.Date);
  3695. smalltalk.addMethod(
  3696. smalltalk.method({
  3697. selector: "dayOfMonth:",
  3698. protocol: 'accessing',
  3699. fn: function (aNumber){
  3700. var self=this;
  3701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3702. return smalltalk.withContext(function($ctx1) {
  3703. //>>excludeEnd("ctx");
  3704. self.setDate(aNumber);
  3705. return self;
  3706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3707. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},globals.Date)});
  3708. //>>excludeEnd("ctx");
  3709. },
  3710. //>>excludeStart("ide", pragmas.excludeIdeData);
  3711. args: ["aNumber"],
  3712. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  3713. referencedClasses: [],
  3714. //>>excludeEnd("ide");
  3715. messageSends: []
  3716. }),
  3717. globals.Date);
  3718. smalltalk.addMethod(
  3719. smalltalk.method({
  3720. selector: "dayOfWeek",
  3721. protocol: 'accessing',
  3722. fn: function (){
  3723. var self=this;
  3724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3725. return smalltalk.withContext(function($ctx1) {
  3726. //>>excludeEnd("ctx");
  3727. return self.getDay() + 1;
  3728. return self;
  3729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3730. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},globals.Date)});
  3731. //>>excludeEnd("ctx");
  3732. },
  3733. //>>excludeStart("ide", pragmas.excludeIdeData);
  3734. args: [],
  3735. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  3736. referencedClasses: [],
  3737. //>>excludeEnd("ide");
  3738. messageSends: []
  3739. }),
  3740. globals.Date);
  3741. smalltalk.addMethod(
  3742. smalltalk.method({
  3743. selector: "dayOfWeek:",
  3744. protocol: 'accessing',
  3745. fn: function (aNumber){
  3746. var self=this;
  3747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3748. return smalltalk.withContext(function($ctx1) {
  3749. //>>excludeEnd("ctx");
  3750. return self.setDay(aNumber - 1);
  3751. return self;
  3752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3753. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},globals.Date)});
  3754. //>>excludeEnd("ctx");
  3755. },
  3756. //>>excludeStart("ide", pragmas.excludeIdeData);
  3757. args: ["aNumber"],
  3758. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  3759. referencedClasses: [],
  3760. //>>excludeEnd("ide");
  3761. messageSends: []
  3762. }),
  3763. globals.Date);
  3764. smalltalk.addMethod(
  3765. smalltalk.method({
  3766. selector: "hours",
  3767. protocol: 'accessing',
  3768. fn: function (){
  3769. var self=this;
  3770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3771. return smalltalk.withContext(function($ctx1) {
  3772. //>>excludeEnd("ctx");
  3773. return self.getHours();
  3774. return self;
  3775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3776. }, function($ctx1) {$ctx1.fill(self,"hours",{},globals.Date)});
  3777. //>>excludeEnd("ctx");
  3778. },
  3779. //>>excludeStart("ide", pragmas.excludeIdeData);
  3780. args: [],
  3781. source: "hours\x0a\x09<return self.getHours()>",
  3782. referencedClasses: [],
  3783. //>>excludeEnd("ide");
  3784. messageSends: []
  3785. }),
  3786. globals.Date);
  3787. smalltalk.addMethod(
  3788. smalltalk.method({
  3789. selector: "hours:",
  3790. protocol: 'accessing',
  3791. fn: function (aNumber){
  3792. var self=this;
  3793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3794. return smalltalk.withContext(function($ctx1) {
  3795. //>>excludeEnd("ctx");
  3796. self.setHours(aNumber);
  3797. return self;
  3798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3799. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},globals.Date)});
  3800. //>>excludeEnd("ctx");
  3801. },
  3802. //>>excludeStart("ide", pragmas.excludeIdeData);
  3803. args: ["aNumber"],
  3804. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3805. referencedClasses: [],
  3806. //>>excludeEnd("ide");
  3807. messageSends: []
  3808. }),
  3809. globals.Date);
  3810. smalltalk.addMethod(
  3811. smalltalk.method({
  3812. selector: "milliseconds",
  3813. protocol: 'accessing',
  3814. fn: function (){
  3815. var self=this;
  3816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3817. return smalltalk.withContext(function($ctx1) {
  3818. //>>excludeEnd("ctx");
  3819. return self.getMilliseconds();
  3820. return self;
  3821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3822. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},globals.Date)});
  3823. //>>excludeEnd("ctx");
  3824. },
  3825. //>>excludeStart("ide", pragmas.excludeIdeData);
  3826. args: [],
  3827. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3828. referencedClasses: [],
  3829. //>>excludeEnd("ide");
  3830. messageSends: []
  3831. }),
  3832. globals.Date);
  3833. smalltalk.addMethod(
  3834. smalltalk.method({
  3835. selector: "milliseconds:",
  3836. protocol: 'accessing',
  3837. fn: function (aNumber){
  3838. var self=this;
  3839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3840. return smalltalk.withContext(function($ctx1) {
  3841. //>>excludeEnd("ctx");
  3842. self.setMilliseconds(aNumber);
  3843. return self;
  3844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3845. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},globals.Date)});
  3846. //>>excludeEnd("ctx");
  3847. },
  3848. //>>excludeStart("ide", pragmas.excludeIdeData);
  3849. args: ["aNumber"],
  3850. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3851. referencedClasses: [],
  3852. //>>excludeEnd("ide");
  3853. messageSends: []
  3854. }),
  3855. globals.Date);
  3856. smalltalk.addMethod(
  3857. smalltalk.method({
  3858. selector: "minutes",
  3859. protocol: 'accessing',
  3860. fn: function (){
  3861. var self=this;
  3862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3863. return smalltalk.withContext(function($ctx1) {
  3864. //>>excludeEnd("ctx");
  3865. return self.getMinutes();
  3866. return self;
  3867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3868. }, function($ctx1) {$ctx1.fill(self,"minutes",{},globals.Date)});
  3869. //>>excludeEnd("ctx");
  3870. },
  3871. //>>excludeStart("ide", pragmas.excludeIdeData);
  3872. args: [],
  3873. source: "minutes\x0a\x09<return self.getMinutes()>",
  3874. referencedClasses: [],
  3875. //>>excludeEnd("ide");
  3876. messageSends: []
  3877. }),
  3878. globals.Date);
  3879. smalltalk.addMethod(
  3880. smalltalk.method({
  3881. selector: "minutes:",
  3882. protocol: 'accessing',
  3883. fn: function (aNumber){
  3884. var self=this;
  3885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3886. return smalltalk.withContext(function($ctx1) {
  3887. //>>excludeEnd("ctx");
  3888. self.setMinutes(aNumber);
  3889. return self;
  3890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3891. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},globals.Date)});
  3892. //>>excludeEnd("ctx");
  3893. },
  3894. //>>excludeStart("ide", pragmas.excludeIdeData);
  3895. args: ["aNumber"],
  3896. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3897. referencedClasses: [],
  3898. //>>excludeEnd("ide");
  3899. messageSends: []
  3900. }),
  3901. globals.Date);
  3902. smalltalk.addMethod(
  3903. smalltalk.method({
  3904. selector: "month",
  3905. protocol: 'accessing',
  3906. fn: function (){
  3907. var self=this;
  3908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3909. return smalltalk.withContext(function($ctx1) {
  3910. //>>excludeEnd("ctx");
  3911. return self.getMonth() + 1;
  3912. return self;
  3913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3914. }, function($ctx1) {$ctx1.fill(self,"month",{},globals.Date)});
  3915. //>>excludeEnd("ctx");
  3916. },
  3917. //>>excludeStart("ide", pragmas.excludeIdeData);
  3918. args: [],
  3919. source: "month\x0a\x09<return self.getMonth() + 1>",
  3920. referencedClasses: [],
  3921. //>>excludeEnd("ide");
  3922. messageSends: []
  3923. }),
  3924. globals.Date);
  3925. smalltalk.addMethod(
  3926. smalltalk.method({
  3927. selector: "month:",
  3928. protocol: 'accessing',
  3929. fn: function (aNumber){
  3930. var self=this;
  3931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3932. return smalltalk.withContext(function($ctx1) {
  3933. //>>excludeEnd("ctx");
  3934. self.setMonth(aNumber - 1);
  3935. return self;
  3936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3937. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},globals.Date)});
  3938. //>>excludeEnd("ctx");
  3939. },
  3940. //>>excludeStart("ide", pragmas.excludeIdeData);
  3941. args: ["aNumber"],
  3942. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3943. referencedClasses: [],
  3944. //>>excludeEnd("ide");
  3945. messageSends: []
  3946. }),
  3947. globals.Date);
  3948. smalltalk.addMethod(
  3949. smalltalk.method({
  3950. selector: "printOn:",
  3951. protocol: 'printing',
  3952. fn: function (aStream){
  3953. var self=this;
  3954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3955. return smalltalk.withContext(function($ctx1) {
  3956. //>>excludeEnd("ctx");
  3957. _st(aStream)._nextPutAll_(self._asString());
  3958. return self;
  3959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3960. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Date)});
  3961. //>>excludeEnd("ctx");
  3962. },
  3963. //>>excludeStart("ide", pragmas.excludeIdeData);
  3964. args: ["aStream"],
  3965. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3966. referencedClasses: [],
  3967. //>>excludeEnd("ide");
  3968. messageSends: ["nextPutAll:", "asString"]
  3969. }),
  3970. globals.Date);
  3971. smalltalk.addMethod(
  3972. smalltalk.method({
  3973. selector: "seconds",
  3974. protocol: 'accessing',
  3975. fn: function (){
  3976. var self=this;
  3977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3978. return smalltalk.withContext(function($ctx1) {
  3979. //>>excludeEnd("ctx");
  3980. return self.getSeconds();
  3981. return self;
  3982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3983. }, function($ctx1) {$ctx1.fill(self,"seconds",{},globals.Date)});
  3984. //>>excludeEnd("ctx");
  3985. },
  3986. //>>excludeStart("ide", pragmas.excludeIdeData);
  3987. args: [],
  3988. source: "seconds\x0a\x09<return self.getSeconds()>",
  3989. referencedClasses: [],
  3990. //>>excludeEnd("ide");
  3991. messageSends: []
  3992. }),
  3993. globals.Date);
  3994. smalltalk.addMethod(
  3995. smalltalk.method({
  3996. selector: "seconds:",
  3997. protocol: 'accessing',
  3998. fn: function (aNumber){
  3999. var self=this;
  4000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4001. return smalltalk.withContext(function($ctx1) {
  4002. //>>excludeEnd("ctx");
  4003. self.setSeconds(aNumber);
  4004. return self;
  4005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4006. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},globals.Date)});
  4007. //>>excludeEnd("ctx");
  4008. },
  4009. //>>excludeStart("ide", pragmas.excludeIdeData);
  4010. args: ["aNumber"],
  4011. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  4012. referencedClasses: [],
  4013. //>>excludeEnd("ide");
  4014. messageSends: []
  4015. }),
  4016. globals.Date);
  4017. smalltalk.addMethod(
  4018. smalltalk.method({
  4019. selector: "time",
  4020. protocol: 'accessing',
  4021. fn: function (){
  4022. var self=this;
  4023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4024. return smalltalk.withContext(function($ctx1) {
  4025. //>>excludeEnd("ctx");
  4026. return self.getTime();
  4027. return self;
  4028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4029. }, function($ctx1) {$ctx1.fill(self,"time",{},globals.Date)});
  4030. //>>excludeEnd("ctx");
  4031. },
  4032. //>>excludeStart("ide", pragmas.excludeIdeData);
  4033. args: [],
  4034. source: "time\x0a\x09<return self.getTime()>",
  4035. referencedClasses: [],
  4036. //>>excludeEnd("ide");
  4037. messageSends: []
  4038. }),
  4039. globals.Date);
  4040. smalltalk.addMethod(
  4041. smalltalk.method({
  4042. selector: "time:",
  4043. protocol: 'accessing',
  4044. fn: function (aNumber){
  4045. var self=this;
  4046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4047. return smalltalk.withContext(function($ctx1) {
  4048. //>>excludeEnd("ctx");
  4049. self.setTime(aNumber);
  4050. return self;
  4051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4052. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},globals.Date)});
  4053. //>>excludeEnd("ctx");
  4054. },
  4055. //>>excludeStart("ide", pragmas.excludeIdeData);
  4056. args: ["aNumber"],
  4057. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  4058. referencedClasses: [],
  4059. //>>excludeEnd("ide");
  4060. messageSends: []
  4061. }),
  4062. globals.Date);
  4063. smalltalk.addMethod(
  4064. smalltalk.method({
  4065. selector: "year",
  4066. protocol: 'accessing',
  4067. fn: function (){
  4068. var self=this;
  4069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4070. return smalltalk.withContext(function($ctx1) {
  4071. //>>excludeEnd("ctx");
  4072. return self.getFullYear();
  4073. return self;
  4074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4075. }, function($ctx1) {$ctx1.fill(self,"year",{},globals.Date)});
  4076. //>>excludeEnd("ctx");
  4077. },
  4078. //>>excludeStart("ide", pragmas.excludeIdeData);
  4079. args: [],
  4080. source: "year\x0a\x09<return self.getFullYear()>",
  4081. referencedClasses: [],
  4082. //>>excludeEnd("ide");
  4083. messageSends: []
  4084. }),
  4085. globals.Date);
  4086. smalltalk.addMethod(
  4087. smalltalk.method({
  4088. selector: "year:",
  4089. protocol: 'accessing',
  4090. fn: function (aNumber){
  4091. var self=this;
  4092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4093. return smalltalk.withContext(function($ctx1) {
  4094. //>>excludeEnd("ctx");
  4095. self.setFullYear(aNumber);
  4096. return self;
  4097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4098. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},globals.Date)});
  4099. //>>excludeEnd("ctx");
  4100. },
  4101. //>>excludeStart("ide", pragmas.excludeIdeData);
  4102. args: ["aNumber"],
  4103. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  4104. referencedClasses: [],
  4105. //>>excludeEnd("ide");
  4106. messageSends: []
  4107. }),
  4108. globals.Date);
  4109. smalltalk.addMethod(
  4110. smalltalk.method({
  4111. selector: "fromMilliseconds:",
  4112. protocol: 'instance creation',
  4113. fn: function (aNumber){
  4114. var self=this;
  4115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4116. return smalltalk.withContext(function($ctx1) {
  4117. //>>excludeEnd("ctx");
  4118. var $1;
  4119. $1=self._new_(aNumber);
  4120. return $1;
  4121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4122. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},globals.Date.klass)});
  4123. //>>excludeEnd("ctx");
  4124. },
  4125. //>>excludeStart("ide", pragmas.excludeIdeData);
  4126. args: ["aNumber"],
  4127. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4128. referencedClasses: [],
  4129. //>>excludeEnd("ide");
  4130. messageSends: ["new:"]
  4131. }),
  4132. globals.Date.klass);
  4133. smalltalk.addMethod(
  4134. smalltalk.method({
  4135. selector: "fromSeconds:",
  4136. protocol: 'instance creation',
  4137. fn: function (aNumber){
  4138. var self=this;
  4139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4140. return smalltalk.withContext(function($ctx1) {
  4141. //>>excludeEnd("ctx");
  4142. var $1;
  4143. $1=self._fromMilliseconds_(_st(aNumber).__star((1000)));
  4144. return $1;
  4145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4146. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},globals.Date.klass)});
  4147. //>>excludeEnd("ctx");
  4148. },
  4149. //>>excludeStart("ide", pragmas.excludeIdeData);
  4150. args: ["aNumber"],
  4151. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4152. referencedClasses: [],
  4153. //>>excludeEnd("ide");
  4154. messageSends: ["fromMilliseconds:", "*"]
  4155. }),
  4156. globals.Date.klass);
  4157. smalltalk.addMethod(
  4158. smalltalk.method({
  4159. selector: "fromString:",
  4160. protocol: 'instance creation',
  4161. fn: function (aString){
  4162. var self=this;
  4163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4164. return smalltalk.withContext(function($ctx1) {
  4165. //>>excludeEnd("ctx");
  4166. var $1;
  4167. $1=self._new_(aString);
  4168. return $1;
  4169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4170. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.Date.klass)});
  4171. //>>excludeEnd("ctx");
  4172. },
  4173. //>>excludeStart("ide", pragmas.excludeIdeData);
  4174. args: ["aString"],
  4175. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4176. referencedClasses: [],
  4177. //>>excludeEnd("ide");
  4178. messageSends: ["new:"]
  4179. }),
  4180. globals.Date.klass);
  4181. smalltalk.addMethod(
  4182. smalltalk.method({
  4183. selector: "heliosClass",
  4184. protocol: 'helios',
  4185. fn: function (){
  4186. var self=this;
  4187. return "magnitude";
  4188. },
  4189. //>>excludeStart("ide", pragmas.excludeIdeData);
  4190. args: [],
  4191. source: "heliosClass\x0a\x09^ 'magnitude'",
  4192. referencedClasses: [],
  4193. //>>excludeEnd("ide");
  4194. messageSends: []
  4195. }),
  4196. globals.Date.klass);
  4197. smalltalk.addMethod(
  4198. smalltalk.method({
  4199. selector: "millisecondsToRun:",
  4200. protocol: 'instance creation',
  4201. fn: function (aBlock){
  4202. var self=this;
  4203. var t;
  4204. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  4205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4206. return smalltalk.withContext(function($ctx1) {
  4207. //>>excludeEnd("ctx");
  4208. var $1;
  4209. t=_st($Date())._now();
  4210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4211. $ctx1.sendIdx["now"]=1;
  4212. //>>excludeEnd("ctx");
  4213. _st(aBlock)._value();
  4214. $1=_st(_st($Date())._now()).__minus(t);
  4215. return $1;
  4216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4217. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},globals.Date.klass)});
  4218. //>>excludeEnd("ctx");
  4219. },
  4220. //>>excludeStart("ide", pragmas.excludeIdeData);
  4221. args: ["aBlock"],
  4222. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4223. referencedClasses: ["Date"],
  4224. //>>excludeEnd("ide");
  4225. messageSends: ["now", "value", "-"]
  4226. }),
  4227. globals.Date.klass);
  4228. smalltalk.addMethod(
  4229. smalltalk.method({
  4230. selector: "new:",
  4231. protocol: 'instance creation',
  4232. fn: function (anObject){
  4233. var self=this;
  4234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4235. return smalltalk.withContext(function($ctx1) {
  4236. //>>excludeEnd("ctx");
  4237. return new Date(anObject);
  4238. return self;
  4239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4240. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},globals.Date.klass)});
  4241. //>>excludeEnd("ctx");
  4242. },
  4243. //>>excludeStart("ide", pragmas.excludeIdeData);
  4244. args: ["anObject"],
  4245. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  4246. referencedClasses: [],
  4247. //>>excludeEnd("ide");
  4248. messageSends: []
  4249. }),
  4250. globals.Date.klass);
  4251. smalltalk.addMethod(
  4252. smalltalk.method({
  4253. selector: "now",
  4254. protocol: 'instance creation',
  4255. fn: function (){
  4256. var self=this;
  4257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4258. return smalltalk.withContext(function($ctx1) {
  4259. //>>excludeEnd("ctx");
  4260. var $1;
  4261. $1=self._today();
  4262. return $1;
  4263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4264. }, function($ctx1) {$ctx1.fill(self,"now",{},globals.Date.klass)});
  4265. //>>excludeEnd("ctx");
  4266. },
  4267. //>>excludeStart("ide", pragmas.excludeIdeData);
  4268. args: [],
  4269. source: "now\x0a\x09^ self today",
  4270. referencedClasses: [],
  4271. //>>excludeEnd("ide");
  4272. messageSends: ["today"]
  4273. }),
  4274. globals.Date.klass);
  4275. smalltalk.addMethod(
  4276. smalltalk.method({
  4277. selector: "today",
  4278. protocol: 'instance creation',
  4279. fn: function (){
  4280. var self=this;
  4281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4282. return smalltalk.withContext(function($ctx1) {
  4283. //>>excludeEnd("ctx");
  4284. var $1;
  4285. $1=self._new();
  4286. return $1;
  4287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4288. }, function($ctx1) {$ctx1.fill(self,"today",{},globals.Date.klass)});
  4289. //>>excludeEnd("ctx");
  4290. },
  4291. //>>excludeStart("ide", pragmas.excludeIdeData);
  4292. args: [],
  4293. source: "today\x0a\x09^ self new",
  4294. referencedClasses: [],
  4295. //>>excludeEnd("ide");
  4296. messageSends: ["new"]
  4297. }),
  4298. globals.Date.klass);
  4299. smalltalk.addClass('Number', globals.Object, [], 'Kernel-Objects');
  4300. //>>excludeStart("ide", pragmas.excludeIdeData);
  4301. globals.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also 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 ].";
  4302. //>>excludeEnd("ide");
  4303. smalltalk.addMethod(
  4304. smalltalk.method({
  4305. selector: "&",
  4306. protocol: 'converting',
  4307. fn: function (aNumber){
  4308. var self=this;
  4309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4310. return smalltalk.withContext(function($ctx1) {
  4311. //>>excludeEnd("ctx");
  4312. return self & aNumber;
  4313. return self;
  4314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4315. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},globals.Number)});
  4316. //>>excludeEnd("ctx");
  4317. },
  4318. //>>excludeStart("ide", pragmas.excludeIdeData);
  4319. args: ["aNumber"],
  4320. source: "& aNumber\x0a\x09<return self & aNumber>",
  4321. referencedClasses: [],
  4322. //>>excludeEnd("ide");
  4323. messageSends: []
  4324. }),
  4325. globals.Number);
  4326. smalltalk.addMethod(
  4327. smalltalk.method({
  4328. selector: "*",
  4329. protocol: 'arithmetic',
  4330. fn: function (aNumber){
  4331. var self=this;
  4332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4333. return smalltalk.withContext(function($ctx1) {
  4334. //>>excludeEnd("ctx");
  4335. return self * aNumber;
  4336. return self;
  4337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4338. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},globals.Number)});
  4339. //>>excludeEnd("ctx");
  4340. },
  4341. //>>excludeStart("ide", pragmas.excludeIdeData);
  4342. args: ["aNumber"],
  4343. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  4344. referencedClasses: [],
  4345. //>>excludeEnd("ide");
  4346. messageSends: []
  4347. }),
  4348. globals.Number);
  4349. smalltalk.addMethod(
  4350. smalltalk.method({
  4351. selector: "**",
  4352. protocol: 'mathematical functions',
  4353. fn: function (exponent){
  4354. var self=this;
  4355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4356. return smalltalk.withContext(function($ctx1) {
  4357. //>>excludeEnd("ctx");
  4358. var $1;
  4359. $1=self._raisedTo_(exponent);
  4360. return $1;
  4361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4362. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},globals.Number)});
  4363. //>>excludeEnd("ctx");
  4364. },
  4365. //>>excludeStart("ide", pragmas.excludeIdeData);
  4366. args: ["exponent"],
  4367. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4368. referencedClasses: [],
  4369. //>>excludeEnd("ide");
  4370. messageSends: ["raisedTo:"]
  4371. }),
  4372. globals.Number);
  4373. smalltalk.addMethod(
  4374. smalltalk.method({
  4375. selector: "+",
  4376. protocol: 'arithmetic',
  4377. fn: function (aNumber){
  4378. var self=this;
  4379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4380. return smalltalk.withContext(function($ctx1) {
  4381. //>>excludeEnd("ctx");
  4382. return self + aNumber;
  4383. return self;
  4384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4385. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},globals.Number)});
  4386. //>>excludeEnd("ctx");
  4387. },
  4388. //>>excludeStart("ide", pragmas.excludeIdeData);
  4389. args: ["aNumber"],
  4390. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  4391. referencedClasses: [],
  4392. //>>excludeEnd("ide");
  4393. messageSends: []
  4394. }),
  4395. globals.Number);
  4396. smalltalk.addMethod(
  4397. smalltalk.method({
  4398. selector: "-",
  4399. protocol: 'arithmetic',
  4400. fn: function (aNumber){
  4401. var self=this;
  4402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4403. return smalltalk.withContext(function($ctx1) {
  4404. //>>excludeEnd("ctx");
  4405. return self - aNumber;
  4406. return self;
  4407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4408. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},globals.Number)});
  4409. //>>excludeEnd("ctx");
  4410. },
  4411. //>>excludeStart("ide", pragmas.excludeIdeData);
  4412. args: ["aNumber"],
  4413. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  4414. referencedClasses: [],
  4415. //>>excludeEnd("ide");
  4416. messageSends: []
  4417. }),
  4418. globals.Number);
  4419. smalltalk.addMethod(
  4420. smalltalk.method({
  4421. selector: "/",
  4422. protocol: 'arithmetic',
  4423. fn: function (aNumber){
  4424. var self=this;
  4425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4426. return smalltalk.withContext(function($ctx1) {
  4427. //>>excludeEnd("ctx");
  4428. return self / aNumber;
  4429. return self;
  4430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4431. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},globals.Number)});
  4432. //>>excludeEnd("ctx");
  4433. },
  4434. //>>excludeStart("ide", pragmas.excludeIdeData);
  4435. args: ["aNumber"],
  4436. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  4437. referencedClasses: [],
  4438. //>>excludeEnd("ide");
  4439. messageSends: []
  4440. }),
  4441. globals.Number);
  4442. smalltalk.addMethod(
  4443. smalltalk.method({
  4444. selector: "//",
  4445. protocol: 'arithmetic',
  4446. fn: function (aNumber){
  4447. var self=this;
  4448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4449. return smalltalk.withContext(function($ctx1) {
  4450. //>>excludeEnd("ctx");
  4451. var $1;
  4452. $1=_st(self.__slash(aNumber))._floor();
  4453. return $1;
  4454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4455. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},globals.Number)});
  4456. //>>excludeEnd("ctx");
  4457. },
  4458. //>>excludeStart("ide", pragmas.excludeIdeData);
  4459. args: ["aNumber"],
  4460. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4461. referencedClasses: [],
  4462. //>>excludeEnd("ide");
  4463. messageSends: ["floor", "/"]
  4464. }),
  4465. globals.Number);
  4466. smalltalk.addMethod(
  4467. smalltalk.method({
  4468. selector: "<",
  4469. protocol: 'comparing',
  4470. fn: function (aNumber){
  4471. var self=this;
  4472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4473. return smalltalk.withContext(function($ctx1) {
  4474. //>>excludeEnd("ctx");
  4475. return self < aNumber;
  4476. return self;
  4477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4478. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},globals.Number)});
  4479. //>>excludeEnd("ctx");
  4480. },
  4481. //>>excludeStart("ide", pragmas.excludeIdeData);
  4482. args: ["aNumber"],
  4483. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  4484. referencedClasses: [],
  4485. //>>excludeEnd("ide");
  4486. messageSends: []
  4487. }),
  4488. globals.Number);
  4489. smalltalk.addMethod(
  4490. smalltalk.method({
  4491. selector: "<=",
  4492. protocol: 'comparing',
  4493. fn: function (aNumber){
  4494. var self=this;
  4495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4496. return smalltalk.withContext(function($ctx1) {
  4497. //>>excludeEnd("ctx");
  4498. return self <= aNumber;
  4499. return self;
  4500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4501. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},globals.Number)});
  4502. //>>excludeEnd("ctx");
  4503. },
  4504. //>>excludeStart("ide", pragmas.excludeIdeData);
  4505. args: ["aNumber"],
  4506. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  4507. referencedClasses: [],
  4508. //>>excludeEnd("ide");
  4509. messageSends: []
  4510. }),
  4511. globals.Number);
  4512. smalltalk.addMethod(
  4513. smalltalk.method({
  4514. selector: "=",
  4515. protocol: 'comparing',
  4516. fn: function (aNumber){
  4517. var self=this;
  4518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4519. return smalltalk.withContext(function($ctx1) {
  4520. //>>excludeEnd("ctx");
  4521. return aNumber != null &&
  4522. typeof aNumber._isNumber === "function" &&
  4523. aNumber._isNumber() &&
  4524. Number(self) == aNumber
  4525. ;
  4526. return self;
  4527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4528. }, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},globals.Number)});
  4529. //>>excludeEnd("ctx");
  4530. },
  4531. //>>excludeStart("ide", pragmas.excludeIdeData);
  4532. args: ["aNumber"],
  4533. source: "= aNumber\x0a\x09<\x0a\x09\x09return aNumber != null &&\x0a\x09\x09\x09typeof aNumber._isNumber === \x22function\x22 &&\x0a\x09\x09\x09aNumber._isNumber() &&\x0a\x09\x09\x09Number(self) == aNumber\x0a\x09>",
  4534. referencedClasses: [],
  4535. //>>excludeEnd("ide");
  4536. messageSends: []
  4537. }),
  4538. globals.Number);
  4539. smalltalk.addMethod(
  4540. smalltalk.method({
  4541. selector: ">",
  4542. protocol: 'comparing',
  4543. fn: function (aNumber){
  4544. var self=this;
  4545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4546. return smalltalk.withContext(function($ctx1) {
  4547. //>>excludeEnd("ctx");
  4548. return self > aNumber;
  4549. return self;
  4550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4551. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},globals.Number)});
  4552. //>>excludeEnd("ctx");
  4553. },
  4554. //>>excludeStart("ide", pragmas.excludeIdeData);
  4555. args: ["aNumber"],
  4556. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  4557. referencedClasses: [],
  4558. //>>excludeEnd("ide");
  4559. messageSends: []
  4560. }),
  4561. globals.Number);
  4562. smalltalk.addMethod(
  4563. smalltalk.method({
  4564. selector: ">=",
  4565. protocol: 'comparing',
  4566. fn: function (aNumber){
  4567. var self=this;
  4568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4569. return smalltalk.withContext(function($ctx1) {
  4570. //>>excludeEnd("ctx");
  4571. return self >= aNumber;
  4572. return self;
  4573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4574. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},globals.Number)});
  4575. //>>excludeEnd("ctx");
  4576. },
  4577. //>>excludeStart("ide", pragmas.excludeIdeData);
  4578. args: ["aNumber"],
  4579. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  4580. referencedClasses: [],
  4581. //>>excludeEnd("ide");
  4582. messageSends: []
  4583. }),
  4584. globals.Number);
  4585. smalltalk.addMethod(
  4586. smalltalk.method({
  4587. selector: "@",
  4588. protocol: 'converting',
  4589. fn: function (aNumber){
  4590. var self=this;
  4591. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4593. return smalltalk.withContext(function($ctx1) {
  4594. //>>excludeEnd("ctx");
  4595. var $1;
  4596. $1=_st($Point())._x_y_(self,aNumber);
  4597. return $1;
  4598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4599. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},globals.Number)});
  4600. //>>excludeEnd("ctx");
  4601. },
  4602. //>>excludeStart("ide", pragmas.excludeIdeData);
  4603. args: ["aNumber"],
  4604. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4605. referencedClasses: ["Point"],
  4606. //>>excludeEnd("ide");
  4607. messageSends: ["x:y:"]
  4608. }),
  4609. globals.Number);
  4610. smalltalk.addMethod(
  4611. smalltalk.method({
  4612. selector: "\x5c\x5c",
  4613. protocol: 'arithmetic',
  4614. fn: function (aNumber){
  4615. var self=this;
  4616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4617. return smalltalk.withContext(function($ctx1) {
  4618. //>>excludeEnd("ctx");
  4619. return self % aNumber;
  4620. return self;
  4621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4622. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},globals.Number)});
  4623. //>>excludeEnd("ctx");
  4624. },
  4625. //>>excludeStart("ide", pragmas.excludeIdeData);
  4626. args: ["aNumber"],
  4627. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  4628. referencedClasses: [],
  4629. //>>excludeEnd("ide");
  4630. messageSends: []
  4631. }),
  4632. globals.Number);
  4633. smalltalk.addMethod(
  4634. smalltalk.method({
  4635. selector: "abs",
  4636. protocol: 'arithmetic',
  4637. fn: function (){
  4638. var self=this;
  4639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4640. return smalltalk.withContext(function($ctx1) {
  4641. //>>excludeEnd("ctx");
  4642. return Math.abs(self);;
  4643. return self;
  4644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4645. }, function($ctx1) {$ctx1.fill(self,"abs",{},globals.Number)});
  4646. //>>excludeEnd("ctx");
  4647. },
  4648. //>>excludeStart("ide", pragmas.excludeIdeData);
  4649. args: [],
  4650. source: "abs\x0a\x09<return Math.abs(self);>",
  4651. referencedClasses: [],
  4652. //>>excludeEnd("ide");
  4653. messageSends: []
  4654. }),
  4655. globals.Number);
  4656. smalltalk.addMethod(
  4657. smalltalk.method({
  4658. selector: "arcCos",
  4659. protocol: 'mathematical functions',
  4660. fn: function (){
  4661. var self=this;
  4662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4663. return smalltalk.withContext(function($ctx1) {
  4664. //>>excludeEnd("ctx");
  4665. return Math.acos(self);;
  4666. return self;
  4667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4668. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},globals.Number)});
  4669. //>>excludeEnd("ctx");
  4670. },
  4671. //>>excludeStart("ide", pragmas.excludeIdeData);
  4672. args: [],
  4673. source: "arcCos\x0a\x09<return Math.acos(self);>",
  4674. referencedClasses: [],
  4675. //>>excludeEnd("ide");
  4676. messageSends: []
  4677. }),
  4678. globals.Number);
  4679. smalltalk.addMethod(
  4680. smalltalk.method({
  4681. selector: "arcSin",
  4682. protocol: 'mathematical functions',
  4683. fn: function (){
  4684. var self=this;
  4685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4686. return smalltalk.withContext(function($ctx1) {
  4687. //>>excludeEnd("ctx");
  4688. return Math.asin(self);;
  4689. return self;
  4690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4691. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},globals.Number)});
  4692. //>>excludeEnd("ctx");
  4693. },
  4694. //>>excludeStart("ide", pragmas.excludeIdeData);
  4695. args: [],
  4696. source: "arcSin\x0a\x09<return Math.asin(self);>",
  4697. referencedClasses: [],
  4698. //>>excludeEnd("ide");
  4699. messageSends: []
  4700. }),
  4701. globals.Number);
  4702. smalltalk.addMethod(
  4703. smalltalk.method({
  4704. selector: "arcTan",
  4705. protocol: 'mathematical functions',
  4706. fn: function (){
  4707. var self=this;
  4708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4709. return smalltalk.withContext(function($ctx1) {
  4710. //>>excludeEnd("ctx");
  4711. return Math.atan(self);;
  4712. return self;
  4713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4714. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},globals.Number)});
  4715. //>>excludeEnd("ctx");
  4716. },
  4717. //>>excludeStart("ide", pragmas.excludeIdeData);
  4718. args: [],
  4719. source: "arcTan\x0a\x09<return Math.atan(self);>",
  4720. referencedClasses: [],
  4721. //>>excludeEnd("ide");
  4722. messageSends: []
  4723. }),
  4724. globals.Number);
  4725. smalltalk.addMethod(
  4726. smalltalk.method({
  4727. selector: "asJSON",
  4728. protocol: 'converting',
  4729. fn: function (){
  4730. var self=this;
  4731. return self;
  4732. },
  4733. //>>excludeStart("ide", pragmas.excludeIdeData);
  4734. args: [],
  4735. source: "asJSON\x0a\x09^ self",
  4736. referencedClasses: [],
  4737. //>>excludeEnd("ide");
  4738. messageSends: []
  4739. }),
  4740. globals.Number);
  4741. smalltalk.addMethod(
  4742. smalltalk.method({
  4743. selector: "asJavascript",
  4744. protocol: 'converting',
  4745. fn: function (){
  4746. var self=this;
  4747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4748. return smalltalk.withContext(function($ctx1) {
  4749. //>>excludeEnd("ctx");
  4750. var $1;
  4751. $1=_st("(".__comma(self._printString())).__comma(")");
  4752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4753. $ctx1.sendIdx[","]=1;
  4754. //>>excludeEnd("ctx");
  4755. return $1;
  4756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4757. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Number)});
  4758. //>>excludeEnd("ctx");
  4759. },
  4760. //>>excludeStart("ide", pragmas.excludeIdeData);
  4761. args: [],
  4762. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  4763. referencedClasses: [],
  4764. //>>excludeEnd("ide");
  4765. messageSends: [",", "printString"]
  4766. }),
  4767. globals.Number);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "asNumber",
  4771. protocol: 'converting',
  4772. fn: function (){
  4773. var self=this;
  4774. return self;
  4775. },
  4776. //>>excludeStart("ide", pragmas.excludeIdeData);
  4777. args: [],
  4778. source: "asNumber\x0a\x09^ self",
  4779. referencedClasses: [],
  4780. //>>excludeEnd("ide");
  4781. messageSends: []
  4782. }),
  4783. globals.Number);
  4784. smalltalk.addMethod(
  4785. smalltalk.method({
  4786. selector: "asPoint",
  4787. protocol: 'converting',
  4788. fn: function (){
  4789. var self=this;
  4790. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4792. return smalltalk.withContext(function($ctx1) {
  4793. //>>excludeEnd("ctx");
  4794. var $1;
  4795. $1=_st($Point())._x_y_(self,self);
  4796. return $1;
  4797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4798. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},globals.Number)});
  4799. //>>excludeEnd("ctx");
  4800. },
  4801. //>>excludeStart("ide", pragmas.excludeIdeData);
  4802. args: [],
  4803. source: "asPoint\x0a\x09^ Point x: self y: self",
  4804. referencedClasses: ["Point"],
  4805. //>>excludeEnd("ide");
  4806. messageSends: ["x:y:"]
  4807. }),
  4808. globals.Number);
  4809. smalltalk.addMethod(
  4810. smalltalk.method({
  4811. selector: "asString",
  4812. protocol: 'converting',
  4813. fn: function (){
  4814. var self=this;
  4815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4816. return smalltalk.withContext(function($ctx1) {
  4817. //>>excludeEnd("ctx");
  4818. return String(self) ;
  4819. return self;
  4820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4821. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Number)});
  4822. //>>excludeEnd("ctx");
  4823. },
  4824. //>>excludeStart("ide", pragmas.excludeIdeData);
  4825. args: [],
  4826. source: "asString\x0a\x09< return String(self) >",
  4827. referencedClasses: [],
  4828. //>>excludeEnd("ide");
  4829. messageSends: []
  4830. }),
  4831. globals.Number);
  4832. smalltalk.addMethod(
  4833. smalltalk.method({
  4834. selector: "atRandom",
  4835. protocol: 'converting',
  4836. fn: function (){
  4837. var self=this;
  4838. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  4839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4840. return smalltalk.withContext(function($ctx1) {
  4841. //>>excludeEnd("ctx");
  4842. var $1;
  4843. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  4844. return $1;
  4845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4846. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.Number)});
  4847. //>>excludeEnd("ctx");
  4848. },
  4849. //>>excludeStart("ide", pragmas.excludeIdeData);
  4850. args: [],
  4851. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4852. referencedClasses: ["Random"],
  4853. //>>excludeEnd("ide");
  4854. messageSends: ["+", "truncated", "*", "next", "new"]
  4855. }),
  4856. globals.Number);
  4857. smalltalk.addMethod(
  4858. smalltalk.method({
  4859. selector: "ceiling",
  4860. protocol: 'converting',
  4861. fn: function (){
  4862. var self=this;
  4863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4864. return smalltalk.withContext(function($ctx1) {
  4865. //>>excludeEnd("ctx");
  4866. return Math.ceil(self);;
  4867. return self;
  4868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4869. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},globals.Number)});
  4870. //>>excludeEnd("ctx");
  4871. },
  4872. //>>excludeStart("ide", pragmas.excludeIdeData);
  4873. args: [],
  4874. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  4875. referencedClasses: [],
  4876. //>>excludeEnd("ide");
  4877. messageSends: []
  4878. }),
  4879. globals.Number);
  4880. smalltalk.addMethod(
  4881. smalltalk.method({
  4882. selector: "copy",
  4883. protocol: 'copying',
  4884. fn: function (){
  4885. var self=this;
  4886. return self;
  4887. },
  4888. //>>excludeStart("ide", pragmas.excludeIdeData);
  4889. args: [],
  4890. source: "copy\x0a\x09^ self",
  4891. referencedClasses: [],
  4892. //>>excludeEnd("ide");
  4893. messageSends: []
  4894. }),
  4895. globals.Number);
  4896. smalltalk.addMethod(
  4897. smalltalk.method({
  4898. selector: "cos",
  4899. protocol: 'mathematical functions',
  4900. fn: function (){
  4901. var self=this;
  4902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4903. return smalltalk.withContext(function($ctx1) {
  4904. //>>excludeEnd("ctx");
  4905. return Math.cos(self);;
  4906. return self;
  4907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4908. }, function($ctx1) {$ctx1.fill(self,"cos",{},globals.Number)});
  4909. //>>excludeEnd("ctx");
  4910. },
  4911. //>>excludeStart("ide", pragmas.excludeIdeData);
  4912. args: [],
  4913. source: "cos\x0a\x09<return Math.cos(self);>",
  4914. referencedClasses: [],
  4915. //>>excludeEnd("ide");
  4916. messageSends: []
  4917. }),
  4918. globals.Number);
  4919. smalltalk.addMethod(
  4920. smalltalk.method({
  4921. selector: "deepCopy",
  4922. protocol: 'copying',
  4923. fn: function (){
  4924. var self=this;
  4925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4926. return smalltalk.withContext(function($ctx1) {
  4927. //>>excludeEnd("ctx");
  4928. var $1;
  4929. $1=self._copy();
  4930. return $1;
  4931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4932. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Number)});
  4933. //>>excludeEnd("ctx");
  4934. },
  4935. //>>excludeStart("ide", pragmas.excludeIdeData);
  4936. args: [],
  4937. source: "deepCopy\x0a\x09^ self copy",
  4938. referencedClasses: [],
  4939. //>>excludeEnd("ide");
  4940. messageSends: ["copy"]
  4941. }),
  4942. globals.Number);
  4943. smalltalk.addMethod(
  4944. smalltalk.method({
  4945. selector: "even",
  4946. protocol: 'testing',
  4947. fn: function (){
  4948. var self=this;
  4949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4950. return smalltalk.withContext(function($ctx1) {
  4951. //>>excludeEnd("ctx");
  4952. var $1;
  4953. $1=(0).__eq(self.__backslash_backslash((2)));
  4954. return $1;
  4955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4956. }, function($ctx1) {$ctx1.fill(self,"even",{},globals.Number)});
  4957. //>>excludeEnd("ctx");
  4958. },
  4959. //>>excludeStart("ide", pragmas.excludeIdeData);
  4960. args: [],
  4961. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4962. referencedClasses: [],
  4963. //>>excludeEnd("ide");
  4964. messageSends: ["=", "\x5c\x5c"]
  4965. }),
  4966. globals.Number);
  4967. smalltalk.addMethod(
  4968. smalltalk.method({
  4969. selector: "floor",
  4970. protocol: 'converting',
  4971. fn: function (){
  4972. var self=this;
  4973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4974. return smalltalk.withContext(function($ctx1) {
  4975. //>>excludeEnd("ctx");
  4976. return Math.floor(self);;
  4977. return self;
  4978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4979. }, function($ctx1) {$ctx1.fill(self,"floor",{},globals.Number)});
  4980. //>>excludeEnd("ctx");
  4981. },
  4982. //>>excludeStart("ide", pragmas.excludeIdeData);
  4983. args: [],
  4984. source: "floor\x0a\x09<return Math.floor(self);>",
  4985. referencedClasses: [],
  4986. //>>excludeEnd("ide");
  4987. messageSends: []
  4988. }),
  4989. globals.Number);
  4990. smalltalk.addMethod(
  4991. smalltalk.method({
  4992. selector: "identityHash",
  4993. protocol: 'accessing',
  4994. fn: function (){
  4995. var self=this;
  4996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4997. return smalltalk.withContext(function($ctx1) {
  4998. //>>excludeEnd("ctx");
  4999. var $1;
  5000. $1=_st(self._asString()).__comma("n");
  5001. return $1;
  5002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5003. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.Number)});
  5004. //>>excludeEnd("ctx");
  5005. },
  5006. //>>excludeStart("ide", pragmas.excludeIdeData);
  5007. args: [],
  5008. source: "identityHash\x0a\x09^ self asString, 'n'",
  5009. referencedClasses: [],
  5010. //>>excludeEnd("ide");
  5011. messageSends: [",", "asString"]
  5012. }),
  5013. globals.Number);
  5014. smalltalk.addMethod(
  5015. smalltalk.method({
  5016. selector: "isImmutable",
  5017. protocol: 'testing',
  5018. fn: function (){
  5019. var self=this;
  5020. return true;
  5021. },
  5022. //>>excludeStart("ide", pragmas.excludeIdeData);
  5023. args: [],
  5024. source: "isImmutable\x0a\x09^ true",
  5025. referencedClasses: [],
  5026. //>>excludeEnd("ide");
  5027. messageSends: []
  5028. }),
  5029. globals.Number);
  5030. smalltalk.addMethod(
  5031. smalltalk.method({
  5032. selector: "isNumber",
  5033. protocol: 'testing',
  5034. fn: function (){
  5035. var self=this;
  5036. return true;
  5037. },
  5038. //>>excludeStart("ide", pragmas.excludeIdeData);
  5039. args: [],
  5040. source: "isNumber\x0a\x09^ true",
  5041. referencedClasses: [],
  5042. //>>excludeEnd("ide");
  5043. messageSends: []
  5044. }),
  5045. globals.Number);
  5046. smalltalk.addMethod(
  5047. smalltalk.method({
  5048. selector: "isZero",
  5049. protocol: 'testing',
  5050. fn: function (){
  5051. var self=this;
  5052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5053. return smalltalk.withContext(function($ctx1) {
  5054. //>>excludeEnd("ctx");
  5055. var $1;
  5056. $1=self.__eq((0));
  5057. return $1;
  5058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5059. }, function($ctx1) {$ctx1.fill(self,"isZero",{},globals.Number)});
  5060. //>>excludeEnd("ctx");
  5061. },
  5062. //>>excludeStart("ide", pragmas.excludeIdeData);
  5063. args: [],
  5064. source: "isZero\x0a\x09^ self = 0",
  5065. referencedClasses: [],
  5066. //>>excludeEnd("ide");
  5067. messageSends: ["="]
  5068. }),
  5069. globals.Number);
  5070. smalltalk.addMethod(
  5071. smalltalk.method({
  5072. selector: "ln",
  5073. protocol: 'mathematical functions',
  5074. fn: function (){
  5075. var self=this;
  5076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5077. return smalltalk.withContext(function($ctx1) {
  5078. //>>excludeEnd("ctx");
  5079. return Math.log(self);;
  5080. return self;
  5081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5082. }, function($ctx1) {$ctx1.fill(self,"ln",{},globals.Number)});
  5083. //>>excludeEnd("ctx");
  5084. },
  5085. //>>excludeStart("ide", pragmas.excludeIdeData);
  5086. args: [],
  5087. source: "ln\x0a\x09<return Math.log(self);>",
  5088. referencedClasses: [],
  5089. //>>excludeEnd("ide");
  5090. messageSends: []
  5091. }),
  5092. globals.Number);
  5093. smalltalk.addMethod(
  5094. smalltalk.method({
  5095. selector: "log",
  5096. protocol: 'mathematical functions',
  5097. fn: function (){
  5098. var self=this;
  5099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5100. return smalltalk.withContext(function($ctx1) {
  5101. //>>excludeEnd("ctx");
  5102. return Math.log(self) / Math.LN10;;
  5103. return self;
  5104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5105. }, function($ctx1) {$ctx1.fill(self,"log",{},globals.Number)});
  5106. //>>excludeEnd("ctx");
  5107. },
  5108. //>>excludeStart("ide", pragmas.excludeIdeData);
  5109. args: [],
  5110. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  5111. referencedClasses: [],
  5112. //>>excludeEnd("ide");
  5113. messageSends: []
  5114. }),
  5115. globals.Number);
  5116. smalltalk.addMethod(
  5117. smalltalk.method({
  5118. selector: "log:",
  5119. protocol: 'mathematical functions',
  5120. fn: function (aNumber){
  5121. var self=this;
  5122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5123. return smalltalk.withContext(function($ctx1) {
  5124. //>>excludeEnd("ctx");
  5125. return Math.log(self) / Math.log(aNumber);;
  5126. return self;
  5127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5128. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},globals.Number)});
  5129. //>>excludeEnd("ctx");
  5130. },
  5131. //>>excludeStart("ide", pragmas.excludeIdeData);
  5132. args: ["aNumber"],
  5133. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  5134. referencedClasses: [],
  5135. //>>excludeEnd("ide");
  5136. messageSends: []
  5137. }),
  5138. globals.Number);
  5139. smalltalk.addMethod(
  5140. smalltalk.method({
  5141. selector: "max:",
  5142. protocol: 'arithmetic',
  5143. fn: function (aNumber){
  5144. var self=this;
  5145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5146. return smalltalk.withContext(function($ctx1) {
  5147. //>>excludeEnd("ctx");
  5148. return Math.max(self, aNumber);;
  5149. return self;
  5150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5151. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},globals.Number)});
  5152. //>>excludeEnd("ctx");
  5153. },
  5154. //>>excludeStart("ide", pragmas.excludeIdeData);
  5155. args: ["aNumber"],
  5156. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  5157. referencedClasses: [],
  5158. //>>excludeEnd("ide");
  5159. messageSends: []
  5160. }),
  5161. globals.Number);
  5162. smalltalk.addMethod(
  5163. smalltalk.method({
  5164. selector: "min:",
  5165. protocol: 'arithmetic',
  5166. fn: function (aNumber){
  5167. var self=this;
  5168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5169. return smalltalk.withContext(function($ctx1) {
  5170. //>>excludeEnd("ctx");
  5171. return Math.min(self, aNumber);;
  5172. return self;
  5173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5174. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},globals.Number)});
  5175. //>>excludeEnd("ctx");
  5176. },
  5177. //>>excludeStart("ide", pragmas.excludeIdeData);
  5178. args: ["aNumber"],
  5179. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  5180. referencedClasses: [],
  5181. //>>excludeEnd("ide");
  5182. messageSends: []
  5183. }),
  5184. globals.Number);
  5185. smalltalk.addMethod(
  5186. smalltalk.method({
  5187. selector: "negated",
  5188. protocol: 'arithmetic',
  5189. fn: function (){
  5190. var self=this;
  5191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5192. return smalltalk.withContext(function($ctx1) {
  5193. //>>excludeEnd("ctx");
  5194. var $1;
  5195. $1=(0).__minus(self);
  5196. return $1;
  5197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5198. }, function($ctx1) {$ctx1.fill(self,"negated",{},globals.Number)});
  5199. //>>excludeEnd("ctx");
  5200. },
  5201. //>>excludeStart("ide", pragmas.excludeIdeData);
  5202. args: [],
  5203. source: "negated\x0a\x09^ 0 - self",
  5204. referencedClasses: [],
  5205. //>>excludeEnd("ide");
  5206. messageSends: ["-"]
  5207. }),
  5208. globals.Number);
  5209. smalltalk.addMethod(
  5210. smalltalk.method({
  5211. selector: "negative",
  5212. protocol: 'testing',
  5213. fn: function (){
  5214. var self=this;
  5215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5216. return smalltalk.withContext(function($ctx1) {
  5217. //>>excludeEnd("ctx");
  5218. var $1;
  5219. $1=self.__lt((0));
  5220. return $1;
  5221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5222. }, function($ctx1) {$ctx1.fill(self,"negative",{},globals.Number)});
  5223. //>>excludeEnd("ctx");
  5224. },
  5225. //>>excludeStart("ide", pragmas.excludeIdeData);
  5226. args: [],
  5227. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5228. referencedClasses: [],
  5229. //>>excludeEnd("ide");
  5230. messageSends: ["<"]
  5231. }),
  5232. globals.Number);
  5233. smalltalk.addMethod(
  5234. smalltalk.method({
  5235. selector: "odd",
  5236. protocol: 'testing',
  5237. fn: function (){
  5238. var self=this;
  5239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5240. return smalltalk.withContext(function($ctx1) {
  5241. //>>excludeEnd("ctx");
  5242. var $1;
  5243. $1=_st(self._even())._not();
  5244. return $1;
  5245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5246. }, function($ctx1) {$ctx1.fill(self,"odd",{},globals.Number)});
  5247. //>>excludeEnd("ctx");
  5248. },
  5249. //>>excludeStart("ide", pragmas.excludeIdeData);
  5250. args: [],
  5251. source: "odd\x0a\x09^ self even not",
  5252. referencedClasses: [],
  5253. //>>excludeEnd("ide");
  5254. messageSends: ["not", "even"]
  5255. }),
  5256. globals.Number);
  5257. smalltalk.addMethod(
  5258. smalltalk.method({
  5259. selector: "positive",
  5260. protocol: 'testing',
  5261. fn: function (){
  5262. var self=this;
  5263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5264. return smalltalk.withContext(function($ctx1) {
  5265. //>>excludeEnd("ctx");
  5266. var $1;
  5267. $1=self.__gt_eq((0));
  5268. return $1;
  5269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5270. }, function($ctx1) {$ctx1.fill(self,"positive",{},globals.Number)});
  5271. //>>excludeEnd("ctx");
  5272. },
  5273. //>>excludeStart("ide", pragmas.excludeIdeData);
  5274. args: [],
  5275. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5276. referencedClasses: [],
  5277. //>>excludeEnd("ide");
  5278. messageSends: [">="]
  5279. }),
  5280. globals.Number);
  5281. smalltalk.addMethod(
  5282. smalltalk.method({
  5283. selector: "printOn:",
  5284. protocol: 'printing',
  5285. fn: function (aStream){
  5286. var self=this;
  5287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5288. return smalltalk.withContext(function($ctx1) {
  5289. //>>excludeEnd("ctx");
  5290. _st(aStream)._nextPutAll_(self._asString());
  5291. return self;
  5292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5293. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Number)});
  5294. //>>excludeEnd("ctx");
  5295. },
  5296. //>>excludeStart("ide", pragmas.excludeIdeData);
  5297. args: ["aStream"],
  5298. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5299. referencedClasses: [],
  5300. //>>excludeEnd("ide");
  5301. messageSends: ["nextPutAll:", "asString"]
  5302. }),
  5303. globals.Number);
  5304. smalltalk.addMethod(
  5305. smalltalk.method({
  5306. selector: "printShowingDecimalPlaces:",
  5307. protocol: 'printing',
  5308. fn: function (placesDesired){
  5309. var self=this;
  5310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5311. return smalltalk.withContext(function($ctx1) {
  5312. //>>excludeEnd("ctx");
  5313. return self.toFixed(placesDesired);
  5314. return self;
  5315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5316. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},globals.Number)});
  5317. //>>excludeEnd("ctx");
  5318. },
  5319. //>>excludeStart("ide", pragmas.excludeIdeData);
  5320. args: ["placesDesired"],
  5321. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  5322. referencedClasses: [],
  5323. //>>excludeEnd("ide");
  5324. messageSends: []
  5325. }),
  5326. globals.Number);
  5327. smalltalk.addMethod(
  5328. smalltalk.method({
  5329. selector: "raisedTo:",
  5330. protocol: 'mathematical functions',
  5331. fn: function (exponent){
  5332. var self=this;
  5333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5334. return smalltalk.withContext(function($ctx1) {
  5335. //>>excludeEnd("ctx");
  5336. return Math.pow(self, exponent);;
  5337. return self;
  5338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5339. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},globals.Number)});
  5340. //>>excludeEnd("ctx");
  5341. },
  5342. //>>excludeStart("ide", pragmas.excludeIdeData);
  5343. args: ["exponent"],
  5344. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  5345. referencedClasses: [],
  5346. //>>excludeEnd("ide");
  5347. messageSends: []
  5348. }),
  5349. globals.Number);
  5350. smalltalk.addMethod(
  5351. smalltalk.method({
  5352. selector: "rounded",
  5353. protocol: 'converting',
  5354. fn: function (){
  5355. var self=this;
  5356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5357. return smalltalk.withContext(function($ctx1) {
  5358. //>>excludeEnd("ctx");
  5359. return Math.round(self);;
  5360. return self;
  5361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5362. }, function($ctx1) {$ctx1.fill(self,"rounded",{},globals.Number)});
  5363. //>>excludeEnd("ctx");
  5364. },
  5365. //>>excludeStart("ide", pragmas.excludeIdeData);
  5366. args: [],
  5367. source: "rounded\x0a\x09<return Math.round(self);>",
  5368. referencedClasses: [],
  5369. //>>excludeEnd("ide");
  5370. messageSends: []
  5371. }),
  5372. globals.Number);
  5373. smalltalk.addMethod(
  5374. smalltalk.method({
  5375. selector: "sign",
  5376. protocol: 'mathematical functions',
  5377. fn: function (){
  5378. var self=this;
  5379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5380. return smalltalk.withContext(function($ctx1) {
  5381. //>>excludeEnd("ctx");
  5382. var $1,$2;
  5383. $1=self._isZero();
  5384. if(smalltalk.assert($1)){
  5385. return (0);
  5386. };
  5387. $2=self._positive();
  5388. if(smalltalk.assert($2)){
  5389. return (1);
  5390. } else {
  5391. return (-1);
  5392. };
  5393. return self;
  5394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5395. }, function($ctx1) {$ctx1.fill(self,"sign",{},globals.Number)});
  5396. //>>excludeEnd("ctx");
  5397. },
  5398. //>>excludeStart("ide", pragmas.excludeIdeData);
  5399. args: [],
  5400. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5401. referencedClasses: [],
  5402. //>>excludeEnd("ide");
  5403. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5404. }),
  5405. globals.Number);
  5406. smalltalk.addMethod(
  5407. smalltalk.method({
  5408. selector: "sin",
  5409. protocol: 'mathematical functions',
  5410. fn: function (){
  5411. var self=this;
  5412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5413. return smalltalk.withContext(function($ctx1) {
  5414. //>>excludeEnd("ctx");
  5415. return Math.sin(self);;
  5416. return self;
  5417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5418. }, function($ctx1) {$ctx1.fill(self,"sin",{},globals.Number)});
  5419. //>>excludeEnd("ctx");
  5420. },
  5421. //>>excludeStart("ide", pragmas.excludeIdeData);
  5422. args: [],
  5423. source: "sin\x0a\x09<return Math.sin(self);>",
  5424. referencedClasses: [],
  5425. //>>excludeEnd("ide");
  5426. messageSends: []
  5427. }),
  5428. globals.Number);
  5429. smalltalk.addMethod(
  5430. smalltalk.method({
  5431. selector: "sqrt",
  5432. protocol: 'mathematical functions',
  5433. fn: function (){
  5434. var self=this;
  5435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5436. return smalltalk.withContext(function($ctx1) {
  5437. //>>excludeEnd("ctx");
  5438. return Math.sqrt(self);
  5439. return self;
  5440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5441. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},globals.Number)});
  5442. //>>excludeEnd("ctx");
  5443. },
  5444. //>>excludeStart("ide", pragmas.excludeIdeData);
  5445. args: [],
  5446. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  5447. referencedClasses: [],
  5448. //>>excludeEnd("ide");
  5449. messageSends: []
  5450. }),
  5451. globals.Number);
  5452. smalltalk.addMethod(
  5453. smalltalk.method({
  5454. selector: "squared",
  5455. protocol: 'mathematical functions',
  5456. fn: function (){
  5457. var self=this;
  5458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5459. return smalltalk.withContext(function($ctx1) {
  5460. //>>excludeEnd("ctx");
  5461. var $1;
  5462. $1=self.__star(self);
  5463. return $1;
  5464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5465. }, function($ctx1) {$ctx1.fill(self,"squared",{},globals.Number)});
  5466. //>>excludeEnd("ctx");
  5467. },
  5468. //>>excludeStart("ide", pragmas.excludeIdeData);
  5469. args: [],
  5470. source: "squared\x0a\x09^ self * self",
  5471. referencedClasses: [],
  5472. //>>excludeEnd("ide");
  5473. messageSends: ["*"]
  5474. }),
  5475. globals.Number);
  5476. smalltalk.addMethod(
  5477. smalltalk.method({
  5478. selector: "tan",
  5479. protocol: 'mathematical functions',
  5480. fn: function (){
  5481. var self=this;
  5482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5483. return smalltalk.withContext(function($ctx1) {
  5484. //>>excludeEnd("ctx");
  5485. return Math.tan(self);;
  5486. return self;
  5487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5488. }, function($ctx1) {$ctx1.fill(self,"tan",{},globals.Number)});
  5489. //>>excludeEnd("ctx");
  5490. },
  5491. //>>excludeStart("ide", pragmas.excludeIdeData);
  5492. args: [],
  5493. source: "tan\x0a\x09<return Math.tan(self);>",
  5494. referencedClasses: [],
  5495. //>>excludeEnd("ide");
  5496. messageSends: []
  5497. }),
  5498. globals.Number);
  5499. smalltalk.addMethod(
  5500. smalltalk.method({
  5501. selector: "timesRepeat:",
  5502. protocol: 'enumerating',
  5503. fn: function (aBlock){
  5504. var self=this;
  5505. var count;
  5506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5507. return smalltalk.withContext(function($ctx1) {
  5508. //>>excludeEnd("ctx");
  5509. count=(1);
  5510. _st((function(){
  5511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5512. return smalltalk.withContext(function($ctx2) {
  5513. //>>excludeEnd("ctx");
  5514. return _st(count).__gt(self);
  5515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5517. //>>excludeEnd("ctx");
  5518. }))._whileFalse_((function(){
  5519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5520. return smalltalk.withContext(function($ctx2) {
  5521. //>>excludeEnd("ctx");
  5522. _st(aBlock)._value();
  5523. count=_st(count).__plus((1));
  5524. return count;
  5525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5527. //>>excludeEnd("ctx");
  5528. }));
  5529. return self;
  5530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5531. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},globals.Number)});
  5532. //>>excludeEnd("ctx");
  5533. },
  5534. //>>excludeStart("ide", pragmas.excludeIdeData);
  5535. args: ["aBlock"],
  5536. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5537. referencedClasses: [],
  5538. //>>excludeEnd("ide");
  5539. messageSends: ["whileFalse:", ">", "value", "+"]
  5540. }),
  5541. globals.Number);
  5542. smalltalk.addMethod(
  5543. smalltalk.method({
  5544. selector: "to:",
  5545. protocol: 'converting',
  5546. fn: function (aNumber){
  5547. var self=this;
  5548. var array,first,last,count;
  5549. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  5550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5551. return smalltalk.withContext(function($ctx1) {
  5552. //>>excludeEnd("ctx");
  5553. var $1;
  5554. first=self._truncated();
  5555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5556. $ctx1.sendIdx["truncated"]=1;
  5557. //>>excludeEnd("ctx");
  5558. last=_st(_st(aNumber)._truncated()).__plus((1));
  5559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5560. $ctx1.sendIdx["+"]=1;
  5561. //>>excludeEnd("ctx");
  5562. count=(1);
  5563. array=_st($Array())._new();
  5564. _st(_st(last).__minus(first))._timesRepeat_((function(){
  5565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5566. return smalltalk.withContext(function($ctx2) {
  5567. //>>excludeEnd("ctx");
  5568. _st(array)._at_put_(count,first);
  5569. count=_st(count).__plus((1));
  5570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5571. $ctx2.sendIdx["+"]=2;
  5572. //>>excludeEnd("ctx");
  5573. count;
  5574. first=_st(first).__plus((1));
  5575. return first;
  5576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5578. //>>excludeEnd("ctx");
  5579. }));
  5580. $1=array;
  5581. return $1;
  5582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5583. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},globals.Number)});
  5584. //>>excludeEnd("ctx");
  5585. },
  5586. //>>excludeStart("ide", pragmas.excludeIdeData);
  5587. args: ["aNumber"],
  5588. 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",
  5589. referencedClasses: ["Array"],
  5590. //>>excludeEnd("ide");
  5591. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5592. }),
  5593. globals.Number);
  5594. smalltalk.addMethod(
  5595. smalltalk.method({
  5596. selector: "to:by:",
  5597. protocol: 'converting',
  5598. fn: function (stop,step){
  5599. var self=this;
  5600. var array,value,pos;
  5601. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  5602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5603. return smalltalk.withContext(function($ctx1) {
  5604. //>>excludeEnd("ctx");
  5605. var $1,$2,$3;
  5606. value=self;
  5607. array=_st($Array())._new();
  5608. pos=(1);
  5609. $1=_st(step).__eq((0));
  5610. if(smalltalk.assert($1)){
  5611. self._error_("step must be non-zero");
  5612. };
  5613. $2=_st(step).__lt((0));
  5614. if(smalltalk.assert($2)){
  5615. _st((function(){
  5616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5617. return smalltalk.withContext(function($ctx2) {
  5618. //>>excludeEnd("ctx");
  5619. return _st(value).__gt_eq(stop);
  5620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5622. //>>excludeEnd("ctx");
  5623. }))._whileTrue_((function(){
  5624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5625. return smalltalk.withContext(function($ctx2) {
  5626. //>>excludeEnd("ctx");
  5627. _st(array)._at_put_(pos,value);
  5628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5629. $ctx2.sendIdx["at:put:"]=1;
  5630. //>>excludeEnd("ctx");
  5631. pos=_st(pos).__plus((1));
  5632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5633. $ctx2.sendIdx["+"]=1;
  5634. //>>excludeEnd("ctx");
  5635. pos;
  5636. value=_st(value).__plus(step);
  5637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5638. $ctx2.sendIdx["+"]=2;
  5639. //>>excludeEnd("ctx");
  5640. return value;
  5641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5642. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5643. //>>excludeEnd("ctx");
  5644. }));
  5645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5646. $ctx1.sendIdx["whileTrue:"]=1;
  5647. //>>excludeEnd("ctx");
  5648. } else {
  5649. _st((function(){
  5650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5651. return smalltalk.withContext(function($ctx2) {
  5652. //>>excludeEnd("ctx");
  5653. return _st(value).__lt_eq(stop);
  5654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5656. //>>excludeEnd("ctx");
  5657. }))._whileTrue_((function(){
  5658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5659. return smalltalk.withContext(function($ctx2) {
  5660. //>>excludeEnd("ctx");
  5661. _st(array)._at_put_(pos,value);
  5662. pos=_st(pos).__plus((1));
  5663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5664. $ctx2.sendIdx["+"]=3;
  5665. //>>excludeEnd("ctx");
  5666. pos;
  5667. value=_st(value).__plus(step);
  5668. return value;
  5669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5671. //>>excludeEnd("ctx");
  5672. }));
  5673. };
  5674. $3=array;
  5675. return $3;
  5676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5677. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},globals.Number)});
  5678. //>>excludeEnd("ctx");
  5679. },
  5680. //>>excludeStart("ide", pragmas.excludeIdeData);
  5681. args: ["stop", "step"],
  5682. 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",
  5683. referencedClasses: ["Array"],
  5684. //>>excludeEnd("ide");
  5685. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5686. }),
  5687. globals.Number);
  5688. smalltalk.addMethod(
  5689. smalltalk.method({
  5690. selector: "to:by:do:",
  5691. protocol: 'enumerating',
  5692. fn: function (stop,step,aBlock){
  5693. var self=this;
  5694. var value;
  5695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5696. return smalltalk.withContext(function($ctx1) {
  5697. //>>excludeEnd("ctx");
  5698. var $1,$2;
  5699. value=self;
  5700. $1=_st(step).__eq((0));
  5701. if(smalltalk.assert($1)){
  5702. self._error_("step must be non-zero");
  5703. };
  5704. $2=_st(step).__lt((0));
  5705. if(smalltalk.assert($2)){
  5706. _st((function(){
  5707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5708. return smalltalk.withContext(function($ctx2) {
  5709. //>>excludeEnd("ctx");
  5710. return _st(value).__gt_eq(stop);
  5711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5713. //>>excludeEnd("ctx");
  5714. }))._whileTrue_((function(){
  5715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5716. return smalltalk.withContext(function($ctx2) {
  5717. //>>excludeEnd("ctx");
  5718. _st(aBlock)._value_(value);
  5719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5720. $ctx2.sendIdx["value:"]=1;
  5721. //>>excludeEnd("ctx");
  5722. value=_st(value).__plus(step);
  5723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5724. $ctx2.sendIdx["+"]=1;
  5725. //>>excludeEnd("ctx");
  5726. return value;
  5727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5729. //>>excludeEnd("ctx");
  5730. }));
  5731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5732. $ctx1.sendIdx["whileTrue:"]=1;
  5733. //>>excludeEnd("ctx");
  5734. } else {
  5735. _st((function(){
  5736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5737. return smalltalk.withContext(function($ctx2) {
  5738. //>>excludeEnd("ctx");
  5739. return _st(value).__lt_eq(stop);
  5740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5742. //>>excludeEnd("ctx");
  5743. }))._whileTrue_((function(){
  5744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5745. return smalltalk.withContext(function($ctx2) {
  5746. //>>excludeEnd("ctx");
  5747. _st(aBlock)._value_(value);
  5748. value=_st(value).__plus(step);
  5749. return value;
  5750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5752. //>>excludeEnd("ctx");
  5753. }));
  5754. };
  5755. return self;
  5756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5757. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},globals.Number)});
  5758. //>>excludeEnd("ctx");
  5759. },
  5760. //>>excludeStart("ide", pragmas.excludeIdeData);
  5761. args: ["stop", "step", "aBlock"],
  5762. 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 ]]",
  5763. referencedClasses: [],
  5764. //>>excludeEnd("ide");
  5765. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  5766. }),
  5767. globals.Number);
  5768. smalltalk.addMethod(
  5769. smalltalk.method({
  5770. selector: "to:do:",
  5771. protocol: 'enumerating',
  5772. fn: function (stop,aBlock){
  5773. var self=this;
  5774. var nextValue;
  5775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5776. return smalltalk.withContext(function($ctx1) {
  5777. //>>excludeEnd("ctx");
  5778. nextValue=self;
  5779. _st((function(){
  5780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5781. return smalltalk.withContext(function($ctx2) {
  5782. //>>excludeEnd("ctx");
  5783. return _st(nextValue).__lt_eq(stop);
  5784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5786. //>>excludeEnd("ctx");
  5787. }))._whileTrue_((function(){
  5788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5789. return smalltalk.withContext(function($ctx2) {
  5790. //>>excludeEnd("ctx");
  5791. _st(aBlock)._value_(nextValue);
  5792. nextValue=_st(nextValue).__plus((1));
  5793. return nextValue;
  5794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5796. //>>excludeEnd("ctx");
  5797. }));
  5798. return self;
  5799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5800. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},globals.Number)});
  5801. //>>excludeEnd("ctx");
  5802. },
  5803. //>>excludeStart("ide", pragmas.excludeIdeData);
  5804. args: ["stop", "aBlock"],
  5805. 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 ]",
  5806. referencedClasses: [],
  5807. //>>excludeEnd("ide");
  5808. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5809. }),
  5810. globals.Number);
  5811. smalltalk.addMethod(
  5812. smalltalk.method({
  5813. selector: "truncated",
  5814. protocol: 'converting',
  5815. fn: function (){
  5816. var self=this;
  5817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5818. return smalltalk.withContext(function($ctx1) {
  5819. //>>excludeEnd("ctx");
  5820. if(self >= 0) {
  5821. return Math.floor(self);
  5822. } else {
  5823. return Math.floor(self * (-1)) * (-1);
  5824. };
  5825. ;
  5826. return self;
  5827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5828. }, function($ctx1) {$ctx1.fill(self,"truncated",{},globals.Number)});
  5829. //>>excludeEnd("ctx");
  5830. },
  5831. //>>excludeStart("ide", pragmas.excludeIdeData);
  5832. args: [],
  5833. 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>",
  5834. referencedClasses: [],
  5835. //>>excludeEnd("ide");
  5836. messageSends: []
  5837. }),
  5838. globals.Number);
  5839. smalltalk.addMethod(
  5840. smalltalk.method({
  5841. selector: "|",
  5842. protocol: 'converting',
  5843. fn: function (aNumber){
  5844. var self=this;
  5845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5846. return smalltalk.withContext(function($ctx1) {
  5847. //>>excludeEnd("ctx");
  5848. return self | aNumber;
  5849. return self;
  5850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5851. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},globals.Number)});
  5852. //>>excludeEnd("ctx");
  5853. },
  5854. //>>excludeStart("ide", pragmas.excludeIdeData);
  5855. args: ["aNumber"],
  5856. source: "| aNumber\x0a\x09<return self | aNumber>",
  5857. referencedClasses: [],
  5858. //>>excludeEnd("ide");
  5859. messageSends: []
  5860. }),
  5861. globals.Number);
  5862. smalltalk.addMethod(
  5863. smalltalk.method({
  5864. selector: "e",
  5865. protocol: 'instance creation',
  5866. fn: function (){
  5867. var self=this;
  5868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5869. return smalltalk.withContext(function($ctx1) {
  5870. //>>excludeEnd("ctx");
  5871. return Math.E;;
  5872. return self;
  5873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5874. }, function($ctx1) {$ctx1.fill(self,"e",{},globals.Number.klass)});
  5875. //>>excludeEnd("ctx");
  5876. },
  5877. //>>excludeStart("ide", pragmas.excludeIdeData);
  5878. args: [],
  5879. source: "e\x0a\x09<return Math.E;>",
  5880. referencedClasses: [],
  5881. //>>excludeEnd("ide");
  5882. messageSends: []
  5883. }),
  5884. globals.Number.klass);
  5885. smalltalk.addMethod(
  5886. smalltalk.method({
  5887. selector: "heliosClass",
  5888. protocol: 'helios',
  5889. fn: function (){
  5890. var self=this;
  5891. return "magnitude";
  5892. },
  5893. //>>excludeStart("ide", pragmas.excludeIdeData);
  5894. args: [],
  5895. source: "heliosClass\x0a\x09^ 'magnitude'",
  5896. referencedClasses: [],
  5897. //>>excludeEnd("ide");
  5898. messageSends: []
  5899. }),
  5900. globals.Number.klass);
  5901. smalltalk.addMethod(
  5902. smalltalk.method({
  5903. selector: "pi",
  5904. protocol: 'instance creation',
  5905. fn: function (){
  5906. var self=this;
  5907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5908. return smalltalk.withContext(function($ctx1) {
  5909. //>>excludeEnd("ctx");
  5910. return Math.PI;
  5911. return self;
  5912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5913. }, function($ctx1) {$ctx1.fill(self,"pi",{},globals.Number.klass)});
  5914. //>>excludeEnd("ctx");
  5915. },
  5916. //>>excludeStart("ide", pragmas.excludeIdeData);
  5917. args: [],
  5918. source: "pi\x0a\x09<return Math.PI>",
  5919. referencedClasses: [],
  5920. //>>excludeEnd("ide");
  5921. messageSends: []
  5922. }),
  5923. globals.Number.klass);
  5924. smalltalk.addClass('Point', globals.Object, ['x', 'y'], 'Kernel-Objects');
  5925. //>>excludeStart("ide", pragmas.excludeIdeData);
  5926. globals.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances 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";
  5927. //>>excludeEnd("ide");
  5928. smalltalk.addMethod(
  5929. smalltalk.method({
  5930. selector: "*",
  5931. protocol: 'arithmetic',
  5932. fn: function (aPoint){
  5933. var self=this;
  5934. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  5935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5936. return smalltalk.withContext(function($ctx1) {
  5937. //>>excludeEnd("ctx");
  5938. var $3,$5,$4,$2,$7,$6,$1;
  5939. $3=self._x();
  5940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5941. $ctx1.sendIdx["x"]=1;
  5942. //>>excludeEnd("ctx");
  5943. $5=_st(aPoint)._asPoint();
  5944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5945. $ctx1.sendIdx["asPoint"]=1;
  5946. //>>excludeEnd("ctx");
  5947. $4=_st($5)._x();
  5948. $2=_st($3).__star($4);
  5949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5950. $ctx1.sendIdx["*"]=1;
  5951. //>>excludeEnd("ctx");
  5952. $7=self._y();
  5953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5954. $ctx1.sendIdx["y"]=1;
  5955. //>>excludeEnd("ctx");
  5956. $6=_st($7).__star(_st(_st(aPoint)._asPoint())._y());
  5957. $1=_st($Point())._x_y_($2,$6);
  5958. return $1;
  5959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5960. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},globals.Point)});
  5961. //>>excludeEnd("ctx");
  5962. },
  5963. //>>excludeStart("ide", pragmas.excludeIdeData);
  5964. args: ["aPoint"],
  5965. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5966. referencedClasses: ["Point"],
  5967. //>>excludeEnd("ide");
  5968. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5969. }),
  5970. globals.Point);
  5971. smalltalk.addMethod(
  5972. smalltalk.method({
  5973. selector: "+",
  5974. protocol: 'arithmetic',
  5975. fn: function (aPoint){
  5976. var self=this;
  5977. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  5978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5979. return smalltalk.withContext(function($ctx1) {
  5980. //>>excludeEnd("ctx");
  5981. var $3,$5,$4,$2,$7,$6,$1;
  5982. $3=self._x();
  5983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5984. $ctx1.sendIdx["x"]=1;
  5985. //>>excludeEnd("ctx");
  5986. $5=_st(aPoint)._asPoint();
  5987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5988. $ctx1.sendIdx["asPoint"]=1;
  5989. //>>excludeEnd("ctx");
  5990. $4=_st($5)._x();
  5991. $2=_st($3).__plus($4);
  5992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5993. $ctx1.sendIdx["+"]=1;
  5994. //>>excludeEnd("ctx");
  5995. $7=self._y();
  5996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5997. $ctx1.sendIdx["y"]=1;
  5998. //>>excludeEnd("ctx");
  5999. $6=_st($7).__plus(_st(_st(aPoint)._asPoint())._y());
  6000. $1=_st($Point())._x_y_($2,$6);
  6001. return $1;
  6002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6003. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},globals.Point)});
  6004. //>>excludeEnd("ctx");
  6005. },
  6006. //>>excludeStart("ide", pragmas.excludeIdeData);
  6007. args: ["aPoint"],
  6008. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6009. referencedClasses: ["Point"],
  6010. //>>excludeEnd("ide");
  6011. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6012. }),
  6013. globals.Point);
  6014. smalltalk.addMethod(
  6015. smalltalk.method({
  6016. selector: "-",
  6017. protocol: 'arithmetic',
  6018. fn: function (aPoint){
  6019. var self=this;
  6020. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  6021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6022. return smalltalk.withContext(function($ctx1) {
  6023. //>>excludeEnd("ctx");
  6024. var $3,$5,$4,$2,$7,$6,$1;
  6025. $3=self._x();
  6026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6027. $ctx1.sendIdx["x"]=1;
  6028. //>>excludeEnd("ctx");
  6029. $5=_st(aPoint)._asPoint();
  6030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6031. $ctx1.sendIdx["asPoint"]=1;
  6032. //>>excludeEnd("ctx");
  6033. $4=_st($5)._x();
  6034. $2=_st($3).__minus($4);
  6035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6036. $ctx1.sendIdx["-"]=1;
  6037. //>>excludeEnd("ctx");
  6038. $7=self._y();
  6039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6040. $ctx1.sendIdx["y"]=1;
  6041. //>>excludeEnd("ctx");
  6042. $6=_st($7).__minus(_st(_st(aPoint)._asPoint())._y());
  6043. $1=_st($Point())._x_y_($2,$6);
  6044. return $1;
  6045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6046. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},globals.Point)});
  6047. //>>excludeEnd("ctx");
  6048. },
  6049. //>>excludeStart("ide", pragmas.excludeIdeData);
  6050. args: ["aPoint"],
  6051. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6052. referencedClasses: ["Point"],
  6053. //>>excludeEnd("ide");
  6054. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6055. }),
  6056. globals.Point);
  6057. smalltalk.addMethod(
  6058. smalltalk.method({
  6059. selector: "/",
  6060. protocol: 'arithmetic',
  6061. fn: function (aPoint){
  6062. var self=this;
  6063. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  6064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6065. return smalltalk.withContext(function($ctx1) {
  6066. //>>excludeEnd("ctx");
  6067. var $3,$5,$4,$2,$7,$6,$1;
  6068. $3=self._x();
  6069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6070. $ctx1.sendIdx["x"]=1;
  6071. //>>excludeEnd("ctx");
  6072. $5=_st(aPoint)._asPoint();
  6073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6074. $ctx1.sendIdx["asPoint"]=1;
  6075. //>>excludeEnd("ctx");
  6076. $4=_st($5)._x();
  6077. $2=_st($3).__slash($4);
  6078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6079. $ctx1.sendIdx["/"]=1;
  6080. //>>excludeEnd("ctx");
  6081. $7=self._y();
  6082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6083. $ctx1.sendIdx["y"]=1;
  6084. //>>excludeEnd("ctx");
  6085. $6=_st($7).__slash(_st(_st(aPoint)._asPoint())._y());
  6086. $1=_st($Point())._x_y_($2,$6);
  6087. return $1;
  6088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6089. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},globals.Point)});
  6090. //>>excludeEnd("ctx");
  6091. },
  6092. //>>excludeStart("ide", pragmas.excludeIdeData);
  6093. args: ["aPoint"],
  6094. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6095. referencedClasses: ["Point"],
  6096. //>>excludeEnd("ide");
  6097. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6098. }),
  6099. globals.Point);
  6100. smalltalk.addMethod(
  6101. smalltalk.method({
  6102. selector: "<",
  6103. protocol: 'comparing',
  6104. fn: function (aPoint){
  6105. var self=this;
  6106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6107. return smalltalk.withContext(function($ctx1) {
  6108. //>>excludeEnd("ctx");
  6109. var $3,$2,$4,$1;
  6110. $3=self._x();
  6111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6112. $ctx1.sendIdx["x"]=1;
  6113. //>>excludeEnd("ctx");
  6114. $2=_st($3).__lt(_st(aPoint)._x());
  6115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6116. $ctx1.sendIdx["<"]=1;
  6117. //>>excludeEnd("ctx");
  6118. $1=_st($2)._and_((function(){
  6119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6120. return smalltalk.withContext(function($ctx2) {
  6121. //>>excludeEnd("ctx");
  6122. $4=self._y();
  6123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6124. $ctx2.sendIdx["y"]=1;
  6125. //>>excludeEnd("ctx");
  6126. return _st($4).__lt(_st(aPoint)._y());
  6127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6129. //>>excludeEnd("ctx");
  6130. }));
  6131. return $1;
  6132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6133. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},globals.Point)});
  6134. //>>excludeEnd("ctx");
  6135. },
  6136. //>>excludeStart("ide", pragmas.excludeIdeData);
  6137. args: ["aPoint"],
  6138. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6139. referencedClasses: [],
  6140. //>>excludeEnd("ide");
  6141. messageSends: ["and:", "<", "x", "y"]
  6142. }),
  6143. globals.Point);
  6144. smalltalk.addMethod(
  6145. smalltalk.method({
  6146. selector: "<=",
  6147. protocol: 'comparing',
  6148. fn: function (aPoint){
  6149. var self=this;
  6150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6151. return smalltalk.withContext(function($ctx1) {
  6152. //>>excludeEnd("ctx");
  6153. var $3,$2,$4,$1;
  6154. $3=self._x();
  6155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6156. $ctx1.sendIdx["x"]=1;
  6157. //>>excludeEnd("ctx");
  6158. $2=_st($3).__lt_eq(_st(aPoint)._x());
  6159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6160. $ctx1.sendIdx["<="]=1;
  6161. //>>excludeEnd("ctx");
  6162. $1=_st($2)._and_((function(){
  6163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6164. return smalltalk.withContext(function($ctx2) {
  6165. //>>excludeEnd("ctx");
  6166. $4=self._y();
  6167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6168. $ctx2.sendIdx["y"]=1;
  6169. //>>excludeEnd("ctx");
  6170. return _st($4).__lt_eq(_st(aPoint)._y());
  6171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6173. //>>excludeEnd("ctx");
  6174. }));
  6175. return $1;
  6176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6177. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},globals.Point)});
  6178. //>>excludeEnd("ctx");
  6179. },
  6180. //>>excludeStart("ide", pragmas.excludeIdeData);
  6181. args: ["aPoint"],
  6182. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6183. referencedClasses: [],
  6184. //>>excludeEnd("ide");
  6185. messageSends: ["and:", "<=", "x", "y"]
  6186. }),
  6187. globals.Point);
  6188. smalltalk.addMethod(
  6189. smalltalk.method({
  6190. selector: "=",
  6191. protocol: 'comparing',
  6192. fn: function (aPoint){
  6193. var self=this;
  6194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6195. return smalltalk.withContext(function($ctx1) {
  6196. //>>excludeEnd("ctx");
  6197. var $3,$2,$5,$4,$7,$6,$1;
  6198. $3=_st(aPoint)._class();
  6199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6200. $ctx1.sendIdx["class"]=1;
  6201. //>>excludeEnd("ctx");
  6202. $2=_st($3).__eq(self._class());
  6203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6204. $ctx1.sendIdx["="]=1;
  6205. //>>excludeEnd("ctx");
  6206. $1=_st($2)._and_((function(){
  6207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6208. return smalltalk.withContext(function($ctx2) {
  6209. //>>excludeEnd("ctx");
  6210. $5=_st(aPoint)._x();
  6211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6212. $ctx2.sendIdx["x"]=1;
  6213. //>>excludeEnd("ctx");
  6214. $4=_st($5).__eq(self._x());
  6215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6216. $ctx2.sendIdx["="]=2;
  6217. //>>excludeEnd("ctx");
  6218. $7=_st(aPoint)._y();
  6219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6220. $ctx2.sendIdx["y"]=1;
  6221. //>>excludeEnd("ctx");
  6222. $6=_st($7).__eq(self._y());
  6223. return _st($4).__and($6);
  6224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6226. //>>excludeEnd("ctx");
  6227. }));
  6228. return $1;
  6229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6230. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},globals.Point)});
  6231. //>>excludeEnd("ctx");
  6232. },
  6233. //>>excludeStart("ide", pragmas.excludeIdeData);
  6234. args: ["aPoint"],
  6235. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6236. referencedClasses: [],
  6237. //>>excludeEnd("ide");
  6238. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6239. }),
  6240. globals.Point);
  6241. smalltalk.addMethod(
  6242. smalltalk.method({
  6243. selector: ">",
  6244. protocol: 'comparing',
  6245. fn: function (aPoint){
  6246. var self=this;
  6247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6248. return smalltalk.withContext(function($ctx1) {
  6249. //>>excludeEnd("ctx");
  6250. var $3,$2,$4,$1;
  6251. $3=self._x();
  6252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6253. $ctx1.sendIdx["x"]=1;
  6254. //>>excludeEnd("ctx");
  6255. $2=_st($3).__gt(_st(aPoint)._x());
  6256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6257. $ctx1.sendIdx[">"]=1;
  6258. //>>excludeEnd("ctx");
  6259. $1=_st($2)._and_((function(){
  6260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6261. return smalltalk.withContext(function($ctx2) {
  6262. //>>excludeEnd("ctx");
  6263. $4=self._y();
  6264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6265. $ctx2.sendIdx["y"]=1;
  6266. //>>excludeEnd("ctx");
  6267. return _st($4).__gt(_st(aPoint)._y());
  6268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6270. //>>excludeEnd("ctx");
  6271. }));
  6272. return $1;
  6273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6274. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},globals.Point)});
  6275. //>>excludeEnd("ctx");
  6276. },
  6277. //>>excludeStart("ide", pragmas.excludeIdeData);
  6278. args: ["aPoint"],
  6279. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6280. referencedClasses: [],
  6281. //>>excludeEnd("ide");
  6282. messageSends: ["and:", ">", "x", "y"]
  6283. }),
  6284. globals.Point);
  6285. smalltalk.addMethod(
  6286. smalltalk.method({
  6287. selector: ">=",
  6288. protocol: 'comparing',
  6289. fn: function (aPoint){
  6290. var self=this;
  6291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6292. return smalltalk.withContext(function($ctx1) {
  6293. //>>excludeEnd("ctx");
  6294. var $3,$2,$4,$1;
  6295. $3=self._x();
  6296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6297. $ctx1.sendIdx["x"]=1;
  6298. //>>excludeEnd("ctx");
  6299. $2=_st($3).__gt_eq(_st(aPoint)._x());
  6300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6301. $ctx1.sendIdx[">="]=1;
  6302. //>>excludeEnd("ctx");
  6303. $1=_st($2)._and_((function(){
  6304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6305. return smalltalk.withContext(function($ctx2) {
  6306. //>>excludeEnd("ctx");
  6307. $4=self._y();
  6308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6309. $ctx2.sendIdx["y"]=1;
  6310. //>>excludeEnd("ctx");
  6311. return _st($4).__gt_eq(_st(aPoint)._y());
  6312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6314. //>>excludeEnd("ctx");
  6315. }));
  6316. return $1;
  6317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6318. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},globals.Point)});
  6319. //>>excludeEnd("ctx");
  6320. },
  6321. //>>excludeStart("ide", pragmas.excludeIdeData);
  6322. args: ["aPoint"],
  6323. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6324. referencedClasses: [],
  6325. //>>excludeEnd("ide");
  6326. messageSends: ["and:", ">=", "x", "y"]
  6327. }),
  6328. globals.Point);
  6329. smalltalk.addMethod(
  6330. smalltalk.method({
  6331. selector: "asPoint",
  6332. protocol: 'converting',
  6333. fn: function (){
  6334. var self=this;
  6335. return self;
  6336. },
  6337. //>>excludeStart("ide", pragmas.excludeIdeData);
  6338. args: [],
  6339. source: "asPoint\x0a\x09^ self",
  6340. referencedClasses: [],
  6341. //>>excludeEnd("ide");
  6342. messageSends: []
  6343. }),
  6344. globals.Point);
  6345. smalltalk.addMethod(
  6346. smalltalk.method({
  6347. selector: "dist:",
  6348. protocol: 'transforming',
  6349. fn: function (aPoint){
  6350. var self=this;
  6351. var dx,dy;
  6352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6353. return smalltalk.withContext(function($ctx1) {
  6354. //>>excludeEnd("ctx");
  6355. var $3,$2,$1;
  6356. dx=_st(_st(aPoint)._x()).__minus(self["@x"]);
  6357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6358. $ctx1.sendIdx["-"]=1;
  6359. //>>excludeEnd("ctx");
  6360. dy=_st(_st(aPoint)._y()).__minus(self["@y"]);
  6361. $3=_st(dx).__star(dx);
  6362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6363. $ctx1.sendIdx["*"]=1;
  6364. //>>excludeEnd("ctx");
  6365. $2=_st($3).__plus(_st(dy).__star(dy));
  6366. $1=_st($2)._sqrt();
  6367. return $1;
  6368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6369. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},globals.Point)});
  6370. //>>excludeEnd("ctx");
  6371. },
  6372. //>>excludeStart("ide", pragmas.excludeIdeData);
  6373. args: ["aPoint"],
  6374. source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
  6375. referencedClasses: [],
  6376. //>>excludeEnd("ide");
  6377. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6378. }),
  6379. globals.Point);
  6380. smalltalk.addMethod(
  6381. smalltalk.method({
  6382. selector: "printOn:",
  6383. protocol: 'printing',
  6384. fn: function (aStream){
  6385. var self=this;
  6386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6387. return smalltalk.withContext(function($ctx1) {
  6388. //>>excludeEnd("ctx");
  6389. var $1;
  6390. _st(self["@x"])._printOn_(aStream);
  6391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6392. $ctx1.sendIdx["printOn:"]=1;
  6393. //>>excludeEnd("ctx");
  6394. _st(aStream)._nextPutAll_("@");
  6395. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  6396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6397. return smalltalk.withContext(function($ctx2) {
  6398. //>>excludeEnd("ctx");
  6399. return _st(self["@y"])._negative();
  6400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6402. //>>excludeEnd("ctx");
  6403. }));
  6404. if(smalltalk.assert($1)){
  6405. _st(aStream)._space();
  6406. };
  6407. _st(self["@y"])._printOn_(aStream);
  6408. return self;
  6409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6410. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Point)});
  6411. //>>excludeEnd("ctx");
  6412. },
  6413. //>>excludeStart("ide", pragmas.excludeIdeData);
  6414. args: ["aStream"],
  6415. 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",
  6416. referencedClasses: [],
  6417. //>>excludeEnd("ide");
  6418. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6419. }),
  6420. globals.Point);
  6421. smalltalk.addMethod(
  6422. smalltalk.method({
  6423. selector: "translateBy:",
  6424. protocol: 'transforming',
  6425. fn: function (delta){
  6426. var self=this;
  6427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6428. return smalltalk.withContext(function($ctx1) {
  6429. //>>excludeEnd("ctx");
  6430. var $2,$1;
  6431. $2=_st(_st(delta)._x()).__plus(self["@x"]);
  6432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6433. $ctx1.sendIdx["+"]=1;
  6434. //>>excludeEnd("ctx");
  6435. $1=_st($2).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  6436. return $1;
  6437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6438. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},globals.Point)});
  6439. //>>excludeEnd("ctx");
  6440. },
  6441. //>>excludeStart("ide", pragmas.excludeIdeData);
  6442. args: ["delta"],
  6443. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6444. referencedClasses: [],
  6445. //>>excludeEnd("ide");
  6446. messageSends: ["@", "+", "x", "y"]
  6447. }),
  6448. globals.Point);
  6449. smalltalk.addMethod(
  6450. smalltalk.method({
  6451. selector: "x",
  6452. protocol: 'accessing',
  6453. fn: function (){
  6454. var self=this;
  6455. var $1;
  6456. $1=self["@x"];
  6457. return $1;
  6458. },
  6459. //>>excludeStart("ide", pragmas.excludeIdeData);
  6460. args: [],
  6461. source: "x\x0a\x09^ x",
  6462. referencedClasses: [],
  6463. //>>excludeEnd("ide");
  6464. messageSends: []
  6465. }),
  6466. globals.Point);
  6467. smalltalk.addMethod(
  6468. smalltalk.method({
  6469. selector: "x:",
  6470. protocol: 'accessing',
  6471. fn: function (aNumber){
  6472. var self=this;
  6473. self["@x"]=aNumber;
  6474. return self;
  6475. },
  6476. //>>excludeStart("ide", pragmas.excludeIdeData);
  6477. args: ["aNumber"],
  6478. source: "x: aNumber\x0a\x09x := aNumber",
  6479. referencedClasses: [],
  6480. //>>excludeEnd("ide");
  6481. messageSends: []
  6482. }),
  6483. globals.Point);
  6484. smalltalk.addMethod(
  6485. smalltalk.method({
  6486. selector: "y",
  6487. protocol: 'accessing',
  6488. fn: function (){
  6489. var self=this;
  6490. var $1;
  6491. $1=self["@y"];
  6492. return $1;
  6493. },
  6494. //>>excludeStart("ide", pragmas.excludeIdeData);
  6495. args: [],
  6496. source: "y\x0a\x09^ y",
  6497. referencedClasses: [],
  6498. //>>excludeEnd("ide");
  6499. messageSends: []
  6500. }),
  6501. globals.Point);
  6502. smalltalk.addMethod(
  6503. smalltalk.method({
  6504. selector: "y:",
  6505. protocol: 'accessing',
  6506. fn: function (aNumber){
  6507. var self=this;
  6508. self["@y"]=aNumber;
  6509. return self;
  6510. },
  6511. //>>excludeStart("ide", pragmas.excludeIdeData);
  6512. args: ["aNumber"],
  6513. source: "y: aNumber\x0a\x09y := aNumber",
  6514. referencedClasses: [],
  6515. //>>excludeEnd("ide");
  6516. messageSends: []
  6517. }),
  6518. globals.Point);
  6519. smalltalk.addMethod(
  6520. smalltalk.method({
  6521. selector: "heliosClass",
  6522. protocol: 'helios',
  6523. fn: function (){
  6524. var self=this;
  6525. return "magnitude";
  6526. },
  6527. //>>excludeStart("ide", pragmas.excludeIdeData);
  6528. args: [],
  6529. source: "heliosClass\x0a\x09^ 'magnitude'",
  6530. referencedClasses: [],
  6531. //>>excludeEnd("ide");
  6532. messageSends: []
  6533. }),
  6534. globals.Point.klass);
  6535. smalltalk.addMethod(
  6536. smalltalk.method({
  6537. selector: "x:y:",
  6538. protocol: 'instance creation',
  6539. fn: function (aNumber,anotherNumber){
  6540. var self=this;
  6541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6542. return smalltalk.withContext(function($ctx1) {
  6543. //>>excludeEnd("ctx");
  6544. var $2,$3,$1;
  6545. $2=self._new();
  6546. _st($2)._x_(aNumber);
  6547. _st($2)._y_(anotherNumber);
  6548. $3=_st($2)._yourself();
  6549. $1=$3;
  6550. return $1;
  6551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6552. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Point.klass)});
  6553. //>>excludeEnd("ctx");
  6554. },
  6555. //>>excludeStart("ide", pragmas.excludeIdeData);
  6556. args: ["aNumber", "anotherNumber"],
  6557. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6558. referencedClasses: [],
  6559. //>>excludeEnd("ide");
  6560. messageSends: ["x:", "new", "y:", "yourself"]
  6561. }),
  6562. globals.Point.klass);
  6563. smalltalk.addClass('Random', globals.Object, [], 'Kernel-Objects');
  6564. //>>excludeStart("ide", pragmas.excludeIdeData);
  6565. globals.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\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\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe 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\x0aAs well as 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'`.";
  6566. //>>excludeEnd("ide");
  6567. smalltalk.addMethod(
  6568. smalltalk.method({
  6569. selector: "next",
  6570. protocol: 'accessing',
  6571. fn: function (){
  6572. var self=this;
  6573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6574. return smalltalk.withContext(function($ctx1) {
  6575. //>>excludeEnd("ctx");
  6576. return Math.random();
  6577. return self;
  6578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6579. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Random)});
  6580. //>>excludeEnd("ctx");
  6581. },
  6582. //>>excludeStart("ide", pragmas.excludeIdeData);
  6583. args: [],
  6584. source: "next\x0a\x09<return Math.random()>",
  6585. referencedClasses: [],
  6586. //>>excludeEnd("ide");
  6587. messageSends: []
  6588. }),
  6589. globals.Random);
  6590. smalltalk.addMethod(
  6591. smalltalk.method({
  6592. selector: "next:",
  6593. protocol: 'accessing',
  6594. fn: function (anInteger){
  6595. var self=this;
  6596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6597. return smalltalk.withContext(function($ctx1) {
  6598. //>>excludeEnd("ctx");
  6599. var $1;
  6600. $1=_st((1)._to_(anInteger))._collect_((function(each){
  6601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6602. return smalltalk.withContext(function($ctx2) {
  6603. //>>excludeEnd("ctx");
  6604. return self._next();
  6605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6606. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6607. //>>excludeEnd("ctx");
  6608. }));
  6609. return $1;
  6610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6611. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},globals.Random)});
  6612. //>>excludeEnd("ctx");
  6613. },
  6614. //>>excludeStart("ide", pragmas.excludeIdeData);
  6615. args: ["anInteger"],
  6616. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6617. referencedClasses: [],
  6618. //>>excludeEnd("ide");
  6619. messageSends: ["collect:", "to:", "next"]
  6620. }),
  6621. globals.Random);
  6622. smalltalk.addClass('UndefinedObject', globals.Object, [], 'Kernel-Objects');
  6623. //>>excludeStart("ide", pragmas.excludeIdeData);
  6624. globals.UndefinedObject.comment="I describe the behavior of my 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 equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
  6625. //>>excludeEnd("ide");
  6626. smalltalk.addMethod(
  6627. smalltalk.method({
  6628. selector: "asJSON",
  6629. protocol: 'converting',
  6630. fn: function (){
  6631. var self=this;
  6632. var $1;
  6633. $1=null;
  6634. return $1;
  6635. },
  6636. //>>excludeStart("ide", pragmas.excludeIdeData);
  6637. args: [],
  6638. source: "asJSON\x0a\x09^ null",
  6639. referencedClasses: [],
  6640. //>>excludeEnd("ide");
  6641. messageSends: []
  6642. }),
  6643. globals.UndefinedObject);
  6644. smalltalk.addMethod(
  6645. smalltalk.method({
  6646. selector: "deepCopy",
  6647. protocol: 'copying',
  6648. fn: function (){
  6649. var self=this;
  6650. return self;
  6651. },
  6652. //>>excludeStart("ide", pragmas.excludeIdeData);
  6653. args: [],
  6654. source: "deepCopy\x0a\x09^ self",
  6655. referencedClasses: [],
  6656. //>>excludeEnd("ide");
  6657. messageSends: []
  6658. }),
  6659. globals.UndefinedObject);
  6660. smalltalk.addMethod(
  6661. smalltalk.method({
  6662. selector: "ifNil:",
  6663. protocol: 'testing',
  6664. fn: function (aBlock){
  6665. var self=this;
  6666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6667. return smalltalk.withContext(function($ctx1) {
  6668. //>>excludeEnd("ctx");
  6669. var $1;
  6670. $1=self._ifNil_ifNotNil_(aBlock,(function(){
  6671. }));
  6672. return $1;
  6673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6674. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},globals.UndefinedObject)});
  6675. //>>excludeEnd("ctx");
  6676. },
  6677. //>>excludeStart("ide", pragmas.excludeIdeData);
  6678. args: ["aBlock"],
  6679. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  6680. referencedClasses: [],
  6681. //>>excludeEnd("ide");
  6682. messageSends: ["ifNil:ifNotNil:"]
  6683. }),
  6684. globals.UndefinedObject);
  6685. smalltalk.addMethod(
  6686. smalltalk.method({
  6687. selector: "ifNil:ifNotNil:",
  6688. protocol: 'testing',
  6689. fn: function (aBlock,anotherBlock){
  6690. var self=this;
  6691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6692. return smalltalk.withContext(function($ctx1) {
  6693. //>>excludeEnd("ctx");
  6694. var $1;
  6695. $1=_st(aBlock)._value();
  6696. return $1;
  6697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6698. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)});
  6699. //>>excludeEnd("ctx");
  6700. },
  6701. //>>excludeStart("ide", pragmas.excludeIdeData);
  6702. args: ["aBlock", "anotherBlock"],
  6703. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  6704. referencedClasses: [],
  6705. //>>excludeEnd("ide");
  6706. messageSends: ["value"]
  6707. }),
  6708. globals.UndefinedObject);
  6709. smalltalk.addMethod(
  6710. smalltalk.method({
  6711. selector: "ifNotNil:",
  6712. protocol: 'testing',
  6713. fn: function (aBlock){
  6714. var self=this;
  6715. return self;
  6716. },
  6717. //>>excludeStart("ide", pragmas.excludeIdeData);
  6718. args: ["aBlock"],
  6719. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  6720. referencedClasses: [],
  6721. //>>excludeEnd("ide");
  6722. messageSends: []
  6723. }),
  6724. globals.UndefinedObject);
  6725. smalltalk.addMethod(
  6726. smalltalk.method({
  6727. selector: "ifNotNil:ifNil:",
  6728. protocol: 'testing',
  6729. fn: function (aBlock,anotherBlock){
  6730. var self=this;
  6731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6732. return smalltalk.withContext(function($ctx1) {
  6733. //>>excludeEnd("ctx");
  6734. var $1;
  6735. $1=_st(anotherBlock)._value();
  6736. return $1;
  6737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6738. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)});
  6739. //>>excludeEnd("ctx");
  6740. },
  6741. //>>excludeStart("ide", pragmas.excludeIdeData);
  6742. args: ["aBlock", "anotherBlock"],
  6743. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  6744. referencedClasses: [],
  6745. //>>excludeEnd("ide");
  6746. messageSends: ["value"]
  6747. }),
  6748. globals.UndefinedObject);
  6749. smalltalk.addMethod(
  6750. smalltalk.method({
  6751. selector: "isImmutable",
  6752. protocol: 'testing',
  6753. fn: function (){
  6754. var self=this;
  6755. return true;
  6756. },
  6757. //>>excludeStart("ide", pragmas.excludeIdeData);
  6758. args: [],
  6759. source: "isImmutable\x0a\x09^ true",
  6760. referencedClasses: [],
  6761. //>>excludeEnd("ide");
  6762. messageSends: []
  6763. }),
  6764. globals.UndefinedObject);
  6765. smalltalk.addMethod(
  6766. smalltalk.method({
  6767. selector: "isNil",
  6768. protocol: 'testing',
  6769. fn: function (){
  6770. var self=this;
  6771. return true;
  6772. },
  6773. //>>excludeStart("ide", pragmas.excludeIdeData);
  6774. args: [],
  6775. source: "isNil\x0a\x09^ true",
  6776. referencedClasses: [],
  6777. //>>excludeEnd("ide");
  6778. messageSends: []
  6779. }),
  6780. globals.UndefinedObject);
  6781. smalltalk.addMethod(
  6782. smalltalk.method({
  6783. selector: "notNil",
  6784. protocol: 'testing',
  6785. fn: function (){
  6786. var self=this;
  6787. return false;
  6788. },
  6789. //>>excludeStart("ide", pragmas.excludeIdeData);
  6790. args: [],
  6791. source: "notNil\x0a\x09^ false",
  6792. referencedClasses: [],
  6793. //>>excludeEnd("ide");
  6794. messageSends: []
  6795. }),
  6796. globals.UndefinedObject);
  6797. smalltalk.addMethod(
  6798. smalltalk.method({
  6799. selector: "printOn:",
  6800. protocol: 'printing',
  6801. fn: function (aStream){
  6802. var self=this;
  6803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6804. return smalltalk.withContext(function($ctx1) {
  6805. //>>excludeEnd("ctx");
  6806. _st(aStream)._nextPutAll_("nil");
  6807. return self;
  6808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6809. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.UndefinedObject)});
  6810. //>>excludeEnd("ctx");
  6811. },
  6812. //>>excludeStart("ide", pragmas.excludeIdeData);
  6813. args: ["aStream"],
  6814. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  6815. referencedClasses: [],
  6816. //>>excludeEnd("ide");
  6817. messageSends: ["nextPutAll:"]
  6818. }),
  6819. globals.UndefinedObject);
  6820. smalltalk.addMethod(
  6821. smalltalk.method({
  6822. selector: "shallowCopy",
  6823. protocol: 'copying',
  6824. fn: function (){
  6825. var self=this;
  6826. return self;
  6827. },
  6828. //>>excludeStart("ide", pragmas.excludeIdeData);
  6829. args: [],
  6830. source: "shallowCopy\x0a\x09^ self",
  6831. referencedClasses: [],
  6832. //>>excludeEnd("ide");
  6833. messageSends: []
  6834. }),
  6835. globals.UndefinedObject);
  6836. smalltalk.addMethod(
  6837. smalltalk.method({
  6838. selector: "subclass:instanceVariableNames:",
  6839. protocol: 'class creation',
  6840. fn: function (aString,anotherString){
  6841. var self=this;
  6842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6843. return smalltalk.withContext(function($ctx1) {
  6844. //>>excludeEnd("ctx");
  6845. var $1;
  6846. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6847. return $1;
  6848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6849. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.UndefinedObject)});
  6850. //>>excludeEnd("ctx");
  6851. },
  6852. //>>excludeStart("ide", pragmas.excludeIdeData);
  6853. args: ["aString", "anotherString"],
  6854. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6855. referencedClasses: [],
  6856. //>>excludeEnd("ide");
  6857. messageSends: ["subclass:instanceVariableNames:package:"]
  6858. }),
  6859. globals.UndefinedObject);
  6860. smalltalk.addMethod(
  6861. smalltalk.method({
  6862. selector: "subclass:instanceVariableNames:category:",
  6863. protocol: 'class creation',
  6864. fn: function (aString,aString2,aString3){
  6865. var self=this;
  6866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6867. return smalltalk.withContext(function($ctx1) {
  6868. //>>excludeEnd("ctx");
  6869. var $1;
  6870. self._deprecatedAPI();
  6871. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6872. return $1;
  6873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6874. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)});
  6875. //>>excludeEnd("ctx");
  6876. },
  6877. //>>excludeStart("ide", pragmas.excludeIdeData);
  6878. args: ["aString", "aString2", "aString3"],
  6879. 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",
  6880. referencedClasses: [],
  6881. //>>excludeEnd("ide");
  6882. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"]
  6883. }),
  6884. globals.UndefinedObject);
  6885. smalltalk.addMethod(
  6886. smalltalk.method({
  6887. selector: "subclass:instanceVariableNames:package:",
  6888. protocol: 'class creation',
  6889. fn: function (aString,aString2,aString3){
  6890. var self=this;
  6891. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6893. return smalltalk.withContext(function($ctx1) {
  6894. //>>excludeEnd("ctx");
  6895. var $1;
  6896. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  6897. return $1;
  6898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6899. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)});
  6900. //>>excludeEnd("ctx");
  6901. },
  6902. //>>excludeStart("ide", pragmas.excludeIdeData);
  6903. args: ["aString", "aString2", "aString3"],
  6904. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6905. referencedClasses: ["ClassBuilder"],
  6906. //>>excludeEnd("ide");
  6907. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  6908. }),
  6909. globals.UndefinedObject);
  6910. smalltalk.addMethod(
  6911. smalltalk.method({
  6912. selector: "new",
  6913. protocol: 'instance creation',
  6914. fn: function (){
  6915. var self=this;
  6916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6917. return smalltalk.withContext(function($ctx1) {
  6918. //>>excludeEnd("ctx");
  6919. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  6920. return self;
  6921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6922. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.UndefinedObject.klass)});
  6923. //>>excludeEnd("ctx");
  6924. },
  6925. //>>excludeStart("ide", pragmas.excludeIdeData);
  6926. args: [],
  6927. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  6928. referencedClasses: [],
  6929. //>>excludeEnd("ide");
  6930. messageSends: ["error:"]
  6931. }),
  6932. globals.UndefinedObject.klass);
  6933. });
  6934. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  6935. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  6936. smalltalk.addPackage('Kernel-Classes');
  6937. smalltalk.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6938. smalltalk.addClass('Behavior', globals.Object, [], 'Kernel-Classes');
  6939. //>>excludeStart("ide", pragmas.excludeIdeData);
  6940. globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  6941. //>>excludeEnd("ide");
  6942. smalltalk.addMethod(
  6943. smalltalk.method({
  6944. selector: ">>",
  6945. protocol: 'accessing',
  6946. fn: function (aString){
  6947. var self=this;
  6948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6949. return smalltalk.withContext(function($ctx1) {
  6950. //>>excludeEnd("ctx");
  6951. var $1;
  6952. $1=self._methodAt_(aString);
  6953. return $1;
  6954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6955. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},globals.Behavior)});
  6956. //>>excludeEnd("ctx");
  6957. },
  6958. //>>excludeStart("ide", pragmas.excludeIdeData);
  6959. args: ["aString"],
  6960. source: ">> aString\x0a\x09^ self methodAt: aString",
  6961. referencedClasses: [],
  6962. //>>excludeEnd("ide");
  6963. messageSends: ["methodAt:"]
  6964. }),
  6965. globals.Behavior);
  6966. smalltalk.addMethod(
  6967. smalltalk.method({
  6968. selector: "addCompiledMethod:",
  6969. protocol: 'compiling',
  6970. fn: function (aMethod){
  6971. var self=this;
  6972. var oldMethod,announcement;
  6973. function $MethodAdded(){return globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  6974. function $MethodModified(){return globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  6975. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6977. return smalltalk.withContext(function($ctx1) {
  6978. //>>excludeEnd("ctx");
  6979. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  6980. oldMethod=_st(self._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
  6981. return nil;
  6982. }));
  6983. $2=self._protocols();
  6984. $3=_st(aMethod)._protocol();
  6985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6986. $ctx1.sendIdx["protocol"]=1;
  6987. //>>excludeEnd("ctx");
  6988. $1=_st($2)._includes_($3);
  6989. if(! smalltalk.assert($1)){
  6990. $4=self._organization();
  6991. $5=_st(aMethod)._protocol();
  6992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6993. $ctx1.sendIdx["protocol"]=2;
  6994. //>>excludeEnd("ctx");
  6995. _st($4)._addElement_($5);
  6996. };
  6997. self._basicAddCompiledMethod_(aMethod);
  6998. $6=oldMethod;
  6999. if(($receiver = $6) == null || $receiver.isNil){
  7000. $6;
  7001. } else {
  7002. self._removeProtocolIfEmpty_(_st(oldMethod)._protocol());
  7003. };
  7004. $7=oldMethod;
  7005. if(($receiver = $7) == null || $receiver.isNil){
  7006. $8=_st($MethodAdded())._new();
  7007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7008. $ctx1.sendIdx["new"]=1;
  7009. //>>excludeEnd("ctx");
  7010. _st($8)._method_(aMethod);
  7011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7012. $ctx1.sendIdx["method:"]=1;
  7013. //>>excludeEnd("ctx");
  7014. $9=_st($8)._yourself();
  7015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7016. $ctx1.sendIdx["yourself"]=1;
  7017. //>>excludeEnd("ctx");
  7018. announcement=$9;
  7019. } else {
  7020. $10=_st($MethodModified())._new();
  7021. _st($10)._oldMethod_(oldMethod);
  7022. _st($10)._method_(aMethod);
  7023. $11=_st($10)._yourself();
  7024. announcement=$11;
  7025. };
  7026. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  7027. return self;
  7028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7029. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},globals.Behavior)});
  7030. //>>excludeEnd("ctx");
  7031. },
  7032. //>>excludeStart("ide", pragmas.excludeIdeData);
  7033. args: ["aMethod"],
  7034. 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\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\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",
  7035. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  7036. //>>excludeEnd("ide");
  7037. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  7038. }),
  7039. globals.Behavior);
  7040. smalltalk.addMethod(
  7041. smalltalk.method({
  7042. selector: "allInstanceVariableNames",
  7043. protocol: 'accessing',
  7044. fn: function (){
  7045. var self=this;
  7046. var result;
  7047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7048. return smalltalk.withContext(function($ctx1) {
  7049. //>>excludeEnd("ctx");
  7050. var $1,$2,$receiver;
  7051. result=_st(self._instanceVariableNames())._copy();
  7052. $1=self._superclass();
  7053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7054. $ctx1.sendIdx["superclass"]=1;
  7055. //>>excludeEnd("ctx");
  7056. if(($receiver = $1) == null || $receiver.isNil){
  7057. $1;
  7058. } else {
  7059. _st(result)._addAll_(_st(self._superclass())._allInstanceVariableNames());
  7060. };
  7061. $2=result;
  7062. return $2;
  7063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7064. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},globals.Behavior)});
  7065. //>>excludeEnd("ctx");
  7066. },
  7067. //>>excludeStart("ide", pragmas.excludeIdeData);
  7068. args: [],
  7069. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  7070. referencedClasses: [],
  7071. //>>excludeEnd("ide");
  7072. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  7073. }),
  7074. globals.Behavior);
  7075. smalltalk.addMethod(
  7076. smalltalk.method({
  7077. selector: "allSelectors",
  7078. protocol: 'accessing',
  7079. fn: function (){
  7080. var self=this;
  7081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7082. return smalltalk.withContext(function($ctx1) {
  7083. //>>excludeEnd("ctx");
  7084. var $2,$3,$4,$1;
  7085. $2=self._allSuperclasses();
  7086. $3=self._selectors();
  7087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7088. $ctx1.sendIdx["selectors"]=1;
  7089. //>>excludeEnd("ctx");
  7090. $1=_st($2)._inject_into_($3,(function(acc,each){
  7091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7092. return smalltalk.withContext(function($ctx2) {
  7093. //>>excludeEnd("ctx");
  7094. _st(acc)._addAll_(_st(each)._selectors());
  7095. $4=_st(acc)._yourself();
  7096. return $4;
  7097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7098. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  7099. //>>excludeEnd("ctx");
  7100. }));
  7101. return $1;
  7102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7103. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Behavior)});
  7104. //>>excludeEnd("ctx");
  7105. },
  7106. //>>excludeStart("ide", pragmas.excludeIdeData);
  7107. args: [],
  7108. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  7109. referencedClasses: [],
  7110. //>>excludeEnd("ide");
  7111. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  7112. }),
  7113. globals.Behavior);
  7114. smalltalk.addMethod(
  7115. smalltalk.method({
  7116. selector: "allSubclasses",
  7117. protocol: 'accessing',
  7118. fn: function (){
  7119. var self=this;
  7120. var subclasses,index;
  7121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7122. return smalltalk.withContext(function($ctx1) {
  7123. //>>excludeEnd("ctx");
  7124. var $1;
  7125. subclasses=self._subclasses();
  7126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7127. $ctx1.sendIdx["subclasses"]=1;
  7128. //>>excludeEnd("ctx");
  7129. index=(1);
  7130. _st((function(){
  7131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7132. return smalltalk.withContext(function($ctx2) {
  7133. //>>excludeEnd("ctx");
  7134. return _st(index).__gt(_st(subclasses)._size());
  7135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7137. //>>excludeEnd("ctx");
  7138. }))._whileFalse_((function(){
  7139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7140. return smalltalk.withContext(function($ctx2) {
  7141. //>>excludeEnd("ctx");
  7142. _st(subclasses)._addAll_(_st(_st(subclasses)._at_(index))._subclasses());
  7143. index=_st(index).__plus((1));
  7144. return index;
  7145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7147. //>>excludeEnd("ctx");
  7148. }));
  7149. $1=subclasses;
  7150. return $1;
  7151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7152. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},globals.Behavior)});
  7153. //>>excludeEnd("ctx");
  7154. },
  7155. //>>excludeStart("ide", pragmas.excludeIdeData);
  7156. args: [],
  7157. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09^ subclasses",
  7158. referencedClasses: [],
  7159. //>>excludeEnd("ide");
  7160. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
  7161. }),
  7162. globals.Behavior);
  7163. smalltalk.addMethod(
  7164. smalltalk.method({
  7165. selector: "allSubclassesDo:",
  7166. protocol: 'enumerating',
  7167. fn: function (aBlock){
  7168. var self=this;
  7169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7170. return smalltalk.withContext(function($ctx1) {
  7171. //>>excludeEnd("ctx");
  7172. _st(self._allSubclasses())._do_((function(each){
  7173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7174. return smalltalk.withContext(function($ctx2) {
  7175. //>>excludeEnd("ctx");
  7176. return _st(aBlock)._value_(each);
  7177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7179. //>>excludeEnd("ctx");
  7180. }));
  7181. return self;
  7182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7183. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},globals.Behavior)});
  7184. //>>excludeEnd("ctx");
  7185. },
  7186. //>>excludeStart("ide", pragmas.excludeIdeData);
  7187. args: ["aBlock"],
  7188. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]",
  7189. referencedClasses: [],
  7190. //>>excludeEnd("ide");
  7191. messageSends: ["do:", "allSubclasses", "value:"]
  7192. }),
  7193. globals.Behavior);
  7194. smalltalk.addMethod(
  7195. smalltalk.method({
  7196. selector: "allSuperclasses",
  7197. protocol: 'accessing',
  7198. fn: function (){
  7199. var self=this;
  7200. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  7201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7202. return smalltalk.withContext(function($ctx1) {
  7203. //>>excludeEnd("ctx");
  7204. var $1,$2,$5,$4,$6,$3,$receiver;
  7205. $1=self._superclass();
  7206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7207. $ctx1.sendIdx["superclass"]=1;
  7208. //>>excludeEnd("ctx");
  7209. if(($receiver = $1) == null || $receiver.isNil){
  7210. $2=[];
  7211. return $2;
  7212. } else {
  7213. $1;
  7214. };
  7215. $5=self._superclass();
  7216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7217. $ctx1.sendIdx["superclass"]=2;
  7218. //>>excludeEnd("ctx");
  7219. $4=_st($OrderedCollection())._with_($5);
  7220. _st($4)._addAll_(_st(self._superclass())._allSuperclasses());
  7221. $6=_st($4)._yourself();
  7222. $3=$6;
  7223. return $3;
  7224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7225. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},globals.Behavior)});
  7226. //>>excludeEnd("ctx");
  7227. },
  7228. //>>excludeStart("ide", pragmas.excludeIdeData);
  7229. args: [],
  7230. 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",
  7231. referencedClasses: ["OrderedCollection"],
  7232. //>>excludeEnd("ide");
  7233. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  7234. }),
  7235. globals.Behavior);
  7236. smalltalk.addMethod(
  7237. smalltalk.method({
  7238. selector: "basicAddCompiledMethod:",
  7239. protocol: 'private',
  7240. fn: function (aMethod){
  7241. var self=this;
  7242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7243. return smalltalk.withContext(function($ctx1) {
  7244. //>>excludeEnd("ctx");
  7245. smalltalk.addMethod(aMethod, self);
  7246. return self;
  7247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7248. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},globals.Behavior)});
  7249. //>>excludeEnd("ctx");
  7250. },
  7251. //>>excludeStart("ide", pragmas.excludeIdeData);
  7252. args: ["aMethod"],
  7253. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
  7254. referencedClasses: [],
  7255. //>>excludeEnd("ide");
  7256. messageSends: []
  7257. }),
  7258. globals.Behavior);
  7259. smalltalk.addMethod(
  7260. smalltalk.method({
  7261. selector: "basicNew",
  7262. protocol: 'instance creation',
  7263. fn: function (){
  7264. var self=this;
  7265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7266. return smalltalk.withContext(function($ctx1) {
  7267. //>>excludeEnd("ctx");
  7268. return new self.fn();
  7269. return self;
  7270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7271. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},globals.Behavior)});
  7272. //>>excludeEnd("ctx");
  7273. },
  7274. //>>excludeStart("ide", pragmas.excludeIdeData);
  7275. args: [],
  7276. source: "basicNew\x0a\x09<return new self.fn()>",
  7277. referencedClasses: [],
  7278. //>>excludeEnd("ide");
  7279. messageSends: []
  7280. }),
  7281. globals.Behavior);
  7282. smalltalk.addMethod(
  7283. smalltalk.method({
  7284. selector: "basicRemoveCompiledMethod:",
  7285. protocol: 'private',
  7286. fn: function (aMethod){
  7287. var self=this;
  7288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7289. return smalltalk.withContext(function($ctx1) {
  7290. //>>excludeEnd("ctx");
  7291. smalltalk.removeMethod(aMethod,self);
  7292. return self;
  7293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7294. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},globals.Behavior)});
  7295. //>>excludeEnd("ctx");
  7296. },
  7297. //>>excludeStart("ide", pragmas.excludeIdeData);
  7298. args: ["aMethod"],
  7299. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<smalltalk.removeMethod(aMethod,self)>",
  7300. referencedClasses: [],
  7301. //>>excludeEnd("ide");
  7302. messageSends: []
  7303. }),
  7304. globals.Behavior);
  7305. smalltalk.addMethod(
  7306. smalltalk.method({
  7307. selector: "canUnderstand:",
  7308. protocol: 'testing',
  7309. fn: function (aSelector){
  7310. var self=this;
  7311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7312. return smalltalk.withContext(function($ctx1) {
  7313. //>>excludeEnd("ctx");
  7314. var $3,$2,$1;
  7315. $1=_st(self._includesSelector_(_st(aSelector)._asString()))._or_((function(){
  7316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7317. return smalltalk.withContext(function($ctx2) {
  7318. //>>excludeEnd("ctx");
  7319. $3=self._superclass();
  7320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7321. $ctx2.sendIdx["superclass"]=1;
  7322. //>>excludeEnd("ctx");
  7323. $2=_st($3)._notNil();
  7324. return _st($2)._and_((function(){
  7325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7326. return smalltalk.withContext(function($ctx3) {
  7327. //>>excludeEnd("ctx");
  7328. return _st(self._superclass())._canUnderstand_(aSelector);
  7329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7330. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7331. //>>excludeEnd("ctx");
  7332. }));
  7333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7335. //>>excludeEnd("ctx");
  7336. }));
  7337. return $1;
  7338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7339. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},globals.Behavior)});
  7340. //>>excludeEnd("ctx");
  7341. },
  7342. //>>excludeStart("ide", pragmas.excludeIdeData);
  7343. args: ["aSelector"],
  7344. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  7345. referencedClasses: [],
  7346. //>>excludeEnd("ide");
  7347. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  7348. }),
  7349. globals.Behavior);
  7350. smalltalk.addMethod(
  7351. smalltalk.method({
  7352. selector: "comment",
  7353. protocol: 'accessing',
  7354. fn: function (){
  7355. var self=this;
  7356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7357. return smalltalk.withContext(function($ctx1) {
  7358. //>>excludeEnd("ctx");
  7359. var $2,$1,$receiver;
  7360. $2=self._basicAt_("comment");
  7361. if(($receiver = $2) == null || $receiver.isNil){
  7362. $1="";
  7363. } else {
  7364. $1=$2;
  7365. };
  7366. return $1;
  7367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7368. }, function($ctx1) {$ctx1.fill(self,"comment",{},globals.Behavior)});
  7369. //>>excludeEnd("ctx");
  7370. },
  7371. //>>excludeStart("ide", pragmas.excludeIdeData);
  7372. args: [],
  7373. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  7374. referencedClasses: [],
  7375. //>>excludeEnd("ide");
  7376. messageSends: ["ifNil:", "basicAt:"]
  7377. }),
  7378. globals.Behavior);
  7379. smalltalk.addMethod(
  7380. smalltalk.method({
  7381. selector: "comment:",
  7382. protocol: 'accessing',
  7383. fn: function (aString){
  7384. var self=this;
  7385. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7386. function $ClassCommentChanged(){return globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  7387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7388. return smalltalk.withContext(function($ctx1) {
  7389. //>>excludeEnd("ctx");
  7390. var $1,$2;
  7391. self._basicAt_put_("comment",aString);
  7392. $1=_st($ClassCommentChanged())._new();
  7393. _st($1)._theClass_(self);
  7394. $2=_st($1)._yourself();
  7395. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7396. return self;
  7397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7398. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},globals.Behavior)});
  7399. //>>excludeEnd("ctx");
  7400. },
  7401. //>>excludeStart("ide", pragmas.excludeIdeData);
  7402. args: ["aString"],
  7403. 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)",
  7404. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  7405. //>>excludeEnd("ide");
  7406. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  7407. }),
  7408. globals.Behavior);
  7409. smalltalk.addMethod(
  7410. smalltalk.method({
  7411. selector: "commentStamp",
  7412. protocol: 'accessing',
  7413. fn: function (){
  7414. var self=this;
  7415. function $ClassCommentReader(){return globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  7416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7417. return smalltalk.withContext(function($ctx1) {
  7418. //>>excludeEnd("ctx");
  7419. var $2,$3,$1;
  7420. $2=_st($ClassCommentReader())._new();
  7421. _st($2)._class_(self);
  7422. $3=_st($2)._yourself();
  7423. $1=$3;
  7424. return $1;
  7425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7426. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},globals.Behavior)});
  7427. //>>excludeEnd("ctx");
  7428. },
  7429. //>>excludeStart("ide", pragmas.excludeIdeData);
  7430. args: [],
  7431. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  7432. referencedClasses: ["ClassCommentReader"],
  7433. //>>excludeEnd("ide");
  7434. messageSends: ["class:", "new", "yourself"]
  7435. }),
  7436. globals.Behavior);
  7437. smalltalk.addMethod(
  7438. smalltalk.method({
  7439. selector: "commentStamp:prior:",
  7440. protocol: 'accessing',
  7441. fn: function (aStamp,prior){
  7442. var self=this;
  7443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7444. return smalltalk.withContext(function($ctx1) {
  7445. //>>excludeEnd("ctx");
  7446. var $1;
  7447. $1=self._commentStamp();
  7448. return $1;
  7449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7450. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},globals.Behavior)});
  7451. //>>excludeEnd("ctx");
  7452. },
  7453. //>>excludeStart("ide", pragmas.excludeIdeData);
  7454. args: ["aStamp", "prior"],
  7455. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  7456. referencedClasses: [],
  7457. //>>excludeEnd("ide");
  7458. messageSends: ["commentStamp"]
  7459. }),
  7460. globals.Behavior);
  7461. smalltalk.addMethod(
  7462. smalltalk.method({
  7463. selector: "compile:",
  7464. protocol: 'compiling',
  7465. fn: function (aString){
  7466. var self=this;
  7467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7468. return smalltalk.withContext(function($ctx1) {
  7469. //>>excludeEnd("ctx");
  7470. var $1;
  7471. $1=self._compile_protocol_(aString,"");
  7472. return $1;
  7473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7474. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Behavior)});
  7475. //>>excludeEnd("ctx");
  7476. },
  7477. //>>excludeStart("ide", pragmas.excludeIdeData);
  7478. args: ["aString"],
  7479. source: "compile: aString\x0a\x09^ self compile: aString protocol: ''",
  7480. referencedClasses: [],
  7481. //>>excludeEnd("ide");
  7482. messageSends: ["compile:protocol:"]
  7483. }),
  7484. globals.Behavior);
  7485. smalltalk.addMethod(
  7486. smalltalk.method({
  7487. selector: "compile:protocol:",
  7488. protocol: 'compiling',
  7489. fn: function (aString,anotherString){
  7490. var self=this;
  7491. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7493. return smalltalk.withContext(function($ctx1) {
  7494. //>>excludeEnd("ctx");
  7495. var $1;
  7496. $1=_st(_st($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  7497. return $1;
  7498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7499. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},globals.Behavior)});
  7500. //>>excludeEnd("ctx");
  7501. },
  7502. //>>excludeStart("ide", pragmas.excludeIdeData);
  7503. args: ["aString", "anotherString"],
  7504. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  7505. referencedClasses: ["Compiler"],
  7506. //>>excludeEnd("ide");
  7507. messageSends: ["install:forClass:protocol:", "new"]
  7508. }),
  7509. globals.Behavior);
  7510. smalltalk.addMethod(
  7511. smalltalk.method({
  7512. selector: "definition",
  7513. protocol: 'accessing',
  7514. fn: function (){
  7515. var self=this;
  7516. return "";
  7517. },
  7518. //>>excludeStart("ide", pragmas.excludeIdeData);
  7519. args: [],
  7520. source: "definition\x0a\x09^ ''",
  7521. referencedClasses: [],
  7522. //>>excludeEnd("ide");
  7523. messageSends: []
  7524. }),
  7525. globals.Behavior);
  7526. smalltalk.addMethod(
  7527. smalltalk.method({
  7528. selector: "includesBehavior:",
  7529. protocol: 'testing',
  7530. fn: function (aClass){
  7531. var self=this;
  7532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7533. return smalltalk.withContext(function($ctx1) {
  7534. //>>excludeEnd("ctx");
  7535. var $1;
  7536. $1=_st(self.__eq_eq(aClass))._or_((function(){
  7537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7538. return smalltalk.withContext(function($ctx2) {
  7539. //>>excludeEnd("ctx");
  7540. return self._inheritsFrom_(aClass);
  7541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7543. //>>excludeEnd("ctx");
  7544. }));
  7545. return $1;
  7546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7547. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},globals.Behavior)});
  7548. //>>excludeEnd("ctx");
  7549. },
  7550. //>>excludeStart("ide", pragmas.excludeIdeData);
  7551. args: ["aClass"],
  7552. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  7553. referencedClasses: [],
  7554. //>>excludeEnd("ide");
  7555. messageSends: ["or:", "==", "inheritsFrom:"]
  7556. }),
  7557. globals.Behavior);
  7558. smalltalk.addMethod(
  7559. smalltalk.method({
  7560. selector: "includesSelector:",
  7561. protocol: 'testing',
  7562. fn: function (aString){
  7563. var self=this;
  7564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7565. return smalltalk.withContext(function($ctx1) {
  7566. //>>excludeEnd("ctx");
  7567. var $1;
  7568. $1=_st(self._methodDictionary())._includesKey_(aString);
  7569. return $1;
  7570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7571. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},globals.Behavior)});
  7572. //>>excludeEnd("ctx");
  7573. },
  7574. //>>excludeStart("ide", pragmas.excludeIdeData);
  7575. args: ["aString"],
  7576. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  7577. referencedClasses: [],
  7578. //>>excludeEnd("ide");
  7579. messageSends: ["includesKey:", "methodDictionary"]
  7580. }),
  7581. globals.Behavior);
  7582. smalltalk.addMethod(
  7583. smalltalk.method({
  7584. selector: "inheritsFrom:",
  7585. protocol: 'testing',
  7586. fn: function (aClass){
  7587. var self=this;
  7588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7589. return smalltalk.withContext(function($ctx1) {
  7590. //>>excludeEnd("ctx");
  7591. var $1,$4,$3,$2,$receiver;
  7592. $1=self._superclass();
  7593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7594. $ctx1.sendIdx["superclass"]=1;
  7595. //>>excludeEnd("ctx");
  7596. if(($receiver = $1) == null || $receiver.isNil){
  7597. return false;
  7598. } else {
  7599. $1;
  7600. };
  7601. $4=self._superclass();
  7602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7603. $ctx1.sendIdx["superclass"]=2;
  7604. //>>excludeEnd("ctx");
  7605. $3=_st(aClass).__eq_eq($4);
  7606. $2=_st($3)._or_((function(){
  7607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7608. return smalltalk.withContext(function($ctx2) {
  7609. //>>excludeEnd("ctx");
  7610. return _st(self._superclass())._inheritsFrom_(aClass);
  7611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7613. //>>excludeEnd("ctx");
  7614. }));
  7615. return $2;
  7616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7617. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},globals.Behavior)});
  7618. //>>excludeEnd("ctx");
  7619. },
  7620. //>>excludeStart("ide", pragmas.excludeIdeData);
  7621. args: ["aClass"],
  7622. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  7623. referencedClasses: [],
  7624. //>>excludeEnd("ide");
  7625. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  7626. }),
  7627. globals.Behavior);
  7628. smalltalk.addMethod(
  7629. smalltalk.method({
  7630. selector: "instanceVariableNames",
  7631. protocol: 'accessing',
  7632. fn: function (){
  7633. var self=this;
  7634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7635. return smalltalk.withContext(function($ctx1) {
  7636. //>>excludeEnd("ctx");
  7637. return self.iVarNames;
  7638. return self;
  7639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7640. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},globals.Behavior)});
  7641. //>>excludeEnd("ctx");
  7642. },
  7643. //>>excludeStart("ide", pragmas.excludeIdeData);
  7644. args: [],
  7645. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  7646. referencedClasses: [],
  7647. //>>excludeEnd("ide");
  7648. messageSends: []
  7649. }),
  7650. globals.Behavior);
  7651. smalltalk.addMethod(
  7652. smalltalk.method({
  7653. selector: "isBehavior",
  7654. protocol: 'testing',
  7655. fn: function (){
  7656. var self=this;
  7657. return true;
  7658. },
  7659. //>>excludeStart("ide", pragmas.excludeIdeData);
  7660. args: [],
  7661. source: "isBehavior\x0a\x09^ true",
  7662. referencedClasses: [],
  7663. //>>excludeEnd("ide");
  7664. messageSends: []
  7665. }),
  7666. globals.Behavior);
  7667. smalltalk.addMethod(
  7668. smalltalk.method({
  7669. selector: "javascriptConstructor",
  7670. protocol: 'accessing',
  7671. fn: function (){
  7672. var self=this;
  7673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7674. return smalltalk.withContext(function($ctx1) {
  7675. //>>excludeEnd("ctx");
  7676. return self.fn;
  7677. return self;
  7678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7679. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},globals.Behavior)});
  7680. //>>excludeEnd("ctx");
  7681. },
  7682. //>>excludeStart("ide", pragmas.excludeIdeData);
  7683. args: [],
  7684. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  7685. referencedClasses: [],
  7686. //>>excludeEnd("ide");
  7687. messageSends: []
  7688. }),
  7689. globals.Behavior);
  7690. smalltalk.addMethod(
  7691. smalltalk.method({
  7692. selector: "javascriptConstructor:",
  7693. protocol: 'accessing',
  7694. fn: function (aJavaScriptFunction){
  7695. var self=this;
  7696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7697. return smalltalk.withContext(function($ctx1) {
  7698. //>>excludeEnd("ctx");
  7699. smalltalk.setClassConstructor(self, aJavaScriptFunction);;
  7700. return self;
  7701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7702. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},globals.Behavior)});
  7703. //>>excludeEnd("ctx");
  7704. },
  7705. //>>excludeStart("ide", pragmas.excludeIdeData);
  7706. args: ["aJavaScriptFunction"],
  7707. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `smalltalk.setClassConstructor'\x22\x0a\x09\x0a\x09<smalltalk.setClassConstructor(self, aJavaScriptFunction);>",
  7708. referencedClasses: [],
  7709. //>>excludeEnd("ide");
  7710. messageSends: []
  7711. }),
  7712. globals.Behavior);
  7713. smalltalk.addMethod(
  7714. smalltalk.method({
  7715. selector: "lookupSelector:",
  7716. protocol: 'accessing',
  7717. fn: function (selector){
  7718. var self=this;
  7719. var lookupClass;
  7720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7721. return smalltalk.withContext(function($ctx1) {
  7722. //>>excludeEnd("ctx");
  7723. var $1,$2;
  7724. var $early={};
  7725. try {
  7726. lookupClass=self;
  7727. _st((function(){
  7728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7729. return smalltalk.withContext(function($ctx2) {
  7730. //>>excludeEnd("ctx");
  7731. return _st(lookupClass).__eq(nil);
  7732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7734. //>>excludeEnd("ctx");
  7735. }))._whileFalse_((function(){
  7736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7737. return smalltalk.withContext(function($ctx2) {
  7738. //>>excludeEnd("ctx");
  7739. $1=_st(lookupClass)._includesSelector_(selector);
  7740. if(smalltalk.assert($1)){
  7741. $2=_st(lookupClass)._methodAt_(selector);
  7742. throw $early=[$2];
  7743. };
  7744. lookupClass=_st(lookupClass)._superclass();
  7745. return lookupClass;
  7746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7748. //>>excludeEnd("ctx");
  7749. }));
  7750. return nil;
  7751. }
  7752. catch(e) {if(e===$early)return e[0]; throw e}
  7753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7754. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},globals.Behavior)});
  7755. //>>excludeEnd("ctx");
  7756. },
  7757. //>>excludeStart("ide", pragmas.excludeIdeData);
  7758. args: ["selector"],
  7759. 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",
  7760. referencedClasses: [],
  7761. //>>excludeEnd("ide");
  7762. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  7763. }),
  7764. globals.Behavior);
  7765. smalltalk.addMethod(
  7766. smalltalk.method({
  7767. selector: "methodAt:",
  7768. protocol: 'accessing',
  7769. fn: function (aString){
  7770. var self=this;
  7771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7772. return smalltalk.withContext(function($ctx1) {
  7773. //>>excludeEnd("ctx");
  7774. var $1;
  7775. $1=_st(self._methodDictionary())._at_(aString);
  7776. return $1;
  7777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7778. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},globals.Behavior)});
  7779. //>>excludeEnd("ctx");
  7780. },
  7781. //>>excludeStart("ide", pragmas.excludeIdeData);
  7782. args: ["aString"],
  7783. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  7784. referencedClasses: [],
  7785. //>>excludeEnd("ide");
  7786. messageSends: ["at:", "methodDictionary"]
  7787. }),
  7788. globals.Behavior);
  7789. smalltalk.addMethod(
  7790. smalltalk.method({
  7791. selector: "methodDictionary",
  7792. protocol: 'accessing',
  7793. fn: function (){
  7794. var self=this;
  7795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7796. return smalltalk.withContext(function($ctx1) {
  7797. //>>excludeEnd("ctx");
  7798. var dict = globals.HashedCollection._new();
  7799. var methods = self.methods;
  7800. Object.keys(methods).forEach(function(i) {
  7801. if(methods[i].selector) {
  7802. dict._at_put_(methods[i].selector, methods[i]);
  7803. }
  7804. });
  7805. return dict;
  7806. return self;
  7807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7808. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},globals.Behavior)});
  7809. //>>excludeEnd("ctx");
  7810. },
  7811. //>>excludeStart("ide", pragmas.excludeIdeData);
  7812. args: [],
  7813. source: "methodDictionary\x0a\x09<var dict = globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict>",
  7814. referencedClasses: [],
  7815. //>>excludeEnd("ide");
  7816. messageSends: []
  7817. }),
  7818. globals.Behavior);
  7819. smalltalk.addMethod(
  7820. smalltalk.method({
  7821. selector: "methodTemplate",
  7822. protocol: 'accessing',
  7823. fn: function (){
  7824. var self=this;
  7825. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  7826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7827. return smalltalk.withContext(function($ctx1) {
  7828. //>>excludeEnd("ctx");
  7829. var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
  7830. $1=_st($String())._streamContents_((function(stream){
  7831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7832. return smalltalk.withContext(function($ctx2) {
  7833. //>>excludeEnd("ctx");
  7834. _st(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  7835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7836. $ctx2.sendIdx["nextPutAll:"]=1;
  7837. //>>excludeEnd("ctx");
  7838. $3=_st($String())._lf();
  7839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7840. $ctx2.sendIdx["lf"]=1;
  7841. //>>excludeEnd("ctx");
  7842. $4=_st($String())._tab();
  7843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7844. $ctx2.sendIdx["tab"]=1;
  7845. //>>excludeEnd("ctx");
  7846. $2=_st($3).__comma($4);
  7847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7848. $ctx2.sendIdx[","]=1;
  7849. //>>excludeEnd("ctx");
  7850. _st(stream)._nextPutAll_($2);
  7851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7852. $ctx2.sendIdx["nextPutAll:"]=2;
  7853. //>>excludeEnd("ctx");
  7854. _st(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  7855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7856. $ctx2.sendIdx["nextPutAll:"]=3;
  7857. //>>excludeEnd("ctx");
  7858. $7=_st($String())._lf();
  7859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7860. $ctx2.sendIdx["lf"]=2;
  7861. //>>excludeEnd("ctx");
  7862. $8=_st($String())._lf();
  7863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7864. $ctx2.sendIdx["lf"]=3;
  7865. //>>excludeEnd("ctx");
  7866. $6=_st($7).__comma($8);
  7867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7868. $ctx2.sendIdx[","]=3;
  7869. //>>excludeEnd("ctx");
  7870. $9=_st($String())._tab();
  7871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7872. $ctx2.sendIdx["tab"]=2;
  7873. //>>excludeEnd("ctx");
  7874. $5=_st($6).__comma($9);
  7875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7876. $ctx2.sendIdx[","]=2;
  7877. //>>excludeEnd("ctx");
  7878. _st(stream)._nextPutAll_($5);
  7879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7880. $ctx2.sendIdx["nextPutAll:"]=4;
  7881. //>>excludeEnd("ctx");
  7882. _st(stream)._nextPutAll_("| temporary variable names |");
  7883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7884. $ctx2.sendIdx["nextPutAll:"]=5;
  7885. //>>excludeEnd("ctx");
  7886. _st(stream)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
  7887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7888. $ctx2.sendIdx["nextPutAll:"]=6;
  7889. //>>excludeEnd("ctx");
  7890. $10=_st(stream)._nextPutAll_("statements");
  7891. return $10;
  7892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7893. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  7894. //>>excludeEnd("ctx");
  7895. }));
  7896. return $1;
  7897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7898. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},globals.Behavior)});
  7899. //>>excludeEnd("ctx");
  7900. },
  7901. //>>excludeStart("ide", pragmas.excludeIdeData);
  7902. args: [],
  7903. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
  7904. referencedClasses: ["String"],
  7905. //>>excludeEnd("ide");
  7906. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  7907. }),
  7908. globals.Behavior);
  7909. smalltalk.addMethod(
  7910. smalltalk.method({
  7911. selector: "methods",
  7912. protocol: 'accessing',
  7913. fn: function (){
  7914. var self=this;
  7915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7916. return smalltalk.withContext(function($ctx1) {
  7917. //>>excludeEnd("ctx");
  7918. var $1;
  7919. $1=_st(self._methodDictionary())._values();
  7920. return $1;
  7921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7922. }, function($ctx1) {$ctx1.fill(self,"methods",{},globals.Behavior)});
  7923. //>>excludeEnd("ctx");
  7924. },
  7925. //>>excludeStart("ide", pragmas.excludeIdeData);
  7926. args: [],
  7927. source: "methods\x0a\x09^ self methodDictionary values",
  7928. referencedClasses: [],
  7929. //>>excludeEnd("ide");
  7930. messageSends: ["values", "methodDictionary"]
  7931. }),
  7932. globals.Behavior);
  7933. smalltalk.addMethod(
  7934. smalltalk.method({
  7935. selector: "methodsFor:",
  7936. protocol: 'accessing',
  7937. fn: function (aString){
  7938. var self=this;
  7939. function $ClassCategoryReader(){return globals.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
  7940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7941. return smalltalk.withContext(function($ctx1) {
  7942. //>>excludeEnd("ctx");
  7943. var $2,$3,$1;
  7944. $2=_st($ClassCategoryReader())._new();
  7945. _st($2)._class_category_(self,aString);
  7946. $3=_st($2)._yourself();
  7947. $1=$3;
  7948. return $1;
  7949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7950. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},globals.Behavior)});
  7951. //>>excludeEnd("ctx");
  7952. },
  7953. //>>excludeStart("ide", pragmas.excludeIdeData);
  7954. args: ["aString"],
  7955. source: "methodsFor: aString\x0a\x09^ ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  7956. referencedClasses: ["ClassCategoryReader"],
  7957. //>>excludeEnd("ide");
  7958. messageSends: ["class:category:", "new", "yourself"]
  7959. }),
  7960. globals.Behavior);
  7961. smalltalk.addMethod(
  7962. smalltalk.method({
  7963. selector: "methodsFor:stamp:",
  7964. protocol: 'accessing',
  7965. fn: function (aString,aStamp){
  7966. var self=this;
  7967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7968. return smalltalk.withContext(function($ctx1) {
  7969. //>>excludeEnd("ctx");
  7970. var $1;
  7971. $1=self._methodsFor_(aString);
  7972. return $1;
  7973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7974. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},globals.Behavior)});
  7975. //>>excludeEnd("ctx");
  7976. },
  7977. //>>excludeStart("ide", pragmas.excludeIdeData);
  7978. args: ["aString", "aStamp"],
  7979. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  7980. referencedClasses: [],
  7981. //>>excludeEnd("ide");
  7982. messageSends: ["methodsFor:"]
  7983. }),
  7984. globals.Behavior);
  7985. smalltalk.addMethod(
  7986. smalltalk.method({
  7987. selector: "methodsInProtocol:",
  7988. protocol: 'accessing',
  7989. fn: function (aString){
  7990. var self=this;
  7991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7992. return smalltalk.withContext(function($ctx1) {
  7993. //>>excludeEnd("ctx");
  7994. var $1;
  7995. $1=_st(self._methods())._select_((function(each){
  7996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7997. return smalltalk.withContext(function($ctx2) {
  7998. //>>excludeEnd("ctx");
  7999. return _st(_st(each)._protocol()).__eq(aString);
  8000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8001. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8002. //>>excludeEnd("ctx");
  8003. }));
  8004. return $1;
  8005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8006. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},globals.Behavior)});
  8007. //>>excludeEnd("ctx");
  8008. },
  8009. //>>excludeStart("ide", pragmas.excludeIdeData);
  8010. args: ["aString"],
  8011. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  8012. referencedClasses: [],
  8013. //>>excludeEnd("ide");
  8014. messageSends: ["select:", "methods", "=", "protocol"]
  8015. }),
  8016. globals.Behavior);
  8017. smalltalk.addMethod(
  8018. smalltalk.method({
  8019. selector: "name",
  8020. protocol: 'accessing',
  8021. fn: function (){
  8022. var self=this;
  8023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8024. return smalltalk.withContext(function($ctx1) {
  8025. //>>excludeEnd("ctx");
  8026. return self.className || nil;
  8027. return self;
  8028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8029. }, function($ctx1) {$ctx1.fill(self,"name",{},globals.Behavior)});
  8030. //>>excludeEnd("ctx");
  8031. },
  8032. //>>excludeStart("ide", pragmas.excludeIdeData);
  8033. args: [],
  8034. source: "name\x0a\x09<return self.className || nil>",
  8035. referencedClasses: [],
  8036. //>>excludeEnd("ide");
  8037. messageSends: []
  8038. }),
  8039. globals.Behavior);
  8040. smalltalk.addMethod(
  8041. smalltalk.method({
  8042. selector: "new",
  8043. protocol: 'instance creation',
  8044. fn: function (){
  8045. var self=this;
  8046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8047. return smalltalk.withContext(function($ctx1) {
  8048. //>>excludeEnd("ctx");
  8049. var $1;
  8050. $1=_st(self._basicNew())._initialize();
  8051. return $1;
  8052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8053. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.Behavior)});
  8054. //>>excludeEnd("ctx");
  8055. },
  8056. //>>excludeStart("ide", pragmas.excludeIdeData);
  8057. args: [],
  8058. source: "new\x0a\x09^ self basicNew initialize",
  8059. referencedClasses: [],
  8060. //>>excludeEnd("ide");
  8061. messageSends: ["initialize", "basicNew"]
  8062. }),
  8063. globals.Behavior);
  8064. smalltalk.addMethod(
  8065. smalltalk.method({
  8066. selector: "organization",
  8067. protocol: 'accessing',
  8068. fn: function (){
  8069. var self=this;
  8070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8071. return smalltalk.withContext(function($ctx1) {
  8072. //>>excludeEnd("ctx");
  8073. var $1;
  8074. $1=self._basicAt_("organization");
  8075. return $1;
  8076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8077. }, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Behavior)});
  8078. //>>excludeEnd("ctx");
  8079. },
  8080. //>>excludeStart("ide", pragmas.excludeIdeData);
  8081. args: [],
  8082. source: "organization\x0a\x09^ self basicAt: 'organization'",
  8083. referencedClasses: [],
  8084. //>>excludeEnd("ide");
  8085. messageSends: ["basicAt:"]
  8086. }),
  8087. globals.Behavior);
  8088. smalltalk.addMethod(
  8089. smalltalk.method({
  8090. selector: "ownMethods",
  8091. protocol: 'accessing',
  8092. fn: function (){
  8093. var self=this;
  8094. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  8095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8096. return smalltalk.withContext(function($ctx1) {
  8097. //>>excludeEnd("ctx");
  8098. var $2,$1;
  8099. $1=_st(_st(self._ownProtocols())._inject_into_(_st($OrderedCollection())._new(),(function(acc,each){
  8100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8101. return smalltalk.withContext(function($ctx2) {
  8102. //>>excludeEnd("ctx");
  8103. return _st(acc).__comma(self._methodsInProtocol_(each));
  8104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8105. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  8106. //>>excludeEnd("ctx");
  8107. })))._sorted_((function(a,b){
  8108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8109. return smalltalk.withContext(function($ctx2) {
  8110. //>>excludeEnd("ctx");
  8111. $2=_st(a)._selector();
  8112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8113. $ctx2.sendIdx["selector"]=1;
  8114. //>>excludeEnd("ctx");
  8115. return _st($2).__lt_eq(_st(b)._selector());
  8116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8117. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  8118. //>>excludeEnd("ctx");
  8119. }));
  8120. return $1;
  8121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8122. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},globals.Behavior)});
  8123. //>>excludeEnd("ctx");
  8124. },
  8125. //>>excludeStart("ide", pragmas.excludeIdeData);
  8126. args: [],
  8127. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  8128. referencedClasses: ["OrderedCollection"],
  8129. //>>excludeEnd("ide");
  8130. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  8131. }),
  8132. globals.Behavior);
  8133. smalltalk.addMethod(
  8134. smalltalk.method({
  8135. selector: "ownProtocols",
  8136. protocol: 'accessing',
  8137. fn: function (){
  8138. var self=this;
  8139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8140. return smalltalk.withContext(function($ctx1) {
  8141. //>>excludeEnd("ctx");
  8142. var $1;
  8143. $1=_st(self._protocols())._reject_((function(each){
  8144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8145. return smalltalk.withContext(function($ctx2) {
  8146. //>>excludeEnd("ctx");
  8147. return _st(each)._match_("^\x5c*");
  8148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8149. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8150. //>>excludeEnd("ctx");
  8151. }));
  8152. return $1;
  8153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8154. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},globals.Behavior)});
  8155. //>>excludeEnd("ctx");
  8156. },
  8157. //>>excludeStart("ide", pragmas.excludeIdeData);
  8158. args: [],
  8159. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  8160. referencedClasses: [],
  8161. //>>excludeEnd("ide");
  8162. messageSends: ["reject:", "protocols", "match:"]
  8163. }),
  8164. globals.Behavior);
  8165. smalltalk.addMethod(
  8166. smalltalk.method({
  8167. selector: "protocols",
  8168. protocol: 'accessing',
  8169. fn: function (){
  8170. var self=this;
  8171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8172. return smalltalk.withContext(function($ctx1) {
  8173. //>>excludeEnd("ctx");
  8174. var $1;
  8175. $1=_st(_st(self._organization())._elements())._sorted();
  8176. return $1;
  8177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8178. }, function($ctx1) {$ctx1.fill(self,"protocols",{},globals.Behavior)});
  8179. //>>excludeEnd("ctx");
  8180. },
  8181. //>>excludeStart("ide", pragmas.excludeIdeData);
  8182. args: [],
  8183. source: "protocols\x0a\x09^ self organization elements sorted",
  8184. referencedClasses: [],
  8185. //>>excludeEnd("ide");
  8186. messageSends: ["sorted", "elements", "organization"]
  8187. }),
  8188. globals.Behavior);
  8189. smalltalk.addMethod(
  8190. smalltalk.method({
  8191. selector: "protocolsDo:",
  8192. protocol: 'enumerating',
  8193. fn: function (aBlock){
  8194. var self=this;
  8195. var methodsByProtocol;
  8196. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  8197. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8199. return smalltalk.withContext(function($ctx1) {
  8200. //>>excludeEnd("ctx");
  8201. methodsByProtocol=_st($HashedCollection())._new();
  8202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8203. $ctx1.sendIdx["new"]=1;
  8204. //>>excludeEnd("ctx");
  8205. _st(self._methodDictionary())._valuesDo_((function(m){
  8206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8207. return smalltalk.withContext(function($ctx2) {
  8208. //>>excludeEnd("ctx");
  8209. return _st(_st(methodsByProtocol)._at_ifAbsentPut_(_st(m)._protocol(),(function(){
  8210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8211. return smalltalk.withContext(function($ctx3) {
  8212. //>>excludeEnd("ctx");
  8213. return _st($Array())._new();
  8214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8215. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8216. //>>excludeEnd("ctx");
  8217. })))._add_(m);
  8218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8219. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  8220. //>>excludeEnd("ctx");
  8221. }));
  8222. _st(self._protocols())._do_((function(protocol){
  8223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8224. return smalltalk.withContext(function($ctx2) {
  8225. //>>excludeEnd("ctx");
  8226. return _st(aBlock)._value_value_(protocol,_st(methodsByProtocol)._at_(protocol));
  8227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8228. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  8229. //>>excludeEnd("ctx");
  8230. }));
  8231. return self;
  8232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8233. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},globals.Behavior)});
  8234. //>>excludeEnd("ctx");
  8235. },
  8236. //>>excludeStart("ide", pragmas.excludeIdeData);
  8237. args: ["aBlock"],
  8238. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  8239. referencedClasses: ["HashedCollection", "Array"],
  8240. //>>excludeEnd("ide");
  8241. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  8242. }),
  8243. globals.Behavior);
  8244. smalltalk.addMethod(
  8245. smalltalk.method({
  8246. selector: "prototype",
  8247. protocol: 'accessing',
  8248. fn: function (){
  8249. var self=this;
  8250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8251. return smalltalk.withContext(function($ctx1) {
  8252. //>>excludeEnd("ctx");
  8253. return self.fn.prototype;
  8254. return self;
  8255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8256. }, function($ctx1) {$ctx1.fill(self,"prototype",{},globals.Behavior)});
  8257. //>>excludeEnd("ctx");
  8258. },
  8259. //>>excludeStart("ide", pragmas.excludeIdeData);
  8260. args: [],
  8261. source: "prototype\x0a\x09<return self.fn.prototype>",
  8262. referencedClasses: [],
  8263. //>>excludeEnd("ide");
  8264. messageSends: []
  8265. }),
  8266. globals.Behavior);
  8267. smalltalk.addMethod(
  8268. smalltalk.method({
  8269. selector: "recompile",
  8270. protocol: 'compiling',
  8271. fn: function (){
  8272. var self=this;
  8273. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  8274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8275. return smalltalk.withContext(function($ctx1) {
  8276. //>>excludeEnd("ctx");
  8277. var $1;
  8278. $1=_st(_st($Compiler())._new())._recompile_(self);
  8279. return $1;
  8280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8281. }, function($ctx1) {$ctx1.fill(self,"recompile",{},globals.Behavior)});
  8282. //>>excludeEnd("ctx");
  8283. },
  8284. //>>excludeStart("ide", pragmas.excludeIdeData);
  8285. args: [],
  8286. source: "recompile\x0a\x09^ Compiler new recompile: self",
  8287. referencedClasses: ["Compiler"],
  8288. //>>excludeEnd("ide");
  8289. messageSends: ["recompile:", "new"]
  8290. }),
  8291. globals.Behavior);
  8292. smalltalk.addMethod(
  8293. smalltalk.method({
  8294. selector: "removeCompiledMethod:",
  8295. protocol: 'compiling',
  8296. fn: function (aMethod){
  8297. var self=this;
  8298. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8299. function $MethodRemoved(){return globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  8300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8301. return smalltalk.withContext(function($ctx1) {
  8302. //>>excludeEnd("ctx");
  8303. var $1,$2;
  8304. self._basicRemoveCompiledMethod_(aMethod);
  8305. self._removeProtocolIfEmpty_(_st(aMethod)._protocol());
  8306. $1=_st($MethodRemoved())._new();
  8307. _st($1)._method_(aMethod);
  8308. $2=_st($1)._yourself();
  8309. _st(_st($SystemAnnouncer())._current())._announce_($2);
  8310. return self;
  8311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8312. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},globals.Behavior)});
  8313. //>>excludeEnd("ctx");
  8314. },
  8315. //>>excludeStart("ide", pragmas.excludeIdeData);
  8316. args: ["aMethod"],
  8317. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  8318. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  8319. //>>excludeEnd("ide");
  8320. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  8321. }),
  8322. globals.Behavior);
  8323. smalltalk.addMethod(
  8324. smalltalk.method({
  8325. selector: "removeProtocolIfEmpty:",
  8326. protocol: 'accessing',
  8327. fn: function (aString){
  8328. var self=this;
  8329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8330. return smalltalk.withContext(function($ctx1) {
  8331. //>>excludeEnd("ctx");
  8332. _st(self._methods())._detect_ifNone_((function(each){
  8333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8334. return smalltalk.withContext(function($ctx2) {
  8335. //>>excludeEnd("ctx");
  8336. return _st(_st(each)._protocol()).__eq(aString);
  8337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8339. //>>excludeEnd("ctx");
  8340. }),(function(){
  8341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8342. return smalltalk.withContext(function($ctx2) {
  8343. //>>excludeEnd("ctx");
  8344. return _st(self._organization())._removeElement_(aString);
  8345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8347. //>>excludeEnd("ctx");
  8348. }));
  8349. return self;
  8350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8351. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},globals.Behavior)});
  8352. //>>excludeEnd("ctx");
  8353. },
  8354. //>>excludeStart("ide", pragmas.excludeIdeData);
  8355. args: ["aString"],
  8356. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  8357. referencedClasses: [],
  8358. //>>excludeEnd("ide");
  8359. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  8360. }),
  8361. globals.Behavior);
  8362. smalltalk.addMethod(
  8363. smalltalk.method({
  8364. selector: "selectors",
  8365. protocol: 'accessing',
  8366. fn: function (){
  8367. var self=this;
  8368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8369. return smalltalk.withContext(function($ctx1) {
  8370. //>>excludeEnd("ctx");
  8371. var $1;
  8372. $1=_st(self._methodDictionary())._keys();
  8373. return $1;
  8374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8375. }, function($ctx1) {$ctx1.fill(self,"selectors",{},globals.Behavior)});
  8376. //>>excludeEnd("ctx");
  8377. },
  8378. //>>excludeStart("ide", pragmas.excludeIdeData);
  8379. args: [],
  8380. source: "selectors\x0a\x09^ self methodDictionary keys",
  8381. referencedClasses: [],
  8382. //>>excludeEnd("ide");
  8383. messageSends: ["keys", "methodDictionary"]
  8384. }),
  8385. globals.Behavior);
  8386. smalltalk.addMethod(
  8387. smalltalk.method({
  8388. selector: "subclasses",
  8389. protocol: 'accessing',
  8390. fn: function (){
  8391. var self=this;
  8392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8393. return smalltalk.withContext(function($ctx1) {
  8394. //>>excludeEnd("ctx");
  8395. self._subclassResponsibility();
  8396. return self;
  8397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8398. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Behavior)});
  8399. //>>excludeEnd("ctx");
  8400. },
  8401. //>>excludeStart("ide", pragmas.excludeIdeData);
  8402. args: [],
  8403. source: "subclasses\x0a\x09self subclassResponsibility",
  8404. referencedClasses: [],
  8405. //>>excludeEnd("ide");
  8406. messageSends: ["subclassResponsibility"]
  8407. }),
  8408. globals.Behavior);
  8409. smalltalk.addMethod(
  8410. smalltalk.method({
  8411. selector: "superclass",
  8412. protocol: 'accessing',
  8413. fn: function (){
  8414. var self=this;
  8415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8416. return smalltalk.withContext(function($ctx1) {
  8417. //>>excludeEnd("ctx");
  8418. return self.superclass || nil;
  8419. return self;
  8420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8421. }, function($ctx1) {$ctx1.fill(self,"superclass",{},globals.Behavior)});
  8422. //>>excludeEnd("ctx");
  8423. },
  8424. //>>excludeStart("ide", pragmas.excludeIdeData);
  8425. args: [],
  8426. source: "superclass\x0a\x09<return self.superclass || nil>",
  8427. referencedClasses: [],
  8428. //>>excludeEnd("ide");
  8429. messageSends: []
  8430. }),
  8431. globals.Behavior);
  8432. smalltalk.addMethod(
  8433. smalltalk.method({
  8434. selector: "theMetaClass",
  8435. protocol: 'accessing',
  8436. fn: function (){
  8437. var self=this;
  8438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8439. return smalltalk.withContext(function($ctx1) {
  8440. //>>excludeEnd("ctx");
  8441. var $1;
  8442. $1=self._class();
  8443. return $1;
  8444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8445. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},globals.Behavior)});
  8446. //>>excludeEnd("ctx");
  8447. },
  8448. //>>excludeStart("ide", pragmas.excludeIdeData);
  8449. args: [],
  8450. source: "theMetaClass\x0a\x09^ self class",
  8451. referencedClasses: [],
  8452. //>>excludeEnd("ide");
  8453. messageSends: ["class"]
  8454. }),
  8455. globals.Behavior);
  8456. smalltalk.addMethod(
  8457. smalltalk.method({
  8458. selector: "theNonMetaClass",
  8459. protocol: 'accessing',
  8460. fn: function (){
  8461. var self=this;
  8462. return self;
  8463. },
  8464. //>>excludeStart("ide", pragmas.excludeIdeData);
  8465. args: [],
  8466. source: "theNonMetaClass\x0a\x09^ self",
  8467. referencedClasses: [],
  8468. //>>excludeEnd("ide");
  8469. messageSends: []
  8470. }),
  8471. globals.Behavior);
  8472. smalltalk.addMethod(
  8473. smalltalk.method({
  8474. selector: "withAllSubclasses",
  8475. protocol: 'accessing',
  8476. fn: function (){
  8477. var self=this;
  8478. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8480. return smalltalk.withContext(function($ctx1) {
  8481. //>>excludeEnd("ctx");
  8482. var $2,$3,$1;
  8483. $2=_st($Array())._with_(self);
  8484. _st($2)._addAll_(self._allSubclasses());
  8485. $3=_st($2)._yourself();
  8486. $1=$3;
  8487. return $1;
  8488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8489. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},globals.Behavior)});
  8490. //>>excludeEnd("ctx");
  8491. },
  8492. //>>excludeStart("ide", pragmas.excludeIdeData);
  8493. args: [],
  8494. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  8495. referencedClasses: ["Array"],
  8496. //>>excludeEnd("ide");
  8497. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  8498. }),
  8499. globals.Behavior);
  8500. smalltalk.addClass('Class', globals.Behavior, [], 'Kernel-Classes');
  8501. //>>excludeStart("ide", pragmas.excludeIdeData);
  8502. globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  8503. //>>excludeEnd("ide");
  8504. smalltalk.addMethod(
  8505. smalltalk.method({
  8506. selector: "asJavascript",
  8507. protocol: 'converting',
  8508. fn: function (){
  8509. var self=this;
  8510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8511. return smalltalk.withContext(function($ctx1) {
  8512. //>>excludeEnd("ctx");
  8513. var $1;
  8514. $1="globals.".__comma(self._name());
  8515. return $1;
  8516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8517. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Class)});
  8518. //>>excludeEnd("ctx");
  8519. },
  8520. //>>excludeStart("ide", pragmas.excludeIdeData);
  8521. args: [],
  8522. source: "asJavascript\x0a\x09^ 'globals.', self name",
  8523. referencedClasses: [],
  8524. //>>excludeEnd("ide");
  8525. messageSends: [",", "name"]
  8526. }),
  8527. globals.Class);
  8528. smalltalk.addMethod(
  8529. smalltalk.method({
  8530. selector: "browse",
  8531. protocol: 'browsing',
  8532. fn: function (){
  8533. var self=this;
  8534. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  8535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8536. return smalltalk.withContext(function($ctx1) {
  8537. //>>excludeEnd("ctx");
  8538. _st($Finder())._findClass_(self);
  8539. return self;
  8540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8541. }, function($ctx1) {$ctx1.fill(self,"browse",{},globals.Class)});
  8542. //>>excludeEnd("ctx");
  8543. },
  8544. //>>excludeStart("ide", pragmas.excludeIdeData);
  8545. args: [],
  8546. source: "browse\x0a\x09Finder findClass: self",
  8547. referencedClasses: ["Finder"],
  8548. //>>excludeEnd("ide");
  8549. messageSends: ["findClass:"]
  8550. }),
  8551. globals.Class);
  8552. smalltalk.addMethod(
  8553. smalltalk.method({
  8554. selector: "category",
  8555. protocol: 'accessing',
  8556. fn: function (){
  8557. var self=this;
  8558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8559. return smalltalk.withContext(function($ctx1) {
  8560. //>>excludeEnd("ctx");
  8561. var $2,$1,$receiver;
  8562. $2=self._package();
  8563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8564. $ctx1.sendIdx["package"]=1;
  8565. //>>excludeEnd("ctx");
  8566. if(($receiver = $2) == null || $receiver.isNil){
  8567. $1="Unclassified";
  8568. } else {
  8569. $1=_st(self._package())._name();
  8570. };
  8571. return $1;
  8572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8573. }, function($ctx1) {$ctx1.fill(self,"category",{},globals.Class)});
  8574. //>>excludeEnd("ctx");
  8575. },
  8576. //>>excludeStart("ide", pragmas.excludeIdeData);
  8577. args: [],
  8578. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  8579. referencedClasses: [],
  8580. //>>excludeEnd("ide");
  8581. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  8582. }),
  8583. globals.Class);
  8584. smalltalk.addMethod(
  8585. smalltalk.method({
  8586. selector: "definition",
  8587. protocol: 'accessing',
  8588. fn: function (){
  8589. var self=this;
  8590. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8592. return smalltalk.withContext(function($ctx1) {
  8593. //>>excludeEnd("ctx");
  8594. var $3,$4,$2,$5,$6,$7,$1;
  8595. $1=_st($String())._streamContents_((function(stream){
  8596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8597. return smalltalk.withContext(function($ctx2) {
  8598. //>>excludeEnd("ctx");
  8599. _st(stream)._nextPutAll_(_st(self._superclass())._asString());
  8600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8601. $ctx2.sendIdx["nextPutAll:"]=1;
  8602. //>>excludeEnd("ctx");
  8603. _st(stream)._nextPutAll_(" subclass: #");
  8604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8605. $ctx2.sendIdx["nextPutAll:"]=2;
  8606. //>>excludeEnd("ctx");
  8607. _st(stream)._nextPutAll_(self._name());
  8608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8609. $ctx2.sendIdx["nextPutAll:"]=3;
  8610. //>>excludeEnd("ctx");
  8611. $3=_st($String())._lf();
  8612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8613. $ctx2.sendIdx["lf"]=1;
  8614. //>>excludeEnd("ctx");
  8615. $4=_st($String())._tab();
  8616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8617. $ctx2.sendIdx["tab"]=1;
  8618. //>>excludeEnd("ctx");
  8619. $2=_st($3).__comma($4);
  8620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8621. $ctx2.sendIdx[","]=1;
  8622. //>>excludeEnd("ctx");
  8623. _st(stream)._nextPutAll_($2);
  8624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8625. $ctx2.sendIdx["nextPutAll:"]=4;
  8626. //>>excludeEnd("ctx");
  8627. $5=_st(stream)._nextPutAll_("instanceVariableNames: '");
  8628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8629. $ctx2.sendIdx["nextPutAll:"]=5;
  8630. //>>excludeEnd("ctx");
  8631. $5;
  8632. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  8633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8634. return smalltalk.withContext(function($ctx3) {
  8635. //>>excludeEnd("ctx");
  8636. return _st(stream)._nextPutAll_(each);
  8637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8638. $ctx3.sendIdx["nextPutAll:"]=6;
  8639. //>>excludeEnd("ctx");
  8640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8641. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  8642. //>>excludeEnd("ctx");
  8643. }),(function(){
  8644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8645. return smalltalk.withContext(function($ctx3) {
  8646. //>>excludeEnd("ctx");
  8647. return _st(stream)._nextPutAll_(" ");
  8648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8649. $ctx3.sendIdx["nextPutAll:"]=7;
  8650. //>>excludeEnd("ctx");
  8651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8652. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  8653. //>>excludeEnd("ctx");
  8654. }));
  8655. $6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
  8656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8657. $ctx2.sendIdx[","]=2;
  8658. //>>excludeEnd("ctx");
  8659. _st(stream)._nextPutAll_($6);
  8660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8661. $ctx2.sendIdx["nextPutAll:"]=8;
  8662. //>>excludeEnd("ctx");
  8663. _st(stream)._nextPutAll_("package: '");
  8664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8665. $ctx2.sendIdx["nextPutAll:"]=9;
  8666. //>>excludeEnd("ctx");
  8667. _st(stream)._nextPutAll_(self._category());
  8668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8669. $ctx2.sendIdx["nextPutAll:"]=10;
  8670. //>>excludeEnd("ctx");
  8671. $7=_st(stream)._nextPutAll_("'");
  8672. return $7;
  8673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8674. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  8675. //>>excludeEnd("ctx");
  8676. }));
  8677. return $1;
  8678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8679. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Class)});
  8680. //>>excludeEnd("ctx");
  8681. },
  8682. //>>excludeStart("ide", pragmas.excludeIdeData);
  8683. args: [],
  8684. 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: '''' ]",
  8685. referencedClasses: ["String"],
  8686. //>>excludeEnd("ide");
  8687. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  8688. }),
  8689. globals.Class);
  8690. smalltalk.addMethod(
  8691. smalltalk.method({
  8692. selector: "heliosClass",
  8693. protocol: 'accessing',
  8694. fn: function (){
  8695. var self=this;
  8696. return "class";
  8697. },
  8698. //>>excludeStart("ide", pragmas.excludeIdeData);
  8699. args: [],
  8700. source: "heliosClass\x0a\x09\x22Should be an Helios extension. Unfortunately, since helios can browse remote\x0a\x09environments, we can't extend base classes\x22\x0a\x09\x0a\x09^ 'class'",
  8701. referencedClasses: [],
  8702. //>>excludeEnd("ide");
  8703. messageSends: []
  8704. }),
  8705. globals.Class);
  8706. smalltalk.addMethod(
  8707. smalltalk.method({
  8708. selector: "isClass",
  8709. protocol: 'testing',
  8710. fn: function (){
  8711. var self=this;
  8712. return true;
  8713. },
  8714. //>>excludeStart("ide", pragmas.excludeIdeData);
  8715. args: [],
  8716. source: "isClass\x0a\x09^ true",
  8717. referencedClasses: [],
  8718. //>>excludeEnd("ide");
  8719. messageSends: []
  8720. }),
  8721. globals.Class);
  8722. smalltalk.addMethod(
  8723. smalltalk.method({
  8724. selector: "package",
  8725. protocol: 'accessing',
  8726. fn: function (){
  8727. var self=this;
  8728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8729. return smalltalk.withContext(function($ctx1) {
  8730. //>>excludeEnd("ctx");
  8731. var $1;
  8732. $1=self._basicAt_("pkg");
  8733. return $1;
  8734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8735. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.Class)});
  8736. //>>excludeEnd("ctx");
  8737. },
  8738. //>>excludeStart("ide", pragmas.excludeIdeData);
  8739. args: [],
  8740. source: "package\x0a\x09^ self basicAt: 'pkg'",
  8741. referencedClasses: [],
  8742. //>>excludeEnd("ide");
  8743. messageSends: ["basicAt:"]
  8744. }),
  8745. globals.Class);
  8746. smalltalk.addMethod(
  8747. smalltalk.method({
  8748. selector: "package:",
  8749. protocol: 'accessing',
  8750. fn: function (aPackage){
  8751. var self=this;
  8752. var oldPackage;
  8753. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8754. function $ClassMoved(){return globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  8755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8756. return smalltalk.withContext(function($ctx1) {
  8757. //>>excludeEnd("ctx");
  8758. var $2,$1,$3,$4,$5;
  8759. $2=self._package();
  8760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8761. $ctx1.sendIdx["package"]=1;
  8762. //>>excludeEnd("ctx");
  8763. $1=_st($2).__eq(aPackage);
  8764. if(smalltalk.assert($1)){
  8765. return self;
  8766. };
  8767. oldPackage=self._package();
  8768. self._basicAt_put_("pkg",aPackage);
  8769. $3=_st(oldPackage)._organization();
  8770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8771. $ctx1.sendIdx["organization"]=1;
  8772. //>>excludeEnd("ctx");
  8773. _st($3)._removeElement_(self);
  8774. _st(_st(aPackage)._organization())._addElement_(self);
  8775. $4=_st($ClassMoved())._new();
  8776. _st($4)._theClass_(self);
  8777. _st($4)._oldPackage_(oldPackage);
  8778. $5=_st($4)._yourself();
  8779. _st(_st($SystemAnnouncer())._current())._announce_($5);
  8780. return self;
  8781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8782. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},globals.Class)});
  8783. //>>excludeEnd("ctx");
  8784. },
  8785. //>>excludeStart("ide", pragmas.excludeIdeData);
  8786. args: ["aPackage"],
  8787. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\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)",
  8788. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  8789. //>>excludeEnd("ide");
  8790. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  8791. }),
  8792. globals.Class);
  8793. smalltalk.addMethod(
  8794. smalltalk.method({
  8795. selector: "printOn:",
  8796. protocol: 'printing',
  8797. fn: function (aStream){
  8798. var self=this;
  8799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8800. return smalltalk.withContext(function($ctx1) {
  8801. //>>excludeEnd("ctx");
  8802. _st(aStream)._nextPutAll_(self._name());
  8803. return self;
  8804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8805. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Class)});
  8806. //>>excludeEnd("ctx");
  8807. },
  8808. //>>excludeStart("ide", pragmas.excludeIdeData);
  8809. args: ["aStream"],
  8810. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  8811. referencedClasses: [],
  8812. //>>excludeEnd("ide");
  8813. messageSends: ["nextPutAll:", "name"]
  8814. }),
  8815. globals.Class);
  8816. smalltalk.addMethod(
  8817. smalltalk.method({
  8818. selector: "rename:",
  8819. protocol: 'accessing',
  8820. fn: function (aString){
  8821. var self=this;
  8822. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  8823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8824. return smalltalk.withContext(function($ctx1) {
  8825. //>>excludeEnd("ctx");
  8826. _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
  8827. return self;
  8828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8829. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},globals.Class)});
  8830. //>>excludeEnd("ctx");
  8831. },
  8832. //>>excludeStart("ide", pragmas.excludeIdeData);
  8833. args: ["aString"],
  8834. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  8835. referencedClasses: ["ClassBuilder"],
  8836. //>>excludeEnd("ide");
  8837. messageSends: ["renameClass:to:", "new"]
  8838. }),
  8839. globals.Class);
  8840. smalltalk.addMethod(
  8841. smalltalk.method({
  8842. selector: "subclass:instanceVariableNames:",
  8843. protocol: 'class creation',
  8844. fn: function (aString,anotherString){
  8845. var self=this;
  8846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8847. return smalltalk.withContext(function($ctx1) {
  8848. //>>excludeEnd("ctx");
  8849. var $1;
  8850. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  8851. return $1;
  8852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8853. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.Class)});
  8854. //>>excludeEnd("ctx");
  8855. },
  8856. //>>excludeStart("ide", pragmas.excludeIdeData);
  8857. args: ["aString", "anotherString"],
  8858. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  8859. referencedClasses: [],
  8860. //>>excludeEnd("ide");
  8861. messageSends: ["subclass:instanceVariableNames:package:"]
  8862. }),
  8863. globals.Class);
  8864. smalltalk.addMethod(
  8865. smalltalk.method({
  8866. selector: "subclass:instanceVariableNames:category:",
  8867. protocol: 'class creation',
  8868. fn: function (aString,aString2,aString3){
  8869. var self=this;
  8870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8871. return smalltalk.withContext(function($ctx1) {
  8872. //>>excludeEnd("ctx");
  8873. var $1;
  8874. self._deprecatedAPI();
  8875. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  8876. return $1;
  8877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8878. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)});
  8879. //>>excludeEnd("ctx");
  8880. },
  8881. //>>excludeStart("ide", pragmas.excludeIdeData);
  8882. args: ["aString", "aString2", "aString3"],
  8883. 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",
  8884. referencedClasses: [],
  8885. //>>excludeEnd("ide");
  8886. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"]
  8887. }),
  8888. globals.Class);
  8889. smalltalk.addMethod(
  8890. smalltalk.method({
  8891. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  8892. protocol: 'class creation',
  8893. fn: function (aString,aString2,classVars,pools,aString3){
  8894. var self=this;
  8895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8896. return smalltalk.withContext(function($ctx1) {
  8897. //>>excludeEnd("ctx");
  8898. var $1;
  8899. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  8900. return $1;
  8901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8902. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},globals.Class)});
  8903. //>>excludeEnd("ctx");
  8904. },
  8905. //>>excludeStart("ide", pragmas.excludeIdeData);
  8906. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  8907. 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",
  8908. referencedClasses: [],
  8909. //>>excludeEnd("ide");
  8910. messageSends: ["subclass:instanceVariableNames:package:"]
  8911. }),
  8912. globals.Class);
  8913. smalltalk.addMethod(
  8914. smalltalk.method({
  8915. selector: "subclass:instanceVariableNames:package:",
  8916. protocol: 'class creation',
  8917. fn: function (aString,aString2,aString3){
  8918. var self=this;
  8919. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  8920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8921. return smalltalk.withContext(function($ctx1) {
  8922. //>>excludeEnd("ctx");
  8923. var $1;
  8924. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  8925. return $1;
  8926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8927. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)});
  8928. //>>excludeEnd("ctx");
  8929. },
  8930. //>>excludeStart("ide", pragmas.excludeIdeData);
  8931. args: ["aString", "aString2", "aString3"],
  8932. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  8933. referencedClasses: ["ClassBuilder"],
  8934. //>>excludeEnd("ide");
  8935. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  8936. }),
  8937. globals.Class);
  8938. smalltalk.addMethod(
  8939. smalltalk.method({
  8940. selector: "subclasses",
  8941. protocol: 'accessing',
  8942. fn: function (){
  8943. var self=this;
  8944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8945. return smalltalk.withContext(function($ctx1) {
  8946. //>>excludeEnd("ctx");
  8947. return self.subclasses._copy();
  8948. return self;
  8949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8950. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Class)});
  8951. //>>excludeEnd("ctx");
  8952. },
  8953. //>>excludeStart("ide", pragmas.excludeIdeData);
  8954. args: [],
  8955. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  8956. referencedClasses: [],
  8957. //>>excludeEnd("ide");
  8958. messageSends: []
  8959. }),
  8960. globals.Class);
  8961. smalltalk.addClass('Metaclass', globals.Behavior, [], 'Kernel-Classes');
  8962. //>>excludeStart("ide", pragmas.excludeIdeData);
  8963. globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  8964. //>>excludeEnd("ide");
  8965. smalltalk.addMethod(
  8966. smalltalk.method({
  8967. selector: "asJavascript",
  8968. protocol: 'converting',
  8969. fn: function (){
  8970. var self=this;
  8971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8972. return smalltalk.withContext(function($ctx1) {
  8973. //>>excludeEnd("ctx");
  8974. var $1;
  8975. $1=_st("globals.".__comma(_st(self._instanceClass())._name())).__comma(".klass");
  8976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8977. $ctx1.sendIdx[","]=1;
  8978. //>>excludeEnd("ctx");
  8979. return $1;
  8980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8981. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Metaclass)});
  8982. //>>excludeEnd("ctx");
  8983. },
  8984. //>>excludeStart("ide", pragmas.excludeIdeData);
  8985. args: [],
  8986. source: "asJavascript\x0a\x09^ 'globals.', self instanceClass name, '.klass'",
  8987. referencedClasses: [],
  8988. //>>excludeEnd("ide");
  8989. messageSends: [",", "name", "instanceClass"]
  8990. }),
  8991. globals.Metaclass);
  8992. smalltalk.addMethod(
  8993. smalltalk.method({
  8994. selector: "definition",
  8995. protocol: 'accessing',
  8996. fn: function (){
  8997. var self=this;
  8998. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9000. return smalltalk.withContext(function($ctx1) {
  9001. //>>excludeEnd("ctx");
  9002. var $2,$1;
  9003. $1=_st($String())._streamContents_((function(stream){
  9004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9005. return smalltalk.withContext(function($ctx2) {
  9006. //>>excludeEnd("ctx");
  9007. _st(stream)._nextPutAll_(self._asString());
  9008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9009. $ctx2.sendIdx["nextPutAll:"]=1;
  9010. //>>excludeEnd("ctx");
  9011. $2=_st(stream)._nextPutAll_(" instanceVariableNames: '");
  9012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9013. $ctx2.sendIdx["nextPutAll:"]=2;
  9014. //>>excludeEnd("ctx");
  9015. $2;
  9016. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  9017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9018. return smalltalk.withContext(function($ctx3) {
  9019. //>>excludeEnd("ctx");
  9020. return _st(stream)._nextPutAll_(each);
  9021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9022. $ctx3.sendIdx["nextPutAll:"]=3;
  9023. //>>excludeEnd("ctx");
  9024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9025. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  9026. //>>excludeEnd("ctx");
  9027. }),(function(){
  9028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9029. return smalltalk.withContext(function($ctx3) {
  9030. //>>excludeEnd("ctx");
  9031. return _st(stream)._nextPutAll_(" ");
  9032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9033. $ctx3.sendIdx["nextPutAll:"]=4;
  9034. //>>excludeEnd("ctx");
  9035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9036. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  9037. //>>excludeEnd("ctx");
  9038. }));
  9039. return _st(stream)._nextPutAll_("'");
  9040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9041. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  9042. //>>excludeEnd("ctx");
  9043. }));
  9044. return $1;
  9045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9046. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Metaclass)});
  9047. //>>excludeEnd("ctx");
  9048. },
  9049. //>>excludeStart("ide", pragmas.excludeIdeData);
  9050. args: [],
  9051. 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: '''' ]",
  9052. referencedClasses: ["String"],
  9053. //>>excludeEnd("ide");
  9054. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  9055. }),
  9056. globals.Metaclass);
  9057. smalltalk.addMethod(
  9058. smalltalk.method({
  9059. selector: "instanceClass",
  9060. protocol: 'accessing',
  9061. fn: function (){
  9062. var self=this;
  9063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9064. return smalltalk.withContext(function($ctx1) {
  9065. //>>excludeEnd("ctx");
  9066. return self.instanceClass;
  9067. return self;
  9068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9069. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},globals.Metaclass)});
  9070. //>>excludeEnd("ctx");
  9071. },
  9072. //>>excludeStart("ide", pragmas.excludeIdeData);
  9073. args: [],
  9074. source: "instanceClass\x0a\x09<return self.instanceClass>",
  9075. referencedClasses: [],
  9076. //>>excludeEnd("ide");
  9077. messageSends: []
  9078. }),
  9079. globals.Metaclass);
  9080. smalltalk.addMethod(
  9081. smalltalk.method({
  9082. selector: "instanceVariableNames:",
  9083. protocol: 'accessing',
  9084. fn: function (aCollection){
  9085. var self=this;
  9086. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  9087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9088. return smalltalk.withContext(function($ctx1) {
  9089. //>>excludeEnd("ctx");
  9090. _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  9091. return self;
  9092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9093. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},globals.Metaclass)});
  9094. //>>excludeEnd("ctx");
  9095. },
  9096. //>>excludeStart("ide", pragmas.excludeIdeData);
  9097. args: ["aCollection"],
  9098. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  9099. referencedClasses: ["ClassBuilder"],
  9100. //>>excludeEnd("ide");
  9101. messageSends: ["class:instanceVariableNames:", "new"]
  9102. }),
  9103. globals.Metaclass);
  9104. smalltalk.addMethod(
  9105. smalltalk.method({
  9106. selector: "isMetaclass",
  9107. protocol: 'testing',
  9108. fn: function (){
  9109. var self=this;
  9110. return true;
  9111. },
  9112. //>>excludeStart("ide", pragmas.excludeIdeData);
  9113. args: [],
  9114. source: "isMetaclass\x0a\x09^ true",
  9115. referencedClasses: [],
  9116. //>>excludeEnd("ide");
  9117. messageSends: []
  9118. }),
  9119. globals.Metaclass);
  9120. smalltalk.addMethod(
  9121. smalltalk.method({
  9122. selector: "package",
  9123. protocol: 'accessing',
  9124. fn: function (){
  9125. var self=this;
  9126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9127. return smalltalk.withContext(function($ctx1) {
  9128. //>>excludeEnd("ctx");
  9129. var $1;
  9130. $1=_st(self._instanceClass())._package();
  9131. return $1;
  9132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9133. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.Metaclass)});
  9134. //>>excludeEnd("ctx");
  9135. },
  9136. //>>excludeStart("ide", pragmas.excludeIdeData);
  9137. args: [],
  9138. source: "package\x0a\x09^ self instanceClass package",
  9139. referencedClasses: [],
  9140. //>>excludeEnd("ide");
  9141. messageSends: ["package", "instanceClass"]
  9142. }),
  9143. globals.Metaclass);
  9144. smalltalk.addMethod(
  9145. smalltalk.method({
  9146. selector: "printOn:",
  9147. protocol: 'printing',
  9148. fn: function (aStream){
  9149. var self=this;
  9150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9151. return smalltalk.withContext(function($ctx1) {
  9152. //>>excludeEnd("ctx");
  9153. var $1;
  9154. _st(aStream)._nextPutAll_(_st(self._instanceClass())._name());
  9155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9156. $ctx1.sendIdx["nextPutAll:"]=1;
  9157. //>>excludeEnd("ctx");
  9158. $1=_st(aStream)._nextPutAll_(" class");
  9159. return self;
  9160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9161. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Metaclass)});
  9162. //>>excludeEnd("ctx");
  9163. },
  9164. //>>excludeStart("ide", pragmas.excludeIdeData);
  9165. args: ["aStream"],
  9166. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  9167. referencedClasses: [],
  9168. //>>excludeEnd("ide");
  9169. messageSends: ["nextPutAll:", "name", "instanceClass"]
  9170. }),
  9171. globals.Metaclass);
  9172. smalltalk.addMethod(
  9173. smalltalk.method({
  9174. selector: "subclasses",
  9175. protocol: 'accessing',
  9176. fn: function (){
  9177. var self=this;
  9178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9179. return smalltalk.withContext(function($ctx1) {
  9180. //>>excludeEnd("ctx");
  9181. var $1;
  9182. $1=_st(_st(_st(self._instanceClass())._subclasses())._select_((function(each){
  9183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9184. return smalltalk.withContext(function($ctx2) {
  9185. //>>excludeEnd("ctx");
  9186. return _st(_st(each)._isMetaclass())._not();
  9187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9189. //>>excludeEnd("ctx");
  9190. })))._collect_((function(each){
  9191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9192. return smalltalk.withContext(function($ctx2) {
  9193. //>>excludeEnd("ctx");
  9194. return _st(each)._theMetaClass();
  9195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9197. //>>excludeEnd("ctx");
  9198. }));
  9199. return $1;
  9200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9201. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Metaclass)});
  9202. //>>excludeEnd("ctx");
  9203. },
  9204. //>>excludeStart("ide", pragmas.excludeIdeData);
  9205. args: [],
  9206. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  9207. referencedClasses: [],
  9208. //>>excludeEnd("ide");
  9209. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
  9210. }),
  9211. globals.Metaclass);
  9212. smalltalk.addMethod(
  9213. smalltalk.method({
  9214. selector: "theMetaClass",
  9215. protocol: 'accessing',
  9216. fn: function (){
  9217. var self=this;
  9218. return self;
  9219. },
  9220. //>>excludeStart("ide", pragmas.excludeIdeData);
  9221. args: [],
  9222. source: "theMetaClass\x0a\x09^ self",
  9223. referencedClasses: [],
  9224. //>>excludeEnd("ide");
  9225. messageSends: []
  9226. }),
  9227. globals.Metaclass);
  9228. smalltalk.addMethod(
  9229. smalltalk.method({
  9230. selector: "theNonMetaClass",
  9231. protocol: 'accessing',
  9232. fn: function (){
  9233. var self=this;
  9234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9235. return smalltalk.withContext(function($ctx1) {
  9236. //>>excludeEnd("ctx");
  9237. var $1;
  9238. $1=self._instanceClass();
  9239. return $1;
  9240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9241. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},globals.Metaclass)});
  9242. //>>excludeEnd("ctx");
  9243. },
  9244. //>>excludeStart("ide", pragmas.excludeIdeData);
  9245. args: [],
  9246. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  9247. referencedClasses: [],
  9248. //>>excludeEnd("ide");
  9249. messageSends: ["instanceClass"]
  9250. }),
  9251. globals.Metaclass);
  9252. smalltalk.addClass('ClassBuilder', globals.Object, [], 'Kernel-Classes');
  9253. //>>excludeStart("ide", pragmas.excludeIdeData);
  9254. globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  9255. //>>excludeEnd("ide");
  9256. smalltalk.addMethod(
  9257. smalltalk.method({
  9258. selector: "addSubclassOf:named:instanceVariableNames:package:",
  9259. protocol: 'class definition',
  9260. fn: function (aClass,className,aCollection,packageName){
  9261. var self=this;
  9262. var theClass,thePackage;
  9263. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9264. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  9265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9266. return smalltalk.withContext(function($ctx1) {
  9267. //>>excludeEnd("ctx");
  9268. var $1,$2,$3,$4,$receiver;
  9269. theClass=_st(_st($Smalltalk())._globals())._at_(className);
  9270. thePackage=_st($Package())._named_(packageName);
  9271. $1=theClass;
  9272. if(($receiver = $1) == null || $receiver.isNil){
  9273. $1;
  9274. } else {
  9275. _st(theClass)._package_(thePackage);
  9276. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  9277. if(! smalltalk.assert($2)){
  9278. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  9279. return $3;
  9280. };
  9281. };
  9282. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  9283. return $4;
  9284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9285. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},globals.ClassBuilder)});
  9286. //>>excludeEnd("ctx");
  9287. },
  9288. //>>excludeStart("ide", pragmas.excludeIdeData);
  9289. args: ["aClass", "className", "aCollection", "packageName"],
  9290. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  9291. referencedClasses: ["Smalltalk", "Package"],
  9292. //>>excludeEnd("ide");
  9293. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  9294. }),
  9295. globals.ClassBuilder);
  9296. smalltalk.addMethod(
  9297. smalltalk.method({
  9298. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  9299. protocol: 'private',
  9300. fn: function (aClass,aString,aCollection,packageName){
  9301. var self=this;
  9302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9303. return smalltalk.withContext(function($ctx1) {
  9304. //>>excludeEnd("ctx");
  9305. smalltalk.addClass(aString, aClass, aCollection, packageName);
  9306. return globals[aString]
  9307. ;
  9308. return self;
  9309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9310. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},globals.ClassBuilder)});
  9311. //>>excludeEnd("ctx");
  9312. },
  9313. //>>excludeStart("ide", pragmas.excludeIdeData);
  9314. args: ["aClass", "aString", "aCollection", "packageName"],
  9315. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return globals[aString]\x0a\x09>",
  9316. referencedClasses: [],
  9317. //>>excludeEnd("ide");
  9318. messageSends: []
  9319. }),
  9320. globals.ClassBuilder);
  9321. smalltalk.addMethod(
  9322. smalltalk.method({
  9323. selector: "basicClass:instanceVariableNames:",
  9324. protocol: 'private',
  9325. fn: function (aClass,aString){
  9326. var self=this;
  9327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9328. return smalltalk.withContext(function($ctx1) {
  9329. //>>excludeEnd("ctx");
  9330. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  9331. return self;
  9332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9333. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},globals.ClassBuilder)});
  9334. //>>excludeEnd("ctx");
  9335. },
  9336. //>>excludeStart("ide", pragmas.excludeIdeData);
  9337. args: ["aClass", "aString"],
  9338. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  9339. referencedClasses: [],
  9340. //>>excludeEnd("ide");
  9341. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  9342. }),
  9343. globals.ClassBuilder);
  9344. smalltalk.addMethod(
  9345. smalltalk.method({
  9346. selector: "basicClass:instanceVariables:",
  9347. protocol: 'private',
  9348. fn: function (aClass,aCollection){
  9349. var self=this;
  9350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9351. return smalltalk.withContext(function($ctx1) {
  9352. //>>excludeEnd("ctx");
  9353. var $1;
  9354. $1=_st(aClass)._isMetaclass();
  9355. if(! smalltalk.assert($1)){
  9356. self._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  9357. };
  9358. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  9359. return self;
  9360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9361. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},globals.ClassBuilder)});
  9362. //>>excludeEnd("ctx");
  9363. },
  9364. //>>excludeStart("ide", pragmas.excludeIdeData);
  9365. args: ["aClass", "aCollection"],
  9366. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  9367. referencedClasses: [],
  9368. //>>excludeEnd("ide");
  9369. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  9370. }),
  9371. globals.ClassBuilder);
  9372. smalltalk.addMethod(
  9373. smalltalk.method({
  9374. selector: "basicRemoveClass:",
  9375. protocol: 'private',
  9376. fn: function (aClass){
  9377. var self=this;
  9378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9379. return smalltalk.withContext(function($ctx1) {
  9380. //>>excludeEnd("ctx");
  9381. smalltalk.removeClass(aClass);
  9382. return self;
  9383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9384. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},globals.ClassBuilder)});
  9385. //>>excludeEnd("ctx");
  9386. },
  9387. //>>excludeStart("ide", pragmas.excludeIdeData);
  9388. args: ["aClass"],
  9389. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  9390. referencedClasses: [],
  9391. //>>excludeEnd("ide");
  9392. messageSends: []
  9393. }),
  9394. globals.ClassBuilder);
  9395. smalltalk.addMethod(
  9396. smalltalk.method({
  9397. selector: "basicRenameClass:to:",
  9398. protocol: 'private',
  9399. fn: function (aClass,aString){
  9400. var self=this;
  9401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9402. return smalltalk.withContext(function($ctx1) {
  9403. //>>excludeEnd("ctx");
  9404. globals[aString] = aClass;
  9405. delete globals[aClass.className];
  9406. aClass.className = aString;
  9407. ;
  9408. return self;
  9409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9410. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)});
  9411. //>>excludeEnd("ctx");
  9412. },
  9413. //>>excludeStart("ide", pragmas.excludeIdeData);
  9414. args: ["aClass", "aString"],
  9415. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09globals[aString] = aClass;\x0a\x09\x09delete globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  9416. referencedClasses: [],
  9417. //>>excludeEnd("ide");
  9418. messageSends: []
  9419. }),
  9420. globals.ClassBuilder);
  9421. smalltalk.addMethod(
  9422. smalltalk.method({
  9423. selector: "basicSwapClassNames:with:",
  9424. protocol: 'private',
  9425. fn: function (aClass,anotherClass){
  9426. var self=this;
  9427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9428. return smalltalk.withContext(function($ctx1) {
  9429. //>>excludeEnd("ctx");
  9430. var tmp = aClass.className;
  9431. aClass.className = anotherClass.className;
  9432. anotherClass.className = tmp;
  9433. ;
  9434. return self;
  9435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9436. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)});
  9437. //>>excludeEnd("ctx");
  9438. },
  9439. //>>excludeStart("ide", pragmas.excludeIdeData);
  9440. args: ["aClass", "anotherClass"],
  9441. 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>",
  9442. referencedClasses: [],
  9443. //>>excludeEnd("ide");
  9444. messageSends: []
  9445. }),
  9446. globals.ClassBuilder);
  9447. smalltalk.addMethod(
  9448. smalltalk.method({
  9449. selector: "class:instanceVariableNames:",
  9450. protocol: 'class definition',
  9451. fn: function (aClass,ivarNames){
  9452. var self=this;
  9453. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9454. function $ClassDefinitionChanged(){return globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  9455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9456. return smalltalk.withContext(function($ctx1) {
  9457. //>>excludeEnd("ctx");
  9458. var $1,$2;
  9459. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  9460. self._setupClass_(aClass);
  9461. $1=_st($ClassDefinitionChanged())._new();
  9462. _st($1)._theClass_(aClass);
  9463. $2=_st($1)._yourself();
  9464. _st(_st($SystemAnnouncer())._current())._announce_($2);
  9465. return self;
  9466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9467. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},globals.ClassBuilder)});
  9468. //>>excludeEnd("ctx");
  9469. },
  9470. //>>excludeStart("ide", pragmas.excludeIdeData);
  9471. args: ["aClass", "ivarNames"],
  9472. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  9473. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  9474. //>>excludeEnd("ide");
  9475. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  9476. }),
  9477. globals.ClassBuilder);
  9478. smalltalk.addMethod(
  9479. smalltalk.method({
  9480. selector: "copyClass:named:",
  9481. protocol: 'copying',
  9482. fn: function (aClass,className){
  9483. var self=this;
  9484. var newClass;
  9485. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9486. function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  9487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9488. return smalltalk.withContext(function($ctx1) {
  9489. //>>excludeEnd("ctx");
  9490. var $1,$2,$3;
  9491. newClass=self._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),className,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  9492. self._copyClass_to_(aClass,newClass);
  9493. $1=_st($ClassAdded())._new();
  9494. _st($1)._theClass_(newClass);
  9495. $2=_st($1)._yourself();
  9496. _st(_st($SystemAnnouncer())._current())._announce_($2);
  9497. $3=newClass;
  9498. return $3;
  9499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9500. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},globals.ClassBuilder)});
  9501. //>>excludeEnd("ctx");
  9502. },
  9503. //>>excludeStart("ide", pragmas.excludeIdeData);
  9504. args: ["aClass", "className"],
  9505. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\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",
  9506. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  9507. //>>excludeEnd("ide");
  9508. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  9509. }),
  9510. globals.ClassBuilder);
  9511. smalltalk.addMethod(
  9512. smalltalk.method({
  9513. selector: "copyClass:to:",
  9514. protocol: 'copying',
  9515. fn: function (aClass,anotherClass){
  9516. var self=this;
  9517. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  9518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9519. return smalltalk.withContext(function($ctx1) {
  9520. //>>excludeEnd("ctx");
  9521. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  9522. _st(anotherClass)._comment_(_st(aClass)._comment());
  9523. $1=_st(aClass)._methodDictionary();
  9524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9525. $ctx1.sendIdx["methodDictionary"]=1;
  9526. //>>excludeEnd("ctx");
  9527. _st($1)._valuesDo_((function(each){
  9528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9529. return smalltalk.withContext(function($ctx2) {
  9530. //>>excludeEnd("ctx");
  9531. $2=_st($Compiler())._new();
  9532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9533. $ctx2.sendIdx["new"]=1;
  9534. //>>excludeEnd("ctx");
  9535. $3=_st(each)._source();
  9536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9537. $ctx2.sendIdx["source"]=1;
  9538. //>>excludeEnd("ctx");
  9539. $4=_st(each)._protocol();
  9540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9541. $ctx2.sendIdx["protocol"]=1;
  9542. //>>excludeEnd("ctx");
  9543. return _st($2)._install_forClass_protocol_($3,anotherClass,$4);
  9544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9545. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  9546. //>>excludeEnd("ctx");
  9547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9548. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9549. //>>excludeEnd("ctx");
  9550. }));
  9551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9552. $ctx1.sendIdx["valuesDo:"]=1;
  9553. //>>excludeEnd("ctx");
  9554. $5=_st(anotherClass)._class();
  9555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9556. $ctx1.sendIdx["class"]=1;
  9557. //>>excludeEnd("ctx");
  9558. $7=_st(aClass)._class();
  9559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9560. $ctx1.sendIdx["class"]=2;
  9561. //>>excludeEnd("ctx");
  9562. $6=_st($7)._instanceVariableNames();
  9563. self._basicClass_instanceVariables_($5,$6);
  9564. $9=_st(aClass)._class();
  9565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9566. $ctx1.sendIdx["class"]=3;
  9567. //>>excludeEnd("ctx");
  9568. $8=_st($9)._methodDictionary();
  9569. _st($8)._valuesDo_((function(each){
  9570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9571. return smalltalk.withContext(function($ctx2) {
  9572. //>>excludeEnd("ctx");
  9573. return _st(_st($Compiler())._new())._install_forClass_protocol_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._protocol());
  9574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9576. //>>excludeEnd("ctx");
  9577. }));
  9578. self._setupClass_(anotherClass);
  9579. return self;
  9580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9581. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)});
  9582. //>>excludeEnd("ctx");
  9583. },
  9584. //>>excludeStart("ide", pragmas.excludeIdeData);
  9585. args: ["aClass", "anotherClass"],
  9586. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ].\x0a\x0a\x09self setupClass: anotherClass",
  9587. referencedClasses: ["Compiler"],
  9588. //>>excludeEnd("ide");
  9589. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
  9590. }),
  9591. globals.ClassBuilder);
  9592. smalltalk.addMethod(
  9593. smalltalk.method({
  9594. selector: "installMethod:forClass:protocol:",
  9595. protocol: 'method definition',
  9596. fn: function (aCompiledMethod,aBehavior,aString){
  9597. var self=this;
  9598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9599. return smalltalk.withContext(function($ctx1) {
  9600. //>>excludeEnd("ctx");
  9601. _st(aCompiledMethod)._protocol_(aString);
  9602. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  9603. self._setupClass_(aBehavior);
  9604. return aCompiledMethod;
  9605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9606. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},globals.ClassBuilder)});
  9607. //>>excludeEnd("ctx");
  9608. },
  9609. //>>excludeStart("ide", pragmas.excludeIdeData);
  9610. args: ["aCompiledMethod", "aBehavior", "aString"],
  9611. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^ aCompiledMethod",
  9612. referencedClasses: [],
  9613. //>>excludeEnd("ide");
  9614. messageSends: ["protocol:", "addCompiledMethod:", "setupClass:"]
  9615. }),
  9616. globals.ClassBuilder);
  9617. smalltalk.addMethod(
  9618. smalltalk.method({
  9619. selector: "instanceVariableNamesFor:",
  9620. protocol: 'accessing',
  9621. fn: function (aString){
  9622. var self=this;
  9623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9624. return smalltalk.withContext(function($ctx1) {
  9625. //>>excludeEnd("ctx");
  9626. var $1;
  9627. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  9628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9629. return smalltalk.withContext(function($ctx2) {
  9630. //>>excludeEnd("ctx");
  9631. return _st(each)._isEmpty();
  9632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9633. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9634. //>>excludeEnd("ctx");
  9635. }));
  9636. return $1;
  9637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9638. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},globals.ClassBuilder)});
  9639. //>>excludeEnd("ctx");
  9640. },
  9641. //>>excludeStart("ide", pragmas.excludeIdeData);
  9642. args: ["aString"],
  9643. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  9644. referencedClasses: [],
  9645. //>>excludeEnd("ide");
  9646. messageSends: ["reject:", "tokenize:", "isEmpty"]
  9647. }),
  9648. globals.ClassBuilder);
  9649. smalltalk.addMethod(
  9650. smalltalk.method({
  9651. selector: "migrateClass:superclass:",
  9652. protocol: 'class migration',
  9653. fn: function (aClass,anotherClass){
  9654. var self=this;
  9655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9656. return smalltalk.withContext(function($ctx1) {
  9657. //>>excludeEnd("ctx");
  9658. var $2,$1;
  9659. $2=_st(aClass)._name();
  9660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9661. $ctx1.sendIdx["name"]=1;
  9662. //>>excludeEnd("ctx");
  9663. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  9664. return $1;
  9665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9666. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)});
  9667. //>>excludeEnd("ctx");
  9668. },
  9669. //>>excludeStart("ide", pragmas.excludeIdeData);
  9670. args: ["aClass", "anotherClass"],
  9671. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  9672. referencedClasses: [],
  9673. //>>excludeEnd("ide");
  9674. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  9675. }),
  9676. globals.ClassBuilder);
  9677. smalltalk.addMethod(
  9678. smalltalk.method({
  9679. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  9680. protocol: 'class migration',
  9681. fn: function (className,aClass,aCollection,packageName){
  9682. var self=this;
  9683. var oldClass,newClass,tmp;
  9684. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9685. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  9686. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9687. function $ClassMigrated(){return globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  9688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9689. return smalltalk.withContext(function($ctx1) {
  9690. //>>excludeEnd("ctx");
  9691. var $1,$2,$3,$4,$5;
  9692. tmp="new*".__comma(className);
  9693. oldClass=_st(_st($Smalltalk())._globals())._at_(className);
  9694. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  9695. self._basicSwapClassNames_with_(oldClass,newClass);
  9696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9697. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  9698. //>>excludeEnd("ctx");
  9699. _st((function(){
  9700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9701. return smalltalk.withContext(function($ctx2) {
  9702. //>>excludeEnd("ctx");
  9703. return self._copyClass_to_(oldClass,newClass);
  9704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9706. //>>excludeEnd("ctx");
  9707. }))._on_do_($Error(),(function(exception){
  9708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9709. return smalltalk.withContext(function($ctx2) {
  9710. //>>excludeEnd("ctx");
  9711. self._basicSwapClassNames_with_(oldClass,newClass);
  9712. $1=self._basicRemoveClass_(newClass);
  9713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9714. $ctx2.sendIdx["basicRemoveClass:"]=1;
  9715. //>>excludeEnd("ctx");
  9716. $1;
  9717. return _st(exception)._signal();
  9718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9719. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  9720. //>>excludeEnd("ctx");
  9721. }));
  9722. self._rawRenameClass_to_(oldClass,tmp);
  9723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9724. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  9725. //>>excludeEnd("ctx");
  9726. $2=self._rawRenameClass_to_(newClass,className);
  9727. _st(_st(oldClass)._subclasses())._do_((function(each){
  9728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9729. return smalltalk.withContext(function($ctx2) {
  9730. //>>excludeEnd("ctx");
  9731. return self._migrateClass_superclass_(each,newClass);
  9732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  9734. //>>excludeEnd("ctx");
  9735. }));
  9736. self._basicRemoveClass_(oldClass);
  9737. $3=_st($ClassMigrated())._new();
  9738. _st($3)._theClass_(newClass);
  9739. _st($3)._oldClass_(oldClass);
  9740. $4=_st($3)._yourself();
  9741. _st(_st($SystemAnnouncer())._current())._announce_($4);
  9742. $5=newClass;
  9743. return $5;
  9744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9745. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},globals.ClassBuilder)});
  9746. //>>excludeEnd("ctx");
  9747. },
  9748. //>>excludeStart("ide", pragmas.excludeIdeData);
  9749. args: ["className", "aClass", "aCollection", "packageName"],
  9750. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\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: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  9751. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  9752. //>>excludeEnd("ide");
  9753. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "signal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  9754. }),
  9755. globals.ClassBuilder);
  9756. smalltalk.addMethod(
  9757. smalltalk.method({
  9758. selector: "rawRenameClass:to:",
  9759. protocol: 'private',
  9760. fn: function (aClass,aString){
  9761. var self=this;
  9762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9763. return smalltalk.withContext(function($ctx1) {
  9764. //>>excludeEnd("ctx");
  9765. globals[aString] = aClass;
  9766. ;
  9767. return self;
  9768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9769. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)});
  9770. //>>excludeEnd("ctx");
  9771. },
  9772. //>>excludeStart("ide", pragmas.excludeIdeData);
  9773. args: ["aClass", "aString"],
  9774. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09globals[aString] = aClass;\x0a\x09>",
  9775. referencedClasses: [],
  9776. //>>excludeEnd("ide");
  9777. messageSends: []
  9778. }),
  9779. globals.ClassBuilder);
  9780. smalltalk.addMethod(
  9781. smalltalk.method({
  9782. selector: "renameClass:to:",
  9783. protocol: 'class migration',
  9784. fn: function (aClass,className){
  9785. var self=this;
  9786. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9787. function $ClassRenamed(){return globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  9788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9789. return smalltalk.withContext(function($ctx1) {
  9790. //>>excludeEnd("ctx");
  9791. var $1,$2;
  9792. self._basicRenameClass_to_(aClass,className);
  9793. _st(aClass)._recompile();
  9794. $1=_st($ClassRenamed())._new();
  9795. _st($1)._theClass_(aClass);
  9796. $2=_st($1)._yourself();
  9797. _st(_st($SystemAnnouncer())._current())._announce_($2);
  9798. return self;
  9799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9800. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},globals.ClassBuilder)});
  9801. //>>excludeEnd("ctx");
  9802. },
  9803. //>>excludeStart("ide", pragmas.excludeIdeData);
  9804. args: ["aClass", "className"],
  9805. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  9806. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  9807. //>>excludeEnd("ide");
  9808. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  9809. }),
  9810. globals.ClassBuilder);
  9811. smalltalk.addMethod(
  9812. smalltalk.method({
  9813. selector: "setupClass:",
  9814. protocol: 'public',
  9815. fn: function (aClass){
  9816. var self=this;
  9817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9818. return smalltalk.withContext(function($ctx1) {
  9819. //>>excludeEnd("ctx");
  9820. smalltalk.init(aClass);;
  9821. return self;
  9822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9823. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},globals.ClassBuilder)});
  9824. //>>excludeEnd("ctx");
  9825. },
  9826. //>>excludeStart("ide", pragmas.excludeIdeData);
  9827. args: ["aClass"],
  9828. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  9829. referencedClasses: [],
  9830. //>>excludeEnd("ide");
  9831. messageSends: []
  9832. }),
  9833. globals.ClassBuilder);
  9834. smalltalk.addMethod(
  9835. smalltalk.method({
  9836. selector: "superclass:subclass:",
  9837. protocol: 'class definition',
  9838. fn: function (aClass,className){
  9839. var self=this;
  9840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9841. return smalltalk.withContext(function($ctx1) {
  9842. //>>excludeEnd("ctx");
  9843. var $1;
  9844. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  9845. return $1;
  9846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9847. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},globals.ClassBuilder)});
  9848. //>>excludeEnd("ctx");
  9849. },
  9850. //>>excludeStart("ide", pragmas.excludeIdeData);
  9851. args: ["aClass", "className"],
  9852. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  9853. referencedClasses: [],
  9854. //>>excludeEnd("ide");
  9855. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  9856. }),
  9857. globals.ClassBuilder);
  9858. smalltalk.addMethod(
  9859. smalltalk.method({
  9860. selector: "superclass:subclass:instanceVariableNames:package:",
  9861. protocol: 'class definition',
  9862. fn: function (aClass,className,ivarNames,packageName){
  9863. var self=this;
  9864. var newClass;
  9865. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9866. function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  9867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9868. return smalltalk.withContext(function($ctx1) {
  9869. //>>excludeEnd("ctx");
  9870. var $1,$2,$3,$4,$5,$receiver;
  9871. $1=self._instanceVariableNamesFor_(ivarNames);
  9872. if(($receiver = packageName) == null || $receiver.isNil){
  9873. $2="unclassified";
  9874. } else {
  9875. $2=packageName;
  9876. };
  9877. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  9878. self._setupClass_(newClass);
  9879. $3=_st($ClassAdded())._new();
  9880. _st($3)._theClass_(newClass);
  9881. $4=_st($3)._yourself();
  9882. _st(_st($SystemAnnouncer())._current())._announce_($4);
  9883. $5=newClass;
  9884. return $5;
  9885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9886. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},globals.ClassBuilder)});
  9887. //>>excludeEnd("ctx");
  9888. },
  9889. //>>excludeStart("ide", pragmas.excludeIdeData);
  9890. args: ["aClass", "className", "ivarNames", "packageName"],
  9891. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName 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",
  9892. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  9893. //>>excludeEnd("ide");
  9894. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  9895. }),
  9896. globals.ClassBuilder);
  9897. smalltalk.addClass('ClassCategoryReader', globals.Object, ['class', 'category'], 'Kernel-Classes');
  9898. //>>excludeStart("ide", pragmas.excludeIdeData);
  9899. globals.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  9900. //>>excludeEnd("ide");
  9901. smalltalk.addMethod(
  9902. smalltalk.method({
  9903. selector: "class:category:",
  9904. protocol: 'accessing',
  9905. fn: function (aClass,aString){
  9906. var self=this;
  9907. self["@class"]=aClass;
  9908. self["@category"]=aString;
  9909. return self;
  9910. },
  9911. //>>excludeStart("ide", pragmas.excludeIdeData);
  9912. args: ["aClass", "aString"],
  9913. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  9914. referencedClasses: [],
  9915. //>>excludeEnd("ide");
  9916. messageSends: []
  9917. }),
  9918. globals.ClassCategoryReader);
  9919. smalltalk.addMethod(
  9920. smalltalk.method({
  9921. selector: "compileMethod:",
  9922. protocol: 'private',
  9923. fn: function (aString){
  9924. var self=this;
  9925. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  9926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9927. return smalltalk.withContext(function($ctx1) {
  9928. //>>excludeEnd("ctx");
  9929. _st(_st($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  9930. return self;
  9931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9932. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},globals.ClassCategoryReader)});
  9933. //>>excludeEnd("ctx");
  9934. },
  9935. //>>excludeStart("ide", pragmas.excludeIdeData);
  9936. args: ["aString"],
  9937. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  9938. referencedClasses: ["Compiler"],
  9939. //>>excludeEnd("ide");
  9940. messageSends: ["install:forClass:protocol:", "new"]
  9941. }),
  9942. globals.ClassCategoryReader);
  9943. smalltalk.addMethod(
  9944. smalltalk.method({
  9945. selector: "initialize",
  9946. protocol: 'initialization',
  9947. fn: function (){
  9948. var self=this;
  9949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9950. return smalltalk.withContext(function($ctx1) {
  9951. //>>excludeEnd("ctx");
  9952. (
  9953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9954. $ctx1.supercall = true,
  9955. //>>excludeEnd("ctx");
  9956. globals.ClassCategoryReader.superclass.fn.prototype._initialize.apply(_st(self), []));
  9957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9958. $ctx1.supercall = false;
  9959. //>>excludeEnd("ctx");;
  9960. return self;
  9961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9962. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCategoryReader)});
  9963. //>>excludeEnd("ctx");
  9964. },
  9965. //>>excludeStart("ide", pragmas.excludeIdeData);
  9966. args: [],
  9967. source: "initialize\x0a\x09super initialize.",
  9968. referencedClasses: [],
  9969. //>>excludeEnd("ide");
  9970. messageSends: ["initialize"]
  9971. }),
  9972. globals.ClassCategoryReader);
  9973. smalltalk.addMethod(
  9974. smalltalk.method({
  9975. selector: "scanFrom:",
  9976. protocol: 'fileIn',
  9977. fn: function (aChunkParser){
  9978. var self=this;
  9979. var chunk;
  9980. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  9981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9982. return smalltalk.withContext(function($ctx1) {
  9983. //>>excludeEnd("ctx");
  9984. _st((function(){
  9985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9986. return smalltalk.withContext(function($ctx2) {
  9987. //>>excludeEnd("ctx");
  9988. chunk=_st(aChunkParser)._nextChunk();
  9989. chunk;
  9990. return _st(chunk)._isEmpty();
  9991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9993. //>>excludeEnd("ctx");
  9994. }))._whileFalse_((function(){
  9995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9996. return smalltalk.withContext(function($ctx2) {
  9997. //>>excludeEnd("ctx");
  9998. return self._compileMethod_(chunk);
  9999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10001. //>>excludeEnd("ctx");
  10002. }));
  10003. _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
  10004. return self;
  10005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10006. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCategoryReader)});
  10007. //>>excludeEnd("ctx");
  10008. },
  10009. //>>excludeStart("ide", pragmas.excludeIdeData);
  10010. args: ["aChunkParser"],
  10011. 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",
  10012. referencedClasses: ["ClassBuilder"],
  10013. //>>excludeEnd("ide");
  10014. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
  10015. }),
  10016. globals.ClassCategoryReader);
  10017. smalltalk.addClass('ClassCommentReader', globals.Object, ['class'], 'Kernel-Classes');
  10018. //>>excludeStart("ide", pragmas.excludeIdeData);
  10019. globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  10020. //>>excludeEnd("ide");
  10021. smalltalk.addMethod(
  10022. smalltalk.method({
  10023. selector: "class:",
  10024. protocol: 'accessing',
  10025. fn: function (aClass){
  10026. var self=this;
  10027. self["@class"]=aClass;
  10028. return self;
  10029. },
  10030. //>>excludeStart("ide", pragmas.excludeIdeData);
  10031. args: ["aClass"],
  10032. source: "class: aClass\x0a\x09class := aClass",
  10033. referencedClasses: [],
  10034. //>>excludeEnd("ide");
  10035. messageSends: []
  10036. }),
  10037. globals.ClassCommentReader);
  10038. smalltalk.addMethod(
  10039. smalltalk.method({
  10040. selector: "initialize",
  10041. protocol: 'initialization',
  10042. fn: function (){
  10043. var self=this;
  10044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10045. return smalltalk.withContext(function($ctx1) {
  10046. //>>excludeEnd("ctx");
  10047. (
  10048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10049. $ctx1.supercall = true,
  10050. //>>excludeEnd("ctx");
  10051. globals.ClassCommentReader.superclass.fn.prototype._initialize.apply(_st(self), []));
  10052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10053. $ctx1.supercall = false;
  10054. //>>excludeEnd("ctx");;
  10055. return self;
  10056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10057. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCommentReader)});
  10058. //>>excludeEnd("ctx");
  10059. },
  10060. //>>excludeStart("ide", pragmas.excludeIdeData);
  10061. args: [],
  10062. source: "initialize\x0a\x09super initialize.",
  10063. referencedClasses: [],
  10064. //>>excludeEnd("ide");
  10065. messageSends: ["initialize"]
  10066. }),
  10067. globals.ClassCommentReader);
  10068. smalltalk.addMethod(
  10069. smalltalk.method({
  10070. selector: "scanFrom:",
  10071. protocol: 'fileIn',
  10072. fn: function (aChunkParser){
  10073. var self=this;
  10074. var chunk;
  10075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10076. return smalltalk.withContext(function($ctx1) {
  10077. //>>excludeEnd("ctx");
  10078. var $1;
  10079. chunk=_st(aChunkParser)._nextChunk();
  10080. $1=_st(chunk)._isEmpty();
  10081. if(! smalltalk.assert($1)){
  10082. self._setComment_(chunk);
  10083. };
  10084. return self;
  10085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10086. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCommentReader)});
  10087. //>>excludeEnd("ctx");
  10088. },
  10089. //>>excludeStart("ide", pragmas.excludeIdeData);
  10090. args: ["aChunkParser"],
  10091. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  10092. referencedClasses: [],
  10093. //>>excludeEnd("ide");
  10094. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  10095. }),
  10096. globals.ClassCommentReader);
  10097. smalltalk.addMethod(
  10098. smalltalk.method({
  10099. selector: "setComment:",
  10100. protocol: 'private',
  10101. fn: function (aString){
  10102. var self=this;
  10103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10104. return smalltalk.withContext(function($ctx1) {
  10105. //>>excludeEnd("ctx");
  10106. _st(self["@class"])._comment_(aString);
  10107. return self;
  10108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10109. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},globals.ClassCommentReader)});
  10110. //>>excludeEnd("ctx");
  10111. },
  10112. //>>excludeStart("ide", pragmas.excludeIdeData);
  10113. args: ["aString"],
  10114. source: "setComment: aString\x0a\x09class comment: aString",
  10115. referencedClasses: [],
  10116. //>>excludeEnd("ide");
  10117. messageSends: ["comment:"]
  10118. }),
  10119. globals.ClassCommentReader);
  10120. smalltalk.addClass('ClassSorterNode', globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  10121. //>>excludeStart("ide", pragmas.excludeIdeData);
  10122. globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  10123. //>>excludeEnd("ide");
  10124. smalltalk.addMethod(
  10125. smalltalk.method({
  10126. selector: "getNodesFrom:",
  10127. protocol: 'accessing',
  10128. fn: function (aCollection){
  10129. var self=this;
  10130. var children,others;
  10131. function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  10132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10133. return smalltalk.withContext(function($ctx1) {
  10134. //>>excludeEnd("ctx");
  10135. var $1;
  10136. children=[];
  10137. others=[];
  10138. _st(aCollection)._do_((function(each){
  10139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10140. return smalltalk.withContext(function($ctx2) {
  10141. //>>excludeEnd("ctx");
  10142. $1=_st(_st(each)._superclass()).__eq(self._theClass());
  10143. if(smalltalk.assert($1)){
  10144. return _st(children)._add_(each);
  10145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10146. $ctx2.sendIdx["add:"]=1;
  10147. //>>excludeEnd("ctx");
  10148. } else {
  10149. return _st(others)._add_(each);
  10150. };
  10151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10153. //>>excludeEnd("ctx");
  10154. }));
  10155. self["@nodes"]=_st(children)._collect_((function(each){
  10156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10157. return smalltalk.withContext(function($ctx2) {
  10158. //>>excludeEnd("ctx");
  10159. return _st($ClassSorterNode())._on_classes_level_(each,others,_st(self._level()).__plus((1)));
  10160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10161. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  10162. //>>excludeEnd("ctx");
  10163. }));
  10164. return self;
  10165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10166. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},globals.ClassSorterNode)});
  10167. //>>excludeEnd("ctx");
  10168. },
  10169. //>>excludeStart("ide", pragmas.excludeIdeData);
  10170. args: ["aCollection"],
  10171. 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 ]",
  10172. referencedClasses: ["ClassSorterNode"],
  10173. //>>excludeEnd("ide");
  10174. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  10175. }),
  10176. globals.ClassSorterNode);
  10177. smalltalk.addMethod(
  10178. smalltalk.method({
  10179. selector: "level",
  10180. protocol: 'accessing',
  10181. fn: function (){
  10182. var self=this;
  10183. var $1;
  10184. $1=self["@level"];
  10185. return $1;
  10186. },
  10187. //>>excludeStart("ide", pragmas.excludeIdeData);
  10188. args: [],
  10189. source: "level\x0a\x09^ level",
  10190. referencedClasses: [],
  10191. //>>excludeEnd("ide");
  10192. messageSends: []
  10193. }),
  10194. globals.ClassSorterNode);
  10195. smalltalk.addMethod(
  10196. smalltalk.method({
  10197. selector: "level:",
  10198. protocol: 'accessing',
  10199. fn: function (anInteger){
  10200. var self=this;
  10201. self["@level"]=anInteger;
  10202. return self;
  10203. },
  10204. //>>excludeStart("ide", pragmas.excludeIdeData);
  10205. args: ["anInteger"],
  10206. source: "level: anInteger\x0a\x09level := anInteger",
  10207. referencedClasses: [],
  10208. //>>excludeEnd("ide");
  10209. messageSends: []
  10210. }),
  10211. globals.ClassSorterNode);
  10212. smalltalk.addMethod(
  10213. smalltalk.method({
  10214. selector: "nodes",
  10215. protocol: 'accessing',
  10216. fn: function (){
  10217. var self=this;
  10218. var $1;
  10219. $1=self["@nodes"];
  10220. return $1;
  10221. },
  10222. //>>excludeStart("ide", pragmas.excludeIdeData);
  10223. args: [],
  10224. source: "nodes\x0a\x09^ nodes",
  10225. referencedClasses: [],
  10226. //>>excludeEnd("ide");
  10227. messageSends: []
  10228. }),
  10229. globals.ClassSorterNode);
  10230. smalltalk.addMethod(
  10231. smalltalk.method({
  10232. selector: "theClass",
  10233. protocol: 'accessing',
  10234. fn: function (){
  10235. var self=this;
  10236. var $1;
  10237. $1=self["@theClass"];
  10238. return $1;
  10239. },
  10240. //>>excludeStart("ide", pragmas.excludeIdeData);
  10241. args: [],
  10242. source: "theClass\x0a\x09^ theClass",
  10243. referencedClasses: [],
  10244. //>>excludeEnd("ide");
  10245. messageSends: []
  10246. }),
  10247. globals.ClassSorterNode);
  10248. smalltalk.addMethod(
  10249. smalltalk.method({
  10250. selector: "theClass:",
  10251. protocol: 'accessing',
  10252. fn: function (aClass){
  10253. var self=this;
  10254. self["@theClass"]=aClass;
  10255. return self;
  10256. },
  10257. //>>excludeStart("ide", pragmas.excludeIdeData);
  10258. args: ["aClass"],
  10259. source: "theClass: aClass\x0a\x09theClass := aClass",
  10260. referencedClasses: [],
  10261. //>>excludeEnd("ide");
  10262. messageSends: []
  10263. }),
  10264. globals.ClassSorterNode);
  10265. smalltalk.addMethod(
  10266. smalltalk.method({
  10267. selector: "traverseClassesWith:",
  10268. protocol: 'visiting',
  10269. fn: function (aCollection){
  10270. var self=this;
  10271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10272. return smalltalk.withContext(function($ctx1) {
  10273. //>>excludeEnd("ctx");
  10274. var $1,$3,$2;
  10275. $1=self._theClass();
  10276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10277. $ctx1.sendIdx["theClass"]=1;
  10278. //>>excludeEnd("ctx");
  10279. _st(aCollection)._add_($1);
  10280. _st(_st(self._nodes())._sorted_((function(a,b){
  10281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10282. return smalltalk.withContext(function($ctx2) {
  10283. //>>excludeEnd("ctx");
  10284. $3=_st(a)._theClass();
  10285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10286. $ctx2.sendIdx["theClass"]=2;
  10287. //>>excludeEnd("ctx");
  10288. $2=_st($3)._name();
  10289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10290. $ctx2.sendIdx["name"]=1;
  10291. //>>excludeEnd("ctx");
  10292. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  10293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10294. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10295. //>>excludeEnd("ctx");
  10296. })))._do_((function(aNode){
  10297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10298. return smalltalk.withContext(function($ctx2) {
  10299. //>>excludeEnd("ctx");
  10300. return _st(aNode)._traverseClassesWith_(aCollection);
  10301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10302. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  10303. //>>excludeEnd("ctx");
  10304. }));
  10305. return self;
  10306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10307. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},globals.ClassSorterNode)});
  10308. //>>excludeEnd("ctx");
  10309. },
  10310. //>>excludeStart("ide", pragmas.excludeIdeData);
  10311. args: ["aCollection"],
  10312. 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 ].",
  10313. referencedClasses: [],
  10314. //>>excludeEnd("ide");
  10315. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  10316. }),
  10317. globals.ClassSorterNode);
  10318. smalltalk.addMethod(
  10319. smalltalk.method({
  10320. selector: "on:classes:level:",
  10321. protocol: 'instance creation',
  10322. fn: function (aClass,aCollection,anInteger){
  10323. var self=this;
  10324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10325. return smalltalk.withContext(function($ctx1) {
  10326. //>>excludeEnd("ctx");
  10327. var $2,$3,$1;
  10328. $2=self._new();
  10329. _st($2)._theClass_(aClass);
  10330. _st($2)._level_(anInteger);
  10331. _st($2)._getNodesFrom_(aCollection);
  10332. $3=_st($2)._yourself();
  10333. $1=$3;
  10334. return $1;
  10335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10336. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},globals.ClassSorterNode.klass)});
  10337. //>>excludeEnd("ctx");
  10338. },
  10339. //>>excludeStart("ide", pragmas.excludeIdeData);
  10340. args: ["aClass", "aCollection", "anInteger"],
  10341. 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",
  10342. referencedClasses: [],
  10343. //>>excludeEnd("ide");
  10344. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  10345. }),
  10346. globals.ClassSorterNode.klass);
  10347. });
  10348. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  10349. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  10350. smalltalk.addPackage('Kernel-Methods');
  10351. smalltalk.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10352. smalltalk.addClass('BlockClosure', globals.Object, [], 'Kernel-Methods');
  10353. //>>excludeStart("ide", pragmas.excludeIdeData);
  10354. globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
  10355. //>>excludeEnd("ide");
  10356. smalltalk.addMethod(
  10357. smalltalk.method({
  10358. selector: "applyTo:arguments:",
  10359. protocol: 'evaluating',
  10360. fn: function (anObject,aCollection){
  10361. var self=this;
  10362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10363. return smalltalk.withContext(function($ctx1) {
  10364. //>>excludeEnd("ctx");
  10365. return self.apply(anObject, aCollection);
  10366. return self;
  10367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10368. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.BlockClosure)});
  10369. //>>excludeEnd("ctx");
  10370. },
  10371. //>>excludeStart("ide", pragmas.excludeIdeData);
  10372. args: ["anObject", "aCollection"],
  10373. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  10374. referencedClasses: [],
  10375. //>>excludeEnd("ide");
  10376. messageSends: []
  10377. }),
  10378. globals.BlockClosure);
  10379. smalltalk.addMethod(
  10380. smalltalk.method({
  10381. selector: "asCompiledMethod:",
  10382. protocol: 'converting',
  10383. fn: function (aString){
  10384. var self=this;
  10385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10386. return smalltalk.withContext(function($ctx1) {
  10387. //>>excludeEnd("ctx");
  10388. return smalltalk.method({selector:aString, fn:self});;
  10389. return self;
  10390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10391. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},globals.BlockClosure)});
  10392. //>>excludeEnd("ctx");
  10393. },
  10394. //>>excludeStart("ide", pragmas.excludeIdeData);
  10395. args: ["aString"],
  10396. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  10397. referencedClasses: [],
  10398. //>>excludeEnd("ide");
  10399. messageSends: []
  10400. }),
  10401. globals.BlockClosure);
  10402. smalltalk.addMethod(
  10403. smalltalk.method({
  10404. selector: "compiledSource",
  10405. protocol: 'accessing',
  10406. fn: function (){
  10407. var self=this;
  10408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10409. return smalltalk.withContext(function($ctx1) {
  10410. //>>excludeEnd("ctx");
  10411. return self.toString();
  10412. return self;
  10413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10414. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},globals.BlockClosure)});
  10415. //>>excludeEnd("ctx");
  10416. },
  10417. //>>excludeStart("ide", pragmas.excludeIdeData);
  10418. args: [],
  10419. source: "compiledSource\x0a\x09<return self.toString()>",
  10420. referencedClasses: [],
  10421. //>>excludeEnd("ide");
  10422. messageSends: []
  10423. }),
  10424. globals.BlockClosure);
  10425. smalltalk.addMethod(
  10426. smalltalk.method({
  10427. selector: "currySelf",
  10428. protocol: 'converting',
  10429. fn: function (){
  10430. var self=this;
  10431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10432. return smalltalk.withContext(function($ctx1) {
  10433. //>>excludeEnd("ctx");
  10434. return function () {
  10435. var args = [ this ];
  10436. args.push.apply(args, arguments);
  10437. return self.apply(null, args);
  10438. }
  10439. ;
  10440. return self;
  10441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10442. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.BlockClosure)});
  10443. //>>excludeEnd("ctx");
  10444. },
  10445. //>>excludeStart("ide", pragmas.excludeIdeData);
  10446. args: [],
  10447. 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>",
  10448. referencedClasses: [],
  10449. //>>excludeEnd("ide");
  10450. messageSends: []
  10451. }),
  10452. globals.BlockClosure);
  10453. smalltalk.addMethod(
  10454. smalltalk.method({
  10455. selector: "ensure:",
  10456. protocol: 'evaluating',
  10457. fn: function (aBlock){
  10458. var self=this;
  10459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10460. return smalltalk.withContext(function($ctx1) {
  10461. //>>excludeEnd("ctx");
  10462. try{return self._value()}finally{aBlock._value()};
  10463. return self;
  10464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10465. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},globals.BlockClosure)});
  10466. //>>excludeEnd("ctx");
  10467. },
  10468. //>>excludeStart("ide", pragmas.excludeIdeData);
  10469. args: ["aBlock"],
  10470. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  10471. referencedClasses: [],
  10472. //>>excludeEnd("ide");
  10473. messageSends: []
  10474. }),
  10475. globals.BlockClosure);
  10476. smalltalk.addMethod(
  10477. smalltalk.method({
  10478. selector: "fork",
  10479. protocol: 'timeout/interval',
  10480. fn: function (){
  10481. var self=this;
  10482. function $ForkPool(){return globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  10483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10484. return smalltalk.withContext(function($ctx1) {
  10485. //>>excludeEnd("ctx");
  10486. _st(_st($ForkPool())._default())._fork_(self);
  10487. return self;
  10488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10489. }, function($ctx1) {$ctx1.fill(self,"fork",{},globals.BlockClosure)});
  10490. //>>excludeEnd("ctx");
  10491. },
  10492. //>>excludeStart("ide", pragmas.excludeIdeData);
  10493. args: [],
  10494. source: "fork\x0a\x09ForkPool default fork: self",
  10495. referencedClasses: ["ForkPool"],
  10496. //>>excludeEnd("ide");
  10497. messageSends: ["fork:", "default"]
  10498. }),
  10499. globals.BlockClosure);
  10500. smalltalk.addMethod(
  10501. smalltalk.method({
  10502. selector: "new",
  10503. protocol: 'evaluating',
  10504. fn: function (){
  10505. var self=this;
  10506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10507. return smalltalk.withContext(function($ctx1) {
  10508. //>>excludeEnd("ctx");
  10509. return new self();
  10510. return self;
  10511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10512. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.BlockClosure)});
  10513. //>>excludeEnd("ctx");
  10514. },
  10515. //>>excludeStart("ide", pragmas.excludeIdeData);
  10516. args: [],
  10517. 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()>",
  10518. referencedClasses: [],
  10519. //>>excludeEnd("ide");
  10520. messageSends: []
  10521. }),
  10522. globals.BlockClosure);
  10523. smalltalk.addMethod(
  10524. smalltalk.method({
  10525. selector: "newValue:",
  10526. protocol: 'evaluating',
  10527. fn: function (anObject){
  10528. var self=this;
  10529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10530. return smalltalk.withContext(function($ctx1) {
  10531. //>>excludeEnd("ctx");
  10532. var $1;
  10533. $1=self._newWithValues_([anObject]);
  10534. return $1;
  10535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10536. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},globals.BlockClosure)});
  10537. //>>excludeEnd("ctx");
  10538. },
  10539. //>>excludeStart("ide", pragmas.excludeIdeData);
  10540. args: ["anObject"],
  10541. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  10542. referencedClasses: [],
  10543. //>>excludeEnd("ide");
  10544. messageSends: ["newWithValues:"]
  10545. }),
  10546. globals.BlockClosure);
  10547. smalltalk.addMethod(
  10548. smalltalk.method({
  10549. selector: "newValue:value:",
  10550. protocol: 'evaluating',
  10551. fn: function (anObject,anObject2){
  10552. var self=this;
  10553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10554. return smalltalk.withContext(function($ctx1) {
  10555. //>>excludeEnd("ctx");
  10556. var $1;
  10557. $1=self._newWithValues_([anObject,anObject2]);
  10558. return $1;
  10559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10560. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},globals.BlockClosure)});
  10561. //>>excludeEnd("ctx");
  10562. },
  10563. //>>excludeStart("ide", pragmas.excludeIdeData);
  10564. args: ["anObject", "anObject2"],
  10565. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  10566. referencedClasses: [],
  10567. //>>excludeEnd("ide");
  10568. messageSends: ["newWithValues:"]
  10569. }),
  10570. globals.BlockClosure);
  10571. smalltalk.addMethod(
  10572. smalltalk.method({
  10573. selector: "newValue:value:value:",
  10574. protocol: 'evaluating',
  10575. fn: function (anObject,anObject2,anObject3){
  10576. var self=this;
  10577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10578. return smalltalk.withContext(function($ctx1) {
  10579. //>>excludeEnd("ctx");
  10580. var $1;
  10581. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  10582. return $1;
  10583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10584. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.BlockClosure)});
  10585. //>>excludeEnd("ctx");
  10586. },
  10587. //>>excludeStart("ide", pragmas.excludeIdeData);
  10588. args: ["anObject", "anObject2", "anObject3"],
  10589. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  10590. referencedClasses: [],
  10591. //>>excludeEnd("ide");
  10592. messageSends: ["newWithValues:"]
  10593. }),
  10594. globals.BlockClosure);
  10595. smalltalk.addMethod(
  10596. smalltalk.method({
  10597. selector: "newWithValues:",
  10598. protocol: 'evaluating',
  10599. fn: function (aCollection){
  10600. var self=this;
  10601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10602. return smalltalk.withContext(function($ctx1) {
  10603. //>>excludeEnd("ctx");
  10604. var object = Object.create(self.prototype);
  10605. var result = self.apply(object, aCollection);
  10606. return typeof result === "object" ? result : object;
  10607. ;
  10608. return self;
  10609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10610. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},globals.BlockClosure)});
  10611. //>>excludeEnd("ctx");
  10612. },
  10613. //>>excludeStart("ide", pragmas.excludeIdeData);
  10614. args: ["aCollection"],
  10615. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09>",
  10616. referencedClasses: [],
  10617. //>>excludeEnd("ide");
  10618. messageSends: []
  10619. }),
  10620. globals.BlockClosure);
  10621. smalltalk.addMethod(
  10622. smalltalk.method({
  10623. selector: "numArgs",
  10624. protocol: 'accessing',
  10625. fn: function (){
  10626. var self=this;
  10627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10628. return smalltalk.withContext(function($ctx1) {
  10629. //>>excludeEnd("ctx");
  10630. return self.length;
  10631. return self;
  10632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10633. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.BlockClosure)});
  10634. //>>excludeEnd("ctx");
  10635. },
  10636. //>>excludeStart("ide", pragmas.excludeIdeData);
  10637. args: [],
  10638. source: "numArgs\x0a\x09<return self.length>",
  10639. referencedClasses: [],
  10640. //>>excludeEnd("ide");
  10641. messageSends: []
  10642. }),
  10643. globals.BlockClosure);
  10644. smalltalk.addMethod(
  10645. smalltalk.method({
  10646. selector: "on:do:",
  10647. protocol: 'error handling',
  10648. fn: function (anErrorClass,aBlock){
  10649. var self=this;
  10650. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  10651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10652. return smalltalk.withContext(function($ctx1) {
  10653. //>>excludeEnd("ctx");
  10654. var $2,$1;
  10655. $1=self._tryCatch_((function(error){
  10656. var smalltalkError;
  10657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10658. return smalltalk.withContext(function($ctx2) {
  10659. //>>excludeEnd("ctx");
  10660. smalltalkError=_st($Smalltalk())._asSmalltalkException_(error);
  10661. smalltalkError;
  10662. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  10663. if(smalltalk.assert($2)){
  10664. return _st(aBlock)._value_(smalltalkError);
  10665. } else {
  10666. return _st(smalltalkError)._resignal();
  10667. };
  10668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10669. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  10670. //>>excludeEnd("ctx");
  10671. }));
  10672. return $1;
  10673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10674. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},globals.BlockClosure)});
  10675. //>>excludeEnd("ctx");
  10676. },
  10677. //>>excludeStart("ide", pragmas.excludeIdeData);
  10678. args: ["anErrorClass", "aBlock"],
  10679. 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 tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  10680. referencedClasses: ["Smalltalk"],
  10681. //>>excludeEnd("ide");
  10682. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  10683. }),
  10684. globals.BlockClosure);
  10685. smalltalk.addMethod(
  10686. smalltalk.method({
  10687. selector: "receiver",
  10688. protocol: 'accessing',
  10689. fn: function (){
  10690. var self=this;
  10691. return nil;
  10692. },
  10693. //>>excludeStart("ide", pragmas.excludeIdeData);
  10694. args: [],
  10695. source: "receiver\x0a\x09^ nil",
  10696. referencedClasses: [],
  10697. //>>excludeEnd("ide");
  10698. messageSends: []
  10699. }),
  10700. globals.BlockClosure);
  10701. smalltalk.addMethod(
  10702. smalltalk.method({
  10703. selector: "timeToRun",
  10704. protocol: 'evaluating',
  10705. fn: function (){
  10706. var self=this;
  10707. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  10708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10709. return smalltalk.withContext(function($ctx1) {
  10710. //>>excludeEnd("ctx");
  10711. var $1;
  10712. $1=_st($Date())._millisecondsToRun_(self);
  10713. return $1;
  10714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10715. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},globals.BlockClosure)});
  10716. //>>excludeEnd("ctx");
  10717. },
  10718. //>>excludeStart("ide", pragmas.excludeIdeData);
  10719. args: [],
  10720. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  10721. referencedClasses: ["Date"],
  10722. //>>excludeEnd("ide");
  10723. messageSends: ["millisecondsToRun:"]
  10724. }),
  10725. globals.BlockClosure);
  10726. smalltalk.addMethod(
  10727. smalltalk.method({
  10728. selector: "tryCatch:",
  10729. protocol: 'error handling',
  10730. fn: function (aBlock){
  10731. var self=this;
  10732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10733. return smalltalk.withContext(function($ctx1) {
  10734. //>>excludeEnd("ctx");
  10735. try {
  10736. return self._value();
  10737. } catch(error) {
  10738. return aBlock._value_(error);
  10739. }
  10740. ;
  10741. return self;
  10742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10743. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},globals.BlockClosure)});
  10744. //>>excludeEnd("ctx");
  10745. },
  10746. //>>excludeStart("ide", pragmas.excludeIdeData);
  10747. args: ["aBlock"],
  10748. source: "tryCatch: aBlock\x0a\x09<\x0a\x09\x09try {\x0a\x09\x09\x09return self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09>",
  10749. referencedClasses: [],
  10750. //>>excludeEnd("ide");
  10751. messageSends: []
  10752. }),
  10753. globals.BlockClosure);
  10754. smalltalk.addMethod(
  10755. smalltalk.method({
  10756. selector: "value",
  10757. protocol: 'evaluating',
  10758. fn: function (){
  10759. var self=this;
  10760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10761. return smalltalk.withContext(function($ctx1) {
  10762. //>>excludeEnd("ctx");
  10763. return self();;
  10764. return self;
  10765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10766. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.BlockClosure)});
  10767. //>>excludeEnd("ctx");
  10768. },
  10769. //>>excludeStart("ide", pragmas.excludeIdeData);
  10770. args: [],
  10771. source: "value\x0a\x09<return self();>",
  10772. referencedClasses: [],
  10773. //>>excludeEnd("ide");
  10774. messageSends: []
  10775. }),
  10776. globals.BlockClosure);
  10777. smalltalk.addMethod(
  10778. smalltalk.method({
  10779. selector: "value:",
  10780. protocol: 'evaluating',
  10781. fn: function (anArg){
  10782. var self=this;
  10783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10784. return smalltalk.withContext(function($ctx1) {
  10785. //>>excludeEnd("ctx");
  10786. return self(anArg);;
  10787. return self;
  10788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10789. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},globals.BlockClosure)});
  10790. //>>excludeEnd("ctx");
  10791. },
  10792. //>>excludeStart("ide", pragmas.excludeIdeData);
  10793. args: ["anArg"],
  10794. source: "value: anArg\x0a\x09<return self(anArg);>",
  10795. referencedClasses: [],
  10796. //>>excludeEnd("ide");
  10797. messageSends: []
  10798. }),
  10799. globals.BlockClosure);
  10800. smalltalk.addMethod(
  10801. smalltalk.method({
  10802. selector: "value:value:",
  10803. protocol: 'evaluating',
  10804. fn: function (firstArg,secondArg){
  10805. var self=this;
  10806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10807. return smalltalk.withContext(function($ctx1) {
  10808. //>>excludeEnd("ctx");
  10809. return self(firstArg, secondArg);;
  10810. return self;
  10811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10812. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},globals.BlockClosure)});
  10813. //>>excludeEnd("ctx");
  10814. },
  10815. //>>excludeStart("ide", pragmas.excludeIdeData);
  10816. args: ["firstArg", "secondArg"],
  10817. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  10818. referencedClasses: [],
  10819. //>>excludeEnd("ide");
  10820. messageSends: []
  10821. }),
  10822. globals.BlockClosure);
  10823. smalltalk.addMethod(
  10824. smalltalk.method({
  10825. selector: "value:value:value:",
  10826. protocol: 'evaluating',
  10827. fn: function (firstArg,secondArg,thirdArg){
  10828. var self=this;
  10829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10830. return smalltalk.withContext(function($ctx1) {
  10831. //>>excludeEnd("ctx");
  10832. return self(firstArg, secondArg, thirdArg);;
  10833. return self;
  10834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10835. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},globals.BlockClosure)});
  10836. //>>excludeEnd("ctx");
  10837. },
  10838. //>>excludeStart("ide", pragmas.excludeIdeData);
  10839. args: ["firstArg", "secondArg", "thirdArg"],
  10840. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  10841. referencedClasses: [],
  10842. //>>excludeEnd("ide");
  10843. messageSends: []
  10844. }),
  10845. globals.BlockClosure);
  10846. smalltalk.addMethod(
  10847. smalltalk.method({
  10848. selector: "valueWithInterval:",
  10849. protocol: 'timeout/interval',
  10850. fn: function (aNumber){
  10851. var self=this;
  10852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10853. return smalltalk.withContext(function($ctx1) {
  10854. //>>excludeEnd("ctx");
  10855. var interval = setInterval(self, aNumber);
  10856. return globals.Timeout._on_(interval);
  10857. ;
  10858. return self;
  10859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10860. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},globals.BlockClosure)});
  10861. //>>excludeEnd("ctx");
  10862. },
  10863. //>>excludeStart("ide", pragmas.excludeIdeData);
  10864. args: ["aNumber"],
  10865. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(interval);\x0a\x09>",
  10866. referencedClasses: [],
  10867. //>>excludeEnd("ide");
  10868. messageSends: []
  10869. }),
  10870. globals.BlockClosure);
  10871. smalltalk.addMethod(
  10872. smalltalk.method({
  10873. selector: "valueWithPossibleArguments:",
  10874. protocol: 'evaluating',
  10875. fn: function (aCollection){
  10876. var self=this;
  10877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10878. return smalltalk.withContext(function($ctx1) {
  10879. //>>excludeEnd("ctx");
  10880. return self.apply(null, aCollection);;
  10881. return self;
  10882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10883. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.BlockClosure)});
  10884. //>>excludeEnd("ctx");
  10885. },
  10886. //>>excludeStart("ide", pragmas.excludeIdeData);
  10887. args: ["aCollection"],
  10888. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  10889. referencedClasses: [],
  10890. //>>excludeEnd("ide");
  10891. messageSends: []
  10892. }),
  10893. globals.BlockClosure);
  10894. smalltalk.addMethod(
  10895. smalltalk.method({
  10896. selector: "valueWithTimeout:",
  10897. protocol: 'timeout/interval',
  10898. fn: function (aNumber){
  10899. var self=this;
  10900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10901. return smalltalk.withContext(function($ctx1) {
  10902. //>>excludeEnd("ctx");
  10903. var timeout = setTimeout(self, aNumber);
  10904. return globals.Timeout._on_(timeout);
  10905. ;
  10906. return self;
  10907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10908. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},globals.BlockClosure)});
  10909. //>>excludeEnd("ctx");
  10910. },
  10911. //>>excludeStart("ide", pragmas.excludeIdeData);
  10912. args: ["aNumber"],
  10913. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(timeout);\x0a\x09>",
  10914. referencedClasses: [],
  10915. //>>excludeEnd("ide");
  10916. messageSends: []
  10917. }),
  10918. globals.BlockClosure);
  10919. smalltalk.addMethod(
  10920. smalltalk.method({
  10921. selector: "whileFalse",
  10922. protocol: 'controlling',
  10923. fn: function (){
  10924. var self=this;
  10925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10926. return smalltalk.withContext(function($ctx1) {
  10927. //>>excludeEnd("ctx");
  10928. self._whileFalse_((function(){
  10929. }));
  10930. return self;
  10931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10932. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},globals.BlockClosure)});
  10933. //>>excludeEnd("ctx");
  10934. },
  10935. //>>excludeStart("ide", pragmas.excludeIdeData);
  10936. args: [],
  10937. source: "whileFalse\x0a\x09self whileFalse: []",
  10938. referencedClasses: [],
  10939. //>>excludeEnd("ide");
  10940. messageSends: ["whileFalse:"]
  10941. }),
  10942. globals.BlockClosure);
  10943. smalltalk.addMethod(
  10944. smalltalk.method({
  10945. selector: "whileFalse:",
  10946. protocol: 'controlling',
  10947. fn: function (aBlock){
  10948. var self=this;
  10949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10950. return smalltalk.withContext(function($ctx1) {
  10951. //>>excludeEnd("ctx");
  10952. while(!smalltalk.assert(self._value())) {aBlock._value()};
  10953. return self;
  10954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10955. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},globals.BlockClosure)});
  10956. //>>excludeEnd("ctx");
  10957. },
  10958. //>>excludeStart("ide", pragmas.excludeIdeData);
  10959. args: ["aBlock"],
  10960. source: "whileFalse: aBlock\x0a\x09<while(!smalltalk.assert(self._value())) {aBlock._value()}>",
  10961. referencedClasses: [],
  10962. //>>excludeEnd("ide");
  10963. messageSends: []
  10964. }),
  10965. globals.BlockClosure);
  10966. smalltalk.addMethod(
  10967. smalltalk.method({
  10968. selector: "whileTrue",
  10969. protocol: 'controlling',
  10970. fn: function (){
  10971. var self=this;
  10972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10973. return smalltalk.withContext(function($ctx1) {
  10974. //>>excludeEnd("ctx");
  10975. self._whileTrue_((function(){
  10976. }));
  10977. return self;
  10978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10979. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},globals.BlockClosure)});
  10980. //>>excludeEnd("ctx");
  10981. },
  10982. //>>excludeStart("ide", pragmas.excludeIdeData);
  10983. args: [],
  10984. source: "whileTrue\x0a\x09self whileTrue: []",
  10985. referencedClasses: [],
  10986. //>>excludeEnd("ide");
  10987. messageSends: ["whileTrue:"]
  10988. }),
  10989. globals.BlockClosure);
  10990. smalltalk.addMethod(
  10991. smalltalk.method({
  10992. selector: "whileTrue:",
  10993. protocol: 'controlling',
  10994. fn: function (aBlock){
  10995. var self=this;
  10996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10997. return smalltalk.withContext(function($ctx1) {
  10998. //>>excludeEnd("ctx");
  10999. while(smalltalk.assert(self._value())) {aBlock._value()};
  11000. return self;
  11001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11002. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},globals.BlockClosure)});
  11003. //>>excludeEnd("ctx");
  11004. },
  11005. //>>excludeStart("ide", pragmas.excludeIdeData);
  11006. args: ["aBlock"],
  11007. source: "whileTrue: aBlock\x0a\x09<while(smalltalk.assert(self._value())) {aBlock._value()}>",
  11008. referencedClasses: [],
  11009. //>>excludeEnd("ide");
  11010. messageSends: []
  11011. }),
  11012. globals.BlockClosure);
  11013. smalltalk.addClass('CompiledMethod', globals.Object, [], 'Kernel-Methods');
  11014. //>>excludeStart("ide", pragmas.excludeIdeData);
  11015. globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
  11016. //>>excludeEnd("ide");
  11017. smalltalk.addMethod(
  11018. smalltalk.method({
  11019. selector: "arguments",
  11020. protocol: 'accessing',
  11021. fn: function (){
  11022. var self=this;
  11023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11024. return smalltalk.withContext(function($ctx1) {
  11025. //>>excludeEnd("ctx");
  11026. return self.args || [];
  11027. return self;
  11028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11029. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.CompiledMethod)});
  11030. //>>excludeEnd("ctx");
  11031. },
  11032. //>>excludeStart("ide", pragmas.excludeIdeData);
  11033. args: [],
  11034. source: "arguments\x0a\x09<return self.args || []>",
  11035. referencedClasses: [],
  11036. //>>excludeEnd("ide");
  11037. messageSends: []
  11038. }),
  11039. globals.CompiledMethod);
  11040. smalltalk.addMethod(
  11041. smalltalk.method({
  11042. selector: "browse",
  11043. protocol: 'browsing',
  11044. fn: function (){
  11045. var self=this;
  11046. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  11047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11048. return smalltalk.withContext(function($ctx1) {
  11049. //>>excludeEnd("ctx");
  11050. _st($Finder())._findMethod_(self);
  11051. return self;
  11052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11053. }, function($ctx1) {$ctx1.fill(self,"browse",{},globals.CompiledMethod)});
  11054. //>>excludeEnd("ctx");
  11055. },
  11056. //>>excludeStart("ide", pragmas.excludeIdeData);
  11057. args: [],
  11058. source: "browse\x0a\x09Finder findMethod: self",
  11059. referencedClasses: ["Finder"],
  11060. //>>excludeEnd("ide");
  11061. messageSends: ["findMethod:"]
  11062. }),
  11063. globals.CompiledMethod);
  11064. smalltalk.addMethod(
  11065. smalltalk.method({
  11066. selector: "category",
  11067. protocol: 'accessing',
  11068. fn: function (){
  11069. var self=this;
  11070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11071. return smalltalk.withContext(function($ctx1) {
  11072. //>>excludeEnd("ctx");
  11073. var $1;
  11074. $1=self._protocol();
  11075. return $1;
  11076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11077. }, function($ctx1) {$ctx1.fill(self,"category",{},globals.CompiledMethod)});
  11078. //>>excludeEnd("ctx");
  11079. },
  11080. //>>excludeStart("ide", pragmas.excludeIdeData);
  11081. args: [],
  11082. source: "category\x0a\x09^ self protocol",
  11083. referencedClasses: [],
  11084. //>>excludeEnd("ide");
  11085. messageSends: ["protocol"]
  11086. }),
  11087. globals.CompiledMethod);
  11088. smalltalk.addMethod(
  11089. smalltalk.method({
  11090. selector: "defaultProtocol",
  11091. protocol: 'defaults',
  11092. fn: function (){
  11093. var self=this;
  11094. return "as yet unclassified";
  11095. },
  11096. //>>excludeStart("ide", pragmas.excludeIdeData);
  11097. args: [],
  11098. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  11099. referencedClasses: [],
  11100. //>>excludeEnd("ide");
  11101. messageSends: []
  11102. }),
  11103. globals.CompiledMethod);
  11104. smalltalk.addMethod(
  11105. smalltalk.method({
  11106. selector: "fn",
  11107. protocol: 'accessing',
  11108. fn: function (){
  11109. var self=this;
  11110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11111. return smalltalk.withContext(function($ctx1) {
  11112. //>>excludeEnd("ctx");
  11113. var $1;
  11114. $1=self._basicAt_("fn");
  11115. return $1;
  11116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11117. }, function($ctx1) {$ctx1.fill(self,"fn",{},globals.CompiledMethod)});
  11118. //>>excludeEnd("ctx");
  11119. },
  11120. //>>excludeStart("ide", pragmas.excludeIdeData);
  11121. args: [],
  11122. source: "fn\x0a\x09^ self basicAt: 'fn'",
  11123. referencedClasses: [],
  11124. //>>excludeEnd("ide");
  11125. messageSends: ["basicAt:"]
  11126. }),
  11127. globals.CompiledMethod);
  11128. smalltalk.addMethod(
  11129. smalltalk.method({
  11130. selector: "fn:",
  11131. protocol: 'accessing',
  11132. fn: function (aBlock){
  11133. var self=this;
  11134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11135. return smalltalk.withContext(function($ctx1) {
  11136. //>>excludeEnd("ctx");
  11137. self._basicAt_put_("fn",aBlock);
  11138. return self;
  11139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11140. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},globals.CompiledMethod)});
  11141. //>>excludeEnd("ctx");
  11142. },
  11143. //>>excludeStart("ide", pragmas.excludeIdeData);
  11144. args: ["aBlock"],
  11145. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  11146. referencedClasses: [],
  11147. //>>excludeEnd("ide");
  11148. messageSends: ["basicAt:put:"]
  11149. }),
  11150. globals.CompiledMethod);
  11151. smalltalk.addMethod(
  11152. smalltalk.method({
  11153. selector: "isCompiledMethod",
  11154. protocol: 'testing',
  11155. fn: function (){
  11156. var self=this;
  11157. return true;
  11158. },
  11159. //>>excludeStart("ide", pragmas.excludeIdeData);
  11160. args: [],
  11161. source: "isCompiledMethod\x0a\x09^ true",
  11162. referencedClasses: [],
  11163. //>>excludeEnd("ide");
  11164. messageSends: []
  11165. }),
  11166. globals.CompiledMethod);
  11167. smalltalk.addMethod(
  11168. smalltalk.method({
  11169. selector: "isOverridden",
  11170. protocol: 'testing',
  11171. fn: function (){
  11172. var self=this;
  11173. var selector;
  11174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11175. return smalltalk.withContext(function($ctx1) {
  11176. //>>excludeEnd("ctx");
  11177. var $1;
  11178. var $early={};
  11179. try {
  11180. selector=self._selector();
  11181. _st(self._methodClass())._allSubclassesDo_((function(each){
  11182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11183. return smalltalk.withContext(function($ctx2) {
  11184. //>>excludeEnd("ctx");
  11185. $1=_st(each)._includesSelector_(selector);
  11186. if(smalltalk.assert($1)){
  11187. throw $early=[true];
  11188. };
  11189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11190. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11191. //>>excludeEnd("ctx");
  11192. }));
  11193. return false;
  11194. }
  11195. catch(e) {if(e===$early)return e[0]; throw e}
  11196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11197. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},globals.CompiledMethod)});
  11198. //>>excludeEnd("ctx");
  11199. },
  11200. //>>excludeStart("ide", pragmas.excludeIdeData);
  11201. args: [],
  11202. 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",
  11203. referencedClasses: [],
  11204. //>>excludeEnd("ide");
  11205. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  11206. }),
  11207. globals.CompiledMethod);
  11208. smalltalk.addMethod(
  11209. smalltalk.method({
  11210. selector: "isOverride",
  11211. protocol: 'testing',
  11212. fn: function (){
  11213. var self=this;
  11214. var superclass;
  11215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11216. return smalltalk.withContext(function($ctx1) {
  11217. //>>excludeEnd("ctx");
  11218. var $1,$2,$3,$receiver;
  11219. $1=self._methodClass();
  11220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11221. $ctx1.sendIdx["methodClass"]=1;
  11222. //>>excludeEnd("ctx");
  11223. superclass=_st($1)._superclass();
  11224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11225. $ctx1.sendIdx["superclass"]=1;
  11226. //>>excludeEnd("ctx");
  11227. $2=superclass;
  11228. if(($receiver = $2) == null || $receiver.isNil){
  11229. return false;
  11230. } else {
  11231. $2;
  11232. };
  11233. $3=_st(_st(_st(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  11234. return $3;
  11235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11236. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},globals.CompiledMethod)});
  11237. //>>excludeEnd("ctx");
  11238. },
  11239. //>>excludeStart("ide", pragmas.excludeIdeData);
  11240. args: [],
  11241. 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",
  11242. referencedClasses: [],
  11243. //>>excludeEnd("ide");
  11244. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  11245. }),
  11246. globals.CompiledMethod);
  11247. smalltalk.addMethod(
  11248. smalltalk.method({
  11249. selector: "messageSends",
  11250. protocol: 'accessing',
  11251. fn: function (){
  11252. var self=this;
  11253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11254. return smalltalk.withContext(function($ctx1) {
  11255. //>>excludeEnd("ctx");
  11256. var $1;
  11257. $1=self._basicAt_("messageSends");
  11258. return $1;
  11259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11260. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.CompiledMethod)});
  11261. //>>excludeEnd("ctx");
  11262. },
  11263. //>>excludeStart("ide", pragmas.excludeIdeData);
  11264. args: [],
  11265. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  11266. referencedClasses: [],
  11267. //>>excludeEnd("ide");
  11268. messageSends: ["basicAt:"]
  11269. }),
  11270. globals.CompiledMethod);
  11271. smalltalk.addMethod(
  11272. smalltalk.method({
  11273. selector: "methodClass",
  11274. protocol: 'accessing',
  11275. fn: function (){
  11276. var self=this;
  11277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11278. return smalltalk.withContext(function($ctx1) {
  11279. //>>excludeEnd("ctx");
  11280. var $1;
  11281. $1=self._basicAt_("methodClass");
  11282. return $1;
  11283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11284. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},globals.CompiledMethod)});
  11285. //>>excludeEnd("ctx");
  11286. },
  11287. //>>excludeStart("ide", pragmas.excludeIdeData);
  11288. args: [],
  11289. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  11290. referencedClasses: [],
  11291. //>>excludeEnd("ide");
  11292. messageSends: ["basicAt:"]
  11293. }),
  11294. globals.CompiledMethod);
  11295. smalltalk.addMethod(
  11296. smalltalk.method({
  11297. selector: "package",
  11298. protocol: 'accessing',
  11299. fn: function (){
  11300. var self=this;
  11301. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  11302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11303. return smalltalk.withContext(function($ctx1) {
  11304. //>>excludeEnd("ctx");
  11305. var $1,$3,$2,$4,$5,$receiver;
  11306. $1=self._methodClass();
  11307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11308. $ctx1.sendIdx["methodClass"]=1;
  11309. //>>excludeEnd("ctx");
  11310. if(($receiver = $1) == null || $receiver.isNil){
  11311. return nil;
  11312. } else {
  11313. $1;
  11314. };
  11315. $3=self._protocol();
  11316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11317. $ctx1.sendIdx["protocol"]=1;
  11318. //>>excludeEnd("ctx");
  11319. $2=_st($3)._beginsWith_("*");
  11320. if(! smalltalk.assert($2)){
  11321. $4=_st(self._methodClass())._package();
  11322. return $4;
  11323. };
  11324. $5=_st($Package())._named_ifAbsent_(_st(self._protocol())._allButFirst(),(function(){
  11325. return nil;
  11326. }));
  11327. return $5;
  11328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11329. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.CompiledMethod)});
  11330. //>>excludeEnd("ctx");
  11331. },
  11332. //>>excludeStart("ide", pragmas.excludeIdeData);
  11333. args: [],
  11334. source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09self methodClass ifNil: [ ^ nil ].\x0a\x09\x0a\x09(self protocol beginsWith: '*') ifFalse: [\x0a\x09\x09^ self methodClass package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: self protocol allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  11335. referencedClasses: ["Package"],
  11336. //>>excludeEnd("ide");
  11337. messageSends: ["ifNil:", "methodClass", "ifFalse:", "beginsWith:", "protocol", "package", "named:ifAbsent:", "allButFirst"]
  11338. }),
  11339. globals.CompiledMethod);
  11340. smalltalk.addMethod(
  11341. smalltalk.method({
  11342. selector: "protocol",
  11343. protocol: 'accessing',
  11344. fn: function (){
  11345. var self=this;
  11346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11347. return smalltalk.withContext(function($ctx1) {
  11348. //>>excludeEnd("ctx");
  11349. var $2,$1,$receiver;
  11350. $2=self._basicAt_("protocol");
  11351. if(($receiver = $2) == null || $receiver.isNil){
  11352. $1=self._defaultProtocol();
  11353. } else {
  11354. $1=$2;
  11355. };
  11356. return $1;
  11357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11358. }, function($ctx1) {$ctx1.fill(self,"protocol",{},globals.CompiledMethod)});
  11359. //>>excludeEnd("ctx");
  11360. },
  11361. //>>excludeStart("ide", pragmas.excludeIdeData);
  11362. args: [],
  11363. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  11364. referencedClasses: [],
  11365. //>>excludeEnd("ide");
  11366. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  11367. }),
  11368. globals.CompiledMethod);
  11369. smalltalk.addMethod(
  11370. smalltalk.method({
  11371. selector: "protocol:",
  11372. protocol: 'accessing',
  11373. fn: function (aString){
  11374. var self=this;
  11375. var oldProtocol;
  11376. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  11377. function $MethodMoved(){return globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  11378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11379. return smalltalk.withContext(function($ctx1) {
  11380. //>>excludeEnd("ctx");
  11381. var $1,$2,$3,$receiver;
  11382. oldProtocol=self._protocol();
  11383. self._basicAt_put_("protocol",aString);
  11384. $1=_st($MethodMoved())._new();
  11385. _st($1)._method_(self);
  11386. _st($1)._oldProtocol_(oldProtocol);
  11387. $2=_st($1)._yourself();
  11388. _st(_st($SystemAnnouncer())._current())._announce_($2);
  11389. $3=self._methodClass();
  11390. if(($receiver = $3) == null || $receiver.isNil){
  11391. $3;
  11392. } else {
  11393. var methodClass;
  11394. methodClass=$receiver;
  11395. _st(_st(methodClass)._organization())._addElement_(aString);
  11396. _st(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  11397. };
  11398. return self;
  11399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11400. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},globals.CompiledMethod)});
  11401. //>>excludeEnd("ctx");
  11402. },
  11403. //>>excludeStart("ide", pragmas.excludeIdeData);
  11404. args: ["aString"],
  11405. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' 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: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  11406. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  11407. //>>excludeEnd("ide");
  11408. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  11409. }),
  11410. globals.CompiledMethod);
  11411. smalltalk.addMethod(
  11412. smalltalk.method({
  11413. selector: "referencedClasses",
  11414. protocol: 'accessing',
  11415. fn: function (){
  11416. var self=this;
  11417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11418. return smalltalk.withContext(function($ctx1) {
  11419. //>>excludeEnd("ctx");
  11420. var $1;
  11421. $1=self._basicAt_("referencedClasses");
  11422. return $1;
  11423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11424. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},globals.CompiledMethod)});
  11425. //>>excludeEnd("ctx");
  11426. },
  11427. //>>excludeStart("ide", pragmas.excludeIdeData);
  11428. args: [],
  11429. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  11430. referencedClasses: [],
  11431. //>>excludeEnd("ide");
  11432. messageSends: ["basicAt:"]
  11433. }),
  11434. globals.CompiledMethod);
  11435. smalltalk.addMethod(
  11436. smalltalk.method({
  11437. selector: "selector",
  11438. protocol: 'accessing',
  11439. fn: function (){
  11440. var self=this;
  11441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11442. return smalltalk.withContext(function($ctx1) {
  11443. //>>excludeEnd("ctx");
  11444. var $1;
  11445. $1=self._basicAt_("selector");
  11446. return $1;
  11447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11448. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.CompiledMethod)});
  11449. //>>excludeEnd("ctx");
  11450. },
  11451. //>>excludeStart("ide", pragmas.excludeIdeData);
  11452. args: [],
  11453. source: "selector\x0a\x09^ self basicAt: 'selector'",
  11454. referencedClasses: [],
  11455. //>>excludeEnd("ide");
  11456. messageSends: ["basicAt:"]
  11457. }),
  11458. globals.CompiledMethod);
  11459. smalltalk.addMethod(
  11460. smalltalk.method({
  11461. selector: "selector:",
  11462. protocol: 'accessing',
  11463. fn: function (aString){
  11464. var self=this;
  11465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11466. return smalltalk.withContext(function($ctx1) {
  11467. //>>excludeEnd("ctx");
  11468. self._basicAt_put_("selector",aString);
  11469. return self;
  11470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11471. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.CompiledMethod)});
  11472. //>>excludeEnd("ctx");
  11473. },
  11474. //>>excludeStart("ide", pragmas.excludeIdeData);
  11475. args: ["aString"],
  11476. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  11477. referencedClasses: [],
  11478. //>>excludeEnd("ide");
  11479. messageSends: ["basicAt:put:"]
  11480. }),
  11481. globals.CompiledMethod);
  11482. smalltalk.addMethod(
  11483. smalltalk.method({
  11484. selector: "sendTo:arguments:",
  11485. protocol: 'evaluating',
  11486. fn: function (anObject,aCollection){
  11487. var self=this;
  11488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11489. return smalltalk.withContext(function($ctx1) {
  11490. //>>excludeEnd("ctx");
  11491. var $1;
  11492. $1=_st(self._fn())._applyTo_arguments_(anObject,aCollection);
  11493. return $1;
  11494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11495. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.CompiledMethod)});
  11496. //>>excludeEnd("ctx");
  11497. },
  11498. //>>excludeStart("ide", pragmas.excludeIdeData);
  11499. args: ["anObject", "aCollection"],
  11500. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  11501. referencedClasses: [],
  11502. //>>excludeEnd("ide");
  11503. messageSends: ["applyTo:arguments:", "fn"]
  11504. }),
  11505. globals.CompiledMethod);
  11506. smalltalk.addMethod(
  11507. smalltalk.method({
  11508. selector: "source",
  11509. protocol: 'accessing',
  11510. fn: function (){
  11511. var self=this;
  11512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11513. return smalltalk.withContext(function($ctx1) {
  11514. //>>excludeEnd("ctx");
  11515. var $2,$1,$receiver;
  11516. $2=self._basicAt_("source");
  11517. if(($receiver = $2) == null || $receiver.isNil){
  11518. $1="";
  11519. } else {
  11520. $1=$2;
  11521. };
  11522. return $1;
  11523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11524. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.CompiledMethod)});
  11525. //>>excludeEnd("ctx");
  11526. },
  11527. //>>excludeStart("ide", pragmas.excludeIdeData);
  11528. args: [],
  11529. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  11530. referencedClasses: [],
  11531. //>>excludeEnd("ide");
  11532. messageSends: ["ifNil:", "basicAt:"]
  11533. }),
  11534. globals.CompiledMethod);
  11535. smalltalk.addMethod(
  11536. smalltalk.method({
  11537. selector: "source:",
  11538. protocol: 'accessing',
  11539. fn: function (aString){
  11540. var self=this;
  11541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11542. return smalltalk.withContext(function($ctx1) {
  11543. //>>excludeEnd("ctx");
  11544. self._basicAt_put_("source",aString);
  11545. return self;
  11546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11547. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},globals.CompiledMethod)});
  11548. //>>excludeEnd("ctx");
  11549. },
  11550. //>>excludeStart("ide", pragmas.excludeIdeData);
  11551. args: ["aString"],
  11552. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  11553. referencedClasses: [],
  11554. //>>excludeEnd("ide");
  11555. messageSends: ["basicAt:put:"]
  11556. }),
  11557. globals.CompiledMethod);
  11558. smalltalk.addClass('ForkPool', globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  11559. //>>excludeStart("ide", pragmas.excludeIdeData);
  11560. globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
  11561. //>>excludeEnd("ide");
  11562. smalltalk.addMethod(
  11563. smalltalk.method({
  11564. selector: "addWorker",
  11565. protocol: 'private',
  11566. fn: function (){
  11567. var self=this;
  11568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11569. return smalltalk.withContext(function($ctx1) {
  11570. //>>excludeEnd("ctx");
  11571. _st(self["@worker"])._valueWithTimeout_((0));
  11572. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  11573. return self;
  11574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11575. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},globals.ForkPool)});
  11576. //>>excludeEnd("ctx");
  11577. },
  11578. //>>excludeStart("ide", pragmas.excludeIdeData);
  11579. args: [],
  11580. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  11581. referencedClasses: [],
  11582. //>>excludeEnd("ide");
  11583. messageSends: ["valueWithTimeout:", "+"]
  11584. }),
  11585. globals.ForkPool);
  11586. smalltalk.addMethod(
  11587. smalltalk.method({
  11588. selector: "defaultMaxPoolSize",
  11589. protocol: 'defaults',
  11590. fn: function (){
  11591. var self=this;
  11592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11593. return smalltalk.withContext(function($ctx1) {
  11594. //>>excludeEnd("ctx");
  11595. var $1;
  11596. $1=_st(self._class())._defaultMaxPoolSize();
  11597. return $1;
  11598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11599. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},globals.ForkPool)});
  11600. //>>excludeEnd("ctx");
  11601. },
  11602. //>>excludeStart("ide", pragmas.excludeIdeData);
  11603. args: [],
  11604. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  11605. referencedClasses: [],
  11606. //>>excludeEnd("ide");
  11607. messageSends: ["defaultMaxPoolSize", "class"]
  11608. }),
  11609. globals.ForkPool);
  11610. smalltalk.addMethod(
  11611. smalltalk.method({
  11612. selector: "fork:",
  11613. protocol: 'actions',
  11614. fn: function (aBlock){
  11615. var self=this;
  11616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11617. return smalltalk.withContext(function($ctx1) {
  11618. //>>excludeEnd("ctx");
  11619. var $1;
  11620. $1=_st(self["@poolSize"]).__lt(self._maxPoolSize());
  11621. if(smalltalk.assert($1)){
  11622. self._addWorker();
  11623. };
  11624. _st(self["@queue"])._nextPut_(aBlock);
  11625. return self;
  11626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11627. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},globals.ForkPool)});
  11628. //>>excludeEnd("ctx");
  11629. },
  11630. //>>excludeStart("ide", pragmas.excludeIdeData);
  11631. args: ["aBlock"],
  11632. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  11633. referencedClasses: [],
  11634. //>>excludeEnd("ide");
  11635. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  11636. }),
  11637. globals.ForkPool);
  11638. smalltalk.addMethod(
  11639. smalltalk.method({
  11640. selector: "initialize",
  11641. protocol: 'initialization',
  11642. fn: function (){
  11643. var self=this;
  11644. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  11645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11646. return smalltalk.withContext(function($ctx1) {
  11647. //>>excludeEnd("ctx");
  11648. (
  11649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11650. $ctx1.supercall = true,
  11651. //>>excludeEnd("ctx");
  11652. globals.ForkPool.superclass.fn.prototype._initialize.apply(_st(self), []));
  11653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11654. $ctx1.supercall = false;
  11655. //>>excludeEnd("ctx");;
  11656. self["@poolSize"]=(0);
  11657. self["@queue"]=_st($Queue())._new();
  11658. self["@worker"]=self._makeWorker();
  11659. return self;
  11660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11661. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ForkPool)});
  11662. //>>excludeEnd("ctx");
  11663. },
  11664. //>>excludeStart("ide", pragmas.excludeIdeData);
  11665. args: [],
  11666. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  11667. referencedClasses: ["Queue"],
  11668. //>>excludeEnd("ide");
  11669. messageSends: ["initialize", "new", "makeWorker"]
  11670. }),
  11671. globals.ForkPool);
  11672. smalltalk.addMethod(
  11673. smalltalk.method({
  11674. selector: "makeWorker",
  11675. protocol: 'initialization',
  11676. fn: function (){
  11677. var self=this;
  11678. var sentinel;
  11679. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  11680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11681. return smalltalk.withContext(function($ctx1) {
  11682. //>>excludeEnd("ctx");
  11683. var $2,$1;
  11684. sentinel=_st($Object())._new();
  11685. $1=(function(){
  11686. var block;
  11687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11688. return smalltalk.withContext(function($ctx2) {
  11689. //>>excludeEnd("ctx");
  11690. self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  11691. self["@poolSize"];
  11692. block=_st(self["@queue"])._nextIfAbsent_((function(){
  11693. return sentinel;
  11694. }));
  11695. block;
  11696. $2=_st(block).__eq_eq(sentinel);
  11697. if(! smalltalk.assert($2)){
  11698. return _st((function(){
  11699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11700. return smalltalk.withContext(function($ctx3) {
  11701. //>>excludeEnd("ctx");
  11702. return _st(block)._value();
  11703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11704. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  11705. //>>excludeEnd("ctx");
  11706. }))._ensure_((function(){
  11707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11708. return smalltalk.withContext(function($ctx3) {
  11709. //>>excludeEnd("ctx");
  11710. return self._addWorker();
  11711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11712. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11713. //>>excludeEnd("ctx");
  11714. }));
  11715. };
  11716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11717. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  11718. //>>excludeEnd("ctx");
  11719. });
  11720. return $1;
  11721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11722. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},globals.ForkPool)});
  11723. //>>excludeEnd("ctx");
  11724. },
  11725. //>>excludeStart("ide", pragmas.excludeIdeData);
  11726. args: [],
  11727. 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 ] ]]",
  11728. referencedClasses: ["Object"],
  11729. //>>excludeEnd("ide");
  11730. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  11731. }),
  11732. globals.ForkPool);
  11733. smalltalk.addMethod(
  11734. smalltalk.method({
  11735. selector: "maxPoolSize",
  11736. protocol: 'accessing',
  11737. fn: function (){
  11738. var self=this;
  11739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11740. return smalltalk.withContext(function($ctx1) {
  11741. //>>excludeEnd("ctx");
  11742. var $2,$1,$receiver;
  11743. $2=self["@maxPoolSize"];
  11744. if(($receiver = $2) == null || $receiver.isNil){
  11745. $1=self._defaultMaxPoolSize();
  11746. } else {
  11747. $1=$2;
  11748. };
  11749. return $1;
  11750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11751. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},globals.ForkPool)});
  11752. //>>excludeEnd("ctx");
  11753. },
  11754. //>>excludeStart("ide", pragmas.excludeIdeData);
  11755. args: [],
  11756. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  11757. referencedClasses: [],
  11758. //>>excludeEnd("ide");
  11759. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  11760. }),
  11761. globals.ForkPool);
  11762. smalltalk.addMethod(
  11763. smalltalk.method({
  11764. selector: "maxPoolSize:",
  11765. protocol: 'accessing',
  11766. fn: function (anInteger){
  11767. var self=this;
  11768. self["@maxPoolSize"]=anInteger;
  11769. return self;
  11770. },
  11771. //>>excludeStart("ide", pragmas.excludeIdeData);
  11772. args: ["anInteger"],
  11773. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  11774. referencedClasses: [],
  11775. //>>excludeEnd("ide");
  11776. messageSends: []
  11777. }),
  11778. globals.ForkPool);
  11779. globals.ForkPool.klass.iVarNames = ['default'];
  11780. smalltalk.addMethod(
  11781. smalltalk.method({
  11782. selector: "default",
  11783. protocol: 'accessing',
  11784. fn: function (){
  11785. var self=this;
  11786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11787. return smalltalk.withContext(function($ctx1) {
  11788. //>>excludeEnd("ctx");
  11789. var $2,$1,$receiver;
  11790. $2=self["@default"];
  11791. if(($receiver = $2) == null || $receiver.isNil){
  11792. self["@default"]=self._new();
  11793. $1=self["@default"];
  11794. } else {
  11795. $1=$2;
  11796. };
  11797. return $1;
  11798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11799. }, function($ctx1) {$ctx1.fill(self,"default",{},globals.ForkPool.klass)});
  11800. //>>excludeEnd("ctx");
  11801. },
  11802. //>>excludeStart("ide", pragmas.excludeIdeData);
  11803. args: [],
  11804. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  11805. referencedClasses: [],
  11806. //>>excludeEnd("ide");
  11807. messageSends: ["ifNil:", "new"]
  11808. }),
  11809. globals.ForkPool.klass);
  11810. smalltalk.addMethod(
  11811. smalltalk.method({
  11812. selector: "defaultMaxPoolSize",
  11813. protocol: 'accessing',
  11814. fn: function (){
  11815. var self=this;
  11816. return (100);
  11817. },
  11818. //>>excludeStart("ide", pragmas.excludeIdeData);
  11819. args: [],
  11820. source: "defaultMaxPoolSize\x0a\x09^ 100",
  11821. referencedClasses: [],
  11822. //>>excludeEnd("ide");
  11823. messageSends: []
  11824. }),
  11825. globals.ForkPool.klass);
  11826. smalltalk.addMethod(
  11827. smalltalk.method({
  11828. selector: "resetDefault",
  11829. protocol: 'accessing',
  11830. fn: function (){
  11831. var self=this;
  11832. self["@default"]=nil;
  11833. return self;
  11834. },
  11835. //>>excludeStart("ide", pragmas.excludeIdeData);
  11836. args: [],
  11837. source: "resetDefault\x0a\x09default := nil",
  11838. referencedClasses: [],
  11839. //>>excludeEnd("ide");
  11840. messageSends: []
  11841. }),
  11842. globals.ForkPool.klass);
  11843. smalltalk.addClass('Message', globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  11844. //>>excludeStart("ide", pragmas.excludeIdeData);
  11845. globals.Message.comment="In general, the system does not use instances of me 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:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
  11846. //>>excludeEnd("ide");
  11847. smalltalk.addMethod(
  11848. smalltalk.method({
  11849. selector: "arguments",
  11850. protocol: 'accessing',
  11851. fn: function (){
  11852. var self=this;
  11853. var $1;
  11854. $1=self["@arguments"];
  11855. return $1;
  11856. },
  11857. //>>excludeStart("ide", pragmas.excludeIdeData);
  11858. args: [],
  11859. source: "arguments\x0a\x09^ arguments",
  11860. referencedClasses: [],
  11861. //>>excludeEnd("ide");
  11862. messageSends: []
  11863. }),
  11864. globals.Message);
  11865. smalltalk.addMethod(
  11866. smalltalk.method({
  11867. selector: "arguments:",
  11868. protocol: 'accessing',
  11869. fn: function (anArray){
  11870. var self=this;
  11871. self["@arguments"]=anArray;
  11872. return self;
  11873. },
  11874. //>>excludeStart("ide", pragmas.excludeIdeData);
  11875. args: ["anArray"],
  11876. source: "arguments: anArray\x0a\x09arguments := anArray",
  11877. referencedClasses: [],
  11878. //>>excludeEnd("ide");
  11879. messageSends: []
  11880. }),
  11881. globals.Message);
  11882. smalltalk.addMethod(
  11883. smalltalk.method({
  11884. selector: "printOn:",
  11885. protocol: 'printing',
  11886. fn: function (aStream){
  11887. var self=this;
  11888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11889. return smalltalk.withContext(function($ctx1) {
  11890. //>>excludeEnd("ctx");
  11891. var $1;
  11892. (
  11893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11894. $ctx1.supercall = true,
  11895. //>>excludeEnd("ctx");
  11896. globals.Message.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  11897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11898. $ctx1.supercall = false;
  11899. //>>excludeEnd("ctx");;
  11900. _st(aStream)._nextPutAll_("(");
  11901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11902. $ctx1.sendIdx["nextPutAll:"]=1;
  11903. //>>excludeEnd("ctx");
  11904. _st(aStream)._nextPutAll_(self._selector());
  11905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11906. $ctx1.sendIdx["nextPutAll:"]=2;
  11907. //>>excludeEnd("ctx");
  11908. $1=_st(aStream)._nextPutAll_(")");
  11909. return self;
  11910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11911. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Message)});
  11912. //>>excludeEnd("ctx");
  11913. },
  11914. //>>excludeStart("ide", pragmas.excludeIdeData);
  11915. args: ["aStream"],
  11916. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  11917. referencedClasses: [],
  11918. //>>excludeEnd("ide");
  11919. messageSends: ["printOn:", "nextPutAll:", "selector"]
  11920. }),
  11921. globals.Message);
  11922. smalltalk.addMethod(
  11923. smalltalk.method({
  11924. selector: "selector",
  11925. protocol: 'accessing',
  11926. fn: function (){
  11927. var self=this;
  11928. var $1;
  11929. $1=self["@selector"];
  11930. return $1;
  11931. },
  11932. //>>excludeStart("ide", pragmas.excludeIdeData);
  11933. args: [],
  11934. source: "selector\x0a\x09^ selector",
  11935. referencedClasses: [],
  11936. //>>excludeEnd("ide");
  11937. messageSends: []
  11938. }),
  11939. globals.Message);
  11940. smalltalk.addMethod(
  11941. smalltalk.method({
  11942. selector: "selector:",
  11943. protocol: 'accessing',
  11944. fn: function (aString){
  11945. var self=this;
  11946. self["@selector"]=aString;
  11947. return self;
  11948. },
  11949. //>>excludeStart("ide", pragmas.excludeIdeData);
  11950. args: ["aString"],
  11951. source: "selector: aString\x0a\x09selector := aString",
  11952. referencedClasses: [],
  11953. //>>excludeEnd("ide");
  11954. messageSends: []
  11955. }),
  11956. globals.Message);
  11957. smalltalk.addMethod(
  11958. smalltalk.method({
  11959. selector: "sendTo:",
  11960. protocol: 'actions',
  11961. fn: function (anObject){
  11962. var self=this;
  11963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11964. return smalltalk.withContext(function($ctx1) {
  11965. //>>excludeEnd("ctx");
  11966. var $1;
  11967. $1=_st(anObject)._perform_withArguments_(self._selector(),self._arguments());
  11968. return $1;
  11969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11970. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},globals.Message)});
  11971. //>>excludeEnd("ctx");
  11972. },
  11973. //>>excludeStart("ide", pragmas.excludeIdeData);
  11974. args: ["anObject"],
  11975. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  11976. referencedClasses: [],
  11977. //>>excludeEnd("ide");
  11978. messageSends: ["perform:withArguments:", "selector", "arguments"]
  11979. }),
  11980. globals.Message);
  11981. smalltalk.addMethod(
  11982. smalltalk.method({
  11983. selector: "selector:arguments:",
  11984. protocol: 'instance creation',
  11985. fn: function (aString,anArray){
  11986. var self=this;
  11987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11988. return smalltalk.withContext(function($ctx1) {
  11989. //>>excludeEnd("ctx");
  11990. var $2,$3,$1;
  11991. $2=self._new();
  11992. _st($2)._selector_(aString);
  11993. _st($2)._arguments_(anArray);
  11994. $3=_st($2)._yourself();
  11995. $1=$3;
  11996. return $1;
  11997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11998. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},globals.Message.klass)});
  11999. //>>excludeEnd("ctx");
  12000. },
  12001. //>>excludeStart("ide", pragmas.excludeIdeData);
  12002. args: ["aString", "anArray"],
  12003. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  12004. referencedClasses: [],
  12005. //>>excludeEnd("ide");
  12006. messageSends: ["selector:", "new", "arguments:", "yourself"]
  12007. }),
  12008. globals.Message.klass);
  12009. smalltalk.addClass('MessageSend', globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  12010. //>>excludeStart("ide", pragmas.excludeIdeData);
  12011. globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
  12012. //>>excludeEnd("ide");
  12013. smalltalk.addMethod(
  12014. smalltalk.method({
  12015. selector: "arguments",
  12016. protocol: 'accessing',
  12017. fn: function (){
  12018. var self=this;
  12019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12020. return smalltalk.withContext(function($ctx1) {
  12021. //>>excludeEnd("ctx");
  12022. var $1;
  12023. $1=_st(self["@message"])._arguments();
  12024. return $1;
  12025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12026. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MessageSend)});
  12027. //>>excludeEnd("ctx");
  12028. },
  12029. //>>excludeStart("ide", pragmas.excludeIdeData);
  12030. args: [],
  12031. source: "arguments\x0a\x09^ message arguments",
  12032. referencedClasses: [],
  12033. //>>excludeEnd("ide");
  12034. messageSends: ["arguments"]
  12035. }),
  12036. globals.MessageSend);
  12037. smalltalk.addMethod(
  12038. smalltalk.method({
  12039. selector: "arguments:",
  12040. protocol: 'accessing',
  12041. fn: function (aCollection){
  12042. var self=this;
  12043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12044. return smalltalk.withContext(function($ctx1) {
  12045. //>>excludeEnd("ctx");
  12046. _st(self["@message"])._arguments_(aCollection);
  12047. return self;
  12048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12049. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.MessageSend)});
  12050. //>>excludeEnd("ctx");
  12051. },
  12052. //>>excludeStart("ide", pragmas.excludeIdeData);
  12053. args: ["aCollection"],
  12054. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  12055. referencedClasses: [],
  12056. //>>excludeEnd("ide");
  12057. messageSends: ["arguments:"]
  12058. }),
  12059. globals.MessageSend);
  12060. smalltalk.addMethod(
  12061. smalltalk.method({
  12062. selector: "initialize",
  12063. protocol: 'initialization',
  12064. fn: function (){
  12065. var self=this;
  12066. function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
  12067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12068. return smalltalk.withContext(function($ctx1) {
  12069. //>>excludeEnd("ctx");
  12070. (
  12071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12072. $ctx1.supercall = true,
  12073. //>>excludeEnd("ctx");
  12074. globals.MessageSend.superclass.fn.prototype._initialize.apply(_st(self), []));
  12075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12076. $ctx1.supercall = false;
  12077. //>>excludeEnd("ctx");;
  12078. self["@message"]=_st($Message())._new();
  12079. return self;
  12080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12081. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.MessageSend)});
  12082. //>>excludeEnd("ctx");
  12083. },
  12084. //>>excludeStart("ide", pragmas.excludeIdeData);
  12085. args: [],
  12086. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  12087. referencedClasses: ["Message"],
  12088. //>>excludeEnd("ide");
  12089. messageSends: ["initialize", "new"]
  12090. }),
  12091. globals.MessageSend);
  12092. smalltalk.addMethod(
  12093. smalltalk.method({
  12094. selector: "printOn:",
  12095. protocol: 'printing',
  12096. fn: function (aStream){
  12097. var self=this;
  12098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12099. return smalltalk.withContext(function($ctx1) {
  12100. //>>excludeEnd("ctx");
  12101. var $1;
  12102. (
  12103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12104. $ctx1.supercall = true,
  12105. //>>excludeEnd("ctx");
  12106. globals.MessageSend.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  12107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12108. $ctx1.supercall = false;
  12109. //>>excludeEnd("ctx");;
  12110. _st(aStream)._nextPutAll_("(");
  12111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12112. $ctx1.sendIdx["nextPutAll:"]=1;
  12113. //>>excludeEnd("ctx");
  12114. _st(aStream)._nextPutAll_(self._receiver());
  12115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12116. $ctx1.sendIdx["nextPutAll:"]=2;
  12117. //>>excludeEnd("ctx");
  12118. _st(aStream)._nextPutAll_(" >> ");
  12119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12120. $ctx1.sendIdx["nextPutAll:"]=3;
  12121. //>>excludeEnd("ctx");
  12122. _st(aStream)._nextPutAll_(self._selector());
  12123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12124. $ctx1.sendIdx["nextPutAll:"]=4;
  12125. //>>excludeEnd("ctx");
  12126. $1=_st(aStream)._nextPutAll_(")");
  12127. return self;
  12128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12129. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MessageSend)});
  12130. //>>excludeEnd("ctx");
  12131. },
  12132. //>>excludeStart("ide", pragmas.excludeIdeData);
  12133. args: ["aStream"],
  12134. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  12135. referencedClasses: [],
  12136. //>>excludeEnd("ide");
  12137. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  12138. }),
  12139. globals.MessageSend);
  12140. smalltalk.addMethod(
  12141. smalltalk.method({
  12142. selector: "receiver",
  12143. protocol: 'accessing',
  12144. fn: function (){
  12145. var self=this;
  12146. var $1;
  12147. $1=self["@receiver"];
  12148. return $1;
  12149. },
  12150. //>>excludeStart("ide", pragmas.excludeIdeData);
  12151. args: [],
  12152. source: "receiver\x0a\x09^ receiver",
  12153. referencedClasses: [],
  12154. //>>excludeEnd("ide");
  12155. messageSends: []
  12156. }),
  12157. globals.MessageSend);
  12158. smalltalk.addMethod(
  12159. smalltalk.method({
  12160. selector: "receiver:",
  12161. protocol: 'accessing',
  12162. fn: function (anObject){
  12163. var self=this;
  12164. self["@receiver"]=anObject;
  12165. return self;
  12166. },
  12167. //>>excludeStart("ide", pragmas.excludeIdeData);
  12168. args: ["anObject"],
  12169. source: "receiver: anObject\x0a\x09receiver := anObject",
  12170. referencedClasses: [],
  12171. //>>excludeEnd("ide");
  12172. messageSends: []
  12173. }),
  12174. globals.MessageSend);
  12175. smalltalk.addMethod(
  12176. smalltalk.method({
  12177. selector: "selector",
  12178. protocol: 'accessing',
  12179. fn: function (){
  12180. var self=this;
  12181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12182. return smalltalk.withContext(function($ctx1) {
  12183. //>>excludeEnd("ctx");
  12184. var $1;
  12185. $1=_st(self["@message"])._selector();
  12186. return $1;
  12187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12188. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MessageSend)});
  12189. //>>excludeEnd("ctx");
  12190. },
  12191. //>>excludeStart("ide", pragmas.excludeIdeData);
  12192. args: [],
  12193. source: "selector\x0a\x09^ message selector",
  12194. referencedClasses: [],
  12195. //>>excludeEnd("ide");
  12196. messageSends: ["selector"]
  12197. }),
  12198. globals.MessageSend);
  12199. smalltalk.addMethod(
  12200. smalltalk.method({
  12201. selector: "selector:",
  12202. protocol: 'accessing',
  12203. fn: function (aString){
  12204. var self=this;
  12205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12206. return smalltalk.withContext(function($ctx1) {
  12207. //>>excludeEnd("ctx");
  12208. _st(self["@message"])._selector_(aString);
  12209. return self;
  12210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12211. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.MessageSend)});
  12212. //>>excludeEnd("ctx");
  12213. },
  12214. //>>excludeStart("ide", pragmas.excludeIdeData);
  12215. args: ["aString"],
  12216. source: "selector: aString\x0a\x09message selector: aString",
  12217. referencedClasses: [],
  12218. //>>excludeEnd("ide");
  12219. messageSends: ["selector:"]
  12220. }),
  12221. globals.MessageSend);
  12222. smalltalk.addMethod(
  12223. smalltalk.method({
  12224. selector: "value",
  12225. protocol: 'evaluating',
  12226. fn: function (){
  12227. var self=this;
  12228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12229. return smalltalk.withContext(function($ctx1) {
  12230. //>>excludeEnd("ctx");
  12231. var $1;
  12232. $1=_st(self["@message"])._sendTo_(self._receiver());
  12233. return $1;
  12234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12235. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.MessageSend)});
  12236. //>>excludeEnd("ctx");
  12237. },
  12238. //>>excludeStart("ide", pragmas.excludeIdeData);
  12239. args: [],
  12240. source: "value\x0a\x09^ message sendTo: self receiver",
  12241. referencedClasses: [],
  12242. //>>excludeEnd("ide");
  12243. messageSends: ["sendTo:", "receiver"]
  12244. }),
  12245. globals.MessageSend);
  12246. smalltalk.addMethod(
  12247. smalltalk.method({
  12248. selector: "value:",
  12249. protocol: 'evaluating',
  12250. fn: function (anObject){
  12251. var self=this;
  12252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12253. return smalltalk.withContext(function($ctx1) {
  12254. //>>excludeEnd("ctx");
  12255. var $2,$3,$1;
  12256. $2=self["@message"];
  12257. _st($2)._arguments_([anObject]);
  12258. $3=_st($2)._sendTo_(self._receiver());
  12259. $1=$3;
  12260. return $1;
  12261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12262. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.MessageSend)});
  12263. //>>excludeEnd("ctx");
  12264. },
  12265. //>>excludeStart("ide", pragmas.excludeIdeData);
  12266. args: ["anObject"],
  12267. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  12268. referencedClasses: [],
  12269. //>>excludeEnd("ide");
  12270. messageSends: ["arguments:", "sendTo:", "receiver"]
  12271. }),
  12272. globals.MessageSend);
  12273. smalltalk.addMethod(
  12274. smalltalk.method({
  12275. selector: "value:value:",
  12276. protocol: 'evaluating',
  12277. fn: function (firstArgument,secondArgument){
  12278. var self=this;
  12279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12280. return smalltalk.withContext(function($ctx1) {
  12281. //>>excludeEnd("ctx");
  12282. var $2,$3,$1;
  12283. $2=self["@message"];
  12284. _st($2)._arguments_([firstArgument,secondArgument]);
  12285. $3=_st($2)._sendTo_(self._receiver());
  12286. $1=$3;
  12287. return $1;
  12288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12289. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.MessageSend)});
  12290. //>>excludeEnd("ctx");
  12291. },
  12292. //>>excludeStart("ide", pragmas.excludeIdeData);
  12293. args: ["firstArgument", "secondArgument"],
  12294. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  12295. referencedClasses: [],
  12296. //>>excludeEnd("ide");
  12297. messageSends: ["arguments:", "sendTo:", "receiver"]
  12298. }),
  12299. globals.MessageSend);
  12300. smalltalk.addMethod(
  12301. smalltalk.method({
  12302. selector: "value:value:value:",
  12303. protocol: 'evaluating',
  12304. fn: function (firstArgument,secondArgument,thirdArgument){
  12305. var self=this;
  12306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12307. return smalltalk.withContext(function($ctx1) {
  12308. //>>excludeEnd("ctx");
  12309. var $2,$3,$1;
  12310. $2=self["@message"];
  12311. _st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  12312. $3=_st($2)._sendTo_(self._receiver());
  12313. $1=$3;
  12314. return $1;
  12315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12316. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.MessageSend)});
  12317. //>>excludeEnd("ctx");
  12318. },
  12319. //>>excludeStart("ide", pragmas.excludeIdeData);
  12320. args: ["firstArgument", "secondArgument", "thirdArgument"],
  12321. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  12322. referencedClasses: [],
  12323. //>>excludeEnd("ide");
  12324. messageSends: ["arguments:", "sendTo:", "receiver"]
  12325. }),
  12326. globals.MessageSend);
  12327. smalltalk.addMethod(
  12328. smalltalk.method({
  12329. selector: "valueWithPossibleArguments:",
  12330. protocol: 'evaluating',
  12331. fn: function (aCollection){
  12332. var self=this;
  12333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12334. return smalltalk.withContext(function($ctx1) {
  12335. //>>excludeEnd("ctx");
  12336. var $1;
  12337. self._arguments_(aCollection);
  12338. $1=self._value();
  12339. return $1;
  12340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12341. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.MessageSend)});
  12342. //>>excludeEnd("ctx");
  12343. },
  12344. //>>excludeStart("ide", pragmas.excludeIdeData);
  12345. args: ["aCollection"],
  12346. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  12347. referencedClasses: [],
  12348. //>>excludeEnd("ide");
  12349. messageSends: ["arguments:", "value"]
  12350. }),
  12351. globals.MessageSend);
  12352. smalltalk.addClass('MethodContext', globals.Object, [], 'Kernel-Methods');
  12353. //>>excludeStart("ide", pragmas.excludeIdeData);
  12354. globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
  12355. //>>excludeEnd("ide");
  12356. smalltalk.addMethod(
  12357. smalltalk.method({
  12358. selector: "asString",
  12359. protocol: 'converting',
  12360. fn: function (){
  12361. var self=this;
  12362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12363. return smalltalk.withContext(function($ctx1) {
  12364. //>>excludeEnd("ctx");
  12365. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  12366. $2=self._isBlockContext();
  12367. if(smalltalk.assert($2)){
  12368. $3="a block (in ".__comma(_st(self._methodContext())._asString());
  12369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12370. $ctx1.sendIdx[","]=2;
  12371. //>>excludeEnd("ctx");
  12372. $1=_st($3).__comma(")");
  12373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12374. $ctx1.sendIdx[","]=1;
  12375. //>>excludeEnd("ctx");
  12376. } else {
  12377. var methodClass;
  12378. methodClass=_st(self._method())._methodClass();
  12379. methodClass;
  12380. $5=methodClass;
  12381. $7=self._receiver();
  12382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12383. $ctx1.sendIdx["receiver"]=1;
  12384. //>>excludeEnd("ctx");
  12385. $6=_st($7)._class();
  12386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12387. $ctx1.sendIdx["class"]=1;
  12388. //>>excludeEnd("ctx");
  12389. $4=_st($5).__eq($6);
  12390. if(smalltalk.assert($4)){
  12391. $11=self._receiver();
  12392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12393. $ctx1.sendIdx["receiver"]=2;
  12394. //>>excludeEnd("ctx");
  12395. $10=_st($11)._class();
  12396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12397. $ctx1.sendIdx["class"]=2;
  12398. //>>excludeEnd("ctx");
  12399. $9=_st($10)._name();
  12400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12401. $ctx1.sendIdx["name"]=1;
  12402. //>>excludeEnd("ctx");
  12403. $8=_st($9).__comma(" >> ");
  12404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12405. $ctx1.sendIdx[","]=4;
  12406. //>>excludeEnd("ctx");
  12407. $12=self._selector();
  12408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12409. $ctx1.sendIdx["selector"]=1;
  12410. //>>excludeEnd("ctx");
  12411. $1=_st($8).__comma($12);
  12412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12413. $ctx1.sendIdx[","]=3;
  12414. //>>excludeEnd("ctx");
  12415. } else {
  12416. $16=_st(_st(self._receiver())._class())._name();
  12417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12418. $ctx1.sendIdx["name"]=2;
  12419. //>>excludeEnd("ctx");
  12420. $15=_st($16).__comma("(");
  12421. $14=_st($15).__comma(_st(methodClass)._name());
  12422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12423. $ctx1.sendIdx[","]=7;
  12424. //>>excludeEnd("ctx");
  12425. $13=_st($14).__comma(") >> ");
  12426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12427. $ctx1.sendIdx[","]=6;
  12428. //>>excludeEnd("ctx");
  12429. $1=_st($13).__comma(self._selector());
  12430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12431. $ctx1.sendIdx[","]=5;
  12432. //>>excludeEnd("ctx");
  12433. };
  12434. };
  12435. return $1;
  12436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12437. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.MethodContext)});
  12438. //>>excludeEnd("ctx");
  12439. },
  12440. //>>excludeStart("ide", pragmas.excludeIdeData);
  12441. args: [],
  12442. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
  12443. referencedClasses: [],
  12444. //>>excludeEnd("ide");
  12445. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  12446. }),
  12447. globals.MethodContext);
  12448. smalltalk.addMethod(
  12449. smalltalk.method({
  12450. selector: "basicReceiver",
  12451. protocol: 'accessing',
  12452. fn: function (){
  12453. var self=this;
  12454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12455. return smalltalk.withContext(function($ctx1) {
  12456. //>>excludeEnd("ctx");
  12457. return self.receiver;
  12458. return self;
  12459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12460. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},globals.MethodContext)});
  12461. //>>excludeEnd("ctx");
  12462. },
  12463. //>>excludeStart("ide", pragmas.excludeIdeData);
  12464. args: [],
  12465. source: "basicReceiver\x0a\x09<return self.receiver>",
  12466. referencedClasses: [],
  12467. //>>excludeEnd("ide");
  12468. messageSends: []
  12469. }),
  12470. globals.MethodContext);
  12471. smalltalk.addMethod(
  12472. smalltalk.method({
  12473. selector: "evaluatedSelector",
  12474. protocol: 'accessing',
  12475. fn: function (){
  12476. var self=this;
  12477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12478. return smalltalk.withContext(function($ctx1) {
  12479. //>>excludeEnd("ctx");
  12480. return self.evaluatedSelector;
  12481. return self;
  12482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12483. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},globals.MethodContext)});
  12484. //>>excludeEnd("ctx");
  12485. },
  12486. //>>excludeStart("ide", pragmas.excludeIdeData);
  12487. args: [],
  12488. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  12489. referencedClasses: [],
  12490. //>>excludeEnd("ide");
  12491. messageSends: []
  12492. }),
  12493. globals.MethodContext);
  12494. smalltalk.addMethod(
  12495. smalltalk.method({
  12496. selector: "findContextSuchThat:",
  12497. protocol: 'accessing',
  12498. fn: function (testBlock){
  12499. var self=this;
  12500. var context;
  12501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12502. return smalltalk.withContext(function($ctx1) {
  12503. //>>excludeEnd("ctx");
  12504. var $1,$2;
  12505. var $early={};
  12506. try {
  12507. context=self;
  12508. _st((function(){
  12509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12510. return smalltalk.withContext(function($ctx2) {
  12511. //>>excludeEnd("ctx");
  12512. return _st(context)._isNil();
  12513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12515. //>>excludeEnd("ctx");
  12516. }))._whileFalse_((function(){
  12517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12518. return smalltalk.withContext(function($ctx2) {
  12519. //>>excludeEnd("ctx");
  12520. $1=_st(testBlock)._value_(context);
  12521. if(smalltalk.assert($1)){
  12522. $2=context;
  12523. throw $early=[$2];
  12524. };
  12525. context=_st(context)._outerContext();
  12526. return context;
  12527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12529. //>>excludeEnd("ctx");
  12530. }));
  12531. return nil;
  12532. }
  12533. catch(e) {if(e===$early)return e[0]; throw e}
  12534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12535. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},globals.MethodContext)});
  12536. //>>excludeEnd("ctx");
  12537. },
  12538. //>>excludeStart("ide", pragmas.excludeIdeData);
  12539. args: ["testBlock"],
  12540. source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
  12541. referencedClasses: [],
  12542. //>>excludeEnd("ide");
  12543. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  12544. }),
  12545. globals.MethodContext);
  12546. smalltalk.addMethod(
  12547. smalltalk.method({
  12548. selector: "home",
  12549. protocol: 'accessing',
  12550. fn: function (){
  12551. var self=this;
  12552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12553. return smalltalk.withContext(function($ctx1) {
  12554. //>>excludeEnd("ctx");
  12555. return self.homeContext;
  12556. return self;
  12557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12558. }, function($ctx1) {$ctx1.fill(self,"home",{},globals.MethodContext)});
  12559. //>>excludeEnd("ctx");
  12560. },
  12561. //>>excludeStart("ide", pragmas.excludeIdeData);
  12562. args: [],
  12563. source: "home\x0a\x09<return self.homeContext>",
  12564. referencedClasses: [],
  12565. //>>excludeEnd("ide");
  12566. messageSends: []
  12567. }),
  12568. globals.MethodContext);
  12569. smalltalk.addMethod(
  12570. smalltalk.method({
  12571. selector: "index",
  12572. protocol: 'accessing',
  12573. fn: function (){
  12574. var self=this;
  12575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12576. return smalltalk.withContext(function($ctx1) {
  12577. //>>excludeEnd("ctx");
  12578. return self.index || 0;
  12579. return self;
  12580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12581. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.MethodContext)});
  12582. //>>excludeEnd("ctx");
  12583. },
  12584. //>>excludeStart("ide", pragmas.excludeIdeData);
  12585. args: [],
  12586. source: "index\x0a\x09<return self.index || 0>",
  12587. referencedClasses: [],
  12588. //>>excludeEnd("ide");
  12589. messageSends: []
  12590. }),
  12591. globals.MethodContext);
  12592. smalltalk.addMethod(
  12593. smalltalk.method({
  12594. selector: "isBlockContext",
  12595. protocol: 'testing',
  12596. fn: function (){
  12597. var self=this;
  12598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12599. return smalltalk.withContext(function($ctx1) {
  12600. //>>excludeEnd("ctx");
  12601. var $1;
  12602. $1=_st(self._selector())._isNil();
  12603. return $1;
  12604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12605. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},globals.MethodContext)});
  12606. //>>excludeEnd("ctx");
  12607. },
  12608. //>>excludeStart("ide", pragmas.excludeIdeData);
  12609. args: [],
  12610. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  12611. referencedClasses: [],
  12612. //>>excludeEnd("ide");
  12613. messageSends: ["isNil", "selector"]
  12614. }),
  12615. globals.MethodContext);
  12616. smalltalk.addMethod(
  12617. smalltalk.method({
  12618. selector: "locals",
  12619. protocol: 'accessing',
  12620. fn: function (){
  12621. var self=this;
  12622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12623. return smalltalk.withContext(function($ctx1) {
  12624. //>>excludeEnd("ctx");
  12625. return self.locals || {};
  12626. return self;
  12627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12628. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.MethodContext)});
  12629. //>>excludeEnd("ctx");
  12630. },
  12631. //>>excludeStart("ide", pragmas.excludeIdeData);
  12632. args: [],
  12633. source: "locals\x0a\x09<return self.locals || {}>",
  12634. referencedClasses: [],
  12635. //>>excludeEnd("ide");
  12636. messageSends: []
  12637. }),
  12638. globals.MethodContext);
  12639. smalltalk.addMethod(
  12640. smalltalk.method({
  12641. selector: "method",
  12642. protocol: 'accessing',
  12643. fn: function (){
  12644. var self=this;
  12645. var method,lookupClass,receiverClass,supercall;
  12646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12647. return smalltalk.withContext(function($ctx1) {
  12648. //>>excludeEnd("ctx");
  12649. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
  12650. $1=self._methodContext();
  12651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12652. $ctx1.sendIdx["methodContext"]=1;
  12653. //>>excludeEnd("ctx");
  12654. if(($receiver = $1) == null || $receiver.isNil){
  12655. return nil;
  12656. } else {
  12657. $1;
  12658. };
  12659. $3=self._methodContext();
  12660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12661. $ctx1.sendIdx["methodContext"]=2;
  12662. //>>excludeEnd("ctx");
  12663. $2=_st($3)._receiver();
  12664. receiverClass=_st($2)._class();
  12665. $4=receiverClass;
  12666. $6=self._methodContext();
  12667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12668. $ctx1.sendIdx["methodContext"]=3;
  12669. //>>excludeEnd("ctx");
  12670. $5=_st($6)._selector();
  12671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12672. $ctx1.sendIdx["selector"]=1;
  12673. //>>excludeEnd("ctx");
  12674. method=_st($4)._lookupSelector_($5);
  12675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12676. $ctx1.sendIdx["lookupSelector:"]=1;
  12677. //>>excludeEnd("ctx");
  12678. $7=self._outerContext();
  12679. if(($receiver = $7) == null || $receiver.isNil){
  12680. supercall=false;
  12681. } else {
  12682. var outer;
  12683. outer=$receiver;
  12684. supercall=_st(outer)._supercall();
  12685. };
  12686. $9=supercall;
  12687. if(smalltalk.assert($9)){
  12688. $8=_st(_st(_st(method)._methodClass())._superclass())._lookupSelector_(_st(self._methodContext())._selector());
  12689. } else {
  12690. $8=method;
  12691. };
  12692. return $8;
  12693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12694. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},globals.MethodContext)});
  12695. //>>excludeEnd("ctx");
  12696. },
  12697. //>>excludeStart("ide", pragmas.excludeIdeData);
  12698. args: [],
  12699. source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
  12700. referencedClasses: [],
  12701. //>>excludeEnd("ide");
  12702. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  12703. }),
  12704. globals.MethodContext);
  12705. smalltalk.addMethod(
  12706. smalltalk.method({
  12707. selector: "methodContext",
  12708. protocol: 'accessing',
  12709. fn: function (){
  12710. var self=this;
  12711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12712. return smalltalk.withContext(function($ctx1) {
  12713. //>>excludeEnd("ctx");
  12714. var $1,$3,$2,$receiver;
  12715. $1=self._isBlockContext();
  12716. if(! smalltalk.assert($1)){
  12717. return self;
  12718. };
  12719. $3=self._outerContext();
  12720. if(($receiver = $3) == null || $receiver.isNil){
  12721. $2=$3;
  12722. } else {
  12723. var outer;
  12724. outer=$receiver;
  12725. $2=_st(outer)._methodContext();
  12726. };
  12727. return $2;
  12728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12729. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},globals.MethodContext)});
  12730. //>>excludeEnd("ctx");
  12731. },
  12732. //>>excludeStart("ide", pragmas.excludeIdeData);
  12733. args: [],
  12734. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  12735. referencedClasses: [],
  12736. //>>excludeEnd("ide");
  12737. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  12738. }),
  12739. globals.MethodContext);
  12740. smalltalk.addMethod(
  12741. smalltalk.method({
  12742. selector: "outerContext",
  12743. protocol: 'accessing',
  12744. fn: function (){
  12745. var self=this;
  12746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12747. return smalltalk.withContext(function($ctx1) {
  12748. //>>excludeEnd("ctx");
  12749. return self.outerContext || self.homeContext;
  12750. return self;
  12751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12752. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},globals.MethodContext)});
  12753. //>>excludeEnd("ctx");
  12754. },
  12755. //>>excludeStart("ide", pragmas.excludeIdeData);
  12756. args: [],
  12757. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  12758. referencedClasses: [],
  12759. //>>excludeEnd("ide");
  12760. messageSends: []
  12761. }),
  12762. globals.MethodContext);
  12763. smalltalk.addMethod(
  12764. smalltalk.method({
  12765. selector: "printOn:",
  12766. protocol: 'printing',
  12767. fn: function (aStream){
  12768. var self=this;
  12769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12770. return smalltalk.withContext(function($ctx1) {
  12771. //>>excludeEnd("ctx");
  12772. var $1;
  12773. (
  12774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12775. $ctx1.supercall = true,
  12776. //>>excludeEnd("ctx");
  12777. globals.MethodContext.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  12778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12779. $ctx1.supercall = false;
  12780. //>>excludeEnd("ctx");;
  12781. _st(aStream)._nextPutAll_("(");
  12782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12783. $ctx1.sendIdx["nextPutAll:"]=1;
  12784. //>>excludeEnd("ctx");
  12785. _st(aStream)._nextPutAll_(self._asString());
  12786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12787. $ctx1.sendIdx["nextPutAll:"]=2;
  12788. //>>excludeEnd("ctx");
  12789. $1=_st(aStream)._nextPutAll_(")");
  12790. return self;
  12791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12792. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MethodContext)});
  12793. //>>excludeEnd("ctx");
  12794. },
  12795. //>>excludeStart("ide", pragmas.excludeIdeData);
  12796. args: ["aStream"],
  12797. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  12798. referencedClasses: [],
  12799. //>>excludeEnd("ide");
  12800. messageSends: ["printOn:", "nextPutAll:", "asString"]
  12801. }),
  12802. globals.MethodContext);
  12803. smalltalk.addMethod(
  12804. smalltalk.method({
  12805. selector: "receiver",
  12806. protocol: 'accessing',
  12807. fn: function (){
  12808. var self=this;
  12809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12810. return smalltalk.withContext(function($ctx1) {
  12811. //>>excludeEnd("ctx");
  12812. var $3,$2,$1;
  12813. $2=_st(self._isBlockContext())._and_((function(){
  12814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12815. return smalltalk.withContext(function($ctx2) {
  12816. //>>excludeEnd("ctx");
  12817. $3=self._outerContext();
  12818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12819. $ctx2.sendIdx["outerContext"]=1;
  12820. //>>excludeEnd("ctx");
  12821. return _st($3)._notNil();
  12822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12824. //>>excludeEnd("ctx");
  12825. }));
  12826. if(smalltalk.assert($2)){
  12827. $1=_st(self._outerContext())._receiver();
  12828. } else {
  12829. $1=self._basicReceiver();
  12830. };
  12831. return $1;
  12832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12833. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.MethodContext)});
  12834. //>>excludeEnd("ctx");
  12835. },
  12836. //>>excludeStart("ide", pragmas.excludeIdeData);
  12837. args: [],
  12838. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  12839. referencedClasses: [],
  12840. //>>excludeEnd("ide");
  12841. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  12842. }),
  12843. globals.MethodContext);
  12844. smalltalk.addMethod(
  12845. smalltalk.method({
  12846. selector: "selector",
  12847. protocol: 'accessing',
  12848. fn: function (){
  12849. var self=this;
  12850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12851. return smalltalk.withContext(function($ctx1) {
  12852. //>>excludeEnd("ctx");
  12853. if(self.selector) {
  12854. return smalltalk.js2st(self.selector);
  12855. } else {
  12856. return nil;
  12857. }
  12858. ;
  12859. return self;
  12860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12861. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MethodContext)});
  12862. //>>excludeEnd("ctx");
  12863. },
  12864. //>>excludeStart("ide", pragmas.excludeIdeData);
  12865. args: [],
  12866. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  12867. referencedClasses: [],
  12868. //>>excludeEnd("ide");
  12869. messageSends: []
  12870. }),
  12871. globals.MethodContext);
  12872. smalltalk.addMethod(
  12873. smalltalk.method({
  12874. selector: "sendIndexAt:",
  12875. protocol: 'accessing',
  12876. fn: function (aSelector){
  12877. var self=this;
  12878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12879. return smalltalk.withContext(function($ctx1) {
  12880. //>>excludeEnd("ctx");
  12881. return self.sendIdx[aSelector] || 0;
  12882. return self;
  12883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12884. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},globals.MethodContext)});
  12885. //>>excludeEnd("ctx");
  12886. },
  12887. //>>excludeStart("ide", pragmas.excludeIdeData);
  12888. args: ["aSelector"],
  12889. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  12890. referencedClasses: [],
  12891. //>>excludeEnd("ide");
  12892. messageSends: []
  12893. }),
  12894. globals.MethodContext);
  12895. smalltalk.addMethod(
  12896. smalltalk.method({
  12897. selector: "sendIndexes",
  12898. protocol: 'accessing',
  12899. fn: function (){
  12900. var self=this;
  12901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12902. return smalltalk.withContext(function($ctx1) {
  12903. //>>excludeEnd("ctx");
  12904. return self.sendIdx;
  12905. return self;
  12906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12907. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.MethodContext)});
  12908. //>>excludeEnd("ctx");
  12909. },
  12910. //>>excludeStart("ide", pragmas.excludeIdeData);
  12911. args: [],
  12912. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  12913. referencedClasses: [],
  12914. //>>excludeEnd("ide");
  12915. messageSends: []
  12916. }),
  12917. globals.MethodContext);
  12918. smalltalk.addMethod(
  12919. smalltalk.method({
  12920. selector: "supercall",
  12921. protocol: 'accessing',
  12922. fn: function (){
  12923. var self=this;
  12924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12925. return smalltalk.withContext(function($ctx1) {
  12926. //>>excludeEnd("ctx");
  12927. return self.supercall == true;
  12928. return self;
  12929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12930. }, function($ctx1) {$ctx1.fill(self,"supercall",{},globals.MethodContext)});
  12931. //>>excludeEnd("ctx");
  12932. },
  12933. //>>excludeStart("ide", pragmas.excludeIdeData);
  12934. args: [],
  12935. source: "supercall\x0a\x09<return self.supercall == true>",
  12936. referencedClasses: [],
  12937. //>>excludeEnd("ide");
  12938. messageSends: []
  12939. }),
  12940. globals.MethodContext);
  12941. smalltalk.addMethod(
  12942. smalltalk.method({
  12943. selector: "temps",
  12944. protocol: 'accessing',
  12945. fn: function (){
  12946. var self=this;
  12947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12948. return smalltalk.withContext(function($ctx1) {
  12949. //>>excludeEnd("ctx");
  12950. var $1;
  12951. self._deprecatedAPI();
  12952. $1=self._locals();
  12953. return $1;
  12954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12955. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.MethodContext)});
  12956. //>>excludeEnd("ctx");
  12957. },
  12958. //>>excludeStart("ide", pragmas.excludeIdeData);
  12959. args: [],
  12960. source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
  12961. referencedClasses: [],
  12962. //>>excludeEnd("ide");
  12963. messageSends: ["deprecatedAPI", "locals"]
  12964. }),
  12965. globals.MethodContext);
  12966. smalltalk.addClass('NativeFunction', globals.Object, [], 'Kernel-Methods');
  12967. //>>excludeStart("ide", pragmas.excludeIdeData);
  12968. globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
  12969. //>>excludeEnd("ide");
  12970. smalltalk.addMethod(
  12971. smalltalk.method({
  12972. selector: "constructor:",
  12973. protocol: 'instance creation',
  12974. fn: function (aString){
  12975. var self=this;
  12976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12977. return smalltalk.withContext(function($ctx1) {
  12978. //>>excludeEnd("ctx");
  12979. var nativeFunc=eval(aString);
  12980. return new nativeFunc();
  12981. ;
  12982. return self;
  12983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12984. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},globals.NativeFunction.klass)});
  12985. //>>excludeEnd("ctx");
  12986. },
  12987. //>>excludeStart("ide", pragmas.excludeIdeData);
  12988. args: ["aString"],
  12989. source: "constructor: aString\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  12990. referencedClasses: [],
  12991. //>>excludeEnd("ide");
  12992. messageSends: []
  12993. }),
  12994. globals.NativeFunction.klass);
  12995. smalltalk.addMethod(
  12996. smalltalk.method({
  12997. selector: "constructor:value:",
  12998. protocol: 'instance creation',
  12999. fn: function (aString,anObject){
  13000. var self=this;
  13001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13002. return smalltalk.withContext(function($ctx1) {
  13003. //>>excludeEnd("ctx");
  13004. var nativeFunc=eval(aString);
  13005. return new nativeFunc(anObject);
  13006. ;
  13007. return self;
  13008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13009. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},globals.NativeFunction.klass)});
  13010. //>>excludeEnd("ctx");
  13011. },
  13012. //>>excludeStart("ide", pragmas.excludeIdeData);
  13013. args: ["aString", "anObject"],
  13014. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  13015. referencedClasses: [],
  13016. //>>excludeEnd("ide");
  13017. messageSends: []
  13018. }),
  13019. globals.NativeFunction.klass);
  13020. smalltalk.addMethod(
  13021. smalltalk.method({
  13022. selector: "constructor:value:value:",
  13023. protocol: 'instance creation',
  13024. fn: function (aString,anObject,anObject2){
  13025. var self=this;
  13026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13027. return smalltalk.withContext(function($ctx1) {
  13028. //>>excludeEnd("ctx");
  13029. var nativeFunc=eval(aString);
  13030. return new nativeFunc(anObject,anObject2);
  13031. ;
  13032. return self;
  13033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13034. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},globals.NativeFunction.klass)});
  13035. //>>excludeEnd("ctx");
  13036. },
  13037. //>>excludeStart("ide", pragmas.excludeIdeData);
  13038. args: ["aString", "anObject", "anObject2"],
  13039. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  13040. referencedClasses: [],
  13041. //>>excludeEnd("ide");
  13042. messageSends: []
  13043. }),
  13044. globals.NativeFunction.klass);
  13045. smalltalk.addMethod(
  13046. smalltalk.method({
  13047. selector: "constructor:value:value:value:",
  13048. protocol: 'instance creation',
  13049. fn: function (aString,anObject,anObject2,anObject3){
  13050. var self=this;
  13051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13052. return smalltalk.withContext(function($ctx1) {
  13053. //>>excludeEnd("ctx");
  13054. var nativeFunc=eval(aString);
  13055. return new nativeFunc(anObject,anObject2, anObject3);
  13056. ;
  13057. return self;
  13058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13059. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.NativeFunction.klass)});
  13060. //>>excludeEnd("ctx");
  13061. },
  13062. //>>excludeStart("ide", pragmas.excludeIdeData);
  13063. args: ["aString", "anObject", "anObject2", "anObject3"],
  13064. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  13065. referencedClasses: [],
  13066. //>>excludeEnd("ide");
  13067. messageSends: []
  13068. }),
  13069. globals.NativeFunction.klass);
  13070. smalltalk.addMethod(
  13071. smalltalk.method({
  13072. selector: "exists:",
  13073. protocol: 'testing',
  13074. fn: function (aString){
  13075. var self=this;
  13076. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  13077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13078. return smalltalk.withContext(function($ctx1) {
  13079. //>>excludeEnd("ctx");
  13080. var $1;
  13081. $1=_st($PlatformInterface())._existsGlobal_(aString);
  13082. return $1;
  13083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13084. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},globals.NativeFunction.klass)});
  13085. //>>excludeEnd("ctx");
  13086. },
  13087. //>>excludeStart("ide", pragmas.excludeIdeData);
  13088. args: ["aString"],
  13089. source: "exists: aString\x0a\x09^ PlatformInterface existsGlobal: aString",
  13090. referencedClasses: ["PlatformInterface"],
  13091. //>>excludeEnd("ide");
  13092. messageSends: ["existsGlobal:"]
  13093. }),
  13094. globals.NativeFunction.klass);
  13095. smalltalk.addClass('Timeout', globals.Object, ['rawTimeout'], 'Kernel-Methods');
  13096. //>>excludeStart("ide", pragmas.excludeIdeData);
  13097. globals.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
  13098. //>>excludeEnd("ide");
  13099. smalltalk.addMethod(
  13100. smalltalk.method({
  13101. selector: "clearInterval",
  13102. protocol: 'timeout/interval',
  13103. fn: function (){
  13104. var self=this;
  13105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13106. return smalltalk.withContext(function($ctx1) {
  13107. //>>excludeEnd("ctx");
  13108. var interval = self["@rawTimeout"];
  13109. clearInterval(interval);
  13110. ;
  13111. return self;
  13112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13113. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},globals.Timeout)});
  13114. //>>excludeEnd("ctx");
  13115. },
  13116. //>>excludeStart("ide", pragmas.excludeIdeData);
  13117. args: [],
  13118. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  13119. referencedClasses: [],
  13120. //>>excludeEnd("ide");
  13121. messageSends: []
  13122. }),
  13123. globals.Timeout);
  13124. smalltalk.addMethod(
  13125. smalltalk.method({
  13126. selector: "clearTimeout",
  13127. protocol: 'timeout/interval',
  13128. fn: function (){
  13129. var self=this;
  13130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13131. return smalltalk.withContext(function($ctx1) {
  13132. //>>excludeEnd("ctx");
  13133. var timeout = self["@rawTimeout"];
  13134. clearTimeout(timeout);
  13135. ;
  13136. return self;
  13137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13138. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},globals.Timeout)});
  13139. //>>excludeEnd("ctx");
  13140. },
  13141. //>>excludeStart("ide", pragmas.excludeIdeData);
  13142. args: [],
  13143. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  13144. referencedClasses: [],
  13145. //>>excludeEnd("ide");
  13146. messageSends: []
  13147. }),
  13148. globals.Timeout);
  13149. smalltalk.addMethod(
  13150. smalltalk.method({
  13151. selector: "rawTimeout:",
  13152. protocol: 'accessing',
  13153. fn: function (anObject){
  13154. var self=this;
  13155. self["@rawTimeout"]=anObject;
  13156. return self;
  13157. },
  13158. //>>excludeStart("ide", pragmas.excludeIdeData);
  13159. args: ["anObject"],
  13160. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  13161. referencedClasses: [],
  13162. //>>excludeEnd("ide");
  13163. messageSends: []
  13164. }),
  13165. globals.Timeout);
  13166. smalltalk.addMethod(
  13167. smalltalk.method({
  13168. selector: "on:",
  13169. protocol: 'instance creation',
  13170. fn: function (anObject){
  13171. var self=this;
  13172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13173. return smalltalk.withContext(function($ctx1) {
  13174. //>>excludeEnd("ctx");
  13175. var $2,$3,$1;
  13176. $2=self._new();
  13177. _st($2)._rawTimeout_(anObject);
  13178. $3=_st($2)._yourself();
  13179. $1=$3;
  13180. return $1;
  13181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13182. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},globals.Timeout.klass)});
  13183. //>>excludeEnd("ctx");
  13184. },
  13185. //>>excludeStart("ide", pragmas.excludeIdeData);
  13186. args: ["anObject"],
  13187. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  13188. referencedClasses: [],
  13189. //>>excludeEnd("ide");
  13190. messageSends: ["rawTimeout:", "new", "yourself"]
  13191. }),
  13192. globals.Timeout.klass);
  13193. });
  13194. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  13195. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  13196. smalltalk.addPackage('Kernel-Collections');
  13197. smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  13198. smalltalk.addClass('Association', globals.Object, ['key', 'value'], 'Kernel-Collections');
  13199. //>>excludeStart("ide", pragmas.excludeIdeData);
  13200. globals.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:`";
  13201. //>>excludeEnd("ide");
  13202. smalltalk.addMethod(
  13203. smalltalk.method({
  13204. selector: "=",
  13205. protocol: 'comparing',
  13206. fn: function (anAssociation){
  13207. var self=this;
  13208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13209. return smalltalk.withContext(function($ctx1) {
  13210. //>>excludeEnd("ctx");
  13211. var $3,$2,$5,$4,$6,$1;
  13212. $3=self._class();
  13213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13214. $ctx1.sendIdx["class"]=1;
  13215. //>>excludeEnd("ctx");
  13216. $2=_st($3).__eq(_st(anAssociation)._class());
  13217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13218. $ctx1.sendIdx["="]=1;
  13219. //>>excludeEnd("ctx");
  13220. $1=_st($2)._and_((function(){
  13221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13222. return smalltalk.withContext(function($ctx2) {
  13223. //>>excludeEnd("ctx");
  13224. $5=self._key();
  13225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13226. $ctx2.sendIdx["key"]=1;
  13227. //>>excludeEnd("ctx");
  13228. $4=_st($5).__eq(_st(anAssociation)._key());
  13229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13230. $ctx2.sendIdx["="]=2;
  13231. //>>excludeEnd("ctx");
  13232. return _st($4)._and_((function(){
  13233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13234. return smalltalk.withContext(function($ctx3) {
  13235. //>>excludeEnd("ctx");
  13236. $6=self._value();
  13237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13238. $ctx3.sendIdx["value"]=1;
  13239. //>>excludeEnd("ctx");
  13240. return _st($6).__eq(_st(anAssociation)._value());
  13241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13242. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13243. //>>excludeEnd("ctx");
  13244. }));
  13245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13247. //>>excludeEnd("ctx");
  13248. }));
  13249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13250. $ctx1.sendIdx["and:"]=1;
  13251. //>>excludeEnd("ctx");
  13252. return $1;
  13253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13254. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},globals.Association)});
  13255. //>>excludeEnd("ctx");
  13256. },
  13257. //>>excludeStart("ide", pragmas.excludeIdeData);
  13258. args: ["anAssociation"],
  13259. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  13260. referencedClasses: [],
  13261. //>>excludeEnd("ide");
  13262. messageSends: ["and:", "=", "class", "key", "value"]
  13263. }),
  13264. globals.Association);
  13265. smalltalk.addMethod(
  13266. smalltalk.method({
  13267. selector: "key",
  13268. protocol: 'accessing',
  13269. fn: function (){
  13270. var self=this;
  13271. var $1;
  13272. $1=self["@key"];
  13273. return $1;
  13274. },
  13275. //>>excludeStart("ide", pragmas.excludeIdeData);
  13276. args: [],
  13277. source: "key\x0a\x09^ key",
  13278. referencedClasses: [],
  13279. //>>excludeEnd("ide");
  13280. messageSends: []
  13281. }),
  13282. globals.Association);
  13283. smalltalk.addMethod(
  13284. smalltalk.method({
  13285. selector: "key:",
  13286. protocol: 'accessing',
  13287. fn: function (aKey){
  13288. var self=this;
  13289. self["@key"]=aKey;
  13290. return self;
  13291. },
  13292. //>>excludeStart("ide", pragmas.excludeIdeData);
  13293. args: ["aKey"],
  13294. source: "key: aKey\x0a\x09key := aKey",
  13295. referencedClasses: [],
  13296. //>>excludeEnd("ide");
  13297. messageSends: []
  13298. }),
  13299. globals.Association);
  13300. smalltalk.addMethod(
  13301. smalltalk.method({
  13302. selector: "printOn:",
  13303. protocol: 'printing',
  13304. fn: function (aStream){
  13305. var self=this;
  13306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13307. return smalltalk.withContext(function($ctx1) {
  13308. //>>excludeEnd("ctx");
  13309. _st(self._key())._printOn_(aStream);
  13310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13311. $ctx1.sendIdx["printOn:"]=1;
  13312. //>>excludeEnd("ctx");
  13313. _st(aStream)._nextPutAll_(" -> ");
  13314. _st(self._value())._printOn_(aStream);
  13315. return self;
  13316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13317. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Association)});
  13318. //>>excludeEnd("ctx");
  13319. },
  13320. //>>excludeStart("ide", pragmas.excludeIdeData);
  13321. args: ["aStream"],
  13322. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  13323. referencedClasses: [],
  13324. //>>excludeEnd("ide");
  13325. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  13326. }),
  13327. globals.Association);
  13328. smalltalk.addMethod(
  13329. smalltalk.method({
  13330. selector: "value",
  13331. protocol: 'accessing',
  13332. fn: function (){
  13333. var self=this;
  13334. var $1;
  13335. $1=self["@value"];
  13336. return $1;
  13337. },
  13338. //>>excludeStart("ide", pragmas.excludeIdeData);
  13339. args: [],
  13340. source: "value\x0a\x09^ value",
  13341. referencedClasses: [],
  13342. //>>excludeEnd("ide");
  13343. messageSends: []
  13344. }),
  13345. globals.Association);
  13346. smalltalk.addMethod(
  13347. smalltalk.method({
  13348. selector: "value:",
  13349. protocol: 'accessing',
  13350. fn: function (aValue){
  13351. var self=this;
  13352. self["@value"]=aValue;
  13353. return self;
  13354. },
  13355. //>>excludeStart("ide", pragmas.excludeIdeData);
  13356. args: ["aValue"],
  13357. source: "value: aValue\x0a\x09value := aValue",
  13358. referencedClasses: [],
  13359. //>>excludeEnd("ide");
  13360. messageSends: []
  13361. }),
  13362. globals.Association);
  13363. smalltalk.addMethod(
  13364. smalltalk.method({
  13365. selector: "key:value:",
  13366. protocol: 'instance creation',
  13367. fn: function (aKey,aValue){
  13368. var self=this;
  13369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13370. return smalltalk.withContext(function($ctx1) {
  13371. //>>excludeEnd("ctx");
  13372. var $2,$3,$1;
  13373. $2=self._new();
  13374. _st($2)._key_(aKey);
  13375. _st($2)._value_(aValue);
  13376. $3=_st($2)._yourself();
  13377. $1=$3;
  13378. return $1;
  13379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13380. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},globals.Association.klass)});
  13381. //>>excludeEnd("ctx");
  13382. },
  13383. //>>excludeStart("ide", pragmas.excludeIdeData);
  13384. args: ["aKey", "aValue"],
  13385. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  13386. referencedClasses: [],
  13387. //>>excludeEnd("ide");
  13388. messageSends: ["key:", "new", "value:", "yourself"]
  13389. }),
  13390. globals.Association.klass);
  13391. smalltalk.addClass('BucketStore', globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  13392. //>>excludeStart("ide", pragmas.excludeIdeData);
  13393. globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  13394. //>>excludeEnd("ide");
  13395. smalltalk.addMethod(
  13396. smalltalk.method({
  13397. selector: "bucketOfElement:",
  13398. protocol: 'accessing',
  13399. fn: function (anObject){
  13400. var self=this;
  13401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13402. return smalltalk.withContext(function($ctx1) {
  13403. //>>excludeEnd("ctx");
  13404. var hash = self['@hashBlock'](anObject);
  13405. if (!hash) return null;
  13406. var buckets = self['@buckets'],
  13407. bucket = buckets[hash];
  13408. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  13409. return bucket;
  13410. ;
  13411. return self;
  13412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13413. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},globals.BucketStore)});
  13414. //>>excludeEnd("ctx");
  13415. },
  13416. //>>excludeStart("ide", pragmas.excludeIdeData);
  13417. args: ["anObject"],
  13418. source: "bucketOfElement: anObject\x0a\x09<\x0a\x09\x09var hash = self['@hashBlock'](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = self['@buckets'],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09>",
  13419. referencedClasses: [],
  13420. //>>excludeEnd("ide");
  13421. messageSends: []
  13422. }),
  13423. globals.BucketStore);
  13424. smalltalk.addMethod(
  13425. smalltalk.method({
  13426. selector: "do:",
  13427. protocol: 'enumerating',
  13428. fn: function (aBlock){
  13429. var self=this;
  13430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13431. return smalltalk.withContext(function($ctx1) {
  13432. //>>excludeEnd("ctx");
  13433. var buckets = self['@buckets'];
  13434. var keys = Object.keys(buckets);
  13435. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  13436. ;
  13437. return self;
  13438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13439. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.BucketStore)});
  13440. //>>excludeEnd("ctx");
  13441. },
  13442. //>>excludeStart("ide", pragmas.excludeIdeData);
  13443. args: ["aBlock"],
  13444. source: "do: aBlock\x0a\x09<\x0a\x09\x09var buckets = self['@buckets'];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09>",
  13445. referencedClasses: [],
  13446. //>>excludeEnd("ide");
  13447. messageSends: []
  13448. }),
  13449. globals.BucketStore);
  13450. smalltalk.addMethod(
  13451. smalltalk.method({
  13452. selector: "hashBlock:",
  13453. protocol: 'accessing',
  13454. fn: function (aBlock){
  13455. var self=this;
  13456. self["@hashBlock"]=aBlock;
  13457. return self;
  13458. },
  13459. //>>excludeStart("ide", pragmas.excludeIdeData);
  13460. args: ["aBlock"],
  13461. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  13462. referencedClasses: [],
  13463. //>>excludeEnd("ide");
  13464. messageSends: []
  13465. }),
  13466. globals.BucketStore);
  13467. smalltalk.addMethod(
  13468. smalltalk.method({
  13469. selector: "initialize",
  13470. protocol: 'initialization',
  13471. fn: function (){
  13472. var self=this;
  13473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13474. return smalltalk.withContext(function($ctx1) {
  13475. //>>excludeEnd("ctx");
  13476. (
  13477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13478. $ctx1.supercall = true,
  13479. //>>excludeEnd("ctx");
  13480. globals.BucketStore.superclass.fn.prototype._initialize.apply(_st(self), []));
  13481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13482. $ctx1.supercall = false;
  13483. //>>excludeEnd("ctx");;
  13484. self._removeAll();
  13485. return self;
  13486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13487. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.BucketStore)});
  13488. //>>excludeEnd("ctx");
  13489. },
  13490. //>>excludeStart("ide", pragmas.excludeIdeData);
  13491. args: [],
  13492. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  13493. referencedClasses: [],
  13494. //>>excludeEnd("ide");
  13495. messageSends: ["initialize", "removeAll"]
  13496. }),
  13497. globals.BucketStore);
  13498. smalltalk.addMethod(
  13499. smalltalk.method({
  13500. selector: "newBucket",
  13501. protocol: 'private',
  13502. fn: function (){
  13503. var self=this;
  13504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13505. return smalltalk.withContext(function($ctx1) {
  13506. //>>excludeEnd("ctx");
  13507. self._subclassResponsibility();
  13508. return self;
  13509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13510. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},globals.BucketStore)});
  13511. //>>excludeEnd("ctx");
  13512. },
  13513. //>>excludeStart("ide", pragmas.excludeIdeData);
  13514. args: [],
  13515. source: "newBucket\x0a\x09self subclassResponsibility",
  13516. referencedClasses: [],
  13517. //>>excludeEnd("ide");
  13518. messageSends: ["subclassResponsibility"]
  13519. }),
  13520. globals.BucketStore);
  13521. smalltalk.addMethod(
  13522. smalltalk.method({
  13523. selector: "removeAll",
  13524. protocol: 'adding/removing',
  13525. fn: function (){
  13526. var self=this;
  13527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13528. return smalltalk.withContext(function($ctx1) {
  13529. //>>excludeEnd("ctx");
  13530. self['@buckets'] = Object.create(null);;
  13531. return self;
  13532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13533. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.BucketStore)});
  13534. //>>excludeEnd("ctx");
  13535. },
  13536. //>>excludeStart("ide", pragmas.excludeIdeData);
  13537. args: [],
  13538. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  13539. referencedClasses: [],
  13540. //>>excludeEnd("ide");
  13541. messageSends: []
  13542. }),
  13543. globals.BucketStore);
  13544. smalltalk.addMethod(
  13545. smalltalk.method({
  13546. selector: "hashBlock:",
  13547. protocol: 'instance creation',
  13548. fn: function (aBlock){
  13549. var self=this;
  13550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13551. return smalltalk.withContext(function($ctx1) {
  13552. //>>excludeEnd("ctx");
  13553. var $2,$3,$1;
  13554. $2=self._new();
  13555. _st($2)._hashBlock_(aBlock);
  13556. $3=_st($2)._yourself();
  13557. $1=$3;
  13558. return $1;
  13559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13560. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},globals.BucketStore.klass)});
  13561. //>>excludeEnd("ctx");
  13562. },
  13563. //>>excludeStart("ide", pragmas.excludeIdeData);
  13564. args: ["aBlock"],
  13565. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  13566. referencedClasses: [],
  13567. //>>excludeEnd("ide");
  13568. messageSends: ["hashBlock:", "new", "yourself"]
  13569. }),
  13570. globals.BucketStore.klass);
  13571. smalltalk.addClass('ArrayBucketStore', globals.BucketStore, [], 'Kernel-Collections');
  13572. //>>excludeStart("ide", pragmas.excludeIdeData);
  13573. globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  13574. //>>excludeEnd("ide");
  13575. smalltalk.addMethod(
  13576. smalltalk.method({
  13577. selector: "newBucket",
  13578. protocol: 'private',
  13579. fn: function (){
  13580. var self=this;
  13581. var $1;
  13582. $1=[];
  13583. return $1;
  13584. },
  13585. //>>excludeStart("ide", pragmas.excludeIdeData);
  13586. args: [],
  13587. source: "newBucket\x0a\x09^ #()",
  13588. referencedClasses: [],
  13589. //>>excludeEnd("ide");
  13590. messageSends: []
  13591. }),
  13592. globals.ArrayBucketStore);
  13593. smalltalk.addClass('Collection', globals.Object, [], 'Kernel-Collections');
  13594. //>>excludeStart("ide", pragmas.excludeIdeData);
  13595. globals.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 Collection hierarchy such as enumerating and converting methods.";
  13596. //>>excludeEnd("ide");
  13597. smalltalk.addMethod(
  13598. smalltalk.method({
  13599. selector: ",",
  13600. protocol: 'copying',
  13601. fn: function (aCollection){
  13602. var self=this;
  13603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13604. return smalltalk.withContext(function($ctx1) {
  13605. //>>excludeEnd("ctx");
  13606. var $2,$3,$1;
  13607. $2=self._copy();
  13608. _st($2)._addAll_(aCollection);
  13609. $3=_st($2)._yourself();
  13610. $1=$3;
  13611. return $1;
  13612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13613. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},globals.Collection)});
  13614. //>>excludeEnd("ctx");
  13615. },
  13616. //>>excludeStart("ide", pragmas.excludeIdeData);
  13617. args: ["aCollection"],
  13618. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  13619. referencedClasses: [],
  13620. //>>excludeEnd("ide");
  13621. messageSends: ["addAll:", "copy", "yourself"]
  13622. }),
  13623. globals.Collection);
  13624. smalltalk.addMethod(
  13625. smalltalk.method({
  13626. selector: "add:",
  13627. protocol: 'adding/removing',
  13628. fn: function (anObject){
  13629. var self=this;
  13630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13631. return smalltalk.withContext(function($ctx1) {
  13632. //>>excludeEnd("ctx");
  13633. self._subclassResponsibility();
  13634. return self;
  13635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13636. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Collection)});
  13637. //>>excludeEnd("ctx");
  13638. },
  13639. //>>excludeStart("ide", pragmas.excludeIdeData);
  13640. args: ["anObject"],
  13641. source: "add: anObject\x0a\x09self subclassResponsibility",
  13642. referencedClasses: [],
  13643. //>>excludeEnd("ide");
  13644. messageSends: ["subclassResponsibility"]
  13645. }),
  13646. globals.Collection);
  13647. smalltalk.addMethod(
  13648. smalltalk.method({
  13649. selector: "addAll:",
  13650. protocol: 'adding/removing',
  13651. fn: function (aCollection){
  13652. var self=this;
  13653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13654. return smalltalk.withContext(function($ctx1) {
  13655. //>>excludeEnd("ctx");
  13656. _st(aCollection)._do_((function(each){
  13657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13658. return smalltalk.withContext(function($ctx2) {
  13659. //>>excludeEnd("ctx");
  13660. return self._add_(each);
  13661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13663. //>>excludeEnd("ctx");
  13664. }));
  13665. return aCollection;
  13666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13667. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},globals.Collection)});
  13668. //>>excludeEnd("ctx");
  13669. },
  13670. //>>excludeStart("ide", pragmas.excludeIdeData);
  13671. args: ["aCollection"],
  13672. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  13673. referencedClasses: [],
  13674. //>>excludeEnd("ide");
  13675. messageSends: ["do:", "add:"]
  13676. }),
  13677. globals.Collection);
  13678. smalltalk.addMethod(
  13679. smalltalk.method({
  13680. selector: "allSatisfy:",
  13681. protocol: 'enumerating',
  13682. fn: function (aBlock){
  13683. var self=this;
  13684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13685. return smalltalk.withContext(function($ctx1) {
  13686. //>>excludeEnd("ctx");
  13687. var $1;
  13688. var $early={};
  13689. try {
  13690. self._do_((function(each){
  13691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13692. return smalltalk.withContext(function($ctx2) {
  13693. //>>excludeEnd("ctx");
  13694. $1=_st(aBlock)._value_(each);
  13695. if(! smalltalk.assert($1)){
  13696. throw $early=[false];
  13697. };
  13698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13700. //>>excludeEnd("ctx");
  13701. }));
  13702. return true;
  13703. }
  13704. catch(e) {if(e===$early)return e[0]; throw e}
  13705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13706. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},globals.Collection)});
  13707. //>>excludeEnd("ctx");
  13708. },
  13709. //>>excludeStart("ide", pragmas.excludeIdeData);
  13710. args: ["aBlock"],
  13711. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  13712. referencedClasses: [],
  13713. //>>excludeEnd("ide");
  13714. messageSends: ["do:", "ifFalse:", "value:"]
  13715. }),
  13716. globals.Collection);
  13717. smalltalk.addMethod(
  13718. smalltalk.method({
  13719. selector: "anyOne",
  13720. protocol: 'adding/removing',
  13721. fn: function (){
  13722. var self=this;
  13723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13724. return smalltalk.withContext(function($ctx1) {
  13725. //>>excludeEnd("ctx");
  13726. var $early={};
  13727. try {
  13728. self._ifEmpty_((function(){
  13729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13730. return smalltalk.withContext(function($ctx2) {
  13731. //>>excludeEnd("ctx");
  13732. return self._error_("Collection is empty");
  13733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13735. //>>excludeEnd("ctx");
  13736. }));
  13737. self._do_((function(each){
  13738. throw $early=[each];
  13739. }));
  13740. return self;
  13741. }
  13742. catch(e) {if(e===$early)return e[0]; throw e}
  13743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13744. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},globals.Collection)});
  13745. //>>excludeEnd("ctx");
  13746. },
  13747. //>>excludeStart("ide", pragmas.excludeIdeData);
  13748. args: [],
  13749. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  13750. referencedClasses: [],
  13751. //>>excludeEnd("ide");
  13752. messageSends: ["ifEmpty:", "error:", "do:"]
  13753. }),
  13754. globals.Collection);
  13755. smalltalk.addMethod(
  13756. smalltalk.method({
  13757. selector: "anySatisfy:",
  13758. protocol: 'enumerating',
  13759. fn: function (aBlock){
  13760. var self=this;
  13761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13762. return smalltalk.withContext(function($ctx1) {
  13763. //>>excludeEnd("ctx");
  13764. var $1;
  13765. var $early={};
  13766. try {
  13767. self._do_((function(each){
  13768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13769. return smalltalk.withContext(function($ctx2) {
  13770. //>>excludeEnd("ctx");
  13771. $1=_st(aBlock)._value_(each);
  13772. if(smalltalk.assert($1)){
  13773. throw $early=[true];
  13774. };
  13775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13777. //>>excludeEnd("ctx");
  13778. }));
  13779. return false;
  13780. }
  13781. catch(e) {if(e===$early)return e[0]; throw e}
  13782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13783. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},globals.Collection)});
  13784. //>>excludeEnd("ctx");
  13785. },
  13786. //>>excludeStart("ide", pragmas.excludeIdeData);
  13787. args: ["aBlock"],
  13788. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  13789. referencedClasses: [],
  13790. //>>excludeEnd("ide");
  13791. messageSends: ["do:", "ifTrue:", "value:"]
  13792. }),
  13793. globals.Collection);
  13794. smalltalk.addMethod(
  13795. smalltalk.method({
  13796. selector: "asArray",
  13797. protocol: 'converting',
  13798. fn: function (){
  13799. var self=this;
  13800. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  13801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13802. return smalltalk.withContext(function($ctx1) {
  13803. //>>excludeEnd("ctx");
  13804. var $1;
  13805. $1=_st($Array())._withAll_(self);
  13806. return $1;
  13807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13808. }, function($ctx1) {$ctx1.fill(self,"asArray",{},globals.Collection)});
  13809. //>>excludeEnd("ctx");
  13810. },
  13811. //>>excludeStart("ide", pragmas.excludeIdeData);
  13812. args: [],
  13813. source: "asArray\x0a\x09^ Array withAll: self",
  13814. referencedClasses: ["Array"],
  13815. //>>excludeEnd("ide");
  13816. messageSends: ["withAll:"]
  13817. }),
  13818. globals.Collection);
  13819. smalltalk.addMethod(
  13820. smalltalk.method({
  13821. selector: "asJSON",
  13822. protocol: 'converting',
  13823. fn: function (){
  13824. var self=this;
  13825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13826. return smalltalk.withContext(function($ctx1) {
  13827. //>>excludeEnd("ctx");
  13828. var $1;
  13829. $1=_st(self._asArray())._collect_((function(each){
  13830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13831. return smalltalk.withContext(function($ctx2) {
  13832. //>>excludeEnd("ctx");
  13833. return _st(each)._asJSON();
  13834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13836. //>>excludeEnd("ctx");
  13837. }));
  13838. return $1;
  13839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13840. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.Collection)});
  13841. //>>excludeEnd("ctx");
  13842. },
  13843. //>>excludeStart("ide", pragmas.excludeIdeData);
  13844. args: [],
  13845. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  13846. referencedClasses: [],
  13847. //>>excludeEnd("ide");
  13848. messageSends: ["collect:", "asArray", "asJSON"]
  13849. }),
  13850. globals.Collection);
  13851. smalltalk.addMethod(
  13852. smalltalk.method({
  13853. selector: "asOrderedCollection",
  13854. protocol: 'converting',
  13855. fn: function (){
  13856. var self=this;
  13857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13858. return smalltalk.withContext(function($ctx1) {
  13859. //>>excludeEnd("ctx");
  13860. var $1;
  13861. $1=self._asArray();
  13862. return $1;
  13863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13864. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},globals.Collection)});
  13865. //>>excludeEnd("ctx");
  13866. },
  13867. //>>excludeStart("ide", pragmas.excludeIdeData);
  13868. args: [],
  13869. source: "asOrderedCollection\x0a\x09^ self asArray",
  13870. referencedClasses: [],
  13871. //>>excludeEnd("ide");
  13872. messageSends: ["asArray"]
  13873. }),
  13874. globals.Collection);
  13875. smalltalk.addMethod(
  13876. smalltalk.method({
  13877. selector: "asSet",
  13878. protocol: 'converting',
  13879. fn: function (){
  13880. var self=this;
  13881. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  13882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13883. return smalltalk.withContext(function($ctx1) {
  13884. //>>excludeEnd("ctx");
  13885. var $1;
  13886. $1=_st($Set())._withAll_(self);
  13887. return $1;
  13888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13889. }, function($ctx1) {$ctx1.fill(self,"asSet",{},globals.Collection)});
  13890. //>>excludeEnd("ctx");
  13891. },
  13892. //>>excludeStart("ide", pragmas.excludeIdeData);
  13893. args: [],
  13894. source: "asSet\x0a\x09^ Set withAll: self",
  13895. referencedClasses: ["Set"],
  13896. //>>excludeEnd("ide");
  13897. messageSends: ["withAll:"]
  13898. }),
  13899. globals.Collection);
  13900. smalltalk.addMethod(
  13901. smalltalk.method({
  13902. selector: "collect:",
  13903. protocol: 'enumerating',
  13904. fn: function (aBlock){
  13905. var self=this;
  13906. var stream;
  13907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13908. return smalltalk.withContext(function($ctx1) {
  13909. //>>excludeEnd("ctx");
  13910. var $1;
  13911. stream=_st(_st(self._class())._new())._writeStream();
  13912. self._do_((function(each){
  13913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13914. return smalltalk.withContext(function($ctx2) {
  13915. //>>excludeEnd("ctx");
  13916. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  13917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13919. //>>excludeEnd("ctx");
  13920. }));
  13921. $1=_st(stream)._contents();
  13922. return $1;
  13923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13924. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},globals.Collection)});
  13925. //>>excludeEnd("ctx");
  13926. },
  13927. //>>excludeStart("ide", pragmas.excludeIdeData);
  13928. args: ["aBlock"],
  13929. 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",
  13930. referencedClasses: [],
  13931. //>>excludeEnd("ide");
  13932. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  13933. }),
  13934. globals.Collection);
  13935. smalltalk.addMethod(
  13936. smalltalk.method({
  13937. selector: "contains:",
  13938. protocol: 'testing',
  13939. fn: function (aBlock){
  13940. var self=this;
  13941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13942. return smalltalk.withContext(function($ctx1) {
  13943. //>>excludeEnd("ctx");
  13944. var $1;
  13945. self._deprecatedAPI();
  13946. $1=self._anySatisfy_(aBlock);
  13947. return $1;
  13948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13949. }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},globals.Collection)});
  13950. //>>excludeEnd("ctx");
  13951. },
  13952. //>>excludeStart("ide", pragmas.excludeIdeData);
  13953. args: ["aBlock"],
  13954. source: "contains: aBlock\x0a\x09self deprecatedAPI.\x0a\x0a\x09^ self anySatisfy: aBlock",
  13955. referencedClasses: [],
  13956. //>>excludeEnd("ide");
  13957. messageSends: ["deprecatedAPI", "anySatisfy:"]
  13958. }),
  13959. globals.Collection);
  13960. smalltalk.addMethod(
  13961. smalltalk.method({
  13962. selector: "copyWith:",
  13963. protocol: 'copying',
  13964. fn: function (anObject){
  13965. var self=this;
  13966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13967. return smalltalk.withContext(function($ctx1) {
  13968. //>>excludeEnd("ctx");
  13969. var $2,$3,$1;
  13970. $2=self._copy();
  13971. _st($2)._add_(anObject);
  13972. $3=_st($2)._yourself();
  13973. $1=$3;
  13974. return $1;
  13975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13976. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},globals.Collection)});
  13977. //>>excludeEnd("ctx");
  13978. },
  13979. //>>excludeStart("ide", pragmas.excludeIdeData);
  13980. args: ["anObject"],
  13981. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  13982. referencedClasses: [],
  13983. //>>excludeEnd("ide");
  13984. messageSends: ["add:", "copy", "yourself"]
  13985. }),
  13986. globals.Collection);
  13987. smalltalk.addMethod(
  13988. smalltalk.method({
  13989. selector: "copyWithAll:",
  13990. protocol: 'copying',
  13991. fn: function (aCollection){
  13992. var self=this;
  13993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13994. return smalltalk.withContext(function($ctx1) {
  13995. //>>excludeEnd("ctx");
  13996. var $2,$3,$1;
  13997. $2=self._copy();
  13998. _st($2)._addAll_(aCollection);
  13999. $3=_st($2)._yourself();
  14000. $1=$3;
  14001. return $1;
  14002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14003. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},globals.Collection)});
  14004. //>>excludeEnd("ctx");
  14005. },
  14006. //>>excludeStart("ide", pragmas.excludeIdeData);
  14007. args: ["aCollection"],
  14008. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  14009. referencedClasses: [],
  14010. //>>excludeEnd("ide");
  14011. messageSends: ["addAll:", "copy", "yourself"]
  14012. }),
  14013. globals.Collection);
  14014. smalltalk.addMethod(
  14015. smalltalk.method({
  14016. selector: "copyWithoutAll:",
  14017. protocol: 'copying',
  14018. fn: function (aCollection){
  14019. var self=this;
  14020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14021. return smalltalk.withContext(function($ctx1) {
  14022. //>>excludeEnd("ctx");
  14023. var $1;
  14024. $1=self._reject_((function(each){
  14025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14026. return smalltalk.withContext(function($ctx2) {
  14027. //>>excludeEnd("ctx");
  14028. return _st(aCollection)._includes_(each);
  14029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14031. //>>excludeEnd("ctx");
  14032. }));
  14033. return $1;
  14034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14035. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},globals.Collection)});
  14036. //>>excludeEnd("ctx");
  14037. },
  14038. //>>excludeStart("ide", pragmas.excludeIdeData);
  14039. args: ["aCollection"],
  14040. 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 ]",
  14041. referencedClasses: [],
  14042. //>>excludeEnd("ide");
  14043. messageSends: ["reject:", "includes:"]
  14044. }),
  14045. globals.Collection);
  14046. smalltalk.addMethod(
  14047. smalltalk.method({
  14048. selector: "detect:",
  14049. protocol: 'enumerating',
  14050. fn: function (aBlock){
  14051. var self=this;
  14052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14053. return smalltalk.withContext(function($ctx1) {
  14054. //>>excludeEnd("ctx");
  14055. var $1;
  14056. $1=self._detect_ifNone_(aBlock,(function(){
  14057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14058. return smalltalk.withContext(function($ctx2) {
  14059. //>>excludeEnd("ctx");
  14060. return self._errorNotFound();
  14061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14063. //>>excludeEnd("ctx");
  14064. }));
  14065. return $1;
  14066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14067. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},globals.Collection)});
  14068. //>>excludeEnd("ctx");
  14069. },
  14070. //>>excludeStart("ide", pragmas.excludeIdeData);
  14071. args: ["aBlock"],
  14072. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  14073. referencedClasses: [],
  14074. //>>excludeEnd("ide");
  14075. messageSends: ["detect:ifNone:", "errorNotFound"]
  14076. }),
  14077. globals.Collection);
  14078. smalltalk.addMethod(
  14079. smalltalk.method({
  14080. selector: "detect:ifNone:",
  14081. protocol: 'enumerating',
  14082. fn: function (aBlock,anotherBlock){
  14083. var self=this;
  14084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14085. return smalltalk.withContext(function($ctx1) {
  14086. //>>excludeEnd("ctx");
  14087. self._subclassResponsibility();
  14088. return self;
  14089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14090. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)});
  14091. //>>excludeEnd("ctx");
  14092. },
  14093. //>>excludeStart("ide", pragmas.excludeIdeData);
  14094. args: ["aBlock", "anotherBlock"],
  14095. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  14096. referencedClasses: [],
  14097. //>>excludeEnd("ide");
  14098. messageSends: ["subclassResponsibility"]
  14099. }),
  14100. globals.Collection);
  14101. smalltalk.addMethod(
  14102. smalltalk.method({
  14103. selector: "do:",
  14104. protocol: 'enumerating',
  14105. fn: function (aBlock){
  14106. var self=this;
  14107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14108. return smalltalk.withContext(function($ctx1) {
  14109. //>>excludeEnd("ctx");
  14110. self._subclassResponsibility();
  14111. return self;
  14112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14113. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Collection)});
  14114. //>>excludeEnd("ctx");
  14115. },
  14116. //>>excludeStart("ide", pragmas.excludeIdeData);
  14117. args: ["aBlock"],
  14118. source: "do: aBlock\x0a\x09self subclassResponsibility",
  14119. referencedClasses: [],
  14120. //>>excludeEnd("ide");
  14121. messageSends: ["subclassResponsibility"]
  14122. }),
  14123. globals.Collection);
  14124. smalltalk.addMethod(
  14125. smalltalk.method({
  14126. selector: "do:separatedBy:",
  14127. protocol: 'enumerating',
  14128. fn: function (aBlock,anotherBlock){
  14129. var self=this;
  14130. var actionBeforeElement;
  14131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14132. return smalltalk.withContext(function($ctx1) {
  14133. //>>excludeEnd("ctx");
  14134. actionBeforeElement=(function(){
  14135. actionBeforeElement=anotherBlock;
  14136. return actionBeforeElement;
  14137. });
  14138. self._do_((function(each){
  14139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14140. return smalltalk.withContext(function($ctx2) {
  14141. //>>excludeEnd("ctx");
  14142. _st(actionBeforeElement)._value();
  14143. return _st(aBlock)._value_(each);
  14144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14145. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  14146. //>>excludeEnd("ctx");
  14147. }));
  14148. return self;
  14149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14150. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},globals.Collection)});
  14151. //>>excludeEnd("ctx");
  14152. },
  14153. //>>excludeStart("ide", pragmas.excludeIdeData);
  14154. args: ["aBlock", "anotherBlock"],
  14155. 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 ]",
  14156. referencedClasses: [],
  14157. //>>excludeEnd("ide");
  14158. messageSends: ["do:", "value", "value:"]
  14159. }),
  14160. globals.Collection);
  14161. smalltalk.addMethod(
  14162. smalltalk.method({
  14163. selector: "errorNotFound",
  14164. protocol: 'error handling',
  14165. fn: function (){
  14166. var self=this;
  14167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14168. return smalltalk.withContext(function($ctx1) {
  14169. //>>excludeEnd("ctx");
  14170. self._error_("Object is not in the collection");
  14171. return self;
  14172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14173. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},globals.Collection)});
  14174. //>>excludeEnd("ctx");
  14175. },
  14176. //>>excludeStart("ide", pragmas.excludeIdeData);
  14177. args: [],
  14178. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  14179. referencedClasses: [],
  14180. //>>excludeEnd("ide");
  14181. messageSends: ["error:"]
  14182. }),
  14183. globals.Collection);
  14184. smalltalk.addMethod(
  14185. smalltalk.method({
  14186. selector: "ifEmpty:",
  14187. protocol: 'testing',
  14188. fn: function (aBlock){
  14189. var self=this;
  14190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14191. return smalltalk.withContext(function($ctx1) {
  14192. //>>excludeEnd("ctx");
  14193. var $2,$1;
  14194. $2=self._isEmpty();
  14195. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  14196. return self;
  14197. }));
  14198. return $1;
  14199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14200. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},globals.Collection)});
  14201. //>>excludeEnd("ctx");
  14202. },
  14203. //>>excludeStart("ide", pragmas.excludeIdeData);
  14204. args: ["aBlock"],
  14205. 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. \x0a\x09Note 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: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
  14206. referencedClasses: [],
  14207. //>>excludeEnd("ide");
  14208. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  14209. }),
  14210. globals.Collection);
  14211. smalltalk.addMethod(
  14212. smalltalk.method({
  14213. selector: "ifEmpty:ifNotEmpty:",
  14214. protocol: 'testing',
  14215. fn: function (aBlock,anotherBlock){
  14216. var self=this;
  14217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14218. return smalltalk.withContext(function($ctx1) {
  14219. //>>excludeEnd("ctx");
  14220. var $2,$1;
  14221. $2=self._isEmpty();
  14222. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  14223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14224. return smalltalk.withContext(function($ctx2) {
  14225. //>>excludeEnd("ctx");
  14226. return _st(anotherBlock)._value_(self);
  14227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14229. //>>excludeEnd("ctx");
  14230. }));
  14231. return $1;
  14232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14233. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)});
  14234. //>>excludeEnd("ctx");
  14235. },
  14236. //>>excludeStart("ide", pragmas.excludeIdeData);
  14237. args: ["aBlock", "anotherBlock"],
  14238. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  14239. referencedClasses: [],
  14240. //>>excludeEnd("ide");
  14241. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  14242. }),
  14243. globals.Collection);
  14244. smalltalk.addMethod(
  14245. smalltalk.method({
  14246. selector: "ifNotEmpty:",
  14247. protocol: 'testing',
  14248. fn: function (aBlock){
  14249. var self=this;
  14250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14251. return smalltalk.withContext(function($ctx1) {
  14252. //>>excludeEnd("ctx");
  14253. var $2,$1;
  14254. $2=self._notEmpty();
  14255. if(smalltalk.assert($2)){
  14256. $1=_st(aBlock)._value_(self);
  14257. } else {
  14258. $1=self;
  14259. };
  14260. return $1;
  14261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14262. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},globals.Collection)});
  14263. //>>excludeEnd("ctx");
  14264. },
  14265. //>>excludeStart("ide", pragmas.excludeIdeData);
  14266. args: ["aBlock"],
  14267. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  14268. referencedClasses: [],
  14269. //>>excludeEnd("ide");
  14270. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  14271. }),
  14272. globals.Collection);
  14273. smalltalk.addMethod(
  14274. smalltalk.method({
  14275. selector: "ifNotEmpty:ifEmpty:",
  14276. protocol: 'testing',
  14277. fn: function (aBlock,anotherBlock){
  14278. var self=this;
  14279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14280. return smalltalk.withContext(function($ctx1) {
  14281. //>>excludeEnd("ctx");
  14282. var $2,$1;
  14283. $2=self._notEmpty();
  14284. $1=_st($2)._ifTrue_ifFalse_((function(){
  14285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14286. return smalltalk.withContext(function($ctx2) {
  14287. //>>excludeEnd("ctx");
  14288. return _st(aBlock)._value_(self);
  14289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14291. //>>excludeEnd("ctx");
  14292. }),anotherBlock);
  14293. return $1;
  14294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14295. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)});
  14296. //>>excludeEnd("ctx");
  14297. },
  14298. //>>excludeStart("ide", pragmas.excludeIdeData);
  14299. args: ["aBlock", "anotherBlock"],
  14300. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  14301. referencedClasses: [],
  14302. //>>excludeEnd("ide");
  14303. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  14304. }),
  14305. globals.Collection);
  14306. smalltalk.addMethod(
  14307. smalltalk.method({
  14308. selector: "includes:",
  14309. protocol: 'testing',
  14310. fn: function (anObject){
  14311. var self=this;
  14312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14313. return smalltalk.withContext(function($ctx1) {
  14314. //>>excludeEnd("ctx");
  14315. var $1;
  14316. $1=self._anySatisfy_((function(each){
  14317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14318. return smalltalk.withContext(function($ctx2) {
  14319. //>>excludeEnd("ctx");
  14320. return _st(each).__eq(anObject);
  14321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14323. //>>excludeEnd("ctx");
  14324. }));
  14325. return $1;
  14326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14327. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.Collection)});
  14328. //>>excludeEnd("ctx");
  14329. },
  14330. //>>excludeStart("ide", pragmas.excludeIdeData);
  14331. args: ["anObject"],
  14332. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  14333. referencedClasses: [],
  14334. //>>excludeEnd("ide");
  14335. messageSends: ["anySatisfy:", "="]
  14336. }),
  14337. globals.Collection);
  14338. smalltalk.addMethod(
  14339. smalltalk.method({
  14340. selector: "inject:into:",
  14341. protocol: 'enumerating',
  14342. fn: function (anObject,aBlock){
  14343. var self=this;
  14344. var result;
  14345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14346. return smalltalk.withContext(function($ctx1) {
  14347. //>>excludeEnd("ctx");
  14348. var $1;
  14349. result=anObject;
  14350. self._do_((function(each){
  14351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14352. return smalltalk.withContext(function($ctx2) {
  14353. //>>excludeEnd("ctx");
  14354. result=_st(aBlock)._value_value_(result,each);
  14355. return result;
  14356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14358. //>>excludeEnd("ctx");
  14359. }));
  14360. $1=result;
  14361. return $1;
  14362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14363. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},globals.Collection)});
  14364. //>>excludeEnd("ctx");
  14365. },
  14366. //>>excludeStart("ide", pragmas.excludeIdeData);
  14367. args: ["anObject", "aBlock"],
  14368. 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",
  14369. referencedClasses: [],
  14370. //>>excludeEnd("ide");
  14371. messageSends: ["do:", "value:value:"]
  14372. }),
  14373. globals.Collection);
  14374. smalltalk.addMethod(
  14375. smalltalk.method({
  14376. selector: "intersection:",
  14377. protocol: 'enumerating',
  14378. fn: function (aCollection){
  14379. var self=this;
  14380. var set,outputSet;
  14381. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  14382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14383. return smalltalk.withContext(function($ctx1) {
  14384. //>>excludeEnd("ctx");
  14385. var $2,$1,$3;
  14386. set=self._asSet();
  14387. outputSet=_st($Set())._new();
  14388. _st(aCollection)._do_((function(each){
  14389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14390. return smalltalk.withContext(function($ctx2) {
  14391. //>>excludeEnd("ctx");
  14392. $2=_st(set)._includes_(each);
  14393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14394. $ctx2.sendIdx["includes:"]=1;
  14395. //>>excludeEnd("ctx");
  14396. $1=_st($2)._and_((function(){
  14397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14398. return smalltalk.withContext(function($ctx3) {
  14399. //>>excludeEnd("ctx");
  14400. return _st(_st(outputSet)._includes_(each))._not();
  14401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14402. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14403. //>>excludeEnd("ctx");
  14404. }));
  14405. if(smalltalk.assert($1)){
  14406. return _st(outputSet)._add_(each);
  14407. };
  14408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14410. //>>excludeEnd("ctx");
  14411. }));
  14412. $3=_st(self._class())._withAll_(_st(outputSet)._asArray());
  14413. return $3;
  14414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14415. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},globals.Collection)});
  14416. //>>excludeEnd("ctx");
  14417. },
  14418. //>>excludeStart("ide", pragmas.excludeIdeData);
  14419. args: ["aCollection"],
  14420. 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",
  14421. referencedClasses: ["Set"],
  14422. //>>excludeEnd("ide");
  14423. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  14424. }),
  14425. globals.Collection);
  14426. smalltalk.addMethod(
  14427. smalltalk.method({
  14428. selector: "isEmpty",
  14429. protocol: 'testing',
  14430. fn: function (){
  14431. var self=this;
  14432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14433. return smalltalk.withContext(function($ctx1) {
  14434. //>>excludeEnd("ctx");
  14435. var $1;
  14436. $1=_st(self._size()).__eq((0));
  14437. return $1;
  14438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14439. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Collection)});
  14440. //>>excludeEnd("ctx");
  14441. },
  14442. //>>excludeStart("ide", pragmas.excludeIdeData);
  14443. args: [],
  14444. source: "isEmpty\x0a\x09^ self size = 0",
  14445. referencedClasses: [],
  14446. //>>excludeEnd("ide");
  14447. messageSends: ["=", "size"]
  14448. }),
  14449. globals.Collection);
  14450. smalltalk.addMethod(
  14451. smalltalk.method({
  14452. selector: "noneSatisfy:",
  14453. protocol: 'enumerating',
  14454. fn: function (aBlock){
  14455. var self=this;
  14456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14457. return smalltalk.withContext(function($ctx1) {
  14458. //>>excludeEnd("ctx");
  14459. var $1;
  14460. var $early={};
  14461. try {
  14462. self._do_((function(item){
  14463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14464. return smalltalk.withContext(function($ctx2) {
  14465. //>>excludeEnd("ctx");
  14466. $1=_st(aBlock)._value_(item);
  14467. if(smalltalk.assert($1)){
  14468. throw $early=[false];
  14469. };
  14470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14471. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  14472. //>>excludeEnd("ctx");
  14473. }));
  14474. return true;
  14475. }
  14476. catch(e) {if(e===$early)return e[0]; throw e}
  14477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14478. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},globals.Collection)});
  14479. //>>excludeEnd("ctx");
  14480. },
  14481. //>>excludeStart("ide", pragmas.excludeIdeData);
  14482. args: ["aBlock"],
  14483. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  14484. referencedClasses: [],
  14485. //>>excludeEnd("ide");
  14486. messageSends: ["do:", "ifTrue:", "value:"]
  14487. }),
  14488. globals.Collection);
  14489. smalltalk.addMethod(
  14490. smalltalk.method({
  14491. selector: "notEmpty",
  14492. protocol: 'testing',
  14493. fn: function (){
  14494. var self=this;
  14495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14496. return smalltalk.withContext(function($ctx1) {
  14497. //>>excludeEnd("ctx");
  14498. var $1;
  14499. $1=_st(self._isEmpty())._not();
  14500. return $1;
  14501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14502. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},globals.Collection)});
  14503. //>>excludeEnd("ctx");
  14504. },
  14505. //>>excludeStart("ide", pragmas.excludeIdeData);
  14506. args: [],
  14507. source: "notEmpty\x0a\x09^ self isEmpty not",
  14508. referencedClasses: [],
  14509. //>>excludeEnd("ide");
  14510. messageSends: ["not", "isEmpty"]
  14511. }),
  14512. globals.Collection);
  14513. smalltalk.addMethod(
  14514. smalltalk.method({
  14515. selector: "occurrencesOf:",
  14516. protocol: 'accessing',
  14517. fn: function (anObject){
  14518. var self=this;
  14519. var tally;
  14520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14521. return smalltalk.withContext(function($ctx1) {
  14522. //>>excludeEnd("ctx");
  14523. var $1,$2;
  14524. tally=(0);
  14525. self._do_((function(each){
  14526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14527. return smalltalk.withContext(function($ctx2) {
  14528. //>>excludeEnd("ctx");
  14529. $1=_st(anObject).__eq(each);
  14530. if(smalltalk.assert($1)){
  14531. tally=_st(tally).__plus((1));
  14532. return tally;
  14533. };
  14534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14536. //>>excludeEnd("ctx");
  14537. }));
  14538. $2=tally;
  14539. return $2;
  14540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14541. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},globals.Collection)});
  14542. //>>excludeEnd("ctx");
  14543. },
  14544. //>>excludeStart("ide", pragmas.excludeIdeData);
  14545. args: ["anObject"],
  14546. 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",
  14547. referencedClasses: [],
  14548. //>>excludeEnd("ide");
  14549. messageSends: ["do:", "ifTrue:", "=", "+"]
  14550. }),
  14551. globals.Collection);
  14552. smalltalk.addMethod(
  14553. smalltalk.method({
  14554. selector: "putOn:",
  14555. protocol: 'streaming',
  14556. fn: function (aStream){
  14557. var self=this;
  14558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14559. return smalltalk.withContext(function($ctx1) {
  14560. //>>excludeEnd("ctx");
  14561. self._do_((function(each){
  14562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14563. return smalltalk.withContext(function($ctx2) {
  14564. //>>excludeEnd("ctx");
  14565. return _st(each)._putOn_(aStream);
  14566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14568. //>>excludeEnd("ctx");
  14569. }));
  14570. return self;
  14571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14572. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Collection)});
  14573. //>>excludeEnd("ctx");
  14574. },
  14575. //>>excludeStart("ide", pragmas.excludeIdeData);
  14576. args: ["aStream"],
  14577. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  14578. referencedClasses: [],
  14579. //>>excludeEnd("ide");
  14580. messageSends: ["do:", "putOn:"]
  14581. }),
  14582. globals.Collection);
  14583. smalltalk.addMethod(
  14584. smalltalk.method({
  14585. selector: "reject:",
  14586. protocol: 'enumerating',
  14587. fn: function (aBlock){
  14588. var self=this;
  14589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14590. return smalltalk.withContext(function($ctx1) {
  14591. //>>excludeEnd("ctx");
  14592. var $1;
  14593. $1=self._select_((function(each){
  14594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14595. return smalltalk.withContext(function($ctx2) {
  14596. //>>excludeEnd("ctx");
  14597. return _st(_st(aBlock)._value_(each)).__eq(false);
  14598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14600. //>>excludeEnd("ctx");
  14601. }));
  14602. return $1;
  14603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14604. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},globals.Collection)});
  14605. //>>excludeEnd("ctx");
  14606. },
  14607. //>>excludeStart("ide", pragmas.excludeIdeData);
  14608. args: ["aBlock"],
  14609. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  14610. referencedClasses: [],
  14611. //>>excludeEnd("ide");
  14612. messageSends: ["select:", "=", "value:"]
  14613. }),
  14614. globals.Collection);
  14615. smalltalk.addMethod(
  14616. smalltalk.method({
  14617. selector: "remove:",
  14618. protocol: 'adding/removing',
  14619. fn: function (anObject){
  14620. var self=this;
  14621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14622. return smalltalk.withContext(function($ctx1) {
  14623. //>>excludeEnd("ctx");
  14624. var $1;
  14625. $1=self._remove_ifAbsent_(anObject,(function(){
  14626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14627. return smalltalk.withContext(function($ctx2) {
  14628. //>>excludeEnd("ctx");
  14629. return self._errorNotFound();
  14630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14632. //>>excludeEnd("ctx");
  14633. }));
  14634. return $1;
  14635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14636. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.Collection)});
  14637. //>>excludeEnd("ctx");
  14638. },
  14639. //>>excludeStart("ide", pragmas.excludeIdeData);
  14640. args: ["anObject"],
  14641. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  14642. referencedClasses: [],
  14643. //>>excludeEnd("ide");
  14644. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  14645. }),
  14646. globals.Collection);
  14647. smalltalk.addMethod(
  14648. smalltalk.method({
  14649. selector: "remove:ifAbsent:",
  14650. protocol: 'adding/removing',
  14651. fn: function (anObject,aBlock){
  14652. var self=this;
  14653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14654. return smalltalk.withContext(function($ctx1) {
  14655. //>>excludeEnd("ctx");
  14656. self._subclassResponsibility();
  14657. return self;
  14658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14659. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.Collection)});
  14660. //>>excludeEnd("ctx");
  14661. },
  14662. //>>excludeStart("ide", pragmas.excludeIdeData);
  14663. args: ["anObject", "aBlock"],
  14664. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  14665. referencedClasses: [],
  14666. //>>excludeEnd("ide");
  14667. messageSends: ["subclassResponsibility"]
  14668. }),
  14669. globals.Collection);
  14670. smalltalk.addMethod(
  14671. smalltalk.method({
  14672. selector: "removeAll",
  14673. protocol: 'adding/removing',
  14674. fn: function (){
  14675. var self=this;
  14676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14677. return smalltalk.withContext(function($ctx1) {
  14678. //>>excludeEnd("ctx");
  14679. self._subclassResponsibility();
  14680. return self;
  14681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14682. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Collection)});
  14683. //>>excludeEnd("ctx");
  14684. },
  14685. //>>excludeStart("ide", pragmas.excludeIdeData);
  14686. args: [],
  14687. source: "removeAll\x0a\x09self subclassResponsibility",
  14688. referencedClasses: [],
  14689. //>>excludeEnd("ide");
  14690. messageSends: ["subclassResponsibility"]
  14691. }),
  14692. globals.Collection);
  14693. smalltalk.addMethod(
  14694. smalltalk.method({
  14695. selector: "select:",
  14696. protocol: 'enumerating',
  14697. fn: function (aBlock){
  14698. var self=this;
  14699. var stream;
  14700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14701. return smalltalk.withContext(function($ctx1) {
  14702. //>>excludeEnd("ctx");
  14703. var $1,$2;
  14704. stream=_st(_st(self._class())._new())._writeStream();
  14705. self._do_((function(each){
  14706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14707. return smalltalk.withContext(function($ctx2) {
  14708. //>>excludeEnd("ctx");
  14709. $1=_st(aBlock)._value_(each);
  14710. if(smalltalk.assert($1)){
  14711. return _st(stream)._nextPut_(each);
  14712. };
  14713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14714. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14715. //>>excludeEnd("ctx");
  14716. }));
  14717. $2=_st(stream)._contents();
  14718. return $2;
  14719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14720. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},globals.Collection)});
  14721. //>>excludeEnd("ctx");
  14722. },
  14723. //>>excludeStart("ide", pragmas.excludeIdeData);
  14724. args: ["aBlock"],
  14725. 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",
  14726. referencedClasses: [],
  14727. //>>excludeEnd("ide");
  14728. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  14729. }),
  14730. globals.Collection);
  14731. smalltalk.addMethod(
  14732. smalltalk.method({
  14733. selector: "select:thenCollect:",
  14734. protocol: 'enumerating',
  14735. fn: function (selectBlock,collectBlock){
  14736. var self=this;
  14737. var stream;
  14738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14739. return smalltalk.withContext(function($ctx1) {
  14740. //>>excludeEnd("ctx");
  14741. var $1,$2;
  14742. stream=_st(_st(self._class())._new())._writeStream();
  14743. self._do_((function(each){
  14744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14745. return smalltalk.withContext(function($ctx2) {
  14746. //>>excludeEnd("ctx");
  14747. $1=_st(selectBlock)._value_(each);
  14748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14749. $ctx2.sendIdx["value:"]=1;
  14750. //>>excludeEnd("ctx");
  14751. if(smalltalk.assert($1)){
  14752. return _st(stream)._nextPut_(_st(collectBlock)._value_(each));
  14753. };
  14754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14756. //>>excludeEnd("ctx");
  14757. }));
  14758. $2=_st(stream)._contents();
  14759. return $2;
  14760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14761. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},globals.Collection)});
  14762. //>>excludeEnd("ctx");
  14763. },
  14764. //>>excludeStart("ide", pragmas.excludeIdeData);
  14765. args: ["selectBlock", "collectBlock"],
  14766. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  14767. referencedClasses: [],
  14768. //>>excludeEnd("ide");
  14769. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  14770. }),
  14771. globals.Collection);
  14772. smalltalk.addMethod(
  14773. smalltalk.method({
  14774. selector: "size",
  14775. protocol: 'accessing',
  14776. fn: function (){
  14777. var self=this;
  14778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14779. return smalltalk.withContext(function($ctx1) {
  14780. //>>excludeEnd("ctx");
  14781. self._subclassResponsibility();
  14782. return self;
  14783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14784. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Collection)});
  14785. //>>excludeEnd("ctx");
  14786. },
  14787. //>>excludeStart("ide", pragmas.excludeIdeData);
  14788. args: [],
  14789. source: "size\x0a\x09self subclassResponsibility",
  14790. referencedClasses: [],
  14791. //>>excludeEnd("ide");
  14792. messageSends: ["subclassResponsibility"]
  14793. }),
  14794. globals.Collection);
  14795. smalltalk.addMethod(
  14796. smalltalk.method({
  14797. selector: "heliosClass",
  14798. protocol: 'helios',
  14799. fn: function (){
  14800. var self=this;
  14801. return "collection";
  14802. },
  14803. //>>excludeStart("ide", pragmas.excludeIdeData);
  14804. args: [],
  14805. source: "heliosClass\x0a\x09^ 'collection'",
  14806. referencedClasses: [],
  14807. //>>excludeEnd("ide");
  14808. messageSends: []
  14809. }),
  14810. globals.Collection.klass);
  14811. smalltalk.addMethod(
  14812. smalltalk.method({
  14813. selector: "new:",
  14814. protocol: 'instance creation',
  14815. fn: function (anInteger){
  14816. var self=this;
  14817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14818. return smalltalk.withContext(function($ctx1) {
  14819. //>>excludeEnd("ctx");
  14820. var $1;
  14821. $1=self._new();
  14822. return $1;
  14823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14824. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Collection.klass)});
  14825. //>>excludeEnd("ctx");
  14826. },
  14827. //>>excludeStart("ide", pragmas.excludeIdeData);
  14828. args: ["anInteger"],
  14829. source: "new: anInteger\x0a\x09^ self new",
  14830. referencedClasses: [],
  14831. //>>excludeEnd("ide");
  14832. messageSends: ["new"]
  14833. }),
  14834. globals.Collection.klass);
  14835. smalltalk.addMethod(
  14836. smalltalk.method({
  14837. selector: "with:",
  14838. protocol: 'instance creation',
  14839. fn: function (anObject){
  14840. var self=this;
  14841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14842. return smalltalk.withContext(function($ctx1) {
  14843. //>>excludeEnd("ctx");
  14844. var $2,$3,$1;
  14845. $2=self._new();
  14846. _st($2)._add_(anObject);
  14847. $3=_st($2)._yourself();
  14848. $1=$3;
  14849. return $1;
  14850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14851. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Collection.klass)});
  14852. //>>excludeEnd("ctx");
  14853. },
  14854. //>>excludeStart("ide", pragmas.excludeIdeData);
  14855. args: ["anObject"],
  14856. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  14857. referencedClasses: [],
  14858. //>>excludeEnd("ide");
  14859. messageSends: ["add:", "new", "yourself"]
  14860. }),
  14861. globals.Collection.klass);
  14862. smalltalk.addMethod(
  14863. smalltalk.method({
  14864. selector: "with:with:",
  14865. protocol: 'instance creation',
  14866. fn: function (anObject,anotherObject){
  14867. var self=this;
  14868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14869. return smalltalk.withContext(function($ctx1) {
  14870. //>>excludeEnd("ctx");
  14871. var $2,$3,$1;
  14872. $2=self._new();
  14873. _st($2)._add_(anObject);
  14874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14875. $ctx1.sendIdx["add:"]=1;
  14876. //>>excludeEnd("ctx");
  14877. _st($2)._add_(anotherObject);
  14878. $3=_st($2)._yourself();
  14879. $1=$3;
  14880. return $1;
  14881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14882. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},globals.Collection.klass)});
  14883. //>>excludeEnd("ctx");
  14884. },
  14885. //>>excludeStart("ide", pragmas.excludeIdeData);
  14886. args: ["anObject", "anotherObject"],
  14887. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  14888. referencedClasses: [],
  14889. //>>excludeEnd("ide");
  14890. messageSends: ["add:", "new", "yourself"]
  14891. }),
  14892. globals.Collection.klass);
  14893. smalltalk.addMethod(
  14894. smalltalk.method({
  14895. selector: "with:with:with:",
  14896. protocol: 'instance creation',
  14897. fn: function (firstObject,secondObject,thirdObject){
  14898. var self=this;
  14899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14900. return smalltalk.withContext(function($ctx1) {
  14901. //>>excludeEnd("ctx");
  14902. var $2,$3,$1;
  14903. $2=self._new();
  14904. _st($2)._add_(firstObject);
  14905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14906. $ctx1.sendIdx["add:"]=1;
  14907. //>>excludeEnd("ctx");
  14908. _st($2)._add_(secondObject);
  14909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14910. $ctx1.sendIdx["add:"]=2;
  14911. //>>excludeEnd("ctx");
  14912. _st($2)._add_(thirdObject);
  14913. $3=_st($2)._yourself();
  14914. $1=$3;
  14915. return $1;
  14916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14917. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},globals.Collection.klass)});
  14918. //>>excludeEnd("ctx");
  14919. },
  14920. //>>excludeStart("ide", pragmas.excludeIdeData);
  14921. args: ["firstObject", "secondObject", "thirdObject"],
  14922. 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",
  14923. referencedClasses: [],
  14924. //>>excludeEnd("ide");
  14925. messageSends: ["add:", "new", "yourself"]
  14926. }),
  14927. globals.Collection.klass);
  14928. smalltalk.addMethod(
  14929. smalltalk.method({
  14930. selector: "withAll:",
  14931. protocol: 'instance creation',
  14932. fn: function (aCollection){
  14933. var self=this;
  14934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14935. return smalltalk.withContext(function($ctx1) {
  14936. //>>excludeEnd("ctx");
  14937. var $2,$3,$1;
  14938. $2=self._new();
  14939. _st($2)._addAll_(aCollection);
  14940. $3=_st($2)._yourself();
  14941. $1=$3;
  14942. return $1;
  14943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14944. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},globals.Collection.klass)});
  14945. //>>excludeEnd("ctx");
  14946. },
  14947. //>>excludeStart("ide", pragmas.excludeIdeData);
  14948. args: ["aCollection"],
  14949. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  14950. referencedClasses: [],
  14951. //>>excludeEnd("ide");
  14952. messageSends: ["addAll:", "new", "yourself"]
  14953. }),
  14954. globals.Collection.klass);
  14955. smalltalk.addClass('IndexableCollection', globals.Collection, [], 'Kernel-Collections');
  14956. //>>excludeStart("ide", pragmas.excludeIdeData);
  14957. globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  14958. //>>excludeEnd("ide");
  14959. smalltalk.addMethod(
  14960. smalltalk.method({
  14961. selector: "at:",
  14962. protocol: 'accessing',
  14963. fn: function (anIndex){
  14964. var self=this;
  14965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14966. return smalltalk.withContext(function($ctx1) {
  14967. //>>excludeEnd("ctx");
  14968. var $1;
  14969. $1=self._at_ifAbsent_(anIndex,(function(){
  14970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14971. return smalltalk.withContext(function($ctx2) {
  14972. //>>excludeEnd("ctx");
  14973. return self._errorNotFound();
  14974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14976. //>>excludeEnd("ctx");
  14977. }));
  14978. return $1;
  14979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14980. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},globals.IndexableCollection)});
  14981. //>>excludeEnd("ctx");
  14982. },
  14983. //>>excludeStart("ide", pragmas.excludeIdeData);
  14984. args: ["anIndex"],
  14985. 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 ]",
  14986. referencedClasses: [],
  14987. //>>excludeEnd("ide");
  14988. messageSends: ["at:ifAbsent:", "errorNotFound"]
  14989. }),
  14990. globals.IndexableCollection);
  14991. smalltalk.addMethod(
  14992. smalltalk.method({
  14993. selector: "at:ifAbsent:",
  14994. protocol: 'accessing',
  14995. fn: function (anIndex,aBlock){
  14996. var self=this;
  14997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14998. return smalltalk.withContext(function($ctx1) {
  14999. //>>excludeEnd("ctx");
  15000. self._subclassResponsibility();
  15001. return self;
  15002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15003. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)});
  15004. //>>excludeEnd("ctx");
  15005. },
  15006. //>>excludeStart("ide", pragmas.excludeIdeData);
  15007. args: ["anIndex", "aBlock"],
  15008. 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 subclassResponsibility",
  15009. referencedClasses: [],
  15010. //>>excludeEnd("ide");
  15011. messageSends: ["subclassResponsibility"]
  15012. }),
  15013. globals.IndexableCollection);
  15014. smalltalk.addMethod(
  15015. smalltalk.method({
  15016. selector: "at:ifAbsentPut:",
  15017. protocol: 'accessing',
  15018. fn: function (aKey,aBlock){
  15019. var self=this;
  15020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15021. return smalltalk.withContext(function($ctx1) {
  15022. //>>excludeEnd("ctx");
  15023. var $1;
  15024. $1=self._at_ifAbsent_(aKey,(function(){
  15025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15026. return smalltalk.withContext(function($ctx2) {
  15027. //>>excludeEnd("ctx");
  15028. return self._at_put_(aKey,_st(aBlock)._value());
  15029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15031. //>>excludeEnd("ctx");
  15032. }));
  15033. return $1;
  15034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15035. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},globals.IndexableCollection)});
  15036. //>>excludeEnd("ctx");
  15037. },
  15038. //>>excludeStart("ide", pragmas.excludeIdeData);
  15039. args: ["aKey", "aBlock"],
  15040. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  15041. referencedClasses: [],
  15042. //>>excludeEnd("ide");
  15043. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  15044. }),
  15045. globals.IndexableCollection);
  15046. smalltalk.addMethod(
  15047. smalltalk.method({
  15048. selector: "at:ifPresent:",
  15049. protocol: 'accessing',
  15050. fn: function (anIndex,aBlock){
  15051. var self=this;
  15052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15053. return smalltalk.withContext(function($ctx1) {
  15054. //>>excludeEnd("ctx");
  15055. var $1;
  15056. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  15057. return nil;
  15058. }));
  15059. return $1;
  15060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15061. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)});
  15062. //>>excludeEnd("ctx");
  15063. },
  15064. //>>excludeStart("ide", pragmas.excludeIdeData);
  15065. args: ["anIndex", "aBlock"],
  15066. 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 ]",
  15067. referencedClasses: [],
  15068. //>>excludeEnd("ide");
  15069. messageSends: ["at:ifPresent:ifAbsent:"]
  15070. }),
  15071. globals.IndexableCollection);
  15072. smalltalk.addMethod(
  15073. smalltalk.method({
  15074. selector: "at:ifPresent:ifAbsent:",
  15075. protocol: 'accessing',
  15076. fn: function (anIndex,aBlock,anotherBlock){
  15077. var self=this;
  15078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15079. return smalltalk.withContext(function($ctx1) {
  15080. //>>excludeEnd("ctx");
  15081. self._subclassResponsibility();
  15082. return self;
  15083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15084. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.IndexableCollection)});
  15085. //>>excludeEnd("ctx");
  15086. },
  15087. //>>excludeStart("ide", pragmas.excludeIdeData);
  15088. args: ["anIndex", "aBlock", "anotherBlock"],
  15089. 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 subclassResponsibility",
  15090. referencedClasses: [],
  15091. //>>excludeEnd("ide");
  15092. messageSends: ["subclassResponsibility"]
  15093. }),
  15094. globals.IndexableCollection);
  15095. smalltalk.addMethod(
  15096. smalltalk.method({
  15097. selector: "at:put:",
  15098. protocol: 'accessing',
  15099. fn: function (anIndex,anObject){
  15100. var self=this;
  15101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15102. return smalltalk.withContext(function($ctx1) {
  15103. //>>excludeEnd("ctx");
  15104. self._subclassResponsibility();
  15105. return self;
  15106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15107. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.IndexableCollection)});
  15108. //>>excludeEnd("ctx");
  15109. },
  15110. //>>excludeStart("ide", pragmas.excludeIdeData);
  15111. args: ["anIndex", "anObject"],
  15112. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  15113. referencedClasses: [],
  15114. //>>excludeEnd("ide");
  15115. messageSends: ["subclassResponsibility"]
  15116. }),
  15117. globals.IndexableCollection);
  15118. smalltalk.addMethod(
  15119. smalltalk.method({
  15120. selector: "indexOf:",
  15121. protocol: 'accessing',
  15122. fn: function (anObject){
  15123. var self=this;
  15124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15125. return smalltalk.withContext(function($ctx1) {
  15126. //>>excludeEnd("ctx");
  15127. var $1;
  15128. $1=self._indexOf_ifAbsent_(anObject,(function(){
  15129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15130. return smalltalk.withContext(function($ctx2) {
  15131. //>>excludeEnd("ctx");
  15132. return self._errorNotFound();
  15133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15135. //>>excludeEnd("ctx");
  15136. }));
  15137. return $1;
  15138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15139. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},globals.IndexableCollection)});
  15140. //>>excludeEnd("ctx");
  15141. },
  15142. //>>excludeStart("ide", pragmas.excludeIdeData);
  15143. args: ["anObject"],
  15144. 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 ]",
  15145. referencedClasses: [],
  15146. //>>excludeEnd("ide");
  15147. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  15148. }),
  15149. globals.IndexableCollection);
  15150. smalltalk.addMethod(
  15151. smalltalk.method({
  15152. selector: "indexOf:ifAbsent:",
  15153. protocol: 'accessing',
  15154. fn: function (anObject,aBlock){
  15155. var self=this;
  15156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15157. return smalltalk.withContext(function($ctx1) {
  15158. //>>excludeEnd("ctx");
  15159. self._subclassResponsibility();
  15160. return self;
  15161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15162. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.IndexableCollection)});
  15163. //>>excludeEnd("ctx");
  15164. },
  15165. //>>excludeStart("ide", pragmas.excludeIdeData);
  15166. args: ["anObject", "aBlock"],
  15167. 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",
  15168. referencedClasses: [],
  15169. //>>excludeEnd("ide");
  15170. messageSends: ["subclassResponsibility"]
  15171. }),
  15172. globals.IndexableCollection);
  15173. smalltalk.addMethod(
  15174. smalltalk.method({
  15175. selector: "with:do:",
  15176. protocol: 'enumerating',
  15177. fn: function (anotherCollection,aBlock){
  15178. var self=this;
  15179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15180. return smalltalk.withContext(function($ctx1) {
  15181. //>>excludeEnd("ctx");
  15182. self._withIndexDo_((function(each,index){
  15183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15184. return smalltalk.withContext(function($ctx2) {
  15185. //>>excludeEnd("ctx");
  15186. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  15187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15188. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  15189. //>>excludeEnd("ctx");
  15190. }));
  15191. return self;
  15192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15193. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.IndexableCollection)});
  15194. //>>excludeEnd("ctx");
  15195. },
  15196. //>>excludeStart("ide", pragmas.excludeIdeData);
  15197. args: ["anotherCollection", "aBlock"],
  15198. 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) ]",
  15199. referencedClasses: [],
  15200. //>>excludeEnd("ide");
  15201. messageSends: ["withIndexDo:", "value:value:", "at:"]
  15202. }),
  15203. globals.IndexableCollection);
  15204. smalltalk.addMethod(
  15205. smalltalk.method({
  15206. selector: "withIndexDo:",
  15207. protocol: 'enumerating',
  15208. fn: function (aBlock){
  15209. var self=this;
  15210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15211. return smalltalk.withContext(function($ctx1) {
  15212. //>>excludeEnd("ctx");
  15213. self._subclassResponsibility();
  15214. return self;
  15215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15216. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.IndexableCollection)});
  15217. //>>excludeEnd("ctx");
  15218. },
  15219. //>>excludeStart("ide", pragmas.excludeIdeData);
  15220. args: ["aBlock"],
  15221. 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 subclassResponsibility",
  15222. referencedClasses: [],
  15223. //>>excludeEnd("ide");
  15224. messageSends: ["subclassResponsibility"]
  15225. }),
  15226. globals.IndexableCollection);
  15227. smalltalk.addClass('AssociativeCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  15228. //>>excludeStart("ide", pragmas.excludeIdeData);
  15229. globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  15230. //>>excludeEnd("ide");
  15231. smalltalk.addMethod(
  15232. smalltalk.method({
  15233. selector: "=",
  15234. protocol: 'comparing',
  15235. fn: function (anAssocitativeCollection){
  15236. var self=this;
  15237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15238. return smalltalk.withContext(function($ctx1) {
  15239. //>>excludeEnd("ctx");
  15240. var $2,$1,$4,$3,$6,$5;
  15241. $2=self._class();
  15242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15243. $ctx1.sendIdx["class"]=1;
  15244. //>>excludeEnd("ctx");
  15245. $1=_st($2).__eq(_st(anAssocitativeCollection)._class());
  15246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15247. $ctx1.sendIdx["="]=1;
  15248. //>>excludeEnd("ctx");
  15249. if(! smalltalk.assert($1)){
  15250. return false;
  15251. };
  15252. $4=self._size();
  15253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15254. $ctx1.sendIdx["size"]=1;
  15255. //>>excludeEnd("ctx");
  15256. $3=_st($4).__eq(_st(anAssocitativeCollection)._size());
  15257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15258. $ctx1.sendIdx["="]=2;
  15259. //>>excludeEnd("ctx");
  15260. if(! smalltalk.assert($3)){
  15261. return false;
  15262. };
  15263. $6=self._associations();
  15264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15265. $ctx1.sendIdx["associations"]=1;
  15266. //>>excludeEnd("ctx");
  15267. $5=_st($6).__eq(_st(anAssocitativeCollection)._associations());
  15268. return $5;
  15269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15270. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},globals.AssociativeCollection)});
  15271. //>>excludeEnd("ctx");
  15272. },
  15273. //>>excludeStart("ide", pragmas.excludeIdeData);
  15274. args: ["anAssocitativeCollection"],
  15275. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  15276. referencedClasses: [],
  15277. //>>excludeEnd("ide");
  15278. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  15279. }),
  15280. globals.AssociativeCollection);
  15281. smalltalk.addMethod(
  15282. smalltalk.method({
  15283. selector: "add:",
  15284. protocol: 'adding/removing',
  15285. fn: function (anAssociation){
  15286. var self=this;
  15287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15288. return smalltalk.withContext(function($ctx1) {
  15289. //>>excludeEnd("ctx");
  15290. self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  15291. return self;
  15292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15293. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},globals.AssociativeCollection)});
  15294. //>>excludeEnd("ctx");
  15295. },
  15296. //>>excludeStart("ide", pragmas.excludeIdeData);
  15297. args: ["anAssociation"],
  15298. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  15299. referencedClasses: [],
  15300. //>>excludeEnd("ide");
  15301. messageSends: ["at:put:", "key", "value"]
  15302. }),
  15303. globals.AssociativeCollection);
  15304. smalltalk.addMethod(
  15305. smalltalk.method({
  15306. selector: "addAll:",
  15307. protocol: 'adding/removing',
  15308. fn: function (anAssociativeCollection){
  15309. var self=this;
  15310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15311. return smalltalk.withContext(function($ctx1) {
  15312. //>>excludeEnd("ctx");
  15313. (
  15314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15315. $ctx1.supercall = true,
  15316. //>>excludeEnd("ctx");
  15317. globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply(_st(self), [_st(anAssociativeCollection)._associations()]));
  15318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15319. $ctx1.supercall = false;
  15320. //>>excludeEnd("ctx");;
  15321. return anAssociativeCollection;
  15322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15323. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},globals.AssociativeCollection)});
  15324. //>>excludeEnd("ctx");
  15325. },
  15326. //>>excludeStart("ide", pragmas.excludeIdeData);
  15327. args: ["anAssociativeCollection"],
  15328. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  15329. referencedClasses: [],
  15330. //>>excludeEnd("ide");
  15331. messageSends: ["addAll:", "associations"]
  15332. }),
  15333. globals.AssociativeCollection);
  15334. smalltalk.addMethod(
  15335. smalltalk.method({
  15336. selector: "asDictionary",
  15337. protocol: 'converting',
  15338. fn: function (){
  15339. var self=this;
  15340. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  15341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15342. return smalltalk.withContext(function($ctx1) {
  15343. //>>excludeEnd("ctx");
  15344. var $1;
  15345. $1=_st($Dictionary())._from_(self._associations());
  15346. return $1;
  15347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15348. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},globals.AssociativeCollection)});
  15349. //>>excludeEnd("ctx");
  15350. },
  15351. //>>excludeStart("ide", pragmas.excludeIdeData);
  15352. args: [],
  15353. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  15354. referencedClasses: ["Dictionary"],
  15355. //>>excludeEnd("ide");
  15356. messageSends: ["from:", "associations"]
  15357. }),
  15358. globals.AssociativeCollection);
  15359. smalltalk.addMethod(
  15360. smalltalk.method({
  15361. selector: "asHashedCollection",
  15362. protocol: 'converting',
  15363. fn: function (){
  15364. var self=this;
  15365. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  15366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15367. return smalltalk.withContext(function($ctx1) {
  15368. //>>excludeEnd("ctx");
  15369. var $1;
  15370. $1=_st($HashedCollection())._from_(self._associations());
  15371. return $1;
  15372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15373. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},globals.AssociativeCollection)});
  15374. //>>excludeEnd("ctx");
  15375. },
  15376. //>>excludeStart("ide", pragmas.excludeIdeData);
  15377. args: [],
  15378. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  15379. referencedClasses: ["HashedCollection"],
  15380. //>>excludeEnd("ide");
  15381. messageSends: ["from:", "associations"]
  15382. }),
  15383. globals.AssociativeCollection);
  15384. smalltalk.addMethod(
  15385. smalltalk.method({
  15386. selector: "asJSON",
  15387. protocol: 'converting',
  15388. fn: function (){
  15389. var self=this;
  15390. var hash;
  15391. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  15392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15393. return smalltalk.withContext(function($ctx1) {
  15394. //>>excludeEnd("ctx");
  15395. var $1;
  15396. hash=_st($HashedCollection())._new();
  15397. self._keysAndValuesDo_((function(key,value){
  15398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15399. return smalltalk.withContext(function($ctx2) {
  15400. //>>excludeEnd("ctx");
  15401. return _st(hash)._at_put_(key,_st(value)._asJSON());
  15402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15403. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  15404. //>>excludeEnd("ctx");
  15405. }));
  15406. $1=hash;
  15407. return $1;
  15408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15409. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},globals.AssociativeCollection)});
  15410. //>>excludeEnd("ctx");
  15411. },
  15412. //>>excludeStart("ide", pragmas.excludeIdeData);
  15413. args: [],
  15414. source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash",
  15415. referencedClasses: ["HashedCollection"],
  15416. //>>excludeEnd("ide");
  15417. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  15418. }),
  15419. globals.AssociativeCollection);
  15420. smalltalk.addMethod(
  15421. smalltalk.method({
  15422. selector: "associations",
  15423. protocol: 'accessing',
  15424. fn: function (){
  15425. var self=this;
  15426. var associations;
  15427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15428. return smalltalk.withContext(function($ctx1) {
  15429. //>>excludeEnd("ctx");
  15430. var $1;
  15431. associations=[];
  15432. self._associationsDo_((function(each){
  15433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15434. return smalltalk.withContext(function($ctx2) {
  15435. //>>excludeEnd("ctx");
  15436. return _st(associations)._add_(each);
  15437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15439. //>>excludeEnd("ctx");
  15440. }));
  15441. $1=associations;
  15442. return $1;
  15443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15444. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},globals.AssociativeCollection)});
  15445. //>>excludeEnd("ctx");
  15446. },
  15447. //>>excludeStart("ide", pragmas.excludeIdeData);
  15448. args: [],
  15449. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  15450. referencedClasses: [],
  15451. //>>excludeEnd("ide");
  15452. messageSends: ["associationsDo:", "add:"]
  15453. }),
  15454. globals.AssociativeCollection);
  15455. smalltalk.addMethod(
  15456. smalltalk.method({
  15457. selector: "associationsDo:",
  15458. protocol: 'enumerating',
  15459. fn: function (aBlock){
  15460. var self=this;
  15461. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  15462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15463. return smalltalk.withContext(function($ctx1) {
  15464. //>>excludeEnd("ctx");
  15465. self._keysAndValuesDo_((function(key,value){
  15466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15467. return smalltalk.withContext(function($ctx2) {
  15468. //>>excludeEnd("ctx");
  15469. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  15470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15471. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  15472. //>>excludeEnd("ctx");
  15473. }));
  15474. return self;
  15475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15476. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  15477. //>>excludeEnd("ctx");
  15478. },
  15479. //>>excludeStart("ide", pragmas.excludeIdeData);
  15480. args: ["aBlock"],
  15481. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  15482. referencedClasses: ["Association"],
  15483. //>>excludeEnd("ide");
  15484. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  15485. }),
  15486. globals.AssociativeCollection);
  15487. smalltalk.addMethod(
  15488. smalltalk.method({
  15489. selector: "at:ifPresent:ifAbsent:",
  15490. protocol: 'accessing',
  15491. fn: function (aKey,aBlock,anotherBlock){
  15492. var self=this;
  15493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15494. return smalltalk.withContext(function($ctx1) {
  15495. //>>excludeEnd("ctx");
  15496. var $2,$1;
  15497. $2=self._includesKey_(aKey);
  15498. if(smalltalk.assert($2)){
  15499. $1=_st(aBlock)._value_(self._at_(aKey));
  15500. } else {
  15501. $1=_st(anotherBlock)._value();
  15502. };
  15503. return $1;
  15504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15505. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)});
  15506. //>>excludeEnd("ctx");
  15507. },
  15508. //>>excludeStart("ide", pragmas.excludeIdeData);
  15509. args: ["aKey", "aBlock", "anotherBlock"],
  15510. 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 \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  15511. referencedClasses: [],
  15512. //>>excludeEnd("ide");
  15513. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  15514. }),
  15515. globals.AssociativeCollection);
  15516. smalltalk.addMethod(
  15517. smalltalk.method({
  15518. selector: "collect:",
  15519. protocol: 'enumerating',
  15520. fn: function (aBlock){
  15521. var self=this;
  15522. var newDict;
  15523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15524. return smalltalk.withContext(function($ctx1) {
  15525. //>>excludeEnd("ctx");
  15526. var $1;
  15527. newDict=_st(self._class())._new();
  15528. self._keysAndValuesDo_((function(key,value){
  15529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15530. return smalltalk.withContext(function($ctx2) {
  15531. //>>excludeEnd("ctx");
  15532. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  15533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15534. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  15535. //>>excludeEnd("ctx");
  15536. }));
  15537. $1=newDict;
  15538. return $1;
  15539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15540. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)});
  15541. //>>excludeEnd("ctx");
  15542. },
  15543. //>>excludeStart("ide", pragmas.excludeIdeData);
  15544. args: ["aBlock"],
  15545. 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",
  15546. referencedClasses: [],
  15547. //>>excludeEnd("ide");
  15548. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  15549. }),
  15550. globals.AssociativeCollection);
  15551. smalltalk.addMethod(
  15552. smalltalk.method({
  15553. selector: "deepCopy",
  15554. protocol: 'copying',
  15555. fn: function (){
  15556. var self=this;
  15557. var copy;
  15558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15559. return smalltalk.withContext(function($ctx1) {
  15560. //>>excludeEnd("ctx");
  15561. var $1;
  15562. copy=_st(self._class())._new();
  15563. self._keysAndValuesDo_((function(key,value){
  15564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15565. return smalltalk.withContext(function($ctx2) {
  15566. //>>excludeEnd("ctx");
  15567. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  15568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15569. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  15570. //>>excludeEnd("ctx");
  15571. }));
  15572. $1=copy;
  15573. return $1;
  15574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15575. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},globals.AssociativeCollection)});
  15576. //>>excludeEnd("ctx");
  15577. },
  15578. //>>excludeStart("ide", pragmas.excludeIdeData);
  15579. args: [],
  15580. 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",
  15581. referencedClasses: [],
  15582. //>>excludeEnd("ide");
  15583. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  15584. }),
  15585. globals.AssociativeCollection);
  15586. smalltalk.addMethod(
  15587. smalltalk.method({
  15588. selector: "detect:ifNone:",
  15589. protocol: 'enumerating',
  15590. fn: function (aBlock,anotherBlock){
  15591. var self=this;
  15592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15593. return smalltalk.withContext(function($ctx1) {
  15594. //>>excludeEnd("ctx");
  15595. var $1;
  15596. $1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
  15597. return $1;
  15598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15599. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)});
  15600. //>>excludeEnd("ctx");
  15601. },
  15602. //>>excludeStart("ide", pragmas.excludeIdeData);
  15603. args: ["aBlock", "anotherBlock"],
  15604. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  15605. referencedClasses: [],
  15606. //>>excludeEnd("ide");
  15607. messageSends: ["detect:ifNone:", "values"]
  15608. }),
  15609. globals.AssociativeCollection);
  15610. smalltalk.addMethod(
  15611. smalltalk.method({
  15612. selector: "do:",
  15613. protocol: 'enumerating',
  15614. fn: function (aBlock){
  15615. var self=this;
  15616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15617. return smalltalk.withContext(function($ctx1) {
  15618. //>>excludeEnd("ctx");
  15619. self._valuesDo_(aBlock);
  15620. return self;
  15621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15622. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.AssociativeCollection)});
  15623. //>>excludeEnd("ctx");
  15624. },
  15625. //>>excludeStart("ide", pragmas.excludeIdeData);
  15626. args: ["aBlock"],
  15627. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  15628. referencedClasses: [],
  15629. //>>excludeEnd("ide");
  15630. messageSends: ["valuesDo:"]
  15631. }),
  15632. globals.AssociativeCollection);
  15633. smalltalk.addMethod(
  15634. smalltalk.method({
  15635. selector: "includes:",
  15636. protocol: 'enumerating',
  15637. fn: function (anObject){
  15638. var self=this;
  15639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15640. return smalltalk.withContext(function($ctx1) {
  15641. //>>excludeEnd("ctx");
  15642. var $1;
  15643. $1=_st(self._values())._includes_(anObject);
  15644. return $1;
  15645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15646. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.AssociativeCollection)});
  15647. //>>excludeEnd("ctx");
  15648. },
  15649. //>>excludeStart("ide", pragmas.excludeIdeData);
  15650. args: ["anObject"],
  15651. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  15652. referencedClasses: [],
  15653. //>>excludeEnd("ide");
  15654. messageSends: ["includes:", "values"]
  15655. }),
  15656. globals.AssociativeCollection);
  15657. smalltalk.addMethod(
  15658. smalltalk.method({
  15659. selector: "includesKey:",
  15660. protocol: 'testing',
  15661. fn: function (aKey){
  15662. var self=this;
  15663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15664. return smalltalk.withContext(function($ctx1) {
  15665. //>>excludeEnd("ctx");
  15666. self._subclassResponsibility();
  15667. return self;
  15668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15669. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.AssociativeCollection)});
  15670. //>>excludeEnd("ctx");
  15671. },
  15672. //>>excludeStart("ide", pragmas.excludeIdeData);
  15673. args: ["aKey"],
  15674. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  15675. referencedClasses: [],
  15676. //>>excludeEnd("ide");
  15677. messageSends: ["subclassResponsibility"]
  15678. }),
  15679. globals.AssociativeCollection);
  15680. smalltalk.addMethod(
  15681. smalltalk.method({
  15682. selector: "indexOf:ifAbsent:",
  15683. protocol: 'accessing',
  15684. fn: function (anObject,aBlock){
  15685. var self=this;
  15686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15687. return smalltalk.withContext(function($ctx1) {
  15688. //>>excludeEnd("ctx");
  15689. var $1;
  15690. $1=_st(self._keys())._detect_ifNone_((function(each){
  15691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15692. return smalltalk.withContext(function($ctx2) {
  15693. //>>excludeEnd("ctx");
  15694. return _st(self._at_(each)).__eq(anObject);
  15695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15697. //>>excludeEnd("ctx");
  15698. }),aBlock);
  15699. return $1;
  15700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15701. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)});
  15702. //>>excludeEnd("ctx");
  15703. },
  15704. //>>excludeStart("ide", pragmas.excludeIdeData);
  15705. args: ["anObject", "aBlock"],
  15706. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  15707. referencedClasses: [],
  15708. //>>excludeEnd("ide");
  15709. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  15710. }),
  15711. globals.AssociativeCollection);
  15712. smalltalk.addMethod(
  15713. smalltalk.method({
  15714. selector: "keyAtValue:",
  15715. protocol: 'accessing',
  15716. fn: function (anObject){
  15717. var self=this;
  15718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15719. return smalltalk.withContext(function($ctx1) {
  15720. //>>excludeEnd("ctx");
  15721. var $1;
  15722. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  15723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15724. return smalltalk.withContext(function($ctx2) {
  15725. //>>excludeEnd("ctx");
  15726. return self._errorNotFound();
  15727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15729. //>>excludeEnd("ctx");
  15730. }));
  15731. return $1;
  15732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15733. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},globals.AssociativeCollection)});
  15734. //>>excludeEnd("ctx");
  15735. },
  15736. //>>excludeStart("ide", pragmas.excludeIdeData);
  15737. args: ["anObject"],
  15738. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  15739. referencedClasses: [],
  15740. //>>excludeEnd("ide");
  15741. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  15742. }),
  15743. globals.AssociativeCollection);
  15744. smalltalk.addMethod(
  15745. smalltalk.method({
  15746. selector: "keyAtValue:ifAbsent:",
  15747. protocol: 'accessing',
  15748. fn: function (anObject,aBlock){
  15749. var self=this;
  15750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15751. return smalltalk.withContext(function($ctx1) {
  15752. //>>excludeEnd("ctx");
  15753. var $1;
  15754. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  15755. return $1;
  15756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15757. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)});
  15758. //>>excludeEnd("ctx");
  15759. },
  15760. //>>excludeStart("ide", pragmas.excludeIdeData);
  15761. args: ["anObject", "aBlock"],
  15762. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  15763. referencedClasses: [],
  15764. //>>excludeEnd("ide");
  15765. messageSends: ["indexOf:ifAbsent:"]
  15766. }),
  15767. globals.AssociativeCollection);
  15768. smalltalk.addMethod(
  15769. smalltalk.method({
  15770. selector: "keys",
  15771. protocol: 'accessing',
  15772. fn: function (){
  15773. var self=this;
  15774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15775. return smalltalk.withContext(function($ctx1) {
  15776. //>>excludeEnd("ctx");
  15777. self._subclassResponsibility();
  15778. return self;
  15779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15780. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.AssociativeCollection)});
  15781. //>>excludeEnd("ctx");
  15782. },
  15783. //>>excludeStart("ide", pragmas.excludeIdeData);
  15784. args: [],
  15785. source: "keys\x0a\x09self subclassResponsibility",
  15786. referencedClasses: [],
  15787. //>>excludeEnd("ide");
  15788. messageSends: ["subclassResponsibility"]
  15789. }),
  15790. globals.AssociativeCollection);
  15791. smalltalk.addMethod(
  15792. smalltalk.method({
  15793. selector: "keysAndValuesDo:",
  15794. protocol: 'enumerating',
  15795. fn: function (aBlock){
  15796. var self=this;
  15797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15798. return smalltalk.withContext(function($ctx1) {
  15799. //>>excludeEnd("ctx");
  15800. self._keysDo_((function(each){
  15801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15802. return smalltalk.withContext(function($ctx2) {
  15803. //>>excludeEnd("ctx");
  15804. return _st(aBlock)._value_value_(each,self._at_(each));
  15805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15807. //>>excludeEnd("ctx");
  15808. }));
  15809. return self;
  15810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15811. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  15812. //>>excludeEnd("ctx");
  15813. },
  15814. //>>excludeStart("ide", pragmas.excludeIdeData);
  15815. args: ["aBlock"],
  15816. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  15817. referencedClasses: [],
  15818. //>>excludeEnd("ide");
  15819. messageSends: ["keysDo:", "value:value:", "at:"]
  15820. }),
  15821. globals.AssociativeCollection);
  15822. smalltalk.addMethod(
  15823. smalltalk.method({
  15824. selector: "keysDo:",
  15825. protocol: 'enumerating',
  15826. fn: function (aBlock){
  15827. var self=this;
  15828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15829. return smalltalk.withContext(function($ctx1) {
  15830. //>>excludeEnd("ctx");
  15831. self._subclassResponsibility();
  15832. return self;
  15833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15834. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  15835. //>>excludeEnd("ctx");
  15836. },
  15837. //>>excludeStart("ide", pragmas.excludeIdeData);
  15838. args: ["aBlock"],
  15839. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  15840. referencedClasses: [],
  15841. //>>excludeEnd("ide");
  15842. messageSends: ["subclassResponsibility"]
  15843. }),
  15844. globals.AssociativeCollection);
  15845. smalltalk.addMethod(
  15846. smalltalk.method({
  15847. selector: "printOn:",
  15848. protocol: 'printing',
  15849. fn: function (aStream){
  15850. var self=this;
  15851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15852. return smalltalk.withContext(function($ctx1) {
  15853. //>>excludeEnd("ctx");
  15854. (
  15855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15856. $ctx1.supercall = true,
  15857. //>>excludeEnd("ctx");
  15858. globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  15859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15860. $ctx1.supercall = false;
  15861. //>>excludeEnd("ctx");;
  15862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15863. $ctx1.sendIdx["printOn:"]=1;
  15864. //>>excludeEnd("ctx");
  15865. _st(aStream)._nextPutAll_(" (");
  15866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15867. $ctx1.sendIdx["nextPutAll:"]=1;
  15868. //>>excludeEnd("ctx");
  15869. _st(self._associations())._do_separatedBy_((function(each){
  15870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15871. return smalltalk.withContext(function($ctx2) {
  15872. //>>excludeEnd("ctx");
  15873. return _st(each)._printOn_(aStream);
  15874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15876. //>>excludeEnd("ctx");
  15877. }),(function(){
  15878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15879. return smalltalk.withContext(function($ctx2) {
  15880. //>>excludeEnd("ctx");
  15881. return _st(aStream)._nextPutAll_(" , ");
  15882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15883. $ctx2.sendIdx["nextPutAll:"]=2;
  15884. //>>excludeEnd("ctx");
  15885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15887. //>>excludeEnd("ctx");
  15888. }));
  15889. _st(aStream)._nextPutAll_(")");
  15890. return self;
  15891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15892. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AssociativeCollection)});
  15893. //>>excludeEnd("ctx");
  15894. },
  15895. //>>excludeStart("ide", pragmas.excludeIdeData);
  15896. args: ["aStream"],
  15897. 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: ')'",
  15898. referencedClasses: [],
  15899. //>>excludeEnd("ide");
  15900. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  15901. }),
  15902. globals.AssociativeCollection);
  15903. smalltalk.addMethod(
  15904. smalltalk.method({
  15905. selector: "remove:ifAbsent:",
  15906. protocol: 'adding/removing',
  15907. fn: function (aKey,aBlock){
  15908. var self=this;
  15909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15910. return smalltalk.withContext(function($ctx1) {
  15911. //>>excludeEnd("ctx");
  15912. var $1;
  15913. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  15914. return $1;
  15915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15916. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)});
  15917. //>>excludeEnd("ctx");
  15918. },
  15919. //>>excludeStart("ide", pragmas.excludeIdeData);
  15920. args: ["aKey", "aBlock"],
  15921. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  15922. referencedClasses: [],
  15923. //>>excludeEnd("ide");
  15924. messageSends: ["removeKey:ifAbsent:"]
  15925. }),
  15926. globals.AssociativeCollection);
  15927. smalltalk.addMethod(
  15928. smalltalk.method({
  15929. selector: "removeAll",
  15930. protocol: 'adding/removing',
  15931. fn: function (){
  15932. var self=this;
  15933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15934. return smalltalk.withContext(function($ctx1) {
  15935. //>>excludeEnd("ctx");
  15936. var $1;
  15937. $1=_st(self._keys())._do_((function(each){
  15938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15939. return smalltalk.withContext(function($ctx2) {
  15940. //>>excludeEnd("ctx");
  15941. return self._removeKey_(each);
  15942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15943. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15944. //>>excludeEnd("ctx");
  15945. }));
  15946. return $1;
  15947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15948. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.AssociativeCollection)});
  15949. //>>excludeEnd("ctx");
  15950. },
  15951. //>>excludeStart("ide", pragmas.excludeIdeData);
  15952. args: [],
  15953. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  15954. referencedClasses: [],
  15955. //>>excludeEnd("ide");
  15956. messageSends: ["do:", "keys", "removeKey:"]
  15957. }),
  15958. globals.AssociativeCollection);
  15959. smalltalk.addMethod(
  15960. smalltalk.method({
  15961. selector: "removeKey:",
  15962. protocol: 'adding/removing',
  15963. fn: function (aKey){
  15964. var self=this;
  15965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15966. return smalltalk.withContext(function($ctx1) {
  15967. //>>excludeEnd("ctx");
  15968. var $1;
  15969. $1=self._remove_(aKey);
  15970. return $1;
  15971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15972. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},globals.AssociativeCollection)});
  15973. //>>excludeEnd("ctx");
  15974. },
  15975. //>>excludeStart("ide", pragmas.excludeIdeData);
  15976. args: ["aKey"],
  15977. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  15978. referencedClasses: [],
  15979. //>>excludeEnd("ide");
  15980. messageSends: ["remove:"]
  15981. }),
  15982. globals.AssociativeCollection);
  15983. smalltalk.addMethod(
  15984. smalltalk.method({
  15985. selector: "removeKey:ifAbsent:",
  15986. protocol: 'adding/removing',
  15987. fn: function (aKey,aBlock){
  15988. var self=this;
  15989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15990. return smalltalk.withContext(function($ctx1) {
  15991. //>>excludeEnd("ctx");
  15992. self._subclassResponsibility();
  15993. return self;
  15994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15995. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)});
  15996. //>>excludeEnd("ctx");
  15997. },
  15998. //>>excludeStart("ide", pragmas.excludeIdeData);
  15999. args: ["aKey", "aBlock"],
  16000. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  16001. referencedClasses: [],
  16002. //>>excludeEnd("ide");
  16003. messageSends: ["subclassResponsibility"]
  16004. }),
  16005. globals.AssociativeCollection);
  16006. smalltalk.addMethod(
  16007. smalltalk.method({
  16008. selector: "select:",
  16009. protocol: 'enumerating',
  16010. fn: function (aBlock){
  16011. var self=this;
  16012. var newDict;
  16013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16014. return smalltalk.withContext(function($ctx1) {
  16015. //>>excludeEnd("ctx");
  16016. var $1,$2;
  16017. newDict=_st(self._class())._new();
  16018. self._keysAndValuesDo_((function(key,value){
  16019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16020. return smalltalk.withContext(function($ctx2) {
  16021. //>>excludeEnd("ctx");
  16022. $1=_st(aBlock)._value_(value);
  16023. if(smalltalk.assert($1)){
  16024. return _st(newDict)._at_put_(key,value);
  16025. };
  16026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16027. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  16028. //>>excludeEnd("ctx");
  16029. }));
  16030. $2=newDict;
  16031. return $2;
  16032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16033. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)});
  16034. //>>excludeEnd("ctx");
  16035. },
  16036. //>>excludeStart("ide", pragmas.excludeIdeData);
  16037. args: ["aBlock"],
  16038. 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",
  16039. referencedClasses: [],
  16040. //>>excludeEnd("ide");
  16041. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  16042. }),
  16043. globals.AssociativeCollection);
  16044. smalltalk.addMethod(
  16045. smalltalk.method({
  16046. selector: "shallowCopy",
  16047. protocol: 'copying',
  16048. fn: function (){
  16049. var self=this;
  16050. var copy;
  16051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16052. return smalltalk.withContext(function($ctx1) {
  16053. //>>excludeEnd("ctx");
  16054. var $1;
  16055. copy=_st(self._class())._new();
  16056. self._keysAndValuesDo_((function(key,value){
  16057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16058. return smalltalk.withContext(function($ctx2) {
  16059. //>>excludeEnd("ctx");
  16060. return _st(copy)._at_put_(key,value);
  16061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16062. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  16063. //>>excludeEnd("ctx");
  16064. }));
  16065. $1=copy;
  16066. return $1;
  16067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16068. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},globals.AssociativeCollection)});
  16069. //>>excludeEnd("ctx");
  16070. },
  16071. //>>excludeStart("ide", pragmas.excludeIdeData);
  16072. args: [],
  16073. 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",
  16074. referencedClasses: [],
  16075. //>>excludeEnd("ide");
  16076. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  16077. }),
  16078. globals.AssociativeCollection);
  16079. smalltalk.addMethod(
  16080. smalltalk.method({
  16081. selector: "size",
  16082. protocol: 'accessing',
  16083. fn: function (){
  16084. var self=this;
  16085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16086. return smalltalk.withContext(function($ctx1) {
  16087. //>>excludeEnd("ctx");
  16088. var $1;
  16089. $1=_st(self._keys())._size();
  16090. return $1;
  16091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16092. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.AssociativeCollection)});
  16093. //>>excludeEnd("ctx");
  16094. },
  16095. //>>excludeStart("ide", pragmas.excludeIdeData);
  16096. args: [],
  16097. source: "size\x0a\x09^ self keys size",
  16098. referencedClasses: [],
  16099. //>>excludeEnd("ide");
  16100. messageSends: ["size", "keys"]
  16101. }),
  16102. globals.AssociativeCollection);
  16103. smalltalk.addMethod(
  16104. smalltalk.method({
  16105. selector: "values",
  16106. protocol: 'accessing',
  16107. fn: function (){
  16108. var self=this;
  16109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16110. return smalltalk.withContext(function($ctx1) {
  16111. //>>excludeEnd("ctx");
  16112. self._subclassResponsibility();
  16113. return self;
  16114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16115. }, function($ctx1) {$ctx1.fill(self,"values",{},globals.AssociativeCollection)});
  16116. //>>excludeEnd("ctx");
  16117. },
  16118. //>>excludeStart("ide", pragmas.excludeIdeData);
  16119. args: [],
  16120. source: "values\x0a\x09self subclassResponsibility",
  16121. referencedClasses: [],
  16122. //>>excludeEnd("ide");
  16123. messageSends: ["subclassResponsibility"]
  16124. }),
  16125. globals.AssociativeCollection);
  16126. smalltalk.addMethod(
  16127. smalltalk.method({
  16128. selector: "valuesDo:",
  16129. protocol: 'enumerating',
  16130. fn: function (aBlock){
  16131. var self=this;
  16132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16133. return smalltalk.withContext(function($ctx1) {
  16134. //>>excludeEnd("ctx");
  16135. self._subclassResponsibility();
  16136. return self;
  16137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16138. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  16139. //>>excludeEnd("ctx");
  16140. },
  16141. //>>excludeStart("ide", pragmas.excludeIdeData);
  16142. args: ["aBlock"],
  16143. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  16144. referencedClasses: [],
  16145. //>>excludeEnd("ide");
  16146. messageSends: ["subclassResponsibility"]
  16147. }),
  16148. globals.AssociativeCollection);
  16149. smalltalk.addMethod(
  16150. smalltalk.method({
  16151. selector: "withIndexDo:",
  16152. protocol: 'enumerating',
  16153. fn: function (aBlock){
  16154. var self=this;
  16155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16156. return smalltalk.withContext(function($ctx1) {
  16157. //>>excludeEnd("ctx");
  16158. self._keysAndValuesDo_((function(key,value){
  16159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16160. return smalltalk.withContext(function($ctx2) {
  16161. //>>excludeEnd("ctx");
  16162. return _st(aBlock)._value_value_(value,key);
  16163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16164. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  16165. //>>excludeEnd("ctx");
  16166. }));
  16167. return self;
  16168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16169. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  16170. //>>excludeEnd("ctx");
  16171. },
  16172. //>>excludeStart("ide", pragmas.excludeIdeData);
  16173. args: ["aBlock"],
  16174. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  16175. referencedClasses: [],
  16176. //>>excludeEnd("ide");
  16177. messageSends: ["keysAndValuesDo:", "value:value:"]
  16178. }),
  16179. globals.AssociativeCollection);
  16180. smalltalk.addMethod(
  16181. smalltalk.method({
  16182. selector: "from:",
  16183. protocol: 'instance creation',
  16184. fn: function (aCollection){
  16185. var self=this;
  16186. var newCollection;
  16187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16188. return smalltalk.withContext(function($ctx1) {
  16189. //>>excludeEnd("ctx");
  16190. var $1;
  16191. newCollection=self._new();
  16192. _st(aCollection)._do_((function(each){
  16193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16194. return smalltalk.withContext(function($ctx2) {
  16195. //>>excludeEnd("ctx");
  16196. return _st(newCollection)._add_(each);
  16197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16199. //>>excludeEnd("ctx");
  16200. }));
  16201. $1=newCollection;
  16202. return $1;
  16203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16204. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)});
  16205. //>>excludeEnd("ctx");
  16206. },
  16207. //>>excludeStart("ide", pragmas.excludeIdeData);
  16208. args: ["aCollection"],
  16209. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  16210. referencedClasses: [],
  16211. //>>excludeEnd("ide");
  16212. messageSends: ["new", "do:", "add:"]
  16213. }),
  16214. globals.AssociativeCollection.klass);
  16215. smalltalk.addMethod(
  16216. smalltalk.method({
  16217. selector: "fromPairs:",
  16218. protocol: 'instance creation',
  16219. fn: function (aCollection){
  16220. var self=this;
  16221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16222. return smalltalk.withContext(function($ctx1) {
  16223. //>>excludeEnd("ctx");
  16224. var $1;
  16225. $1=self._from_(aCollection);
  16226. return $1;
  16227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16228. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},globals.AssociativeCollection.klass)});
  16229. //>>excludeEnd("ctx");
  16230. },
  16231. //>>excludeStart("ide", pragmas.excludeIdeData);
  16232. args: ["aCollection"],
  16233. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  16234. referencedClasses: [],
  16235. //>>excludeEnd("ide");
  16236. messageSends: ["from:"]
  16237. }),
  16238. globals.AssociativeCollection.klass);
  16239. smalltalk.addMethod(
  16240. smalltalk.method({
  16241. selector: "newFromPairs:",
  16242. protocol: 'instance creation',
  16243. fn: function (aCollection){
  16244. var self=this;
  16245. var newCollection;
  16246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16247. return smalltalk.withContext(function($ctx1) {
  16248. //>>excludeEnd("ctx");
  16249. var $2,$1,$3,$4,$5;
  16250. $2=_st(aCollection)._size();
  16251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16252. $ctx1.sendIdx["size"]=1;
  16253. //>>excludeEnd("ctx");
  16254. $1=_st($2)._even();
  16255. if(! smalltalk.assert($1)){
  16256. self._error_("#newFromPairs only accepts arrays of an even length");
  16257. };
  16258. newCollection=self._new();
  16259. _st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
  16260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16261. return smalltalk.withContext(function($ctx2) {
  16262. //>>excludeEnd("ctx");
  16263. $3=newCollection;
  16264. $4=_st(aCollection)._at_(each);
  16265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16266. $ctx2.sendIdx["at:"]=1;
  16267. //>>excludeEnd("ctx");
  16268. return _st($3)._at_put_($4,_st(aCollection)._at_(_st(each).__plus((1))));
  16269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16270. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  16271. //>>excludeEnd("ctx");
  16272. }));
  16273. $5=newCollection;
  16274. return $5;
  16275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16276. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)});
  16277. //>>excludeEnd("ctx");
  16278. },
  16279. //>>excludeStart("ide", pragmas.excludeIdeData);
  16280. args: ["aCollection"],
  16281. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  16282. referencedClasses: [],
  16283. //>>excludeEnd("ide");
  16284. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  16285. }),
  16286. globals.AssociativeCollection.klass);
  16287. smalltalk.addClass('Dictionary', globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  16288. //>>excludeStart("ide", pragmas.excludeIdeData);
  16289. globals.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.";
  16290. //>>excludeEnd("ide");
  16291. smalltalk.addMethod(
  16292. smalltalk.method({
  16293. selector: "at:ifAbsent:",
  16294. protocol: 'accessing',
  16295. fn: function (aKey,aBlock){
  16296. var self=this;
  16297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16298. return smalltalk.withContext(function($ctx1) {
  16299. //>>excludeEnd("ctx");
  16300. var index = self._positionOfKey_(aKey);
  16301. return index >=0 ? self['@values'][index] : aBlock._value();
  16302. ;
  16303. return self;
  16304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16305. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)});
  16306. //>>excludeEnd("ctx");
  16307. },
  16308. //>>excludeStart("ide", pragmas.excludeIdeData);
  16309. args: ["aKey", "aBlock"],
  16310. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
  16311. referencedClasses: [],
  16312. //>>excludeEnd("ide");
  16313. messageSends: []
  16314. }),
  16315. globals.Dictionary);
  16316. smalltalk.addMethod(
  16317. smalltalk.method({
  16318. selector: "at:put:",
  16319. protocol: 'accessing',
  16320. fn: function (aKey,aValue){
  16321. var self=this;
  16322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16323. return smalltalk.withContext(function($ctx1) {
  16324. //>>excludeEnd("ctx");
  16325. var index = self._positionOfKey_(aKey);
  16326. if(index === -1) {
  16327. var keys = self['@keys'];
  16328. index = keys.length;
  16329. keys.push(aKey);
  16330. }
  16331. return self['@values'][index] = aValue;
  16332. ;
  16333. return self;
  16334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16335. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.Dictionary)});
  16336. //>>excludeEnd("ctx");
  16337. },
  16338. //>>excludeStart("ide", pragmas.excludeIdeData);
  16339. args: ["aKey", "aValue"],
  16340. 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>",
  16341. referencedClasses: [],
  16342. //>>excludeEnd("ide");
  16343. messageSends: []
  16344. }),
  16345. globals.Dictionary);
  16346. smalltalk.addMethod(
  16347. smalltalk.method({
  16348. selector: "includesKey:",
  16349. protocol: 'testing',
  16350. fn: function (aKey){
  16351. var self=this;
  16352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16353. return smalltalk.withContext(function($ctx1) {
  16354. //>>excludeEnd("ctx");
  16355. return self._positionOfKey_(aKey) >= 0; ;
  16356. return self;
  16357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16358. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.Dictionary)});
  16359. //>>excludeEnd("ctx");
  16360. },
  16361. //>>excludeStart("ide", pragmas.excludeIdeData);
  16362. args: ["aKey"],
  16363. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  16364. referencedClasses: [],
  16365. //>>excludeEnd("ide");
  16366. messageSends: []
  16367. }),
  16368. globals.Dictionary);
  16369. smalltalk.addMethod(
  16370. smalltalk.method({
  16371. selector: "indexOf:ifAbsent:",
  16372. protocol: 'accessing',
  16373. fn: function (anObject,aBlock){
  16374. var self=this;
  16375. var index;
  16376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16377. return smalltalk.withContext(function($ctx1) {
  16378. //>>excludeEnd("ctx");
  16379. var $2,$1;
  16380. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  16381. return (0);
  16382. }));
  16383. $2=_st(index).__eq((0));
  16384. if(smalltalk.assert($2)){
  16385. $1=_st(aBlock)._value();
  16386. } else {
  16387. $1=_st(self["@keys"])._at_(index);
  16388. };
  16389. return $1;
  16390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16391. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Dictionary)});
  16392. //>>excludeEnd("ctx");
  16393. },
  16394. //>>excludeStart("ide", pragmas.excludeIdeData);
  16395. args: ["anObject", "aBlock"],
  16396. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  16397. referencedClasses: [],
  16398. //>>excludeEnd("ide");
  16399. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  16400. }),
  16401. globals.Dictionary);
  16402. smalltalk.addMethod(
  16403. smalltalk.method({
  16404. selector: "initialize",
  16405. protocol: 'initialization',
  16406. fn: function (){
  16407. var self=this;
  16408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16409. return smalltalk.withContext(function($ctx1) {
  16410. //>>excludeEnd("ctx");
  16411. (
  16412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16413. $ctx1.supercall = true,
  16414. //>>excludeEnd("ctx");
  16415. globals.Dictionary.superclass.fn.prototype._initialize.apply(_st(self), []));
  16416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16417. $ctx1.supercall = false;
  16418. //>>excludeEnd("ctx");;
  16419. self["@keys"]=[];
  16420. self["@values"]=[];
  16421. return self;
  16422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16423. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Dictionary)});
  16424. //>>excludeEnd("ctx");
  16425. },
  16426. //>>excludeStart("ide", pragmas.excludeIdeData);
  16427. args: [],
  16428. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  16429. referencedClasses: [],
  16430. //>>excludeEnd("ide");
  16431. messageSends: ["initialize"]
  16432. }),
  16433. globals.Dictionary);
  16434. smalltalk.addMethod(
  16435. smalltalk.method({
  16436. selector: "keys",
  16437. protocol: 'accessing',
  16438. fn: function (){
  16439. var self=this;
  16440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16441. return smalltalk.withContext(function($ctx1) {
  16442. //>>excludeEnd("ctx");
  16443. var $1;
  16444. $1=_st(self["@keys"])._copy();
  16445. return $1;
  16446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16447. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.Dictionary)});
  16448. //>>excludeEnd("ctx");
  16449. },
  16450. //>>excludeStart("ide", pragmas.excludeIdeData);
  16451. args: [],
  16452. source: "keys\x0a\x09^ keys copy",
  16453. referencedClasses: [],
  16454. //>>excludeEnd("ide");
  16455. messageSends: ["copy"]
  16456. }),
  16457. globals.Dictionary);
  16458. smalltalk.addMethod(
  16459. smalltalk.method({
  16460. selector: "keysAndValuesDo:",
  16461. protocol: 'enumerating',
  16462. fn: function (aBlock){
  16463. var self=this;
  16464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16465. return smalltalk.withContext(function($ctx1) {
  16466. //>>excludeEnd("ctx");
  16467. var $1;
  16468. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  16469. return $1;
  16470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16471. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.Dictionary)});
  16472. //>>excludeEnd("ctx");
  16473. },
  16474. //>>excludeStart("ide", pragmas.excludeIdeData);
  16475. args: ["aBlock"],
  16476. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  16477. referencedClasses: [],
  16478. //>>excludeEnd("ide");
  16479. messageSends: ["with:do:"]
  16480. }),
  16481. globals.Dictionary);
  16482. smalltalk.addMethod(
  16483. smalltalk.method({
  16484. selector: "keysDo:",
  16485. protocol: 'enumerating',
  16486. fn: function (aBlock){
  16487. var self=this;
  16488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16489. return smalltalk.withContext(function($ctx1) {
  16490. //>>excludeEnd("ctx");
  16491. var $1;
  16492. $1=_st(self["@keys"])._do_(aBlock);
  16493. return $1;
  16494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16495. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.Dictionary)});
  16496. //>>excludeEnd("ctx");
  16497. },
  16498. //>>excludeStart("ide", pragmas.excludeIdeData);
  16499. args: ["aBlock"],
  16500. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  16501. referencedClasses: [],
  16502. //>>excludeEnd("ide");
  16503. messageSends: ["do:"]
  16504. }),
  16505. globals.Dictionary);
  16506. smalltalk.addMethod(
  16507. smalltalk.method({
  16508. selector: "positionOfKey:",
  16509. protocol: 'private',
  16510. fn: function (anObject){
  16511. var self=this;
  16512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16513. return smalltalk.withContext(function($ctx1) {
  16514. //>>excludeEnd("ctx");
  16515. var keys = self['@keys'];
  16516. for(var i=0;i<keys.length;i++){
  16517. if(keys[i].__eq(anObject)) { return i;}
  16518. }
  16519. return -1;
  16520. ;
  16521. return self;
  16522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16523. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},globals.Dictionary)});
  16524. //>>excludeEnd("ctx");
  16525. },
  16526. //>>excludeStart("ide", pragmas.excludeIdeData);
  16527. args: ["anObject"],
  16528. 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>",
  16529. referencedClasses: [],
  16530. //>>excludeEnd("ide");
  16531. messageSends: []
  16532. }),
  16533. globals.Dictionary);
  16534. smalltalk.addMethod(
  16535. smalltalk.method({
  16536. selector: "removeAll",
  16537. protocol: 'adding/removing',
  16538. fn: function (){
  16539. var self=this;
  16540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16541. return smalltalk.withContext(function($ctx1) {
  16542. //>>excludeEnd("ctx");
  16543. _st(self["@keys"])._removeAll();
  16544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16545. $ctx1.sendIdx["removeAll"]=1;
  16546. //>>excludeEnd("ctx");
  16547. _st(self["@values"])._removeAll();
  16548. return self;
  16549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16550. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Dictionary)});
  16551. //>>excludeEnd("ctx");
  16552. },
  16553. //>>excludeStart("ide", pragmas.excludeIdeData);
  16554. args: [],
  16555. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  16556. referencedClasses: [],
  16557. //>>excludeEnd("ide");
  16558. messageSends: ["removeAll"]
  16559. }),
  16560. globals.Dictionary);
  16561. smalltalk.addMethod(
  16562. smalltalk.method({
  16563. selector: "removeKey:ifAbsent:",
  16564. protocol: 'adding/removing',
  16565. fn: function (aKey,aBlock){
  16566. var self=this;
  16567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16568. return smalltalk.withContext(function($ctx1) {
  16569. //>>excludeEnd("ctx");
  16570. var index = self._positionOfKey_(aKey);
  16571. if(index === -1) {
  16572. return aBlock._value()
  16573. } else {
  16574. var keys = self['@keys'], values = self['@values'];
  16575. var value = values[index], l = keys.length;
  16576. keys[index] = keys[l-1];
  16577. keys.pop();
  16578. values[index] = values[l-1];
  16579. values.pop();
  16580. return value;
  16581. }
  16582. ;
  16583. return self;
  16584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16585. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)});
  16586. //>>excludeEnd("ctx");
  16587. },
  16588. //>>excludeStart("ide", pragmas.excludeIdeData);
  16589. args: ["aKey", "aBlock"],
  16590. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\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>",
  16591. referencedClasses: [],
  16592. //>>excludeEnd("ide");
  16593. messageSends: []
  16594. }),
  16595. globals.Dictionary);
  16596. smalltalk.addMethod(
  16597. smalltalk.method({
  16598. selector: "values",
  16599. protocol: 'accessing',
  16600. fn: function (){
  16601. var self=this;
  16602. var $1;
  16603. $1=self["@values"];
  16604. return $1;
  16605. },
  16606. //>>excludeStart("ide", pragmas.excludeIdeData);
  16607. args: [],
  16608. source: "values\x0a\x09^ values",
  16609. referencedClasses: [],
  16610. //>>excludeEnd("ide");
  16611. messageSends: []
  16612. }),
  16613. globals.Dictionary);
  16614. smalltalk.addMethod(
  16615. smalltalk.method({
  16616. selector: "valuesDo:",
  16617. protocol: 'enumerating',
  16618. fn: function (aBlock){
  16619. var self=this;
  16620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16621. return smalltalk.withContext(function($ctx1) {
  16622. //>>excludeEnd("ctx");
  16623. var $1;
  16624. $1=_st(self["@values"])._do_(aBlock);
  16625. return $1;
  16626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16627. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.Dictionary)});
  16628. //>>excludeEnd("ctx");
  16629. },
  16630. //>>excludeStart("ide", pragmas.excludeIdeData);
  16631. args: ["aBlock"],
  16632. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  16633. referencedClasses: [],
  16634. //>>excludeEnd("ide");
  16635. messageSends: ["do:"]
  16636. }),
  16637. globals.Dictionary);
  16638. smalltalk.addClass('HashedCollection', globals.AssociativeCollection, [], 'Kernel-Collections');
  16639. //>>excludeStart("ide", pragmas.excludeIdeData);
  16640. globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  16641. //>>excludeEnd("ide");
  16642. smalltalk.addMethod(
  16643. smalltalk.method({
  16644. selector: "at:ifAbsent:",
  16645. protocol: 'accessing',
  16646. fn: function (aKey,aBlock){
  16647. var self=this;
  16648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16649. return smalltalk.withContext(function($ctx1) {
  16650. //>>excludeEnd("ctx");
  16651. var $2,$1;
  16652. $2=self._includesKey_(aKey);
  16653. if(smalltalk.assert($2)){
  16654. $1=self._basicAt_(aKey);
  16655. } else {
  16656. $1=_st(aBlock)._value();
  16657. };
  16658. return $1;
  16659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16660. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)});
  16661. //>>excludeEnd("ctx");
  16662. },
  16663. //>>excludeStart("ide", pragmas.excludeIdeData);
  16664. args: ["aKey", "aBlock"],
  16665. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  16666. referencedClasses: [],
  16667. //>>excludeEnd("ide");
  16668. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  16669. }),
  16670. globals.HashedCollection);
  16671. smalltalk.addMethod(
  16672. smalltalk.method({
  16673. selector: "at:put:",
  16674. protocol: 'accessing',
  16675. fn: function (aKey,aValue){
  16676. var self=this;
  16677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16678. return smalltalk.withContext(function($ctx1) {
  16679. //>>excludeEnd("ctx");
  16680. var $1;
  16681. $1=self._basicAt_put_(aKey,aValue);
  16682. return $1;
  16683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16684. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.HashedCollection)});
  16685. //>>excludeEnd("ctx");
  16686. },
  16687. //>>excludeStart("ide", pragmas.excludeIdeData);
  16688. args: ["aKey", "aValue"],
  16689. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  16690. referencedClasses: [],
  16691. //>>excludeEnd("ide");
  16692. messageSends: ["basicAt:put:"]
  16693. }),
  16694. globals.HashedCollection);
  16695. smalltalk.addMethod(
  16696. smalltalk.method({
  16697. selector: "includesKey:",
  16698. protocol: 'testing',
  16699. fn: function (aKey){
  16700. var self=this;
  16701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16702. return smalltalk.withContext(function($ctx1) {
  16703. //>>excludeEnd("ctx");
  16704. return self.hasOwnProperty(aKey);
  16705. return self;
  16706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16707. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.HashedCollection)});
  16708. //>>excludeEnd("ctx");
  16709. },
  16710. //>>excludeStart("ide", pragmas.excludeIdeData);
  16711. args: ["aKey"],
  16712. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  16713. referencedClasses: [],
  16714. //>>excludeEnd("ide");
  16715. messageSends: []
  16716. }),
  16717. globals.HashedCollection);
  16718. smalltalk.addMethod(
  16719. smalltalk.method({
  16720. selector: "keys",
  16721. protocol: 'accessing',
  16722. fn: function (){
  16723. var self=this;
  16724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16725. return smalltalk.withContext(function($ctx1) {
  16726. //>>excludeEnd("ctx");
  16727. return Object.keys(self);
  16728. return self;
  16729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16730. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.HashedCollection)});
  16731. //>>excludeEnd("ctx");
  16732. },
  16733. //>>excludeStart("ide", pragmas.excludeIdeData);
  16734. args: [],
  16735. source: "keys\x0a\x09<return Object.keys(self)>",
  16736. referencedClasses: [],
  16737. //>>excludeEnd("ide");
  16738. messageSends: []
  16739. }),
  16740. globals.HashedCollection);
  16741. smalltalk.addMethod(
  16742. smalltalk.method({
  16743. selector: "keysDo:",
  16744. protocol: 'enumerating',
  16745. fn: function (aBlock){
  16746. var self=this;
  16747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16748. return smalltalk.withContext(function($ctx1) {
  16749. //>>excludeEnd("ctx");
  16750. _st(self._keys())._do_(aBlock);
  16751. return self;
  16752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16753. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.HashedCollection)});
  16754. //>>excludeEnd("ctx");
  16755. },
  16756. //>>excludeStart("ide", pragmas.excludeIdeData);
  16757. args: ["aBlock"],
  16758. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  16759. referencedClasses: [],
  16760. //>>excludeEnd("ide");
  16761. messageSends: ["do:", "keys"]
  16762. }),
  16763. globals.HashedCollection);
  16764. smalltalk.addMethod(
  16765. smalltalk.method({
  16766. selector: "removeKey:ifAbsent:",
  16767. protocol: 'adding/removing',
  16768. fn: function (aKey,aBlock){
  16769. var self=this;
  16770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16771. return smalltalk.withContext(function($ctx1) {
  16772. //>>excludeEnd("ctx");
  16773. var $1;
  16774. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  16775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16776. return smalltalk.withContext(function($ctx2) {
  16777. //>>excludeEnd("ctx");
  16778. self._basicDelete_(aKey);
  16779. return removed;
  16780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16781. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  16782. //>>excludeEnd("ctx");
  16783. }),(function(){
  16784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16785. return smalltalk.withContext(function($ctx2) {
  16786. //>>excludeEnd("ctx");
  16787. return _st(aBlock)._value();
  16788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16790. //>>excludeEnd("ctx");
  16791. }));
  16792. return $1;
  16793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16794. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)});
  16795. //>>excludeEnd("ctx");
  16796. },
  16797. //>>excludeStart("ide", pragmas.excludeIdeData);
  16798. args: ["aKey", "aBlock"],
  16799. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  16800. referencedClasses: [],
  16801. //>>excludeEnd("ide");
  16802. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  16803. }),
  16804. globals.HashedCollection);
  16805. smalltalk.addMethod(
  16806. smalltalk.method({
  16807. selector: "values",
  16808. protocol: 'accessing',
  16809. fn: function (){
  16810. var self=this;
  16811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16812. return smalltalk.withContext(function($ctx1) {
  16813. //>>excludeEnd("ctx");
  16814. return self._keys().map(function(key){
  16815. return self._at_(key);
  16816. });
  16817. ;
  16818. return self;
  16819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16820. }, function($ctx1) {$ctx1.fill(self,"values",{},globals.HashedCollection)});
  16821. //>>excludeEnd("ctx");
  16822. },
  16823. //>>excludeStart("ide", pragmas.excludeIdeData);
  16824. args: [],
  16825. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  16826. referencedClasses: [],
  16827. //>>excludeEnd("ide");
  16828. messageSends: []
  16829. }),
  16830. globals.HashedCollection);
  16831. smalltalk.addMethod(
  16832. smalltalk.method({
  16833. selector: "valuesDo:",
  16834. protocol: 'enumerating',
  16835. fn: function (aBlock){
  16836. var self=this;
  16837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16838. return smalltalk.withContext(function($ctx1) {
  16839. //>>excludeEnd("ctx");
  16840. _st(self._values())._do_(aBlock);
  16841. return self;
  16842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16843. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.HashedCollection)});
  16844. //>>excludeEnd("ctx");
  16845. },
  16846. //>>excludeStart("ide", pragmas.excludeIdeData);
  16847. args: ["aBlock"],
  16848. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  16849. referencedClasses: [],
  16850. //>>excludeEnd("ide");
  16851. messageSends: ["do:", "values"]
  16852. }),
  16853. globals.HashedCollection);
  16854. smalltalk.addClass('SequenceableCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  16855. //>>excludeStart("ide", pragmas.excludeIdeData);
  16856. globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  16857. //>>excludeEnd("ide");
  16858. smalltalk.addMethod(
  16859. smalltalk.method({
  16860. selector: "=",
  16861. protocol: 'comparing',
  16862. fn: function (aCollection){
  16863. var self=this;
  16864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16865. return smalltalk.withContext(function($ctx1) {
  16866. //>>excludeEnd("ctx");
  16867. var $3,$2,$4,$1,$5;
  16868. var $early={};
  16869. try {
  16870. $3=self._class();
  16871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16872. $ctx1.sendIdx["class"]=1;
  16873. //>>excludeEnd("ctx");
  16874. $2=_st($3).__eq(_st(aCollection)._class());
  16875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16876. $ctx1.sendIdx["="]=1;
  16877. //>>excludeEnd("ctx");
  16878. $1=_st($2)._and_((function(){
  16879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16880. return smalltalk.withContext(function($ctx2) {
  16881. //>>excludeEnd("ctx");
  16882. $4=self._size();
  16883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16884. $ctx2.sendIdx["size"]=1;
  16885. //>>excludeEnd("ctx");
  16886. return _st($4).__eq(_st(aCollection)._size());
  16887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16888. $ctx2.sendIdx["="]=2;
  16889. //>>excludeEnd("ctx");
  16890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16892. //>>excludeEnd("ctx");
  16893. }));
  16894. if(! smalltalk.assert($1)){
  16895. return false;
  16896. };
  16897. self._withIndexDo_((function(each,i){
  16898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16899. return smalltalk.withContext(function($ctx2) {
  16900. //>>excludeEnd("ctx");
  16901. $5=_st(_st(aCollection)._at_(i)).__eq(each);
  16902. if(! smalltalk.assert($5)){
  16903. throw $early=[false];
  16904. };
  16905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16906. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  16907. //>>excludeEnd("ctx");
  16908. }));
  16909. return true;
  16910. }
  16911. catch(e) {if(e===$early)return e[0]; throw e}
  16912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16913. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.SequenceableCollection)});
  16914. //>>excludeEnd("ctx");
  16915. },
  16916. //>>excludeStart("ide", pragmas.excludeIdeData);
  16917. args: ["aCollection"],
  16918. 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",
  16919. referencedClasses: [],
  16920. //>>excludeEnd("ide");
  16921. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  16922. }),
  16923. globals.SequenceableCollection);
  16924. smalltalk.addMethod(
  16925. smalltalk.method({
  16926. selector: "addLast:",
  16927. protocol: 'adding/removing',
  16928. fn: function (anObject){
  16929. var self=this;
  16930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16931. return smalltalk.withContext(function($ctx1) {
  16932. //>>excludeEnd("ctx");
  16933. self._add_(anObject);
  16934. return self;
  16935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16936. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},globals.SequenceableCollection)});
  16937. //>>excludeEnd("ctx");
  16938. },
  16939. //>>excludeStart("ide", pragmas.excludeIdeData);
  16940. args: ["anObject"],
  16941. source: "addLast: anObject\x0a\x09self add: anObject",
  16942. referencedClasses: [],
  16943. //>>excludeEnd("ide");
  16944. messageSends: ["add:"]
  16945. }),
  16946. globals.SequenceableCollection);
  16947. smalltalk.addMethod(
  16948. smalltalk.method({
  16949. selector: "allButFirst",
  16950. protocol: 'accessing',
  16951. fn: function (){
  16952. var self=this;
  16953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16954. return smalltalk.withContext(function($ctx1) {
  16955. //>>excludeEnd("ctx");
  16956. var $1;
  16957. $1=self._copyFrom_to_((2),self._size());
  16958. return $1;
  16959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16960. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},globals.SequenceableCollection)});
  16961. //>>excludeEnd("ctx");
  16962. },
  16963. //>>excludeStart("ide", pragmas.excludeIdeData);
  16964. args: [],
  16965. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  16966. referencedClasses: [],
  16967. //>>excludeEnd("ide");
  16968. messageSends: ["copyFrom:to:", "size"]
  16969. }),
  16970. globals.SequenceableCollection);
  16971. smalltalk.addMethod(
  16972. smalltalk.method({
  16973. selector: "allButLast",
  16974. protocol: 'accessing',
  16975. fn: function (){
  16976. var self=this;
  16977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16978. return smalltalk.withContext(function($ctx1) {
  16979. //>>excludeEnd("ctx");
  16980. var $1;
  16981. $1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
  16982. return $1;
  16983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16984. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},globals.SequenceableCollection)});
  16985. //>>excludeEnd("ctx");
  16986. },
  16987. //>>excludeStart("ide", pragmas.excludeIdeData);
  16988. args: [],
  16989. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  16990. referencedClasses: [],
  16991. //>>excludeEnd("ide");
  16992. messageSends: ["copyFrom:to:", "-", "size"]
  16993. }),
  16994. globals.SequenceableCollection);
  16995. smalltalk.addMethod(
  16996. smalltalk.method({
  16997. selector: "atRandom",
  16998. protocol: 'accessing',
  16999. fn: function (){
  17000. var self=this;
  17001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17002. return smalltalk.withContext(function($ctx1) {
  17003. //>>excludeEnd("ctx");
  17004. var $1;
  17005. $1=self._at_(_st(self._size())._atRandom());
  17006. return $1;
  17007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17008. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.SequenceableCollection)});
  17009. //>>excludeEnd("ctx");
  17010. },
  17011. //>>excludeStart("ide", pragmas.excludeIdeData);
  17012. args: [],
  17013. source: "atRandom\x0a\x09^ self at: self size atRandom",
  17014. referencedClasses: [],
  17015. //>>excludeEnd("ide");
  17016. messageSends: ["at:", "atRandom", "size"]
  17017. }),
  17018. globals.SequenceableCollection);
  17019. smalltalk.addMethod(
  17020. smalltalk.method({
  17021. selector: "beginsWith:",
  17022. protocol: 'testing',
  17023. fn: function (prefix){
  17024. var self=this;
  17025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17026. return smalltalk.withContext(function($ctx1) {
  17027. //>>excludeEnd("ctx");
  17028. var $2,$3,$1,$4;
  17029. $2=self._size();
  17030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17031. $ctx1.sendIdx["size"]=1;
  17032. //>>excludeEnd("ctx");
  17033. $3=_st(prefix)._size();
  17034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17035. $ctx1.sendIdx["size"]=2;
  17036. //>>excludeEnd("ctx");
  17037. $1=_st($2).__lt($3);
  17038. if(smalltalk.assert($1)){
  17039. return false;
  17040. };
  17041. $4=_st(self._first_(_st(prefix)._size())).__eq(prefix);
  17042. return $4;
  17043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17044. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},globals.SequenceableCollection)});
  17045. //>>excludeEnd("ctx");
  17046. },
  17047. //>>excludeStart("ide", pragmas.excludeIdeData);
  17048. args: ["prefix"],
  17049. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  17050. referencedClasses: [],
  17051. //>>excludeEnd("ide");
  17052. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  17053. }),
  17054. globals.SequenceableCollection);
  17055. smalltalk.addMethod(
  17056. smalltalk.method({
  17057. selector: "copyFrom:to:",
  17058. protocol: 'copying',
  17059. fn: function (anIndex,anotherIndex){
  17060. var self=this;
  17061. var range,newCollection;
  17062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17063. return smalltalk.withContext(function($ctx1) {
  17064. //>>excludeEnd("ctx");
  17065. var $1;
  17066. range=_st(anIndex)._to_(anotherIndex);
  17067. newCollection=_st(self._class())._new_(_st(range)._size());
  17068. _st(range)._withIndexDo_((function(each,i){
  17069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17070. return smalltalk.withContext(function($ctx2) {
  17071. //>>excludeEnd("ctx");
  17072. return _st(newCollection)._at_put_(i,self._at_(each));
  17073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17074. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  17075. //>>excludeEnd("ctx");
  17076. }));
  17077. $1=newCollection;
  17078. return $1;
  17079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17080. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},globals.SequenceableCollection)});
  17081. //>>excludeEnd("ctx");
  17082. },
  17083. //>>excludeStart("ide", pragmas.excludeIdeData);
  17084. args: ["anIndex", "anotherIndex"],
  17085. 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",
  17086. referencedClasses: [],
  17087. //>>excludeEnd("ide");
  17088. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"]
  17089. }),
  17090. globals.SequenceableCollection);
  17091. smalltalk.addMethod(
  17092. smalltalk.method({
  17093. selector: "deepCopy",
  17094. protocol: 'copying',
  17095. fn: function (){
  17096. var self=this;
  17097. var newCollection;
  17098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17099. return smalltalk.withContext(function($ctx1) {
  17100. //>>excludeEnd("ctx");
  17101. var $1;
  17102. newCollection=_st(self._class())._new_(self._size());
  17103. self._withIndexDo_((function(each,index){
  17104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17105. return smalltalk.withContext(function($ctx2) {
  17106. //>>excludeEnd("ctx");
  17107. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  17108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17109. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  17110. //>>excludeEnd("ctx");
  17111. }));
  17112. $1=newCollection;
  17113. return $1;
  17114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17115. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},globals.SequenceableCollection)});
  17116. //>>excludeEnd("ctx");
  17117. },
  17118. //>>excludeStart("ide", pragmas.excludeIdeData);
  17119. args: [],
  17120. 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",
  17121. referencedClasses: [],
  17122. //>>excludeEnd("ide");
  17123. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"]
  17124. }),
  17125. globals.SequenceableCollection);
  17126. smalltalk.addMethod(
  17127. smalltalk.method({
  17128. selector: "detect:ifNone:",
  17129. protocol: 'enumerating',
  17130. fn: function (aBlock,anotherBlock){
  17131. var self=this;
  17132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17133. return smalltalk.withContext(function($ctx1) {
  17134. //>>excludeEnd("ctx");
  17135. self = self._numericallyIndexable();
  17136. for(var i = 0; i < self.length; i++)
  17137. if(aBlock._value_(self[i]))
  17138. return self[i];
  17139. return anotherBlock._value();
  17140. ;
  17141. return self;
  17142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17143. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.SequenceableCollection)});
  17144. //>>excludeEnd("ctx");
  17145. },
  17146. //>>excludeStart("ide", pragmas.excludeIdeData);
  17147. args: ["aBlock", "anotherBlock"],
  17148. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09>",
  17149. referencedClasses: [],
  17150. //>>excludeEnd("ide");
  17151. messageSends: []
  17152. }),
  17153. globals.SequenceableCollection);
  17154. smalltalk.addMethod(
  17155. smalltalk.method({
  17156. selector: "do:",
  17157. protocol: 'enumerating',
  17158. fn: function (aBlock){
  17159. var self=this;
  17160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17161. return smalltalk.withContext(function($ctx1) {
  17162. //>>excludeEnd("ctx");
  17163. self = self._numericallyIndexable();
  17164. for(var i=0; i < self.length; i++) {
  17165. aBlock._value_(self[i]);
  17166. }
  17167. ;
  17168. return self;
  17169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17170. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.SequenceableCollection)});
  17171. //>>excludeEnd("ctx");
  17172. },
  17173. //>>excludeStart("ide", pragmas.excludeIdeData);
  17174. args: ["aBlock"],
  17175. source: "do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09>",
  17176. referencedClasses: [],
  17177. //>>excludeEnd("ide");
  17178. messageSends: []
  17179. }),
  17180. globals.SequenceableCollection);
  17181. smalltalk.addMethod(
  17182. smalltalk.method({
  17183. selector: "endsWith:",
  17184. protocol: 'testing',
  17185. fn: function (suffix){
  17186. var self=this;
  17187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17188. return smalltalk.withContext(function($ctx1) {
  17189. //>>excludeEnd("ctx");
  17190. var $2,$3,$1,$4;
  17191. $2=self._size();
  17192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17193. $ctx1.sendIdx["size"]=1;
  17194. //>>excludeEnd("ctx");
  17195. $3=_st(suffix)._size();
  17196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17197. $ctx1.sendIdx["size"]=2;
  17198. //>>excludeEnd("ctx");
  17199. $1=_st($2).__lt($3);
  17200. if(smalltalk.assert($1)){
  17201. return false;
  17202. };
  17203. $4=_st(self._last_(_st(suffix)._size())).__eq(suffix);
  17204. return $4;
  17205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17206. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},globals.SequenceableCollection)});
  17207. //>>excludeEnd("ctx");
  17208. },
  17209. //>>excludeStart("ide", pragmas.excludeIdeData);
  17210. args: ["suffix"],
  17211. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  17212. referencedClasses: [],
  17213. //>>excludeEnd("ide");
  17214. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  17215. }),
  17216. globals.SequenceableCollection);
  17217. smalltalk.addMethod(
  17218. smalltalk.method({
  17219. selector: "first",
  17220. protocol: 'accessing',
  17221. fn: function (){
  17222. var self=this;
  17223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17224. return smalltalk.withContext(function($ctx1) {
  17225. //>>excludeEnd("ctx");
  17226. var $1;
  17227. $1=self._at_((1));
  17228. return $1;
  17229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17230. }, function($ctx1) {$ctx1.fill(self,"first",{},globals.SequenceableCollection)});
  17231. //>>excludeEnd("ctx");
  17232. },
  17233. //>>excludeStart("ide", pragmas.excludeIdeData);
  17234. args: [],
  17235. source: "first\x0a\x09^ self at: 1",
  17236. referencedClasses: [],
  17237. //>>excludeEnd("ide");
  17238. messageSends: ["at:"]
  17239. }),
  17240. globals.SequenceableCollection);
  17241. smalltalk.addMethod(
  17242. smalltalk.method({
  17243. selector: "first:",
  17244. protocol: 'accessing',
  17245. fn: function (aNumber){
  17246. var self=this;
  17247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17248. return smalltalk.withContext(function($ctx1) {
  17249. //>>excludeEnd("ctx");
  17250. var $1,$2;
  17251. $1=_st(self._size()).__lt(aNumber);
  17252. if(smalltalk.assert($1)){
  17253. self._error_("Invalid number of elements");
  17254. };
  17255. $2=self._copyFrom_to_((1),aNumber);
  17256. return $2;
  17257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17258. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},globals.SequenceableCollection)});
  17259. //>>excludeEnd("ctx");
  17260. },
  17261. //>>excludeStart("ide", pragmas.excludeIdeData);
  17262. args: ["aNumber"],
  17263. source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
  17264. referencedClasses: [],
  17265. //>>excludeEnd("ide");
  17266. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  17267. }),
  17268. globals.SequenceableCollection);
  17269. smalltalk.addMethod(
  17270. smalltalk.method({
  17271. selector: "fourth",
  17272. protocol: 'accessing',
  17273. fn: function (){
  17274. var self=this;
  17275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17276. return smalltalk.withContext(function($ctx1) {
  17277. //>>excludeEnd("ctx");
  17278. var $1;
  17279. $1=self._at_((4));
  17280. return $1;
  17281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17282. }, function($ctx1) {$ctx1.fill(self,"fourth",{},globals.SequenceableCollection)});
  17283. //>>excludeEnd("ctx");
  17284. },
  17285. //>>excludeStart("ide", pragmas.excludeIdeData);
  17286. args: [],
  17287. source: "fourth\x0a\x09^ self at: 4",
  17288. referencedClasses: [],
  17289. //>>excludeEnd("ide");
  17290. messageSends: ["at:"]
  17291. }),
  17292. globals.SequenceableCollection);
  17293. smalltalk.addMethod(
  17294. smalltalk.method({
  17295. selector: "includes:",
  17296. protocol: 'testing',
  17297. fn: function (anObject){
  17298. var self=this;
  17299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17300. return smalltalk.withContext(function($ctx1) {
  17301. //>>excludeEnd("ctx");
  17302. var $1;
  17303. $1=_st(self._indexOf_ifAbsent_(anObject,(function(){
  17304. return nil;
  17305. })))._notNil();
  17306. return $1;
  17307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17308. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.SequenceableCollection)});
  17309. //>>excludeEnd("ctx");
  17310. },
  17311. //>>excludeStart("ide", pragmas.excludeIdeData);
  17312. args: ["anObject"],
  17313. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  17314. referencedClasses: [],
  17315. //>>excludeEnd("ide");
  17316. messageSends: ["notNil", "indexOf:ifAbsent:"]
  17317. }),
  17318. globals.SequenceableCollection);
  17319. smalltalk.addMethod(
  17320. smalltalk.method({
  17321. selector: "indexOf:ifAbsent:",
  17322. protocol: 'accessing',
  17323. fn: function (anObject,aBlock){
  17324. var self=this;
  17325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17326. return smalltalk.withContext(function($ctx1) {
  17327. //>>excludeEnd("ctx");
  17328. self = self._numericallyIndexable();
  17329. for(var i=0; i < self.length; i++) {
  17330. if(_st(self[i]).__eq(anObject)) {return i+1}
  17331. };
  17332. return aBlock._value();
  17333. ;
  17334. return self;
  17335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17336. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.SequenceableCollection)});
  17337. //>>excludeEnd("ctx");
  17338. },
  17339. //>>excludeStart("ide", pragmas.excludeIdeData);
  17340. args: ["anObject", "aBlock"],
  17341. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  17342. referencedClasses: [],
  17343. //>>excludeEnd("ide");
  17344. messageSends: []
  17345. }),
  17346. globals.SequenceableCollection);
  17347. smalltalk.addMethod(
  17348. smalltalk.method({
  17349. selector: "indexOf:startingAt:",
  17350. protocol: 'accessing',
  17351. fn: function (anObject,start){
  17352. var self=this;
  17353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17354. return smalltalk.withContext(function($ctx1) {
  17355. //>>excludeEnd("ctx");
  17356. var $1;
  17357. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  17358. return (0);
  17359. }));
  17360. return $1;
  17361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17362. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},globals.SequenceableCollection)});
  17363. //>>excludeEnd("ctx");
  17364. },
  17365. //>>excludeStart("ide", pragmas.excludeIdeData);
  17366. args: ["anObject", "start"],
  17367. 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 ]",
  17368. referencedClasses: [],
  17369. //>>excludeEnd("ide");
  17370. messageSends: ["indexOf:startingAt:ifAbsent:"]
  17371. }),
  17372. globals.SequenceableCollection);
  17373. smalltalk.addMethod(
  17374. smalltalk.method({
  17375. selector: "indexOf:startingAt:ifAbsent:",
  17376. protocol: 'accessing',
  17377. fn: function (anObject,start,aBlock){
  17378. var self=this;
  17379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17380. return smalltalk.withContext(function($ctx1) {
  17381. //>>excludeEnd("ctx");
  17382. self = self._numericallyIndexable();
  17383. for(var i=start - 1; i < self.length; i++){
  17384. if(_st(self[i]).__eq(anObject)) {return i+1}
  17385. }
  17386. return aBlock._value();
  17387. ;
  17388. return self;
  17389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17390. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},globals.SequenceableCollection)});
  17391. //>>excludeEnd("ctx");
  17392. },
  17393. //>>excludeStart("ide", pragmas.excludeIdeData);
  17394. args: ["anObject", "start", "aBlock"],
  17395. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  17396. referencedClasses: [],
  17397. //>>excludeEnd("ide");
  17398. messageSends: []
  17399. }),
  17400. globals.SequenceableCollection);
  17401. smalltalk.addMethod(
  17402. smalltalk.method({
  17403. selector: "last",
  17404. protocol: 'accessing',
  17405. fn: function (){
  17406. var self=this;
  17407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17408. return smalltalk.withContext(function($ctx1) {
  17409. //>>excludeEnd("ctx");
  17410. var $1;
  17411. $1=self._at_(self._size());
  17412. return $1;
  17413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17414. }, function($ctx1) {$ctx1.fill(self,"last",{},globals.SequenceableCollection)});
  17415. //>>excludeEnd("ctx");
  17416. },
  17417. //>>excludeStart("ide", pragmas.excludeIdeData);
  17418. args: [],
  17419. source: "last\x0a\x09^ self at: self size",
  17420. referencedClasses: [],
  17421. //>>excludeEnd("ide");
  17422. messageSends: ["at:", "size"]
  17423. }),
  17424. globals.SequenceableCollection);
  17425. smalltalk.addMethod(
  17426. smalltalk.method({
  17427. selector: "last:",
  17428. protocol: 'accessing',
  17429. fn: function (aNumber){
  17430. var self=this;
  17431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17432. return smalltalk.withContext(function($ctx1) {
  17433. //>>excludeEnd("ctx");
  17434. var $2,$1,$6,$5,$4,$3;
  17435. $2=self._size();
  17436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17437. $ctx1.sendIdx["size"]=1;
  17438. //>>excludeEnd("ctx");
  17439. $1=_st($2).__lt(aNumber);
  17440. if(smalltalk.assert($1)){
  17441. self._error_("Invalid number of elements");
  17442. };
  17443. $6=self._size();
  17444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17445. $ctx1.sendIdx["size"]=2;
  17446. //>>excludeEnd("ctx");
  17447. $5=_st($6).__minus(aNumber);
  17448. $4=_st($5).__plus((1));
  17449. $3=self._copyFrom_to_($4,self._size());
  17450. return $3;
  17451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17452. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},globals.SequenceableCollection)});
  17453. //>>excludeEnd("ctx");
  17454. },
  17455. //>>excludeStart("ide", pragmas.excludeIdeData);
  17456. args: ["aNumber"],
  17457. source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
  17458. referencedClasses: [],
  17459. //>>excludeEnd("ide");
  17460. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  17461. }),
  17462. globals.SequenceableCollection);
  17463. smalltalk.addMethod(
  17464. smalltalk.method({
  17465. selector: "newStream",
  17466. protocol: 'streaming',
  17467. fn: function (){
  17468. var self=this;
  17469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17470. return smalltalk.withContext(function($ctx1) {
  17471. //>>excludeEnd("ctx");
  17472. var $1;
  17473. $1=_st(self._streamClass())._on_(self);
  17474. return $1;
  17475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17476. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.SequenceableCollection)});
  17477. //>>excludeEnd("ctx");
  17478. },
  17479. //>>excludeStart("ide", pragmas.excludeIdeData);
  17480. args: [],
  17481. source: "newStream\x0a\x09^ self streamClass on: self",
  17482. referencedClasses: [],
  17483. //>>excludeEnd("ide");
  17484. messageSends: ["on:", "streamClass"]
  17485. }),
  17486. globals.SequenceableCollection);
  17487. smalltalk.addMethod(
  17488. smalltalk.method({
  17489. selector: "numericallyIndexable",
  17490. protocol: 'private',
  17491. fn: function (){
  17492. var self=this;
  17493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17494. return smalltalk.withContext(function($ctx1) {
  17495. //>>excludeEnd("ctx");
  17496. self._subclassResponsibility();
  17497. return self;
  17498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17499. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.SequenceableCollection)});
  17500. //>>excludeEnd("ctx");
  17501. },
  17502. //>>excludeStart("ide", pragmas.excludeIdeData);
  17503. args: [],
  17504. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  17505. referencedClasses: [],
  17506. //>>excludeEnd("ide");
  17507. messageSends: ["subclassResponsibility"]
  17508. }),
  17509. globals.SequenceableCollection);
  17510. smalltalk.addMethod(
  17511. smalltalk.method({
  17512. selector: "readStream",
  17513. protocol: 'streaming',
  17514. fn: function (){
  17515. var self=this;
  17516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17517. return smalltalk.withContext(function($ctx1) {
  17518. //>>excludeEnd("ctx");
  17519. var $1;
  17520. $1=self._stream();
  17521. return $1;
  17522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17523. }, function($ctx1) {$ctx1.fill(self,"readStream",{},globals.SequenceableCollection)});
  17524. //>>excludeEnd("ctx");
  17525. },
  17526. //>>excludeStart("ide", pragmas.excludeIdeData);
  17527. args: [],
  17528. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  17529. referencedClasses: [],
  17530. //>>excludeEnd("ide");
  17531. messageSends: ["stream"]
  17532. }),
  17533. globals.SequenceableCollection);
  17534. smalltalk.addMethod(
  17535. smalltalk.method({
  17536. selector: "removeLast",
  17537. protocol: 'adding/removing',
  17538. fn: function (){
  17539. var self=this;
  17540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17541. return smalltalk.withContext(function($ctx1) {
  17542. //>>excludeEnd("ctx");
  17543. var $1;
  17544. $1=self._remove_(self._last());
  17545. return $1;
  17546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17547. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.SequenceableCollection)});
  17548. //>>excludeEnd("ctx");
  17549. },
  17550. //>>excludeStart("ide", pragmas.excludeIdeData);
  17551. args: [],
  17552. source: "removeLast\x0a\x09^ self remove: self last",
  17553. referencedClasses: [],
  17554. //>>excludeEnd("ide");
  17555. messageSends: ["remove:", "last"]
  17556. }),
  17557. globals.SequenceableCollection);
  17558. smalltalk.addMethod(
  17559. smalltalk.method({
  17560. selector: "reversed",
  17561. protocol: 'converting',
  17562. fn: function (){
  17563. var self=this;
  17564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17565. return smalltalk.withContext(function($ctx1) {
  17566. //>>excludeEnd("ctx");
  17567. self._subclassResponsibility();
  17568. return self;
  17569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17570. }, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.SequenceableCollection)});
  17571. //>>excludeEnd("ctx");
  17572. },
  17573. //>>excludeStart("ide", pragmas.excludeIdeData);
  17574. args: [],
  17575. source: "reversed\x0a\x09self subclassResponsibility",
  17576. referencedClasses: [],
  17577. //>>excludeEnd("ide");
  17578. messageSends: ["subclassResponsibility"]
  17579. }),
  17580. globals.SequenceableCollection);
  17581. smalltalk.addMethod(
  17582. smalltalk.method({
  17583. selector: "second",
  17584. protocol: 'accessing',
  17585. fn: function (){
  17586. var self=this;
  17587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17588. return smalltalk.withContext(function($ctx1) {
  17589. //>>excludeEnd("ctx");
  17590. var $1;
  17591. $1=self._at_((2));
  17592. return $1;
  17593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17594. }, function($ctx1) {$ctx1.fill(self,"second",{},globals.SequenceableCollection)});
  17595. //>>excludeEnd("ctx");
  17596. },
  17597. //>>excludeStart("ide", pragmas.excludeIdeData);
  17598. args: [],
  17599. source: "second\x0a\x09^ self at: 2",
  17600. referencedClasses: [],
  17601. //>>excludeEnd("ide");
  17602. messageSends: ["at:"]
  17603. }),
  17604. globals.SequenceableCollection);
  17605. smalltalk.addMethod(
  17606. smalltalk.method({
  17607. selector: "shallowCopy",
  17608. protocol: 'copying',
  17609. fn: function (){
  17610. var self=this;
  17611. var newCollection;
  17612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17613. return smalltalk.withContext(function($ctx1) {
  17614. //>>excludeEnd("ctx");
  17615. var $1;
  17616. newCollection=_st(self._class())._new_(self._size());
  17617. self._withIndexDo_((function(each,index){
  17618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17619. return smalltalk.withContext(function($ctx2) {
  17620. //>>excludeEnd("ctx");
  17621. return _st(newCollection)._at_put_(index,each);
  17622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17623. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  17624. //>>excludeEnd("ctx");
  17625. }));
  17626. $1=newCollection;
  17627. return $1;
  17628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17629. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},globals.SequenceableCollection)});
  17630. //>>excludeEnd("ctx");
  17631. },
  17632. //>>excludeStart("ide", pragmas.excludeIdeData);
  17633. args: [],
  17634. 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",
  17635. referencedClasses: [],
  17636. //>>excludeEnd("ide");
  17637. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"]
  17638. }),
  17639. globals.SequenceableCollection);
  17640. smalltalk.addMethod(
  17641. smalltalk.method({
  17642. selector: "stream",
  17643. protocol: 'streaming',
  17644. fn: function (){
  17645. var self=this;
  17646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17647. return smalltalk.withContext(function($ctx1) {
  17648. //>>excludeEnd("ctx");
  17649. var $1;
  17650. $1=self._newStream();
  17651. return $1;
  17652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17653. }, function($ctx1) {$ctx1.fill(self,"stream",{},globals.SequenceableCollection)});
  17654. //>>excludeEnd("ctx");
  17655. },
  17656. //>>excludeStart("ide", pragmas.excludeIdeData);
  17657. args: [],
  17658. source: "stream\x0a\x09^ self newStream",
  17659. referencedClasses: [],
  17660. //>>excludeEnd("ide");
  17661. messageSends: ["newStream"]
  17662. }),
  17663. globals.SequenceableCollection);
  17664. smalltalk.addMethod(
  17665. smalltalk.method({
  17666. selector: "streamClass",
  17667. protocol: 'streaming',
  17668. fn: function (){
  17669. var self=this;
  17670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17671. return smalltalk.withContext(function($ctx1) {
  17672. //>>excludeEnd("ctx");
  17673. var $1;
  17674. $1=_st(self._class())._streamClass();
  17675. return $1;
  17676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17677. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},globals.SequenceableCollection)});
  17678. //>>excludeEnd("ctx");
  17679. },
  17680. //>>excludeStart("ide", pragmas.excludeIdeData);
  17681. args: [],
  17682. source: "streamClass\x0a\x09^ self class streamClass",
  17683. referencedClasses: [],
  17684. //>>excludeEnd("ide");
  17685. messageSends: ["streamClass", "class"]
  17686. }),
  17687. globals.SequenceableCollection);
  17688. smalltalk.addMethod(
  17689. smalltalk.method({
  17690. selector: "third",
  17691. protocol: 'accessing',
  17692. fn: function (){
  17693. var self=this;
  17694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17695. return smalltalk.withContext(function($ctx1) {
  17696. //>>excludeEnd("ctx");
  17697. var $1;
  17698. $1=self._at_((3));
  17699. return $1;
  17700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17701. }, function($ctx1) {$ctx1.fill(self,"third",{},globals.SequenceableCollection)});
  17702. //>>excludeEnd("ctx");
  17703. },
  17704. //>>excludeStart("ide", pragmas.excludeIdeData);
  17705. args: [],
  17706. source: "third\x0a\x09^ self at: 3",
  17707. referencedClasses: [],
  17708. //>>excludeEnd("ide");
  17709. messageSends: ["at:"]
  17710. }),
  17711. globals.SequenceableCollection);
  17712. smalltalk.addMethod(
  17713. smalltalk.method({
  17714. selector: "with:do:",
  17715. protocol: 'enumerating',
  17716. fn: function (anotherCollection,aBlock){
  17717. var self=this;
  17718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17719. return smalltalk.withContext(function($ctx1) {
  17720. //>>excludeEnd("ctx");
  17721. self = self._numericallyIndexable();
  17722. anotherCollection = anotherCollection._numericallyIndexable();
  17723. for(var i=0; i<self.length; i++) {
  17724. aBlock._value_value_(self[i], anotherCollection[i]);
  17725. }
  17726. ;
  17727. return self;
  17728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17729. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.SequenceableCollection)});
  17730. //>>excludeEnd("ctx");
  17731. },
  17732. //>>excludeStart("ide", pragmas.excludeIdeData);
  17733. args: ["anotherCollection", "aBlock"],
  17734. source: "with: anotherCollection do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09>",
  17735. referencedClasses: [],
  17736. //>>excludeEnd("ide");
  17737. messageSends: []
  17738. }),
  17739. globals.SequenceableCollection);
  17740. smalltalk.addMethod(
  17741. smalltalk.method({
  17742. selector: "withIndexDo:",
  17743. protocol: 'enumerating',
  17744. fn: function (aBlock){
  17745. var self=this;
  17746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17747. return smalltalk.withContext(function($ctx1) {
  17748. //>>excludeEnd("ctx");
  17749. self = self._numericallyIndexable();
  17750. for(var i=0; i < self.length; i++) {
  17751. aBlock._value_value_(self[i], i+1);
  17752. }
  17753. ;
  17754. return self;
  17755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17756. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.SequenceableCollection)});
  17757. //>>excludeEnd("ctx");
  17758. },
  17759. //>>excludeStart("ide", pragmas.excludeIdeData);
  17760. args: ["aBlock"],
  17761. source: "withIndexDo: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09>",
  17762. referencedClasses: [],
  17763. //>>excludeEnd("ide");
  17764. messageSends: []
  17765. }),
  17766. globals.SequenceableCollection);
  17767. smalltalk.addMethod(
  17768. smalltalk.method({
  17769. selector: "writeStream",
  17770. protocol: 'streaming',
  17771. fn: function (){
  17772. var self=this;
  17773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17774. return smalltalk.withContext(function($ctx1) {
  17775. //>>excludeEnd("ctx");
  17776. var $1;
  17777. $1=self._stream();
  17778. return $1;
  17779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17780. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},globals.SequenceableCollection)});
  17781. //>>excludeEnd("ctx");
  17782. },
  17783. //>>excludeStart("ide", pragmas.excludeIdeData);
  17784. args: [],
  17785. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  17786. referencedClasses: [],
  17787. //>>excludeEnd("ide");
  17788. messageSends: ["stream"]
  17789. }),
  17790. globals.SequenceableCollection);
  17791. smalltalk.addMethod(
  17792. smalltalk.method({
  17793. selector: "streamClass",
  17794. protocol: 'accessing',
  17795. fn: function (){
  17796. var self=this;
  17797. function $Stream(){return globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  17798. return $Stream();
  17799. },
  17800. //>>excludeStart("ide", pragmas.excludeIdeData);
  17801. args: [],
  17802. source: "streamClass\x0a\x09\x09^ Stream",
  17803. referencedClasses: ["Stream"],
  17804. //>>excludeEnd("ide");
  17805. messageSends: []
  17806. }),
  17807. globals.SequenceableCollection.klass);
  17808. smalltalk.addMethod(
  17809. smalltalk.method({
  17810. selector: "streamContents:",
  17811. protocol: 'streaming',
  17812. fn: function (aBlock){
  17813. var self=this;
  17814. var stream;
  17815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17816. return smalltalk.withContext(function($ctx1) {
  17817. //>>excludeEnd("ctx");
  17818. var $1;
  17819. stream=_st(self._streamClass())._on_(self._new());
  17820. _st(aBlock)._value_(stream);
  17821. $1=_st(stream)._contents();
  17822. return $1;
  17823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17824. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},globals.SequenceableCollection.klass)});
  17825. //>>excludeEnd("ctx");
  17826. },
  17827. //>>excludeStart("ide", pragmas.excludeIdeData);
  17828. args: ["aBlock"],
  17829. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  17830. referencedClasses: [],
  17831. //>>excludeEnd("ide");
  17832. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  17833. }),
  17834. globals.SequenceableCollection.klass);
  17835. smalltalk.addClass('Array', globals.SequenceableCollection, [], 'Kernel-Collections');
  17836. //>>excludeStart("ide", pragmas.excludeIdeData);
  17837. globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
  17838. //>>excludeEnd("ide");
  17839. smalltalk.addMethod(
  17840. smalltalk.method({
  17841. selector: "add:",
  17842. protocol: 'adding/removing',
  17843. fn: function (anObject){
  17844. var self=this;
  17845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17846. return smalltalk.withContext(function($ctx1) {
  17847. //>>excludeEnd("ctx");
  17848. self.push(anObject); return anObject;;
  17849. return self;
  17850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17851. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Array)});
  17852. //>>excludeEnd("ctx");
  17853. },
  17854. //>>excludeStart("ide", pragmas.excludeIdeData);
  17855. args: ["anObject"],
  17856. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  17857. referencedClasses: [],
  17858. //>>excludeEnd("ide");
  17859. messageSends: []
  17860. }),
  17861. globals.Array);
  17862. smalltalk.addMethod(
  17863. smalltalk.method({
  17864. selector: "addFirst:",
  17865. protocol: 'adding/removing',
  17866. fn: function (anObject){
  17867. var self=this;
  17868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17869. return smalltalk.withContext(function($ctx1) {
  17870. //>>excludeEnd("ctx");
  17871. self.unshift(anObject); return anObject;;
  17872. return self;
  17873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17874. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},globals.Array)});
  17875. //>>excludeEnd("ctx");
  17876. },
  17877. //>>excludeStart("ide", pragmas.excludeIdeData);
  17878. args: ["anObject"],
  17879. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  17880. referencedClasses: [],
  17881. //>>excludeEnd("ide");
  17882. messageSends: []
  17883. }),
  17884. globals.Array);
  17885. smalltalk.addMethod(
  17886. smalltalk.method({
  17887. selector: "asJavascript",
  17888. protocol: 'converting',
  17889. fn: function (){
  17890. var self=this;
  17891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17892. return smalltalk.withContext(function($ctx1) {
  17893. //>>excludeEnd("ctx");
  17894. var $1;
  17895. $1=_st("[".__comma(_st(self._collect_((function(each){
  17896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17897. return smalltalk.withContext(function($ctx2) {
  17898. //>>excludeEnd("ctx");
  17899. return _st(each)._asJavascript();
  17900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17902. //>>excludeEnd("ctx");
  17903. })))._join_(", "))).__comma("]");
  17904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17905. $ctx1.sendIdx[","]=1;
  17906. //>>excludeEnd("ctx");
  17907. return $1;
  17908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17909. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Array)});
  17910. //>>excludeEnd("ctx");
  17911. },
  17912. //>>excludeStart("ide", pragmas.excludeIdeData);
  17913. args: [],
  17914. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  17915. referencedClasses: [],
  17916. //>>excludeEnd("ide");
  17917. messageSends: [",", "join:", "collect:", "asJavascript"]
  17918. }),
  17919. globals.Array);
  17920. smalltalk.addMethod(
  17921. smalltalk.method({
  17922. selector: "at:ifAbsent:",
  17923. protocol: 'accessing',
  17924. fn: function (anIndex,aBlock){
  17925. var self=this;
  17926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17927. return smalltalk.withContext(function($ctx1) {
  17928. //>>excludeEnd("ctx");
  17929. return anIndex >= 1 && anIndex <= self.length
  17930. ? self[anIndex - 1]
  17931. : aBlock._value()
  17932. ;
  17933. return self;
  17934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17935. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.Array)});
  17936. //>>excludeEnd("ctx");
  17937. },
  17938. //>>excludeStart("ide", pragmas.excludeIdeData);
  17939. args: ["anIndex", "aBlock"],
  17940. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>",
  17941. referencedClasses: [],
  17942. //>>excludeEnd("ide");
  17943. messageSends: []
  17944. }),
  17945. globals.Array);
  17946. smalltalk.addMethod(
  17947. smalltalk.method({
  17948. selector: "at:ifPresent:ifAbsent:",
  17949. protocol: 'accessing',
  17950. fn: function (anIndex,aBlock,anotherBlock){
  17951. var self=this;
  17952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17953. return smalltalk.withContext(function($ctx1) {
  17954. //>>excludeEnd("ctx");
  17955. return anIndex >= 1 && anIndex <= self.length
  17956. ? aBlock._value_(self[anIndex - 1])
  17957. : anotherBlock._value()
  17958. ;
  17959. return self;
  17960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17961. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.Array)});
  17962. //>>excludeEnd("ctx");
  17963. },
  17964. //>>excludeStart("ide", pragmas.excludeIdeData);
  17965. args: ["anIndex", "aBlock", "anotherBlock"],
  17966. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09>",
  17967. referencedClasses: [],
  17968. //>>excludeEnd("ide");
  17969. messageSends: []
  17970. }),
  17971. globals.Array);
  17972. smalltalk.addMethod(
  17973. smalltalk.method({
  17974. selector: "at:put:",
  17975. protocol: 'accessing',
  17976. fn: function (anIndex,anObject){
  17977. var self=this;
  17978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17979. return smalltalk.withContext(function($ctx1) {
  17980. //>>excludeEnd("ctx");
  17981. return self[anIndex - 1] = anObject;
  17982. return self;
  17983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17984. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.Array)});
  17985. //>>excludeEnd("ctx");
  17986. },
  17987. //>>excludeStart("ide", pragmas.excludeIdeData);
  17988. args: ["anIndex", "anObject"],
  17989. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  17990. referencedClasses: [],
  17991. //>>excludeEnd("ide");
  17992. messageSends: []
  17993. }),
  17994. globals.Array);
  17995. smalltalk.addMethod(
  17996. smalltalk.method({
  17997. selector: "collect:",
  17998. protocol: 'enumerating',
  17999. fn: function (aBlock){
  18000. var self=this;
  18001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18002. return smalltalk.withContext(function($ctx1) {
  18003. //>>excludeEnd("ctx");
  18004. return self.map(function(each) {return aBlock._value_(each)});
  18005. return self;
  18006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18007. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},globals.Array)});
  18008. //>>excludeEnd("ctx");
  18009. },
  18010. //>>excludeStart("ide", pragmas.excludeIdeData);
  18011. args: ["aBlock"],
  18012. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  18013. referencedClasses: [],
  18014. //>>excludeEnd("ide");
  18015. messageSends: []
  18016. }),
  18017. globals.Array);
  18018. smalltalk.addMethod(
  18019. smalltalk.method({
  18020. selector: "join:",
  18021. protocol: 'enumerating',
  18022. fn: function (aString){
  18023. var self=this;
  18024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18025. return smalltalk.withContext(function($ctx1) {
  18026. //>>excludeEnd("ctx");
  18027. return self.join(aString);
  18028. return self;
  18029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18030. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},globals.Array)});
  18031. //>>excludeEnd("ctx");
  18032. },
  18033. //>>excludeStart("ide", pragmas.excludeIdeData);
  18034. args: ["aString"],
  18035. source: "join: aString\x0a\x09<return self.join(aString)>",
  18036. referencedClasses: [],
  18037. //>>excludeEnd("ide");
  18038. messageSends: []
  18039. }),
  18040. globals.Array);
  18041. smalltalk.addMethod(
  18042. smalltalk.method({
  18043. selector: "numericallyIndexable",
  18044. protocol: 'private',
  18045. fn: function (){
  18046. var self=this;
  18047. return self;
  18048. },
  18049. //>>excludeStart("ide", pragmas.excludeIdeData);
  18050. args: [],
  18051. source: "numericallyIndexable\x0a\x09^ self",
  18052. referencedClasses: [],
  18053. //>>excludeEnd("ide");
  18054. messageSends: []
  18055. }),
  18056. globals.Array);
  18057. smalltalk.addMethod(
  18058. smalltalk.method({
  18059. selector: "printOn:",
  18060. protocol: 'printing',
  18061. fn: function (aStream){
  18062. var self=this;
  18063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18064. return smalltalk.withContext(function($ctx1) {
  18065. //>>excludeEnd("ctx");
  18066. (
  18067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18068. $ctx1.supercall = true,
  18069. //>>excludeEnd("ctx");
  18070. globals.Array.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  18071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18072. $ctx1.supercall = false;
  18073. //>>excludeEnd("ctx");;
  18074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18075. $ctx1.sendIdx["printOn:"]=1;
  18076. //>>excludeEnd("ctx");
  18077. _st(aStream)._nextPutAll_(" (");
  18078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18079. $ctx1.sendIdx["nextPutAll:"]=1;
  18080. //>>excludeEnd("ctx");
  18081. self._do_separatedBy_((function(each){
  18082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18083. return smalltalk.withContext(function($ctx2) {
  18084. //>>excludeEnd("ctx");
  18085. return _st(each)._printOn_(aStream);
  18086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18088. //>>excludeEnd("ctx");
  18089. }),(function(){
  18090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18091. return smalltalk.withContext(function($ctx2) {
  18092. //>>excludeEnd("ctx");
  18093. return _st(aStream)._nextPutAll_(" ");
  18094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18095. $ctx2.sendIdx["nextPutAll:"]=2;
  18096. //>>excludeEnd("ctx");
  18097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  18099. //>>excludeEnd("ctx");
  18100. }));
  18101. _st(aStream)._nextPutAll_(")");
  18102. return self;
  18103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18104. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Array)});
  18105. //>>excludeEnd("ctx");
  18106. },
  18107. //>>excludeStart("ide", pragmas.excludeIdeData);
  18108. args: ["aStream"],
  18109. 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: ')'",
  18110. referencedClasses: [],
  18111. //>>excludeEnd("ide");
  18112. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  18113. }),
  18114. globals.Array);
  18115. smalltalk.addMethod(
  18116. smalltalk.method({
  18117. selector: "remove:ifAbsent:",
  18118. protocol: 'adding/removing',
  18119. fn: function (anObject,aBlock){
  18120. var self=this;
  18121. var index;
  18122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18123. return smalltalk.withContext(function($ctx1) {
  18124. //>>excludeEnd("ctx");
  18125. var $2,$1;
  18126. index=self._indexOf_ifAbsent_(anObject,(function(){
  18127. return (0);
  18128. }));
  18129. $2=_st(index).__eq((0));
  18130. if(smalltalk.assert($2)){
  18131. $1=_st(aBlock)._value();
  18132. } else {
  18133. self._removeIndex_(index);
  18134. $1=anObject;
  18135. };
  18136. return $1;
  18137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18138. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Array)});
  18139. //>>excludeEnd("ctx");
  18140. },
  18141. //>>excludeStart("ide", pragmas.excludeIdeData);
  18142. args: ["anObject", "aBlock"],
  18143. source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
  18144. referencedClasses: [],
  18145. //>>excludeEnd("ide");
  18146. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  18147. }),
  18148. globals.Array);
  18149. smalltalk.addMethod(
  18150. smalltalk.method({
  18151. selector: "removeAll",
  18152. protocol: 'adding/removing',
  18153. fn: function (){
  18154. var self=this;
  18155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18156. return smalltalk.withContext(function($ctx1) {
  18157. //>>excludeEnd("ctx");
  18158. self.length = 0;
  18159. return self;
  18160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18161. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Array)});
  18162. //>>excludeEnd("ctx");
  18163. },
  18164. //>>excludeStart("ide", pragmas.excludeIdeData);
  18165. args: [],
  18166. source: "removeAll\x0a\x09<self.length = 0>",
  18167. referencedClasses: [],
  18168. //>>excludeEnd("ide");
  18169. messageSends: []
  18170. }),
  18171. globals.Array);
  18172. smalltalk.addMethod(
  18173. smalltalk.method({
  18174. selector: "removeFrom:to:",
  18175. protocol: 'adding/removing',
  18176. fn: function (aNumber,anotherNumber){
  18177. var self=this;
  18178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18179. return smalltalk.withContext(function($ctx1) {
  18180. //>>excludeEnd("ctx");
  18181. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  18182. return self;
  18183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18184. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Array)});
  18185. //>>excludeEnd("ctx");
  18186. },
  18187. //>>excludeStart("ide", pragmas.excludeIdeData);
  18188. args: ["aNumber", "anotherNumber"],
  18189. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  18190. referencedClasses: [],
  18191. //>>excludeEnd("ide");
  18192. messageSends: []
  18193. }),
  18194. globals.Array);
  18195. smalltalk.addMethod(
  18196. smalltalk.method({
  18197. selector: "removeIndex:",
  18198. protocol: 'adding/removing',
  18199. fn: function (anInteger){
  18200. var self=this;
  18201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18202. return smalltalk.withContext(function($ctx1) {
  18203. //>>excludeEnd("ctx");
  18204. self.splice(anInteger - 1, 1);
  18205. return self;
  18206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18207. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},globals.Array)});
  18208. //>>excludeEnd("ctx");
  18209. },
  18210. //>>excludeStart("ide", pragmas.excludeIdeData);
  18211. args: ["anInteger"],
  18212. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  18213. referencedClasses: [],
  18214. //>>excludeEnd("ide");
  18215. messageSends: []
  18216. }),
  18217. globals.Array);
  18218. smalltalk.addMethod(
  18219. smalltalk.method({
  18220. selector: "removeLast",
  18221. protocol: 'adding/removing',
  18222. fn: function (){
  18223. var self=this;
  18224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18225. return smalltalk.withContext(function($ctx1) {
  18226. //>>excludeEnd("ctx");
  18227. return self.pop();;
  18228. return self;
  18229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18230. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.Array)});
  18231. //>>excludeEnd("ctx");
  18232. },
  18233. //>>excludeStart("ide", pragmas.excludeIdeData);
  18234. args: [],
  18235. source: "removeLast\x0a\x09<return self.pop();>",
  18236. referencedClasses: [],
  18237. //>>excludeEnd("ide");
  18238. messageSends: []
  18239. }),
  18240. globals.Array);
  18241. smalltalk.addMethod(
  18242. smalltalk.method({
  18243. selector: "reversed",
  18244. protocol: 'converting',
  18245. fn: function (){
  18246. var self=this;
  18247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18248. return smalltalk.withContext(function($ctx1) {
  18249. //>>excludeEnd("ctx");
  18250. return self._copy().reverse();
  18251. return self;
  18252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18253. }, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.Array)});
  18254. //>>excludeEnd("ctx");
  18255. },
  18256. //>>excludeStart("ide", pragmas.excludeIdeData);
  18257. args: [],
  18258. source: "reversed\x0a\x09<return self._copy().reverse()>",
  18259. referencedClasses: [],
  18260. //>>excludeEnd("ide");
  18261. messageSends: []
  18262. }),
  18263. globals.Array);
  18264. smalltalk.addMethod(
  18265. smalltalk.method({
  18266. selector: "select:",
  18267. protocol: 'enumerating',
  18268. fn: function (aBlock){
  18269. var self=this;
  18270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18271. return smalltalk.withContext(function($ctx1) {
  18272. //>>excludeEnd("ctx");
  18273. var result = self.klass._new();
  18274. for(var i=0; i<self.length; i++) {
  18275. if(aBlock._value_(self[i])) {
  18276. result.push(self[i]);
  18277. }
  18278. }
  18279. return result;
  18280. ;
  18281. return self;
  18282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18283. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},globals.Array)});
  18284. //>>excludeEnd("ctx");
  18285. },
  18286. //>>excludeStart("ide", pragmas.excludeIdeData);
  18287. args: ["aBlock"],
  18288. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09if(aBlock._value_(self[i])) {\x0a\x09\x09\x09\x09result.push(self[i]);\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09return result;\x0a\x09>",
  18289. referencedClasses: [],
  18290. //>>excludeEnd("ide");
  18291. messageSends: []
  18292. }),
  18293. globals.Array);
  18294. smalltalk.addMethod(
  18295. smalltalk.method({
  18296. selector: "size",
  18297. protocol: 'accessing',
  18298. fn: function (){
  18299. var self=this;
  18300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18301. return smalltalk.withContext(function($ctx1) {
  18302. //>>excludeEnd("ctx");
  18303. return self.length;
  18304. return self;
  18305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18306. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Array)});
  18307. //>>excludeEnd("ctx");
  18308. },
  18309. //>>excludeStart("ide", pragmas.excludeIdeData);
  18310. args: [],
  18311. source: "size\x0a\x09<return self.length>",
  18312. referencedClasses: [],
  18313. //>>excludeEnd("ide");
  18314. messageSends: []
  18315. }),
  18316. globals.Array);
  18317. smalltalk.addMethod(
  18318. smalltalk.method({
  18319. selector: "sort",
  18320. protocol: 'enumerating',
  18321. fn: function (){
  18322. var self=this;
  18323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18324. return smalltalk.withContext(function($ctx1) {
  18325. //>>excludeEnd("ctx");
  18326. var $1;
  18327. $1=self._sort_((function(a,b){
  18328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18329. return smalltalk.withContext(function($ctx2) {
  18330. //>>excludeEnd("ctx");
  18331. return _st(a).__lt(b);
  18332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18333. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  18334. //>>excludeEnd("ctx");
  18335. }));
  18336. return $1;
  18337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18338. }, function($ctx1) {$ctx1.fill(self,"sort",{},globals.Array)});
  18339. //>>excludeEnd("ctx");
  18340. },
  18341. //>>excludeStart("ide", pragmas.excludeIdeData);
  18342. args: [],
  18343. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  18344. referencedClasses: [],
  18345. //>>excludeEnd("ide");
  18346. messageSends: ["sort:", "<"]
  18347. }),
  18348. globals.Array);
  18349. smalltalk.addMethod(
  18350. smalltalk.method({
  18351. selector: "sort:",
  18352. protocol: 'enumerating',
  18353. fn: function (aBlock){
  18354. var self=this;
  18355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18356. return smalltalk.withContext(function($ctx1) {
  18357. //>>excludeEnd("ctx");
  18358. return self.sort(function(a, b) {
  18359. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  18360. })
  18361. ;
  18362. return self;
  18363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18364. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},globals.Array)});
  18365. //>>excludeEnd("ctx");
  18366. },
  18367. //>>excludeStart("ide", pragmas.excludeIdeData);
  18368. args: ["aBlock"],
  18369. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  18370. referencedClasses: [],
  18371. //>>excludeEnd("ide");
  18372. messageSends: []
  18373. }),
  18374. globals.Array);
  18375. smalltalk.addMethod(
  18376. smalltalk.method({
  18377. selector: "sorted",
  18378. protocol: 'enumerating',
  18379. fn: function (){
  18380. var self=this;
  18381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18382. return smalltalk.withContext(function($ctx1) {
  18383. //>>excludeEnd("ctx");
  18384. var $1;
  18385. $1=_st(self._copy())._sort();
  18386. return $1;
  18387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18388. }, function($ctx1) {$ctx1.fill(self,"sorted",{},globals.Array)});
  18389. //>>excludeEnd("ctx");
  18390. },
  18391. //>>excludeStart("ide", pragmas.excludeIdeData);
  18392. args: [],
  18393. source: "sorted\x0a\x09^ self copy sort",
  18394. referencedClasses: [],
  18395. //>>excludeEnd("ide");
  18396. messageSends: ["sort", "copy"]
  18397. }),
  18398. globals.Array);
  18399. smalltalk.addMethod(
  18400. smalltalk.method({
  18401. selector: "sorted:",
  18402. protocol: 'enumerating',
  18403. fn: function (aBlock){
  18404. var self=this;
  18405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18406. return smalltalk.withContext(function($ctx1) {
  18407. //>>excludeEnd("ctx");
  18408. var $1;
  18409. $1=_st(self._copy())._sort_(aBlock);
  18410. return $1;
  18411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18412. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},globals.Array)});
  18413. //>>excludeEnd("ctx");
  18414. },
  18415. //>>excludeStart("ide", pragmas.excludeIdeData);
  18416. args: ["aBlock"],
  18417. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  18418. referencedClasses: [],
  18419. //>>excludeEnd("ide");
  18420. messageSends: ["sort:", "copy"]
  18421. }),
  18422. globals.Array);
  18423. smalltalk.addMethod(
  18424. smalltalk.method({
  18425. selector: "new:",
  18426. protocol: 'instance creation',
  18427. fn: function (anInteger){
  18428. var self=this;
  18429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18430. return smalltalk.withContext(function($ctx1) {
  18431. //>>excludeEnd("ctx");
  18432. return new Array(anInteger);
  18433. return self;
  18434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18435. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Array.klass)});
  18436. //>>excludeEnd("ctx");
  18437. },
  18438. //>>excludeStart("ide", pragmas.excludeIdeData);
  18439. args: ["anInteger"],
  18440. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  18441. referencedClasses: [],
  18442. //>>excludeEnd("ide");
  18443. messageSends: []
  18444. }),
  18445. globals.Array.klass);
  18446. smalltalk.addMethod(
  18447. smalltalk.method({
  18448. selector: "with:",
  18449. protocol: 'instance creation',
  18450. fn: function (anObject){
  18451. var self=this;
  18452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18453. return smalltalk.withContext(function($ctx1) {
  18454. //>>excludeEnd("ctx");
  18455. var $2,$3,$1;
  18456. $2=self._new_((1));
  18457. _st($2)._at_put_((1),anObject);
  18458. $3=_st($2)._yourself();
  18459. $1=$3;
  18460. return $1;
  18461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18462. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Array.klass)});
  18463. //>>excludeEnd("ctx");
  18464. },
  18465. //>>excludeStart("ide", pragmas.excludeIdeData);
  18466. args: ["anObject"],
  18467. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  18468. referencedClasses: [],
  18469. //>>excludeEnd("ide");
  18470. messageSends: ["at:put:", "new:", "yourself"]
  18471. }),
  18472. globals.Array.klass);
  18473. smalltalk.addMethod(
  18474. smalltalk.method({
  18475. selector: "with:with:",
  18476. protocol: 'instance creation',
  18477. fn: function (anObject,anObject2){
  18478. var self=this;
  18479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18480. return smalltalk.withContext(function($ctx1) {
  18481. //>>excludeEnd("ctx");
  18482. var $2,$3,$1;
  18483. $2=self._new_((2));
  18484. _st($2)._at_put_((1),anObject);
  18485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18486. $ctx1.sendIdx["at:put:"]=1;
  18487. //>>excludeEnd("ctx");
  18488. _st($2)._at_put_((2),anObject2);
  18489. $3=_st($2)._yourself();
  18490. $1=$3;
  18491. return $1;
  18492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18493. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},globals.Array.klass)});
  18494. //>>excludeEnd("ctx");
  18495. },
  18496. //>>excludeStart("ide", pragmas.excludeIdeData);
  18497. args: ["anObject", "anObject2"],
  18498. 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",
  18499. referencedClasses: [],
  18500. //>>excludeEnd("ide");
  18501. messageSends: ["at:put:", "new:", "yourself"]
  18502. }),
  18503. globals.Array.klass);
  18504. smalltalk.addMethod(
  18505. smalltalk.method({
  18506. selector: "with:with:with:",
  18507. protocol: 'instance creation',
  18508. fn: function (anObject,anObject2,anObject3){
  18509. var self=this;
  18510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18511. return smalltalk.withContext(function($ctx1) {
  18512. //>>excludeEnd("ctx");
  18513. var $2,$3,$1;
  18514. $2=self._new_((3));
  18515. _st($2)._at_put_((1),anObject);
  18516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18517. $ctx1.sendIdx["at:put:"]=1;
  18518. //>>excludeEnd("ctx");
  18519. _st($2)._at_put_((2),anObject2);
  18520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18521. $ctx1.sendIdx["at:put:"]=2;
  18522. //>>excludeEnd("ctx");
  18523. _st($2)._at_put_((3),anObject3);
  18524. $3=_st($2)._yourself();
  18525. $1=$3;
  18526. return $1;
  18527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18528. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.Array.klass)});
  18529. //>>excludeEnd("ctx");
  18530. },
  18531. //>>excludeStart("ide", pragmas.excludeIdeData);
  18532. args: ["anObject", "anObject2", "anObject3"],
  18533. 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",
  18534. referencedClasses: [],
  18535. //>>excludeEnd("ide");
  18536. messageSends: ["at:put:", "new:", "yourself"]
  18537. }),
  18538. globals.Array.klass);
  18539. smalltalk.addMethod(
  18540. smalltalk.method({
  18541. selector: "withAll:",
  18542. protocol: 'instance creation',
  18543. fn: function (aCollection){
  18544. var self=this;
  18545. var instance,index;
  18546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18547. return smalltalk.withContext(function($ctx1) {
  18548. //>>excludeEnd("ctx");
  18549. var $1;
  18550. index=(1);
  18551. instance=self._new_(_st(aCollection)._size());
  18552. _st(aCollection)._do_((function(each){
  18553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18554. return smalltalk.withContext(function($ctx2) {
  18555. //>>excludeEnd("ctx");
  18556. _st(instance)._at_put_(index,each);
  18557. index=_st(index).__plus((1));
  18558. return index;
  18559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18560. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18561. //>>excludeEnd("ctx");
  18562. }));
  18563. $1=instance;
  18564. return $1;
  18565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18566. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},globals.Array.klass)});
  18567. //>>excludeEnd("ctx");
  18568. },
  18569. //>>excludeStart("ide", pragmas.excludeIdeData);
  18570. args: ["aCollection"],
  18571. 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",
  18572. referencedClasses: [],
  18573. //>>excludeEnd("ide");
  18574. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  18575. }),
  18576. globals.Array.klass);
  18577. smalltalk.addClass('CharacterArray', globals.SequenceableCollection, [], 'Kernel-Collections');
  18578. //>>excludeStart("ide", pragmas.excludeIdeData);
  18579. globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  18580. //>>excludeEnd("ide");
  18581. smalltalk.addMethod(
  18582. smalltalk.method({
  18583. selector: ",",
  18584. protocol: 'copying',
  18585. fn: function (aString){
  18586. var self=this;
  18587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18588. return smalltalk.withContext(function($ctx1) {
  18589. //>>excludeEnd("ctx");
  18590. var $2,$1;
  18591. $2=self._asString();
  18592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18593. $ctx1.sendIdx["asString"]=1;
  18594. //>>excludeEnd("ctx");
  18595. $1=_st($2).__comma(_st(aString)._asString());
  18596. return $1;
  18597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18598. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.CharacterArray)});
  18599. //>>excludeEnd("ctx");
  18600. },
  18601. //>>excludeStart("ide", pragmas.excludeIdeData);
  18602. args: ["aString"],
  18603. source: ", aString\x0a\x09^ self asString, aString asString",
  18604. referencedClasses: [],
  18605. //>>excludeEnd("ide");
  18606. messageSends: [",", "asString"]
  18607. }),
  18608. globals.CharacterArray);
  18609. smalltalk.addMethod(
  18610. smalltalk.method({
  18611. selector: "add:",
  18612. protocol: 'adding/removing',
  18613. fn: function (anObject){
  18614. var self=this;
  18615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18616. return smalltalk.withContext(function($ctx1) {
  18617. //>>excludeEnd("ctx");
  18618. self._errorReadOnly();
  18619. return self;
  18620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18621. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.CharacterArray)});
  18622. //>>excludeEnd("ctx");
  18623. },
  18624. //>>excludeStart("ide", pragmas.excludeIdeData);
  18625. args: ["anObject"],
  18626. source: "add: anObject\x0a\x09self errorReadOnly",
  18627. referencedClasses: [],
  18628. //>>excludeEnd("ide");
  18629. messageSends: ["errorReadOnly"]
  18630. }),
  18631. globals.CharacterArray);
  18632. smalltalk.addMethod(
  18633. smalltalk.method({
  18634. selector: "asLowercase",
  18635. protocol: 'converting',
  18636. fn: function (){
  18637. var self=this;
  18638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18639. return smalltalk.withContext(function($ctx1) {
  18640. //>>excludeEnd("ctx");
  18641. var $1;
  18642. $1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
  18643. return $1;
  18644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18645. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.CharacterArray)});
  18646. //>>excludeEnd("ctx");
  18647. },
  18648. //>>excludeStart("ide", pragmas.excludeIdeData);
  18649. args: [],
  18650. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  18651. referencedClasses: [],
  18652. //>>excludeEnd("ide");
  18653. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  18654. }),
  18655. globals.CharacterArray);
  18656. smalltalk.addMethod(
  18657. smalltalk.method({
  18658. selector: "asNumber",
  18659. protocol: 'converting',
  18660. fn: function (){
  18661. var self=this;
  18662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18663. return smalltalk.withContext(function($ctx1) {
  18664. //>>excludeEnd("ctx");
  18665. var $1;
  18666. $1=_st(self._asString())._asNumber();
  18667. return $1;
  18668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18669. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.CharacterArray)});
  18670. //>>excludeEnd("ctx");
  18671. },
  18672. //>>excludeStart("ide", pragmas.excludeIdeData);
  18673. args: [],
  18674. source: "asNumber\x0a\x09^ self asString asNumber",
  18675. referencedClasses: [],
  18676. //>>excludeEnd("ide");
  18677. messageSends: ["asNumber", "asString"]
  18678. }),
  18679. globals.CharacterArray);
  18680. smalltalk.addMethod(
  18681. smalltalk.method({
  18682. selector: "asString",
  18683. protocol: 'converting',
  18684. fn: function (){
  18685. var self=this;
  18686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18687. return smalltalk.withContext(function($ctx1) {
  18688. //>>excludeEnd("ctx");
  18689. var $1;
  18690. $1=self._subclassResponsibility();
  18691. return $1;
  18692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18693. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.CharacterArray)});
  18694. //>>excludeEnd("ctx");
  18695. },
  18696. //>>excludeStart("ide", pragmas.excludeIdeData);
  18697. args: [],
  18698. source: "asString\x0a\x09^ self subclassResponsibility",
  18699. referencedClasses: [],
  18700. //>>excludeEnd("ide");
  18701. messageSends: ["subclassResponsibility"]
  18702. }),
  18703. globals.CharacterArray);
  18704. smalltalk.addMethod(
  18705. smalltalk.method({
  18706. selector: "asSymbol",
  18707. protocol: 'converting',
  18708. fn: function (){
  18709. var self=this;
  18710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18711. return smalltalk.withContext(function($ctx1) {
  18712. //>>excludeEnd("ctx");
  18713. var $1;
  18714. $1=self._asString();
  18715. return $1;
  18716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18717. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},globals.CharacterArray)});
  18718. //>>excludeEnd("ctx");
  18719. },
  18720. //>>excludeStart("ide", pragmas.excludeIdeData);
  18721. args: [],
  18722. source: "asSymbol\x0a\x09^ self asString",
  18723. referencedClasses: [],
  18724. //>>excludeEnd("ide");
  18725. messageSends: ["asString"]
  18726. }),
  18727. globals.CharacterArray);
  18728. smalltalk.addMethod(
  18729. smalltalk.method({
  18730. selector: "asUppercase",
  18731. protocol: 'converting',
  18732. fn: function (){
  18733. var self=this;
  18734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18735. return smalltalk.withContext(function($ctx1) {
  18736. //>>excludeEnd("ctx");
  18737. var $1;
  18738. $1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
  18739. return $1;
  18740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18741. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.CharacterArray)});
  18742. //>>excludeEnd("ctx");
  18743. },
  18744. //>>excludeStart("ide", pragmas.excludeIdeData);
  18745. args: [],
  18746. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  18747. referencedClasses: [],
  18748. //>>excludeEnd("ide");
  18749. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  18750. }),
  18751. globals.CharacterArray);
  18752. smalltalk.addMethod(
  18753. smalltalk.method({
  18754. selector: "at:put:",
  18755. protocol: 'accessing',
  18756. fn: function (anIndex,anObject){
  18757. var self=this;
  18758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18759. return smalltalk.withContext(function($ctx1) {
  18760. //>>excludeEnd("ctx");
  18761. self._errorReadOnly();
  18762. return self;
  18763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18764. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.CharacterArray)});
  18765. //>>excludeEnd("ctx");
  18766. },
  18767. //>>excludeStart("ide", pragmas.excludeIdeData);
  18768. args: ["anIndex", "anObject"],
  18769. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  18770. referencedClasses: [],
  18771. //>>excludeEnd("ide");
  18772. messageSends: ["errorReadOnly"]
  18773. }),
  18774. globals.CharacterArray);
  18775. smalltalk.addMethod(
  18776. smalltalk.method({
  18777. selector: "errorReadOnly",
  18778. protocol: 'error handling',
  18779. fn: function (){
  18780. var self=this;
  18781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18782. return smalltalk.withContext(function($ctx1) {
  18783. //>>excludeEnd("ctx");
  18784. self._error_("Object is read-only");
  18785. return self;
  18786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18787. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},globals.CharacterArray)});
  18788. //>>excludeEnd("ctx");
  18789. },
  18790. //>>excludeStart("ide", pragmas.excludeIdeData);
  18791. args: [],
  18792. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  18793. referencedClasses: [],
  18794. //>>excludeEnd("ide");
  18795. messageSends: ["error:"]
  18796. }),
  18797. globals.CharacterArray);
  18798. smalltalk.addMethod(
  18799. smalltalk.method({
  18800. selector: "printOn:",
  18801. protocol: 'printing',
  18802. fn: function (aStream){
  18803. var self=this;
  18804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18805. return smalltalk.withContext(function($ctx1) {
  18806. //>>excludeEnd("ctx");
  18807. _st(self._asString())._printOn_(aStream);
  18808. return self;
  18809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18810. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.CharacterArray)});
  18811. //>>excludeEnd("ctx");
  18812. },
  18813. //>>excludeStart("ide", pragmas.excludeIdeData);
  18814. args: ["aStream"],
  18815. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  18816. referencedClasses: [],
  18817. //>>excludeEnd("ide");
  18818. messageSends: ["printOn:", "asString"]
  18819. }),
  18820. globals.CharacterArray);
  18821. smalltalk.addMethod(
  18822. smalltalk.method({
  18823. selector: "putOn:",
  18824. protocol: 'streaming',
  18825. fn: function (aStream){
  18826. var self=this;
  18827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18828. return smalltalk.withContext(function($ctx1) {
  18829. //>>excludeEnd("ctx");
  18830. _st(aStream)._nextPutString_(self);
  18831. return self;
  18832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18833. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.CharacterArray)});
  18834. //>>excludeEnd("ctx");
  18835. },
  18836. //>>excludeStart("ide", pragmas.excludeIdeData);
  18837. args: ["aStream"],
  18838. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  18839. referencedClasses: [],
  18840. //>>excludeEnd("ide");
  18841. messageSends: ["nextPutString:"]
  18842. }),
  18843. globals.CharacterArray);
  18844. smalltalk.addMethod(
  18845. smalltalk.method({
  18846. selector: "remove:",
  18847. protocol: 'adding/removing',
  18848. fn: function (anObject){
  18849. var self=this;
  18850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18851. return smalltalk.withContext(function($ctx1) {
  18852. //>>excludeEnd("ctx");
  18853. self._errorReadOnly();
  18854. return self;
  18855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18856. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.CharacterArray)});
  18857. //>>excludeEnd("ctx");
  18858. },
  18859. //>>excludeStart("ide", pragmas.excludeIdeData);
  18860. args: ["anObject"],
  18861. source: "remove: anObject\x0a\x09self errorReadOnly",
  18862. referencedClasses: [],
  18863. //>>excludeEnd("ide");
  18864. messageSends: ["errorReadOnly"]
  18865. }),
  18866. globals.CharacterArray);
  18867. smalltalk.addMethod(
  18868. smalltalk.method({
  18869. selector: "fromString:",
  18870. protocol: 'instance creation',
  18871. fn: function (aString){
  18872. var self=this;
  18873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18874. return smalltalk.withContext(function($ctx1) {
  18875. //>>excludeEnd("ctx");
  18876. self._subclassResponsibility();
  18877. return self;
  18878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18879. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.CharacterArray.klass)});
  18880. //>>excludeEnd("ctx");
  18881. },
  18882. //>>excludeStart("ide", pragmas.excludeIdeData);
  18883. args: ["aString"],
  18884. source: "fromString: aString\x0a\x09self subclassResponsibility",
  18885. referencedClasses: [],
  18886. //>>excludeEnd("ide");
  18887. messageSends: ["subclassResponsibility"]
  18888. }),
  18889. globals.CharacterArray.klass);
  18890. smalltalk.addClass('String', globals.CharacterArray, [], 'Kernel-Collections');
  18891. //>>excludeStart("ide", pragmas.excludeIdeData);
  18892. globals.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 >> #,`";
  18893. //>>excludeEnd("ide");
  18894. smalltalk.addMethod(
  18895. smalltalk.method({
  18896. selector: ",",
  18897. protocol: 'copying',
  18898. fn: function (aString){
  18899. var self=this;
  18900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18901. return smalltalk.withContext(function($ctx1) {
  18902. //>>excludeEnd("ctx");
  18903. return String(self) + aString;
  18904. return self;
  18905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18906. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.String)});
  18907. //>>excludeEnd("ctx");
  18908. },
  18909. //>>excludeStart("ide", pragmas.excludeIdeData);
  18910. args: ["aString"],
  18911. source: ", aString\x0a\x09<return String(self) + aString>",
  18912. referencedClasses: [],
  18913. //>>excludeEnd("ide");
  18914. messageSends: []
  18915. }),
  18916. globals.String);
  18917. smalltalk.addMethod(
  18918. smalltalk.method({
  18919. selector: "<",
  18920. protocol: 'comparing',
  18921. fn: function (aString){
  18922. var self=this;
  18923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18924. return smalltalk.withContext(function($ctx1) {
  18925. //>>excludeEnd("ctx");
  18926. return String(self) < aString._asString();
  18927. return self;
  18928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18929. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},globals.String)});
  18930. //>>excludeEnd("ctx");
  18931. },
  18932. //>>excludeStart("ide", pragmas.excludeIdeData);
  18933. args: ["aString"],
  18934. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  18935. referencedClasses: [],
  18936. //>>excludeEnd("ide");
  18937. messageSends: []
  18938. }),
  18939. globals.String);
  18940. smalltalk.addMethod(
  18941. smalltalk.method({
  18942. selector: "<=",
  18943. protocol: 'comparing',
  18944. fn: function (aString){
  18945. var self=this;
  18946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18947. return smalltalk.withContext(function($ctx1) {
  18948. //>>excludeEnd("ctx");
  18949. return String(self) <= aString._asString();
  18950. return self;
  18951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18952. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},globals.String)});
  18953. //>>excludeEnd("ctx");
  18954. },
  18955. //>>excludeStart("ide", pragmas.excludeIdeData);
  18956. args: ["aString"],
  18957. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  18958. referencedClasses: [],
  18959. //>>excludeEnd("ide");
  18960. messageSends: []
  18961. }),
  18962. globals.String);
  18963. smalltalk.addMethod(
  18964. smalltalk.method({
  18965. selector: "=",
  18966. protocol: 'comparing',
  18967. fn: function (aString){
  18968. var self=this;
  18969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18970. return smalltalk.withContext(function($ctx1) {
  18971. //>>excludeEnd("ctx");
  18972. return aString != null &&
  18973. typeof aString._isString === "function" &&
  18974. aString._isString() &&
  18975. String(self) === String(aString)
  18976. ;
  18977. return self;
  18978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18979. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},globals.String)});
  18980. //>>excludeEnd("ctx");
  18981. },
  18982. //>>excludeStart("ide", pragmas.excludeIdeData);
  18983. args: ["aString"],
  18984. source: "= aString\x0a\x09<\x0a\x09\x09return aString != null &&\x0a\x09\x09\x09typeof aString._isString === \x22function\x22 &&\x0a\x09\x09\x09aString._isString() &&\x0a\x09\x09\x09String(self) === String(aString)\x0a\x09>",
  18985. referencedClasses: [],
  18986. //>>excludeEnd("ide");
  18987. messageSends: []
  18988. }),
  18989. globals.String);
  18990. smalltalk.addMethod(
  18991. smalltalk.method({
  18992. selector: "==",
  18993. protocol: 'comparing',
  18994. fn: function (aString){
  18995. var self=this;
  18996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18997. return smalltalk.withContext(function($ctx1) {
  18998. //>>excludeEnd("ctx");
  18999. var $1;
  19000. $1=self.__eq(aString);
  19001. return $1;
  19002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19003. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},globals.String)});
  19004. //>>excludeEnd("ctx");
  19005. },
  19006. //>>excludeStart("ide", pragmas.excludeIdeData);
  19007. args: ["aString"],
  19008. source: "== aString\x0a\x09^ self = aString",
  19009. referencedClasses: [],
  19010. //>>excludeEnd("ide");
  19011. messageSends: ["="]
  19012. }),
  19013. globals.String);
  19014. smalltalk.addMethod(
  19015. smalltalk.method({
  19016. selector: ">",
  19017. protocol: 'comparing',
  19018. fn: function (aString){
  19019. var self=this;
  19020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19021. return smalltalk.withContext(function($ctx1) {
  19022. //>>excludeEnd("ctx");
  19023. return String(self) > aString._asString();
  19024. return self;
  19025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19026. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},globals.String)});
  19027. //>>excludeEnd("ctx");
  19028. },
  19029. //>>excludeStart("ide", pragmas.excludeIdeData);
  19030. args: ["aString"],
  19031. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  19032. referencedClasses: [],
  19033. //>>excludeEnd("ide");
  19034. messageSends: []
  19035. }),
  19036. globals.String);
  19037. smalltalk.addMethod(
  19038. smalltalk.method({
  19039. selector: ">=",
  19040. protocol: 'comparing',
  19041. fn: function (aString){
  19042. var self=this;
  19043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19044. return smalltalk.withContext(function($ctx1) {
  19045. //>>excludeEnd("ctx");
  19046. return String(self) >= aString._asString();
  19047. return self;
  19048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19049. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},globals.String)});
  19050. //>>excludeEnd("ctx");
  19051. },
  19052. //>>excludeStart("ide", pragmas.excludeIdeData);
  19053. args: ["aString"],
  19054. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  19055. referencedClasses: [],
  19056. //>>excludeEnd("ide");
  19057. messageSends: []
  19058. }),
  19059. globals.String);
  19060. smalltalk.addMethod(
  19061. smalltalk.method({
  19062. selector: "asJSON",
  19063. protocol: 'converting',
  19064. fn: function (){
  19065. var self=this;
  19066. return self;
  19067. },
  19068. //>>excludeStart("ide", pragmas.excludeIdeData);
  19069. args: [],
  19070. source: "asJSON\x0a\x09^ self",
  19071. referencedClasses: [],
  19072. //>>excludeEnd("ide");
  19073. messageSends: []
  19074. }),
  19075. globals.String);
  19076. smalltalk.addMethod(
  19077. smalltalk.method({
  19078. selector: "asJavaScriptMethodName",
  19079. protocol: 'converting',
  19080. fn: function (){
  19081. var self=this;
  19082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19083. return smalltalk.withContext(function($ctx1) {
  19084. //>>excludeEnd("ctx");
  19085. return smalltalk.st2js(self);
  19086. return self;
  19087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19088. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},globals.String)});
  19089. //>>excludeEnd("ctx");
  19090. },
  19091. //>>excludeStart("ide", pragmas.excludeIdeData);
  19092. args: [],
  19093. source: "asJavaScriptMethodName\x0a\x09<return smalltalk.st2js(self)>",
  19094. referencedClasses: [],
  19095. //>>excludeEnd("ide");
  19096. messageSends: []
  19097. }),
  19098. globals.String);
  19099. smalltalk.addMethod(
  19100. smalltalk.method({
  19101. selector: "asJavascript",
  19102. protocol: 'converting',
  19103. fn: function (){
  19104. var self=this;
  19105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19106. return smalltalk.withContext(function($ctx1) {
  19107. //>>excludeEnd("ctx");
  19108. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  19109. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  19110. else
  19111. return "\"" + self + "\"";
  19112. ;
  19113. return self;
  19114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19115. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.String)});
  19116. //>>excludeEnd("ctx");
  19117. },
  19118. //>>excludeStart("ide", pragmas.excludeIdeData);
  19119. args: [],
  19120. 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>",
  19121. referencedClasses: [],
  19122. //>>excludeEnd("ide");
  19123. messageSends: []
  19124. }),
  19125. globals.String);
  19126. smalltalk.addMethod(
  19127. smalltalk.method({
  19128. selector: "asLowercase",
  19129. protocol: 'converting',
  19130. fn: function (){
  19131. var self=this;
  19132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19133. return smalltalk.withContext(function($ctx1) {
  19134. //>>excludeEnd("ctx");
  19135. return self.toLowerCase();
  19136. return self;
  19137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19138. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.String)});
  19139. //>>excludeEnd("ctx");
  19140. },
  19141. //>>excludeStart("ide", pragmas.excludeIdeData);
  19142. args: [],
  19143. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  19144. referencedClasses: [],
  19145. //>>excludeEnd("ide");
  19146. messageSends: []
  19147. }),
  19148. globals.String);
  19149. smalltalk.addMethod(
  19150. smalltalk.method({
  19151. selector: "asMutator",
  19152. protocol: 'converting',
  19153. fn: function (){
  19154. var self=this;
  19155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19156. return smalltalk.withContext(function($ctx1) {
  19157. //>>excludeEnd("ctx");
  19158. var $1,$2;
  19159. $1=_st(self._last()).__eq(":");
  19160. if(! smalltalk.assert($1)){
  19161. $2=self.__comma(":");
  19162. return $2;
  19163. };
  19164. return self;
  19165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19166. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},globals.String)});
  19167. //>>excludeEnd("ctx");
  19168. },
  19169. //>>excludeStart("ide", pragmas.excludeIdeData);
  19170. args: [],
  19171. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  19172. referencedClasses: [],
  19173. //>>excludeEnd("ide");
  19174. messageSends: ["ifFalse:", "=", "last", ","]
  19175. }),
  19176. globals.String);
  19177. smalltalk.addMethod(
  19178. smalltalk.method({
  19179. selector: "asNumber",
  19180. protocol: 'converting',
  19181. fn: function (){
  19182. var self=this;
  19183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19184. return smalltalk.withContext(function($ctx1) {
  19185. //>>excludeEnd("ctx");
  19186. return Number(self);
  19187. return self;
  19188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19189. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.String)});
  19190. //>>excludeEnd("ctx");
  19191. },
  19192. //>>excludeStart("ide", pragmas.excludeIdeData);
  19193. args: [],
  19194. source: "asNumber\x0a\x09<return Number(self)>",
  19195. referencedClasses: [],
  19196. //>>excludeEnd("ide");
  19197. messageSends: []
  19198. }),
  19199. globals.String);
  19200. smalltalk.addMethod(
  19201. smalltalk.method({
  19202. selector: "asRegexp",
  19203. protocol: 'converting',
  19204. fn: function (){
  19205. var self=this;
  19206. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  19207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19208. return smalltalk.withContext(function($ctx1) {
  19209. //>>excludeEnd("ctx");
  19210. var $1;
  19211. $1=_st($RegularExpression())._fromString_(self);
  19212. return $1;
  19213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19214. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},globals.String)});
  19215. //>>excludeEnd("ctx");
  19216. },
  19217. //>>excludeStart("ide", pragmas.excludeIdeData);
  19218. args: [],
  19219. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  19220. referencedClasses: ["RegularExpression"],
  19221. //>>excludeEnd("ide");
  19222. messageSends: ["fromString:"]
  19223. }),
  19224. globals.String);
  19225. smalltalk.addMethod(
  19226. smalltalk.method({
  19227. selector: "asSelector",
  19228. protocol: 'converting',
  19229. fn: function (){
  19230. var self=this;
  19231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19232. return smalltalk.withContext(function($ctx1) {
  19233. //>>excludeEnd("ctx");
  19234. var $1;
  19235. self._deprecatedAPI_("Use #asJavaScriptMethodName");
  19236. $1=self._asJavaScriptMethodName();
  19237. return $1;
  19238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19239. }, function($ctx1) {$ctx1.fill(self,"asSelector",{},globals.String)});
  19240. //>>excludeEnd("ctx");
  19241. },
  19242. //>>excludeStart("ide", pragmas.excludeIdeData);
  19243. args: [],
  19244. source: "asSelector\x0a\x09self deprecatedAPI: 'Use #asJavaScriptMethodName'.\x0a\x09^ self asJavaScriptMethodName",
  19245. referencedClasses: [],
  19246. //>>excludeEnd("ide");
  19247. messageSends: ["deprecatedAPI:", "asJavaScriptMethodName"]
  19248. }),
  19249. globals.String);
  19250. smalltalk.addMethod(
  19251. smalltalk.method({
  19252. selector: "asString",
  19253. protocol: 'converting',
  19254. fn: function (){
  19255. var self=this;
  19256. return self;
  19257. },
  19258. //>>excludeStart("ide", pragmas.excludeIdeData);
  19259. args: [],
  19260. source: "asString\x0a\x09^ self",
  19261. referencedClasses: [],
  19262. //>>excludeEnd("ide");
  19263. messageSends: []
  19264. }),
  19265. globals.String);
  19266. smalltalk.addMethod(
  19267. smalltalk.method({
  19268. selector: "asSymbol",
  19269. protocol: 'converting',
  19270. fn: function (){
  19271. var self=this;
  19272. return self;
  19273. },
  19274. //>>excludeStart("ide", pragmas.excludeIdeData);
  19275. args: [],
  19276. source: "asSymbol\x0a\x09^ self",
  19277. referencedClasses: [],
  19278. //>>excludeEnd("ide");
  19279. messageSends: []
  19280. }),
  19281. globals.String);
  19282. smalltalk.addMethod(
  19283. smalltalk.method({
  19284. selector: "asUppercase",
  19285. protocol: 'converting',
  19286. fn: function (){
  19287. var self=this;
  19288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19289. return smalltalk.withContext(function($ctx1) {
  19290. //>>excludeEnd("ctx");
  19291. return self.toUpperCase();
  19292. return self;
  19293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19294. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.String)});
  19295. //>>excludeEnd("ctx");
  19296. },
  19297. //>>excludeStart("ide", pragmas.excludeIdeData);
  19298. args: [],
  19299. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  19300. referencedClasses: [],
  19301. //>>excludeEnd("ide");
  19302. messageSends: []
  19303. }),
  19304. globals.String);
  19305. smalltalk.addMethod(
  19306. smalltalk.method({
  19307. selector: "asciiValue",
  19308. protocol: 'accessing',
  19309. fn: function (){
  19310. var self=this;
  19311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19312. return smalltalk.withContext(function($ctx1) {
  19313. //>>excludeEnd("ctx");
  19314. return self.charCodeAt(0);;
  19315. return self;
  19316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19317. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},globals.String)});
  19318. //>>excludeEnd("ctx");
  19319. },
  19320. //>>excludeStart("ide", pragmas.excludeIdeData);
  19321. args: [],
  19322. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  19323. referencedClasses: [],
  19324. //>>excludeEnd("ide");
  19325. messageSends: []
  19326. }),
  19327. globals.String);
  19328. smalltalk.addMethod(
  19329. smalltalk.method({
  19330. selector: "at:ifAbsent:",
  19331. protocol: 'accessing',
  19332. fn: function (anIndex,aBlock){
  19333. var self=this;
  19334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19335. return smalltalk.withContext(function($ctx1) {
  19336. //>>excludeEnd("ctx");
  19337. return String(self)[anIndex - 1] || aBlock._value();
  19338. return self;
  19339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19340. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.String)});
  19341. //>>excludeEnd("ctx");
  19342. },
  19343. //>>excludeStart("ide", pragmas.excludeIdeData);
  19344. args: ["anIndex", "aBlock"],
  19345. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  19346. referencedClasses: [],
  19347. //>>excludeEnd("ide");
  19348. messageSends: []
  19349. }),
  19350. globals.String);
  19351. smalltalk.addMethod(
  19352. smalltalk.method({
  19353. selector: "at:ifPresent:ifAbsent:",
  19354. protocol: 'accessing',
  19355. fn: function (anIndex,aBlock,anotherBlock){
  19356. var self=this;
  19357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19358. return smalltalk.withContext(function($ctx1) {
  19359. //>>excludeEnd("ctx");
  19360. var result = String(self)[anIndex - 1];
  19361. return result ? aBlock._value_(result) : anotherBlock._value();
  19362. ;
  19363. return self;
  19364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19365. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.String)});
  19366. //>>excludeEnd("ctx");
  19367. },
  19368. //>>excludeStart("ide", pragmas.excludeIdeData);
  19369. args: ["anIndex", "aBlock", "anotherBlock"],
  19370. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  19371. referencedClasses: [],
  19372. //>>excludeEnd("ide");
  19373. messageSends: []
  19374. }),
  19375. globals.String);
  19376. smalltalk.addMethod(
  19377. smalltalk.method({
  19378. selector: "capitalized",
  19379. protocol: 'converting',
  19380. fn: function (){
  19381. var self=this;
  19382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19383. return smalltalk.withContext(function($ctx1) {
  19384. //>>excludeEnd("ctx");
  19385. var $2,$1;
  19386. $2=self._isEmpty();
  19387. if(smalltalk.assert($2)){
  19388. $1=self;
  19389. } else {
  19390. $1=_st(_st(self._first())._asUppercase()).__comma(self._allButFirst());
  19391. };
  19392. return $1;
  19393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19394. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},globals.String)});
  19395. //>>excludeEnd("ctx");
  19396. },
  19397. //>>excludeStart("ide", pragmas.excludeIdeData);
  19398. args: [],
  19399. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  19400. referencedClasses: [],
  19401. //>>excludeEnd("ide");
  19402. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  19403. }),
  19404. globals.String);
  19405. smalltalk.addMethod(
  19406. smalltalk.method({
  19407. selector: "charCodeAt:",
  19408. protocol: 'accessing',
  19409. fn: function (anInteger){
  19410. var self=this;
  19411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19412. return smalltalk.withContext(function($ctx1) {
  19413. //>>excludeEnd("ctx");
  19414. return self.charCodeAt(anInteger - 1);
  19415. return self;
  19416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19417. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},globals.String)});
  19418. //>>excludeEnd("ctx");
  19419. },
  19420. //>>excludeStart("ide", pragmas.excludeIdeData);
  19421. args: ["anInteger"],
  19422. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  19423. referencedClasses: [],
  19424. //>>excludeEnd("ide");
  19425. messageSends: []
  19426. }),
  19427. globals.String);
  19428. smalltalk.addMethod(
  19429. smalltalk.method({
  19430. selector: "copyFrom:to:",
  19431. protocol: 'copying',
  19432. fn: function (anIndex,anotherIndex){
  19433. var self=this;
  19434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19435. return smalltalk.withContext(function($ctx1) {
  19436. //>>excludeEnd("ctx");
  19437. return self.substring(anIndex - 1, anotherIndex);
  19438. return self;
  19439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19440. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},globals.String)});
  19441. //>>excludeEnd("ctx");
  19442. },
  19443. //>>excludeStart("ide", pragmas.excludeIdeData);
  19444. args: ["anIndex", "anotherIndex"],
  19445. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  19446. referencedClasses: [],
  19447. //>>excludeEnd("ide");
  19448. messageSends: []
  19449. }),
  19450. globals.String);
  19451. smalltalk.addMethod(
  19452. smalltalk.method({
  19453. selector: "crlfSanitized",
  19454. protocol: 'converting',
  19455. fn: function (){
  19456. var self=this;
  19457. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  19458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19459. return smalltalk.withContext(function($ctx1) {
  19460. //>>excludeEnd("ctx");
  19461. var $1;
  19462. $1=_st(self._lines())._join_(_st($String())._lf());
  19463. return $1;
  19464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19465. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},globals.String)});
  19466. //>>excludeEnd("ctx");
  19467. },
  19468. //>>excludeStart("ide", pragmas.excludeIdeData);
  19469. args: [],
  19470. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  19471. referencedClasses: ["String"],
  19472. //>>excludeEnd("ide");
  19473. messageSends: ["join:", "lines", "lf"]
  19474. }),
  19475. globals.String);
  19476. smalltalk.addMethod(
  19477. smalltalk.method({
  19478. selector: "deepCopy",
  19479. protocol: 'copying',
  19480. fn: function (){
  19481. var self=this;
  19482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19483. return smalltalk.withContext(function($ctx1) {
  19484. //>>excludeEnd("ctx");
  19485. var $1;
  19486. $1=self._shallowCopy();
  19487. return $1;
  19488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19489. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.String)});
  19490. //>>excludeEnd("ctx");
  19491. },
  19492. //>>excludeStart("ide", pragmas.excludeIdeData);
  19493. args: [],
  19494. source: "deepCopy\x0a\x09^ self shallowCopy",
  19495. referencedClasses: [],
  19496. //>>excludeEnd("ide");
  19497. messageSends: ["shallowCopy"]
  19498. }),
  19499. globals.String);
  19500. smalltalk.addMethod(
  19501. smalltalk.method({
  19502. selector: "escaped",
  19503. protocol: 'converting',
  19504. fn: function (){
  19505. var self=this;
  19506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19507. return smalltalk.withContext(function($ctx1) {
  19508. //>>excludeEnd("ctx");
  19509. return escape(self);
  19510. return self;
  19511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19512. }, function($ctx1) {$ctx1.fill(self,"escaped",{},globals.String)});
  19513. //>>excludeEnd("ctx");
  19514. },
  19515. //>>excludeStart("ide", pragmas.excludeIdeData);
  19516. args: [],
  19517. source: "escaped\x0a\x09<return escape(self)>",
  19518. referencedClasses: [],
  19519. //>>excludeEnd("ide");
  19520. messageSends: []
  19521. }),
  19522. globals.String);
  19523. smalltalk.addMethod(
  19524. smalltalk.method({
  19525. selector: "identityHash",
  19526. protocol: 'accessing',
  19527. fn: function (){
  19528. var self=this;
  19529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19530. return smalltalk.withContext(function($ctx1) {
  19531. //>>excludeEnd("ctx");
  19532. var $1;
  19533. $1=self.__comma("s");
  19534. return $1;
  19535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19536. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.String)});
  19537. //>>excludeEnd("ctx");
  19538. },
  19539. //>>excludeStart("ide", pragmas.excludeIdeData);
  19540. args: [],
  19541. source: "identityHash\x0a\x09^ self, 's'",
  19542. referencedClasses: [],
  19543. //>>excludeEnd("ide");
  19544. messageSends: [","]
  19545. }),
  19546. globals.String);
  19547. smalltalk.addMethod(
  19548. smalltalk.method({
  19549. selector: "includesSubString:",
  19550. protocol: 'testing',
  19551. fn: function (subString){
  19552. var self=this;
  19553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19554. return smalltalk.withContext(function($ctx1) {
  19555. //>>excludeEnd("ctx");
  19556. return self.indexOf(subString) != -1;
  19557. return self;
  19558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19559. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},globals.String)});
  19560. //>>excludeEnd("ctx");
  19561. },
  19562. //>>excludeStart("ide", pragmas.excludeIdeData);
  19563. args: ["subString"],
  19564. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  19565. referencedClasses: [],
  19566. //>>excludeEnd("ide");
  19567. messageSends: []
  19568. }),
  19569. globals.String);
  19570. smalltalk.addMethod(
  19571. smalltalk.method({
  19572. selector: "isCapitalized",
  19573. protocol: 'testing',
  19574. fn: function (){
  19575. var self=this;
  19576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19577. return smalltalk.withContext(function($ctx1) {
  19578. //>>excludeEnd("ctx");
  19579. var $3,$2,$1;
  19580. $3=self._first();
  19581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19582. $ctx1.sendIdx["first"]=1;
  19583. //>>excludeEnd("ctx");
  19584. $2=_st($3)._asUppercase();
  19585. $1=_st($2).__eq_eq(self._first());
  19586. return $1;
  19587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19588. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},globals.String)});
  19589. //>>excludeEnd("ctx");
  19590. },
  19591. //>>excludeStart("ide", pragmas.excludeIdeData);
  19592. args: [],
  19593. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  19594. referencedClasses: [],
  19595. //>>excludeEnd("ide");
  19596. messageSends: ["==", "asUppercase", "first"]
  19597. }),
  19598. globals.String);
  19599. smalltalk.addMethod(
  19600. smalltalk.method({
  19601. selector: "isImmutable",
  19602. protocol: 'testing',
  19603. fn: function (){
  19604. var self=this;
  19605. return true;
  19606. },
  19607. //>>excludeStart("ide", pragmas.excludeIdeData);
  19608. args: [],
  19609. source: "isImmutable\x0a\x09^ true",
  19610. referencedClasses: [],
  19611. //>>excludeEnd("ide");
  19612. messageSends: []
  19613. }),
  19614. globals.String);
  19615. smalltalk.addMethod(
  19616. smalltalk.method({
  19617. selector: "isString",
  19618. protocol: 'testing',
  19619. fn: function (){
  19620. var self=this;
  19621. return true;
  19622. },
  19623. //>>excludeStart("ide", pragmas.excludeIdeData);
  19624. args: [],
  19625. source: "isString\x0a\x09^ true",
  19626. referencedClasses: [],
  19627. //>>excludeEnd("ide");
  19628. messageSends: []
  19629. }),
  19630. globals.String);
  19631. smalltalk.addMethod(
  19632. smalltalk.method({
  19633. selector: "isVowel",
  19634. protocol: 'testing',
  19635. fn: function (){
  19636. var self=this;
  19637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19638. return smalltalk.withContext(function($ctx1) {
  19639. //>>excludeEnd("ctx");
  19640. var $1;
  19641. $1=_st(_st(self._size()).__eq((1)))._and_((function(){
  19642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19643. return smalltalk.withContext(function($ctx2) {
  19644. //>>excludeEnd("ctx");
  19645. return "aeiou"._includes_(self._asLowercase());
  19646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19648. //>>excludeEnd("ctx");
  19649. }));
  19650. return $1;
  19651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19652. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},globals.String)});
  19653. //>>excludeEnd("ctx");
  19654. },
  19655. //>>excludeStart("ide", pragmas.excludeIdeData);
  19656. args: [],
  19657. 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 ]",
  19658. referencedClasses: [],
  19659. //>>excludeEnd("ide");
  19660. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  19661. }),
  19662. globals.String);
  19663. smalltalk.addMethod(
  19664. smalltalk.method({
  19665. selector: "join:",
  19666. protocol: 'split join',
  19667. fn: function (aCollection){
  19668. var self=this;
  19669. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  19670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19671. return smalltalk.withContext(function($ctx1) {
  19672. //>>excludeEnd("ctx");
  19673. var $1;
  19674. $1=_st($String())._streamContents_((function(stream){
  19675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19676. return smalltalk.withContext(function($ctx2) {
  19677. //>>excludeEnd("ctx");
  19678. return _st(aCollection)._do_separatedBy_((function(each){
  19679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19680. return smalltalk.withContext(function($ctx3) {
  19681. //>>excludeEnd("ctx");
  19682. return _st(stream)._nextPutAll_(_st(each)._asString());
  19683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19684. $ctx3.sendIdx["nextPutAll:"]=1;
  19685. //>>excludeEnd("ctx");
  19686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19687. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  19688. //>>excludeEnd("ctx");
  19689. }),(function(){
  19690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19691. return smalltalk.withContext(function($ctx3) {
  19692. //>>excludeEnd("ctx");
  19693. return _st(stream)._nextPutAll_(self);
  19694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19695. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  19696. //>>excludeEnd("ctx");
  19697. }));
  19698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19699. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  19700. //>>excludeEnd("ctx");
  19701. }));
  19702. return $1;
  19703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19704. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},globals.String)});
  19705. //>>excludeEnd("ctx");
  19706. },
  19707. //>>excludeStart("ide", pragmas.excludeIdeData);
  19708. args: ["aCollection"],
  19709. 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 ]]",
  19710. referencedClasses: ["String"],
  19711. //>>excludeEnd("ide");
  19712. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  19713. }),
  19714. globals.String);
  19715. smalltalk.addMethod(
  19716. smalltalk.method({
  19717. selector: "lineIndicesDo:",
  19718. protocol: 'split join',
  19719. fn: function (aBlock){
  19720. var self=this;
  19721. var cr,lf,start,sz,nextLF,nextCR;
  19722. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  19723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19724. return smalltalk.withContext(function($ctx1) {
  19725. //>>excludeEnd("ctx");
  19726. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  19727. var $early={};
  19728. try {
  19729. start=(1);
  19730. sz=self._size();
  19731. cr=_st($String())._cr();
  19732. nextCR=self._indexOf_startingAt_(cr,(1));
  19733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19734. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  19735. //>>excludeEnd("ctx");
  19736. lf=_st($String())._lf();
  19737. nextLF=self._indexOf_startingAt_(lf,(1));
  19738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19739. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  19740. //>>excludeEnd("ctx");
  19741. _st((function(){
  19742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19743. return smalltalk.withContext(function($ctx2) {
  19744. //>>excludeEnd("ctx");
  19745. return _st(start).__lt_eq(sz);
  19746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19748. //>>excludeEnd("ctx");
  19749. }))._whileTrue_((function(){
  19750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19751. return smalltalk.withContext(function($ctx2) {
  19752. //>>excludeEnd("ctx");
  19753. $2=_st(nextLF).__eq((0));
  19754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19755. $ctx2.sendIdx["="]=1;
  19756. //>>excludeEnd("ctx");
  19757. $1=_st($2)._and_((function(){
  19758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19759. return smalltalk.withContext(function($ctx3) {
  19760. //>>excludeEnd("ctx");
  19761. return _st(nextCR).__eq((0));
  19762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19763. $ctx3.sendIdx["="]=2;
  19764. //>>excludeEnd("ctx");
  19765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19766. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  19767. //>>excludeEnd("ctx");
  19768. }));
  19769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19770. $ctx2.sendIdx["and:"]=1;
  19771. //>>excludeEnd("ctx");
  19772. if(smalltalk.assert($1)){
  19773. _st(aBlock)._value_value_value_(start,sz,sz);
  19774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19775. $ctx2.sendIdx["value:value:value:"]=1;
  19776. //>>excludeEnd("ctx");
  19777. throw $early=[self];
  19778. };
  19779. $4=_st(nextCR).__eq((0));
  19780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19781. $ctx2.sendIdx["="]=3;
  19782. //>>excludeEnd("ctx");
  19783. $3=_st($4)._or_((function(){
  19784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19785. return smalltalk.withContext(function($ctx3) {
  19786. //>>excludeEnd("ctx");
  19787. $5=(0).__lt(nextLF);
  19788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19789. $ctx3.sendIdx["<"]=1;
  19790. //>>excludeEnd("ctx");
  19791. return _st($5)._and_((function(){
  19792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19793. return smalltalk.withContext(function($ctx4) {
  19794. //>>excludeEnd("ctx");
  19795. return _st(nextLF).__lt(nextCR);
  19796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19797. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  19798. //>>excludeEnd("ctx");
  19799. }));
  19800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19801. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  19802. //>>excludeEnd("ctx");
  19803. }));
  19804. if(smalltalk.assert($3)){
  19805. $6=start;
  19806. $7=_st(nextLF).__minus((1));
  19807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19808. $ctx2.sendIdx["-"]=1;
  19809. //>>excludeEnd("ctx");
  19810. _st(aBlock)._value_value_value_($6,$7,nextLF);
  19811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19812. $ctx2.sendIdx["value:value:value:"]=2;
  19813. //>>excludeEnd("ctx");
  19814. start=(1).__plus(nextLF);
  19815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19816. $ctx2.sendIdx["+"]=1;
  19817. //>>excludeEnd("ctx");
  19818. start;
  19819. nextLF=self._indexOf_startingAt_(lf,start);
  19820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19821. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  19822. //>>excludeEnd("ctx");
  19823. return nextLF;
  19824. } else {
  19825. $9=(1).__plus(nextCR);
  19826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19827. $ctx2.sendIdx["+"]=2;
  19828. //>>excludeEnd("ctx");
  19829. $8=_st($9).__eq(nextLF);
  19830. if(smalltalk.assert($8)){
  19831. $10=start;
  19832. $11=_st(nextCR).__minus((1));
  19833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19834. $ctx2.sendIdx["-"]=2;
  19835. //>>excludeEnd("ctx");
  19836. _st(aBlock)._value_value_value_($10,$11,nextLF);
  19837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19838. $ctx2.sendIdx["value:value:value:"]=3;
  19839. //>>excludeEnd("ctx");
  19840. start=(1).__plus(nextLF);
  19841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19842. $ctx2.sendIdx["+"]=3;
  19843. //>>excludeEnd("ctx");
  19844. start;
  19845. nextCR=self._indexOf_startingAt_(cr,start);
  19846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19847. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  19848. //>>excludeEnd("ctx");
  19849. nextCR;
  19850. nextLF=self._indexOf_startingAt_(lf,start);
  19851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19852. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  19853. //>>excludeEnd("ctx");
  19854. return nextLF;
  19855. } else {
  19856. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  19857. start=(1).__plus(nextCR);
  19858. start;
  19859. nextCR=self._indexOf_startingAt_(cr,start);
  19860. return nextCR;
  19861. };
  19862. };
  19863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19865. //>>excludeEnd("ctx");
  19866. }));
  19867. return self;
  19868. }
  19869. catch(e) {if(e===$early)return e[0]; throw e}
  19870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19871. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},globals.String)});
  19872. //>>excludeEnd("ctx");
  19873. },
  19874. //>>excludeStart("ide", pragmas.excludeIdeData);
  19875. args: ["aBlock"],
  19876. 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 ] ]]",
  19877. referencedClasses: ["String"],
  19878. //>>excludeEnd("ide");
  19879. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  19880. }),
  19881. globals.String);
  19882. smalltalk.addMethod(
  19883. smalltalk.method({
  19884. selector: "lineNumber:",
  19885. protocol: 'split join',
  19886. fn: function (anIndex){
  19887. var self=this;
  19888. var lineCount;
  19889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19890. return smalltalk.withContext(function($ctx1) {
  19891. //>>excludeEnd("ctx");
  19892. var $2,$1,$3;
  19893. var $early={};
  19894. try {
  19895. lineCount=(0);
  19896. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  19897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19898. return smalltalk.withContext(function($ctx2) {
  19899. //>>excludeEnd("ctx");
  19900. lineCount=_st(lineCount).__plus((1));
  19901. $2=lineCount;
  19902. $1=_st($2).__eq(anIndex);
  19903. if(smalltalk.assert($1)){
  19904. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  19905. throw $early=[$3];
  19906. };
  19907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19908. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  19909. //>>excludeEnd("ctx");
  19910. }));
  19911. return nil;
  19912. }
  19913. catch(e) {if(e===$early)return e[0]; throw e}
  19914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19915. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},globals.String)});
  19916. //>>excludeEnd("ctx");
  19917. },
  19918. //>>excludeStart("ide", pragmas.excludeIdeData);
  19919. args: ["anIndex"],
  19920. 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",
  19921. referencedClasses: [],
  19922. //>>excludeEnd("ide");
  19923. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  19924. }),
  19925. globals.String);
  19926. smalltalk.addMethod(
  19927. smalltalk.method({
  19928. selector: "lines",
  19929. protocol: 'split join',
  19930. fn: function (){
  19931. var self=this;
  19932. var lines;
  19933. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  19934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19935. return smalltalk.withContext(function($ctx1) {
  19936. //>>excludeEnd("ctx");
  19937. var $1;
  19938. lines=_st($Array())._new();
  19939. self._linesDo_((function(aLine){
  19940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19941. return smalltalk.withContext(function($ctx2) {
  19942. //>>excludeEnd("ctx");
  19943. return _st(lines)._add_(aLine);
  19944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19945. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)});
  19946. //>>excludeEnd("ctx");
  19947. }));
  19948. $1=lines;
  19949. return $1;
  19950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19951. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},globals.String)});
  19952. //>>excludeEnd("ctx");
  19953. },
  19954. //>>excludeStart("ide", pragmas.excludeIdeData);
  19955. args: [],
  19956. 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",
  19957. referencedClasses: ["Array"],
  19958. //>>excludeEnd("ide");
  19959. messageSends: ["new", "linesDo:", "add:"]
  19960. }),
  19961. globals.String);
  19962. smalltalk.addMethod(
  19963. smalltalk.method({
  19964. selector: "linesDo:",
  19965. protocol: 'split join',
  19966. fn: function (aBlock){
  19967. var self=this;
  19968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19969. return smalltalk.withContext(function($ctx1) {
  19970. //>>excludeEnd("ctx");
  19971. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  19972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19973. return smalltalk.withContext(function($ctx2) {
  19974. //>>excludeEnd("ctx");
  19975. return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  19976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19977. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  19978. //>>excludeEnd("ctx");
  19979. }));
  19980. return self;
  19981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19982. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},globals.String)});
  19983. //>>excludeEnd("ctx");
  19984. },
  19985. //>>excludeStart("ide", pragmas.excludeIdeData);
  19986. args: ["aBlock"],
  19987. 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) ]",
  19988. referencedClasses: [],
  19989. //>>excludeEnd("ide");
  19990. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"]
  19991. }),
  19992. globals.String);
  19993. smalltalk.addMethod(
  19994. smalltalk.method({
  19995. selector: "match:",
  19996. protocol: 'regular expressions',
  19997. fn: function (aRegexp){
  19998. var self=this;
  19999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20000. return smalltalk.withContext(function($ctx1) {
  20001. //>>excludeEnd("ctx");
  20002. return self.search(aRegexp) != -1;
  20003. return self;
  20004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20005. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},globals.String)});
  20006. //>>excludeEnd("ctx");
  20007. },
  20008. //>>excludeStart("ide", pragmas.excludeIdeData);
  20009. args: ["aRegexp"],
  20010. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  20011. referencedClasses: [],
  20012. //>>excludeEnd("ide");
  20013. messageSends: []
  20014. }),
  20015. globals.String);
  20016. smalltalk.addMethod(
  20017. smalltalk.method({
  20018. selector: "matchesOf:",
  20019. protocol: 'regular expressions',
  20020. fn: function (aRegularExpression){
  20021. var self=this;
  20022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20023. return smalltalk.withContext(function($ctx1) {
  20024. //>>excludeEnd("ctx");
  20025. return self.match(aRegularExpression);
  20026. return self;
  20027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20028. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},globals.String)});
  20029. //>>excludeEnd("ctx");
  20030. },
  20031. //>>excludeStart("ide", pragmas.excludeIdeData);
  20032. args: ["aRegularExpression"],
  20033. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  20034. referencedClasses: [],
  20035. //>>excludeEnd("ide");
  20036. messageSends: []
  20037. }),
  20038. globals.String);
  20039. smalltalk.addMethod(
  20040. smalltalk.method({
  20041. selector: "numericallyIndexable",
  20042. protocol: 'private',
  20043. fn: function (){
  20044. var self=this;
  20045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20046. return smalltalk.withContext(function($ctx1) {
  20047. //>>excludeEnd("ctx");
  20048. return String(self);
  20049. return self;
  20050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20051. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.String)});
  20052. //>>excludeEnd("ctx");
  20053. },
  20054. //>>excludeStart("ide", pragmas.excludeIdeData);
  20055. args: [],
  20056. source: "numericallyIndexable\x0a\x09<return String(self)>",
  20057. referencedClasses: [],
  20058. //>>excludeEnd("ide");
  20059. messageSends: []
  20060. }),
  20061. globals.String);
  20062. smalltalk.addMethod(
  20063. smalltalk.method({
  20064. selector: "printNl",
  20065. protocol: 'printing',
  20066. fn: function (){
  20067. var self=this;
  20068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20069. return smalltalk.withContext(function($ctx1) {
  20070. //>>excludeEnd("ctx");
  20071. console.log(self);
  20072. return self;
  20073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20074. }, function($ctx1) {$ctx1.fill(self,"printNl",{},globals.String)});
  20075. //>>excludeEnd("ctx");
  20076. },
  20077. //>>excludeStart("ide", pragmas.excludeIdeData);
  20078. args: [],
  20079. source: "printNl\x0a\x09<console.log(self)>",
  20080. referencedClasses: [],
  20081. //>>excludeEnd("ide");
  20082. messageSends: []
  20083. }),
  20084. globals.String);
  20085. smalltalk.addMethod(
  20086. smalltalk.method({
  20087. selector: "printOn:",
  20088. protocol: 'printing',
  20089. fn: function (aStream){
  20090. var self=this;
  20091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20092. return smalltalk.withContext(function($ctx1) {
  20093. //>>excludeEnd("ctx");
  20094. var $1;
  20095. _st(aStream)._nextPutAll_("'");
  20096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20097. $ctx1.sendIdx["nextPutAll:"]=1;
  20098. //>>excludeEnd("ctx");
  20099. _st(aStream)._nextPutAll_(self);
  20100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20101. $ctx1.sendIdx["nextPutAll:"]=2;
  20102. //>>excludeEnd("ctx");
  20103. $1=_st(aStream)._nextPutAll_("'");
  20104. return self;
  20105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20106. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.String)});
  20107. //>>excludeEnd("ctx");
  20108. },
  20109. //>>excludeStart("ide", pragmas.excludeIdeData);
  20110. args: ["aStream"],
  20111. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  20112. referencedClasses: [],
  20113. //>>excludeEnd("ide");
  20114. messageSends: ["nextPutAll:"]
  20115. }),
  20116. globals.String);
  20117. smalltalk.addMethod(
  20118. smalltalk.method({
  20119. selector: "replace:with:",
  20120. protocol: 'regular expressions',
  20121. fn: function (aString,anotherString){
  20122. var self=this;
  20123. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  20124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20125. return smalltalk.withContext(function($ctx1) {
  20126. //>>excludeEnd("ctx");
  20127. var $1;
  20128. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  20129. return $1;
  20130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20131. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},globals.String)});
  20132. //>>excludeEnd("ctx");
  20133. },
  20134. //>>excludeStart("ide", pragmas.excludeIdeData);
  20135. args: ["aString", "anotherString"],
  20136. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  20137. referencedClasses: ["RegularExpression"],
  20138. //>>excludeEnd("ide");
  20139. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  20140. }),
  20141. globals.String);
  20142. smalltalk.addMethod(
  20143. smalltalk.method({
  20144. selector: "replaceRegexp:with:",
  20145. protocol: 'regular expressions',
  20146. fn: function (aRegexp,aString){
  20147. var self=this;
  20148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20149. return smalltalk.withContext(function($ctx1) {
  20150. //>>excludeEnd("ctx");
  20151. return self.replace(aRegexp, aString);
  20152. return self;
  20153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20154. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},globals.String)});
  20155. //>>excludeEnd("ctx");
  20156. },
  20157. //>>excludeStart("ide", pragmas.excludeIdeData);
  20158. args: ["aRegexp", "aString"],
  20159. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  20160. referencedClasses: [],
  20161. //>>excludeEnd("ide");
  20162. messageSends: []
  20163. }),
  20164. globals.String);
  20165. smalltalk.addMethod(
  20166. smalltalk.method({
  20167. selector: "reversed",
  20168. protocol: 'converting',
  20169. fn: function (){
  20170. var self=this;
  20171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20172. return smalltalk.withContext(function($ctx1) {
  20173. //>>excludeEnd("ctx");
  20174. return self.split("").reverse().join("");
  20175. return self;
  20176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20177. }, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.String)});
  20178. //>>excludeEnd("ctx");
  20179. },
  20180. //>>excludeStart("ide", pragmas.excludeIdeData);
  20181. args: [],
  20182. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  20183. referencedClasses: [],
  20184. //>>excludeEnd("ide");
  20185. messageSends: []
  20186. }),
  20187. globals.String);
  20188. smalltalk.addMethod(
  20189. smalltalk.method({
  20190. selector: "shallowCopy",
  20191. protocol: 'copying',
  20192. fn: function (){
  20193. var self=this;
  20194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20195. return smalltalk.withContext(function($ctx1) {
  20196. //>>excludeEnd("ctx");
  20197. var $1;
  20198. $1=_st(self._class())._fromString_(self);
  20199. return $1;
  20200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20201. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.String)});
  20202. //>>excludeEnd("ctx");
  20203. },
  20204. //>>excludeStart("ide", pragmas.excludeIdeData);
  20205. args: [],
  20206. source: "shallowCopy\x0a\x09^ self class fromString: self",
  20207. referencedClasses: [],
  20208. //>>excludeEnd("ide");
  20209. messageSends: ["fromString:", "class"]
  20210. }),
  20211. globals.String);
  20212. smalltalk.addMethod(
  20213. smalltalk.method({
  20214. selector: "size",
  20215. protocol: 'accessing',
  20216. fn: function (){
  20217. var self=this;
  20218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20219. return smalltalk.withContext(function($ctx1) {
  20220. //>>excludeEnd("ctx");
  20221. return self.length;
  20222. return self;
  20223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20224. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.String)});
  20225. //>>excludeEnd("ctx");
  20226. },
  20227. //>>excludeStart("ide", pragmas.excludeIdeData);
  20228. args: [],
  20229. source: "size\x0a\x09<return self.length>",
  20230. referencedClasses: [],
  20231. //>>excludeEnd("ide");
  20232. messageSends: []
  20233. }),
  20234. globals.String);
  20235. smalltalk.addMethod(
  20236. smalltalk.method({
  20237. selector: "subStrings:",
  20238. protocol: 'split join',
  20239. fn: function (aString){
  20240. var self=this;
  20241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20242. return smalltalk.withContext(function($ctx1) {
  20243. //>>excludeEnd("ctx");
  20244. var $1;
  20245. $1=self._tokenize_(aString);
  20246. return $1;
  20247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20248. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},globals.String)});
  20249. //>>excludeEnd("ctx");
  20250. },
  20251. //>>excludeStart("ide", pragmas.excludeIdeData);
  20252. args: ["aString"],
  20253. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  20254. referencedClasses: [],
  20255. //>>excludeEnd("ide");
  20256. messageSends: ["tokenize:"]
  20257. }),
  20258. globals.String);
  20259. smalltalk.addMethod(
  20260. smalltalk.method({
  20261. selector: "tokenize:",
  20262. protocol: 'split join',
  20263. fn: function (aString){
  20264. var self=this;
  20265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20266. return smalltalk.withContext(function($ctx1) {
  20267. //>>excludeEnd("ctx");
  20268. return self.split(aString);
  20269. return self;
  20270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20271. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},globals.String)});
  20272. //>>excludeEnd("ctx");
  20273. },
  20274. //>>excludeStart("ide", pragmas.excludeIdeData);
  20275. args: ["aString"],
  20276. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  20277. referencedClasses: [],
  20278. //>>excludeEnd("ide");
  20279. messageSends: []
  20280. }),
  20281. globals.String);
  20282. smalltalk.addMethod(
  20283. smalltalk.method({
  20284. selector: "trimBoth",
  20285. protocol: 'regular expressions',
  20286. fn: function (){
  20287. var self=this;
  20288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20289. return smalltalk.withContext(function($ctx1) {
  20290. //>>excludeEnd("ctx");
  20291. var $1;
  20292. $1=self._trimBoth_("\x5cs");
  20293. return $1;
  20294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20295. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},globals.String)});
  20296. //>>excludeEnd("ctx");
  20297. },
  20298. //>>excludeStart("ide", pragmas.excludeIdeData);
  20299. args: [],
  20300. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  20301. referencedClasses: [],
  20302. //>>excludeEnd("ide");
  20303. messageSends: ["trimBoth:"]
  20304. }),
  20305. globals.String);
  20306. smalltalk.addMethod(
  20307. smalltalk.method({
  20308. selector: "trimBoth:",
  20309. protocol: 'regular expressions',
  20310. fn: function (separators){
  20311. var self=this;
  20312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20313. return smalltalk.withContext(function($ctx1) {
  20314. //>>excludeEnd("ctx");
  20315. var $1;
  20316. $1=_st(self._trimLeft_(separators))._trimRight_(separators);
  20317. return $1;
  20318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20319. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},globals.String)});
  20320. //>>excludeEnd("ctx");
  20321. },
  20322. //>>excludeStart("ide", pragmas.excludeIdeData);
  20323. args: ["separators"],
  20324. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  20325. referencedClasses: [],
  20326. //>>excludeEnd("ide");
  20327. messageSends: ["trimRight:", "trimLeft:"]
  20328. }),
  20329. globals.String);
  20330. smalltalk.addMethod(
  20331. smalltalk.method({
  20332. selector: "trimLeft",
  20333. protocol: 'regular expressions',
  20334. fn: function (){
  20335. var self=this;
  20336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20337. return smalltalk.withContext(function($ctx1) {
  20338. //>>excludeEnd("ctx");
  20339. var $1;
  20340. $1=self._trimLeft_("\x5cs");
  20341. return $1;
  20342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20343. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},globals.String)});
  20344. //>>excludeEnd("ctx");
  20345. },
  20346. //>>excludeStart("ide", pragmas.excludeIdeData);
  20347. args: [],
  20348. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  20349. referencedClasses: [],
  20350. //>>excludeEnd("ide");
  20351. messageSends: ["trimLeft:"]
  20352. }),
  20353. globals.String);
  20354. smalltalk.addMethod(
  20355. smalltalk.method({
  20356. selector: "trimLeft:",
  20357. protocol: 'regular expressions',
  20358. fn: function (separators){
  20359. var self=this;
  20360. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  20361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20362. return smalltalk.withContext(function($ctx1) {
  20363. //>>excludeEnd("ctx");
  20364. var $3,$2,$1;
  20365. $3=_st("^[".__comma(separators)).__comma("]+");
  20366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20367. $ctx1.sendIdx[","]=1;
  20368. //>>excludeEnd("ctx");
  20369. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  20370. $1=self._replaceRegexp_with_($2,"");
  20371. return $1;
  20372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20373. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},globals.String)});
  20374. //>>excludeEnd("ctx");
  20375. },
  20376. //>>excludeStart("ide", pragmas.excludeIdeData);
  20377. args: ["separators"],
  20378. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  20379. referencedClasses: ["RegularExpression"],
  20380. //>>excludeEnd("ide");
  20381. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  20382. }),
  20383. globals.String);
  20384. smalltalk.addMethod(
  20385. smalltalk.method({
  20386. selector: "trimRight",
  20387. protocol: 'regular expressions',
  20388. fn: function (){
  20389. var self=this;
  20390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20391. return smalltalk.withContext(function($ctx1) {
  20392. //>>excludeEnd("ctx");
  20393. var $1;
  20394. $1=self._trimRight_("\x5cs");
  20395. return $1;
  20396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20397. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},globals.String)});
  20398. //>>excludeEnd("ctx");
  20399. },
  20400. //>>excludeStart("ide", pragmas.excludeIdeData);
  20401. args: [],
  20402. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  20403. referencedClasses: [],
  20404. //>>excludeEnd("ide");
  20405. messageSends: ["trimRight:"]
  20406. }),
  20407. globals.String);
  20408. smalltalk.addMethod(
  20409. smalltalk.method({
  20410. selector: "trimRight:",
  20411. protocol: 'regular expressions',
  20412. fn: function (separators){
  20413. var self=this;
  20414. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  20415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20416. return smalltalk.withContext(function($ctx1) {
  20417. //>>excludeEnd("ctx");
  20418. var $3,$2,$1;
  20419. $3=_st("[".__comma(separators)).__comma("]+$");
  20420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20421. $ctx1.sendIdx[","]=1;
  20422. //>>excludeEnd("ctx");
  20423. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  20424. $1=self._replaceRegexp_with_($2,"");
  20425. return $1;
  20426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20427. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},globals.String)});
  20428. //>>excludeEnd("ctx");
  20429. },
  20430. //>>excludeStart("ide", pragmas.excludeIdeData);
  20431. args: ["separators"],
  20432. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  20433. referencedClasses: ["RegularExpression"],
  20434. //>>excludeEnd("ide");
  20435. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  20436. }),
  20437. globals.String);
  20438. smalltalk.addMethod(
  20439. smalltalk.method({
  20440. selector: "unescaped",
  20441. protocol: 'converting',
  20442. fn: function (){
  20443. var self=this;
  20444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20445. return smalltalk.withContext(function($ctx1) {
  20446. //>>excludeEnd("ctx");
  20447. return unescape(self);
  20448. return self;
  20449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20450. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},globals.String)});
  20451. //>>excludeEnd("ctx");
  20452. },
  20453. //>>excludeStart("ide", pragmas.excludeIdeData);
  20454. args: [],
  20455. source: "unescaped\x0a\x09<return unescape(self)>",
  20456. referencedClasses: [],
  20457. //>>excludeEnd("ide");
  20458. messageSends: []
  20459. }),
  20460. globals.String);
  20461. smalltalk.addMethod(
  20462. smalltalk.method({
  20463. selector: "uriComponentDecoded",
  20464. protocol: 'converting',
  20465. fn: function (){
  20466. var self=this;
  20467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20468. return smalltalk.withContext(function($ctx1) {
  20469. //>>excludeEnd("ctx");
  20470. return decodeURIComponent(self);
  20471. return self;
  20472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20473. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},globals.String)});
  20474. //>>excludeEnd("ctx");
  20475. },
  20476. //>>excludeStart("ide", pragmas.excludeIdeData);
  20477. args: [],
  20478. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  20479. referencedClasses: [],
  20480. //>>excludeEnd("ide");
  20481. messageSends: []
  20482. }),
  20483. globals.String);
  20484. smalltalk.addMethod(
  20485. smalltalk.method({
  20486. selector: "uriComponentEncoded",
  20487. protocol: 'converting',
  20488. fn: function (){
  20489. var self=this;
  20490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20491. return smalltalk.withContext(function($ctx1) {
  20492. //>>excludeEnd("ctx");
  20493. return encodeURIComponent(self);
  20494. return self;
  20495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20496. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},globals.String)});
  20497. //>>excludeEnd("ctx");
  20498. },
  20499. //>>excludeStart("ide", pragmas.excludeIdeData);
  20500. args: [],
  20501. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  20502. referencedClasses: [],
  20503. //>>excludeEnd("ide");
  20504. messageSends: []
  20505. }),
  20506. globals.String);
  20507. smalltalk.addMethod(
  20508. smalltalk.method({
  20509. selector: "uriDecoded",
  20510. protocol: 'converting',
  20511. fn: function (){
  20512. var self=this;
  20513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20514. return smalltalk.withContext(function($ctx1) {
  20515. //>>excludeEnd("ctx");
  20516. return decodeURI(self);
  20517. return self;
  20518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20519. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},globals.String)});
  20520. //>>excludeEnd("ctx");
  20521. },
  20522. //>>excludeStart("ide", pragmas.excludeIdeData);
  20523. args: [],
  20524. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  20525. referencedClasses: [],
  20526. //>>excludeEnd("ide");
  20527. messageSends: []
  20528. }),
  20529. globals.String);
  20530. smalltalk.addMethod(
  20531. smalltalk.method({
  20532. selector: "uriEncoded",
  20533. protocol: 'converting',
  20534. fn: function (){
  20535. var self=this;
  20536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20537. return smalltalk.withContext(function($ctx1) {
  20538. //>>excludeEnd("ctx");
  20539. return encodeURI(self);
  20540. return self;
  20541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20542. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},globals.String)});
  20543. //>>excludeEnd("ctx");
  20544. },
  20545. //>>excludeStart("ide", pragmas.excludeIdeData);
  20546. args: [],
  20547. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  20548. referencedClasses: [],
  20549. //>>excludeEnd("ide");
  20550. messageSends: []
  20551. }),
  20552. globals.String);
  20553. smalltalk.addMethod(
  20554. smalltalk.method({
  20555. selector: "value:",
  20556. protocol: 'evaluating',
  20557. fn: function (anObject){
  20558. var self=this;
  20559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20560. return smalltalk.withContext(function($ctx1) {
  20561. //>>excludeEnd("ctx");
  20562. var $1;
  20563. $1=_st(anObject)._perform_(self);
  20564. return $1;
  20565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20566. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.String)});
  20567. //>>excludeEnd("ctx");
  20568. },
  20569. //>>excludeStart("ide", pragmas.excludeIdeData);
  20570. args: ["anObject"],
  20571. source: "value: anObject \x0a\x09^ anObject perform: self",
  20572. referencedClasses: [],
  20573. //>>excludeEnd("ide");
  20574. messageSends: ["perform:"]
  20575. }),
  20576. globals.String);
  20577. smalltalk.addMethod(
  20578. smalltalk.method({
  20579. selector: "cr",
  20580. protocol: 'accessing',
  20581. fn: function (){
  20582. var self=this;
  20583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20584. return smalltalk.withContext(function($ctx1) {
  20585. //>>excludeEnd("ctx");
  20586. return '\r';
  20587. return self;
  20588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20589. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.String.klass)});
  20590. //>>excludeEnd("ctx");
  20591. },
  20592. //>>excludeStart("ide", pragmas.excludeIdeData);
  20593. args: [],
  20594. source: "cr\x0a\x09<return '\x5cr'>",
  20595. referencedClasses: [],
  20596. //>>excludeEnd("ide");
  20597. messageSends: []
  20598. }),
  20599. globals.String.klass);
  20600. smalltalk.addMethod(
  20601. smalltalk.method({
  20602. selector: "crlf",
  20603. protocol: 'accessing',
  20604. fn: function (){
  20605. var self=this;
  20606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20607. return smalltalk.withContext(function($ctx1) {
  20608. //>>excludeEnd("ctx");
  20609. return '\r\n';
  20610. return self;
  20611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20612. }, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.String.klass)});
  20613. //>>excludeEnd("ctx");
  20614. },
  20615. //>>excludeStart("ide", pragmas.excludeIdeData);
  20616. args: [],
  20617. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  20618. referencedClasses: [],
  20619. //>>excludeEnd("ide");
  20620. messageSends: []
  20621. }),
  20622. globals.String.klass);
  20623. smalltalk.addMethod(
  20624. smalltalk.method({
  20625. selector: "esc",
  20626. protocol: 'accessing',
  20627. fn: function (){
  20628. var self=this;
  20629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20630. return smalltalk.withContext(function($ctx1) {
  20631. //>>excludeEnd("ctx");
  20632. var $1;
  20633. $1=self._fromCharCode_((27));
  20634. return $1;
  20635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20636. }, function($ctx1) {$ctx1.fill(self,"esc",{},globals.String.klass)});
  20637. //>>excludeEnd("ctx");
  20638. },
  20639. //>>excludeStart("ide", pragmas.excludeIdeData);
  20640. args: [],
  20641. source: "esc\x0a\x09^ self fromCharCode: 27",
  20642. referencedClasses: [],
  20643. //>>excludeEnd("ide");
  20644. messageSends: ["fromCharCode:"]
  20645. }),
  20646. globals.String.klass);
  20647. smalltalk.addMethod(
  20648. smalltalk.method({
  20649. selector: "fromCharCode:",
  20650. protocol: 'instance creation',
  20651. fn: function (anInteger){
  20652. var self=this;
  20653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20654. return smalltalk.withContext(function($ctx1) {
  20655. //>>excludeEnd("ctx");
  20656. return String.fromCharCode(anInteger);
  20657. return self;
  20658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20659. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},globals.String.klass)});
  20660. //>>excludeEnd("ctx");
  20661. },
  20662. //>>excludeStart("ide", pragmas.excludeIdeData);
  20663. args: ["anInteger"],
  20664. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  20665. referencedClasses: [],
  20666. //>>excludeEnd("ide");
  20667. messageSends: []
  20668. }),
  20669. globals.String.klass);
  20670. smalltalk.addMethod(
  20671. smalltalk.method({
  20672. selector: "fromString:",
  20673. protocol: 'instance creation',
  20674. fn: function (aString){
  20675. var self=this;
  20676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20677. return smalltalk.withContext(function($ctx1) {
  20678. //>>excludeEnd("ctx");
  20679. return String(aString);
  20680. return self;
  20681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20682. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.String.klass)});
  20683. //>>excludeEnd("ctx");
  20684. },
  20685. //>>excludeStart("ide", pragmas.excludeIdeData);
  20686. args: ["aString"],
  20687. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  20688. referencedClasses: [],
  20689. //>>excludeEnd("ide");
  20690. messageSends: []
  20691. }),
  20692. globals.String.klass);
  20693. smalltalk.addMethod(
  20694. smalltalk.method({
  20695. selector: "lf",
  20696. protocol: 'accessing',
  20697. fn: function (){
  20698. var self=this;
  20699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20700. return smalltalk.withContext(function($ctx1) {
  20701. //>>excludeEnd("ctx");
  20702. return '\n';
  20703. return self;
  20704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20705. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.String.klass)});
  20706. //>>excludeEnd("ctx");
  20707. },
  20708. //>>excludeStart("ide", pragmas.excludeIdeData);
  20709. args: [],
  20710. source: "lf\x0a\x09<return '\x5cn'>",
  20711. referencedClasses: [],
  20712. //>>excludeEnd("ide");
  20713. messageSends: []
  20714. }),
  20715. globals.String.klass);
  20716. smalltalk.addMethod(
  20717. smalltalk.method({
  20718. selector: "random",
  20719. protocol: 'random',
  20720. fn: function (){
  20721. var self=this;
  20722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20723. return smalltalk.withContext(function($ctx1) {
  20724. //>>excludeEnd("ctx");
  20725. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  20726. return self;
  20727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20728. }, function($ctx1) {$ctx1.fill(self,"random",{},globals.String.klass)});
  20729. //>>excludeEnd("ctx");
  20730. },
  20731. //>>excludeStart("ide", pragmas.excludeIdeData);
  20732. args: [],
  20733. 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);>",
  20734. referencedClasses: [],
  20735. //>>excludeEnd("ide");
  20736. messageSends: []
  20737. }),
  20738. globals.String.klass);
  20739. smalltalk.addMethod(
  20740. smalltalk.method({
  20741. selector: "randomNotIn:",
  20742. protocol: 'random',
  20743. fn: function (aString){
  20744. var self=this;
  20745. var result;
  20746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20747. return smalltalk.withContext(function($ctx1) {
  20748. //>>excludeEnd("ctx");
  20749. var $1;
  20750. _st((function(){
  20751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20752. return smalltalk.withContext(function($ctx2) {
  20753. //>>excludeEnd("ctx");
  20754. result=self._random();
  20755. result;
  20756. return _st(aString)._includesSubString_(result);
  20757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20759. //>>excludeEnd("ctx");
  20760. }))._whileTrue();
  20761. $1=result;
  20762. return $1;
  20763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20764. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},globals.String.klass)});
  20765. //>>excludeEnd("ctx");
  20766. },
  20767. //>>excludeStart("ide", pragmas.excludeIdeData);
  20768. args: ["aString"],
  20769. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  20770. referencedClasses: [],
  20771. //>>excludeEnd("ide");
  20772. messageSends: ["whileTrue", "random", "includesSubString:"]
  20773. }),
  20774. globals.String.klass);
  20775. smalltalk.addMethod(
  20776. smalltalk.method({
  20777. selector: "space",
  20778. protocol: 'accessing',
  20779. fn: function (){
  20780. var self=this;
  20781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20782. return smalltalk.withContext(function($ctx1) {
  20783. //>>excludeEnd("ctx");
  20784. return ' ';
  20785. return self;
  20786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20787. }, function($ctx1) {$ctx1.fill(self,"space",{},globals.String.klass)});
  20788. //>>excludeEnd("ctx");
  20789. },
  20790. //>>excludeStart("ide", pragmas.excludeIdeData);
  20791. args: [],
  20792. source: "space\x0a\x09<return ' '>",
  20793. referencedClasses: [],
  20794. //>>excludeEnd("ide");
  20795. messageSends: []
  20796. }),
  20797. globals.String.klass);
  20798. smalltalk.addMethod(
  20799. smalltalk.method({
  20800. selector: "streamClass",
  20801. protocol: 'accessing',
  20802. fn: function (){
  20803. var self=this;
  20804. function $StringStream(){return globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  20805. return $StringStream();
  20806. },
  20807. //>>excludeStart("ide", pragmas.excludeIdeData);
  20808. args: [],
  20809. source: "streamClass\x0a\x09\x09^ StringStream",
  20810. referencedClasses: ["StringStream"],
  20811. //>>excludeEnd("ide");
  20812. messageSends: []
  20813. }),
  20814. globals.String.klass);
  20815. smalltalk.addMethod(
  20816. smalltalk.method({
  20817. selector: "tab",
  20818. protocol: 'accessing',
  20819. fn: function (){
  20820. var self=this;
  20821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20822. return smalltalk.withContext(function($ctx1) {
  20823. //>>excludeEnd("ctx");
  20824. return '\t';
  20825. return self;
  20826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20827. }, function($ctx1) {$ctx1.fill(self,"tab",{},globals.String.klass)});
  20828. //>>excludeEnd("ctx");
  20829. },
  20830. //>>excludeStart("ide", pragmas.excludeIdeData);
  20831. args: [],
  20832. source: "tab\x0a\x09<return '\x5ct'>",
  20833. referencedClasses: [],
  20834. //>>excludeEnd("ide");
  20835. messageSends: []
  20836. }),
  20837. globals.String.klass);
  20838. smalltalk.addMethod(
  20839. smalltalk.method({
  20840. selector: "value:",
  20841. protocol: 'instance creation',
  20842. fn: function (aUTFCharCode){
  20843. var self=this;
  20844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20845. return smalltalk.withContext(function($ctx1) {
  20846. //>>excludeEnd("ctx");
  20847. return String.fromCharCode(aUTFCharCode);;
  20848. return self;
  20849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20850. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},globals.String.klass)});
  20851. //>>excludeEnd("ctx");
  20852. },
  20853. //>>excludeStart("ide", pragmas.excludeIdeData);
  20854. args: ["aUTFCharCode"],
  20855. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  20856. referencedClasses: [],
  20857. //>>excludeEnd("ide");
  20858. messageSends: []
  20859. }),
  20860. globals.String.klass);
  20861. smalltalk.addClass('Set', globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  20862. //>>excludeStart("ide", pragmas.excludeIdeData);
  20863. globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
  20864. //>>excludeEnd("ide");
  20865. smalltalk.addMethod(
  20866. smalltalk.method({
  20867. selector: "=",
  20868. protocol: 'comparing',
  20869. fn: function (aCollection){
  20870. var self=this;
  20871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20872. return smalltalk.withContext(function($ctx1) {
  20873. //>>excludeEnd("ctx");
  20874. var $2,$1,$4,$3,$5;
  20875. var $early={};
  20876. try {
  20877. $2=self._class();
  20878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20879. $ctx1.sendIdx["class"]=1;
  20880. //>>excludeEnd("ctx");
  20881. $1=_st($2).__eq(_st(aCollection)._class());
  20882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20883. $ctx1.sendIdx["="]=1;
  20884. //>>excludeEnd("ctx");
  20885. if(! smalltalk.assert($1)){
  20886. return false;
  20887. };
  20888. $4=self._size();
  20889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20890. $ctx1.sendIdx["size"]=1;
  20891. //>>excludeEnd("ctx");
  20892. $3=_st($4).__eq(_st(aCollection)._size());
  20893. if(! smalltalk.assert($3)){
  20894. return false;
  20895. };
  20896. self._do_((function(each){
  20897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20898. return smalltalk.withContext(function($ctx2) {
  20899. //>>excludeEnd("ctx");
  20900. $5=_st(aCollection)._includes_(each);
  20901. if(! smalltalk.assert($5)){
  20902. throw $early=[false];
  20903. };
  20904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  20906. //>>excludeEnd("ctx");
  20907. }));
  20908. return true;
  20909. }
  20910. catch(e) {if(e===$early)return e[0]; throw e}
  20911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20912. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.Set)});
  20913. //>>excludeEnd("ctx");
  20914. },
  20915. //>>excludeStart("ide", pragmas.excludeIdeData);
  20916. args: ["aCollection"],
  20917. 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",
  20918. referencedClasses: [],
  20919. //>>excludeEnd("ide");
  20920. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  20921. }),
  20922. globals.Set);
  20923. smalltalk.addMethod(
  20924. smalltalk.method({
  20925. selector: "add:",
  20926. protocol: 'adding/removing',
  20927. fn: function (anObject){
  20928. var self=this;
  20929. var bucket;
  20930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20931. return smalltalk.withContext(function($ctx1) {
  20932. //>>excludeEnd("ctx");
  20933. var $2,$1,$receiver;
  20934. bucket=self._bucketsOfElement_(anObject);
  20935. $2=_st(bucket)._second();
  20936. if(($receiver = $2) == null || $receiver.isNil){
  20937. var object,slowBucket;
  20938. object=_st(bucket)._first();
  20939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20940. $ctx1.sendIdx["first"]=1;
  20941. //>>excludeEnd("ctx");
  20942. object;
  20943. slowBucket=_st(bucket)._third();
  20944. slowBucket;
  20945. _st(slowBucket)._indexOf_ifAbsent_(object,(function(){
  20946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20947. return smalltalk.withContext(function($ctx2) {
  20948. //>>excludeEnd("ctx");
  20949. _st(slowBucket)._add_(object);
  20950. self["@size"]=_st(self["@size"]).__plus((1));
  20951. return self["@size"];
  20952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20954. //>>excludeEnd("ctx");
  20955. }));
  20956. $1=object;
  20957. } else {
  20958. var primitiveBucket;
  20959. primitiveBucket=$receiver;
  20960. $1=self._add_in_(_st(bucket)._first(),primitiveBucket);
  20961. };
  20962. return $1;
  20963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20964. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},globals.Set)});
  20965. //>>excludeEnd("ctx");
  20966. },
  20967. //>>excludeStart("ide", pragmas.excludeIdeData);
  20968. args: ["anObject"],
  20969. source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
  20970. referencedClasses: [],
  20971. //>>excludeEnd("ide");
  20972. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  20973. }),
  20974. globals.Set);
  20975. smalltalk.addMethod(
  20976. smalltalk.method({
  20977. selector: "add:in:",
  20978. protocol: 'private',
  20979. fn: function (anObject,anotherObject){
  20980. var self=this;
  20981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20982. return smalltalk.withContext(function($ctx1) {
  20983. //>>excludeEnd("ctx");
  20984. if (anObject in anotherObject.store) { return false; }
  20985. self['@size']++;
  20986. return anotherObject.store[anObject] = true;
  20987. ;
  20988. return self;
  20989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20990. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)});
  20991. //>>excludeEnd("ctx");
  20992. },
  20993. //>>excludeStart("ide", pragmas.excludeIdeData);
  20994. args: ["anObject", "anotherObject"],
  20995. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09return anotherObject.store[anObject] = true;\x0a\x09>",
  20996. referencedClasses: [],
  20997. //>>excludeEnd("ide");
  20998. messageSends: []
  20999. }),
  21000. globals.Set);
  21001. smalltalk.addMethod(
  21002. smalltalk.method({
  21003. selector: "bucketsOfElement:",
  21004. protocol: 'private',
  21005. fn: function (anObject){
  21006. var self=this;
  21007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21008. return smalltalk.withContext(function($ctx1) {
  21009. //>>excludeEnd("ctx");
  21010. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  21011. if ((type = typeof prim) === "object") {
  21012. if (anObject !== nil) {
  21013. bucket = null;
  21014. self['@slowBucketStores'].some(function (store) {
  21015. return bucket = store._bucketOfElement_(anObject);
  21016. });
  21017. return [ anObject, null, bucket || self['@defaultBucket'] ];
  21018. }
  21019. // include nil to well-known objects under 'boolean' fastBucket
  21020. prim = null;
  21021. type = 'boolean';
  21022. }
  21023. return [ prim, self['@fastBuckets'][type] ];
  21024. ;
  21025. return self;
  21026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21027. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},globals.Set)});
  21028. //>>excludeEnd("ctx");
  21029. },
  21030. //>>excludeStart("ide", pragmas.excludeIdeData);
  21031. args: ["anObject"],
  21032. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<\x0a\x09\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>",
  21033. referencedClasses: [],
  21034. //>>excludeEnd("ide");
  21035. messageSends: []
  21036. }),
  21037. globals.Set);
  21038. smalltalk.addMethod(
  21039. smalltalk.method({
  21040. selector: "classNameOf:",
  21041. protocol: 'private',
  21042. fn: function (anObject){
  21043. var self=this;
  21044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21045. return smalltalk.withContext(function($ctx1) {
  21046. //>>excludeEnd("ctx");
  21047. return anObject.klass && anObject.klass.className;
  21048. return self;
  21049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21050. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},globals.Set)});
  21051. //>>excludeEnd("ctx");
  21052. },
  21053. //>>excludeStart("ide", pragmas.excludeIdeData);
  21054. args: ["anObject"],
  21055. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<return anObject.klass && anObject.klass.className>",
  21056. referencedClasses: [],
  21057. //>>excludeEnd("ide");
  21058. messageSends: []
  21059. }),
  21060. globals.Set);
  21061. smalltalk.addMethod(
  21062. smalltalk.method({
  21063. selector: "collect:",
  21064. protocol: 'enumerating',
  21065. fn: function (aBlock){
  21066. var self=this;
  21067. var collection;
  21068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21069. return smalltalk.withContext(function($ctx1) {
  21070. //>>excludeEnd("ctx");
  21071. var $1;
  21072. collection=_st(self._class())._new();
  21073. self._do_((function(each){
  21074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21075. return smalltalk.withContext(function($ctx2) {
  21076. //>>excludeEnd("ctx");
  21077. return _st(collection)._add_(_st(aBlock)._value_(each));
  21078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21080. //>>excludeEnd("ctx");
  21081. }));
  21082. $1=collection;
  21083. return $1;
  21084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21085. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},globals.Set)});
  21086. //>>excludeEnd("ctx");
  21087. },
  21088. //>>excludeStart("ide", pragmas.excludeIdeData);
  21089. args: ["aBlock"],
  21090. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  21091. referencedClasses: [],
  21092. //>>excludeEnd("ide");
  21093. messageSends: ["new", "class", "do:", "add:", "value:"]
  21094. }),
  21095. globals.Set);
  21096. smalltalk.addMethod(
  21097. smalltalk.method({
  21098. selector: "detect:ifNone:",
  21099. protocol: 'enumerating',
  21100. fn: function (aBlock,anotherBlock){
  21101. var self=this;
  21102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21103. return smalltalk.withContext(function($ctx1) {
  21104. //>>excludeEnd("ctx");
  21105. var $1,$2;
  21106. var $early={};
  21107. try {
  21108. self._do_((function(each){
  21109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21110. return smalltalk.withContext(function($ctx2) {
  21111. //>>excludeEnd("ctx");
  21112. $1=_st(aBlock)._value_(each);
  21113. if(smalltalk.assert($1)){
  21114. throw $early=[each];
  21115. };
  21116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21118. //>>excludeEnd("ctx");
  21119. }));
  21120. $2=_st(anotherBlock)._value();
  21121. return $2;
  21122. }
  21123. catch(e) {if(e===$early)return e[0]; throw e}
  21124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21125. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Set)});
  21126. //>>excludeEnd("ctx");
  21127. },
  21128. //>>excludeStart("ide", pragmas.excludeIdeData);
  21129. args: ["aBlock", "anotherBlock"],
  21130. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  21131. referencedClasses: [],
  21132. //>>excludeEnd("ide");
  21133. messageSends: ["do:", "ifTrue:", "value:", "value"]
  21134. }),
  21135. globals.Set);
  21136. smalltalk.addMethod(
  21137. smalltalk.method({
  21138. selector: "do:",
  21139. protocol: 'enumerating',
  21140. fn: function (aBlock){
  21141. var self=this;
  21142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21143. return smalltalk.withContext(function($ctx1) {
  21144. //>>excludeEnd("ctx");
  21145. var el, keys, i;
  21146. el = self['@fastBuckets'];
  21147. keys = Object.keys(el);
  21148. for (i = 0; i < keys.length; ++i) {
  21149. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  21150. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  21151. else { store._do_(aBlock); }
  21152. }
  21153. el = self['@slowBucketStores'];
  21154. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  21155. self['@defaultBucket']._do_(aBlock);
  21156. ;
  21157. return self;
  21158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21159. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Set)});
  21160. //>>excludeEnd("ctx");
  21161. },
  21162. //>>excludeStart("ide", pragmas.excludeIdeData);
  21163. args: ["aBlock"],
  21164. source: "do: aBlock\x0a\x09<\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = self['@fastBuckets'];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = self['@slowBucketStores'];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09self['@defaultBucket']._do_(aBlock);\x0a\x09>",
  21165. referencedClasses: [],
  21166. //>>excludeEnd("ide");
  21167. messageSends: []
  21168. }),
  21169. globals.Set);
  21170. smalltalk.addMethod(
  21171. smalltalk.method({
  21172. selector: "includes:",
  21173. protocol: 'testing',
  21174. fn: function (anObject){
  21175. var self=this;
  21176. var bucket;
  21177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21178. return smalltalk.withContext(function($ctx1) {
  21179. //>>excludeEnd("ctx");
  21180. var $2,$3,$4,$1,$receiver;
  21181. bucket=self._bucketsOfElement_(anObject);
  21182. $2=_st(bucket)._second();
  21183. if(($receiver = $2) == null || $receiver.isNil){
  21184. $3=_st(bucket)._third();
  21185. $4=_st(bucket)._first();
  21186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21187. $ctx1.sendIdx["first"]=1;
  21188. //>>excludeEnd("ctx");
  21189. $1=_st($3)._includes_($4);
  21190. } else {
  21191. var primitiveBucket;
  21192. primitiveBucket=$receiver;
  21193. $1=self._includes_in_(_st(bucket)._first(),primitiveBucket);
  21194. };
  21195. return $1;
  21196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21197. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},globals.Set)});
  21198. //>>excludeEnd("ctx");
  21199. },
  21200. //>>excludeStart("ide", pragmas.excludeIdeData);
  21201. args: ["anObject"],
  21202. source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
  21203. referencedClasses: [],
  21204. //>>excludeEnd("ide");
  21205. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  21206. }),
  21207. globals.Set);
  21208. smalltalk.addMethod(
  21209. smalltalk.method({
  21210. selector: "includes:in:",
  21211. protocol: 'private',
  21212. fn: function (anObject,anotherObject){
  21213. var self=this;
  21214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21215. return smalltalk.withContext(function($ctx1) {
  21216. //>>excludeEnd("ctx");
  21217. return anObject in anotherObject.store;
  21218. return self;
  21219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21220. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)});
  21221. //>>excludeEnd("ctx");
  21222. },
  21223. //>>excludeStart("ide", pragmas.excludeIdeData);
  21224. args: ["anObject", "anotherObject"],
  21225. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  21226. referencedClasses: [],
  21227. //>>excludeEnd("ide");
  21228. messageSends: []
  21229. }),
  21230. globals.Set);
  21231. smalltalk.addMethod(
  21232. smalltalk.method({
  21233. selector: "initialize",
  21234. protocol: 'initialization',
  21235. fn: function (){
  21236. var self=this;
  21237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21238. return smalltalk.withContext(function($ctx1) {
  21239. //>>excludeEnd("ctx");
  21240. var $1;
  21241. (
  21242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21243. $ctx1.supercall = true,
  21244. //>>excludeEnd("ctx");
  21245. globals.Set.superclass.fn.prototype._initialize.apply(_st(self), []));
  21246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21247. $ctx1.supercall = false;
  21248. //>>excludeEnd("ctx");;
  21249. self["@defaultBucket"]=[];
  21250. self._initializeSlowBucketStores();
  21251. $1=self._removeAll();
  21252. return self;
  21253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21254. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Set)});
  21255. //>>excludeEnd("ctx");
  21256. },
  21257. //>>excludeStart("ide", pragmas.excludeIdeData);
  21258. args: [],
  21259. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  21260. referencedClasses: [],
  21261. //>>excludeEnd("ide");
  21262. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  21263. }),
  21264. globals.Set);
  21265. smalltalk.addMethod(
  21266. smalltalk.method({
  21267. selector: "initializeSlowBucketStores",
  21268. protocol: 'initialization',
  21269. fn: function (){
  21270. var self=this;
  21271. function $ArrayBucketStore(){return globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  21272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21273. return smalltalk.withContext(function($ctx1) {
  21274. //>>excludeEnd("ctx");
  21275. var $1;
  21276. $1=_st($ArrayBucketStore())._hashBlock_((function(x){
  21277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21278. return smalltalk.withContext(function($ctx2) {
  21279. //>>excludeEnd("ctx");
  21280. return self._classNameOf_(x);
  21281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21282. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  21283. //>>excludeEnd("ctx");
  21284. }));
  21285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21286. $ctx1.sendIdx["hashBlock:"]=1;
  21287. //>>excludeEnd("ctx");
  21288. self["@slowBucketStores"]=[$1,_st($ArrayBucketStore())._hashBlock_((function(x){
  21289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21290. return smalltalk.withContext(function($ctx2) {
  21291. //>>excludeEnd("ctx");
  21292. return self._jsConstructorNameOf_(x);
  21293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21294. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  21295. //>>excludeEnd("ctx");
  21296. }))];
  21297. return self;
  21298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21299. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},globals.Set)});
  21300. //>>excludeEnd("ctx");
  21301. },
  21302. //>>excludeStart("ide", pragmas.excludeIdeData);
  21303. args: [],
  21304. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  21305. referencedClasses: ["ArrayBucketStore"],
  21306. //>>excludeEnd("ide");
  21307. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  21308. }),
  21309. globals.Set);
  21310. smalltalk.addMethod(
  21311. smalltalk.method({
  21312. selector: "jsConstructorNameOf:",
  21313. protocol: 'private',
  21314. fn: function (anObject){
  21315. var self=this;
  21316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21317. return smalltalk.withContext(function($ctx1) {
  21318. //>>excludeEnd("ctx");
  21319. return anObject.constructor && anObject.constructor.name;
  21320. return self;
  21321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21322. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},globals.Set)});
  21323. //>>excludeEnd("ctx");
  21324. },
  21325. //>>excludeStart("ide", pragmas.excludeIdeData);
  21326. args: ["anObject"],
  21327. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  21328. referencedClasses: [],
  21329. //>>excludeEnd("ide");
  21330. messageSends: []
  21331. }),
  21332. globals.Set);
  21333. smalltalk.addMethod(
  21334. smalltalk.method({
  21335. selector: "printOn:",
  21336. protocol: 'printing',
  21337. fn: function (aStream){
  21338. var self=this;
  21339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21340. return smalltalk.withContext(function($ctx1) {
  21341. //>>excludeEnd("ctx");
  21342. (
  21343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21344. $ctx1.supercall = true,
  21345. //>>excludeEnd("ctx");
  21346. globals.Set.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  21347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21348. $ctx1.supercall = false;
  21349. //>>excludeEnd("ctx");;
  21350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21351. $ctx1.sendIdx["printOn:"]=1;
  21352. //>>excludeEnd("ctx");
  21353. _st(aStream)._nextPutAll_(" (");
  21354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21355. $ctx1.sendIdx["nextPutAll:"]=1;
  21356. //>>excludeEnd("ctx");
  21357. self._do_separatedBy_((function(each){
  21358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21359. return smalltalk.withContext(function($ctx2) {
  21360. //>>excludeEnd("ctx");
  21361. return _st(each)._printOn_(aStream);
  21362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21363. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21364. //>>excludeEnd("ctx");
  21365. }),(function(){
  21366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21367. return smalltalk.withContext(function($ctx2) {
  21368. //>>excludeEnd("ctx");
  21369. return _st(aStream)._nextPutAll_(" ");
  21370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21371. $ctx2.sendIdx["nextPutAll:"]=2;
  21372. //>>excludeEnd("ctx");
  21373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  21375. //>>excludeEnd("ctx");
  21376. }));
  21377. _st(aStream)._nextPutAll_(")");
  21378. return self;
  21379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21380. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Set)});
  21381. //>>excludeEnd("ctx");
  21382. },
  21383. //>>excludeStart("ide", pragmas.excludeIdeData);
  21384. args: ["aStream"],
  21385. 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: ')'",
  21386. referencedClasses: [],
  21387. //>>excludeEnd("ide");
  21388. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  21389. }),
  21390. globals.Set);
  21391. smalltalk.addMethod(
  21392. smalltalk.method({
  21393. selector: "remove:ifAbsent:",
  21394. protocol: 'adding/removing',
  21395. fn: function (anObject,aBlock){
  21396. var self=this;
  21397. var bucket;
  21398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21399. return smalltalk.withContext(function($ctx1) {
  21400. //>>excludeEnd("ctx");
  21401. var $2,$3,$4,$5,$1,$receiver;
  21402. var $early={};
  21403. try {
  21404. bucket=self._bucketsOfElement_(anObject);
  21405. $2=_st(bucket)._second();
  21406. if(($receiver = $2) == null || $receiver.isNil){
  21407. $3=_st(bucket)._third();
  21408. $4=_st(bucket)._first();
  21409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21410. $ctx1.sendIdx["first"]=1;
  21411. //>>excludeEnd("ctx");
  21412. _st($3)._remove_ifAbsent_($4,(function(){
  21413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21414. return smalltalk.withContext(function($ctx2) {
  21415. //>>excludeEnd("ctx");
  21416. $5=_st(aBlock)._value();
  21417. throw $early=[$5];
  21418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  21420. //>>excludeEnd("ctx");
  21421. }));
  21422. self["@size"]=_st(self["@size"]).__minus((1));
  21423. $1=self["@size"];
  21424. } else {
  21425. var primitiveBucket;
  21426. primitiveBucket=$receiver;
  21427. $1=self._remove_in_(_st(bucket)._first(),primitiveBucket);
  21428. };
  21429. return $1;
  21430. }
  21431. catch(e) {if(e===$early)return e[0]; throw e}
  21432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21433. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},globals.Set)});
  21434. //>>excludeEnd("ctx");
  21435. },
  21436. //>>excludeStart("ide", pragmas.excludeIdeData);
  21437. args: ["anObject", "aBlock"],
  21438. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  21439. referencedClasses: [],
  21440. //>>excludeEnd("ide");
  21441. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  21442. }),
  21443. globals.Set);
  21444. smalltalk.addMethod(
  21445. smalltalk.method({
  21446. selector: "remove:in:",
  21447. protocol: 'private',
  21448. fn: function (anObject,anotherObject){
  21449. var self=this;
  21450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21451. return smalltalk.withContext(function($ctx1) {
  21452. //>>excludeEnd("ctx");
  21453. if (delete anotherObject.store[anObject]) self['@size']--;
  21454. return self;
  21455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21456. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)});
  21457. //>>excludeEnd("ctx");
  21458. },
  21459. //>>excludeStart("ide", pragmas.excludeIdeData);
  21460. args: ["anObject", "anotherObject"],
  21461. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  21462. referencedClasses: [],
  21463. //>>excludeEnd("ide");
  21464. messageSends: []
  21465. }),
  21466. globals.Set);
  21467. smalltalk.addMethod(
  21468. smalltalk.method({
  21469. selector: "removeAll",
  21470. protocol: 'adding/removing',
  21471. fn: function (){
  21472. var self=this;
  21473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21474. return smalltalk.withContext(function($ctx1) {
  21475. //>>excludeEnd("ctx");
  21476. self['@fastBuckets'] = {
  21477. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  21478. 'number': { store: Object.create(null), fn: Number },
  21479. 'string': { store: Object.create(null) }
  21480. };
  21481. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  21482. self['@defaultBucket']._removeAll();
  21483. self['@size'] = 0;
  21484. ;
  21485. return self;
  21486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21487. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Set)});
  21488. //>>excludeEnd("ctx");
  21489. },
  21490. //>>excludeStart("ide", pragmas.excludeIdeData);
  21491. args: [],
  21492. source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self['@defaultBucket']._removeAll();\x0a\x09\x09self['@size'] = 0;\x0a\x09>",
  21493. referencedClasses: [],
  21494. //>>excludeEnd("ide");
  21495. messageSends: []
  21496. }),
  21497. globals.Set);
  21498. smalltalk.addMethod(
  21499. smalltalk.method({
  21500. selector: "select:",
  21501. protocol: 'enumerating',
  21502. fn: function (aBlock){
  21503. var self=this;
  21504. var collection;
  21505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21506. return smalltalk.withContext(function($ctx1) {
  21507. //>>excludeEnd("ctx");
  21508. var $1,$2;
  21509. collection=_st(self._class())._new();
  21510. self._do_((function(each){
  21511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21512. return smalltalk.withContext(function($ctx2) {
  21513. //>>excludeEnd("ctx");
  21514. $1=_st(aBlock)._value_(each);
  21515. if(smalltalk.assert($1)){
  21516. return _st(collection)._add_(each);
  21517. };
  21518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21520. //>>excludeEnd("ctx");
  21521. }));
  21522. $2=collection;
  21523. return $2;
  21524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21525. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},globals.Set)});
  21526. //>>excludeEnd("ctx");
  21527. },
  21528. //>>excludeStart("ide", pragmas.excludeIdeData);
  21529. args: ["aBlock"],
  21530. 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",
  21531. referencedClasses: [],
  21532. //>>excludeEnd("ide");
  21533. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  21534. }),
  21535. globals.Set);
  21536. smalltalk.addMethod(
  21537. smalltalk.method({
  21538. selector: "size",
  21539. protocol: 'accessing',
  21540. fn: function (){
  21541. var self=this;
  21542. var $1;
  21543. $1=self["@size"];
  21544. return $1;
  21545. },
  21546. //>>excludeStart("ide", pragmas.excludeIdeData);
  21547. args: [],
  21548. source: "size\x0a\x09^ size",
  21549. referencedClasses: [],
  21550. //>>excludeEnd("ide");
  21551. messageSends: []
  21552. }),
  21553. globals.Set);
  21554. smalltalk.addClass('Queue', globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  21555. //>>excludeStart("ide", pragmas.excludeIdeData);
  21556. globals.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.";
  21557. //>>excludeEnd("ide");
  21558. smalltalk.addMethod(
  21559. smalltalk.method({
  21560. selector: "initialize",
  21561. protocol: 'initialization',
  21562. fn: function (){
  21563. var self=this;
  21564. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  21565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21566. return smalltalk.withContext(function($ctx1) {
  21567. //>>excludeEnd("ctx");
  21568. (
  21569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21570. $ctx1.supercall = true,
  21571. //>>excludeEnd("ctx");
  21572. globals.Queue.superclass.fn.prototype._initialize.apply(_st(self), []));
  21573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21574. $ctx1.supercall = false;
  21575. //>>excludeEnd("ctx");;
  21576. self["@read"]=_st($OrderedCollection())._new();
  21577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21578. $ctx1.sendIdx["new"]=1;
  21579. //>>excludeEnd("ctx");
  21580. self["@write"]=_st($OrderedCollection())._new();
  21581. self["@readIndex"]=(1);
  21582. return self;
  21583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21584. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Queue)});
  21585. //>>excludeEnd("ctx");
  21586. },
  21587. //>>excludeStart("ide", pragmas.excludeIdeData);
  21588. args: [],
  21589. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  21590. referencedClasses: ["OrderedCollection"],
  21591. //>>excludeEnd("ide");
  21592. messageSends: ["initialize", "new"]
  21593. }),
  21594. globals.Queue);
  21595. smalltalk.addMethod(
  21596. smalltalk.method({
  21597. selector: "next",
  21598. protocol: 'accessing',
  21599. fn: function (){
  21600. var self=this;
  21601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21602. return smalltalk.withContext(function($ctx1) {
  21603. //>>excludeEnd("ctx");
  21604. var $1;
  21605. $1=self._nextIfAbsent_((function(){
  21606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21607. return smalltalk.withContext(function($ctx2) {
  21608. //>>excludeEnd("ctx");
  21609. return self._error_("Cannot read from empty Queue.");
  21610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21612. //>>excludeEnd("ctx");
  21613. }));
  21614. return $1;
  21615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21616. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Queue)});
  21617. //>>excludeEnd("ctx");
  21618. },
  21619. //>>excludeStart("ide", pragmas.excludeIdeData);
  21620. args: [],
  21621. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  21622. referencedClasses: [],
  21623. //>>excludeEnd("ide");
  21624. messageSends: ["nextIfAbsent:", "error:"]
  21625. }),
  21626. globals.Queue);
  21627. smalltalk.addMethod(
  21628. smalltalk.method({
  21629. selector: "nextIfAbsent:",
  21630. protocol: 'accessing',
  21631. fn: function (aBlock){
  21632. var self=this;
  21633. var result;
  21634. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  21635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21636. return smalltalk.withContext(function($ctx1) {
  21637. //>>excludeEnd("ctx");
  21638. var $1,$2,$3,$4;
  21639. var $early={};
  21640. try {
  21641. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  21642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21643. return smalltalk.withContext(function($ctx2) {
  21644. //>>excludeEnd("ctx");
  21645. $1=_st(self["@write"])._isEmpty();
  21646. if(smalltalk.assert($1)){
  21647. $2=_st(self["@readIndex"]).__gt((1));
  21648. if(smalltalk.assert($2)){
  21649. self["@read"]=[];
  21650. self["@read"];
  21651. self["@readIndex"]=(1);
  21652. self["@readIndex"];
  21653. };
  21654. $3=_st(aBlock)._value();
  21655. throw $early=[$3];
  21656. };
  21657. self["@read"]=self["@write"];
  21658. self["@read"];
  21659. self["@readIndex"]=(1);
  21660. self["@readIndex"];
  21661. self["@write"]=_st($OrderedCollection())._new();
  21662. self["@write"];
  21663. return _st(self["@read"])._first();
  21664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21666. //>>excludeEnd("ctx");
  21667. }));
  21668. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  21669. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  21670. $4=result;
  21671. return $4;
  21672. }
  21673. catch(e) {if(e===$early)return e[0]; throw e}
  21674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21675. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},globals.Queue)});
  21676. //>>excludeEnd("ctx");
  21677. },
  21678. //>>excludeStart("ide", pragmas.excludeIdeData);
  21679. args: ["aBlock"],
  21680. 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",
  21681. referencedClasses: ["OrderedCollection"],
  21682. //>>excludeEnd("ide");
  21683. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  21684. }),
  21685. globals.Queue);
  21686. smalltalk.addMethod(
  21687. smalltalk.method({
  21688. selector: "nextPut:",
  21689. protocol: 'accessing',
  21690. fn: function (anObject){
  21691. var self=this;
  21692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21693. return smalltalk.withContext(function($ctx1) {
  21694. //>>excludeEnd("ctx");
  21695. _st(self["@write"])._add_(anObject);
  21696. return self;
  21697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21698. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Queue)});
  21699. //>>excludeEnd("ctx");
  21700. },
  21701. //>>excludeStart("ide", pragmas.excludeIdeData);
  21702. args: ["anObject"],
  21703. source: "nextPut: anObject\x0a\x09write add: anObject",
  21704. referencedClasses: [],
  21705. //>>excludeEnd("ide");
  21706. messageSends: ["add:"]
  21707. }),
  21708. globals.Queue);
  21709. smalltalk.addClass('RegularExpression', globals.Object, [], 'Kernel-Collections');
  21710. //>>excludeStart("ide", pragmas.excludeIdeData);
  21711. globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  21712. //>>excludeEnd("ide");
  21713. smalltalk.addMethod(
  21714. smalltalk.method({
  21715. selector: "compile:",
  21716. protocol: 'evaluating',
  21717. fn: function (aString){
  21718. var self=this;
  21719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21720. return smalltalk.withContext(function($ctx1) {
  21721. //>>excludeEnd("ctx");
  21722. return self.compile(aString);
  21723. return self;
  21724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21725. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.RegularExpression)});
  21726. //>>excludeEnd("ctx");
  21727. },
  21728. //>>excludeStart("ide", pragmas.excludeIdeData);
  21729. args: ["aString"],
  21730. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  21731. referencedClasses: [],
  21732. //>>excludeEnd("ide");
  21733. messageSends: []
  21734. }),
  21735. globals.RegularExpression);
  21736. smalltalk.addMethod(
  21737. smalltalk.method({
  21738. selector: "exec:",
  21739. protocol: 'evaluating',
  21740. fn: function (aString){
  21741. var self=this;
  21742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21743. return smalltalk.withContext(function($ctx1) {
  21744. //>>excludeEnd("ctx");
  21745. return self.exec(aString) || nil;
  21746. return self;
  21747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21748. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},globals.RegularExpression)});
  21749. //>>excludeEnd("ctx");
  21750. },
  21751. //>>excludeStart("ide", pragmas.excludeIdeData);
  21752. args: ["aString"],
  21753. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  21754. referencedClasses: [],
  21755. //>>excludeEnd("ide");
  21756. messageSends: []
  21757. }),
  21758. globals.RegularExpression);
  21759. smalltalk.addMethod(
  21760. smalltalk.method({
  21761. selector: "test:",
  21762. protocol: 'evaluating',
  21763. fn: function (aString){
  21764. var self=this;
  21765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21766. return smalltalk.withContext(function($ctx1) {
  21767. //>>excludeEnd("ctx");
  21768. return self.test(aString);
  21769. return self;
  21770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21771. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},globals.RegularExpression)});
  21772. //>>excludeEnd("ctx");
  21773. },
  21774. //>>excludeStart("ide", pragmas.excludeIdeData);
  21775. args: ["aString"],
  21776. source: "test: aString\x0a\x09<return self.test(aString)>",
  21777. referencedClasses: [],
  21778. //>>excludeEnd("ide");
  21779. messageSends: []
  21780. }),
  21781. globals.RegularExpression);
  21782. smalltalk.addMethod(
  21783. smalltalk.method({
  21784. selector: "fromString:",
  21785. protocol: 'instance creation',
  21786. fn: function (aString){
  21787. var self=this;
  21788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21789. return smalltalk.withContext(function($ctx1) {
  21790. //>>excludeEnd("ctx");
  21791. var $1;
  21792. $1=self._fromString_flag_(aString,"");
  21793. return $1;
  21794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21795. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.RegularExpression.klass)});
  21796. //>>excludeEnd("ctx");
  21797. },
  21798. //>>excludeStart("ide", pragmas.excludeIdeData);
  21799. args: ["aString"],
  21800. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  21801. referencedClasses: [],
  21802. //>>excludeEnd("ide");
  21803. messageSends: ["fromString:flag:"]
  21804. }),
  21805. globals.RegularExpression.klass);
  21806. smalltalk.addMethod(
  21807. smalltalk.method({
  21808. selector: "fromString:flag:",
  21809. protocol: 'instance creation',
  21810. fn: function (aString,anotherString){
  21811. var self=this;
  21812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21813. return smalltalk.withContext(function($ctx1) {
  21814. //>>excludeEnd("ctx");
  21815. return new RegExp(aString, anotherString);
  21816. return self;
  21817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21818. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},globals.RegularExpression.klass)});
  21819. //>>excludeEnd("ctx");
  21820. },
  21821. //>>excludeStart("ide", pragmas.excludeIdeData);
  21822. args: ["aString", "anotherString"],
  21823. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  21824. referencedClasses: [],
  21825. //>>excludeEnd("ide");
  21826. messageSends: []
  21827. }),
  21828. globals.RegularExpression.klass);
  21829. smalltalk.addClass('Stream', globals.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  21830. //>>excludeStart("ide", pragmas.excludeIdeData);
  21831. globals.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.";
  21832. //>>excludeEnd("ide");
  21833. smalltalk.addMethod(
  21834. smalltalk.method({
  21835. selector: "<<",
  21836. protocol: 'writing',
  21837. fn: function (anObject){
  21838. var self=this;
  21839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21840. return smalltalk.withContext(function($ctx1) {
  21841. //>>excludeEnd("ctx");
  21842. self._write_(anObject);
  21843. return self;
  21844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21845. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},globals.Stream)});
  21846. //>>excludeEnd("ctx");
  21847. },
  21848. //>>excludeStart("ide", pragmas.excludeIdeData);
  21849. args: ["anObject"],
  21850. source: "<< anObject\x0a\x09self write: anObject",
  21851. referencedClasses: [],
  21852. //>>excludeEnd("ide");
  21853. messageSends: ["write:"]
  21854. }),
  21855. globals.Stream);
  21856. smalltalk.addMethod(
  21857. smalltalk.method({
  21858. selector: "atEnd",
  21859. protocol: 'testing',
  21860. fn: function (){
  21861. var self=this;
  21862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21863. return smalltalk.withContext(function($ctx1) {
  21864. //>>excludeEnd("ctx");
  21865. var $1;
  21866. $1=_st(self._position()).__eq(self._size());
  21867. return $1;
  21868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21869. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.Stream)});
  21870. //>>excludeEnd("ctx");
  21871. },
  21872. //>>excludeStart("ide", pragmas.excludeIdeData);
  21873. args: [],
  21874. source: "atEnd\x0a\x09^ self position = self size",
  21875. referencedClasses: [],
  21876. //>>excludeEnd("ide");
  21877. messageSends: ["=", "position", "size"]
  21878. }),
  21879. globals.Stream);
  21880. smalltalk.addMethod(
  21881. smalltalk.method({
  21882. selector: "atStart",
  21883. protocol: 'testing',
  21884. fn: function (){
  21885. var self=this;
  21886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21887. return smalltalk.withContext(function($ctx1) {
  21888. //>>excludeEnd("ctx");
  21889. var $1;
  21890. $1=_st(self._position()).__eq((0));
  21891. return $1;
  21892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21893. }, function($ctx1) {$ctx1.fill(self,"atStart",{},globals.Stream)});
  21894. //>>excludeEnd("ctx");
  21895. },
  21896. //>>excludeStart("ide", pragmas.excludeIdeData);
  21897. args: [],
  21898. source: "atStart\x0a\x09^ self position = 0",
  21899. referencedClasses: [],
  21900. //>>excludeEnd("ide");
  21901. messageSends: ["=", "position"]
  21902. }),
  21903. globals.Stream);
  21904. smalltalk.addMethod(
  21905. smalltalk.method({
  21906. selector: "close",
  21907. protocol: 'actions',
  21908. fn: function (){
  21909. var self=this;
  21910. return self;
  21911. },
  21912. //>>excludeStart("ide", pragmas.excludeIdeData);
  21913. args: [],
  21914. source: "close",
  21915. referencedClasses: [],
  21916. //>>excludeEnd("ide");
  21917. messageSends: []
  21918. }),
  21919. globals.Stream);
  21920. smalltalk.addMethod(
  21921. smalltalk.method({
  21922. selector: "collection",
  21923. protocol: 'accessing',
  21924. fn: function (){
  21925. var self=this;
  21926. var $1;
  21927. $1=self["@collection"];
  21928. return $1;
  21929. },
  21930. //>>excludeStart("ide", pragmas.excludeIdeData);
  21931. args: [],
  21932. source: "collection\x0a\x09^ collection",
  21933. referencedClasses: [],
  21934. //>>excludeEnd("ide");
  21935. messageSends: []
  21936. }),
  21937. globals.Stream);
  21938. smalltalk.addMethod(
  21939. smalltalk.method({
  21940. selector: "contents",
  21941. protocol: 'accessing',
  21942. fn: function (){
  21943. var self=this;
  21944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21945. return smalltalk.withContext(function($ctx1) {
  21946. //>>excludeEnd("ctx");
  21947. var $1;
  21948. $1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
  21949. return $1;
  21950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21951. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.Stream)});
  21952. //>>excludeEnd("ctx");
  21953. },
  21954. //>>excludeStart("ide", pragmas.excludeIdeData);
  21955. args: [],
  21956. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  21957. referencedClasses: [],
  21958. //>>excludeEnd("ide");
  21959. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  21960. }),
  21961. globals.Stream);
  21962. smalltalk.addMethod(
  21963. smalltalk.method({
  21964. selector: "do:",
  21965. protocol: 'enumerating',
  21966. fn: function (aBlock){
  21967. var self=this;
  21968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21969. return smalltalk.withContext(function($ctx1) {
  21970. //>>excludeEnd("ctx");
  21971. _st((function(){
  21972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21973. return smalltalk.withContext(function($ctx2) {
  21974. //>>excludeEnd("ctx");
  21975. return self._atEnd();
  21976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21978. //>>excludeEnd("ctx");
  21979. }))._whileFalse_((function(){
  21980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21981. return smalltalk.withContext(function($ctx2) {
  21982. //>>excludeEnd("ctx");
  21983. return _st(aBlock)._value_(self._next());
  21984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  21986. //>>excludeEnd("ctx");
  21987. }));
  21988. return self;
  21989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21990. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Stream)});
  21991. //>>excludeEnd("ctx");
  21992. },
  21993. //>>excludeStart("ide", pragmas.excludeIdeData);
  21994. args: ["aBlock"],
  21995. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  21996. referencedClasses: [],
  21997. //>>excludeEnd("ide");
  21998. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  21999. }),
  22000. globals.Stream);
  22001. smalltalk.addMethod(
  22002. smalltalk.method({
  22003. selector: "flush",
  22004. protocol: 'actions',
  22005. fn: function (){
  22006. var self=this;
  22007. return self;
  22008. },
  22009. //>>excludeStart("ide", pragmas.excludeIdeData);
  22010. args: [],
  22011. source: "flush",
  22012. referencedClasses: [],
  22013. //>>excludeEnd("ide");
  22014. messageSends: []
  22015. }),
  22016. globals.Stream);
  22017. smalltalk.addMethod(
  22018. smalltalk.method({
  22019. selector: "isEmpty",
  22020. protocol: 'testing',
  22021. fn: function (){
  22022. var self=this;
  22023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22024. return smalltalk.withContext(function($ctx1) {
  22025. //>>excludeEnd("ctx");
  22026. var $1;
  22027. $1=_st(self._size()).__eq((0));
  22028. return $1;
  22029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22030. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Stream)});
  22031. //>>excludeEnd("ctx");
  22032. },
  22033. //>>excludeStart("ide", pragmas.excludeIdeData);
  22034. args: [],
  22035. source: "isEmpty\x0a\x09^ self size = 0",
  22036. referencedClasses: [],
  22037. //>>excludeEnd("ide");
  22038. messageSends: ["=", "size"]
  22039. }),
  22040. globals.Stream);
  22041. smalltalk.addMethod(
  22042. smalltalk.method({
  22043. selector: "next",
  22044. protocol: 'reading',
  22045. fn: function (){
  22046. var self=this;
  22047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22048. return smalltalk.withContext(function($ctx1) {
  22049. //>>excludeEnd("ctx");
  22050. var $2,$4,$3,$1;
  22051. $2=self._atEnd();
  22052. if(smalltalk.assert($2)){
  22053. $1=nil;
  22054. } else {
  22055. $4=self._position();
  22056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22057. $ctx1.sendIdx["position"]=1;
  22058. //>>excludeEnd("ctx");
  22059. $3=_st($4).__plus((1));
  22060. self._position_($3);
  22061. $1=_st(self["@collection"])._at_(self._position());
  22062. };
  22063. return $1;
  22064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22065. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Stream)});
  22066. //>>excludeEnd("ctx");
  22067. },
  22068. //>>excludeStart("ide", pragmas.excludeIdeData);
  22069. args: [],
  22070. 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 ]",
  22071. referencedClasses: [],
  22072. //>>excludeEnd("ide");
  22073. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  22074. }),
  22075. globals.Stream);
  22076. smalltalk.addMethod(
  22077. smalltalk.method({
  22078. selector: "next:",
  22079. protocol: 'reading',
  22080. fn: function (anInteger){
  22081. var self=this;
  22082. var tempCollection;
  22083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22084. return smalltalk.withContext(function($ctx1) {
  22085. //>>excludeEnd("ctx");
  22086. var $1,$2;
  22087. tempCollection=_st(_st(self._collection())._class())._new();
  22088. _st(anInteger)._timesRepeat_((function(){
  22089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22090. return smalltalk.withContext(function($ctx2) {
  22091. //>>excludeEnd("ctx");
  22092. $1=self._atEnd();
  22093. if(! smalltalk.assert($1)){
  22094. return _st(tempCollection)._add_(self._next());
  22095. };
  22096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22098. //>>excludeEnd("ctx");
  22099. }));
  22100. $2=tempCollection;
  22101. return $2;
  22102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22103. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.Stream)});
  22104. //>>excludeEnd("ctx");
  22105. },
  22106. //>>excludeStart("ide", pragmas.excludeIdeData);
  22107. args: ["anInteger"],
  22108. 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",
  22109. referencedClasses: [],
  22110. //>>excludeEnd("ide");
  22111. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  22112. }),
  22113. globals.Stream);
  22114. smalltalk.addMethod(
  22115. smalltalk.method({
  22116. selector: "nextPut:",
  22117. protocol: 'writing',
  22118. fn: function (anObject){
  22119. var self=this;
  22120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22121. return smalltalk.withContext(function($ctx1) {
  22122. //>>excludeEnd("ctx");
  22123. var $2,$1,$3,$4;
  22124. $2=self._position();
  22125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22126. $ctx1.sendIdx["position"]=1;
  22127. //>>excludeEnd("ctx");
  22128. $1=_st($2).__plus((1));
  22129. self._position_($1);
  22130. $3=self._collection();
  22131. $4=self._position();
  22132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22133. $ctx1.sendIdx["position"]=2;
  22134. //>>excludeEnd("ctx");
  22135. _st($3)._at_put_($4,anObject);
  22136. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  22137. return self;
  22138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22139. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Stream)});
  22140. //>>excludeEnd("ctx");
  22141. },
  22142. //>>excludeStart("ide", pragmas.excludeIdeData);
  22143. args: ["anObject"],
  22144. 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)",
  22145. referencedClasses: [],
  22146. //>>excludeEnd("ide");
  22147. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  22148. }),
  22149. globals.Stream);
  22150. smalltalk.addMethod(
  22151. smalltalk.method({
  22152. selector: "nextPutAll:",
  22153. protocol: 'writing',
  22154. fn: function (aCollection){
  22155. var self=this;
  22156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22157. return smalltalk.withContext(function($ctx1) {
  22158. //>>excludeEnd("ctx");
  22159. _st(aCollection)._do_((function(each){
  22160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22161. return smalltalk.withContext(function($ctx2) {
  22162. //>>excludeEnd("ctx");
  22163. return self._nextPut_(each);
  22164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22165. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22166. //>>excludeEnd("ctx");
  22167. }));
  22168. return self;
  22169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22170. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},globals.Stream)});
  22171. //>>excludeEnd("ctx");
  22172. },
  22173. //>>excludeStart("ide", pragmas.excludeIdeData);
  22174. args: ["aCollection"],
  22175. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  22176. referencedClasses: [],
  22177. //>>excludeEnd("ide");
  22178. messageSends: ["do:", "nextPut:"]
  22179. }),
  22180. globals.Stream);
  22181. smalltalk.addMethod(
  22182. smalltalk.method({
  22183. selector: "nextPutString:",
  22184. protocol: 'writing',
  22185. fn: function (aString){
  22186. var self=this;
  22187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22188. return smalltalk.withContext(function($ctx1) {
  22189. //>>excludeEnd("ctx");
  22190. self._nextPut_(aString);
  22191. return self;
  22192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22193. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.Stream)});
  22194. //>>excludeEnd("ctx");
  22195. },
  22196. //>>excludeStart("ide", pragmas.excludeIdeData);
  22197. args: ["aString"],
  22198. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  22199. referencedClasses: [],
  22200. //>>excludeEnd("ide");
  22201. messageSends: ["nextPut:"]
  22202. }),
  22203. globals.Stream);
  22204. smalltalk.addMethod(
  22205. smalltalk.method({
  22206. selector: "peek",
  22207. protocol: 'reading',
  22208. fn: function (){
  22209. var self=this;
  22210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22211. return smalltalk.withContext(function($ctx1) {
  22212. //>>excludeEnd("ctx");
  22213. var $2,$1;
  22214. $2=self._atEnd();
  22215. if(! smalltalk.assert($2)){
  22216. $1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
  22217. };
  22218. return $1;
  22219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22220. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.Stream)});
  22221. //>>excludeEnd("ctx");
  22222. },
  22223. //>>excludeStart("ide", pragmas.excludeIdeData);
  22224. args: [],
  22225. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  22226. referencedClasses: [],
  22227. //>>excludeEnd("ide");
  22228. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  22229. }),
  22230. globals.Stream);
  22231. smalltalk.addMethod(
  22232. smalltalk.method({
  22233. selector: "position",
  22234. protocol: 'accessing',
  22235. fn: function (){
  22236. var self=this;
  22237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22238. return smalltalk.withContext(function($ctx1) {
  22239. //>>excludeEnd("ctx");
  22240. var $2,$1,$receiver;
  22241. $2=self["@position"];
  22242. if(($receiver = $2) == null || $receiver.isNil){
  22243. self["@position"]=(0);
  22244. $1=self["@position"];
  22245. } else {
  22246. $1=$2;
  22247. };
  22248. return $1;
  22249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22250. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Stream)});
  22251. //>>excludeEnd("ctx");
  22252. },
  22253. //>>excludeStart("ide", pragmas.excludeIdeData);
  22254. args: [],
  22255. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  22256. referencedClasses: [],
  22257. //>>excludeEnd("ide");
  22258. messageSends: ["ifNil:"]
  22259. }),
  22260. globals.Stream);
  22261. smalltalk.addMethod(
  22262. smalltalk.method({
  22263. selector: "position:",
  22264. protocol: 'accessing',
  22265. fn: function (anInteger){
  22266. var self=this;
  22267. self["@position"]=anInteger;
  22268. return self;
  22269. },
  22270. //>>excludeStart("ide", pragmas.excludeIdeData);
  22271. args: ["anInteger"],
  22272. source: "position: anInteger\x0a\x09position := anInteger",
  22273. referencedClasses: [],
  22274. //>>excludeEnd("ide");
  22275. messageSends: []
  22276. }),
  22277. globals.Stream);
  22278. smalltalk.addMethod(
  22279. smalltalk.method({
  22280. selector: "reset",
  22281. protocol: 'actions',
  22282. fn: function (){
  22283. var self=this;
  22284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22285. return smalltalk.withContext(function($ctx1) {
  22286. //>>excludeEnd("ctx");
  22287. self._position_((0));
  22288. return self;
  22289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22290. }, function($ctx1) {$ctx1.fill(self,"reset",{},globals.Stream)});
  22291. //>>excludeEnd("ctx");
  22292. },
  22293. //>>excludeStart("ide", pragmas.excludeIdeData);
  22294. args: [],
  22295. source: "reset\x0a\x09self position: 0",
  22296. referencedClasses: [],
  22297. //>>excludeEnd("ide");
  22298. messageSends: ["position:"]
  22299. }),
  22300. globals.Stream);
  22301. smalltalk.addMethod(
  22302. smalltalk.method({
  22303. selector: "resetContents",
  22304. protocol: 'actions',
  22305. fn: function (){
  22306. var self=this;
  22307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22308. return smalltalk.withContext(function($ctx1) {
  22309. //>>excludeEnd("ctx");
  22310. self._reset();
  22311. self._setStreamSize_((0));
  22312. return self;
  22313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22314. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},globals.Stream)});
  22315. //>>excludeEnd("ctx");
  22316. },
  22317. //>>excludeStart("ide", pragmas.excludeIdeData);
  22318. args: [],
  22319. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  22320. referencedClasses: [],
  22321. //>>excludeEnd("ide");
  22322. messageSends: ["reset", "setStreamSize:"]
  22323. }),
  22324. globals.Stream);
  22325. smalltalk.addMethod(
  22326. smalltalk.method({
  22327. selector: "setCollection:",
  22328. protocol: 'accessing',
  22329. fn: function (aCollection){
  22330. var self=this;
  22331. self["@collection"]=aCollection;
  22332. return self;
  22333. },
  22334. //>>excludeStart("ide", pragmas.excludeIdeData);
  22335. args: ["aCollection"],
  22336. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  22337. referencedClasses: [],
  22338. //>>excludeEnd("ide");
  22339. messageSends: []
  22340. }),
  22341. globals.Stream);
  22342. smalltalk.addMethod(
  22343. smalltalk.method({
  22344. selector: "setStreamSize:",
  22345. protocol: 'accessing',
  22346. fn: function (anInteger){
  22347. var self=this;
  22348. self["@streamSize"]=anInteger;
  22349. return self;
  22350. },
  22351. //>>excludeStart("ide", pragmas.excludeIdeData);
  22352. args: ["anInteger"],
  22353. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  22354. referencedClasses: [],
  22355. //>>excludeEnd("ide");
  22356. messageSends: []
  22357. }),
  22358. globals.Stream);
  22359. smalltalk.addMethod(
  22360. smalltalk.method({
  22361. selector: "setToEnd",
  22362. protocol: 'positioning',
  22363. fn: function (){
  22364. var self=this;
  22365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22366. return smalltalk.withContext(function($ctx1) {
  22367. //>>excludeEnd("ctx");
  22368. self._position_(self._size());
  22369. return self;
  22370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22371. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},globals.Stream)});
  22372. //>>excludeEnd("ctx");
  22373. },
  22374. //>>excludeStart("ide", pragmas.excludeIdeData);
  22375. args: [],
  22376. source: "setToEnd\x0a\x09self position: self size",
  22377. referencedClasses: [],
  22378. //>>excludeEnd("ide");
  22379. messageSends: ["position:", "size"]
  22380. }),
  22381. globals.Stream);
  22382. smalltalk.addMethod(
  22383. smalltalk.method({
  22384. selector: "size",
  22385. protocol: 'accessing',
  22386. fn: function (){
  22387. var self=this;
  22388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22389. return smalltalk.withContext(function($ctx1) {
  22390. //>>excludeEnd("ctx");
  22391. var $1;
  22392. $1=self._streamSize();
  22393. return $1;
  22394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22395. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Stream)});
  22396. //>>excludeEnd("ctx");
  22397. },
  22398. //>>excludeStart("ide", pragmas.excludeIdeData);
  22399. args: [],
  22400. source: "size\x0a\x09^ self streamSize",
  22401. referencedClasses: [],
  22402. //>>excludeEnd("ide");
  22403. messageSends: ["streamSize"]
  22404. }),
  22405. globals.Stream);
  22406. smalltalk.addMethod(
  22407. smalltalk.method({
  22408. selector: "skip:",
  22409. protocol: 'positioning',
  22410. fn: function (anInteger){
  22411. var self=this;
  22412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22413. return smalltalk.withContext(function($ctx1) {
  22414. //>>excludeEnd("ctx");
  22415. self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  22416. return self;
  22417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22418. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},globals.Stream)});
  22419. //>>excludeEnd("ctx");
  22420. },
  22421. //>>excludeStart("ide", pragmas.excludeIdeData);
  22422. args: ["anInteger"],
  22423. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  22424. referencedClasses: [],
  22425. //>>excludeEnd("ide");
  22426. messageSends: ["position:", "min:max:", "+", "position", "size"]
  22427. }),
  22428. globals.Stream);
  22429. smalltalk.addMethod(
  22430. smalltalk.method({
  22431. selector: "streamSize",
  22432. protocol: 'accessing',
  22433. fn: function (){
  22434. var self=this;
  22435. var $1;
  22436. $1=self["@streamSize"];
  22437. return $1;
  22438. },
  22439. //>>excludeStart("ide", pragmas.excludeIdeData);
  22440. args: [],
  22441. source: "streamSize\x0a\x09^ streamSize",
  22442. referencedClasses: [],
  22443. //>>excludeEnd("ide");
  22444. messageSends: []
  22445. }),
  22446. globals.Stream);
  22447. smalltalk.addMethod(
  22448. smalltalk.method({
  22449. selector: "write:",
  22450. protocol: 'writing',
  22451. fn: function (anObject){
  22452. var self=this;
  22453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22454. return smalltalk.withContext(function($ctx1) {
  22455. //>>excludeEnd("ctx");
  22456. _st(anObject)._putOn_(self);
  22457. return self;
  22458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22459. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},globals.Stream)});
  22460. //>>excludeEnd("ctx");
  22461. },
  22462. //>>excludeStart("ide", pragmas.excludeIdeData);
  22463. args: ["anObject"],
  22464. source: "write: anObject\x0a\x09anObject putOn: self",
  22465. referencedClasses: [],
  22466. //>>excludeEnd("ide");
  22467. messageSends: ["putOn:"]
  22468. }),
  22469. globals.Stream);
  22470. smalltalk.addMethod(
  22471. smalltalk.method({
  22472. selector: "on:",
  22473. protocol: 'instance creation',
  22474. fn: function (aCollection){
  22475. var self=this;
  22476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22477. return smalltalk.withContext(function($ctx1) {
  22478. //>>excludeEnd("ctx");
  22479. var $2,$3,$1;
  22480. $2=self._new();
  22481. _st($2)._setCollection_(aCollection);
  22482. _st($2)._setStreamSize_(_st(aCollection)._size());
  22483. $3=_st($2)._yourself();
  22484. $1=$3;
  22485. return $1;
  22486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22487. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.Stream.klass)});
  22488. //>>excludeEnd("ctx");
  22489. },
  22490. //>>excludeStart("ide", pragmas.excludeIdeData);
  22491. args: ["aCollection"],
  22492. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  22493. referencedClasses: [],
  22494. //>>excludeEnd("ide");
  22495. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  22496. }),
  22497. globals.Stream.klass);
  22498. smalltalk.addClass('StringStream', globals.Stream, [], 'Kernel-Collections');
  22499. //>>excludeStart("ide", pragmas.excludeIdeData);
  22500. globals.StringStream.comment="I am a Stream specific to `String` objects.";
  22501. //>>excludeEnd("ide");
  22502. smalltalk.addMethod(
  22503. smalltalk.method({
  22504. selector: "cr",
  22505. protocol: 'writing',
  22506. fn: function (){
  22507. var self=this;
  22508. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  22509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22510. return smalltalk.withContext(function($ctx1) {
  22511. //>>excludeEnd("ctx");
  22512. var $1;
  22513. $1=self._nextPutAll_(_st($String())._cr());
  22514. return $1;
  22515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22516. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.StringStream)});
  22517. //>>excludeEnd("ctx");
  22518. },
  22519. //>>excludeStart("ide", pragmas.excludeIdeData);
  22520. args: [],
  22521. source: "cr\x0a\x09^ self nextPutAll: String cr",
  22522. referencedClasses: ["String"],
  22523. //>>excludeEnd("ide");
  22524. messageSends: ["nextPutAll:", "cr"]
  22525. }),
  22526. globals.StringStream);
  22527. smalltalk.addMethod(
  22528. smalltalk.method({
  22529. selector: "crlf",
  22530. protocol: 'writing',
  22531. fn: function (){
  22532. var self=this;
  22533. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  22534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22535. return smalltalk.withContext(function($ctx1) {
  22536. //>>excludeEnd("ctx");
  22537. var $1;
  22538. $1=self._nextPutAll_(_st($String())._crlf());
  22539. return $1;
  22540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22541. }, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.StringStream)});
  22542. //>>excludeEnd("ctx");
  22543. },
  22544. //>>excludeStart("ide", pragmas.excludeIdeData);
  22545. args: [],
  22546. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  22547. referencedClasses: ["String"],
  22548. //>>excludeEnd("ide");
  22549. messageSends: ["nextPutAll:", "crlf"]
  22550. }),
  22551. globals.StringStream);
  22552. smalltalk.addMethod(
  22553. smalltalk.method({
  22554. selector: "lf",
  22555. protocol: 'writing',
  22556. fn: function (){
  22557. var self=this;
  22558. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  22559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22560. return smalltalk.withContext(function($ctx1) {
  22561. //>>excludeEnd("ctx");
  22562. var $1;
  22563. $1=self._nextPutAll_(_st($String())._lf());
  22564. return $1;
  22565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22566. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.StringStream)});
  22567. //>>excludeEnd("ctx");
  22568. },
  22569. //>>excludeStart("ide", pragmas.excludeIdeData);
  22570. args: [],
  22571. source: "lf\x0a\x09^ self nextPutAll: String lf",
  22572. referencedClasses: ["String"],
  22573. //>>excludeEnd("ide");
  22574. messageSends: ["nextPutAll:", "lf"]
  22575. }),
  22576. globals.StringStream);
  22577. smalltalk.addMethod(
  22578. smalltalk.method({
  22579. selector: "next:",
  22580. protocol: 'reading',
  22581. fn: function (anInteger){
  22582. var self=this;
  22583. var tempCollection;
  22584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22585. return smalltalk.withContext(function($ctx1) {
  22586. //>>excludeEnd("ctx");
  22587. var $1,$2;
  22588. tempCollection=_st(_st(self._collection())._class())._new();
  22589. _st(anInteger)._timesRepeat_((function(){
  22590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22591. return smalltalk.withContext(function($ctx2) {
  22592. //>>excludeEnd("ctx");
  22593. $1=self._atEnd();
  22594. if(! smalltalk.assert($1)){
  22595. tempCollection=_st(tempCollection).__comma(self._next());
  22596. return tempCollection;
  22597. };
  22598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22600. //>>excludeEnd("ctx");
  22601. }));
  22602. $2=tempCollection;
  22603. return $2;
  22604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22605. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.StringStream)});
  22606. //>>excludeEnd("ctx");
  22607. },
  22608. //>>excludeStart("ide", pragmas.excludeIdeData);
  22609. args: ["anInteger"],
  22610. 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",
  22611. referencedClasses: [],
  22612. //>>excludeEnd("ide");
  22613. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  22614. }),
  22615. globals.StringStream);
  22616. smalltalk.addMethod(
  22617. smalltalk.method({
  22618. selector: "nextPut:",
  22619. protocol: 'writing',
  22620. fn: function (aString){
  22621. var self=this;
  22622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22623. return smalltalk.withContext(function($ctx1) {
  22624. //>>excludeEnd("ctx");
  22625. self._nextPutAll_(aString);
  22626. return self;
  22627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22628. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.StringStream)});
  22629. //>>excludeEnd("ctx");
  22630. },
  22631. //>>excludeStart("ide", pragmas.excludeIdeData);
  22632. args: ["aString"],
  22633. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  22634. referencedClasses: [],
  22635. //>>excludeEnd("ide");
  22636. messageSends: ["nextPutAll:"]
  22637. }),
  22638. globals.StringStream);
  22639. smalltalk.addMethod(
  22640. smalltalk.method({
  22641. selector: "nextPutAll:",
  22642. protocol: 'writing',
  22643. fn: function (aString){
  22644. var self=this;
  22645. var pre,post;
  22646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22647. return smalltalk.withContext(function($ctx1) {
  22648. //>>excludeEnd("ctx");
  22649. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  22650. $1=self._atEnd();
  22651. if(smalltalk.assert($1)){
  22652. $3=self._collection();
  22653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22654. $ctx1.sendIdx["collection"]=1;
  22655. //>>excludeEnd("ctx");
  22656. $2=_st($3).__comma(aString);
  22657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22658. $ctx1.sendIdx[","]=1;
  22659. //>>excludeEnd("ctx");
  22660. self._setCollection_($2);
  22661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22662. $ctx1.sendIdx["setCollection:"]=1;
  22663. //>>excludeEnd("ctx");
  22664. } else {
  22665. $4=self._collection();
  22666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22667. $ctx1.sendIdx["collection"]=2;
  22668. //>>excludeEnd("ctx");
  22669. $5=self._position();
  22670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22671. $ctx1.sendIdx["position"]=1;
  22672. //>>excludeEnd("ctx");
  22673. pre=_st($4)._copyFrom_to_((1),$5);
  22674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22675. $ctx1.sendIdx["copyFrom:to:"]=1;
  22676. //>>excludeEnd("ctx");
  22677. pre;
  22678. $6=self._collection();
  22679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22680. $ctx1.sendIdx["collection"]=3;
  22681. //>>excludeEnd("ctx");
  22682. $9=self._position();
  22683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22684. $ctx1.sendIdx["position"]=2;
  22685. //>>excludeEnd("ctx");
  22686. $8=_st($9).__plus((1));
  22687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22688. $ctx1.sendIdx["+"]=2;
  22689. //>>excludeEnd("ctx");
  22690. $10=_st(aString)._size();
  22691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22692. $ctx1.sendIdx["size"]=1;
  22693. //>>excludeEnd("ctx");
  22694. $7=_st($8).__plus($10);
  22695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22696. $ctx1.sendIdx["+"]=1;
  22697. //>>excludeEnd("ctx");
  22698. $11=_st(self._collection())._size();
  22699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22700. $ctx1.sendIdx["size"]=2;
  22701. //>>excludeEnd("ctx");
  22702. post=_st($6)._copyFrom_to_($7,$11);
  22703. post;
  22704. $12=_st(_st(pre).__comma(aString)).__comma(post);
  22705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22706. $ctx1.sendIdx[","]=2;
  22707. //>>excludeEnd("ctx");
  22708. self._setCollection_($12);
  22709. };
  22710. $14=self._position();
  22711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22712. $ctx1.sendIdx["position"]=3;
  22713. //>>excludeEnd("ctx");
  22714. $13=_st($14).__plus(_st(aString)._size());
  22715. self._position_($13);
  22716. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  22717. return self;
  22718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22719. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},globals.StringStream)});
  22720. //>>excludeEnd("ctx");
  22721. },
  22722. //>>excludeStart("ide", pragmas.excludeIdeData);
  22723. args: ["aString"],
  22724. 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)",
  22725. referencedClasses: [],
  22726. //>>excludeEnd("ide");
  22727. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  22728. }),
  22729. globals.StringStream);
  22730. smalltalk.addMethod(
  22731. smalltalk.method({
  22732. selector: "nextPutString:",
  22733. protocol: 'writing',
  22734. fn: function (aString){
  22735. var self=this;
  22736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22737. return smalltalk.withContext(function($ctx1) {
  22738. //>>excludeEnd("ctx");
  22739. self._nextPutAll_(aString);
  22740. return self;
  22741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22742. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.StringStream)});
  22743. //>>excludeEnd("ctx");
  22744. },
  22745. //>>excludeStart("ide", pragmas.excludeIdeData);
  22746. args: ["aString"],
  22747. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  22748. referencedClasses: [],
  22749. //>>excludeEnd("ide");
  22750. messageSends: ["nextPutAll:"]
  22751. }),
  22752. globals.StringStream);
  22753. smalltalk.addMethod(
  22754. smalltalk.method({
  22755. selector: "space",
  22756. protocol: 'writing',
  22757. fn: function (){
  22758. var self=this;
  22759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22760. return smalltalk.withContext(function($ctx1) {
  22761. //>>excludeEnd("ctx");
  22762. self._nextPut_(" ");
  22763. return self;
  22764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22765. }, function($ctx1) {$ctx1.fill(self,"space",{},globals.StringStream)});
  22766. //>>excludeEnd("ctx");
  22767. },
  22768. //>>excludeStart("ide", pragmas.excludeIdeData);
  22769. args: [],
  22770. source: "space\x0a\x09self nextPut: ' '",
  22771. referencedClasses: [],
  22772. //>>excludeEnd("ide");
  22773. messageSends: ["nextPut:"]
  22774. }),
  22775. globals.StringStream);
  22776. smalltalk.addMethod(
  22777. smalltalk.method({
  22778. selector: "tab",
  22779. protocol: 'writing',
  22780. fn: function (){
  22781. var self=this;
  22782. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  22783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22784. return smalltalk.withContext(function($ctx1) {
  22785. //>>excludeEnd("ctx");
  22786. var $1;
  22787. $1=self._nextPutAll_(_st($String())._tab());
  22788. return $1;
  22789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22790. }, function($ctx1) {$ctx1.fill(self,"tab",{},globals.StringStream)});
  22791. //>>excludeEnd("ctx");
  22792. },
  22793. //>>excludeStart("ide", pragmas.excludeIdeData);
  22794. args: [],
  22795. source: "tab\x0a\x09^ self nextPutAll: String tab",
  22796. referencedClasses: ["String"],
  22797. //>>excludeEnd("ide");
  22798. messageSends: ["nextPutAll:", "tab"]
  22799. }),
  22800. globals.StringStream);
  22801. });
  22802. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){
  22803. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  22804. smalltalk.addPackage('Kernel-Infrastructure');
  22805. smalltalk.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  22806. smalltalk.addClass('ConsoleErrorHandler', globals.Object, [], 'Kernel-Infrastructure');
  22807. //>>excludeStart("ide", pragmas.excludeIdeData);
  22808. globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  22809. //>>excludeEnd("ide");
  22810. smalltalk.addMethod(
  22811. smalltalk.method({
  22812. selector: "handleError:",
  22813. protocol: 'error handling',
  22814. fn: function (anError){
  22815. var self=this;
  22816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22817. return smalltalk.withContext(function($ctx1) {
  22818. //>>excludeEnd("ctx");
  22819. var $1,$receiver;
  22820. $1=_st(anError)._context();
  22821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22822. $ctx1.sendIdx["context"]=1;
  22823. //>>excludeEnd("ctx");
  22824. if(($receiver = $1) == null || $receiver.isNil){
  22825. $1;
  22826. } else {
  22827. self._logErrorContext_(_st(anError)._context());
  22828. };
  22829. self._logError_(anError);
  22830. return self;
  22831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22832. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ConsoleErrorHandler)});
  22833. //>>excludeEnd("ctx");
  22834. },
  22835. //>>excludeStart("ide", pragmas.excludeIdeData);
  22836. args: ["anError"],
  22837. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  22838. referencedClasses: [],
  22839. //>>excludeEnd("ide");
  22840. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  22841. }),
  22842. globals.ConsoleErrorHandler);
  22843. smalltalk.addMethod(
  22844. smalltalk.method({
  22845. selector: "log:",
  22846. protocol: 'private',
  22847. fn: function (aString){
  22848. var self=this;
  22849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22850. return smalltalk.withContext(function($ctx1) {
  22851. //>>excludeEnd("ctx");
  22852. _st(console)._log_(aString);
  22853. return self;
  22854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22855. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},globals.ConsoleErrorHandler)});
  22856. //>>excludeEnd("ctx");
  22857. },
  22858. //>>excludeStart("ide", pragmas.excludeIdeData);
  22859. args: ["aString"],
  22860. source: "log: aString\x0a\x09console log: aString",
  22861. referencedClasses: [],
  22862. //>>excludeEnd("ide");
  22863. messageSends: ["log:"]
  22864. }),
  22865. globals.ConsoleErrorHandler);
  22866. smalltalk.addMethod(
  22867. smalltalk.method({
  22868. selector: "logContext:",
  22869. protocol: 'private',
  22870. fn: function (aContext){
  22871. var self=this;
  22872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22873. return smalltalk.withContext(function($ctx1) {
  22874. //>>excludeEnd("ctx");
  22875. var $1,$receiver;
  22876. $1=_st(aContext)._home();
  22877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22878. $ctx1.sendIdx["home"]=1;
  22879. //>>excludeEnd("ctx");
  22880. if(($receiver = $1) == null || $receiver.isNil){
  22881. $1;
  22882. } else {
  22883. self._logContext_(_st(aContext)._home());
  22884. };
  22885. self._log_(_st(aContext)._asString());
  22886. return self;
  22887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22888. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},globals.ConsoleErrorHandler)});
  22889. //>>excludeEnd("ctx");
  22890. },
  22891. //>>excludeStart("ide", pragmas.excludeIdeData);
  22892. args: ["aContext"],
  22893. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  22894. referencedClasses: [],
  22895. //>>excludeEnd("ide");
  22896. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  22897. }),
  22898. globals.ConsoleErrorHandler);
  22899. smalltalk.addMethod(
  22900. smalltalk.method({
  22901. selector: "logError:",
  22902. protocol: 'private',
  22903. fn: function (anError){
  22904. var self=this;
  22905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22906. return smalltalk.withContext(function($ctx1) {
  22907. //>>excludeEnd("ctx");
  22908. self._log_(_st(anError)._messageText());
  22909. return self;
  22910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22911. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},globals.ConsoleErrorHandler)});
  22912. //>>excludeEnd("ctx");
  22913. },
  22914. //>>excludeStart("ide", pragmas.excludeIdeData);
  22915. args: ["anError"],
  22916. source: "logError: anError\x0a\x09self log: anError messageText",
  22917. referencedClasses: [],
  22918. //>>excludeEnd("ide");
  22919. messageSends: ["log:", "messageText"]
  22920. }),
  22921. globals.ConsoleErrorHandler);
  22922. smalltalk.addMethod(
  22923. smalltalk.method({
  22924. selector: "logErrorContext:",
  22925. protocol: 'private',
  22926. fn: function (aContext){
  22927. var self=this;
  22928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22929. return smalltalk.withContext(function($ctx1) {
  22930. //>>excludeEnd("ctx");
  22931. var $1,$receiver;
  22932. if(($receiver = aContext) == null || $receiver.isNil){
  22933. aContext;
  22934. } else {
  22935. $1=_st(aContext)._home();
  22936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22937. $ctx1.sendIdx["home"]=1;
  22938. //>>excludeEnd("ctx");
  22939. if(($receiver = $1) == null || $receiver.isNil){
  22940. $1;
  22941. } else {
  22942. self._logContext_(_st(aContext)._home());
  22943. };
  22944. };
  22945. return self;
  22946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22947. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},globals.ConsoleErrorHandler)});
  22948. //>>excludeEnd("ctx");
  22949. },
  22950. //>>excludeStart("ide", pragmas.excludeIdeData);
  22951. args: ["aContext"],
  22952. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  22953. referencedClasses: [],
  22954. //>>excludeEnd("ide");
  22955. messageSends: ["ifNotNil:", "home", "logContext:"]
  22956. }),
  22957. globals.ConsoleErrorHandler);
  22958. globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  22959. smalltalk.addMethod(
  22960. smalltalk.method({
  22961. selector: "initialize",
  22962. protocol: 'initialization',
  22963. fn: function (){
  22964. var self=this;
  22965. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  22966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22967. return smalltalk.withContext(function($ctx1) {
  22968. //>>excludeEnd("ctx");
  22969. _st($ErrorHandler())._registerIfNone_(self._new());
  22970. return self;
  22971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22972. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleErrorHandler.klass)});
  22973. //>>excludeEnd("ctx");
  22974. },
  22975. //>>excludeStart("ide", pragmas.excludeIdeData);
  22976. args: [],
  22977. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  22978. referencedClasses: ["ErrorHandler"],
  22979. //>>excludeEnd("ide");
  22980. messageSends: ["registerIfNone:", "new"]
  22981. }),
  22982. globals.ConsoleErrorHandler.klass);
  22983. smalltalk.addClass('InterfacingObject', globals.Object, [], 'Kernel-Infrastructure');
  22984. //>>excludeStart("ide", pragmas.excludeIdeData);
  22985. globals.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  22986. //>>excludeEnd("ide");
  22987. smalltalk.addMethod(
  22988. smalltalk.method({
  22989. selector: "ajax:",
  22990. protocol: 'actions',
  22991. fn: function (anObject){
  22992. var self=this;
  22993. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  22994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22995. return smalltalk.withContext(function($ctx1) {
  22996. //>>excludeEnd("ctx");
  22997. var $1;
  22998. $1=_st($PlatformInterface())._ajax_(anObject);
  22999. return $1;
  23000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23001. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.InterfacingObject)});
  23002. //>>excludeEnd("ctx");
  23003. },
  23004. //>>excludeStart("ide", pragmas.excludeIdeData);
  23005. args: ["anObject"],
  23006. source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject",
  23007. referencedClasses: ["PlatformInterface"],
  23008. //>>excludeEnd("ide");
  23009. messageSends: ["ajax:"]
  23010. }),
  23011. globals.InterfacingObject);
  23012. smalltalk.addMethod(
  23013. smalltalk.method({
  23014. selector: "alert:",
  23015. protocol: 'actions',
  23016. fn: function (aString){
  23017. var self=this;
  23018. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  23019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23020. return smalltalk.withContext(function($ctx1) {
  23021. //>>excludeEnd("ctx");
  23022. var $1;
  23023. $1=_st($PlatformInterface())._alert_(aString);
  23024. return $1;
  23025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23026. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.InterfacingObject)});
  23027. //>>excludeEnd("ctx");
  23028. },
  23029. //>>excludeStart("ide", pragmas.excludeIdeData);
  23030. args: ["aString"],
  23031. source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
  23032. referencedClasses: ["PlatformInterface"],
  23033. //>>excludeEnd("ide");
  23034. messageSends: ["alert:"]
  23035. }),
  23036. globals.InterfacingObject);
  23037. smalltalk.addMethod(
  23038. smalltalk.method({
  23039. selector: "confirm:",
  23040. protocol: 'actions',
  23041. fn: function (aString){
  23042. var self=this;
  23043. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  23044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23045. return smalltalk.withContext(function($ctx1) {
  23046. //>>excludeEnd("ctx");
  23047. var $1;
  23048. $1=_st($PlatformInterface())._confirm_(aString);
  23049. return $1;
  23050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23051. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.InterfacingObject)});
  23052. //>>excludeEnd("ctx");
  23053. },
  23054. //>>excludeStart("ide", pragmas.excludeIdeData);
  23055. args: ["aString"],
  23056. source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
  23057. referencedClasses: ["PlatformInterface"],
  23058. //>>excludeEnd("ide");
  23059. messageSends: ["confirm:"]
  23060. }),
  23061. globals.InterfacingObject);
  23062. smalltalk.addMethod(
  23063. smalltalk.method({
  23064. selector: "prompt:",
  23065. protocol: 'actions',
  23066. fn: function (aString){
  23067. var self=this;
  23068. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  23069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23070. return smalltalk.withContext(function($ctx1) {
  23071. //>>excludeEnd("ctx");
  23072. var $1;
  23073. $1=_st($PlatformInterface())._prompt_(aString);
  23074. return $1;
  23075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23076. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.InterfacingObject)});
  23077. //>>excludeEnd("ctx");
  23078. },
  23079. //>>excludeStart("ide", pragmas.excludeIdeData);
  23080. args: ["aString"],
  23081. source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
  23082. referencedClasses: ["PlatformInterface"],
  23083. //>>excludeEnd("ide");
  23084. messageSends: ["prompt:"]
  23085. }),
  23086. globals.InterfacingObject);
  23087. smalltalk.addMethod(
  23088. smalltalk.method({
  23089. selector: "prompt:default:",
  23090. protocol: 'actions',
  23091. fn: function (aString,defaultString){
  23092. var self=this;
  23093. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  23094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23095. return smalltalk.withContext(function($ctx1) {
  23096. //>>excludeEnd("ctx");
  23097. var $1;
  23098. $1=_st($PlatformInterface())._prompt_default_(aString,defaultString);
  23099. return $1;
  23100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23101. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},globals.InterfacingObject)});
  23102. //>>excludeEnd("ctx");
  23103. },
  23104. //>>excludeStart("ide", pragmas.excludeIdeData);
  23105. args: ["aString", "defaultString"],
  23106. source: "prompt: aString default: defaultString\x0a\x09^ PlatformInterface prompt: aString default: defaultString",
  23107. referencedClasses: ["PlatformInterface"],
  23108. //>>excludeEnd("ide");
  23109. messageSends: ["prompt:default:"]
  23110. }),
  23111. globals.InterfacingObject);
  23112. smalltalk.addClass('Environment', globals.InterfacingObject, [], 'Kernel-Infrastructure');
  23113. //>>excludeStart("ide", pragmas.excludeIdeData);
  23114. globals.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
  23115. //>>excludeEnd("ide");
  23116. smalltalk.addMethod(
  23117. smalltalk.method({
  23118. selector: "addInstVarNamed:to:",
  23119. protocol: 'compiling',
  23120. fn: function (aString,aClass){
  23121. var self=this;
  23122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23123. return smalltalk.withContext(function($ctx1) {
  23124. //>>excludeEnd("ctx");
  23125. var $1,$2,$3,$4,$5;
  23126. $1=self._classBuilder();
  23127. $2=_st(aClass)._superclass();
  23128. $3=_st(aClass)._name();
  23129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23130. $ctx1.sendIdx["name"]=1;
  23131. //>>excludeEnd("ctx");
  23132. $4=_st(_st(aClass)._instanceVariableNames())._copy();
  23133. _st($4)._add_(aString);
  23134. $5=_st($4)._yourself();
  23135. _st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,_st(_st(aClass)._package())._name());
  23136. return self;
  23137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23138. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},globals.Environment)});
  23139. //>>excludeEnd("ctx");
  23140. },
  23141. //>>excludeStart("ide", pragmas.excludeIdeData);
  23142. args: ["aString", "aClass"],
  23143. 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",
  23144. referencedClasses: [],
  23145. //>>excludeEnd("ide");
  23146. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  23147. }),
  23148. globals.Environment);
  23149. smalltalk.addMethod(
  23150. smalltalk.method({
  23151. selector: "allSelectors",
  23152. protocol: 'accessing',
  23153. fn: function (){
  23154. var self=this;
  23155. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23157. return smalltalk.withContext(function($ctx1) {
  23158. //>>excludeEnd("ctx");
  23159. var $1;
  23160. $1=_st(_st($Smalltalk())._vm())._allSelectors();
  23161. return $1;
  23162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23163. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Environment)});
  23164. //>>excludeEnd("ctx");
  23165. },
  23166. //>>excludeStart("ide", pragmas.excludeIdeData);
  23167. args: [],
  23168. source: "allSelectors\x0a\x09^ Smalltalk vm allSelectors",
  23169. referencedClasses: ["Smalltalk"],
  23170. //>>excludeEnd("ide");
  23171. messageSends: ["allSelectors", "vm"]
  23172. }),
  23173. globals.Environment);
  23174. smalltalk.addMethod(
  23175. smalltalk.method({
  23176. selector: "availableClassNames",
  23177. protocol: 'accessing',
  23178. fn: function (){
  23179. var self=this;
  23180. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23182. return smalltalk.withContext(function($ctx1) {
  23183. //>>excludeEnd("ctx");
  23184. var $1;
  23185. $1=_st(_st($Smalltalk())._classes())._collect_((function(each){
  23186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23187. return smalltalk.withContext(function($ctx2) {
  23188. //>>excludeEnd("ctx");
  23189. return _st(each)._name();
  23190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23192. //>>excludeEnd("ctx");
  23193. }));
  23194. return $1;
  23195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23196. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},globals.Environment)});
  23197. //>>excludeEnd("ctx");
  23198. },
  23199. //>>excludeStart("ide", pragmas.excludeIdeData);
  23200. args: [],
  23201. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  23202. referencedClasses: ["Smalltalk"],
  23203. //>>excludeEnd("ide");
  23204. messageSends: ["collect:", "classes", "name"]
  23205. }),
  23206. globals.Environment);
  23207. smalltalk.addMethod(
  23208. smalltalk.method({
  23209. selector: "availablePackageNames",
  23210. protocol: 'accessing',
  23211. fn: function (){
  23212. var self=this;
  23213. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23215. return smalltalk.withContext(function($ctx1) {
  23216. //>>excludeEnd("ctx");
  23217. var $1;
  23218. $1=_st(_st($Smalltalk())._packages())._collect_((function(each){
  23219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23220. return smalltalk.withContext(function($ctx2) {
  23221. //>>excludeEnd("ctx");
  23222. return _st(each)._name();
  23223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23225. //>>excludeEnd("ctx");
  23226. }));
  23227. return $1;
  23228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23229. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},globals.Environment)});
  23230. //>>excludeEnd("ctx");
  23231. },
  23232. //>>excludeStart("ide", pragmas.excludeIdeData);
  23233. args: [],
  23234. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  23235. referencedClasses: ["Smalltalk"],
  23236. //>>excludeEnd("ide");
  23237. messageSends: ["collect:", "packages", "name"]
  23238. }),
  23239. globals.Environment);
  23240. smalltalk.addMethod(
  23241. smalltalk.method({
  23242. selector: "availableProtocolsFor:",
  23243. protocol: 'accessing',
  23244. fn: function (aClass){
  23245. var self=this;
  23246. var protocols;
  23247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23248. return smalltalk.withContext(function($ctx1) {
  23249. //>>excludeEnd("ctx");
  23250. var $1,$2,$receiver;
  23251. protocols=_st(aClass)._protocols();
  23252. $1=_st(aClass)._superclass();
  23253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23254. $ctx1.sendIdx["superclass"]=1;
  23255. //>>excludeEnd("ctx");
  23256. if(($receiver = $1) == null || $receiver.isNil){
  23257. $1;
  23258. } else {
  23259. _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
  23260. };
  23261. $2=_st(_st(_st(protocols)._asSet())._asArray())._sort();
  23262. return $2;
  23263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23264. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},globals.Environment)});
  23265. //>>excludeEnd("ctx");
  23266. },
  23267. //>>excludeStart("ide", pragmas.excludeIdeData);
  23268. args: ["aClass"],
  23269. 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 sort",
  23270. referencedClasses: [],
  23271. //>>excludeEnd("ide");
  23272. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  23273. }),
  23274. globals.Environment);
  23275. smalltalk.addMethod(
  23276. smalltalk.method({
  23277. selector: "classBuilder",
  23278. protocol: 'accessing',
  23279. fn: function (){
  23280. var self=this;
  23281. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  23282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23283. return smalltalk.withContext(function($ctx1) {
  23284. //>>excludeEnd("ctx");
  23285. var $1;
  23286. $1=_st($ClassBuilder())._new();
  23287. return $1;
  23288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23289. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},globals.Environment)});
  23290. //>>excludeEnd("ctx");
  23291. },
  23292. //>>excludeStart("ide", pragmas.excludeIdeData);
  23293. args: [],
  23294. source: "classBuilder\x0a\x09^ ClassBuilder new",
  23295. referencedClasses: ["ClassBuilder"],
  23296. //>>excludeEnd("ide");
  23297. messageSends: ["new"]
  23298. }),
  23299. globals.Environment);
  23300. smalltalk.addMethod(
  23301. smalltalk.method({
  23302. selector: "classNamed:",
  23303. protocol: 'accessing',
  23304. fn: function (aString){
  23305. var self=this;
  23306. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23308. return smalltalk.withContext(function($ctx1) {
  23309. //>>excludeEnd("ctx");
  23310. var $2,$1,$receiver;
  23311. $2=_st(_st($Smalltalk())._globals())._at_(_st(aString)._asSymbol());
  23312. if(($receiver = $2) == null || $receiver.isNil){
  23313. $1=self._error_("Invalid class name");
  23314. } else {
  23315. $1=$2;
  23316. };
  23317. return $1;
  23318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23319. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},globals.Environment)});
  23320. //>>excludeEnd("ctx");
  23321. },
  23322. //>>excludeStart("ide", pragmas.excludeIdeData);
  23323. args: ["aString"],
  23324. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  23325. referencedClasses: ["Smalltalk"],
  23326. //>>excludeEnd("ide");
  23327. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  23328. }),
  23329. globals.Environment);
  23330. smalltalk.addMethod(
  23331. smalltalk.method({
  23332. selector: "classes",
  23333. protocol: 'accessing',
  23334. fn: function (){
  23335. var self=this;
  23336. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23338. return smalltalk.withContext(function($ctx1) {
  23339. //>>excludeEnd("ctx");
  23340. var $1;
  23341. $1=_st($Smalltalk())._classes();
  23342. return $1;
  23343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23344. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Environment)});
  23345. //>>excludeEnd("ctx");
  23346. },
  23347. //>>excludeStart("ide", pragmas.excludeIdeData);
  23348. args: [],
  23349. source: "classes\x0a\x09^ Smalltalk classes",
  23350. referencedClasses: ["Smalltalk"],
  23351. //>>excludeEnd("ide");
  23352. messageSends: ["classes"]
  23353. }),
  23354. globals.Environment);
  23355. smalltalk.addMethod(
  23356. smalltalk.method({
  23357. selector: "commitPackage:onSuccess:onError:",
  23358. protocol: 'actions',
  23359. fn: function (aPackage,aBlock,anotherBlock){
  23360. var self=this;
  23361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23362. return smalltalk.withContext(function($ctx1) {
  23363. //>>excludeEnd("ctx");
  23364. _st(_st(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  23365. return self;
  23366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23367. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.Environment)});
  23368. //>>excludeEnd("ctx");
  23369. },
  23370. //>>excludeStart("ide", pragmas.excludeIdeData);
  23371. args: ["aPackage", "aBlock", "anotherBlock"],
  23372. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  23373. referencedClasses: [],
  23374. //>>excludeEnd("ide");
  23375. messageSends: ["commitOnSuccess:onError:", "transport"]
  23376. }),
  23377. globals.Environment);
  23378. smalltalk.addMethod(
  23379. smalltalk.method({
  23380. selector: "compileClassComment:for:",
  23381. protocol: 'compiling',
  23382. fn: function (aString,aClass){
  23383. var self=this;
  23384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23385. return smalltalk.withContext(function($ctx1) {
  23386. //>>excludeEnd("ctx");
  23387. _st(aClass)._comment_(aString);
  23388. return self;
  23389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23390. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},globals.Environment)});
  23391. //>>excludeEnd("ctx");
  23392. },
  23393. //>>excludeStart("ide", pragmas.excludeIdeData);
  23394. args: ["aString", "aClass"],
  23395. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  23396. referencedClasses: [],
  23397. //>>excludeEnd("ide");
  23398. messageSends: ["comment:"]
  23399. }),
  23400. globals.Environment);
  23401. smalltalk.addMethod(
  23402. smalltalk.method({
  23403. selector: "compileClassDefinition:",
  23404. protocol: 'compiling',
  23405. fn: function (aString){
  23406. var self=this;
  23407. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  23408. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  23409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23410. return smalltalk.withContext(function($ctx1) {
  23411. //>>excludeEnd("ctx");
  23412. _st((function(){
  23413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23414. return smalltalk.withContext(function($ctx2) {
  23415. //>>excludeEnd("ctx");
  23416. return self._evaluate_for_(aString,_st($DoIt())._new());
  23417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23419. //>>excludeEnd("ctx");
  23420. }))._on_do_($Error(),(function(error){
  23421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23422. return smalltalk.withContext(function($ctx2) {
  23423. //>>excludeEnd("ctx");
  23424. return self._alert_(_st(error)._messageText());
  23425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23426. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  23427. //>>excludeEnd("ctx");
  23428. }));
  23429. return self;
  23430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23431. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},globals.Environment)});
  23432. //>>excludeEnd("ctx");
  23433. },
  23434. //>>excludeStart("ide", pragmas.excludeIdeData);
  23435. args: ["aString"],
  23436. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  23437. referencedClasses: ["DoIt", "Error"],
  23438. //>>excludeEnd("ide");
  23439. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  23440. }),
  23441. globals.Environment);
  23442. smalltalk.addMethod(
  23443. smalltalk.method({
  23444. selector: "compileMethod:for:protocol:",
  23445. protocol: 'compiling',
  23446. fn: function (sourceCode,class_,protocol){
  23447. var self=this;
  23448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23449. return smalltalk.withContext(function($ctx1) {
  23450. //>>excludeEnd("ctx");
  23451. var $1;
  23452. $1=_st(class_)._compile_protocol_(sourceCode,protocol);
  23453. return $1;
  23454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23455. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},globals.Environment)});
  23456. //>>excludeEnd("ctx");
  23457. },
  23458. //>>excludeStart("ide", pragmas.excludeIdeData);
  23459. args: ["sourceCode", "class", "protocol"],
  23460. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  23461. referencedClasses: [],
  23462. //>>excludeEnd("ide");
  23463. messageSends: ["compile:protocol:"]
  23464. }),
  23465. globals.Environment);
  23466. smalltalk.addMethod(
  23467. smalltalk.method({
  23468. selector: "copyClass:to:",
  23469. protocol: 'actions',
  23470. fn: function (aClass,aClassName){
  23471. var self=this;
  23472. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23473. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  23474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23475. return smalltalk.withContext(function($ctx1) {
  23476. //>>excludeEnd("ctx");
  23477. var $1,$2,$receiver;
  23478. $1=_st(_st($Smalltalk())._globals())._at_(aClassName);
  23479. if(($receiver = $1) == null || $receiver.isNil){
  23480. $1;
  23481. } else {
  23482. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  23483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23484. $ctx1.sendIdx[","]=1;
  23485. //>>excludeEnd("ctx");
  23486. self._error_($2);
  23487. };
  23488. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  23489. return self;
  23490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23491. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)});
  23492. //>>excludeEnd("ctx");
  23493. },
  23494. //>>excludeStart("ide", pragmas.excludeIdeData);
  23495. args: ["aClass", "aClassName"],
  23496. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
  23497. referencedClasses: ["Smalltalk", "ClassBuilder"],
  23498. //>>excludeEnd("ide");
  23499. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  23500. }),
  23501. globals.Environment);
  23502. smalltalk.addMethod(
  23503. smalltalk.method({
  23504. selector: "doItReceiver",
  23505. protocol: 'accessing',
  23506. fn: function (){
  23507. var self=this;
  23508. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  23509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23510. return smalltalk.withContext(function($ctx1) {
  23511. //>>excludeEnd("ctx");
  23512. var $1;
  23513. $1=_st($DoIt())._new();
  23514. return $1;
  23515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23516. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},globals.Environment)});
  23517. //>>excludeEnd("ctx");
  23518. },
  23519. //>>excludeStart("ide", pragmas.excludeIdeData);
  23520. args: [],
  23521. source: "doItReceiver\x0a\x09^ DoIt new",
  23522. referencedClasses: ["DoIt"],
  23523. //>>excludeEnd("ide");
  23524. messageSends: ["new"]
  23525. }),
  23526. globals.Environment);
  23527. smalltalk.addMethod(
  23528. smalltalk.method({
  23529. selector: "evaluate:for:",
  23530. protocol: 'evaluating',
  23531. fn: function (aString,anObject){
  23532. var self=this;
  23533. function $Evaluator(){return globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  23534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23535. return smalltalk.withContext(function($ctx1) {
  23536. //>>excludeEnd("ctx");
  23537. var $1;
  23538. $1=_st($Evaluator())._evaluate_for_(aString,anObject);
  23539. return $1;
  23540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23541. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Environment)});
  23542. //>>excludeEnd("ctx");
  23543. },
  23544. //>>excludeStart("ide", pragmas.excludeIdeData);
  23545. args: ["aString", "anObject"],
  23546. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  23547. referencedClasses: ["Evaluator"],
  23548. //>>excludeEnd("ide");
  23549. messageSends: ["evaluate:for:"]
  23550. }),
  23551. globals.Environment);
  23552. smalltalk.addMethod(
  23553. smalltalk.method({
  23554. selector: "evaluate:on:do:",
  23555. protocol: 'error handling',
  23556. fn: function (aBlock,anErrorClass,exceptionBlock){
  23557. var self=this;
  23558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23559. return smalltalk.withContext(function($ctx1) {
  23560. //>>excludeEnd("ctx");
  23561. var $1;
  23562. _st(aBlock)._tryCatch_((function(exception){
  23563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23564. return smalltalk.withContext(function($ctx2) {
  23565. //>>excludeEnd("ctx");
  23566. $1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
  23567. if(smalltalk.assert($1)){
  23568. return _st(exceptionBlock)._value_(exception);
  23569. } else {
  23570. return _st(exception)._signal();
  23571. };
  23572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23573. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  23574. //>>excludeEnd("ctx");
  23575. }));
  23576. return self;
  23577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23578. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},globals.Environment)});
  23579. //>>excludeEnd("ctx");
  23580. },
  23581. //>>excludeStart("ide", pragmas.excludeIdeData);
  23582. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  23583. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
  23584. referencedClasses: [],
  23585. //>>excludeEnd("ide");
  23586. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "signal"]
  23587. }),
  23588. globals.Environment);
  23589. smalltalk.addMethod(
  23590. smalltalk.method({
  23591. selector: "inspect:",
  23592. protocol: 'actions',
  23593. fn: function (anObject){
  23594. var self=this;
  23595. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  23596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23597. return smalltalk.withContext(function($ctx1) {
  23598. //>>excludeEnd("ctx");
  23599. _st($Inspector())._inspect_(anObject);
  23600. return self;
  23601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23602. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Environment)});
  23603. //>>excludeEnd("ctx");
  23604. },
  23605. //>>excludeStart("ide", pragmas.excludeIdeData);
  23606. args: ["anObject"],
  23607. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  23608. referencedClasses: ["Inspector"],
  23609. //>>excludeEnd("ide");
  23610. messageSends: ["inspect:"]
  23611. }),
  23612. globals.Environment);
  23613. smalltalk.addMethod(
  23614. smalltalk.method({
  23615. selector: "moveClass:toPackage:",
  23616. protocol: 'actions',
  23617. fn: function (aClass,aPackageName){
  23618. var self=this;
  23619. var package_;
  23620. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  23621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23622. return smalltalk.withContext(function($ctx1) {
  23623. //>>excludeEnd("ctx");
  23624. var $1,$2,$receiver;
  23625. package_=_st($Package())._named_(aPackageName);
  23626. $1=package_;
  23627. if(($receiver = $1) == null || $receiver.isNil){
  23628. self._error_("Invalid package name");
  23629. } else {
  23630. $1;
  23631. };
  23632. $2=_st(package_).__eq_eq(_st(aClass)._package());
  23633. if(smalltalk.assert($2)){
  23634. return self;
  23635. };
  23636. _st(aClass)._package_(package_);
  23637. return self;
  23638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23639. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},globals.Environment)});
  23640. //>>excludeEnd("ctx");
  23641. },
  23642. //>>excludeStart("ide", pragmas.excludeIdeData);
  23643. args: ["aClass", "aPackageName"],
  23644. 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",
  23645. referencedClasses: ["Package"],
  23646. //>>excludeEnd("ide");
  23647. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  23648. }),
  23649. globals.Environment);
  23650. smalltalk.addMethod(
  23651. smalltalk.method({
  23652. selector: "moveMethod:toClass:",
  23653. protocol: 'actions',
  23654. fn: function (aMethod,aClassName){
  23655. var self=this;
  23656. var destinationClass;
  23657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23658. return smalltalk.withContext(function($ctx1) {
  23659. //>>excludeEnd("ctx");
  23660. var $2,$3,$1,$5,$4;
  23661. destinationClass=self._classNamed_(aClassName);
  23662. $2=destinationClass;
  23663. $3=_st(aMethod)._methodClass();
  23664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23665. $ctx1.sendIdx["methodClass"]=1;
  23666. //>>excludeEnd("ctx");
  23667. $1=_st($2).__eq_eq($3);
  23668. if(smalltalk.assert($1)){
  23669. return self;
  23670. };
  23671. $5=_st(aMethod)._methodClass();
  23672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23673. $ctx1.sendIdx["methodClass"]=2;
  23674. //>>excludeEnd("ctx");
  23675. $4=_st($5)._isMetaclass();
  23676. if(smalltalk.assert($4)){
  23677. destinationClass=_st(destinationClass)._class();
  23678. destinationClass;
  23679. };
  23680. _st(destinationClass)._compile_protocol_(_st(aMethod)._source(),_st(aMethod)._protocol());
  23681. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  23682. return self;
  23683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23684. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},globals.Environment)});
  23685. //>>excludeEnd("ctx");
  23686. },
  23687. //>>excludeStart("ide", pragmas.excludeIdeData);
  23688. args: ["aMethod", "aClassName"],
  23689. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass class ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  23690. referencedClasses: [],
  23691. //>>excludeEnd("ide");
  23692. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  23693. }),
  23694. globals.Environment);
  23695. smalltalk.addMethod(
  23696. smalltalk.method({
  23697. selector: "moveMethod:toProtocol:",
  23698. protocol: 'actions',
  23699. fn: function (aMethod,aProtocol){
  23700. var self=this;
  23701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23702. return smalltalk.withContext(function($ctx1) {
  23703. //>>excludeEnd("ctx");
  23704. _st(aMethod)._protocol_(aProtocol);
  23705. return self;
  23706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23707. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},globals.Environment)});
  23708. //>>excludeEnd("ctx");
  23709. },
  23710. //>>excludeStart("ide", pragmas.excludeIdeData);
  23711. args: ["aMethod", "aProtocol"],
  23712. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  23713. referencedClasses: [],
  23714. //>>excludeEnd("ide");
  23715. messageSends: ["protocol:"]
  23716. }),
  23717. globals.Environment);
  23718. smalltalk.addMethod(
  23719. smalltalk.method({
  23720. selector: "packages",
  23721. protocol: 'accessing',
  23722. fn: function (){
  23723. var self=this;
  23724. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23726. return smalltalk.withContext(function($ctx1) {
  23727. //>>excludeEnd("ctx");
  23728. var $1;
  23729. $1=_st($Smalltalk())._packages();
  23730. return $1;
  23731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23732. }, function($ctx1) {$ctx1.fill(self,"packages",{},globals.Environment)});
  23733. //>>excludeEnd("ctx");
  23734. },
  23735. //>>excludeStart("ide", pragmas.excludeIdeData);
  23736. args: [],
  23737. source: "packages\x0a\x09^ Smalltalk packages",
  23738. referencedClasses: ["Smalltalk"],
  23739. //>>excludeEnd("ide");
  23740. messageSends: ["packages"]
  23741. }),
  23742. globals.Environment);
  23743. smalltalk.addMethod(
  23744. smalltalk.method({
  23745. selector: "registerErrorHandler:",
  23746. protocol: 'services',
  23747. fn: function (anErrorHandler){
  23748. var self=this;
  23749. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  23750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23751. return smalltalk.withContext(function($ctx1) {
  23752. //>>excludeEnd("ctx");
  23753. _st($ErrorHandler())._register_(anErrorHandler);
  23754. return self;
  23755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23756. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},globals.Environment)});
  23757. //>>excludeEnd("ctx");
  23758. },
  23759. //>>excludeStart("ide", pragmas.excludeIdeData);
  23760. args: ["anErrorHandler"],
  23761. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  23762. referencedClasses: ["ErrorHandler"],
  23763. //>>excludeEnd("ide");
  23764. messageSends: ["register:"]
  23765. }),
  23766. globals.Environment);
  23767. smalltalk.addMethod(
  23768. smalltalk.method({
  23769. selector: "registerFinder:",
  23770. protocol: 'services',
  23771. fn: function (aFinder){
  23772. var self=this;
  23773. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  23774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23775. return smalltalk.withContext(function($ctx1) {
  23776. //>>excludeEnd("ctx");
  23777. _st($Finder())._register_(aFinder);
  23778. return self;
  23779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23780. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},globals.Environment)});
  23781. //>>excludeEnd("ctx");
  23782. },
  23783. //>>excludeStart("ide", pragmas.excludeIdeData);
  23784. args: ["aFinder"],
  23785. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  23786. referencedClasses: ["Finder"],
  23787. //>>excludeEnd("ide");
  23788. messageSends: ["register:"]
  23789. }),
  23790. globals.Environment);
  23791. smalltalk.addMethod(
  23792. smalltalk.method({
  23793. selector: "registerInspector:",
  23794. protocol: 'services',
  23795. fn: function (anInspector){
  23796. var self=this;
  23797. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  23798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23799. return smalltalk.withContext(function($ctx1) {
  23800. //>>excludeEnd("ctx");
  23801. _st($Inspector())._register_(anInspector);
  23802. return self;
  23803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23804. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},globals.Environment)});
  23805. //>>excludeEnd("ctx");
  23806. },
  23807. //>>excludeStart("ide", pragmas.excludeIdeData);
  23808. args: ["anInspector"],
  23809. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  23810. referencedClasses: ["Inspector"],
  23811. //>>excludeEnd("ide");
  23812. messageSends: ["register:"]
  23813. }),
  23814. globals.Environment);
  23815. smalltalk.addMethod(
  23816. smalltalk.method({
  23817. selector: "registerProgressHandler:",
  23818. protocol: 'services',
  23819. fn: function (aProgressHandler){
  23820. var self=this;
  23821. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  23822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23823. return smalltalk.withContext(function($ctx1) {
  23824. //>>excludeEnd("ctx");
  23825. _st($ProgressHandler())._register_(aProgressHandler);
  23826. return self;
  23827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23828. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},globals.Environment)});
  23829. //>>excludeEnd("ctx");
  23830. },
  23831. //>>excludeStart("ide", pragmas.excludeIdeData);
  23832. args: ["aProgressHandler"],
  23833. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  23834. referencedClasses: ["ProgressHandler"],
  23835. //>>excludeEnd("ide");
  23836. messageSends: ["register:"]
  23837. }),
  23838. globals.Environment);
  23839. smalltalk.addMethod(
  23840. smalltalk.method({
  23841. selector: "registerTranscript:",
  23842. protocol: 'services',
  23843. fn: function (aTranscript){
  23844. var self=this;
  23845. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  23846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23847. return smalltalk.withContext(function($ctx1) {
  23848. //>>excludeEnd("ctx");
  23849. _st($Transcript())._register_(aTranscript);
  23850. return self;
  23851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23852. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},globals.Environment)});
  23853. //>>excludeEnd("ctx");
  23854. },
  23855. //>>excludeStart("ide", pragmas.excludeIdeData);
  23856. args: ["aTranscript"],
  23857. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  23858. referencedClasses: ["Transcript"],
  23859. //>>excludeEnd("ide");
  23860. messageSends: ["register:"]
  23861. }),
  23862. globals.Environment);
  23863. smalltalk.addMethod(
  23864. smalltalk.method({
  23865. selector: "removeClass:",
  23866. protocol: 'actions',
  23867. fn: function (aClass){
  23868. var self=this;
  23869. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23871. return smalltalk.withContext(function($ctx1) {
  23872. //>>excludeEnd("ctx");
  23873. _st($Smalltalk())._removeClass_(aClass);
  23874. return self;
  23875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23876. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.Environment)});
  23877. //>>excludeEnd("ctx");
  23878. },
  23879. //>>excludeStart("ide", pragmas.excludeIdeData);
  23880. args: ["aClass"],
  23881. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  23882. referencedClasses: ["Smalltalk"],
  23883. //>>excludeEnd("ide");
  23884. messageSends: ["removeClass:"]
  23885. }),
  23886. globals.Environment);
  23887. smalltalk.addMethod(
  23888. smalltalk.method({
  23889. selector: "removeMethod:",
  23890. protocol: 'actions',
  23891. fn: function (aMethod){
  23892. var self=this;
  23893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23894. return smalltalk.withContext(function($ctx1) {
  23895. //>>excludeEnd("ctx");
  23896. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  23897. return self;
  23898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23899. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},globals.Environment)});
  23900. //>>excludeEnd("ctx");
  23901. },
  23902. //>>excludeStart("ide", pragmas.excludeIdeData);
  23903. args: ["aMethod"],
  23904. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  23905. referencedClasses: [],
  23906. //>>excludeEnd("ide");
  23907. messageSends: ["removeCompiledMethod:", "methodClass"]
  23908. }),
  23909. globals.Environment);
  23910. smalltalk.addMethod(
  23911. smalltalk.method({
  23912. selector: "removeProtocol:from:",
  23913. protocol: 'actions',
  23914. fn: function (aString,aClass){
  23915. var self=this;
  23916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23917. return smalltalk.withContext(function($ctx1) {
  23918. //>>excludeEnd("ctx");
  23919. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  23920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23921. return smalltalk.withContext(function($ctx2) {
  23922. //>>excludeEnd("ctx");
  23923. return _st(aClass)._removeCompiledMethod_(each);
  23924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23926. //>>excludeEnd("ctx");
  23927. }));
  23928. return self;
  23929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23930. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},globals.Environment)});
  23931. //>>excludeEnd("ctx");
  23932. },
  23933. //>>excludeStart("ide", pragmas.excludeIdeData);
  23934. args: ["aString", "aClass"],
  23935. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  23936. referencedClasses: [],
  23937. //>>excludeEnd("ide");
  23938. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  23939. }),
  23940. globals.Environment);
  23941. smalltalk.addMethod(
  23942. smalltalk.method({
  23943. selector: "renameClass:to:",
  23944. protocol: 'actions',
  23945. fn: function (aClass,aClassName){
  23946. var self=this;
  23947. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23948. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  23949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23950. return smalltalk.withContext(function($ctx1) {
  23951. //>>excludeEnd("ctx");
  23952. var $1,$2,$receiver;
  23953. $1=_st(_st($Smalltalk())._globals())._at_(aClassName);
  23954. if(($receiver = $1) == null || $receiver.isNil){
  23955. $1;
  23956. } else {
  23957. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  23958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23959. $ctx1.sendIdx[","]=1;
  23960. //>>excludeEnd("ctx");
  23961. self._error_($2);
  23962. };
  23963. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  23964. return self;
  23965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23966. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)});
  23967. //>>excludeEnd("ctx");
  23968. },
  23969. //>>excludeStart("ide", pragmas.excludeIdeData);
  23970. args: ["aClass", "aClassName"],
  23971. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
  23972. referencedClasses: ["Smalltalk", "ClassBuilder"],
  23973. //>>excludeEnd("ide");
  23974. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  23975. }),
  23976. globals.Environment);
  23977. smalltalk.addMethod(
  23978. smalltalk.method({
  23979. selector: "renameProtocol:to:in:",
  23980. protocol: 'actions',
  23981. fn: function (aString,anotherString,aClass){
  23982. var self=this;
  23983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23984. return smalltalk.withContext(function($ctx1) {
  23985. //>>excludeEnd("ctx");
  23986. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  23987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23988. return smalltalk.withContext(function($ctx2) {
  23989. //>>excludeEnd("ctx");
  23990. return _st(each)._protocol_(anotherString);
  23991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23992. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23993. //>>excludeEnd("ctx");
  23994. }));
  23995. return self;
  23996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23997. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},globals.Environment)});
  23998. //>>excludeEnd("ctx");
  23999. },
  24000. //>>excludeStart("ide", pragmas.excludeIdeData);
  24001. args: ["aString", "anotherString", "aClass"],
  24002. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  24003. referencedClasses: [],
  24004. //>>excludeEnd("ide");
  24005. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  24006. }),
  24007. globals.Environment);
  24008. smalltalk.addMethod(
  24009. smalltalk.method({
  24010. selector: "setClassCommentOf:to:",
  24011. protocol: 'actions',
  24012. fn: function (aClass,aString){
  24013. var self=this;
  24014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24015. return smalltalk.withContext(function($ctx1) {
  24016. //>>excludeEnd("ctx");
  24017. _st(aClass)._comment_(aString);
  24018. return self;
  24019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24020. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},globals.Environment)});
  24021. //>>excludeEnd("ctx");
  24022. },
  24023. //>>excludeStart("ide", pragmas.excludeIdeData);
  24024. args: ["aClass", "aString"],
  24025. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  24026. referencedClasses: [],
  24027. //>>excludeEnd("ide");
  24028. messageSends: ["comment:"]
  24029. }),
  24030. globals.Environment);
  24031. smalltalk.addMethod(
  24032. smalltalk.method({
  24033. selector: "systemAnnouncer",
  24034. protocol: 'accessing',
  24035. fn: function (){
  24036. var self=this;
  24037. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  24038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24039. return smalltalk.withContext(function($ctx1) {
  24040. //>>excludeEnd("ctx");
  24041. var $1;
  24042. $1=_st(_st(_st($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  24043. return $1;
  24044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24045. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},globals.Environment)});
  24046. //>>excludeEnd("ctx");
  24047. },
  24048. //>>excludeStart("ide", pragmas.excludeIdeData);
  24049. args: [],
  24050. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  24051. referencedClasses: ["Smalltalk"],
  24052. //>>excludeEnd("ide");
  24053. messageSends: ["current", "at:", "globals"]
  24054. }),
  24055. globals.Environment);
  24056. smalltalk.addClass('JSObjectProxy', globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  24057. //>>excludeStart("ide", pragmas.excludeIdeData);
  24058. globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  24059. //>>excludeEnd("ide");
  24060. smalltalk.addMethod(
  24061. smalltalk.method({
  24062. selector: "=",
  24063. protocol: 'comparing',
  24064. fn: function (anObject){
  24065. var self=this;
  24066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24067. return smalltalk.withContext(function($ctx1) {
  24068. //>>excludeEnd("ctx");
  24069. var $2,$1,$3;
  24070. $2=_st(anObject)._class();
  24071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24072. $ctx1.sendIdx["class"]=1;
  24073. //>>excludeEnd("ctx");
  24074. $1=_st($2).__eq_eq(self._class());
  24075. if(! smalltalk.assert($1)){
  24076. return false;
  24077. };
  24078. $3=self._compareJSObjectWith_(_st(anObject)._jsObject());
  24079. return $3;
  24080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24081. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.JSObjectProxy)});
  24082. //>>excludeEnd("ctx");
  24083. },
  24084. //>>excludeStart("ide", pragmas.excludeIdeData);
  24085. args: ["anObject"],
  24086. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ self compareJSObjectWith: anObject jsObject",
  24087. referencedClasses: [],
  24088. //>>excludeEnd("ide");
  24089. messageSends: ["ifFalse:", "==", "class", "compareJSObjectWith:", "jsObject"]
  24090. }),
  24091. globals.JSObjectProxy);
  24092. smalltalk.addMethod(
  24093. smalltalk.method({
  24094. selector: "addObjectVariablesTo:",
  24095. protocol: 'proxy',
  24096. fn: function (aDictionary){
  24097. var self=this;
  24098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24099. return smalltalk.withContext(function($ctx1) {
  24100. //>>excludeEnd("ctx");
  24101. for(var i in self['@jsObject']) {
  24102. aDictionary._at_put_(i, self['@jsObject'][i]);
  24103. }
  24104. ;
  24105. return self;
  24106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24107. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},globals.JSObjectProxy)});
  24108. //>>excludeEnd("ctx");
  24109. },
  24110. //>>excludeStart("ide", pragmas.excludeIdeData);
  24111. args: ["aDictionary"],
  24112. 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>",
  24113. referencedClasses: [],
  24114. //>>excludeEnd("ide");
  24115. messageSends: []
  24116. }),
  24117. globals.JSObjectProxy);
  24118. smalltalk.addMethod(
  24119. smalltalk.method({
  24120. selector: "asJSON",
  24121. protocol: 'enumerating',
  24122. fn: function (){
  24123. var self=this;
  24124. var $1;
  24125. $1=self["@jsObject"];
  24126. return $1;
  24127. },
  24128. //>>excludeStart("ide", pragmas.excludeIdeData);
  24129. args: [],
  24130. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  24131. referencedClasses: [],
  24132. //>>excludeEnd("ide");
  24133. messageSends: []
  24134. }),
  24135. globals.JSObjectProxy);
  24136. smalltalk.addMethod(
  24137. smalltalk.method({
  24138. selector: "at:",
  24139. protocol: 'accessing',
  24140. fn: function (aString){
  24141. var self=this;
  24142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24143. return smalltalk.withContext(function($ctx1) {
  24144. //>>excludeEnd("ctx");
  24145. return self['@jsObject'][aString];
  24146. return self;
  24147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24148. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.JSObjectProxy)});
  24149. //>>excludeEnd("ctx");
  24150. },
  24151. //>>excludeStart("ide", pragmas.excludeIdeData);
  24152. args: ["aString"],
  24153. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  24154. referencedClasses: [],
  24155. //>>excludeEnd("ide");
  24156. messageSends: []
  24157. }),
  24158. globals.JSObjectProxy);
  24159. smalltalk.addMethod(
  24160. smalltalk.method({
  24161. selector: "at:ifAbsent:",
  24162. protocol: 'accessing',
  24163. fn: function (aString,aBlock){
  24164. var self=this;
  24165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24166. return smalltalk.withContext(function($ctx1) {
  24167. //>>excludeEnd("ctx");
  24168. var obj = self['@jsObject'];
  24169. return aString in obj ? obj[aString] : aBlock._value();
  24170. ;
  24171. return self;
  24172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24173. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)});
  24174. //>>excludeEnd("ctx");
  24175. },
  24176. //>>excludeStart("ide", pragmas.excludeIdeData);
  24177. args: ["aString", "aBlock"],
  24178. 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._value();\x0a\x09>",
  24179. referencedClasses: [],
  24180. //>>excludeEnd("ide");
  24181. messageSends: []
  24182. }),
  24183. globals.JSObjectProxy);
  24184. smalltalk.addMethod(
  24185. smalltalk.method({
  24186. selector: "at:ifPresent:",
  24187. protocol: 'accessing',
  24188. fn: function (aString,aBlock){
  24189. var self=this;
  24190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24191. return smalltalk.withContext(function($ctx1) {
  24192. //>>excludeEnd("ctx");
  24193. var obj = self['@jsObject'];
  24194. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  24195. ;
  24196. return self;
  24197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24198. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)});
  24199. //>>excludeEnd("ctx");
  24200. },
  24201. //>>excludeStart("ide", pragmas.excludeIdeData);
  24202. args: ["aString", "aBlock"],
  24203. 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._value_(obj[aString]) : nil;\x0a\x09>",
  24204. referencedClasses: [],
  24205. //>>excludeEnd("ide");
  24206. messageSends: []
  24207. }),
  24208. globals.JSObjectProxy);
  24209. smalltalk.addMethod(
  24210. smalltalk.method({
  24211. selector: "at:ifPresent:ifAbsent:",
  24212. protocol: 'accessing',
  24213. fn: function (aString,aBlock,anotherBlock){
  24214. var self=this;
  24215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24216. return smalltalk.withContext(function($ctx1) {
  24217. //>>excludeEnd("ctx");
  24218. var obj = self['@jsObject'];
  24219. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  24220. ;
  24221. return self;
  24222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24223. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.JSObjectProxy)});
  24224. //>>excludeEnd("ctx");
  24225. },
  24226. //>>excludeStart("ide", pragmas.excludeIdeData);
  24227. args: ["aString", "aBlock", "anotherBlock"],
  24228. 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._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
  24229. referencedClasses: [],
  24230. //>>excludeEnd("ide");
  24231. messageSends: []
  24232. }),
  24233. globals.JSObjectProxy);
  24234. smalltalk.addMethod(
  24235. smalltalk.method({
  24236. selector: "at:put:",
  24237. protocol: 'accessing',
  24238. fn: function (aString,anObject){
  24239. var self=this;
  24240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24241. return smalltalk.withContext(function($ctx1) {
  24242. //>>excludeEnd("ctx");
  24243. return self['@jsObject'][aString] = anObject;
  24244. return self;
  24245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24246. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.JSObjectProxy)});
  24247. //>>excludeEnd("ctx");
  24248. },
  24249. //>>excludeStart("ide", pragmas.excludeIdeData);
  24250. args: ["aString", "anObject"],
  24251. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  24252. referencedClasses: [],
  24253. //>>excludeEnd("ide");
  24254. messageSends: []
  24255. }),
  24256. globals.JSObjectProxy);
  24257. smalltalk.addMethod(
  24258. smalltalk.method({
  24259. selector: "compareJSObjectWith:",
  24260. protocol: 'private',
  24261. fn: function (aJSObject){
  24262. var self=this;
  24263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24264. return smalltalk.withContext(function($ctx1) {
  24265. //>>excludeEnd("ctx");
  24266. return self["@jsObject"] === aJSObject;
  24267. return self;
  24268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24269. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectWith:",{aJSObject:aJSObject},globals.JSObjectProxy)});
  24270. //>>excludeEnd("ctx");
  24271. },
  24272. //>>excludeStart("ide", pragmas.excludeIdeData);
  24273. args: ["aJSObject"],
  24274. source: "compareJSObjectWith: aJSObject\x0a \x09<return self[\x22@jsObject\x22] === aJSObject>",
  24275. referencedClasses: [],
  24276. //>>excludeEnd("ide");
  24277. messageSends: []
  24278. }),
  24279. globals.JSObjectProxy);
  24280. smalltalk.addMethod(
  24281. smalltalk.method({
  24282. selector: "doesNotUnderstand:",
  24283. protocol: 'proxy',
  24284. fn: function (aMessage){
  24285. var self=this;
  24286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24287. return smalltalk.withContext(function($ctx1) {
  24288. //>>excludeEnd("ctx");
  24289. var $2,$1,$receiver;
  24290. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptPropertyName());
  24291. if(($receiver = $2) == null || $receiver.isNil){
  24292. $1=(
  24293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24294. $ctx1.supercall = true,
  24295. //>>excludeEnd("ctx");
  24296. globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]));
  24297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24298. $ctx1.supercall = false;
  24299. //>>excludeEnd("ctx");;
  24300. } else {
  24301. var jsSelector;
  24302. jsSelector=$receiver;
  24303. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  24304. };
  24305. return $1;
  24306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24307. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.JSObjectProxy)});
  24308. //>>excludeEnd("ctx");
  24309. },
  24310. //>>excludeStart("ide", pragmas.excludeIdeData);
  24311. args: ["aMessage"],
  24312. source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptPropertyName)\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 ]",
  24313. referencedClasses: [],
  24314. //>>excludeEnd("ide");
  24315. messageSends: ["ifNil:ifNotNil:", "lookupProperty:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"]
  24316. }),
  24317. globals.JSObjectProxy);
  24318. smalltalk.addMethod(
  24319. smalltalk.method({
  24320. selector: "forwardMessage:withArguments:",
  24321. protocol: 'proxy',
  24322. fn: function (aString,anArray){
  24323. var self=this;
  24324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24325. return smalltalk.withContext(function($ctx1) {
  24326. //>>excludeEnd("ctx");
  24327. return smalltalk.accessJavaScript(self._jsObject(), aString, anArray);
  24328. ;
  24329. return self;
  24330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24331. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},globals.JSObjectProxy)});
  24332. //>>excludeEnd("ctx");
  24333. },
  24334. //>>excludeStart("ide", pragmas.excludeIdeData);
  24335. args: ["aString", "anArray"],
  24336. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.accessJavaScript(self._jsObject(), aString, anArray);\x0a\x09>",
  24337. referencedClasses: [],
  24338. //>>excludeEnd("ide");
  24339. messageSends: []
  24340. }),
  24341. globals.JSObjectProxy);
  24342. smalltalk.addMethod(
  24343. smalltalk.method({
  24344. selector: "inspectOn:",
  24345. protocol: 'proxy',
  24346. fn: function (anInspector){
  24347. var self=this;
  24348. var variables;
  24349. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  24350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24351. return smalltalk.withContext(function($ctx1) {
  24352. //>>excludeEnd("ctx");
  24353. variables=_st($Dictionary())._new();
  24354. _st(variables)._at_put_("#self",self._jsObject());
  24355. _st(anInspector)._setLabel_(self._printString());
  24356. self._addObjectVariablesTo_(variables);
  24357. _st(anInspector)._setVariables_(variables);
  24358. return self;
  24359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24360. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.JSObjectProxy)});
  24361. //>>excludeEnd("ctx");
  24362. },
  24363. //>>excludeStart("ide", pragmas.excludeIdeData);
  24364. args: ["anInspector"],
  24365. 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",
  24366. referencedClasses: ["Dictionary"],
  24367. //>>excludeEnd("ide");
  24368. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"]
  24369. }),
  24370. globals.JSObjectProxy);
  24371. smalltalk.addMethod(
  24372. smalltalk.method({
  24373. selector: "jsObject",
  24374. protocol: 'accessing',
  24375. fn: function (){
  24376. var self=this;
  24377. var $1;
  24378. $1=self["@jsObject"];
  24379. return $1;
  24380. },
  24381. //>>excludeStart("ide", pragmas.excludeIdeData);
  24382. args: [],
  24383. source: "jsObject\x0a\x09^ jsObject",
  24384. referencedClasses: [],
  24385. //>>excludeEnd("ide");
  24386. messageSends: []
  24387. }),
  24388. globals.JSObjectProxy);
  24389. smalltalk.addMethod(
  24390. smalltalk.method({
  24391. selector: "jsObject:",
  24392. protocol: 'accessing',
  24393. fn: function (aJSObject){
  24394. var self=this;
  24395. self["@jsObject"]=aJSObject;
  24396. return self;
  24397. },
  24398. //>>excludeStart("ide", pragmas.excludeIdeData);
  24399. args: ["aJSObject"],
  24400. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  24401. referencedClasses: [],
  24402. //>>excludeEnd("ide");
  24403. messageSends: []
  24404. }),
  24405. globals.JSObjectProxy);
  24406. smalltalk.addMethod(
  24407. smalltalk.method({
  24408. selector: "keysAndValuesDo:",
  24409. protocol: 'enumerating',
  24410. fn: function (aBlock){
  24411. var self=this;
  24412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24413. return smalltalk.withContext(function($ctx1) {
  24414. //>>excludeEnd("ctx");
  24415. var o = self['@jsObject'];
  24416. for(var i in o) {
  24417. aBlock._value_value_(i, o[i]);
  24418. }
  24419. ;
  24420. return self;
  24421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24422. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.JSObjectProxy)});
  24423. //>>excludeEnd("ctx");
  24424. },
  24425. //>>excludeStart("ide", pragmas.excludeIdeData);
  24426. args: ["aBlock"],
  24427. source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09>",
  24428. referencedClasses: [],
  24429. //>>excludeEnd("ide");
  24430. messageSends: []
  24431. }),
  24432. globals.JSObjectProxy);
  24433. smalltalk.addMethod(
  24434. smalltalk.method({
  24435. selector: "lookupProperty:",
  24436. protocol: 'accessing',
  24437. fn: function (aString){
  24438. var self=this;
  24439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24440. return smalltalk.withContext(function($ctx1) {
  24441. //>>excludeEnd("ctx");
  24442. return aString in self._jsObject() ? aString : nil;
  24443. return self;
  24444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24445. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},globals.JSObjectProxy)});
  24446. //>>excludeEnd("ctx");
  24447. },
  24448. //>>excludeStart("ide", pragmas.excludeIdeData);
  24449. args: ["aString"],
  24450. 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>",
  24451. referencedClasses: [],
  24452. //>>excludeEnd("ide");
  24453. messageSends: []
  24454. }),
  24455. globals.JSObjectProxy);
  24456. smalltalk.addMethod(
  24457. smalltalk.method({
  24458. selector: "printOn:",
  24459. protocol: 'printing',
  24460. fn: function (aStream){
  24461. var self=this;
  24462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24463. return smalltalk.withContext(function($ctx1) {
  24464. //>>excludeEnd("ctx");
  24465. _st(aStream)._nextPutAll_(self._printString());
  24466. return self;
  24467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24468. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.JSObjectProxy)});
  24469. //>>excludeEnd("ctx");
  24470. },
  24471. //>>excludeStart("ide", pragmas.excludeIdeData);
  24472. args: ["aStream"],
  24473. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  24474. referencedClasses: [],
  24475. //>>excludeEnd("ide");
  24476. messageSends: ["nextPutAll:", "printString"]
  24477. }),
  24478. globals.JSObjectProxy);
  24479. smalltalk.addMethod(
  24480. smalltalk.method({
  24481. selector: "printString",
  24482. protocol: 'printing',
  24483. fn: function (){
  24484. var self=this;
  24485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24486. return smalltalk.withContext(function($ctx1) {
  24487. //>>excludeEnd("ctx");
  24488. var js = self['@jsObject'];
  24489. return js.toString
  24490. ? js.toString()
  24491. : Object.prototype.toString.call(js)
  24492. ;
  24493. return self;
  24494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24495. }, function($ctx1) {$ctx1.fill(self,"printString",{},globals.JSObjectProxy)});
  24496. //>>excludeEnd("ctx");
  24497. },
  24498. //>>excludeStart("ide", pragmas.excludeIdeData);
  24499. args: [],
  24500. source: "printString\x0a\x09<\x0a\x09\x09var js = self['@jsObject'];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09>",
  24501. referencedClasses: [],
  24502. //>>excludeEnd("ide");
  24503. messageSends: []
  24504. }),
  24505. globals.JSObjectProxy);
  24506. smalltalk.addMethod(
  24507. smalltalk.method({
  24508. selector: "on:",
  24509. protocol: 'instance creation',
  24510. fn: function (aJSObject){
  24511. var self=this;
  24512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24513. return smalltalk.withContext(function($ctx1) {
  24514. //>>excludeEnd("ctx");
  24515. var $2,$3,$1;
  24516. $2=self._new();
  24517. _st($2)._jsObject_(aJSObject);
  24518. $3=_st($2)._yourself();
  24519. $1=$3;
  24520. return $1;
  24521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24522. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},globals.JSObjectProxy.klass)});
  24523. //>>excludeEnd("ctx");
  24524. },
  24525. //>>excludeStart("ide", pragmas.excludeIdeData);
  24526. args: ["aJSObject"],
  24527. source: "on: aJSObject\x0a\x09^ self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  24528. referencedClasses: [],
  24529. //>>excludeEnd("ide");
  24530. messageSends: ["jsObject:", "new", "yourself"]
  24531. }),
  24532. globals.JSObjectProxy.klass);
  24533. smalltalk.addClass('NullProgressHandler', globals.Object, [], 'Kernel-Infrastructure');
  24534. //>>excludeStart("ide", pragmas.excludeIdeData);
  24535. globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  24536. //>>excludeEnd("ide");
  24537. smalltalk.addMethod(
  24538. smalltalk.method({
  24539. selector: "do:on:displaying:",
  24540. protocol: 'progress handling',
  24541. fn: function (aBlock,aCollection,aString){
  24542. var self=this;
  24543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24544. return smalltalk.withContext(function($ctx1) {
  24545. //>>excludeEnd("ctx");
  24546. _st(aCollection)._do_(aBlock);
  24547. return self;
  24548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24549. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.NullProgressHandler)});
  24550. //>>excludeEnd("ctx");
  24551. },
  24552. //>>excludeStart("ide", pragmas.excludeIdeData);
  24553. args: ["aBlock", "aCollection", "aString"],
  24554. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  24555. referencedClasses: [],
  24556. //>>excludeEnd("ide");
  24557. messageSends: ["do:"]
  24558. }),
  24559. globals.NullProgressHandler);
  24560. globals.NullProgressHandler.klass.iVarNames = ['current'];
  24561. smalltalk.addMethod(
  24562. smalltalk.method({
  24563. selector: "initialize",
  24564. protocol: 'initialization',
  24565. fn: function (){
  24566. var self=this;
  24567. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  24568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24569. return smalltalk.withContext(function($ctx1) {
  24570. //>>excludeEnd("ctx");
  24571. _st($ProgressHandler())._registerIfNone_(self._new());
  24572. return self;
  24573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24574. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.NullProgressHandler.klass)});
  24575. //>>excludeEnd("ctx");
  24576. },
  24577. //>>excludeStart("ide", pragmas.excludeIdeData);
  24578. args: [],
  24579. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  24580. referencedClasses: ["ProgressHandler"],
  24581. //>>excludeEnd("ide");
  24582. messageSends: ["registerIfNone:", "new"]
  24583. }),
  24584. globals.NullProgressHandler.klass);
  24585. smalltalk.addClass('Organizer', globals.Object, [], 'Kernel-Infrastructure');
  24586. //>>excludeStart("ide", pragmas.excludeIdeData);
  24587. globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  24588. //>>excludeEnd("ide");
  24589. smalltalk.addMethod(
  24590. smalltalk.method({
  24591. selector: "addElement:",
  24592. protocol: 'accessing',
  24593. fn: function (anObject){
  24594. var self=this;
  24595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24596. return smalltalk.withContext(function($ctx1) {
  24597. //>>excludeEnd("ctx");
  24598. self.elements.addElement(anObject);
  24599. return self;
  24600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24601. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},globals.Organizer)});
  24602. //>>excludeEnd("ctx");
  24603. },
  24604. //>>excludeStart("ide", pragmas.excludeIdeData);
  24605. args: ["anObject"],
  24606. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  24607. referencedClasses: [],
  24608. //>>excludeEnd("ide");
  24609. messageSends: []
  24610. }),
  24611. globals.Organizer);
  24612. smalltalk.addMethod(
  24613. smalltalk.method({
  24614. selector: "elements",
  24615. protocol: 'accessing',
  24616. fn: function (){
  24617. var self=this;
  24618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24619. return smalltalk.withContext(function($ctx1) {
  24620. //>>excludeEnd("ctx");
  24621. var $1;
  24622. $1=_st(self._basicAt_("elements"))._copy();
  24623. return $1;
  24624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24625. }, function($ctx1) {$ctx1.fill(self,"elements",{},globals.Organizer)});
  24626. //>>excludeEnd("ctx");
  24627. },
  24628. //>>excludeStart("ide", pragmas.excludeIdeData);
  24629. args: [],
  24630. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  24631. referencedClasses: [],
  24632. //>>excludeEnd("ide");
  24633. messageSends: ["copy", "basicAt:"]
  24634. }),
  24635. globals.Organizer);
  24636. smalltalk.addMethod(
  24637. smalltalk.method({
  24638. selector: "removeElement:",
  24639. protocol: 'accessing',
  24640. fn: function (anObject){
  24641. var self=this;
  24642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24643. return smalltalk.withContext(function($ctx1) {
  24644. //>>excludeEnd("ctx");
  24645. self.elements.removeElement(anObject);
  24646. return self;
  24647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24648. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},globals.Organizer)});
  24649. //>>excludeEnd("ctx");
  24650. },
  24651. //>>excludeStart("ide", pragmas.excludeIdeData);
  24652. args: ["anObject"],
  24653. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  24654. referencedClasses: [],
  24655. //>>excludeEnd("ide");
  24656. messageSends: []
  24657. }),
  24658. globals.Organizer);
  24659. smalltalk.addClass('ClassOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  24660. //>>excludeStart("ide", pragmas.excludeIdeData);
  24661. globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  24662. //>>excludeEnd("ide");
  24663. smalltalk.addMethod(
  24664. smalltalk.method({
  24665. selector: "addElement:",
  24666. protocol: 'accessing',
  24667. fn: function (aString){
  24668. var self=this;
  24669. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  24670. function $ProtocolAdded(){return globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  24671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24672. return smalltalk.withContext(function($ctx1) {
  24673. //>>excludeEnd("ctx");
  24674. var $1,$2;
  24675. (
  24676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24677. $ctx1.supercall = true,
  24678. //>>excludeEnd("ctx");
  24679. globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply(_st(self), [aString]));
  24680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24681. $ctx1.supercall = false;
  24682. //>>excludeEnd("ctx");;
  24683. $1=_st($ProtocolAdded())._new();
  24684. _st($1)._protocol_(aString);
  24685. _st($1)._theClass_(self._theClass());
  24686. $2=_st($1)._yourself();
  24687. _st(_st($SystemAnnouncer())._current())._announce_($2);
  24688. return self;
  24689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24690. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},globals.ClassOrganizer)});
  24691. //>>excludeEnd("ctx");
  24692. },
  24693. //>>excludeStart("ide", pragmas.excludeIdeData);
  24694. args: ["aString"],
  24695. 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)",
  24696. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  24697. //>>excludeEnd("ide");
  24698. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  24699. }),
  24700. globals.ClassOrganizer);
  24701. smalltalk.addMethod(
  24702. smalltalk.method({
  24703. selector: "removeElement:",
  24704. protocol: 'accessing',
  24705. fn: function (aString){
  24706. var self=this;
  24707. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  24708. function $ProtocolRemoved(){return globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  24709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24710. return smalltalk.withContext(function($ctx1) {
  24711. //>>excludeEnd("ctx");
  24712. var $1,$2;
  24713. (
  24714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24715. $ctx1.supercall = true,
  24716. //>>excludeEnd("ctx");
  24717. globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply(_st(self), [aString]));
  24718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24719. $ctx1.supercall = false;
  24720. //>>excludeEnd("ctx");;
  24721. $1=_st($ProtocolRemoved())._new();
  24722. _st($1)._protocol_(aString);
  24723. _st($1)._theClass_(self._theClass());
  24724. $2=_st($1)._yourself();
  24725. _st(_st($SystemAnnouncer())._current())._announce_($2);
  24726. return self;
  24727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24728. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},globals.ClassOrganizer)});
  24729. //>>excludeEnd("ctx");
  24730. },
  24731. //>>excludeStart("ide", pragmas.excludeIdeData);
  24732. args: ["aString"],
  24733. 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)",
  24734. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  24735. //>>excludeEnd("ide");
  24736. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  24737. }),
  24738. globals.ClassOrganizer);
  24739. smalltalk.addMethod(
  24740. smalltalk.method({
  24741. selector: "theClass",
  24742. protocol: 'accessing',
  24743. fn: function (){
  24744. var self=this;
  24745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24746. return smalltalk.withContext(function($ctx1) {
  24747. //>>excludeEnd("ctx");
  24748. return self.theClass ;
  24749. return self;
  24750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24751. }, function($ctx1) {$ctx1.fill(self,"theClass",{},globals.ClassOrganizer)});
  24752. //>>excludeEnd("ctx");
  24753. },
  24754. //>>excludeStart("ide", pragmas.excludeIdeData);
  24755. args: [],
  24756. source: "theClass\x0a\x09< return self.theClass >",
  24757. referencedClasses: [],
  24758. //>>excludeEnd("ide");
  24759. messageSends: []
  24760. }),
  24761. globals.ClassOrganizer);
  24762. smalltalk.addClass('PackageOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  24763. //>>excludeStart("ide", pragmas.excludeIdeData);
  24764. globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  24765. //>>excludeEnd("ide");
  24766. smalltalk.addClass('Package', globals.Object, ['transport', 'dirty'], 'Kernel-Infrastructure');
  24767. //>>excludeStart("ide", pragmas.excludeIdeData);
  24768. globals.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  24769. //>>excludeEnd("ide");
  24770. smalltalk.addMethod(
  24771. smalltalk.method({
  24772. selector: "basicName:",
  24773. protocol: 'private',
  24774. fn: function (aString){
  24775. var self=this;
  24776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24777. return smalltalk.withContext(function($ctx1) {
  24778. //>>excludeEnd("ctx");
  24779. self.pkgName = aString;
  24780. return self;
  24781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24782. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},globals.Package)});
  24783. //>>excludeEnd("ctx");
  24784. },
  24785. //>>excludeStart("ide", pragmas.excludeIdeData);
  24786. args: ["aString"],
  24787. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  24788. referencedClasses: [],
  24789. //>>excludeEnd("ide");
  24790. messageSends: []
  24791. }),
  24792. globals.Package);
  24793. smalltalk.addMethod(
  24794. smalltalk.method({
  24795. selector: "basicTransport",
  24796. protocol: 'private',
  24797. fn: function (){
  24798. var self=this;
  24799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24800. return smalltalk.withContext(function($ctx1) {
  24801. //>>excludeEnd("ctx");
  24802. return self.transport;
  24803. return self;
  24804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24805. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},globals.Package)});
  24806. //>>excludeEnd("ctx");
  24807. },
  24808. //>>excludeStart("ide", pragmas.excludeIdeData);
  24809. args: [],
  24810. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.transport>",
  24811. referencedClasses: [],
  24812. //>>excludeEnd("ide");
  24813. messageSends: []
  24814. }),
  24815. globals.Package);
  24816. smalltalk.addMethod(
  24817. smalltalk.method({
  24818. selector: "beClean",
  24819. protocol: 'accessing',
  24820. fn: function (){
  24821. var self=this;
  24822. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  24823. function $PackageClean(){return globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
  24824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24825. return smalltalk.withContext(function($ctx1) {
  24826. //>>excludeEnd("ctx");
  24827. var $1,$2;
  24828. self["@dirty"]=false;
  24829. $1=_st($PackageClean())._new();
  24830. _st($1)._package_(self);
  24831. $2=_st($1)._yourself();
  24832. _st(_st($SystemAnnouncer())._current())._announce_($2);
  24833. return self;
  24834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24835. }, function($ctx1) {$ctx1.fill(self,"beClean",{},globals.Package)});
  24836. //>>excludeEnd("ctx");
  24837. },
  24838. //>>excludeStart("ide", pragmas.excludeIdeData);
  24839. args: [],
  24840. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  24841. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  24842. //>>excludeEnd("ide");
  24843. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  24844. }),
  24845. globals.Package);
  24846. smalltalk.addMethod(
  24847. smalltalk.method({
  24848. selector: "beDirty",
  24849. protocol: 'accessing',
  24850. fn: function (){
  24851. var self=this;
  24852. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  24853. function $PackageDirty(){return globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
  24854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24855. return smalltalk.withContext(function($ctx1) {
  24856. //>>excludeEnd("ctx");
  24857. var $1,$2;
  24858. self["@dirty"]=true;
  24859. $1=_st($PackageDirty())._new();
  24860. _st($1)._package_(self);
  24861. $2=_st($1)._yourself();
  24862. _st(_st($SystemAnnouncer())._current())._announce_($2);
  24863. return self;
  24864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24865. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},globals.Package)});
  24866. //>>excludeEnd("ctx");
  24867. },
  24868. //>>excludeStart("ide", pragmas.excludeIdeData);
  24869. args: [],
  24870. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  24871. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  24872. //>>excludeEnd("ide");
  24873. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  24874. }),
  24875. globals.Package);
  24876. smalltalk.addMethod(
  24877. smalltalk.method({
  24878. selector: "classTemplate",
  24879. protocol: 'accessing',
  24880. fn: function (){
  24881. var self=this;
  24882. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  24883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24884. return smalltalk.withContext(function($ctx1) {
  24885. //>>excludeEnd("ctx");
  24886. var $3,$4,$2,$5,$6,$7,$1;
  24887. $1=_st($String())._streamContents_((function(stream){
  24888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24889. return smalltalk.withContext(function($ctx2) {
  24890. //>>excludeEnd("ctx");
  24891. _st(stream)._nextPutAll_("Object");
  24892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24893. $ctx2.sendIdx["nextPutAll:"]=1;
  24894. //>>excludeEnd("ctx");
  24895. _st(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  24896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24897. $ctx2.sendIdx["nextPutAll:"]=2;
  24898. //>>excludeEnd("ctx");
  24899. $3=_st($String())._lf();
  24900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24901. $ctx2.sendIdx["lf"]=1;
  24902. //>>excludeEnd("ctx");
  24903. $4=_st($String())._tab();
  24904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24905. $ctx2.sendIdx["tab"]=1;
  24906. //>>excludeEnd("ctx");
  24907. $2=_st($3).__comma($4);
  24908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24909. $ctx2.sendIdx[","]=1;
  24910. //>>excludeEnd("ctx");
  24911. _st(stream)._nextPutAll_($2);
  24912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24913. $ctx2.sendIdx["nextPutAll:"]=3;
  24914. //>>excludeEnd("ctx");
  24915. $5=_st(stream)._nextPutAll_("instanceVariableNames: ''");
  24916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24917. $ctx2.sendIdx["nextPutAll:"]=4;
  24918. //>>excludeEnd("ctx");
  24919. $5;
  24920. $6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
  24921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24922. $ctx2.sendIdx[","]=2;
  24923. //>>excludeEnd("ctx");
  24924. _st(stream)._nextPutAll_($6);
  24925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24926. $ctx2.sendIdx["nextPutAll:"]=5;
  24927. //>>excludeEnd("ctx");
  24928. _st(stream)._nextPutAll_("package: '");
  24929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24930. $ctx2.sendIdx["nextPutAll:"]=6;
  24931. //>>excludeEnd("ctx");
  24932. _st(stream)._nextPutAll_(self._name());
  24933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24934. $ctx2.sendIdx["nextPutAll:"]=7;
  24935. //>>excludeEnd("ctx");
  24936. $7=_st(stream)._nextPutAll_("'");
  24937. return $7;
  24938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24939. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  24940. //>>excludeEnd("ctx");
  24941. }));
  24942. return $1;
  24943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24944. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},globals.Package)});
  24945. //>>excludeEnd("ctx");
  24946. },
  24947. //>>excludeStart("ide", pragmas.excludeIdeData);
  24948. args: [],
  24949. source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]",
  24950. referencedClasses: ["String"],
  24951. //>>excludeEnd("ide");
  24952. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  24953. }),
  24954. globals.Package);
  24955. smalltalk.addMethod(
  24956. smalltalk.method({
  24957. selector: "classes",
  24958. protocol: 'classes',
  24959. fn: function (){
  24960. var self=this;
  24961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24962. return smalltalk.withContext(function($ctx1) {
  24963. //>>excludeEnd("ctx");
  24964. var $1;
  24965. $1=_st(self._organization())._elements();
  24966. return $1;
  24967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24968. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Package)});
  24969. //>>excludeEnd("ctx");
  24970. },
  24971. //>>excludeStart("ide", pragmas.excludeIdeData);
  24972. args: [],
  24973. source: "classes\x0a\x09^ self organization elements",
  24974. referencedClasses: [],
  24975. //>>excludeEnd("ide");
  24976. messageSends: ["elements", "organization"]
  24977. }),
  24978. globals.Package);
  24979. smalltalk.addMethod(
  24980. smalltalk.method({
  24981. selector: "definition",
  24982. protocol: 'accessing',
  24983. fn: function (){
  24984. var self=this;
  24985. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  24986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24987. return smalltalk.withContext(function($ctx1) {
  24988. //>>excludeEnd("ctx");
  24989. var $2,$4,$5,$3,$7,$6,$8,$9,$1;
  24990. $1=_st($String())._streamContents_((function(stream){
  24991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24992. return smalltalk.withContext(function($ctx2) {
  24993. //>>excludeEnd("ctx");
  24994. $2=_st(self._class())._name();
  24995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24996. $ctx2.sendIdx["name"]=1;
  24997. //>>excludeEnd("ctx");
  24998. _st(stream)._nextPutAll_($2);
  24999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25000. $ctx2.sendIdx["nextPutAll:"]=1;
  25001. //>>excludeEnd("ctx");
  25002. $4=_st($String())._lf();
  25003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25004. $ctx2.sendIdx["lf"]=1;
  25005. //>>excludeEnd("ctx");
  25006. $5=_st($String())._tab();
  25007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25008. $ctx2.sendIdx["tab"]=1;
  25009. //>>excludeEnd("ctx");
  25010. $3=_st($4).__comma($5);
  25011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25012. $ctx2.sendIdx[","]=1;
  25013. //>>excludeEnd("ctx");
  25014. _st(stream)._nextPutAll_($3);
  25015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25016. $ctx2.sendIdx["nextPutAll:"]=2;
  25017. //>>excludeEnd("ctx");
  25018. _st(stream)._nextPutAll_(" named: ");
  25019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25020. $ctx2.sendIdx["nextPutAll:"]=3;
  25021. //>>excludeEnd("ctx");
  25022. $7="'".__comma(self._name());
  25023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25024. $ctx2.sendIdx[","]=3;
  25025. //>>excludeEnd("ctx");
  25026. $6=_st($7).__comma("'");
  25027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25028. $ctx2.sendIdx[","]=2;
  25029. //>>excludeEnd("ctx");
  25030. _st(stream)._nextPutAll_($6);
  25031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25032. $ctx2.sendIdx["nextPutAll:"]=4;
  25033. //>>excludeEnd("ctx");
  25034. $8=_st(_st($String())._lf()).__comma(_st($String())._tab());
  25035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25036. $ctx2.sendIdx[","]=4;
  25037. //>>excludeEnd("ctx");
  25038. _st(stream)._nextPutAll_($8);
  25039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25040. $ctx2.sendIdx["nextPutAll:"]=5;
  25041. //>>excludeEnd("ctx");
  25042. _st(stream)._nextPutAll_(" transport: (");
  25043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25044. $ctx2.sendIdx["nextPutAll:"]=6;
  25045. //>>excludeEnd("ctx");
  25046. $9=_st(stream)._nextPutAll_(_st(_st(self._transport())._definition()).__comma(")"));
  25047. return $9;
  25048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25049. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  25050. //>>excludeEnd("ctx");
  25051. }));
  25052. return $1;
  25053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25054. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Package)});
  25055. //>>excludeEnd("ctx");
  25056. },
  25057. //>>excludeStart("ide", pragmas.excludeIdeData);
  25058. args: [],
  25059. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: ' named: ';\x0a\x09\x09\x09nextPutAll: '''', self name, '''';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: ' transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]",
  25060. referencedClasses: ["String"],
  25061. //>>excludeEnd("ide");
  25062. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "definition", "transport"]
  25063. }),
  25064. globals.Package);
  25065. smalltalk.addMethod(
  25066. smalltalk.method({
  25067. selector: "isDirty",
  25068. protocol: 'testing',
  25069. fn: function (){
  25070. var self=this;
  25071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25072. return smalltalk.withContext(function($ctx1) {
  25073. //>>excludeEnd("ctx");
  25074. var $2,$1,$receiver;
  25075. $2=self["@dirty"];
  25076. if(($receiver = $2) == null || $receiver.isNil){
  25077. $1=false;
  25078. } else {
  25079. $1=$2;
  25080. };
  25081. return $1;
  25082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25083. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},globals.Package)});
  25084. //>>excludeEnd("ctx");
  25085. },
  25086. //>>excludeStart("ide", pragmas.excludeIdeData);
  25087. args: [],
  25088. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  25089. referencedClasses: [],
  25090. //>>excludeEnd("ide");
  25091. messageSends: ["ifNil:"]
  25092. }),
  25093. globals.Package);
  25094. smalltalk.addMethod(
  25095. smalltalk.method({
  25096. selector: "isPackage",
  25097. protocol: 'testing',
  25098. fn: function (){
  25099. var self=this;
  25100. return true;
  25101. },
  25102. //>>excludeStart("ide", pragmas.excludeIdeData);
  25103. args: [],
  25104. source: "isPackage\x0a\x09^ true",
  25105. referencedClasses: [],
  25106. //>>excludeEnd("ide");
  25107. messageSends: []
  25108. }),
  25109. globals.Package);
  25110. smalltalk.addMethod(
  25111. smalltalk.method({
  25112. selector: "loadDependencies",
  25113. protocol: 'dependencies',
  25114. fn: function (){
  25115. var self=this;
  25116. var classes,packages;
  25117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25118. return smalltalk.withContext(function($ctx1) {
  25119. //>>excludeEnd("ctx");
  25120. var $2,$3,$1;
  25121. classes=self._loadDependencyClasses();
  25122. $2=_st(_st(classes)._collect_((function(each){
  25123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25124. return smalltalk.withContext(function($ctx2) {
  25125. //>>excludeEnd("ctx");
  25126. return _st(each)._package();
  25127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25129. //>>excludeEnd("ctx");
  25130. })))._asSet();
  25131. _st($2)._remove_ifAbsent_(self,(function(){
  25132. }));
  25133. $3=_st($2)._yourself();
  25134. $1=$3;
  25135. return $1;
  25136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25137. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},globals.Package)});
  25138. //>>excludeEnd("ctx");
  25139. },
  25140. //>>excludeStart("ide", pragmas.excludeIdeData);
  25141. args: [],
  25142. source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^ (classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself",
  25143. referencedClasses: [],
  25144. //>>excludeEnd("ide");
  25145. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  25146. }),
  25147. globals.Package);
  25148. smalltalk.addMethod(
  25149. smalltalk.method({
  25150. selector: "loadDependencyClasses",
  25151. protocol: 'dependencies',
  25152. fn: function (){
  25153. var self=this;
  25154. var starCategoryName;
  25155. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  25156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25157. return smalltalk.withContext(function($ctx1) {
  25158. //>>excludeEnd("ctx");
  25159. var $4,$3,$2,$6,$5,$7,$1;
  25160. starCategoryName="*".__comma(self._name());
  25161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25162. $ctx1.sendIdx[","]=1;
  25163. //>>excludeEnd("ctx");
  25164. $4=self._classes();
  25165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25166. $ctx1.sendIdx["classes"]=1;
  25167. //>>excludeEnd("ctx");
  25168. $3=_st($4)._collect_((function(each){
  25169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25170. return smalltalk.withContext(function($ctx2) {
  25171. //>>excludeEnd("ctx");
  25172. return _st(each)._superclass();
  25173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25175. //>>excludeEnd("ctx");
  25176. }));
  25177. $2=_st($3)._asSet();
  25178. _st($2)._remove_ifAbsent_(nil,(function(){
  25179. }));
  25180. _st($2)._addAll_(_st(_st($Smalltalk())._classes())._select_((function(each){
  25181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25182. return smalltalk.withContext(function($ctx2) {
  25183. //>>excludeEnd("ctx");
  25184. $6=_st(each)._protocols();
  25185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25186. $ctx2.sendIdx["protocols"]=1;
  25187. //>>excludeEnd("ctx");
  25188. $5=_st($6).__comma(_st(_st(each)._class())._protocols());
  25189. return _st($5)._includes_(starCategoryName);
  25190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  25192. //>>excludeEnd("ctx");
  25193. })));
  25194. $7=_st($2)._yourself();
  25195. $1=$7;
  25196. return $1;
  25197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25198. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},globals.Package)});
  25199. //>>excludeEnd("ctx");
  25200. },
  25201. //>>excludeStart("ide", pragmas.excludeIdeData);
  25202. args: [],
  25203. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
  25204. referencedClasses: ["Smalltalk"],
  25205. //>>excludeEnd("ide");
  25206. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  25207. }),
  25208. globals.Package);
  25209. smalltalk.addMethod(
  25210. smalltalk.method({
  25211. selector: "name",
  25212. protocol: 'accessing',
  25213. fn: function (){
  25214. var self=this;
  25215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25216. return smalltalk.withContext(function($ctx1) {
  25217. //>>excludeEnd("ctx");
  25218. return self.pkgName;
  25219. return self;
  25220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25221. }, function($ctx1) {$ctx1.fill(self,"name",{},globals.Package)});
  25222. //>>excludeEnd("ctx");
  25223. },
  25224. //>>excludeStart("ide", pragmas.excludeIdeData);
  25225. args: [],
  25226. source: "name\x0a\x09<return self.pkgName>",
  25227. referencedClasses: [],
  25228. //>>excludeEnd("ide");
  25229. messageSends: []
  25230. }),
  25231. globals.Package);
  25232. smalltalk.addMethod(
  25233. smalltalk.method({
  25234. selector: "name:",
  25235. protocol: 'accessing',
  25236. fn: function (aString){
  25237. var self=this;
  25238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25239. return smalltalk.withContext(function($ctx1) {
  25240. //>>excludeEnd("ctx");
  25241. self._basicName_(aString);
  25242. self._beDirty();
  25243. return self;
  25244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25245. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},globals.Package)});
  25246. //>>excludeEnd("ctx");
  25247. },
  25248. //>>excludeStart("ide", pragmas.excludeIdeData);
  25249. args: ["aString"],
  25250. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  25251. referencedClasses: [],
  25252. //>>excludeEnd("ide");
  25253. messageSends: ["basicName:", "beDirty"]
  25254. }),
  25255. globals.Package);
  25256. smalltalk.addMethod(
  25257. smalltalk.method({
  25258. selector: "organization",
  25259. protocol: 'accessing',
  25260. fn: function (){
  25261. var self=this;
  25262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25263. return smalltalk.withContext(function($ctx1) {
  25264. //>>excludeEnd("ctx");
  25265. var $1;
  25266. $1=self._basicAt_("organization");
  25267. return $1;
  25268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25269. }, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Package)});
  25270. //>>excludeEnd("ctx");
  25271. },
  25272. //>>excludeStart("ide", pragmas.excludeIdeData);
  25273. args: [],
  25274. source: "organization\x0a\x09^ self basicAt: 'organization'",
  25275. referencedClasses: [],
  25276. //>>excludeEnd("ide");
  25277. messageSends: ["basicAt:"]
  25278. }),
  25279. globals.Package);
  25280. smalltalk.addMethod(
  25281. smalltalk.method({
  25282. selector: "printOn:",
  25283. protocol: 'printing',
  25284. fn: function (aStream){
  25285. var self=this;
  25286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25287. return smalltalk.withContext(function($ctx1) {
  25288. //>>excludeEnd("ctx");
  25289. var $1;
  25290. (
  25291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25292. $ctx1.supercall = true,
  25293. //>>excludeEnd("ctx");
  25294. globals.Package.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  25295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25296. $ctx1.supercall = false;
  25297. //>>excludeEnd("ctx");;
  25298. _st(aStream)._nextPutAll_(" (");
  25299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25300. $ctx1.sendIdx["nextPutAll:"]=1;
  25301. //>>excludeEnd("ctx");
  25302. _st(aStream)._nextPutAll_(self._name());
  25303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25304. $ctx1.sendIdx["nextPutAll:"]=2;
  25305. //>>excludeEnd("ctx");
  25306. $1=_st(aStream)._nextPutAll_(")");
  25307. return self;
  25308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25309. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Package)});
  25310. //>>excludeEnd("ctx");
  25311. },
  25312. //>>excludeStart("ide", pragmas.excludeIdeData);
  25313. args: ["aStream"],
  25314. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  25315. referencedClasses: [],
  25316. //>>excludeEnd("ide");
  25317. messageSends: ["printOn:", "nextPutAll:", "name"]
  25318. }),
  25319. globals.Package);
  25320. smalltalk.addMethod(
  25321. smalltalk.method({
  25322. selector: "setupClasses",
  25323. protocol: 'classes',
  25324. fn: function (){
  25325. var self=this;
  25326. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  25327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25328. return smalltalk.withContext(function($ctx1) {
  25329. //>>excludeEnd("ctx");
  25330. var $1,$2;
  25331. $1=self._classes();
  25332. _st($1)._do_((function(each){
  25333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25334. return smalltalk.withContext(function($ctx2) {
  25335. //>>excludeEnd("ctx");
  25336. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  25337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25339. //>>excludeEnd("ctx");
  25340. }));
  25341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25342. $ctx1.sendIdx["do:"]=1;
  25343. //>>excludeEnd("ctx");
  25344. $2=_st($1)._do_((function(each){
  25345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25346. return smalltalk.withContext(function($ctx2) {
  25347. //>>excludeEnd("ctx");
  25348. return _st(each)._initialize();
  25349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  25351. //>>excludeEnd("ctx");
  25352. }));
  25353. return self;
  25354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25355. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},globals.Package)});
  25356. //>>excludeEnd("ctx");
  25357. },
  25358. //>>excludeStart("ide", pragmas.excludeIdeData);
  25359. args: [],
  25360. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  25361. referencedClasses: ["ClassBuilder"],
  25362. //>>excludeEnd("ide");
  25363. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  25364. }),
  25365. globals.Package);
  25366. smalltalk.addMethod(
  25367. smalltalk.method({
  25368. selector: "sortedClasses",
  25369. protocol: 'classes',
  25370. fn: function (){
  25371. var self=this;
  25372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25373. return smalltalk.withContext(function($ctx1) {
  25374. //>>excludeEnd("ctx");
  25375. var $1;
  25376. $1=_st(self._class())._sortedClasses_(self._classes());
  25377. return $1;
  25378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25379. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},globals.Package)});
  25380. //>>excludeEnd("ctx");
  25381. },
  25382. //>>excludeStart("ide", pragmas.excludeIdeData);
  25383. args: [],
  25384. 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",
  25385. referencedClasses: [],
  25386. //>>excludeEnd("ide");
  25387. messageSends: ["sortedClasses:", "class", "classes"]
  25388. }),
  25389. globals.Package);
  25390. smalltalk.addMethod(
  25391. smalltalk.method({
  25392. selector: "transport",
  25393. protocol: 'accessing',
  25394. fn: function (){
  25395. var self=this;
  25396. function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  25397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25398. return smalltalk.withContext(function($ctx1) {
  25399. //>>excludeEnd("ctx");
  25400. var $2,$3,$4,$1,$receiver;
  25401. $2=self["@transport"];
  25402. if(($receiver = $2) == null || $receiver.isNil){
  25403. $3=_st($PackageTransport())._fromJson_(self._basicTransport());
  25404. _st($3)._package_(self);
  25405. $4=_st($3)._yourself();
  25406. self["@transport"]=$4;
  25407. $1=self["@transport"];
  25408. } else {
  25409. $1=$2;
  25410. };
  25411. return $1;
  25412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25413. }, function($ctx1) {$ctx1.fill(self,"transport",{},globals.Package)});
  25414. //>>excludeEnd("ctx");
  25415. },
  25416. //>>excludeStart("ide", pragmas.excludeIdeData);
  25417. args: [],
  25418. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  25419. referencedClasses: ["PackageTransport"],
  25420. //>>excludeEnd("ide");
  25421. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  25422. }),
  25423. globals.Package);
  25424. smalltalk.addMethod(
  25425. smalltalk.method({
  25426. selector: "transport:",
  25427. protocol: 'accessing',
  25428. fn: function (aPackageTransport){
  25429. var self=this;
  25430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25431. return smalltalk.withContext(function($ctx1) {
  25432. //>>excludeEnd("ctx");
  25433. self["@transport"]=aPackageTransport;
  25434. _st(aPackageTransport)._package_(self);
  25435. return self;
  25436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25437. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},globals.Package)});
  25438. //>>excludeEnd("ctx");
  25439. },
  25440. //>>excludeStart("ide", pragmas.excludeIdeData);
  25441. args: ["aPackageTransport"],
  25442. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  25443. referencedClasses: [],
  25444. //>>excludeEnd("ide");
  25445. messageSends: ["package:"]
  25446. }),
  25447. globals.Package);
  25448. globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  25449. smalltalk.addMethod(
  25450. smalltalk.method({
  25451. selector: "named:",
  25452. protocol: 'accessing',
  25453. fn: function (aPackageName){
  25454. var self=this;
  25455. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  25456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25457. return smalltalk.withContext(function($ctx1) {
  25458. //>>excludeEnd("ctx");
  25459. var $1;
  25460. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  25461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25462. return smalltalk.withContext(function($ctx2) {
  25463. //>>excludeEnd("ctx");
  25464. return _st($Smalltalk())._createPackage_(aPackageName);
  25465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25467. //>>excludeEnd("ctx");
  25468. }));
  25469. return $1;
  25470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25471. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},globals.Package.klass)});
  25472. //>>excludeEnd("ctx");
  25473. },
  25474. //>>excludeStart("ide", pragmas.excludeIdeData);
  25475. args: ["aPackageName"],
  25476. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  25477. referencedClasses: ["Smalltalk"],
  25478. //>>excludeEnd("ide");
  25479. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  25480. }),
  25481. globals.Package.klass);
  25482. smalltalk.addMethod(
  25483. smalltalk.method({
  25484. selector: "named:ifAbsent:",
  25485. protocol: 'accessing',
  25486. fn: function (aPackageName,aBlock){
  25487. var self=this;
  25488. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  25489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25490. return smalltalk.withContext(function($ctx1) {
  25491. //>>excludeEnd("ctx");
  25492. var $1;
  25493. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  25494. return $1;
  25495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25496. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},globals.Package.klass)});
  25497. //>>excludeEnd("ctx");
  25498. },
  25499. //>>excludeStart("ide", pragmas.excludeIdeData);
  25500. args: ["aPackageName", "aBlock"],
  25501. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  25502. referencedClasses: ["Smalltalk"],
  25503. //>>excludeEnd("ide");
  25504. messageSends: ["packageAt:ifAbsent:"]
  25505. }),
  25506. globals.Package.klass);
  25507. smalltalk.addMethod(
  25508. smalltalk.method({
  25509. selector: "named:transport:",
  25510. protocol: 'accessing',
  25511. fn: function (aPackageName,aTransport){
  25512. var self=this;
  25513. var package_;
  25514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25515. return smalltalk.withContext(function($ctx1) {
  25516. //>>excludeEnd("ctx");
  25517. var $1;
  25518. package_=self._named_(aPackageName);
  25519. _st(package_)._transport_(aTransport);
  25520. $1=package_;
  25521. return $1;
  25522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25523. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},globals.Package.klass)});
  25524. //>>excludeEnd("ctx");
  25525. },
  25526. //>>excludeStart("ide", pragmas.excludeIdeData);
  25527. args: ["aPackageName", "aTransport"],
  25528. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  25529. referencedClasses: [],
  25530. //>>excludeEnd("ide");
  25531. messageSends: ["named:", "transport:"]
  25532. }),
  25533. globals.Package.klass);
  25534. smalltalk.addMethod(
  25535. smalltalk.method({
  25536. selector: "sortedClasses:",
  25537. protocol: 'sorting',
  25538. fn: function (classes){
  25539. var self=this;
  25540. var children,others,nodes,expandedClasses;
  25541. function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  25542. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  25543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25544. return smalltalk.withContext(function($ctx1) {
  25545. //>>excludeEnd("ctx");
  25546. var $1,$3,$2,$4;
  25547. children=[];
  25548. others=[];
  25549. _st(classes)._do_((function(each){
  25550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25551. return smalltalk.withContext(function($ctx2) {
  25552. //>>excludeEnd("ctx");
  25553. $1=_st(classes)._includes_(_st(each)._superclass());
  25554. if(smalltalk.assert($1)){
  25555. return _st(others)._add_(each);
  25556. } else {
  25557. return _st(children)._add_(each);
  25558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25559. $ctx2.sendIdx["add:"]=1;
  25560. //>>excludeEnd("ctx");
  25561. };
  25562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25564. //>>excludeEnd("ctx");
  25565. }));
  25566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25567. $ctx1.sendIdx["do:"]=1;
  25568. //>>excludeEnd("ctx");
  25569. nodes=_st(children)._collect_((function(each){
  25570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25571. return smalltalk.withContext(function($ctx2) {
  25572. //>>excludeEnd("ctx");
  25573. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  25574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  25576. //>>excludeEnd("ctx");
  25577. }));
  25578. nodes=_st(nodes)._sorted_((function(a,b){
  25579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25580. return smalltalk.withContext(function($ctx2) {
  25581. //>>excludeEnd("ctx");
  25582. $3=_st(a)._theClass();
  25583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25584. $ctx2.sendIdx["theClass"]=1;
  25585. //>>excludeEnd("ctx");
  25586. $2=_st($3)._name();
  25587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25588. $ctx2.sendIdx["name"]=1;
  25589. //>>excludeEnd("ctx");
  25590. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  25591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25592. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  25593. //>>excludeEnd("ctx");
  25594. }));
  25595. expandedClasses=_st($Array())._new();
  25596. _st(nodes)._do_((function(aNode){
  25597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25598. return smalltalk.withContext(function($ctx2) {
  25599. //>>excludeEnd("ctx");
  25600. return _st(aNode)._traverseClassesWith_(expandedClasses);
  25601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25602. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  25603. //>>excludeEnd("ctx");
  25604. }));
  25605. $4=expandedClasses;
  25606. return $4;
  25607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25608. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},globals.Package.klass)});
  25609. //>>excludeEnd("ctx");
  25610. },
  25611. //>>excludeStart("ide", pragmas.excludeIdeData);
  25612. args: ["classes"],
  25613. 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",
  25614. referencedClasses: ["ClassSorterNode", "Array"],
  25615. //>>excludeEnd("ide");
  25616. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  25617. }),
  25618. globals.Package.klass);
  25619. smalltalk.addClass('PackageStateObserver', globals.Object, [], 'Kernel-Infrastructure');
  25620. //>>excludeStart("ide", pragmas.excludeIdeData);
  25621. globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  25622. //>>excludeEnd("ide");
  25623. smalltalk.addMethod(
  25624. smalltalk.method({
  25625. selector: "announcer",
  25626. protocol: 'accessing',
  25627. fn: function (){
  25628. var self=this;
  25629. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  25630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25631. return smalltalk.withContext(function($ctx1) {
  25632. //>>excludeEnd("ctx");
  25633. var $1;
  25634. $1=_st($SystemAnnouncer())._current();
  25635. return $1;
  25636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25637. }, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.PackageStateObserver)});
  25638. //>>excludeEnd("ctx");
  25639. },
  25640. //>>excludeStart("ide", pragmas.excludeIdeData);
  25641. args: [],
  25642. source: "announcer\x0a\x09^ SystemAnnouncer current",
  25643. referencedClasses: ["SystemAnnouncer"],
  25644. //>>excludeEnd("ide");
  25645. messageSends: ["current"]
  25646. }),
  25647. globals.PackageStateObserver);
  25648. smalltalk.addMethod(
  25649. smalltalk.method({
  25650. selector: "observeSystem",
  25651. protocol: 'actions',
  25652. fn: function (){
  25653. var self=this;
  25654. function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  25655. function $ClassAnnouncement(){return globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
  25656. function $MethodAnnouncement(){return globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
  25657. function $ProtocolAnnouncement(){return globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
  25658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25659. return smalltalk.withContext(function($ctx1) {
  25660. //>>excludeEnd("ctx");
  25661. var $1,$2;
  25662. $1=self._announcer();
  25663. _st($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
  25664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25665. $ctx1.sendIdx["on:send:to:"]=1;
  25666. //>>excludeEnd("ctx");
  25667. _st($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
  25668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25669. $ctx1.sendIdx["on:send:to:"]=2;
  25670. //>>excludeEnd("ctx");
  25671. _st($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
  25672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25673. $ctx1.sendIdx["on:send:to:"]=3;
  25674. //>>excludeEnd("ctx");
  25675. $2=_st($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
  25676. return self;
  25677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25678. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.PackageStateObserver)});
  25679. //>>excludeEnd("ctx");
  25680. },
  25681. //>>excludeStart("ide", pragmas.excludeIdeData);
  25682. args: [],
  25683. source: "observeSystem\x0a\x09self announcer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassAnnouncement\x0a\x09\x09send: #onClassModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodAnnouncement\x0a\x09\x09send: #onMethodModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolAnnouncement\x0a\x09\x09send: #onProtocolModification:\x0a\x09\x09to: self",
  25684. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  25685. //>>excludeEnd("ide");
  25686. messageSends: ["on:send:to:", "announcer"]
  25687. }),
  25688. globals.PackageStateObserver);
  25689. smalltalk.addMethod(
  25690. smalltalk.method({
  25691. selector: "onClassModification:",
  25692. protocol: 'reactions',
  25693. fn: function (anAnnouncement){
  25694. var self=this;
  25695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25696. return smalltalk.withContext(function($ctx1) {
  25697. //>>excludeEnd("ctx");
  25698. var $1,$receiver;
  25699. $1=_st(anAnnouncement)._theClass();
  25700. if(($receiver = $1) == null || $receiver.isNil){
  25701. $1;
  25702. } else {
  25703. var theClass;
  25704. theClass=$receiver;
  25705. _st(_st(theClass)._package())._beDirty();
  25706. };
  25707. return self;
  25708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25709. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)});
  25710. //>>excludeEnd("ctx");
  25711. },
  25712. //>>excludeStart("ide", pragmas.excludeIdeData);
  25713. args: ["anAnnouncement"],
  25714. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  25715. referencedClasses: [],
  25716. //>>excludeEnd("ide");
  25717. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  25718. }),
  25719. globals.PackageStateObserver);
  25720. smalltalk.addMethod(
  25721. smalltalk.method({
  25722. selector: "onMethodModification:",
  25723. protocol: 'reactions',
  25724. fn: function (anAnnouncement){
  25725. var self=this;
  25726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25727. return smalltalk.withContext(function($ctx1) {
  25728. //>>excludeEnd("ctx");
  25729. var $1,$receiver;
  25730. $1=_st(_st(anAnnouncement)._method())._package();
  25731. if(($receiver = $1) == null || $receiver.isNil){
  25732. $1;
  25733. } else {
  25734. var package_;
  25735. package_=$receiver;
  25736. _st(package_)._beDirty();
  25737. };
  25738. return self;
  25739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25740. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)});
  25741. //>>excludeEnd("ctx");
  25742. },
  25743. //>>excludeStart("ide", pragmas.excludeIdeData);
  25744. args: ["anAnnouncement"],
  25745. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  25746. referencedClasses: [],
  25747. //>>excludeEnd("ide");
  25748. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  25749. }),
  25750. globals.PackageStateObserver);
  25751. smalltalk.addMethod(
  25752. smalltalk.method({
  25753. selector: "onPackageAdded:",
  25754. protocol: 'reactions',
  25755. fn: function (anAnnouncement){
  25756. var self=this;
  25757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25758. return smalltalk.withContext(function($ctx1) {
  25759. //>>excludeEnd("ctx");
  25760. _st(_st(anAnnouncement)._package())._beDirty();
  25761. return self;
  25762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25763. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)});
  25764. //>>excludeEnd("ctx");
  25765. },
  25766. //>>excludeStart("ide", pragmas.excludeIdeData);
  25767. args: ["anAnnouncement"],
  25768. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  25769. referencedClasses: [],
  25770. //>>excludeEnd("ide");
  25771. messageSends: ["beDirty", "package"]
  25772. }),
  25773. globals.PackageStateObserver);
  25774. smalltalk.addMethod(
  25775. smalltalk.method({
  25776. selector: "onProtocolModification:",
  25777. protocol: 'reactions',
  25778. fn: function (anAnnouncement){
  25779. var self=this;
  25780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25781. return smalltalk.withContext(function($ctx1) {
  25782. //>>excludeEnd("ctx");
  25783. var $1,$receiver;
  25784. $1=_st(anAnnouncement)._package();
  25785. if(($receiver = $1) == null || $receiver.isNil){
  25786. $1;
  25787. } else {
  25788. var package_;
  25789. package_=$receiver;
  25790. _st(package_)._beDirty();
  25791. };
  25792. return self;
  25793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25794. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)});
  25795. //>>excludeEnd("ctx");
  25796. },
  25797. //>>excludeStart("ide", pragmas.excludeIdeData);
  25798. args: ["anAnnouncement"],
  25799. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  25800. referencedClasses: [],
  25801. //>>excludeEnd("ide");
  25802. messageSends: ["ifNotNil:", "package", "beDirty"]
  25803. }),
  25804. globals.PackageStateObserver);
  25805. globals.PackageStateObserver.klass.iVarNames = ['current'];
  25806. smalltalk.addMethod(
  25807. smalltalk.method({
  25808. selector: "current",
  25809. protocol: 'accessing',
  25810. fn: function (){
  25811. var self=this;
  25812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25813. return smalltalk.withContext(function($ctx1) {
  25814. //>>excludeEnd("ctx");
  25815. var $2,$1,$receiver;
  25816. $2=self["@current"];
  25817. if(($receiver = $2) == null || $receiver.isNil){
  25818. self["@current"]=self._new();
  25819. $1=self["@current"];
  25820. } else {
  25821. $1=$2;
  25822. };
  25823. return $1;
  25824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25825. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.PackageStateObserver.klass)});
  25826. //>>excludeEnd("ctx");
  25827. },
  25828. //>>excludeStart("ide", pragmas.excludeIdeData);
  25829. args: [],
  25830. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  25831. referencedClasses: [],
  25832. //>>excludeEnd("ide");
  25833. messageSends: ["ifNil:", "new"]
  25834. }),
  25835. globals.PackageStateObserver.klass);
  25836. smalltalk.addMethod(
  25837. smalltalk.method({
  25838. selector: "initialize",
  25839. protocol: 'initialization',
  25840. fn: function (){
  25841. var self=this;
  25842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25843. return smalltalk.withContext(function($ctx1) {
  25844. //>>excludeEnd("ctx");
  25845. _st(self._current())._observeSystem();
  25846. return self;
  25847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25848. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.PackageStateObserver.klass)});
  25849. //>>excludeEnd("ctx");
  25850. },
  25851. //>>excludeStart("ide", pragmas.excludeIdeData);
  25852. args: [],
  25853. source: "initialize\x0a\x09self current observeSystem",
  25854. referencedClasses: [],
  25855. //>>excludeEnd("ide");
  25856. messageSends: ["observeSystem", "current"]
  25857. }),
  25858. globals.PackageStateObserver.klass);
  25859. smalltalk.addClass('PlatformInterface', globals.Object, [], 'Kernel-Infrastructure');
  25860. //>>excludeStart("ide", pragmas.excludeIdeData);
  25861. globals.PlatformInterface.comment="I am single entry point to UI and environment interface.\x0aMy `initialize` tries several options (for now, browser environment only) to set myself up.\x0a\x0a## API\x0a\x0a PlatformInterface alert: 'Hey, there is a problem'.\x0a PlatformInterface confirm: 'Affirmative?'.\x0a PlatformInterface prompt: 'Your name:'.\x0a\x0a PlatformInterface ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  25862. //>>excludeEnd("ide");
  25863. globals.PlatformInterface.klass.iVarNames = ['worker'];
  25864. smalltalk.addMethod(
  25865. smalltalk.method({
  25866. selector: "ajax:",
  25867. protocol: 'actions',
  25868. fn: function (anObject){
  25869. var self=this;
  25870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25871. return smalltalk.withContext(function($ctx1) {
  25872. //>>excludeEnd("ctx");
  25873. var $2,$1,$receiver;
  25874. $2=self["@worker"];
  25875. if(($receiver = $2) == null || $receiver.isNil){
  25876. $1=self._error_("ajax: not available");
  25877. } else {
  25878. $1=_st(self["@worker"])._ajax_(anObject);
  25879. };
  25880. return $1;
  25881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25882. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.PlatformInterface.klass)});
  25883. //>>excludeEnd("ctx");
  25884. },
  25885. //>>excludeStart("ide", pragmas.excludeIdeData);
  25886. args: ["anObject"],
  25887. source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
  25888. referencedClasses: [],
  25889. //>>excludeEnd("ide");
  25890. messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"]
  25891. }),
  25892. globals.PlatformInterface.klass);
  25893. smalltalk.addMethod(
  25894. smalltalk.method({
  25895. selector: "alert:",
  25896. protocol: 'actions',
  25897. fn: function (aString){
  25898. var self=this;
  25899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25900. return smalltalk.withContext(function($ctx1) {
  25901. //>>excludeEnd("ctx");
  25902. var $2,$1,$receiver;
  25903. $2=self["@worker"];
  25904. if(($receiver = $2) == null || $receiver.isNil){
  25905. $1=self._error_("alert: not available");
  25906. } else {
  25907. $1=_st(self["@worker"])._alert_(aString);
  25908. };
  25909. return $1;
  25910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25911. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.PlatformInterface.klass)});
  25912. //>>excludeEnd("ctx");
  25913. },
  25914. //>>excludeStart("ide", pragmas.excludeIdeData);
  25915. args: ["aString"],
  25916. source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
  25917. referencedClasses: [],
  25918. //>>excludeEnd("ide");
  25919. messageSends: ["ifNotNil:ifNil:", "alert:", "error:"]
  25920. }),
  25921. globals.PlatformInterface.klass);
  25922. smalltalk.addMethod(
  25923. smalltalk.method({
  25924. selector: "confirm:",
  25925. protocol: 'actions',
  25926. fn: function (aString){
  25927. var self=this;
  25928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25929. return smalltalk.withContext(function($ctx1) {
  25930. //>>excludeEnd("ctx");
  25931. var $2,$1,$receiver;
  25932. $2=self["@worker"];
  25933. if(($receiver = $2) == null || $receiver.isNil){
  25934. $1=self._error_("confirm: not available");
  25935. } else {
  25936. $1=_st(self["@worker"])._confirm_(aString);
  25937. };
  25938. return $1;
  25939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25940. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.PlatformInterface.klass)});
  25941. //>>excludeEnd("ctx");
  25942. },
  25943. //>>excludeStart("ide", pragmas.excludeIdeData);
  25944. args: ["aString"],
  25945. source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
  25946. referencedClasses: [],
  25947. //>>excludeEnd("ide");
  25948. messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"]
  25949. }),
  25950. globals.PlatformInterface.klass);
  25951. smalltalk.addMethod(
  25952. smalltalk.method({
  25953. selector: "existsGlobal:",
  25954. protocol: 'actions',
  25955. fn: function (aString){
  25956. var self=this;
  25957. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  25958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25959. return smalltalk.withContext(function($ctx1) {
  25960. //>>excludeEnd("ctx");
  25961. var $1;
  25962. $1=_st(_st($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  25963. return true;
  25964. }),(function(){
  25965. return false;
  25966. }));
  25967. return $1;
  25968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25969. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},globals.PlatformInterface.klass)});
  25970. //>>excludeEnd("ctx");
  25971. },
  25972. //>>excludeStart("ide", pragmas.excludeIdeData);
  25973. args: ["aString"],
  25974. source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  25975. referencedClasses: ["PlatformInterface"],
  25976. //>>excludeEnd("ide");
  25977. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  25978. }),
  25979. globals.PlatformInterface.klass);
  25980. smalltalk.addMethod(
  25981. smalltalk.method({
  25982. selector: "globals",
  25983. protocol: 'accessing',
  25984. fn: function (){
  25985. var self=this;
  25986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25987. return smalltalk.withContext(function($ctx1) {
  25988. //>>excludeEnd("ctx");
  25989. return (new Function('return this'))();;
  25990. return self;
  25991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25992. }, function($ctx1) {$ctx1.fill(self,"globals",{},globals.PlatformInterface.klass)});
  25993. //>>excludeEnd("ctx");
  25994. },
  25995. //>>excludeStart("ide", pragmas.excludeIdeData);
  25996. args: [],
  25997. source: "globals\x0a\x09<return (new Function('return this'))();>",
  25998. referencedClasses: [],
  25999. //>>excludeEnd("ide");
  26000. messageSends: []
  26001. }),
  26002. globals.PlatformInterface.klass);
  26003. smalltalk.addMethod(
  26004. smalltalk.method({
  26005. selector: "initialize",
  26006. protocol: 'initialization',
  26007. fn: function (){
  26008. var self=this;
  26009. var candidate;
  26010. function $BrowserInterface(){return globals.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
  26011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26012. return smalltalk.withContext(function($ctx1) {
  26013. //>>excludeEnd("ctx");
  26014. var $1,$receiver;
  26015. (
  26016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26017. $ctx1.supercall = true,
  26018. //>>excludeEnd("ctx");
  26019. globals.PlatformInterface.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
  26020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26021. $ctx1.supercall = false;
  26022. //>>excludeEnd("ctx");;
  26023. if(($receiver = $BrowserInterface()) == null || $receiver.isNil){
  26024. $BrowserInterface();
  26025. } else {
  26026. candidate=_st($BrowserInterface())._new();
  26027. candidate;
  26028. $1=_st(candidate)._isAvailable();
  26029. if(smalltalk.assert($1)){
  26030. self._setWorker_(candidate);
  26031. return self;
  26032. };
  26033. };
  26034. return self;
  26035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26036. }, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},globals.PlatformInterface.klass)});
  26037. //>>excludeEnd("ctx");
  26038. },
  26039. //>>excludeStart("ide", pragmas.excludeIdeData);
  26040. args: [],
  26041. source: "initialize\x0a\x09| candidate |\x0a\x09\x0a\x09super initialize.\x0a\x09\x0a\x09BrowserInterface ifNotNil: [\x0a\x09\x09candidate := BrowserInterface new.\x0a\x09\x09candidate isAvailable ifTrue: [ self setWorker: candidate. ^ self ]\x0a\x09]",
  26042. referencedClasses: ["BrowserInterface"],
  26043. //>>excludeEnd("ide");
  26044. messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"]
  26045. }),
  26046. globals.PlatformInterface.klass);
  26047. smalltalk.addMethod(
  26048. smalltalk.method({
  26049. selector: "prompt:",
  26050. protocol: 'actions',
  26051. fn: function (aString){
  26052. var self=this;
  26053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26054. return smalltalk.withContext(function($ctx1) {
  26055. //>>excludeEnd("ctx");
  26056. var $2,$1,$receiver;
  26057. $2=self["@worker"];
  26058. if(($receiver = $2) == null || $receiver.isNil){
  26059. $1=self._error_("prompt: not available");
  26060. } else {
  26061. $1=_st(self["@worker"])._prompt_(aString);
  26062. };
  26063. return $1;
  26064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26065. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.PlatformInterface.klass)});
  26066. //>>excludeEnd("ctx");
  26067. },
  26068. //>>excludeStart("ide", pragmas.excludeIdeData);
  26069. args: ["aString"],
  26070. source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  26071. referencedClasses: [],
  26072. //>>excludeEnd("ide");
  26073. messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"]
  26074. }),
  26075. globals.PlatformInterface.klass);
  26076. smalltalk.addMethod(
  26077. smalltalk.method({
  26078. selector: "prompt:default:",
  26079. protocol: 'actions',
  26080. fn: function (aString,defaultString){
  26081. var self=this;
  26082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26083. return smalltalk.withContext(function($ctx1) {
  26084. //>>excludeEnd("ctx");
  26085. var $2,$1,$receiver;
  26086. $2=self["@worker"];
  26087. if(($receiver = $2) == null || $receiver.isNil){
  26088. $1=self._error_("prompt: not available");
  26089. } else {
  26090. $1=_st(self["@worker"])._prompt_default_(aString,defaultString);
  26091. };
  26092. return $1;
  26093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26094. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},globals.PlatformInterface.klass)});
  26095. //>>excludeEnd("ctx");
  26096. },
  26097. //>>excludeStart("ide", pragmas.excludeIdeData);
  26098. args: ["aString", "defaultString"],
  26099. source: "prompt: aString default: defaultString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString default: defaultString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  26100. referencedClasses: [],
  26101. //>>excludeEnd("ide");
  26102. messageSends: ["ifNotNil:ifNil:", "prompt:default:", "error:"]
  26103. }),
  26104. globals.PlatformInterface.klass);
  26105. smalltalk.addMethod(
  26106. smalltalk.method({
  26107. selector: "setWorker:",
  26108. protocol: 'accessing',
  26109. fn: function (anObject){
  26110. var self=this;
  26111. self["@worker"]=anObject;
  26112. return self;
  26113. },
  26114. //>>excludeStart("ide", pragmas.excludeIdeData);
  26115. args: ["anObject"],
  26116. source: "setWorker: anObject\x0a\x09worker := anObject",
  26117. referencedClasses: [],
  26118. //>>excludeEnd("ide");
  26119. messageSends: []
  26120. }),
  26121. globals.PlatformInterface.klass);
  26122. smalltalk.addClass('Service', globals.Object, [], 'Kernel-Infrastructure');
  26123. //>>excludeStart("ide", pragmas.excludeIdeData);
  26124. globals.Service.comment="I implement the basic behavior for class registration to a service.\x0a\x0aSee the `Transcript` class for a concrete service.\x0a\x0a## API\x0a\x0aUse class-side methods `#register:` and `#registerIfNone:` to register classes to a specific service.";
  26125. //>>excludeEnd("ide");
  26126. globals.Service.klass.iVarNames = ['current'];
  26127. smalltalk.addMethod(
  26128. smalltalk.method({
  26129. selector: "current",
  26130. protocol: 'accessing',
  26131. fn: function (){
  26132. var self=this;
  26133. var $1;
  26134. $1=self["@current"];
  26135. return $1;
  26136. },
  26137. //>>excludeStart("ide", pragmas.excludeIdeData);
  26138. args: [],
  26139. source: "current\x0a\x09^ current",
  26140. referencedClasses: [],
  26141. //>>excludeEnd("ide");
  26142. messageSends: []
  26143. }),
  26144. globals.Service.klass);
  26145. smalltalk.addMethod(
  26146. smalltalk.method({
  26147. selector: "new",
  26148. protocol: 'instance creation',
  26149. fn: function (){
  26150. var self=this;
  26151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26152. return smalltalk.withContext(function($ctx1) {
  26153. //>>excludeEnd("ctx");
  26154. self._shouldNotImplement();
  26155. return self;
  26156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26157. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.Service.klass)});
  26158. //>>excludeEnd("ctx");
  26159. },
  26160. //>>excludeStart("ide", pragmas.excludeIdeData);
  26161. args: [],
  26162. source: "new\x0a\x09self shouldNotImplement",
  26163. referencedClasses: [],
  26164. //>>excludeEnd("ide");
  26165. messageSends: ["shouldNotImplement"]
  26166. }),
  26167. globals.Service.klass);
  26168. smalltalk.addMethod(
  26169. smalltalk.method({
  26170. selector: "register:",
  26171. protocol: 'registration',
  26172. fn: function (anObject){
  26173. var self=this;
  26174. self["@current"]=anObject;
  26175. return self;
  26176. },
  26177. //>>excludeStart("ide", pragmas.excludeIdeData);
  26178. args: ["anObject"],
  26179. source: "register: anObject\x0a\x09current := anObject",
  26180. referencedClasses: [],
  26181. //>>excludeEnd("ide");
  26182. messageSends: []
  26183. }),
  26184. globals.Service.klass);
  26185. smalltalk.addMethod(
  26186. smalltalk.method({
  26187. selector: "registerIfNone:",
  26188. protocol: 'registration',
  26189. fn: function (anObject){
  26190. var self=this;
  26191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26192. return smalltalk.withContext(function($ctx1) {
  26193. //>>excludeEnd("ctx");
  26194. var $1,$receiver;
  26195. $1=self._current();
  26196. if(($receiver = $1) == null || $receiver.isNil){
  26197. self._register_(anObject);
  26198. } else {
  26199. $1;
  26200. };
  26201. return self;
  26202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26203. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},globals.Service.klass)});
  26204. //>>excludeEnd("ctx");
  26205. },
  26206. //>>excludeStart("ide", pragmas.excludeIdeData);
  26207. args: ["anObject"],
  26208. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26209. referencedClasses: [],
  26210. //>>excludeEnd("ide");
  26211. messageSends: ["ifNil:", "current", "register:"]
  26212. }),
  26213. globals.Service.klass);
  26214. smalltalk.addClass('ErrorHandler', globals.Service, [], 'Kernel-Infrastructure');
  26215. //>>excludeStart("ide", pragmas.excludeIdeData);
  26216. globals.ErrorHandler.comment="I am the service used to handle Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aRegistered service instances must implement `#handleError:` to perform an action on the thrown exception.";
  26217. //>>excludeEnd("ide");
  26218. smalltalk.addMethod(
  26219. smalltalk.method({
  26220. selector: "handleError:",
  26221. protocol: 'error handling',
  26222. fn: function (anError){
  26223. var self=this;
  26224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26225. return smalltalk.withContext(function($ctx1) {
  26226. //>>excludeEnd("ctx");
  26227. self._handleUnhandledError_(anError);
  26228. return self;
  26229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26230. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ErrorHandler.klass)});
  26231. //>>excludeEnd("ctx");
  26232. },
  26233. //>>excludeStart("ide", pragmas.excludeIdeData);
  26234. args: ["anError"],
  26235. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  26236. referencedClasses: [],
  26237. //>>excludeEnd("ide");
  26238. messageSends: ["handleUnhandledError:"]
  26239. }),
  26240. globals.ErrorHandler.klass);
  26241. smalltalk.addMethod(
  26242. smalltalk.method({
  26243. selector: "handleUnhandledError:",
  26244. protocol: 'error handling',
  26245. fn: function (anError){
  26246. var self=this;
  26247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26248. return smalltalk.withContext(function($ctx1) {
  26249. //>>excludeEnd("ctx");
  26250. var $1,$2;
  26251. $1=_st(anError)._wasHandled();
  26252. if(smalltalk.assert($1)){
  26253. return self;
  26254. };
  26255. $2=_st(self._current())._handleError_(anError);
  26256. return $2;
  26257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26258. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},globals.ErrorHandler.klass)});
  26259. //>>excludeEnd("ctx");
  26260. },
  26261. //>>excludeStart("ide", pragmas.excludeIdeData);
  26262. args: ["anError"],
  26263. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  26264. referencedClasses: [],
  26265. //>>excludeEnd("ide");
  26266. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  26267. }),
  26268. globals.ErrorHandler.klass);
  26269. smalltalk.addClass('Finder', globals.Service, [], 'Kernel-Infrastructure');
  26270. //>>excludeStart("ide", pragmas.excludeIdeData);
  26271. globals.Finder.comment="I am the service responsible for finding classes/methods.\x0a__There is no default finder.__\x0a\x0a## API\x0a\x0aUse `#browse` on an object to find it.";
  26272. //>>excludeEnd("ide");
  26273. smalltalk.addMethod(
  26274. smalltalk.method({
  26275. selector: "findClass:",
  26276. protocol: 'finding',
  26277. fn: function (aClass){
  26278. var self=this;
  26279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26280. return smalltalk.withContext(function($ctx1) {
  26281. //>>excludeEnd("ctx");
  26282. var $1;
  26283. $1=_st(self._current())._findClass_(aClass);
  26284. return $1;
  26285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26286. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},globals.Finder.klass)});
  26287. //>>excludeEnd("ctx");
  26288. },
  26289. //>>excludeStart("ide", pragmas.excludeIdeData);
  26290. args: ["aClass"],
  26291. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26292. referencedClasses: [],
  26293. //>>excludeEnd("ide");
  26294. messageSends: ["findClass:", "current"]
  26295. }),
  26296. globals.Finder.klass);
  26297. smalltalk.addMethod(
  26298. smalltalk.method({
  26299. selector: "findMethod:",
  26300. protocol: 'finding',
  26301. fn: function (aCompiledMethod){
  26302. var self=this;
  26303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26304. return smalltalk.withContext(function($ctx1) {
  26305. //>>excludeEnd("ctx");
  26306. var $1;
  26307. $1=_st(self._current())._findMethod_(aCompiledMethod);
  26308. return $1;
  26309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26310. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},globals.Finder.klass)});
  26311. //>>excludeEnd("ctx");
  26312. },
  26313. //>>excludeStart("ide", pragmas.excludeIdeData);
  26314. args: ["aCompiledMethod"],
  26315. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26316. referencedClasses: [],
  26317. //>>excludeEnd("ide");
  26318. messageSends: ["findMethod:", "current"]
  26319. }),
  26320. globals.Finder.klass);
  26321. smalltalk.addMethod(
  26322. smalltalk.method({
  26323. selector: "findString:",
  26324. protocol: 'finding',
  26325. fn: function (aString){
  26326. var self=this;
  26327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26328. return smalltalk.withContext(function($ctx1) {
  26329. //>>excludeEnd("ctx");
  26330. var $1;
  26331. $1=_st(self._current())._findString_(aString);
  26332. return $1;
  26333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26334. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},globals.Finder.klass)});
  26335. //>>excludeEnd("ctx");
  26336. },
  26337. //>>excludeStart("ide", pragmas.excludeIdeData);
  26338. args: ["aString"],
  26339. source: "findString: aString\x0a\x09^ self current findString: aString",
  26340. referencedClasses: [],
  26341. //>>excludeEnd("ide");
  26342. messageSends: ["findString:", "current"]
  26343. }),
  26344. globals.Finder.klass);
  26345. smalltalk.addClass('Inspector', globals.Service, [], 'Kernel-Infrastructure');
  26346. //>>excludeStart("ide", pragmas.excludeIdeData);
  26347. globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26348. //>>excludeEnd("ide");
  26349. smalltalk.addMethod(
  26350. smalltalk.method({
  26351. selector: "inspect:",
  26352. protocol: 'inspecting',
  26353. fn: function (anObject){
  26354. var self=this;
  26355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26356. return smalltalk.withContext(function($ctx1) {
  26357. //>>excludeEnd("ctx");
  26358. var $1;
  26359. $1=_st(self._current())._inspect_(anObject);
  26360. return $1;
  26361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26362. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Inspector.klass)});
  26363. //>>excludeEnd("ctx");
  26364. },
  26365. //>>excludeStart("ide", pragmas.excludeIdeData);
  26366. args: ["anObject"],
  26367. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26368. referencedClasses: [],
  26369. //>>excludeEnd("ide");
  26370. messageSends: ["inspect:", "current"]
  26371. }),
  26372. globals.Inspector.klass);
  26373. smalltalk.addClass('ProgressHandler', globals.Service, [], 'Kernel-Infrastructure');
  26374. //>>excludeStart("ide", pragmas.excludeIdeData);
  26375. globals.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aRegistered instances must implement `#do:on:displaying:`.\x0a\x0aThe default behavior is to simply iterate over the collection, using `NullProgressHandler`.";
  26376. //>>excludeEnd("ide");
  26377. smalltalk.addMethod(
  26378. smalltalk.method({
  26379. selector: "do:on:displaying:",
  26380. protocol: 'progress handling',
  26381. fn: function (aBlock,aCollection,aString){
  26382. var self=this;
  26383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26384. return smalltalk.withContext(function($ctx1) {
  26385. //>>excludeEnd("ctx");
  26386. _st(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26387. return self;
  26388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26389. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.ProgressHandler.klass)});
  26390. //>>excludeEnd("ctx");
  26391. },
  26392. //>>excludeStart("ide", pragmas.excludeIdeData);
  26393. args: ["aBlock", "aCollection", "aString"],
  26394. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26395. referencedClasses: [],
  26396. //>>excludeEnd("ide");
  26397. messageSends: ["do:on:displaying:", "current"]
  26398. }),
  26399. globals.ProgressHandler.klass);
  26400. smalltalk.addClass('Transcript', globals.Service, [], 'Kernel-Infrastructure');
  26401. //>>excludeStart("ide", pragmas.excludeIdeData);
  26402. globals.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a Transcript \x0a show: 'hello world';\x0a cr;\x0a show: anObject.";
  26403. //>>excludeEnd("ide");
  26404. smalltalk.addMethod(
  26405. smalltalk.method({
  26406. selector: "clear",
  26407. protocol: 'printing',
  26408. fn: function (){
  26409. var self=this;
  26410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26411. return smalltalk.withContext(function($ctx1) {
  26412. //>>excludeEnd("ctx");
  26413. _st(self._current())._clear();
  26414. return self;
  26415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26416. }, function($ctx1) {$ctx1.fill(self,"clear",{},globals.Transcript.klass)});
  26417. //>>excludeEnd("ctx");
  26418. },
  26419. //>>excludeStart("ide", pragmas.excludeIdeData);
  26420. args: [],
  26421. source: "clear\x0a\x09self current clear",
  26422. referencedClasses: [],
  26423. //>>excludeEnd("ide");
  26424. messageSends: ["clear", "current"]
  26425. }),
  26426. globals.Transcript.klass);
  26427. smalltalk.addMethod(
  26428. smalltalk.method({
  26429. selector: "cr",
  26430. protocol: 'printing',
  26431. fn: function (){
  26432. var self=this;
  26433. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  26434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26435. return smalltalk.withContext(function($ctx1) {
  26436. //>>excludeEnd("ctx");
  26437. _st(self._current())._show_(_st($String())._cr());
  26438. return self;
  26439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26440. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.Transcript.klass)});
  26441. //>>excludeEnd("ctx");
  26442. },
  26443. //>>excludeStart("ide", pragmas.excludeIdeData);
  26444. args: [],
  26445. source: "cr\x0a\x09self current show: String cr",
  26446. referencedClasses: ["String"],
  26447. //>>excludeEnd("ide");
  26448. messageSends: ["show:", "current", "cr"]
  26449. }),
  26450. globals.Transcript.klass);
  26451. smalltalk.addMethod(
  26452. smalltalk.method({
  26453. selector: "inspect:",
  26454. protocol: 'printing',
  26455. fn: function (anObject){
  26456. var self=this;
  26457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26458. return smalltalk.withContext(function($ctx1) {
  26459. //>>excludeEnd("ctx");
  26460. self._show_(anObject);
  26461. return self;
  26462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26463. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Transcript.klass)});
  26464. //>>excludeEnd("ctx");
  26465. },
  26466. //>>excludeStart("ide", pragmas.excludeIdeData);
  26467. args: ["anObject"],
  26468. source: "inspect: anObject\x0a\x09self show: anObject",
  26469. referencedClasses: [],
  26470. //>>excludeEnd("ide");
  26471. messageSends: ["show:"]
  26472. }),
  26473. globals.Transcript.klass);
  26474. smalltalk.addMethod(
  26475. smalltalk.method({
  26476. selector: "open",
  26477. protocol: 'instance creation',
  26478. fn: function (){
  26479. var self=this;
  26480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26481. return smalltalk.withContext(function($ctx1) {
  26482. //>>excludeEnd("ctx");
  26483. _st(self._current())._open();
  26484. return self;
  26485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26486. }, function($ctx1) {$ctx1.fill(self,"open",{},globals.Transcript.klass)});
  26487. //>>excludeEnd("ctx");
  26488. },
  26489. //>>excludeStart("ide", pragmas.excludeIdeData);
  26490. args: [],
  26491. source: "open\x0a\x09self current open",
  26492. referencedClasses: [],
  26493. //>>excludeEnd("ide");
  26494. messageSends: ["open", "current"]
  26495. }),
  26496. globals.Transcript.klass);
  26497. smalltalk.addMethod(
  26498. smalltalk.method({
  26499. selector: "show:",
  26500. protocol: 'printing',
  26501. fn: function (anObject){
  26502. var self=this;
  26503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26504. return smalltalk.withContext(function($ctx1) {
  26505. //>>excludeEnd("ctx");
  26506. _st(self._current())._show_(anObject);
  26507. return self;
  26508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26509. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.Transcript.klass)});
  26510. //>>excludeEnd("ctx");
  26511. },
  26512. //>>excludeStart("ide", pragmas.excludeIdeData);
  26513. args: ["anObject"],
  26514. source: "show: anObject\x0a\x09self current show: anObject",
  26515. referencedClasses: [],
  26516. //>>excludeEnd("ide");
  26517. messageSends: ["show:", "current"]
  26518. }),
  26519. globals.Transcript.klass);
  26520. smalltalk.addClass('Setting', globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  26521. //>>excludeStart("ide", pragmas.excludeIdeData);
  26522. globals.Setting.comment="I represent a setting accessible via `Smalltalk settings`.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: 'defaultValue'`.";
  26523. //>>excludeEnd("ide");
  26524. smalltalk.addMethod(
  26525. smalltalk.method({
  26526. selector: "defaultValue",
  26527. protocol: 'accessing',
  26528. fn: function (){
  26529. var self=this;
  26530. var $1;
  26531. $1=self["@defaultValue"];
  26532. return $1;
  26533. },
  26534. //>>excludeStart("ide", pragmas.excludeIdeData);
  26535. args: [],
  26536. source: "defaultValue\x0a\x09^ defaultValue",
  26537. referencedClasses: [],
  26538. //>>excludeEnd("ide");
  26539. messageSends: []
  26540. }),
  26541. globals.Setting);
  26542. smalltalk.addMethod(
  26543. smalltalk.method({
  26544. selector: "defaultValue:",
  26545. protocol: 'accessing',
  26546. fn: function (anObject){
  26547. var self=this;
  26548. self["@defaultValue"]=anObject;
  26549. return self;
  26550. },
  26551. //>>excludeStart("ide", pragmas.excludeIdeData);
  26552. args: ["anObject"],
  26553. source: "defaultValue: anObject\x0a\x09defaultValue := anObject",
  26554. referencedClasses: [],
  26555. //>>excludeEnd("ide");
  26556. messageSends: []
  26557. }),
  26558. globals.Setting);
  26559. smalltalk.addMethod(
  26560. smalltalk.method({
  26561. selector: "key",
  26562. protocol: 'accessing',
  26563. fn: function (){
  26564. var self=this;
  26565. var $1;
  26566. $1=self["@key"];
  26567. return $1;
  26568. },
  26569. //>>excludeStart("ide", pragmas.excludeIdeData);
  26570. args: [],
  26571. source: "key\x0a\x09^ key",
  26572. referencedClasses: [],
  26573. //>>excludeEnd("ide");
  26574. messageSends: []
  26575. }),
  26576. globals.Setting);
  26577. smalltalk.addMethod(
  26578. smalltalk.method({
  26579. selector: "key:",
  26580. protocol: 'accessing',
  26581. fn: function (anObject){
  26582. var self=this;
  26583. self["@key"]=anObject;
  26584. return self;
  26585. },
  26586. //>>excludeStart("ide", pragmas.excludeIdeData);
  26587. args: ["anObject"],
  26588. source: "key: anObject\x0a\x09key := anObject",
  26589. referencedClasses: [],
  26590. //>>excludeEnd("ide");
  26591. messageSends: []
  26592. }),
  26593. globals.Setting);
  26594. smalltalk.addMethod(
  26595. smalltalk.method({
  26596. selector: "value",
  26597. protocol: 'accessing',
  26598. fn: function (){
  26599. var self=this;
  26600. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26602. return smalltalk.withContext(function($ctx1) {
  26603. //>>excludeEnd("ctx");
  26604. var $1;
  26605. $1=_st(_st($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  26606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26607. return smalltalk.withContext(function($ctx2) {
  26608. //>>excludeEnd("ctx");
  26609. return self._defaultValue();
  26610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26612. //>>excludeEnd("ctx");
  26613. }));
  26614. return $1;
  26615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26616. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.Setting)});
  26617. //>>excludeEnd("ctx");
  26618. },
  26619. //>>excludeStart("ide", pragmas.excludeIdeData);
  26620. args: [],
  26621. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  26622. referencedClasses: ["Smalltalk"],
  26623. //>>excludeEnd("ide");
  26624. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  26625. }),
  26626. globals.Setting);
  26627. smalltalk.addMethod(
  26628. smalltalk.method({
  26629. selector: "value:",
  26630. protocol: 'accessing',
  26631. fn: function (aString){
  26632. var self=this;
  26633. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26635. return smalltalk.withContext(function($ctx1) {
  26636. //>>excludeEnd("ctx");
  26637. var $1;
  26638. $1=_st(_st($Smalltalk())._settings())._at_put_(self._key(),aString);
  26639. return $1;
  26640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26641. }, function($ctx1) {$ctx1.fill(self,"value:",{aString:aString},globals.Setting)});
  26642. //>>excludeEnd("ctx");
  26643. },
  26644. //>>excludeStart("ide", pragmas.excludeIdeData);
  26645. args: ["aString"],
  26646. source: "value: aString\x0a\x09^ Smalltalk settings at: self key put: aString",
  26647. referencedClasses: ["Smalltalk"],
  26648. //>>excludeEnd("ide");
  26649. messageSends: ["at:put:", "settings", "key"]
  26650. }),
  26651. globals.Setting);
  26652. smalltalk.addMethod(
  26653. smalltalk.method({
  26654. selector: "at:ifAbsent:",
  26655. protocol: 'instance creation',
  26656. fn: function (aString,anotherString){
  26657. var self=this;
  26658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26659. return smalltalk.withContext(function($ctx1) {
  26660. //>>excludeEnd("ctx");
  26661. var $2,$3,$1;
  26662. $2=(
  26663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26664. $ctx1.supercall = true,
  26665. //>>excludeEnd("ctx");
  26666. globals.Setting.klass.superclass.fn.prototype._new.apply(_st(self), []));
  26667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26668. $ctx1.supercall = false;
  26669. //>>excludeEnd("ctx");;
  26670. _st($2)._key_(aString);
  26671. _st($2)._defaultValue_(anotherString);
  26672. $3=_st($2)._yourself();
  26673. $1=$3;
  26674. return $1;
  26675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26676. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,anotherString:anotherString},globals.Setting.klass)});
  26677. //>>excludeEnd("ctx");
  26678. },
  26679. //>>excludeStart("ide", pragmas.excludeIdeData);
  26680. args: ["aString", "anotherString"],
  26681. source: "at: aString ifAbsent: anotherString\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: anotherString;\x0a\x09\x09yourself",
  26682. referencedClasses: [],
  26683. //>>excludeEnd("ide");
  26684. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  26685. }),
  26686. globals.Setting.klass);
  26687. smalltalk.addMethod(
  26688. smalltalk.method({
  26689. selector: "new",
  26690. protocol: 'instance creation',
  26691. fn: function (){
  26692. var self=this;
  26693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26694. return smalltalk.withContext(function($ctx1) {
  26695. //>>excludeEnd("ctx");
  26696. self._shouldNotImplement();
  26697. return self;
  26698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26699. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.Setting.klass)});
  26700. //>>excludeEnd("ctx");
  26701. },
  26702. //>>excludeStart("ide", pragmas.excludeIdeData);
  26703. args: [],
  26704. source: "new\x0a\x09self shouldNotImplement",
  26705. referencedClasses: [],
  26706. //>>excludeEnd("ide");
  26707. messageSends: ["shouldNotImplement"]
  26708. }),
  26709. globals.Setting.klass);
  26710. smalltalk.addClass('SmalltalkImage', globals.Object, [], 'Kernel-Infrastructure');
  26711. //>>excludeStart("ide", pragmas.excludeIdeData);
  26712. globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `smalltalk` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\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 or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  26713. //>>excludeEnd("ide");
  26714. smalltalk.addMethod(
  26715. smalltalk.method({
  26716. selector: "addGlobalJsVariable:",
  26717. protocol: 'globals',
  26718. fn: function (aString){
  26719. var self=this;
  26720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26721. return smalltalk.withContext(function($ctx1) {
  26722. //>>excludeEnd("ctx");
  26723. _st(self._globalJsVariables())._add_(aString);
  26724. return self;
  26725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26726. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)});
  26727. //>>excludeEnd("ctx");
  26728. },
  26729. //>>excludeStart("ide", pragmas.excludeIdeData);
  26730. args: ["aString"],
  26731. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  26732. referencedClasses: [],
  26733. //>>excludeEnd("ide");
  26734. messageSends: ["add:", "globalJsVariables"]
  26735. }),
  26736. globals.SmalltalkImage);
  26737. smalltalk.addMethod(
  26738. smalltalk.method({
  26739. selector: "amdRequire",
  26740. protocol: 'accessing amd',
  26741. fn: function (){
  26742. var self=this;
  26743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26744. return smalltalk.withContext(function($ctx1) {
  26745. //>>excludeEnd("ctx");
  26746. var $1;
  26747. $1=_st(self._vm())._at_("amdRequire");
  26748. return $1;
  26749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26750. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},globals.SmalltalkImage)});
  26751. //>>excludeEnd("ctx");
  26752. },
  26753. //>>excludeStart("ide", pragmas.excludeIdeData);
  26754. args: [],
  26755. source: "amdRequire\x0a\x09^ self vm at: 'amdRequire'",
  26756. referencedClasses: [],
  26757. //>>excludeEnd("ide");
  26758. messageSends: ["at:", "vm"]
  26759. }),
  26760. globals.SmalltalkImage);
  26761. smalltalk.addMethod(
  26762. smalltalk.method({
  26763. selector: "asSmalltalkException:",
  26764. protocol: 'error handling',
  26765. fn: function (anObject){
  26766. var self=this;
  26767. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  26768. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  26769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26770. return smalltalk.withContext(function($ctx1) {
  26771. //>>excludeEnd("ctx");
  26772. var $2,$1;
  26773. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  26774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26775. return smalltalk.withContext(function($ctx2) {
  26776. //>>excludeEnd("ctx");
  26777. return _st(anObject)._isKindOf_($Error());
  26778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26780. //>>excludeEnd("ctx");
  26781. }));
  26782. if(smalltalk.assert($2)){
  26783. $1=anObject;
  26784. } else {
  26785. $1=_st($JavaScriptException())._on_(anObject);
  26786. };
  26787. return $1;
  26788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26789. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},globals.SmalltalkImage)});
  26790. //>>excludeEnd("ctx");
  26791. },
  26792. //>>excludeStart("ide", pragmas.excludeIdeData);
  26793. args: ["anObject"],
  26794. 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 ]",
  26795. referencedClasses: ["Error", "JavaScriptException"],
  26796. //>>excludeEnd("ide");
  26797. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  26798. }),
  26799. globals.SmalltalkImage);
  26800. smalltalk.addMethod(
  26801. smalltalk.method({
  26802. selector: "at:",
  26803. protocol: 'accessing',
  26804. fn: function (aString){
  26805. var self=this;
  26806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26807. return smalltalk.withContext(function($ctx1) {
  26808. //>>excludeEnd("ctx");
  26809. var $1;
  26810. self._deprecatedAPI();
  26811. $1=_st(self._globals())._at_(aString);
  26812. return $1;
  26813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26814. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.SmalltalkImage)});
  26815. //>>excludeEnd("ctx");
  26816. },
  26817. //>>excludeStart("ide", pragmas.excludeIdeData);
  26818. args: ["aString"],
  26819. source: "at: aString\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString",
  26820. referencedClasses: [],
  26821. //>>excludeEnd("ide");
  26822. messageSends: ["deprecatedAPI", "at:", "globals"]
  26823. }),
  26824. globals.SmalltalkImage);
  26825. smalltalk.addMethod(
  26826. smalltalk.method({
  26827. selector: "at:ifAbsent:",
  26828. protocol: 'accessing',
  26829. fn: function (aKey,aBlock){
  26830. var self=this;
  26831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26832. return smalltalk.withContext(function($ctx1) {
  26833. //>>excludeEnd("ctx");
  26834. var $1;
  26835. self._deprecatedAPI();
  26836. $1=_st(self._globals())._at_ifAbsent_(aKey,aBlock);
  26837. return $1;
  26838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26839. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.SmalltalkImage)});
  26840. //>>excludeEnd("ctx");
  26841. },
  26842. //>>excludeStart("ide", pragmas.excludeIdeData);
  26843. args: ["aKey", "aBlock"],
  26844. source: "at: aKey ifAbsent: aBlock\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aKey ifAbsent: aBlock",
  26845. referencedClasses: [],
  26846. //>>excludeEnd("ide");
  26847. messageSends: ["deprecatedAPI", "at:ifAbsent:", "globals"]
  26848. }),
  26849. globals.SmalltalkImage);
  26850. smalltalk.addMethod(
  26851. smalltalk.method({
  26852. selector: "at:put:",
  26853. protocol: 'accessing',
  26854. fn: function (aString,anObject){
  26855. var self=this;
  26856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26857. return smalltalk.withContext(function($ctx1) {
  26858. //>>excludeEnd("ctx");
  26859. var $1;
  26860. self._deprecatedAPI();
  26861. $1=_st(self._globals())._at_put_(aString,anObject);
  26862. return $1;
  26863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26864. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.SmalltalkImage)});
  26865. //>>excludeEnd("ctx");
  26866. },
  26867. //>>excludeStart("ide", pragmas.excludeIdeData);
  26868. args: ["aString", "anObject"],
  26869. source: "at: aString put: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString put: anObject",
  26870. referencedClasses: [],
  26871. //>>excludeEnd("ide");
  26872. messageSends: ["deprecatedAPI", "at:put:", "globals"]
  26873. }),
  26874. globals.SmalltalkImage);
  26875. smalltalk.addMethod(
  26876. smalltalk.method({
  26877. selector: "basicCreatePackage:",
  26878. protocol: 'private',
  26879. fn: function (packageName){
  26880. var self=this;
  26881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26882. return smalltalk.withContext(function($ctx1) {
  26883. //>>excludeEnd("ctx");
  26884. return smalltalk.addPackage(packageName);
  26885. return self;
  26886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26887. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},globals.SmalltalkImage)});
  26888. //>>excludeEnd("ctx");
  26889. },
  26890. //>>excludeStart("ide", pragmas.excludeIdeData);
  26891. args: ["packageName"],
  26892. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  26893. referencedClasses: [],
  26894. //>>excludeEnd("ide");
  26895. messageSends: []
  26896. }),
  26897. globals.SmalltalkImage);
  26898. smalltalk.addMethod(
  26899. smalltalk.method({
  26900. selector: "basicParse:",
  26901. protocol: 'private',
  26902. fn: function (aString){
  26903. var self=this;
  26904. function $SmalltalkParser(){return globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  26905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26906. return smalltalk.withContext(function($ctx1) {
  26907. //>>excludeEnd("ctx");
  26908. var $1;
  26909. $1=_st($SmalltalkParser())._parse_(aString);
  26910. return $1;
  26911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26912. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},globals.SmalltalkImage)});
  26913. //>>excludeEnd("ctx");
  26914. },
  26915. //>>excludeStart("ide", pragmas.excludeIdeData);
  26916. args: ["aString"],
  26917. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  26918. referencedClasses: ["SmalltalkParser"],
  26919. //>>excludeEnd("ide");
  26920. messageSends: ["parse:"]
  26921. }),
  26922. globals.SmalltalkImage);
  26923. smalltalk.addMethod(
  26924. smalltalk.method({
  26925. selector: "classes",
  26926. protocol: 'classes',
  26927. fn: function (){
  26928. var self=this;
  26929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26930. return smalltalk.withContext(function($ctx1) {
  26931. //>>excludeEnd("ctx");
  26932. return smalltalk.classes();
  26933. return self;
  26934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26935. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.SmalltalkImage)});
  26936. //>>excludeEnd("ctx");
  26937. },
  26938. //>>excludeStart("ide", pragmas.excludeIdeData);
  26939. args: [],
  26940. source: "classes\x0a\x09<return smalltalk.classes()>",
  26941. referencedClasses: [],
  26942. //>>excludeEnd("ide");
  26943. messageSends: []
  26944. }),
  26945. globals.SmalltalkImage);
  26946. smalltalk.addMethod(
  26947. smalltalk.method({
  26948. selector: "createPackage:",
  26949. protocol: 'packages',
  26950. fn: function (packageName){
  26951. var self=this;
  26952. var package_,announcement;
  26953. function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  26954. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  26955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26956. return smalltalk.withContext(function($ctx1) {
  26957. //>>excludeEnd("ctx");
  26958. var $1,$2,$3;
  26959. package_=self._basicCreatePackage_(packageName);
  26960. $1=_st($PackageAdded())._new();
  26961. _st($1)._package_(package_);
  26962. $2=_st($1)._yourself();
  26963. announcement=$2;
  26964. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  26965. $3=package_;
  26966. return $3;
  26967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26968. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},globals.SmalltalkImage)});
  26969. //>>excludeEnd("ctx");
  26970. },
  26971. //>>excludeStart("ide", pragmas.excludeIdeData);
  26972. args: ["packageName"],
  26973. source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
  26974. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  26975. //>>excludeEnd("ide");
  26976. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  26977. }),
  26978. globals.SmalltalkImage);
  26979. smalltalk.addMethod(
  26980. smalltalk.method({
  26981. selector: "createPackage:properties:",
  26982. protocol: 'private',
  26983. fn: function (packageName,aDict){
  26984. var self=this;
  26985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26986. return smalltalk.withContext(function($ctx1) {
  26987. //>>excludeEnd("ctx");
  26988. var $1,$2;
  26989. self._deprecatedAPI();
  26990. $1=_st(aDict)._isEmpty();
  26991. if(! smalltalk.assert($1)){
  26992. self._error_("createPackage:properties: called with nonempty properties");
  26993. };
  26994. $2=self._createPackage_(packageName);
  26995. return $2;
  26996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26997. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},globals.SmalltalkImage)});
  26998. //>>excludeEnd("ctx");
  26999. },
  27000. //>>excludeStart("ide", pragmas.excludeIdeData);
  27001. args: ["packageName", "aDict"],
  27002. 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",
  27003. referencedClasses: [],
  27004. //>>excludeEnd("ide");
  27005. messageSends: ["deprecatedAPI", "ifFalse:", "isEmpty", "error:", "createPackage:"]
  27006. }),
  27007. globals.SmalltalkImage);
  27008. smalltalk.addMethod(
  27009. smalltalk.method({
  27010. selector: "current",
  27011. protocol: 'accessing',
  27012. fn: function (){
  27013. var self=this;
  27014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27015. return smalltalk.withContext(function($ctx1) {
  27016. //>>excludeEnd("ctx");
  27017. self._deprecatedAPI();
  27018. return self;
  27019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27020. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage)});
  27021. //>>excludeEnd("ctx");
  27022. },
  27023. //>>excludeStart("ide", pragmas.excludeIdeData);
  27024. args: [],
  27025. source: "current\x0a\x09\x22Backward compatibility for Smalltalk current ...\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self",
  27026. referencedClasses: [],
  27027. //>>excludeEnd("ide");
  27028. messageSends: ["deprecatedAPI"]
  27029. }),
  27030. globals.SmalltalkImage);
  27031. smalltalk.addMethod(
  27032. smalltalk.method({
  27033. selector: "defaultAmdNamespace",
  27034. protocol: 'accessing amd',
  27035. fn: function (){
  27036. var self=this;
  27037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27038. return smalltalk.withContext(function($ctx1) {
  27039. //>>excludeEnd("ctx");
  27040. var $1;
  27041. $1="transport.defaultAmdNamespace"._settingValue();
  27042. return $1;
  27043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27044. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},globals.SmalltalkImage)});
  27045. //>>excludeEnd("ctx");
  27046. },
  27047. //>>excludeStart("ide", pragmas.excludeIdeData);
  27048. args: [],
  27049. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  27050. referencedClasses: [],
  27051. //>>excludeEnd("ide");
  27052. messageSends: ["settingValue"]
  27053. }),
  27054. globals.SmalltalkImage);
  27055. smalltalk.addMethod(
  27056. smalltalk.method({
  27057. selector: "defaultAmdNamespace:",
  27058. protocol: 'accessing amd',
  27059. fn: function (aString){
  27060. var self=this;
  27061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27062. return smalltalk.withContext(function($ctx1) {
  27063. //>>excludeEnd("ctx");
  27064. "transport.defaultAmdNamespace"._settingValue_(aString);
  27065. return self;
  27066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27067. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},globals.SmalltalkImage)});
  27068. //>>excludeEnd("ctx");
  27069. },
  27070. //>>excludeStart("ide", pragmas.excludeIdeData);
  27071. args: ["aString"],
  27072. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  27073. referencedClasses: [],
  27074. //>>excludeEnd("ide");
  27075. messageSends: ["settingValue:"]
  27076. }),
  27077. globals.SmalltalkImage);
  27078. smalltalk.addMethod(
  27079. smalltalk.method({
  27080. selector: "deleteClass:",
  27081. protocol: 'private',
  27082. fn: function (aClass){
  27083. var self=this;
  27084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27085. return smalltalk.withContext(function($ctx1) {
  27086. //>>excludeEnd("ctx");
  27087. smalltalk.removeClass(aClass);
  27088. return self;
  27089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27090. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},globals.SmalltalkImage)});
  27091. //>>excludeEnd("ctx");
  27092. },
  27093. //>>excludeStart("ide", pragmas.excludeIdeData);
  27094. args: ["aClass"],
  27095. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<smalltalk.removeClass(aClass)>",
  27096. referencedClasses: [],
  27097. //>>excludeEnd("ide");
  27098. messageSends: []
  27099. }),
  27100. globals.SmalltalkImage);
  27101. smalltalk.addMethod(
  27102. smalltalk.method({
  27103. selector: "deleteGlobalJsVariable:",
  27104. protocol: 'globals',
  27105. fn: function (aString){
  27106. var self=this;
  27107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27108. return smalltalk.withContext(function($ctx1) {
  27109. //>>excludeEnd("ctx");
  27110. _st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  27111. }));
  27112. return self;
  27113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27114. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)});
  27115. //>>excludeEnd("ctx");
  27116. },
  27117. //>>excludeStart("ide", pragmas.excludeIdeData);
  27118. args: ["aString"],
  27119. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  27120. referencedClasses: [],
  27121. //>>excludeEnd("ide");
  27122. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  27123. }),
  27124. globals.SmalltalkImage);
  27125. smalltalk.addMethod(
  27126. smalltalk.method({
  27127. selector: "deletePackage:",
  27128. protocol: 'private',
  27129. fn: function (packageName){
  27130. var self=this;
  27131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27132. return smalltalk.withContext(function($ctx1) {
  27133. //>>excludeEnd("ctx");
  27134. delete smalltalk.packages[packageName];
  27135. return self;
  27136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27137. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},globals.SmalltalkImage)});
  27138. //>>excludeEnd("ctx");
  27139. },
  27140. //>>excludeStart("ide", pragmas.excludeIdeData);
  27141. args: ["packageName"],
  27142. 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]>",
  27143. referencedClasses: [],
  27144. //>>excludeEnd("ide");
  27145. messageSends: []
  27146. }),
  27147. globals.SmalltalkImage);
  27148. smalltalk.addMethod(
  27149. smalltalk.method({
  27150. selector: "globalJsVariables",
  27151. protocol: 'globals',
  27152. fn: function (){
  27153. var self=this;
  27154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27155. return smalltalk.withContext(function($ctx1) {
  27156. //>>excludeEnd("ctx");
  27157. return smalltalk.globalJsVariables;
  27158. return self;
  27159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27160. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},globals.SmalltalkImage)});
  27161. //>>excludeEnd("ctx");
  27162. },
  27163. //>>excludeStart("ide", pragmas.excludeIdeData);
  27164. args: [],
  27165. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return smalltalk.globalJsVariables>",
  27166. referencedClasses: [],
  27167. //>>excludeEnd("ide");
  27168. messageSends: []
  27169. }),
  27170. globals.SmalltalkImage);
  27171. smalltalk.addMethod(
  27172. smalltalk.method({
  27173. selector: "globals",
  27174. protocol: 'accessing',
  27175. fn: function (){
  27176. var self=this;
  27177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27178. return smalltalk.withContext(function($ctx1) {
  27179. //>>excludeEnd("ctx");
  27180. return globals;
  27181. return self;
  27182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27183. }, function($ctx1) {$ctx1.fill(self,"globals",{},globals.SmalltalkImage)});
  27184. //>>excludeEnd("ctx");
  27185. },
  27186. //>>excludeStart("ide", pragmas.excludeIdeData);
  27187. args: [],
  27188. source: "globals\x0a\x09\x22Future compatibility to be able to use Smalltalk globals at: ...\x22\x0a\x09<return globals>",
  27189. referencedClasses: [],
  27190. //>>excludeEnd("ide");
  27191. messageSends: []
  27192. }),
  27193. globals.SmalltalkImage);
  27194. smalltalk.addMethod(
  27195. smalltalk.method({
  27196. selector: "includesKey:",
  27197. protocol: 'accessing',
  27198. fn: function (aKey){
  27199. var self=this;
  27200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27201. return smalltalk.withContext(function($ctx1) {
  27202. //>>excludeEnd("ctx");
  27203. return smalltalk.hasOwnProperty(aKey);
  27204. return self;
  27205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27206. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.SmalltalkImage)});
  27207. //>>excludeEnd("ctx");
  27208. },
  27209. //>>excludeStart("ide", pragmas.excludeIdeData);
  27210. args: ["aKey"],
  27211. source: "includesKey: aKey\x0a\x09<return smalltalk.hasOwnProperty(aKey)>",
  27212. referencedClasses: [],
  27213. //>>excludeEnd("ide");
  27214. messageSends: []
  27215. }),
  27216. globals.SmalltalkImage);
  27217. smalltalk.addMethod(
  27218. smalltalk.method({
  27219. selector: "isSmalltalkObject:",
  27220. protocol: 'testing',
  27221. fn: function (anObject){
  27222. var self=this;
  27223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27224. return smalltalk.withContext(function($ctx1) {
  27225. //>>excludeEnd("ctx");
  27226. return typeof anObject.klass !== 'undefined';
  27227. return self;
  27228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27229. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},globals.SmalltalkImage)});
  27230. //>>excludeEnd("ctx");
  27231. },
  27232. //>>excludeStart("ide", pragmas.excludeIdeData);
  27233. args: ["anObject"],
  27234. 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'>",
  27235. referencedClasses: [],
  27236. //>>excludeEnd("ide");
  27237. messageSends: []
  27238. }),
  27239. globals.SmalltalkImage);
  27240. smalltalk.addMethod(
  27241. smalltalk.method({
  27242. selector: "packageAt:",
  27243. protocol: 'packages',
  27244. fn: function (packageName){
  27245. var self=this;
  27246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27247. return smalltalk.withContext(function($ctx1) {
  27248. //>>excludeEnd("ctx");
  27249. return smalltalk.packages[packageName];
  27250. return self;
  27251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27252. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},globals.SmalltalkImage)});
  27253. //>>excludeEnd("ctx");
  27254. },
  27255. //>>excludeStart("ide", pragmas.excludeIdeData);
  27256. args: ["packageName"],
  27257. source: "packageAt: packageName\x0a\x09<return smalltalk.packages[packageName]>",
  27258. referencedClasses: [],
  27259. //>>excludeEnd("ide");
  27260. messageSends: []
  27261. }),
  27262. globals.SmalltalkImage);
  27263. smalltalk.addMethod(
  27264. smalltalk.method({
  27265. selector: "packageAt:ifAbsent:",
  27266. protocol: 'packages',
  27267. fn: function (packageName,aBlock){
  27268. var self=this;
  27269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27270. return smalltalk.withContext(function($ctx1) {
  27271. //>>excludeEnd("ctx");
  27272. var $2,$1;
  27273. $2=self._packageAt_(packageName);
  27274. $1=_st($2)._ifNil_(aBlock);
  27275. return $1;
  27276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27277. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},globals.SmalltalkImage)});
  27278. //>>excludeEnd("ctx");
  27279. },
  27280. //>>excludeStart("ide", pragmas.excludeIdeData);
  27281. args: ["packageName", "aBlock"],
  27282. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  27283. referencedClasses: [],
  27284. //>>excludeEnd("ide");
  27285. messageSends: ["ifNil:", "packageAt:"]
  27286. }),
  27287. globals.SmalltalkImage);
  27288. smalltalk.addMethod(
  27289. smalltalk.method({
  27290. selector: "packages",
  27291. protocol: 'packages',
  27292. fn: function (){
  27293. var self=this;
  27294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27295. return smalltalk.withContext(function($ctx1) {
  27296. //>>excludeEnd("ctx");
  27297. return Object.keys(smalltalk.packages).map(function(k) {
  27298. return smalltalk.packages[k];
  27299. })
  27300. ;
  27301. return self;
  27302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27303. }, function($ctx1) {$ctx1.fill(self,"packages",{},globals.SmalltalkImage)});
  27304. //>>excludeEnd("ctx");
  27305. },
  27306. //>>excludeStart("ide", pragmas.excludeIdeData);
  27307. args: [],
  27308. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys(smalltalk.packages).map(function(k) {\x0a\x09\x09\x09return smalltalk.packages[k];\x0a\x09\x09})\x0a\x09>",
  27309. referencedClasses: [],
  27310. //>>excludeEnd("ide");
  27311. messageSends: []
  27312. }),
  27313. globals.SmalltalkImage);
  27314. smalltalk.addMethod(
  27315. smalltalk.method({
  27316. selector: "parse:",
  27317. protocol: 'accessing',
  27318. fn: function (aString){
  27319. var self=this;
  27320. var result;
  27321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27322. return smalltalk.withContext(function($ctx1) {
  27323. //>>excludeEnd("ctx");
  27324. var $2,$3,$1;
  27325. _st((function(){
  27326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27327. return smalltalk.withContext(function($ctx2) {
  27328. //>>excludeEnd("ctx");
  27329. result=self._basicParse_(aString);
  27330. return result;
  27331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27333. //>>excludeEnd("ctx");
  27334. }))._tryCatch_((function(ex){
  27335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27336. return smalltalk.withContext(function($ctx2) {
  27337. //>>excludeEnd("ctx");
  27338. return _st(self._parseError_parsing_(ex,aString))._signal();
  27339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  27341. //>>excludeEnd("ctx");
  27342. }));
  27343. $2=result;
  27344. _st($2)._source_(aString);
  27345. $3=_st($2)._yourself();
  27346. $1=$3;
  27347. return $1;
  27348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27349. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},globals.SmalltalkImage)});
  27350. //>>excludeEnd("ctx");
  27351. },
  27352. //>>excludeStart("ide", pragmas.excludeIdeData);
  27353. args: ["aString"],
  27354. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  27355. referencedClasses: [],
  27356. //>>excludeEnd("ide");
  27357. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  27358. }),
  27359. globals.SmalltalkImage);
  27360. smalltalk.addMethod(
  27361. smalltalk.method({
  27362. selector: "parseError:parsing:",
  27363. protocol: 'error handling',
  27364. fn: function (anException,aString){
  27365. var self=this;
  27366. function $ParseError(){return globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  27367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27368. return smalltalk.withContext(function($ctx1) {
  27369. //>>excludeEnd("ctx");
  27370. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  27371. $2=_st($ParseError())._new();
  27372. $8=_st(anException)._basicAt_("line");
  27373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27374. $ctx1.sendIdx["basicAt:"]=1;
  27375. //>>excludeEnd("ctx");
  27376. $7="Parse error on line ".__comma($8);
  27377. $6=_st($7).__comma(" column ");
  27378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27379. $ctx1.sendIdx[","]=4;
  27380. //>>excludeEnd("ctx");
  27381. $9=_st(anException)._basicAt_("column");
  27382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27383. $ctx1.sendIdx["basicAt:"]=2;
  27384. //>>excludeEnd("ctx");
  27385. $5=_st($6).__comma($9);
  27386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27387. $ctx1.sendIdx[","]=3;
  27388. //>>excludeEnd("ctx");
  27389. $4=_st($5).__comma(" : Unexpected character ");
  27390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27391. $ctx1.sendIdx[","]=2;
  27392. //>>excludeEnd("ctx");
  27393. $3=_st($4).__comma(_st(anException)._basicAt_("found"));
  27394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27395. $ctx1.sendIdx[","]=1;
  27396. //>>excludeEnd("ctx");
  27397. $1=_st($2)._messageText_($3);
  27398. return $1;
  27399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27400. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},globals.SmalltalkImage)});
  27401. //>>excludeEnd("ctx");
  27402. },
  27403. //>>excludeStart("ide", pragmas.excludeIdeData);
  27404. args: ["anException", "aString"],
  27405. 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')",
  27406. referencedClasses: ["ParseError"],
  27407. //>>excludeEnd("ide");
  27408. messageSends: ["messageText:", "new", ",", "basicAt:"]
  27409. }),
  27410. globals.SmalltalkImage);
  27411. smalltalk.addMethod(
  27412. smalltalk.method({
  27413. selector: "pseudoVariableNames",
  27414. protocol: 'accessing',
  27415. fn: function (){
  27416. var self=this;
  27417. var $1;
  27418. $1=["self", "super", "nil", "true", "false", "thisContext"];
  27419. return $1;
  27420. },
  27421. //>>excludeStart("ide", pragmas.excludeIdeData);
  27422. args: [],
  27423. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  27424. referencedClasses: [],
  27425. //>>excludeEnd("ide");
  27426. messageSends: []
  27427. }),
  27428. globals.SmalltalkImage);
  27429. smalltalk.addMethod(
  27430. smalltalk.method({
  27431. selector: "readJSObject:",
  27432. protocol: 'accessing',
  27433. fn: function (anObject){
  27434. var self=this;
  27435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27436. return smalltalk.withContext(function($ctx1) {
  27437. //>>excludeEnd("ctx");
  27438. return smalltalk.readJSObject(anObject);
  27439. return self;
  27440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27441. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},globals.SmalltalkImage)});
  27442. //>>excludeEnd("ctx");
  27443. },
  27444. //>>excludeStart("ide", pragmas.excludeIdeData);
  27445. args: ["anObject"],
  27446. source: "readJSObject: anObject\x0a\x09<return smalltalk.readJSObject(anObject)>",
  27447. referencedClasses: [],
  27448. //>>excludeEnd("ide");
  27449. messageSends: []
  27450. }),
  27451. globals.SmalltalkImage);
  27452. smalltalk.addMethod(
  27453. smalltalk.method({
  27454. selector: "removeClass:",
  27455. protocol: 'classes',
  27456. fn: function (aClass){
  27457. var self=this;
  27458. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  27459. function $ClassRemoved(){return globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  27460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27461. return smalltalk.withContext(function($ctx1) {
  27462. //>>excludeEnd("ctx");
  27463. var $1,$2,$3;
  27464. $1=_st(aClass)._isMetaclass();
  27465. if(smalltalk.assert($1)){
  27466. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  27467. };
  27468. self._deleteClass_(aClass);
  27469. $2=_st($ClassRemoved())._new();
  27470. _st($2)._theClass_(aClass);
  27471. $3=_st($2)._yourself();
  27472. _st(_st($SystemAnnouncer())._current())._announce_($3);
  27473. return self;
  27474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27475. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.SmalltalkImage)});
  27476. //>>excludeEnd("ctx");
  27477. },
  27478. //>>excludeStart("ide", pragmas.excludeIdeData);
  27479. args: ["aClass"],
  27480. 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)",
  27481. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  27482. //>>excludeEnd("ide");
  27483. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  27484. }),
  27485. globals.SmalltalkImage);
  27486. smalltalk.addMethod(
  27487. smalltalk.method({
  27488. selector: "removePackage:",
  27489. protocol: 'packages',
  27490. fn: function (packageName){
  27491. var self=this;
  27492. var pkg;
  27493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27494. return smalltalk.withContext(function($ctx1) {
  27495. //>>excludeEnd("ctx");
  27496. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  27497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27498. return smalltalk.withContext(function($ctx2) {
  27499. //>>excludeEnd("ctx");
  27500. return self._error_("Missing package: ".__comma(packageName));
  27501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27503. //>>excludeEnd("ctx");
  27504. }));
  27505. _st(_st(pkg)._classes())._do_((function(each){
  27506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27507. return smalltalk.withContext(function($ctx2) {
  27508. //>>excludeEnd("ctx");
  27509. return self._removeClass_(each);
  27510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27512. //>>excludeEnd("ctx");
  27513. }));
  27514. self._deletePackage_(packageName);
  27515. return self;
  27516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27517. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},globals.SmalltalkImage)});
  27518. //>>excludeEnd("ctx");
  27519. },
  27520. //>>excludeStart("ide", pragmas.excludeIdeData);
  27521. args: ["packageName"],
  27522. 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",
  27523. referencedClasses: [],
  27524. //>>excludeEnd("ide");
  27525. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  27526. }),
  27527. globals.SmalltalkImage);
  27528. smalltalk.addMethod(
  27529. smalltalk.method({
  27530. selector: "renamePackage:to:",
  27531. protocol: 'packages',
  27532. fn: function (packageName,newName){
  27533. var self=this;
  27534. var pkg;
  27535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27536. return smalltalk.withContext(function($ctx1) {
  27537. //>>excludeEnd("ctx");
  27538. var $1,$2,$receiver;
  27539. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  27540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27541. return smalltalk.withContext(function($ctx2) {
  27542. //>>excludeEnd("ctx");
  27543. $1="Missing package: ".__comma(packageName);
  27544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27545. $ctx2.sendIdx[","]=1;
  27546. //>>excludeEnd("ctx");
  27547. return self._error_($1);
  27548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27549. $ctx2.sendIdx["error:"]=1;
  27550. //>>excludeEnd("ctx");
  27551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27553. //>>excludeEnd("ctx");
  27554. }));
  27555. $2=self._packageAt_(newName);
  27556. if(($receiver = $2) == null || $receiver.isNil){
  27557. $2;
  27558. } else {
  27559. self._error_("Already exists a package called: ".__comma(newName));
  27560. };
  27561. _st(self._at_("packages"))._at_put_(newName,pkg);
  27562. _st(pkg)._name_(newName);
  27563. self._deletePackage_(packageName);
  27564. return self;
  27565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27566. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},globals.SmalltalkImage)});
  27567. //>>excludeEnd("ctx");
  27568. },
  27569. //>>excludeStart("ide", pragmas.excludeIdeData);
  27570. args: ["packageName", "newName"],
  27571. 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 at: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  27572. referencedClasses: [],
  27573. //>>excludeEnd("ide");
  27574. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"]
  27575. }),
  27576. globals.SmalltalkImage);
  27577. smalltalk.addMethod(
  27578. smalltalk.method({
  27579. selector: "reservedWords",
  27580. protocol: 'accessing',
  27581. fn: function (){
  27582. var self=this;
  27583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27584. return smalltalk.withContext(function($ctx1) {
  27585. //>>excludeEnd("ctx");
  27586. return smalltalk.reservedWords;
  27587. return self;
  27588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27589. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},globals.SmalltalkImage)});
  27590. //>>excludeEnd("ctx");
  27591. },
  27592. //>>excludeStart("ide", pragmas.excludeIdeData);
  27593. args: [],
  27594. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return smalltalk.reservedWords>",
  27595. referencedClasses: [],
  27596. //>>excludeEnd("ide");
  27597. messageSends: []
  27598. }),
  27599. globals.SmalltalkImage);
  27600. smalltalk.addMethod(
  27601. smalltalk.method({
  27602. selector: "settings",
  27603. protocol: 'accessing',
  27604. fn: function (){
  27605. var self=this;
  27606. function $SmalltalkSettings(){return globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  27607. return $SmalltalkSettings();
  27608. },
  27609. //>>excludeStart("ide", pragmas.excludeIdeData);
  27610. args: [],
  27611. source: "settings\x0a\x09^ SmalltalkSettings",
  27612. referencedClasses: ["SmalltalkSettings"],
  27613. //>>excludeEnd("ide");
  27614. messageSends: []
  27615. }),
  27616. globals.SmalltalkImage);
  27617. smalltalk.addMethod(
  27618. smalltalk.method({
  27619. selector: "version",
  27620. protocol: 'accessing',
  27621. fn: function (){
  27622. var self=this;
  27623. return "0.13.0-pre";
  27624. },
  27625. //>>excludeStart("ide", pragmas.excludeIdeData);
  27626. args: [],
  27627. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.13.0-pre'",
  27628. referencedClasses: [],
  27629. //>>excludeEnd("ide");
  27630. messageSends: []
  27631. }),
  27632. globals.SmalltalkImage);
  27633. smalltalk.addMethod(
  27634. smalltalk.method({
  27635. selector: "vm",
  27636. protocol: 'accessing',
  27637. fn: function (){
  27638. var self=this;
  27639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27640. return smalltalk.withContext(function($ctx1) {
  27641. //>>excludeEnd("ctx");
  27642. return smalltalk;
  27643. return self;
  27644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27645. }, function($ctx1) {$ctx1.fill(self,"vm",{},globals.SmalltalkImage)});
  27646. //>>excludeEnd("ctx");
  27647. },
  27648. //>>excludeStart("ide", pragmas.excludeIdeData);
  27649. args: [],
  27650. source: "vm\x0a\x09\x22Future compatibility to be able to use Smalltalk vm ...\x22\x0a\x09<return smalltalk>",
  27651. referencedClasses: [],
  27652. //>>excludeEnd("ide");
  27653. messageSends: []
  27654. }),
  27655. globals.SmalltalkImage);
  27656. globals.SmalltalkImage.klass.iVarNames = ['current'];
  27657. smalltalk.addMethod(
  27658. smalltalk.method({
  27659. selector: "current",
  27660. protocol: 'instance creation',
  27661. fn: function (){
  27662. var self=this;
  27663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27664. return smalltalk.withContext(function($ctx1) {
  27665. //>>excludeEnd("ctx");
  27666. var $2,$1,$receiver;
  27667. $2=self["@current"];
  27668. if(($receiver = $2) == null || $receiver.isNil){
  27669. self["@current"]=(
  27670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27671. $ctx1.supercall = true,
  27672. //>>excludeEnd("ctx");
  27673. globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply(_st(self), []));
  27674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27675. $ctx1.supercall = false;
  27676. //>>excludeEnd("ctx");;
  27677. $1=self["@current"];
  27678. } else {
  27679. self._deprecatedAPI();
  27680. $1=self["@current"];
  27681. };
  27682. return $1;
  27683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27684. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage.klass)});
  27685. //>>excludeEnd("ctx");
  27686. },
  27687. //>>excludeStart("ide", pragmas.excludeIdeData);
  27688. args: [],
  27689. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  27690. referencedClasses: [],
  27691. //>>excludeEnd("ide");
  27692. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  27693. }),
  27694. globals.SmalltalkImage.klass);
  27695. smalltalk.addMethod(
  27696. smalltalk.method({
  27697. selector: "initialize",
  27698. protocol: 'initialization',
  27699. fn: function (){
  27700. var self=this;
  27701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27702. return smalltalk.withContext(function($ctx1) {
  27703. //>>excludeEnd("ctx");
  27704. _st(globals)._at_put_("Smalltalk",self._current());
  27705. return self;
  27706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27707. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.SmalltalkImage.klass)});
  27708. //>>excludeEnd("ctx");
  27709. },
  27710. //>>excludeStart("ide", pragmas.excludeIdeData);
  27711. args: [],
  27712. source: "initialize\x0a\x09globals at: 'Smalltalk' put: self current",
  27713. referencedClasses: [],
  27714. //>>excludeEnd("ide");
  27715. messageSends: ["at:put:", "current"]
  27716. }),
  27717. globals.SmalltalkImage.klass);
  27718. smalltalk.addMethod(
  27719. smalltalk.method({
  27720. selector: "new",
  27721. protocol: 'instance creation',
  27722. fn: function (){
  27723. var self=this;
  27724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27725. return smalltalk.withContext(function($ctx1) {
  27726. //>>excludeEnd("ctx");
  27727. self._shouldNotImplement();
  27728. return self;
  27729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27730. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.SmalltalkImage.klass)});
  27731. //>>excludeEnd("ctx");
  27732. },
  27733. //>>excludeStart("ide", pragmas.excludeIdeData);
  27734. args: [],
  27735. source: "new\x0a\x09self shouldNotImplement",
  27736. referencedClasses: [],
  27737. //>>excludeEnd("ide");
  27738. messageSends: ["shouldNotImplement"]
  27739. }),
  27740. globals.SmalltalkImage.klass);
  27741. smalltalk.addMethod(
  27742. smalltalk.method({
  27743. selector: "do:displayingProgress:",
  27744. protocol: '*Kernel-Infrastructure',
  27745. fn: function (aBlock,aString){
  27746. var self=this;
  27747. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  27748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27749. return smalltalk.withContext(function($ctx1) {
  27750. //>>excludeEnd("ctx");
  27751. _st($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  27752. return self;
  27753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27754. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},globals.SequenceableCollection)});
  27755. //>>excludeEnd("ctx");
  27756. },
  27757. //>>excludeStart("ide", pragmas.excludeIdeData);
  27758. args: ["aBlock", "aString"],
  27759. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  27760. referencedClasses: ["ProgressHandler"],
  27761. //>>excludeEnd("ide");
  27762. messageSends: ["do:on:displaying:"]
  27763. }),
  27764. globals.SequenceableCollection);
  27765. smalltalk.addMethod(
  27766. smalltalk.method({
  27767. selector: "asJavaScriptPropertyName",
  27768. protocol: '*Kernel-Infrastructure',
  27769. fn: function (){
  27770. var self=this;
  27771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27772. return smalltalk.withContext(function($ctx1) {
  27773. //>>excludeEnd("ctx");
  27774. return smalltalk.st2prop(self);
  27775. return self;
  27776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27777. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},globals.String)});
  27778. //>>excludeEnd("ctx");
  27779. },
  27780. //>>excludeStart("ide", pragmas.excludeIdeData);
  27781. args: [],
  27782. source: "asJavaScriptPropertyName\x0a<return smalltalk.st2prop(self)>",
  27783. referencedClasses: [],
  27784. //>>excludeEnd("ide");
  27785. messageSends: []
  27786. }),
  27787. globals.String);
  27788. smalltalk.addMethod(
  27789. smalltalk.method({
  27790. selector: "asJavaScriptSelector",
  27791. protocol: '*Kernel-Infrastructure',
  27792. fn: function (){
  27793. var self=this;
  27794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27795. return smalltalk.withContext(function($ctx1) {
  27796. //>>excludeEnd("ctx");
  27797. var $1;
  27798. $1=self._asJavaScriptPropertyName();
  27799. return $1;
  27800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27801. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},globals.String)});
  27802. //>>excludeEnd("ctx");
  27803. },
  27804. //>>excludeStart("ide", pragmas.excludeIdeData);
  27805. args: [],
  27806. source: "asJavaScriptSelector\x0a\x09\x22Cannot add next line as it breaks commit:\x0a\x09self deprecatedAPI: 'Use #asJavaScriptPropertyName'.\x22\x0a\x0a\x09^ self asJavaScriptPropertyName",
  27807. referencedClasses: [],
  27808. //>>excludeEnd("ide");
  27809. messageSends: ["asJavaScriptPropertyName"]
  27810. }),
  27811. globals.String);
  27812. smalltalk.addMethod(
  27813. smalltalk.method({
  27814. selector: "asSetting",
  27815. protocol: '*Kernel-Infrastructure',
  27816. fn: function (){
  27817. var self=this;
  27818. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  27819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27820. return smalltalk.withContext(function($ctx1) {
  27821. //>>excludeEnd("ctx");
  27822. var $1;
  27823. $1=_st($Setting())._at_ifAbsent_(self,nil);
  27824. return $1;
  27825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27826. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},globals.String)});
  27827. //>>excludeEnd("ctx");
  27828. },
  27829. //>>excludeStart("ide", pragmas.excludeIdeData);
  27830. args: [],
  27831. source: "asSetting\x0a\x09^ Setting at: self ifAbsent: nil",
  27832. referencedClasses: ["Setting"],
  27833. //>>excludeEnd("ide");
  27834. messageSends: ["at:ifAbsent:"]
  27835. }),
  27836. globals.String);
  27837. smalltalk.addMethod(
  27838. smalltalk.method({
  27839. selector: "asSettingIfAbsent:",
  27840. protocol: '*Kernel-Infrastructure',
  27841. fn: function (aString){
  27842. var self=this;
  27843. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  27844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27845. return smalltalk.withContext(function($ctx1) {
  27846. //>>excludeEnd("ctx");
  27847. var $1;
  27848. $1=_st($Setting())._at_ifAbsent_(self,aString);
  27849. return $1;
  27850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27851. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aString:aString},globals.String)});
  27852. //>>excludeEnd("ctx");
  27853. },
  27854. //>>excludeStart("ide", pragmas.excludeIdeData);
  27855. args: ["aString"],
  27856. source: "asSettingIfAbsent: aString\x0a\x09^ Setting at: self ifAbsent: aString",
  27857. referencedClasses: ["Setting"],
  27858. //>>excludeEnd("ide");
  27859. messageSends: ["at:ifAbsent:"]
  27860. }),
  27861. globals.String);
  27862. smalltalk.addMethod(
  27863. smalltalk.method({
  27864. selector: "settingValue",
  27865. protocol: '*Kernel-Infrastructure',
  27866. fn: function (){
  27867. var self=this;
  27868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27869. return smalltalk.withContext(function($ctx1) {
  27870. //>>excludeEnd("ctx");
  27871. var $1;
  27872. $1=_st(self._asSetting())._value();
  27873. return $1;
  27874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27875. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},globals.String)});
  27876. //>>excludeEnd("ctx");
  27877. },
  27878. //>>excludeStart("ide", pragmas.excludeIdeData);
  27879. args: [],
  27880. source: "settingValue\x0a\x09^ self asSetting value",
  27881. referencedClasses: [],
  27882. //>>excludeEnd("ide");
  27883. messageSends: ["value", "asSetting"]
  27884. }),
  27885. globals.String);
  27886. smalltalk.addMethod(
  27887. smalltalk.method({
  27888. selector: "settingValue:",
  27889. protocol: '*Kernel-Infrastructure',
  27890. fn: function (aString){
  27891. var self=this;
  27892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27893. return smalltalk.withContext(function($ctx1) {
  27894. //>>excludeEnd("ctx");
  27895. var $1;
  27896. $1=_st(self._asSetting())._value_(aString);
  27897. return $1;
  27898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27899. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aString:aString},globals.String)});
  27900. //>>excludeEnd("ctx");
  27901. },
  27902. //>>excludeStart("ide", pragmas.excludeIdeData);
  27903. args: ["aString"],
  27904. source: "settingValue: aString\x0a\x09^ self asSetting value: aString",
  27905. referencedClasses: [],
  27906. //>>excludeEnd("ide");
  27907. messageSends: ["value:", "asSetting"]
  27908. }),
  27909. globals.String);
  27910. smalltalk.addMethod(
  27911. smalltalk.method({
  27912. selector: "settingValueIfAbsent:",
  27913. protocol: '*Kernel-Infrastructure',
  27914. fn: function (aString){
  27915. var self=this;
  27916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27917. return smalltalk.withContext(function($ctx1) {
  27918. //>>excludeEnd("ctx");
  27919. var $1;
  27920. $1=_st(self._asSettingIfAbsent_(aString))._value();
  27921. return $1;
  27922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27923. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aString:aString},globals.String)});
  27924. //>>excludeEnd("ctx");
  27925. },
  27926. //>>excludeStart("ide", pragmas.excludeIdeData);
  27927. args: ["aString"],
  27928. source: "settingValueIfAbsent: aString\x0a\x09^ (self asSettingIfAbsent: aString) value",
  27929. referencedClasses: [],
  27930. //>>excludeEnd("ide");
  27931. messageSends: ["value", "asSettingIfAbsent:"]
  27932. }),
  27933. globals.String);
  27934. });
  27935. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  27936. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  27937. smalltalk.addPackage('Kernel-Exceptions');
  27938. smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  27939. smalltalk.addClass('Error', globals.Object, ['messageText'], 'Kernel-Exceptions');
  27940. //>>excludeStart("ide", pragmas.excludeIdeData);
  27941. globals.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.";
  27942. //>>excludeEnd("ide");
  27943. smalltalk.addMethod(
  27944. smalltalk.method({
  27945. selector: "beHandled",
  27946. protocol: 'accessing',
  27947. fn: function (){
  27948. var self=this;
  27949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27950. return smalltalk.withContext(function($ctx1) {
  27951. //>>excludeEnd("ctx");
  27952. self.amberHandled = true;
  27953. return self;
  27954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27955. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},globals.Error)});
  27956. //>>excludeEnd("ctx");
  27957. },
  27958. //>>excludeStart("ide", pragmas.excludeIdeData);
  27959. args: [],
  27960. source: "beHandled\x0a\x09<self.amberHandled = true>",
  27961. referencedClasses: [],
  27962. //>>excludeEnd("ide");
  27963. messageSends: []
  27964. }),
  27965. globals.Error);
  27966. smalltalk.addMethod(
  27967. smalltalk.method({
  27968. selector: "beUnhandled",
  27969. protocol: 'accessing',
  27970. fn: function (){
  27971. var self=this;
  27972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27973. return smalltalk.withContext(function($ctx1) {
  27974. //>>excludeEnd("ctx");
  27975. self.amberHandled = false;
  27976. return self;
  27977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27978. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},globals.Error)});
  27979. //>>excludeEnd("ctx");
  27980. },
  27981. //>>excludeStart("ide", pragmas.excludeIdeData);
  27982. args: [],
  27983. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  27984. referencedClasses: [],
  27985. //>>excludeEnd("ide");
  27986. messageSends: []
  27987. }),
  27988. globals.Error);
  27989. smalltalk.addMethod(
  27990. smalltalk.method({
  27991. selector: "context",
  27992. protocol: 'accessing',
  27993. fn: function (){
  27994. var self=this;
  27995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27996. return smalltalk.withContext(function($ctx1) {
  27997. //>>excludeEnd("ctx");
  27998. return self.context;
  27999. return self;
  28000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28001. }, function($ctx1) {$ctx1.fill(self,"context",{},globals.Error)});
  28002. //>>excludeEnd("ctx");
  28003. },
  28004. //>>excludeStart("ide", pragmas.excludeIdeData);
  28005. args: [],
  28006. source: "context\x0a\x09<return self.context>",
  28007. referencedClasses: [],
  28008. //>>excludeEnd("ide");
  28009. messageSends: []
  28010. }),
  28011. globals.Error);
  28012. smalltalk.addMethod(
  28013. smalltalk.method({
  28014. selector: "initialize",
  28015. protocol: 'initialization',
  28016. fn: function (){
  28017. var self=this;
  28018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28019. return smalltalk.withContext(function($ctx1) {
  28020. //>>excludeEnd("ctx");
  28021. self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
  28022. return self;
  28023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28024. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Error)});
  28025. //>>excludeEnd("ctx");
  28026. },
  28027. //>>excludeStart("ide", pragmas.excludeIdeData);
  28028. args: [],
  28029. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  28030. referencedClasses: [],
  28031. //>>excludeEnd("ide");
  28032. messageSends: ["messageText:", ",", "name", "class"]
  28033. }),
  28034. globals.Error);
  28035. smalltalk.addMethod(
  28036. smalltalk.method({
  28037. selector: "isSmalltalkError",
  28038. protocol: 'testing',
  28039. fn: function (){
  28040. var self=this;
  28041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28042. return smalltalk.withContext(function($ctx1) {
  28043. //>>excludeEnd("ctx");
  28044. return self.smalltalkError === true;
  28045. return self;
  28046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28047. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},globals.Error)});
  28048. //>>excludeEnd("ctx");
  28049. },
  28050. //>>excludeStart("ide", pragmas.excludeIdeData);
  28051. args: [],
  28052. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  28053. referencedClasses: [],
  28054. //>>excludeEnd("ide");
  28055. messageSends: []
  28056. }),
  28057. globals.Error);
  28058. smalltalk.addMethod(
  28059. smalltalk.method({
  28060. selector: "jsStack",
  28061. protocol: 'accessing',
  28062. fn: function (){
  28063. var self=this;
  28064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28065. return smalltalk.withContext(function($ctx1) {
  28066. //>>excludeEnd("ctx");
  28067. return self.stack;
  28068. return self;
  28069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28070. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},globals.Error)});
  28071. //>>excludeEnd("ctx");
  28072. },
  28073. //>>excludeStart("ide", pragmas.excludeIdeData);
  28074. args: [],
  28075. source: "jsStack\x0a\x09<return self.stack>",
  28076. referencedClasses: [],
  28077. //>>excludeEnd("ide");
  28078. messageSends: []
  28079. }),
  28080. globals.Error);
  28081. smalltalk.addMethod(
  28082. smalltalk.method({
  28083. selector: "messageText",
  28084. protocol: 'accessing',
  28085. fn: function (){
  28086. var self=this;
  28087. var $1;
  28088. $1=self["@messageText"];
  28089. return $1;
  28090. },
  28091. //>>excludeStart("ide", pragmas.excludeIdeData);
  28092. args: [],
  28093. source: "messageText\x0a\x09^ messageText",
  28094. referencedClasses: [],
  28095. //>>excludeEnd("ide");
  28096. messageSends: []
  28097. }),
  28098. globals.Error);
  28099. smalltalk.addMethod(
  28100. smalltalk.method({
  28101. selector: "messageText:",
  28102. protocol: 'accessing',
  28103. fn: function (aString){
  28104. var self=this;
  28105. self["@messageText"]=aString;
  28106. return self;
  28107. },
  28108. //>>excludeStart("ide", pragmas.excludeIdeData);
  28109. args: ["aString"],
  28110. source: "messageText: aString\x0a\x09messageText := aString",
  28111. referencedClasses: [],
  28112. //>>excludeEnd("ide");
  28113. messageSends: []
  28114. }),
  28115. globals.Error);
  28116. smalltalk.addMethod(
  28117. smalltalk.method({
  28118. selector: "resignal",
  28119. protocol: 'signaling',
  28120. fn: function (){
  28121. var self=this;
  28122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28123. return smalltalk.withContext(function($ctx1) {
  28124. //>>excludeEnd("ctx");
  28125. self.amberHandled = false;
  28126. throw(self);
  28127. ;
  28128. return self;
  28129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28130. }, function($ctx1) {$ctx1.fill(self,"resignal",{},globals.Error)});
  28131. //>>excludeEnd("ctx");
  28132. },
  28133. //>>excludeStart("ide", pragmas.excludeIdeData);
  28134. args: [],
  28135. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09>",
  28136. referencedClasses: [],
  28137. //>>excludeEnd("ide");
  28138. messageSends: []
  28139. }),
  28140. globals.Error);
  28141. smalltalk.addMethod(
  28142. smalltalk.method({
  28143. selector: "signal",
  28144. protocol: 'signaling',
  28145. fn: function (){
  28146. var self=this;
  28147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28148. return smalltalk.withContext(function($ctx1) {
  28149. //>>excludeEnd("ctx");
  28150. self.amberHandled = false;
  28151. self.context = smalltalk.getThisContext();
  28152. self.smalltalkError = true; throw(self)
  28153. ;
  28154. return self;
  28155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28156. }, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error)});
  28157. //>>excludeEnd("ctx");
  28158. },
  28159. //>>excludeStart("ide", pragmas.excludeIdeData);
  28160. args: [],
  28161. source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = smalltalk.getThisContext(); \x0a\x09\x09self.smalltalkError = true; throw(self)\x0a\x09>",
  28162. referencedClasses: [],
  28163. //>>excludeEnd("ide");
  28164. messageSends: []
  28165. }),
  28166. globals.Error);
  28167. smalltalk.addMethod(
  28168. smalltalk.method({
  28169. selector: "signal:",
  28170. protocol: 'signaling',
  28171. fn: function (aString){
  28172. var self=this;
  28173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28174. return smalltalk.withContext(function($ctx1) {
  28175. //>>excludeEnd("ctx");
  28176. self._messageText_(aString);
  28177. self._signal();
  28178. return self;
  28179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28180. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error)});
  28181. //>>excludeEnd("ctx");
  28182. },
  28183. //>>excludeStart("ide", pragmas.excludeIdeData);
  28184. args: ["aString"],
  28185. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  28186. referencedClasses: [],
  28187. //>>excludeEnd("ide");
  28188. messageSends: ["messageText:", "signal"]
  28189. }),
  28190. globals.Error);
  28191. smalltalk.addMethod(
  28192. smalltalk.method({
  28193. selector: "signalerContext",
  28194. protocol: 'accessing',
  28195. fn: function (){
  28196. var self=this;
  28197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28198. return smalltalk.withContext(function($ctx1) {
  28199. //>>excludeEnd("ctx");
  28200. var $1;
  28201. $1=self._signalerContextFrom_(self._context());
  28202. return $1;
  28203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28204. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},globals.Error)});
  28205. //>>excludeEnd("ctx");
  28206. },
  28207. //>>excludeStart("ide", pragmas.excludeIdeData);
  28208. args: [],
  28209. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  28210. referencedClasses: [],
  28211. //>>excludeEnd("ide");
  28212. messageSends: ["signalerContextFrom:", "context"]
  28213. }),
  28214. globals.Error);
  28215. smalltalk.addMethod(
  28216. smalltalk.method({
  28217. selector: "signalerContextFrom:",
  28218. protocol: 'accessing',
  28219. fn: function (aContext){
  28220. var self=this;
  28221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28222. return smalltalk.withContext(function($ctx1) {
  28223. //>>excludeEnd("ctx");
  28224. var $4,$3,$2,$1;
  28225. $1=_st(aContext)._findContextSuchThat_((function(context){
  28226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28227. return smalltalk.withContext(function($ctx2) {
  28228. //>>excludeEnd("ctx");
  28229. $4=_st(context)._receiver();
  28230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28231. $ctx2.sendIdx["receiver"]=1;
  28232. //>>excludeEnd("ctx");
  28233. $3=_st($4).__eq_eq(self);
  28234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28235. $ctx2.sendIdx["=="]=1;
  28236. //>>excludeEnd("ctx");
  28237. $2=_st($3)._or_((function(){
  28238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28239. return smalltalk.withContext(function($ctx3) {
  28240. //>>excludeEnd("ctx");
  28241. return _st(_st(context)._receiver()).__eq_eq(self._class());
  28242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28243. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28244. //>>excludeEnd("ctx");
  28245. }));
  28246. return _st($2)._not();
  28247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28248. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  28249. //>>excludeEnd("ctx");
  28250. }));
  28251. return $1;
  28252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28253. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Error)});
  28254. //>>excludeEnd("ctx");
  28255. },
  28256. //>>excludeStart("ide", pragmas.excludeIdeData);
  28257. args: ["aContext"],
  28258. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  28259. referencedClasses: [],
  28260. //>>excludeEnd("ide");
  28261. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  28262. }),
  28263. globals.Error);
  28264. smalltalk.addMethod(
  28265. smalltalk.method({
  28266. selector: "wasHandled",
  28267. protocol: 'testing',
  28268. fn: function (){
  28269. var self=this;
  28270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28271. return smalltalk.withContext(function($ctx1) {
  28272. //>>excludeEnd("ctx");
  28273. return self.amberHandled || false;
  28274. return self;
  28275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28276. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},globals.Error)});
  28277. //>>excludeEnd("ctx");
  28278. },
  28279. //>>excludeStart("ide", pragmas.excludeIdeData);
  28280. args: [],
  28281. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  28282. referencedClasses: [],
  28283. //>>excludeEnd("ide");
  28284. messageSends: []
  28285. }),
  28286. globals.Error);
  28287. smalltalk.addMethod(
  28288. smalltalk.method({
  28289. selector: "heliosClass",
  28290. protocol: 'helios',
  28291. fn: function (){
  28292. var self=this;
  28293. return "exception";
  28294. },
  28295. //>>excludeStart("ide", pragmas.excludeIdeData);
  28296. args: [],
  28297. source: "heliosClass\x0a\x09^ 'exception'",
  28298. referencedClasses: [],
  28299. //>>excludeEnd("ide");
  28300. messageSends: []
  28301. }),
  28302. globals.Error.klass);
  28303. smalltalk.addMethod(
  28304. smalltalk.method({
  28305. selector: "signal",
  28306. protocol: 'instance creation',
  28307. fn: function (){
  28308. var self=this;
  28309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28310. return smalltalk.withContext(function($ctx1) {
  28311. //>>excludeEnd("ctx");
  28312. var $1;
  28313. $1=_st(self._new())._signal();
  28314. return $1;
  28315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28316. }, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error.klass)});
  28317. //>>excludeEnd("ctx");
  28318. },
  28319. //>>excludeStart("ide", pragmas.excludeIdeData);
  28320. args: [],
  28321. source: "signal\x0a\x09^ self new signal",
  28322. referencedClasses: [],
  28323. //>>excludeEnd("ide");
  28324. messageSends: ["signal", "new"]
  28325. }),
  28326. globals.Error.klass);
  28327. smalltalk.addMethod(
  28328. smalltalk.method({
  28329. selector: "signal:",
  28330. protocol: 'instance creation',
  28331. fn: function (aString){
  28332. var self=this;
  28333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28334. return smalltalk.withContext(function($ctx1) {
  28335. //>>excludeEnd("ctx");
  28336. var $1;
  28337. $1=_st(self._new())._signal_(aString);
  28338. return $1;
  28339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28340. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error.klass)});
  28341. //>>excludeEnd("ctx");
  28342. },
  28343. //>>excludeStart("ide", pragmas.excludeIdeData);
  28344. args: ["aString"],
  28345. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  28346. referencedClasses: [],
  28347. //>>excludeEnd("ide");
  28348. messageSends: ["signal:", "new"]
  28349. }),
  28350. globals.Error.klass);
  28351. smalltalk.addClass('Halt', globals.Error, [], 'Kernel-Exceptions');
  28352. //>>excludeStart("ide", pragmas.excludeIdeData);
  28353. globals.Halt.comment="I am provided to support `Object>>#halt`.";
  28354. //>>excludeEnd("ide");
  28355. smalltalk.addMethod(
  28356. smalltalk.method({
  28357. selector: "messageText",
  28358. protocol: 'accessing',
  28359. fn: function (){
  28360. var self=this;
  28361. return "Halt encountered";
  28362. },
  28363. //>>excludeStart("ide", pragmas.excludeIdeData);
  28364. args: [],
  28365. source: "messageText\x0a\x09^ 'Halt encountered'",
  28366. referencedClasses: [],
  28367. //>>excludeEnd("ide");
  28368. messageSends: []
  28369. }),
  28370. globals.Halt);
  28371. smalltalk.addMethod(
  28372. smalltalk.method({
  28373. selector: "signalerContextFrom:",
  28374. protocol: 'accessing',
  28375. fn: function (aContext){
  28376. var self=this;
  28377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28378. return smalltalk.withContext(function($ctx1) {
  28379. //>>excludeEnd("ctx");
  28380. var $4,$3,$2,$1;
  28381. $1=_st(aContext)._findContextSuchThat_((function(context){
  28382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28383. return smalltalk.withContext(function($ctx2) {
  28384. //>>excludeEnd("ctx");
  28385. $4=_st(context)._receiver();
  28386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28387. $ctx2.sendIdx["receiver"]=1;
  28388. //>>excludeEnd("ctx");
  28389. $3=_st($4).__eq_eq(self);
  28390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28391. $ctx2.sendIdx["=="]=1;
  28392. //>>excludeEnd("ctx");
  28393. $2=_st($3)._or_((function(){
  28394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28395. return smalltalk.withContext(function($ctx3) {
  28396. //>>excludeEnd("ctx");
  28397. return _st(_st(_st(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  28398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28399. return smalltalk.withContext(function($ctx4) {
  28400. //>>excludeEnd("ctx");
  28401. return _st(_st(_st(context)._method())._selector()).__eq("halt");
  28402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28403. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  28404. //>>excludeEnd("ctx");
  28405. }));
  28406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28407. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28408. //>>excludeEnd("ctx");
  28409. }));
  28410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28411. $ctx2.sendIdx["or:"]=1;
  28412. //>>excludeEnd("ctx");
  28413. return _st($2)._not();
  28414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28415. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  28416. //>>excludeEnd("ctx");
  28417. }));
  28418. return $1;
  28419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28420. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Halt)});
  28421. //>>excludeEnd("ctx");
  28422. },
  28423. //>>excludeStart("ide", pragmas.excludeIdeData);
  28424. args: ["aContext"],
  28425. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  28426. referencedClasses: [],
  28427. //>>excludeEnd("ide");
  28428. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  28429. }),
  28430. globals.Halt);
  28431. smalltalk.addClass('JavaScriptException', globals.Error, ['exception'], 'Kernel-Exceptions');
  28432. //>>excludeStart("ide", pragmas.excludeIdeData);
  28433. globals.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:`";
  28434. //>>excludeEnd("ide");
  28435. smalltalk.addMethod(
  28436. smalltalk.method({
  28437. selector: "context:",
  28438. protocol: 'accessing',
  28439. fn: function (aMethodContext){
  28440. var self=this;
  28441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28442. return smalltalk.withContext(function($ctx1) {
  28443. //>>excludeEnd("ctx");
  28444. self.context = aMethodContext;
  28445. return self;
  28446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28447. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},globals.JavaScriptException)});
  28448. //>>excludeEnd("ctx");
  28449. },
  28450. //>>excludeStart("ide", pragmas.excludeIdeData);
  28451. args: ["aMethodContext"],
  28452. 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>",
  28453. referencedClasses: [],
  28454. //>>excludeEnd("ide");
  28455. messageSends: []
  28456. }),
  28457. globals.JavaScriptException);
  28458. smalltalk.addMethod(
  28459. smalltalk.method({
  28460. selector: "exception",
  28461. protocol: 'accessing',
  28462. fn: function (){
  28463. var self=this;
  28464. var $1;
  28465. $1=self["@exception"];
  28466. return $1;
  28467. },
  28468. //>>excludeStart("ide", pragmas.excludeIdeData);
  28469. args: [],
  28470. source: "exception\x0a\x09^ exception",
  28471. referencedClasses: [],
  28472. //>>excludeEnd("ide");
  28473. messageSends: []
  28474. }),
  28475. globals.JavaScriptException);
  28476. smalltalk.addMethod(
  28477. smalltalk.method({
  28478. selector: "exception:",
  28479. protocol: 'accessing',
  28480. fn: function (anException){
  28481. var self=this;
  28482. self["@exception"]=anException;
  28483. return self;
  28484. },
  28485. //>>excludeStart("ide", pragmas.excludeIdeData);
  28486. args: ["anException"],
  28487. source: "exception: anException\x0a\x09exception := anException",
  28488. referencedClasses: [],
  28489. //>>excludeEnd("ide");
  28490. messageSends: []
  28491. }),
  28492. globals.JavaScriptException);
  28493. smalltalk.addMethod(
  28494. smalltalk.method({
  28495. selector: "messageText",
  28496. protocol: 'accessing',
  28497. fn: function (){
  28498. var self=this;
  28499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28500. return smalltalk.withContext(function($ctx1) {
  28501. //>>excludeEnd("ctx");
  28502. return 'JavaScript exception: ' + self["@exception"].toString();
  28503. return self;
  28504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28505. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.JavaScriptException)});
  28506. //>>excludeEnd("ctx");
  28507. },
  28508. //>>excludeStart("ide", pragmas.excludeIdeData);
  28509. args: [],
  28510. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  28511. referencedClasses: [],
  28512. //>>excludeEnd("ide");
  28513. messageSends: []
  28514. }),
  28515. globals.JavaScriptException);
  28516. smalltalk.addMethod(
  28517. smalltalk.method({
  28518. selector: "on:",
  28519. protocol: 'instance creation',
  28520. fn: function (anException){
  28521. var self=this;
  28522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28523. return smalltalk.withContext(function($ctx1) {
  28524. //>>excludeEnd("ctx");
  28525. var $2,$3,$1;
  28526. $2=self._new();
  28527. _st($2)._exception_(anException);
  28528. $3=_st($2)._yourself();
  28529. $1=$3;
  28530. return $1;
  28531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28532. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},globals.JavaScriptException.klass)});
  28533. //>>excludeEnd("ctx");
  28534. },
  28535. //>>excludeStart("ide", pragmas.excludeIdeData);
  28536. args: ["anException"],
  28537. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  28538. referencedClasses: [],
  28539. //>>excludeEnd("ide");
  28540. messageSends: ["exception:", "new", "yourself"]
  28541. }),
  28542. globals.JavaScriptException.klass);
  28543. smalltalk.addMethod(
  28544. smalltalk.method({
  28545. selector: "on:context:",
  28546. protocol: 'instance creation',
  28547. fn: function (anException,aMethodContext){
  28548. var self=this;
  28549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28550. return smalltalk.withContext(function($ctx1) {
  28551. //>>excludeEnd("ctx");
  28552. var $2,$3,$1;
  28553. $2=self._new();
  28554. _st($2)._exception_(anException);
  28555. _st($2)._context_(aMethodContext);
  28556. $3=_st($2)._yourself();
  28557. $1=$3;
  28558. return $1;
  28559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28560. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},globals.JavaScriptException.klass)});
  28561. //>>excludeEnd("ctx");
  28562. },
  28563. //>>excludeStart("ide", pragmas.excludeIdeData);
  28564. args: ["anException", "aMethodContext"],
  28565. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  28566. referencedClasses: [],
  28567. //>>excludeEnd("ide");
  28568. messageSends: ["exception:", "new", "context:", "yourself"]
  28569. }),
  28570. globals.JavaScriptException.klass);
  28571. smalltalk.addClass('MessageNotUnderstood', globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  28572. //>>excludeStart("ide", pragmas.excludeIdeData);
  28573. globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  28574. //>>excludeEnd("ide");
  28575. smalltalk.addMethod(
  28576. smalltalk.method({
  28577. selector: "message",
  28578. protocol: 'accessing',
  28579. fn: function (){
  28580. var self=this;
  28581. var $1;
  28582. $1=self["@message"];
  28583. return $1;
  28584. },
  28585. //>>excludeStart("ide", pragmas.excludeIdeData);
  28586. args: [],
  28587. source: "message\x0a\x09^ message",
  28588. referencedClasses: [],
  28589. //>>excludeEnd("ide");
  28590. messageSends: []
  28591. }),
  28592. globals.MessageNotUnderstood);
  28593. smalltalk.addMethod(
  28594. smalltalk.method({
  28595. selector: "message:",
  28596. protocol: 'accessing',
  28597. fn: function (aMessage){
  28598. var self=this;
  28599. self["@message"]=aMessage;
  28600. return self;
  28601. },
  28602. //>>excludeStart("ide", pragmas.excludeIdeData);
  28603. args: ["aMessage"],
  28604. source: "message: aMessage\x0a\x09message := aMessage",
  28605. referencedClasses: [],
  28606. //>>excludeEnd("ide");
  28607. messageSends: []
  28608. }),
  28609. globals.MessageNotUnderstood);
  28610. smalltalk.addMethod(
  28611. smalltalk.method({
  28612. selector: "messageText",
  28613. protocol: 'accessing',
  28614. fn: function (){
  28615. var self=this;
  28616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28617. return smalltalk.withContext(function($ctx1) {
  28618. //>>excludeEnd("ctx");
  28619. var $1;
  28620. $1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
  28621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28622. $ctx1.sendIdx[","]=1;
  28623. //>>excludeEnd("ctx");
  28624. return $1;
  28625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28626. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.MessageNotUnderstood)});
  28627. //>>excludeEnd("ctx");
  28628. },
  28629. //>>excludeStart("ide", pragmas.excludeIdeData);
  28630. args: [],
  28631. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  28632. referencedClasses: [],
  28633. //>>excludeEnd("ide");
  28634. messageSends: [",", "asString", "receiver", "selector", "message"]
  28635. }),
  28636. globals.MessageNotUnderstood);
  28637. smalltalk.addMethod(
  28638. smalltalk.method({
  28639. selector: "receiver",
  28640. protocol: 'accessing',
  28641. fn: function (){
  28642. var self=this;
  28643. var $1;
  28644. $1=self["@receiver"];
  28645. return $1;
  28646. },
  28647. //>>excludeStart("ide", pragmas.excludeIdeData);
  28648. args: [],
  28649. source: "receiver\x0a\x09^ receiver",
  28650. referencedClasses: [],
  28651. //>>excludeEnd("ide");
  28652. messageSends: []
  28653. }),
  28654. globals.MessageNotUnderstood);
  28655. smalltalk.addMethod(
  28656. smalltalk.method({
  28657. selector: "receiver:",
  28658. protocol: 'accessing',
  28659. fn: function (anObject){
  28660. var self=this;
  28661. self["@receiver"]=anObject;
  28662. return self;
  28663. },
  28664. //>>excludeStart("ide", pragmas.excludeIdeData);
  28665. args: ["anObject"],
  28666. source: "receiver: anObject\x0a\x09receiver := anObject",
  28667. referencedClasses: [],
  28668. //>>excludeEnd("ide");
  28669. messageSends: []
  28670. }),
  28671. globals.MessageNotUnderstood);
  28672. smalltalk.addClass('NonBooleanReceiver', globals.Error, ['object'], 'Kernel-Exceptions');
  28673. //>>excludeStart("ide", pragmas.excludeIdeData);
  28674. globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  28675. //>>excludeEnd("ide");
  28676. smalltalk.addMethod(
  28677. smalltalk.method({
  28678. selector: "object",
  28679. protocol: 'accessing',
  28680. fn: function (){
  28681. var self=this;
  28682. var $1;
  28683. $1=self["@object"];
  28684. return $1;
  28685. },
  28686. //>>excludeStart("ide", pragmas.excludeIdeData);
  28687. args: [],
  28688. source: "object\x0a\x09^ object",
  28689. referencedClasses: [],
  28690. //>>excludeEnd("ide");
  28691. messageSends: []
  28692. }),
  28693. globals.NonBooleanReceiver);
  28694. smalltalk.addMethod(
  28695. smalltalk.method({
  28696. selector: "object:",
  28697. protocol: 'accessing',
  28698. fn: function (anObject){
  28699. var self=this;
  28700. self["@object"]=anObject;
  28701. return self;
  28702. },
  28703. //>>excludeStart("ide", pragmas.excludeIdeData);
  28704. args: ["anObject"],
  28705. source: "object: anObject\x0a\x09object := anObject",
  28706. referencedClasses: [],
  28707. //>>excludeEnd("ide");
  28708. messageSends: []
  28709. }),
  28710. globals.NonBooleanReceiver);
  28711. smalltalk.addClass('PackageCommitError', globals.Error, [], 'Kernel-Exceptions');
  28712. //>>excludeStart("ide", pragmas.excludeIdeData);
  28713. globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28714. //>>excludeEnd("ide");
  28715. });
  28716. define("amber_core/Kernel-Transcript", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  28717. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  28718. smalltalk.addPackage('Kernel-Transcript');
  28719. smalltalk.packages["Kernel-Transcript"].transport = {"type":"amd","amdNamespace":"amber_core"};
  28720. smalltalk.addClass('ConsoleTranscript', globals.Object, ['textarea'], 'Kernel-Transcript');
  28721. //>>excludeStart("ide", pragmas.excludeIdeData);
  28722. globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  28723. //>>excludeEnd("ide");
  28724. smalltalk.addMethod(
  28725. smalltalk.method({
  28726. selector: "clear",
  28727. protocol: 'printing',
  28728. fn: function (){
  28729. var self=this;
  28730. return self;
  28731. },
  28732. //>>excludeStart("ide", pragmas.excludeIdeData);
  28733. args: [],
  28734. source: "clear\x0a\x09\x22no op\x22",
  28735. referencedClasses: [],
  28736. //>>excludeEnd("ide");
  28737. messageSends: []
  28738. }),
  28739. globals.ConsoleTranscript);
  28740. smalltalk.addMethod(
  28741. smalltalk.method({
  28742. selector: "cr",
  28743. protocol: 'printing',
  28744. fn: function (){
  28745. var self=this;
  28746. return self;
  28747. },
  28748. //>>excludeStart("ide", pragmas.excludeIdeData);
  28749. args: [],
  28750. source: "cr\x0a\x09\x22no op\x22",
  28751. referencedClasses: [],
  28752. //>>excludeEnd("ide");
  28753. messageSends: []
  28754. }),
  28755. globals.ConsoleTranscript);
  28756. smalltalk.addMethod(
  28757. smalltalk.method({
  28758. selector: "open",
  28759. protocol: 'actions',
  28760. fn: function (){
  28761. var self=this;
  28762. return self;
  28763. },
  28764. //>>excludeStart("ide", pragmas.excludeIdeData);
  28765. args: [],
  28766. source: "open",
  28767. referencedClasses: [],
  28768. //>>excludeEnd("ide");
  28769. messageSends: []
  28770. }),
  28771. globals.ConsoleTranscript);
  28772. smalltalk.addMethod(
  28773. smalltalk.method({
  28774. selector: "show:",
  28775. protocol: 'printing',
  28776. fn: function (anObject){
  28777. var self=this;
  28778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28779. return smalltalk.withContext(function($ctx1) {
  28780. //>>excludeEnd("ctx");
  28781. console.log(String(_st(anObject)._asString()));
  28782. return self;
  28783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28784. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.ConsoleTranscript)});
  28785. //>>excludeEnd("ctx");
  28786. },
  28787. //>>excludeStart("ide", pragmas.excludeIdeData);
  28788. args: ["anObject"],
  28789. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<console.log(String(_st(anObject)._asString()))>",
  28790. referencedClasses: [],
  28791. //>>excludeEnd("ide");
  28792. messageSends: []
  28793. }),
  28794. globals.ConsoleTranscript);
  28795. smalltalk.addMethod(
  28796. smalltalk.method({
  28797. selector: "initialize",
  28798. protocol: 'initialization',
  28799. fn: function (){
  28800. var self=this;
  28801. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  28802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28803. return smalltalk.withContext(function($ctx1) {
  28804. //>>excludeEnd("ctx");
  28805. _st($Transcript())._registerIfNone_(self._new());
  28806. return self;
  28807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28808. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleTranscript.klass)});
  28809. //>>excludeEnd("ctx");
  28810. },
  28811. //>>excludeStart("ide", pragmas.excludeIdeData);
  28812. args: [],
  28813. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  28814. referencedClasses: ["Transcript"],
  28815. //>>excludeEnd("ide");
  28816. messageSends: ["registerIfNone:", "new"]
  28817. }),
  28818. globals.ConsoleTranscript.klass);
  28819. });
  28820. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  28821. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  28822. smalltalk.addPackage('Kernel-Announcements');
  28823. smalltalk.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  28824. smalltalk.addClass('AnnouncementSubscription', globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  28825. //>>excludeStart("ide", pragmas.excludeIdeData);
  28826. globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  28827. //>>excludeEnd("ide");
  28828. smalltalk.addMethod(
  28829. smalltalk.method({
  28830. selector: "announcementClass",
  28831. protocol: 'accessing',
  28832. fn: function (){
  28833. var self=this;
  28834. var $1;
  28835. $1=self["@announcementClass"];
  28836. return $1;
  28837. },
  28838. //>>excludeStart("ide", pragmas.excludeIdeData);
  28839. args: [],
  28840. source: "announcementClass\x0a\x09^ announcementClass",
  28841. referencedClasses: [],
  28842. //>>excludeEnd("ide");
  28843. messageSends: []
  28844. }),
  28845. globals.AnnouncementSubscription);
  28846. smalltalk.addMethod(
  28847. smalltalk.method({
  28848. selector: "announcementClass:",
  28849. protocol: 'accessing',
  28850. fn: function (aClass){
  28851. var self=this;
  28852. self["@announcementClass"]=aClass;
  28853. return self;
  28854. },
  28855. //>>excludeStart("ide", pragmas.excludeIdeData);
  28856. args: ["aClass"],
  28857. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  28858. referencedClasses: [],
  28859. //>>excludeEnd("ide");
  28860. messageSends: []
  28861. }),
  28862. globals.AnnouncementSubscription);
  28863. smalltalk.addMethod(
  28864. smalltalk.method({
  28865. selector: "block",
  28866. protocol: 'accessing',
  28867. fn: function (){
  28868. var self=this;
  28869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28870. return smalltalk.withContext(function($ctx1) {
  28871. //>>excludeEnd("ctx");
  28872. var $1;
  28873. self._deprecatedAPI();
  28874. $1=self._valuable();
  28875. return $1;
  28876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28877. }, function($ctx1) {$ctx1.fill(self,"block",{},globals.AnnouncementSubscription)});
  28878. //>>excludeEnd("ctx");
  28879. },
  28880. //>>excludeStart("ide", pragmas.excludeIdeData);
  28881. args: [],
  28882. source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
  28883. referencedClasses: [],
  28884. //>>excludeEnd("ide");
  28885. messageSends: ["deprecatedAPI", "valuable"]
  28886. }),
  28887. globals.AnnouncementSubscription);
  28888. smalltalk.addMethod(
  28889. smalltalk.method({
  28890. selector: "block:",
  28891. protocol: 'accessing',
  28892. fn: function (aValuable){
  28893. var self=this;
  28894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28895. return smalltalk.withContext(function($ctx1) {
  28896. //>>excludeEnd("ctx");
  28897. self._deprecatedAPI();
  28898. self._valuable_(aValuable);
  28899. return self;
  28900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28901. }, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},globals.AnnouncementSubscription)});
  28902. //>>excludeEnd("ctx");
  28903. },
  28904. //>>excludeStart("ide", pragmas.excludeIdeData);
  28905. args: ["aValuable"],
  28906. source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
  28907. referencedClasses: [],
  28908. //>>excludeEnd("ide");
  28909. messageSends: ["deprecatedAPI", "valuable:"]
  28910. }),
  28911. globals.AnnouncementSubscription);
  28912. smalltalk.addMethod(
  28913. smalltalk.method({
  28914. selector: "deliver:",
  28915. protocol: 'announcing',
  28916. fn: function (anAnnouncement){
  28917. var self=this;
  28918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28919. return smalltalk.withContext(function($ctx1) {
  28920. //>>excludeEnd("ctx");
  28921. var $1;
  28922. $1=self._handlesAnnouncement_(anAnnouncement);
  28923. if(smalltalk.assert($1)){
  28924. _st(self._valuable())._value_(anAnnouncement);
  28925. };
  28926. return self;
  28927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28928. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)});
  28929. //>>excludeEnd("ctx");
  28930. },
  28931. //>>excludeStart("ide", pragmas.excludeIdeData);
  28932. args: ["anAnnouncement"],
  28933. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  28934. referencedClasses: [],
  28935. //>>excludeEnd("ide");
  28936. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  28937. }),
  28938. globals.AnnouncementSubscription);
  28939. smalltalk.addMethod(
  28940. smalltalk.method({
  28941. selector: "handlesAnnouncement:",
  28942. protocol: 'announcing',
  28943. fn: function (anAnnouncement){
  28944. var self=this;
  28945. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  28946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28947. return smalltalk.withContext(function($ctx1) {
  28948. //>>excludeEnd("ctx");
  28949. var $3,$4,$2,$1,$receiver;
  28950. $3=_st($Smalltalk())._globals();
  28951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28952. $ctx1.sendIdx["globals"]=1;
  28953. //>>excludeEnd("ctx");
  28954. $4=_st(self._announcementClass())._name();
  28955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28956. $ctx1.sendIdx["name"]=1;
  28957. //>>excludeEnd("ctx");
  28958. $2=_st($3)._at_($4);
  28959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28960. $ctx1.sendIdx["at:"]=1;
  28961. //>>excludeEnd("ctx");
  28962. if(($receiver = $2) == null || $receiver.isNil){
  28963. return false;
  28964. } else {
  28965. var class_;
  28966. class_=$receiver;
  28967. $1=_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  28968. };
  28969. return $1;
  28970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28971. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)});
  28972. //>>excludeEnd("ctx");
  28973. },
  28974. //>>excludeStart("ide", pragmas.excludeIdeData);
  28975. args: ["anAnnouncement"],
  28976. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  28977. referencedClasses: ["Smalltalk"],
  28978. //>>excludeEnd("ide");
  28979. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  28980. }),
  28981. globals.AnnouncementSubscription);
  28982. smalltalk.addMethod(
  28983. smalltalk.method({
  28984. selector: "receiver",
  28985. protocol: 'accessing',
  28986. fn: function (){
  28987. var self=this;
  28988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28989. return smalltalk.withContext(function($ctx1) {
  28990. //>>excludeEnd("ctx");
  28991. var $1;
  28992. $1=_st(self._valuable())._receiver();
  28993. return $1;
  28994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28995. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.AnnouncementSubscription)});
  28996. //>>excludeEnd("ctx");
  28997. },
  28998. //>>excludeStart("ide", pragmas.excludeIdeData);
  28999. args: [],
  29000. source: "receiver\x0a\x09^ self valuable receiver",
  29001. referencedClasses: [],
  29002. //>>excludeEnd("ide");
  29003. messageSends: ["receiver", "valuable"]
  29004. }),
  29005. globals.AnnouncementSubscription);
  29006. smalltalk.addMethod(
  29007. smalltalk.method({
  29008. selector: "valuable",
  29009. protocol: 'accessing',
  29010. fn: function (){
  29011. var self=this;
  29012. var $1;
  29013. $1=self["@valuable"];
  29014. return $1;
  29015. },
  29016. //>>excludeStart("ide", pragmas.excludeIdeData);
  29017. args: [],
  29018. source: "valuable\x0a\x09^ valuable",
  29019. referencedClasses: [],
  29020. //>>excludeEnd("ide");
  29021. messageSends: []
  29022. }),
  29023. globals.AnnouncementSubscription);
  29024. smalltalk.addMethod(
  29025. smalltalk.method({
  29026. selector: "valuable:",
  29027. protocol: 'accessing',
  29028. fn: function (aValuable){
  29029. var self=this;
  29030. self["@valuable"]=aValuable;
  29031. return self;
  29032. },
  29033. //>>excludeStart("ide", pragmas.excludeIdeData);
  29034. args: ["aValuable"],
  29035. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  29036. referencedClasses: [],
  29037. //>>excludeEnd("ide");
  29038. messageSends: []
  29039. }),
  29040. globals.AnnouncementSubscription);
  29041. smalltalk.addClass('AnnouncementValuable', globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  29042. //>>excludeStart("ide", pragmas.excludeIdeData);
  29043. globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  29044. //>>excludeEnd("ide");
  29045. smalltalk.addMethod(
  29046. smalltalk.method({
  29047. selector: "receiver",
  29048. protocol: 'accessing',
  29049. fn: function (){
  29050. var self=this;
  29051. var $1;
  29052. $1=self["@receiver"];
  29053. return $1;
  29054. },
  29055. //>>excludeStart("ide", pragmas.excludeIdeData);
  29056. args: [],
  29057. source: "receiver\x0a\x09^ receiver",
  29058. referencedClasses: [],
  29059. //>>excludeEnd("ide");
  29060. messageSends: []
  29061. }),
  29062. globals.AnnouncementValuable);
  29063. smalltalk.addMethod(
  29064. smalltalk.method({
  29065. selector: "receiver:",
  29066. protocol: 'accessing',
  29067. fn: function (anObject){
  29068. var self=this;
  29069. self["@receiver"]=anObject;
  29070. return self;
  29071. },
  29072. //>>excludeStart("ide", pragmas.excludeIdeData);
  29073. args: ["anObject"],
  29074. source: "receiver: anObject\x0a\x09receiver := anObject",
  29075. referencedClasses: [],
  29076. //>>excludeEnd("ide");
  29077. messageSends: []
  29078. }),
  29079. globals.AnnouncementValuable);
  29080. smalltalk.addMethod(
  29081. smalltalk.method({
  29082. selector: "valuable",
  29083. protocol: 'accessing',
  29084. fn: function (){
  29085. var self=this;
  29086. var $1;
  29087. $1=self["@valuable"];
  29088. return $1;
  29089. },
  29090. //>>excludeStart("ide", pragmas.excludeIdeData);
  29091. args: [],
  29092. source: "valuable\x0a\x09^ valuable",
  29093. referencedClasses: [],
  29094. //>>excludeEnd("ide");
  29095. messageSends: []
  29096. }),
  29097. globals.AnnouncementValuable);
  29098. smalltalk.addMethod(
  29099. smalltalk.method({
  29100. selector: "valuable:",
  29101. protocol: 'accessing',
  29102. fn: function (anObject){
  29103. var self=this;
  29104. self["@valuable"]=anObject;
  29105. return self;
  29106. },
  29107. //>>excludeStart("ide", pragmas.excludeIdeData);
  29108. args: ["anObject"],
  29109. source: "valuable: anObject\x0a\x09valuable := anObject",
  29110. referencedClasses: [],
  29111. //>>excludeEnd("ide");
  29112. messageSends: []
  29113. }),
  29114. globals.AnnouncementValuable);
  29115. smalltalk.addMethod(
  29116. smalltalk.method({
  29117. selector: "value",
  29118. protocol: 'evaluating',
  29119. fn: function (){
  29120. var self=this;
  29121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29122. return smalltalk.withContext(function($ctx1) {
  29123. //>>excludeEnd("ctx");
  29124. var $1;
  29125. $1=_st(self._valuable())._value();
  29126. return $1;
  29127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29128. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.AnnouncementValuable)});
  29129. //>>excludeEnd("ctx");
  29130. },
  29131. //>>excludeStart("ide", pragmas.excludeIdeData);
  29132. args: [],
  29133. source: "value\x0a\x09^ self valuable value",
  29134. referencedClasses: [],
  29135. //>>excludeEnd("ide");
  29136. messageSends: ["value", "valuable"]
  29137. }),
  29138. globals.AnnouncementValuable);
  29139. smalltalk.addMethod(
  29140. smalltalk.method({
  29141. selector: "value:",
  29142. protocol: 'evaluating',
  29143. fn: function (anObject){
  29144. var self=this;
  29145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29146. return smalltalk.withContext(function($ctx1) {
  29147. //>>excludeEnd("ctx");
  29148. var $1;
  29149. $1=_st(self._valuable())._value_(anObject);
  29150. return $1;
  29151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29152. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.AnnouncementValuable)});
  29153. //>>excludeEnd("ctx");
  29154. },
  29155. //>>excludeStart("ide", pragmas.excludeIdeData);
  29156. args: ["anObject"],
  29157. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  29158. referencedClasses: [],
  29159. //>>excludeEnd("ide");
  29160. messageSends: ["value:", "valuable"]
  29161. }),
  29162. globals.AnnouncementValuable);
  29163. smalltalk.addClass('Announcer', globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  29164. //>>excludeStart("ide", pragmas.excludeIdeData);
  29165. globals.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a SystemAnnouncer current\x0a on: ClassAdded\x0a do: [ :ann | window alert: ann theClass name, ' added' ].";
  29166. //>>excludeEnd("ide");
  29167. smalltalk.addMethod(
  29168. smalltalk.method({
  29169. selector: "announce:",
  29170. protocol: 'announcing',
  29171. fn: function (anAnnouncement){
  29172. var self=this;
  29173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29174. return smalltalk.withContext(function($ctx1) {
  29175. //>>excludeEnd("ctx");
  29176. _st(self["@subscriptions"])._do_((function(each){
  29177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29178. return smalltalk.withContext(function($ctx2) {
  29179. //>>excludeEnd("ctx");
  29180. return _st(each)._deliver_(anAnnouncement);
  29181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29182. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29183. //>>excludeEnd("ctx");
  29184. }));
  29185. return self;
  29186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29187. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},globals.Announcer)});
  29188. //>>excludeEnd("ctx");
  29189. },
  29190. //>>excludeStart("ide", pragmas.excludeIdeData);
  29191. args: ["anAnnouncement"],
  29192. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  29193. referencedClasses: [],
  29194. //>>excludeEnd("ide");
  29195. messageSends: ["do:", "deliver:"]
  29196. }),
  29197. globals.Announcer);
  29198. smalltalk.addMethod(
  29199. smalltalk.method({
  29200. selector: "initialize",
  29201. protocol: 'initialization',
  29202. fn: function (){
  29203. var self=this;
  29204. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  29205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29206. return smalltalk.withContext(function($ctx1) {
  29207. //>>excludeEnd("ctx");
  29208. (
  29209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29210. $ctx1.supercall = true,
  29211. //>>excludeEnd("ctx");
  29212. globals.Announcer.superclass.fn.prototype._initialize.apply(_st(self), []));
  29213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29214. $ctx1.supercall = false;
  29215. //>>excludeEnd("ctx");;
  29216. self["@subscriptions"]=_st($OrderedCollection())._new();
  29217. return self;
  29218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29219. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Announcer)});
  29220. //>>excludeEnd("ctx");
  29221. },
  29222. //>>excludeStart("ide", pragmas.excludeIdeData);
  29223. args: [],
  29224. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  29225. referencedClasses: ["OrderedCollection"],
  29226. //>>excludeEnd("ide");
  29227. messageSends: ["initialize", "new"]
  29228. }),
  29229. globals.Announcer);
  29230. smalltalk.addMethod(
  29231. smalltalk.method({
  29232. selector: "on:do:",
  29233. protocol: 'subscribing',
  29234. fn: function (aClass,aBlock){
  29235. var self=this;
  29236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29237. return smalltalk.withContext(function($ctx1) {
  29238. //>>excludeEnd("ctx");
  29239. self._on_do_for_(aClass,aBlock,nil);
  29240. return self;
  29241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29242. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},globals.Announcer)});
  29243. //>>excludeEnd("ctx");
  29244. },
  29245. //>>excludeStart("ide", pragmas.excludeIdeData);
  29246. args: ["aClass", "aBlock"],
  29247. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  29248. referencedClasses: [],
  29249. //>>excludeEnd("ide");
  29250. messageSends: ["on:do:for:"]
  29251. }),
  29252. globals.Announcer);
  29253. smalltalk.addMethod(
  29254. smalltalk.method({
  29255. selector: "on:do:for:",
  29256. protocol: 'subscribing',
  29257. fn: function (aClass,aBlock,aReceiver){
  29258. var self=this;
  29259. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  29260. function $AnnouncementValuable(){return globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
  29261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29262. return smalltalk.withContext(function($ctx1) {
  29263. //>>excludeEnd("ctx");
  29264. var $1,$3,$4,$6,$7,$5,$8,$2;
  29265. $1=self["@subscriptions"];
  29266. $3=_st($AnnouncementSubscription())._new();
  29267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29268. $ctx1.sendIdx["new"]=1;
  29269. //>>excludeEnd("ctx");
  29270. $4=$3;
  29271. $6=_st($AnnouncementValuable())._new();
  29272. _st($6)._valuable_(aBlock);
  29273. _st($6)._receiver_(aReceiver);
  29274. $7=_st($6)._yourself();
  29275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29276. $ctx1.sendIdx["yourself"]=1;
  29277. //>>excludeEnd("ctx");
  29278. $5=$7;
  29279. _st($4)._valuable_($5);
  29280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29281. $ctx1.sendIdx["valuable:"]=1;
  29282. //>>excludeEnd("ctx");
  29283. _st($3)._announcementClass_(aClass);
  29284. $8=_st($3)._yourself();
  29285. $2=$8;
  29286. _st($1)._add_($2);
  29287. return self;
  29288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29289. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},globals.Announcer)});
  29290. //>>excludeEnd("ctx");
  29291. },
  29292. //>>excludeStart("ide", pragmas.excludeIdeData);
  29293. args: ["aClass", "aBlock", "aReceiver"],
  29294. source: "on: aClass do: aBlock for: aReceiver\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (AnnouncementValuable new\x0a\x09\x09\x09valuable: aBlock;\x0a\x09\x09\x09receiver: aReceiver;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  29295. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  29296. //>>excludeEnd("ide");
  29297. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  29298. }),
  29299. globals.Announcer);
  29300. smalltalk.addMethod(
  29301. smalltalk.method({
  29302. selector: "on:doOnce:",
  29303. protocol: 'subscribing',
  29304. fn: function (aClass,aBlock){
  29305. var self=this;
  29306. var subscription;
  29307. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  29308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29309. return smalltalk.withContext(function($ctx1) {
  29310. //>>excludeEnd("ctx");
  29311. var $1,$2;
  29312. $1=_st($AnnouncementSubscription())._new();
  29313. _st($1)._announcementClass_(aClass);
  29314. $2=_st($1)._yourself();
  29315. subscription=$2;
  29316. _st(subscription)._valuable_((function(ann){
  29317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29318. return smalltalk.withContext(function($ctx2) {
  29319. //>>excludeEnd("ctx");
  29320. _st(self["@subscriptions"])._remove_(subscription);
  29321. return _st(aBlock)._value_(ann);
  29322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29323. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  29324. //>>excludeEnd("ctx");
  29325. }));
  29326. _st(self["@subscriptions"])._add_(subscription);
  29327. return self;
  29328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29329. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},globals.Announcer)});
  29330. //>>excludeEnd("ctx");
  29331. },
  29332. //>>excludeStart("ide", pragmas.excludeIdeData);
  29333. args: ["aClass", "aBlock"],
  29334. source: "on: aClass doOnce: aBlock\x0a\x09| subscription |\x0a\x09\x0a\x09subscription := AnnouncementSubscription new\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself.\x0a\x09subscription valuable: [ :ann |\x0a\x09\x09subscriptions remove: subscription.\x0a\x09\x09aBlock value: ann ].\x0a\x0a\x09subscriptions add: subscription",
  29335. referencedClasses: ["AnnouncementSubscription"],
  29336. //>>excludeEnd("ide");
  29337. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  29338. }),
  29339. globals.Announcer);
  29340. smalltalk.addMethod(
  29341. smalltalk.method({
  29342. selector: "on:send:to:",
  29343. protocol: 'subscribing',
  29344. fn: function (aClass,aSelector,anObject){
  29345. var self=this;
  29346. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  29347. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  29348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29349. return smalltalk.withContext(function($ctx1) {
  29350. //>>excludeEnd("ctx");
  29351. var $1,$3,$4,$6,$7,$5,$8,$2;
  29352. $1=self["@subscriptions"];
  29353. $3=_st($AnnouncementSubscription())._new();
  29354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29355. $ctx1.sendIdx["new"]=1;
  29356. //>>excludeEnd("ctx");
  29357. $4=$3;
  29358. $6=_st($MessageSend())._new();
  29359. _st($6)._receiver_(anObject);
  29360. _st($6)._selector_(aSelector);
  29361. $7=_st($6)._yourself();
  29362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29363. $ctx1.sendIdx["yourself"]=1;
  29364. //>>excludeEnd("ctx");
  29365. $5=$7;
  29366. _st($4)._valuable_($5);
  29367. _st($3)._announcementClass_(aClass);
  29368. $8=_st($3)._yourself();
  29369. $2=$8;
  29370. _st($1)._add_($2);
  29371. return self;
  29372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29373. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},globals.Announcer)});
  29374. //>>excludeEnd("ctx");
  29375. },
  29376. //>>excludeStart("ide", pragmas.excludeIdeData);
  29377. args: ["aClass", "aSelector", "anObject"],
  29378. source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  29379. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  29380. //>>excludeEnd("ide");
  29381. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  29382. }),
  29383. globals.Announcer);
  29384. smalltalk.addMethod(
  29385. smalltalk.method({
  29386. selector: "unsubscribe:",
  29387. protocol: 'subscribing',
  29388. fn: function (anObject){
  29389. var self=this;
  29390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29391. return smalltalk.withContext(function($ctx1) {
  29392. //>>excludeEnd("ctx");
  29393. self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
  29394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29395. return smalltalk.withContext(function($ctx2) {
  29396. //>>excludeEnd("ctx");
  29397. return _st(_st(each)._receiver()).__eq(anObject);
  29398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29400. //>>excludeEnd("ctx");
  29401. }));
  29402. return self;
  29403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29404. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},globals.Announcer)});
  29405. //>>excludeEnd("ctx");
  29406. },
  29407. //>>excludeStart("ide", pragmas.excludeIdeData);
  29408. args: ["anObject"],
  29409. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  29410. referencedClasses: [],
  29411. //>>excludeEnd("ide");
  29412. messageSends: ["reject:", "=", "receiver"]
  29413. }),
  29414. globals.Announcer);
  29415. smalltalk.addClass('SystemAnnouncer', globals.Announcer, [], 'Kernel-Announcements');
  29416. //>>excludeStart("ide", pragmas.excludeIdeData);
  29417. globals.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`";
  29418. //>>excludeEnd("ide");
  29419. globals.SystemAnnouncer.klass.iVarNames = ['current'];
  29420. smalltalk.addMethod(
  29421. smalltalk.method({
  29422. selector: "current",
  29423. protocol: 'accessing',
  29424. fn: function (){
  29425. var self=this;
  29426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29427. return smalltalk.withContext(function($ctx1) {
  29428. //>>excludeEnd("ctx");
  29429. var $2,$1,$receiver;
  29430. $2=self["@current"];
  29431. if(($receiver = $2) == null || $receiver.isNil){
  29432. self["@current"]=(
  29433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29434. $ctx1.supercall = true,
  29435. //>>excludeEnd("ctx");
  29436. globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply(_st(self), []));
  29437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29438. $ctx1.supercall = false;
  29439. //>>excludeEnd("ctx");;
  29440. $1=self["@current"];
  29441. } else {
  29442. $1=$2;
  29443. };
  29444. return $1;
  29445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29446. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SystemAnnouncer.klass)});
  29447. //>>excludeEnd("ctx");
  29448. },
  29449. //>>excludeStart("ide", pragmas.excludeIdeData);
  29450. args: [],
  29451. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  29452. referencedClasses: [],
  29453. //>>excludeEnd("ide");
  29454. messageSends: ["ifNil:", "new"]
  29455. }),
  29456. globals.SystemAnnouncer.klass);
  29457. smalltalk.addMethod(
  29458. smalltalk.method({
  29459. selector: "new",
  29460. protocol: 'instance creation',
  29461. fn: function (){
  29462. var self=this;
  29463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29464. return smalltalk.withContext(function($ctx1) {
  29465. //>>excludeEnd("ctx");
  29466. self._shouldNotImplement();
  29467. return self;
  29468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29469. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.SystemAnnouncer.klass)});
  29470. //>>excludeEnd("ctx");
  29471. },
  29472. //>>excludeStart("ide", pragmas.excludeIdeData);
  29473. args: [],
  29474. source: "new\x0a\x09self shouldNotImplement",
  29475. referencedClasses: [],
  29476. //>>excludeEnd("ide");
  29477. messageSends: ["shouldNotImplement"]
  29478. }),
  29479. globals.SystemAnnouncer.klass);
  29480. smalltalk.addClass('SystemAnnouncement', globals.Object, [], 'Kernel-Announcements');
  29481. //>>excludeStart("ide", pragmas.excludeIdeData);
  29482. globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  29483. //>>excludeEnd("ide");
  29484. smalltalk.addMethod(
  29485. smalltalk.method({
  29486. selector: "heliosClass",
  29487. protocol: 'helios',
  29488. fn: function (){
  29489. var self=this;
  29490. return "announcement";
  29491. },
  29492. //>>excludeStart("ide", pragmas.excludeIdeData);
  29493. args: [],
  29494. source: "heliosClass\x0a\x09^ 'announcement'",
  29495. referencedClasses: [],
  29496. //>>excludeEnd("ide");
  29497. messageSends: []
  29498. }),
  29499. globals.SystemAnnouncement.klass);
  29500. smalltalk.addClass('ClassAnnouncement', globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  29501. //>>excludeStart("ide", pragmas.excludeIdeData);
  29502. globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  29503. //>>excludeEnd("ide");
  29504. smalltalk.addMethod(
  29505. smalltalk.method({
  29506. selector: "theClass",
  29507. protocol: 'accessing',
  29508. fn: function (){
  29509. var self=this;
  29510. var $1;
  29511. $1=self["@theClass"];
  29512. return $1;
  29513. },
  29514. //>>excludeStart("ide", pragmas.excludeIdeData);
  29515. args: [],
  29516. source: "theClass\x0a\x09^ theClass",
  29517. referencedClasses: [],
  29518. //>>excludeEnd("ide");
  29519. messageSends: []
  29520. }),
  29521. globals.ClassAnnouncement);
  29522. smalltalk.addMethod(
  29523. smalltalk.method({
  29524. selector: "theClass:",
  29525. protocol: 'accessing',
  29526. fn: function (aClass){
  29527. var self=this;
  29528. self["@theClass"]=aClass;
  29529. return self;
  29530. },
  29531. //>>excludeStart("ide", pragmas.excludeIdeData);
  29532. args: ["aClass"],
  29533. source: "theClass: aClass\x0a\x09theClass := aClass",
  29534. referencedClasses: [],
  29535. //>>excludeEnd("ide");
  29536. messageSends: []
  29537. }),
  29538. globals.ClassAnnouncement);
  29539. smalltalk.addClass('ClassAdded', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29540. //>>excludeStart("ide", pragmas.excludeIdeData);
  29541. globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  29542. //>>excludeEnd("ide");
  29543. smalltalk.addClass('ClassCommentChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29544. //>>excludeStart("ide", pragmas.excludeIdeData);
  29545. globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  29546. //>>excludeEnd("ide");
  29547. smalltalk.addClass('ClassDefinitionChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29548. //>>excludeStart("ide", pragmas.excludeIdeData);
  29549. globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  29550. //>>excludeEnd("ide");
  29551. smalltalk.addClass('ClassMigrated', globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  29552. //>>excludeStart("ide", pragmas.excludeIdeData);
  29553. globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  29554. //>>excludeEnd("ide");
  29555. smalltalk.addMethod(
  29556. smalltalk.method({
  29557. selector: "oldClass",
  29558. protocol: 'accessing',
  29559. fn: function (){
  29560. var self=this;
  29561. var $1;
  29562. $1=self["@oldClass"];
  29563. return $1;
  29564. },
  29565. //>>excludeStart("ide", pragmas.excludeIdeData);
  29566. args: [],
  29567. source: "oldClass\x0a\x09^ oldClass",
  29568. referencedClasses: [],
  29569. //>>excludeEnd("ide");
  29570. messageSends: []
  29571. }),
  29572. globals.ClassMigrated);
  29573. smalltalk.addMethod(
  29574. smalltalk.method({
  29575. selector: "oldClass:",
  29576. protocol: 'accessing',
  29577. fn: function (aClass){
  29578. var self=this;
  29579. self["@oldClass"]=aClass;
  29580. return self;
  29581. },
  29582. //>>excludeStart("ide", pragmas.excludeIdeData);
  29583. args: ["aClass"],
  29584. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  29585. referencedClasses: [],
  29586. //>>excludeEnd("ide");
  29587. messageSends: []
  29588. }),
  29589. globals.ClassMigrated);
  29590. smalltalk.addClass('ClassMoved', globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  29591. //>>excludeStart("ide", pragmas.excludeIdeData);
  29592. globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  29593. //>>excludeEnd("ide");
  29594. smalltalk.addMethod(
  29595. smalltalk.method({
  29596. selector: "oldPackage",
  29597. protocol: 'accessing',
  29598. fn: function (){
  29599. var self=this;
  29600. var $1;
  29601. $1=self["@oldPackage"];
  29602. return $1;
  29603. },
  29604. //>>excludeStart("ide", pragmas.excludeIdeData);
  29605. args: [],
  29606. source: "oldPackage\x0a\x09^ oldPackage",
  29607. referencedClasses: [],
  29608. //>>excludeEnd("ide");
  29609. messageSends: []
  29610. }),
  29611. globals.ClassMoved);
  29612. smalltalk.addMethod(
  29613. smalltalk.method({
  29614. selector: "oldPackage:",
  29615. protocol: 'accessing',
  29616. fn: function (aPackage){
  29617. var self=this;
  29618. self["@oldPackage"]=aPackage;
  29619. return self;
  29620. },
  29621. //>>excludeStart("ide", pragmas.excludeIdeData);
  29622. args: ["aPackage"],
  29623. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  29624. referencedClasses: [],
  29625. //>>excludeEnd("ide");
  29626. messageSends: []
  29627. }),
  29628. globals.ClassMoved);
  29629. smalltalk.addClass('ClassRemoved', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29630. //>>excludeStart("ide", pragmas.excludeIdeData);
  29631. globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  29632. //>>excludeEnd("ide");
  29633. smalltalk.addClass('ClassRenamed', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29634. //>>excludeStart("ide", pragmas.excludeIdeData);
  29635. globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  29636. //>>excludeEnd("ide");
  29637. smalltalk.addClass('MethodAnnouncement', globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  29638. //>>excludeStart("ide", pragmas.excludeIdeData);
  29639. globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  29640. //>>excludeEnd("ide");
  29641. smalltalk.addMethod(
  29642. smalltalk.method({
  29643. selector: "method",
  29644. protocol: 'accessing',
  29645. fn: function (){
  29646. var self=this;
  29647. var $1;
  29648. $1=self["@method"];
  29649. return $1;
  29650. },
  29651. //>>excludeStart("ide", pragmas.excludeIdeData);
  29652. args: [],
  29653. source: "method\x0a\x09^ method",
  29654. referencedClasses: [],
  29655. //>>excludeEnd("ide");
  29656. messageSends: []
  29657. }),
  29658. globals.MethodAnnouncement);
  29659. smalltalk.addMethod(
  29660. smalltalk.method({
  29661. selector: "method:",
  29662. protocol: 'accessing',
  29663. fn: function (aCompiledMethod){
  29664. var self=this;
  29665. self["@method"]=aCompiledMethod;
  29666. return self;
  29667. },
  29668. //>>excludeStart("ide", pragmas.excludeIdeData);
  29669. args: ["aCompiledMethod"],
  29670. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  29671. referencedClasses: [],
  29672. //>>excludeEnd("ide");
  29673. messageSends: []
  29674. }),
  29675. globals.MethodAnnouncement);
  29676. smalltalk.addClass('MethodAdded', globals.MethodAnnouncement, [], 'Kernel-Announcements');
  29677. //>>excludeStart("ide", pragmas.excludeIdeData);
  29678. globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  29679. //>>excludeEnd("ide");
  29680. smalltalk.addClass('MethodModified', globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  29681. //>>excludeStart("ide", pragmas.excludeIdeData);
  29682. globals.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced.";
  29683. //>>excludeEnd("ide");
  29684. smalltalk.addMethod(
  29685. smalltalk.method({
  29686. selector: "oldMethod",
  29687. protocol: 'accessing',
  29688. fn: function (){
  29689. var self=this;
  29690. var $1;
  29691. $1=self["@oldMethod"];
  29692. return $1;
  29693. },
  29694. //>>excludeStart("ide", pragmas.excludeIdeData);
  29695. args: [],
  29696. source: "oldMethod\x0a\x09^ oldMethod",
  29697. referencedClasses: [],
  29698. //>>excludeEnd("ide");
  29699. messageSends: []
  29700. }),
  29701. globals.MethodModified);
  29702. smalltalk.addMethod(
  29703. smalltalk.method({
  29704. selector: "oldMethod:",
  29705. protocol: 'accessing',
  29706. fn: function (aMethod){
  29707. var self=this;
  29708. self["@oldMethod"]=aMethod;
  29709. return self;
  29710. },
  29711. //>>excludeStart("ide", pragmas.excludeIdeData);
  29712. args: ["aMethod"],
  29713. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  29714. referencedClasses: [],
  29715. //>>excludeEnd("ide");
  29716. messageSends: []
  29717. }),
  29718. globals.MethodModified);
  29719. smalltalk.addClass('MethodMoved', globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  29720. //>>excludeStart("ide", pragmas.excludeIdeData);
  29721. globals.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  29722. //>>excludeEnd("ide");
  29723. smalltalk.addMethod(
  29724. smalltalk.method({
  29725. selector: "oldProtocol",
  29726. protocol: 'accessing',
  29727. fn: function (){
  29728. var self=this;
  29729. var $1;
  29730. $1=self["@oldProtocol"];
  29731. return $1;
  29732. },
  29733. //>>excludeStart("ide", pragmas.excludeIdeData);
  29734. args: [],
  29735. source: "oldProtocol\x0a\x09^ oldProtocol",
  29736. referencedClasses: [],
  29737. //>>excludeEnd("ide");
  29738. messageSends: []
  29739. }),
  29740. globals.MethodMoved);
  29741. smalltalk.addMethod(
  29742. smalltalk.method({
  29743. selector: "oldProtocol:",
  29744. protocol: 'accessing',
  29745. fn: function (aString){
  29746. var self=this;
  29747. self["@oldProtocol"]=aString;
  29748. return self;
  29749. },
  29750. //>>excludeStart("ide", pragmas.excludeIdeData);
  29751. args: ["aString"],
  29752. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  29753. referencedClasses: [],
  29754. //>>excludeEnd("ide");
  29755. messageSends: []
  29756. }),
  29757. globals.MethodMoved);
  29758. smalltalk.addClass('MethodRemoved', globals.MethodAnnouncement, [], 'Kernel-Announcements');
  29759. //>>excludeStart("ide", pragmas.excludeIdeData);
  29760. globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  29761. //>>excludeEnd("ide");
  29762. smalltalk.addClass('PackageAnnouncement', globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  29763. //>>excludeStart("ide", pragmas.excludeIdeData);
  29764. globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  29765. //>>excludeEnd("ide");
  29766. smalltalk.addMethod(
  29767. smalltalk.method({
  29768. selector: "package",
  29769. protocol: 'accessing',
  29770. fn: function (){
  29771. var self=this;
  29772. var $1;
  29773. $1=self["@package"];
  29774. return $1;
  29775. },
  29776. //>>excludeStart("ide", pragmas.excludeIdeData);
  29777. args: [],
  29778. source: "package\x0a\x09^ package",
  29779. referencedClasses: [],
  29780. //>>excludeEnd("ide");
  29781. messageSends: []
  29782. }),
  29783. globals.PackageAnnouncement);
  29784. smalltalk.addMethod(
  29785. smalltalk.method({
  29786. selector: "package:",
  29787. protocol: 'accessing',
  29788. fn: function (aPackage){
  29789. var self=this;
  29790. self["@package"]=aPackage;
  29791. return self;
  29792. },
  29793. //>>excludeStart("ide", pragmas.excludeIdeData);
  29794. args: ["aPackage"],
  29795. source: "package: aPackage\x0a\x09package := aPackage",
  29796. referencedClasses: [],
  29797. //>>excludeEnd("ide");
  29798. messageSends: []
  29799. }),
  29800. globals.PackageAnnouncement);
  29801. smalltalk.addClass('PackageAdded', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  29802. //>>excludeStart("ide", pragmas.excludeIdeData);
  29803. globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  29804. //>>excludeEnd("ide");
  29805. smalltalk.addClass('PackageClean', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  29806. //>>excludeStart("ide", pragmas.excludeIdeData);
  29807. globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  29808. //>>excludeEnd("ide");
  29809. smalltalk.addClass('PackageDirty', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  29810. //>>excludeStart("ide", pragmas.excludeIdeData);
  29811. globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  29812. //>>excludeEnd("ide");
  29813. smalltalk.addClass('PackageRemoved', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  29814. //>>excludeStart("ide", pragmas.excludeIdeData);
  29815. globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  29816. //>>excludeEnd("ide");
  29817. smalltalk.addClass('ProtocolAnnouncement', globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  29818. //>>excludeStart("ide", pragmas.excludeIdeData);
  29819. globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  29820. //>>excludeEnd("ide");
  29821. smalltalk.addMethod(
  29822. smalltalk.method({
  29823. selector: "package",
  29824. protocol: 'accessing',
  29825. fn: function (){
  29826. var self=this;
  29827. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  29828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29829. return smalltalk.withContext(function($ctx1) {
  29830. //>>excludeEnd("ctx");
  29831. var $2,$1,$3,$4;
  29832. $2=self._protocol();
  29833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29834. $ctx1.sendIdx["protocol"]=1;
  29835. //>>excludeEnd("ctx");
  29836. $1=_st($2)._beginsWith_("*");
  29837. if(! smalltalk.assert($1)){
  29838. $3=_st(self._theClass())._package();
  29839. return $3;
  29840. };
  29841. $4=_st($Package())._named_ifAbsent_(_st(self._protocol())._allButFirst(),(function(){
  29842. return nil;
  29843. }));
  29844. return $4;
  29845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29846. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.ProtocolAnnouncement)});
  29847. //>>excludeEnd("ctx");
  29848. },
  29849. //>>excludeStart("ide", pragmas.excludeIdeData);
  29850. args: [],
  29851. source: "package\x0a\x0a\x09(self protocol beginsWith: '*') ifFalse: [\x0a\x09\x09^ self theClass package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: self protocol allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  29852. referencedClasses: ["Package"],
  29853. //>>excludeEnd("ide");
  29854. messageSends: ["ifFalse:", "beginsWith:", "protocol", "package", "theClass", "named:ifAbsent:", "allButFirst"]
  29855. }),
  29856. globals.ProtocolAnnouncement);
  29857. smalltalk.addMethod(
  29858. smalltalk.method({
  29859. selector: "protocol",
  29860. protocol: 'accessing',
  29861. fn: function (){
  29862. var self=this;
  29863. var $1;
  29864. $1=self["@protocol"];
  29865. return $1;
  29866. },
  29867. //>>excludeStart("ide", pragmas.excludeIdeData);
  29868. args: [],
  29869. source: "protocol\x0a\x09^ protocol",
  29870. referencedClasses: [],
  29871. //>>excludeEnd("ide");
  29872. messageSends: []
  29873. }),
  29874. globals.ProtocolAnnouncement);
  29875. smalltalk.addMethod(
  29876. smalltalk.method({
  29877. selector: "protocol:",
  29878. protocol: 'accessing',
  29879. fn: function (aString){
  29880. var self=this;
  29881. self["@protocol"]=aString;
  29882. return self;
  29883. },
  29884. //>>excludeStart("ide", pragmas.excludeIdeData);
  29885. args: ["aString"],
  29886. source: "protocol: aString\x0a\x09protocol := aString",
  29887. referencedClasses: [],
  29888. //>>excludeEnd("ide");
  29889. messageSends: []
  29890. }),
  29891. globals.ProtocolAnnouncement);
  29892. smalltalk.addMethod(
  29893. smalltalk.method({
  29894. selector: "theClass",
  29895. protocol: 'accessing',
  29896. fn: function (){
  29897. var self=this;
  29898. var $1;
  29899. $1=self["@theClass"];
  29900. return $1;
  29901. },
  29902. //>>excludeStart("ide", pragmas.excludeIdeData);
  29903. args: [],
  29904. source: "theClass\x0a\x09^ theClass",
  29905. referencedClasses: [],
  29906. //>>excludeEnd("ide");
  29907. messageSends: []
  29908. }),
  29909. globals.ProtocolAnnouncement);
  29910. smalltalk.addMethod(
  29911. smalltalk.method({
  29912. selector: "theClass:",
  29913. protocol: 'accessing',
  29914. fn: function (aClass){
  29915. var self=this;
  29916. self["@theClass"]=aClass;
  29917. return self;
  29918. },
  29919. //>>excludeStart("ide", pragmas.excludeIdeData);
  29920. args: ["aClass"],
  29921. source: "theClass: aClass\x0a\x09theClass := aClass",
  29922. referencedClasses: [],
  29923. //>>excludeEnd("ide");
  29924. messageSends: []
  29925. }),
  29926. globals.ProtocolAnnouncement);
  29927. smalltalk.addClass('ProtocolAdded', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  29928. //>>excludeStart("ide", pragmas.excludeIdeData);
  29929. globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  29930. //>>excludeEnd("ide");
  29931. smalltalk.addClass('ProtocolRemoved', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  29932. //>>excludeStart("ide", pragmas.excludeIdeData);
  29933. globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  29934. //>>excludeEnd("ide");
  29935. });
  29936. define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){
  29937. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  29938. smalltalk.addPackage('Compiler-Exceptions');
  29939. smalltalk.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  29940. smalltalk.addClass('CompilerError', globals.Error, [], 'Compiler-Exceptions');
  29941. //>>excludeStart("ide", pragmas.excludeIdeData);
  29942. globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  29943. //>>excludeEnd("ide");
  29944. smalltalk.addClass('ParseError', globals.CompilerError, [], 'Compiler-Exceptions');
  29945. //>>excludeStart("ide", pragmas.excludeIdeData);
  29946. globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  29947. //>>excludeEnd("ide");
  29948. smalltalk.addClass('SemanticError', globals.CompilerError, [], 'Compiler-Exceptions');
  29949. //>>excludeStart("ide", pragmas.excludeIdeData);
  29950. globals.SemanticError.comment="I represent an abstract semantic error thrown by the SemanticAnalyzer.\x0aSemantic errors can be unknown variable errors, etc.\x0aSee my subclasses for concrete errors.\x0a\x0aThe IDE should catch instances of Semantic error to deal with them when compiling";
  29951. //>>excludeEnd("ide");
  29952. smalltalk.addClass('InliningError', globals.SemanticError, [], 'Compiler-Exceptions');
  29953. //>>excludeStart("ide", pragmas.excludeIdeData);
  29954. globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  29955. //>>excludeEnd("ide");
  29956. smalltalk.addClass('InvalidAssignmentError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  29957. //>>excludeStart("ide", pragmas.excludeIdeData);
  29958. globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  29959. //>>excludeEnd("ide");
  29960. smalltalk.addMethod(
  29961. smalltalk.method({
  29962. selector: "messageText",
  29963. protocol: 'accessing',
  29964. fn: function (){
  29965. var self=this;
  29966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29967. return smalltalk.withContext(function($ctx1) {
  29968. //>>excludeEnd("ctx");
  29969. var $1;
  29970. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  29971. return $1;
  29972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29973. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.InvalidAssignmentError)});
  29974. //>>excludeEnd("ctx");
  29975. },
  29976. //>>excludeStart("ide", pragmas.excludeIdeData);
  29977. args: [],
  29978. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  29979. referencedClasses: [],
  29980. //>>excludeEnd("ide");
  29981. messageSends: [",", "variableName"]
  29982. }),
  29983. globals.InvalidAssignmentError);
  29984. smalltalk.addMethod(
  29985. smalltalk.method({
  29986. selector: "variableName",
  29987. protocol: 'accessing',
  29988. fn: function (){
  29989. var self=this;
  29990. var $1;
  29991. $1=self["@variableName"];
  29992. return $1;
  29993. },
  29994. //>>excludeStart("ide", pragmas.excludeIdeData);
  29995. args: [],
  29996. source: "variableName\x0a\x09^ variableName",
  29997. referencedClasses: [],
  29998. //>>excludeEnd("ide");
  29999. messageSends: []
  30000. }),
  30001. globals.InvalidAssignmentError);
  30002. smalltalk.addMethod(
  30003. smalltalk.method({
  30004. selector: "variableName:",
  30005. protocol: 'accessing',
  30006. fn: function (aString){
  30007. var self=this;
  30008. self["@variableName"]=aString;
  30009. return self;
  30010. },
  30011. //>>excludeStart("ide", pragmas.excludeIdeData);
  30012. args: ["aString"],
  30013. source: "variableName: aString\x0a\x09variableName := aString",
  30014. referencedClasses: [],
  30015. //>>excludeEnd("ide");
  30016. messageSends: []
  30017. }),
  30018. globals.InvalidAssignmentError);
  30019. smalltalk.addClass('ShadowingVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30020. //>>excludeStart("ide", pragmas.excludeIdeData);
  30021. globals.ShadowingVariableError.comment="I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.";
  30022. //>>excludeEnd("ide");
  30023. smalltalk.addMethod(
  30024. smalltalk.method({
  30025. selector: "messageText",
  30026. protocol: 'accessing',
  30027. fn: function (){
  30028. var self=this;
  30029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30030. return smalltalk.withContext(function($ctx1) {
  30031. //>>excludeEnd("ctx");
  30032. var $1;
  30033. $1=_st("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  30034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30035. $ctx1.sendIdx[","]=1;
  30036. //>>excludeEnd("ctx");
  30037. return $1;
  30038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30039. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.ShadowingVariableError)});
  30040. //>>excludeEnd("ctx");
  30041. },
  30042. //>>excludeStart("ide", pragmas.excludeIdeData);
  30043. args: [],
  30044. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  30045. referencedClasses: [],
  30046. //>>excludeEnd("ide");
  30047. messageSends: [",", "variableName"]
  30048. }),
  30049. globals.ShadowingVariableError);
  30050. smalltalk.addMethod(
  30051. smalltalk.method({
  30052. selector: "variableName",
  30053. protocol: 'accessing',
  30054. fn: function (){
  30055. var self=this;
  30056. var $1;
  30057. $1=self["@variableName"];
  30058. return $1;
  30059. },
  30060. //>>excludeStart("ide", pragmas.excludeIdeData);
  30061. args: [],
  30062. source: "variableName\x0a\x09^ variableName",
  30063. referencedClasses: [],
  30064. //>>excludeEnd("ide");
  30065. messageSends: []
  30066. }),
  30067. globals.ShadowingVariableError);
  30068. smalltalk.addMethod(
  30069. smalltalk.method({
  30070. selector: "variableName:",
  30071. protocol: 'accessing',
  30072. fn: function (aString){
  30073. var self=this;
  30074. self["@variableName"]=aString;
  30075. return self;
  30076. },
  30077. //>>excludeStart("ide", pragmas.excludeIdeData);
  30078. args: ["aString"],
  30079. source: "variableName: aString\x0a\x09variableName := aString",
  30080. referencedClasses: [],
  30081. //>>excludeEnd("ide");
  30082. messageSends: []
  30083. }),
  30084. globals.ShadowingVariableError);
  30085. smalltalk.addClass('UnknownVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30086. //>>excludeStart("ide", pragmas.excludeIdeData);
  30087. globals.UnknownVariableError.comment="I get signaled when a variable is not defined.\x0aThe default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.";
  30088. //>>excludeEnd("ide");
  30089. smalltalk.addMethod(
  30090. smalltalk.method({
  30091. selector: "messageText",
  30092. protocol: 'accessing',
  30093. fn: function (){
  30094. var self=this;
  30095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30096. return smalltalk.withContext(function($ctx1) {
  30097. //>>excludeEnd("ctx");
  30098. var $1;
  30099. $1=_st("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  30100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30101. $ctx1.sendIdx[","]=1;
  30102. //>>excludeEnd("ctx");
  30103. return $1;
  30104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30105. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.UnknownVariableError)});
  30106. //>>excludeEnd("ctx");
  30107. },
  30108. //>>excludeStart("ide", pragmas.excludeIdeData);
  30109. args: [],
  30110. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  30111. referencedClasses: [],
  30112. //>>excludeEnd("ide");
  30113. messageSends: [",", "variableName"]
  30114. }),
  30115. globals.UnknownVariableError);
  30116. smalltalk.addMethod(
  30117. smalltalk.method({
  30118. selector: "variableName",
  30119. protocol: 'accessing',
  30120. fn: function (){
  30121. var self=this;
  30122. var $1;
  30123. $1=self["@variableName"];
  30124. return $1;
  30125. },
  30126. //>>excludeStart("ide", pragmas.excludeIdeData);
  30127. args: [],
  30128. source: "variableName\x0a\x09^ variableName",
  30129. referencedClasses: [],
  30130. //>>excludeEnd("ide");
  30131. messageSends: []
  30132. }),
  30133. globals.UnknownVariableError);
  30134. smalltalk.addMethod(
  30135. smalltalk.method({
  30136. selector: "variableName:",
  30137. protocol: 'accessing',
  30138. fn: function (aString){
  30139. var self=this;
  30140. self["@variableName"]=aString;
  30141. return self;
  30142. },
  30143. //>>excludeStart("ide", pragmas.excludeIdeData);
  30144. args: ["aString"],
  30145. source: "variableName: aString\x0a\x09variableName := aString",
  30146. referencedClasses: [],
  30147. //>>excludeEnd("ide");
  30148. messageSends: []
  30149. }),
  30150. globals.UnknownVariableError);
  30151. smalltalk.addClass('RethrowErrorHandler', globals.Object, [], 'Compiler-Exceptions');
  30152. //>>excludeStart("ide", pragmas.excludeIdeData);
  30153. globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
  30154. //>>excludeEnd("ide");
  30155. smalltalk.addMethod(
  30156. smalltalk.method({
  30157. selector: "basicSignal:",
  30158. protocol: 'error handling',
  30159. fn: function (anError){
  30160. var self=this;
  30161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30162. return smalltalk.withContext(function($ctx1) {
  30163. //>>excludeEnd("ctx");
  30164. throw anError;
  30165. return self;
  30166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30167. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},globals.RethrowErrorHandler)});
  30168. //>>excludeEnd("ctx");
  30169. },
  30170. //>>excludeStart("ide", pragmas.excludeIdeData);
  30171. args: ["anError"],
  30172. source: "basicSignal: anError\x0a <throw anError>",
  30173. referencedClasses: [],
  30174. //>>excludeEnd("ide");
  30175. messageSends: []
  30176. }),
  30177. globals.RethrowErrorHandler);
  30178. smalltalk.addMethod(
  30179. smalltalk.method({
  30180. selector: "handleError:",
  30181. protocol: 'error handling',
  30182. fn: function (anError){
  30183. var self=this;
  30184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30185. return smalltalk.withContext(function($ctx1) {
  30186. //>>excludeEnd("ctx");
  30187. self._basicSignal_(anError);
  30188. return self;
  30189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30190. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.RethrowErrorHandler)});
  30191. //>>excludeEnd("ctx");
  30192. },
  30193. //>>excludeStart("ide", pragmas.excludeIdeData);
  30194. args: ["anError"],
  30195. source: "handleError: anError\x0a self basicSignal: anError",
  30196. referencedClasses: [],
  30197. //>>excludeEnd("ide");
  30198. messageSends: ["basicSignal:"]
  30199. }),
  30200. globals.RethrowErrorHandler);
  30201. });
  30202. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Collections"], function($boot){
  30203. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  30204. smalltalk.addPackage('Compiler-Core');
  30205. smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30206. smalltalk.addClass('AbstractCodeGenerator', globals.Object, ['currentClass', 'source'], 'Compiler-Core');
  30207. //>>excludeStart("ide", pragmas.excludeIdeData);
  30208. globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  30209. //>>excludeEnd("ide");
  30210. smalltalk.addMethod(
  30211. smalltalk.method({
  30212. selector: "classNameFor:",
  30213. protocol: 'accessing',
  30214. fn: function (aClass){
  30215. var self=this;
  30216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30217. return smalltalk.withContext(function($ctx1) {
  30218. //>>excludeEnd("ctx");
  30219. var $2,$3,$4,$1;
  30220. $2=_st(aClass)._isMetaclass();
  30221. if(smalltalk.assert($2)){
  30222. $3=_st(_st(aClass)._instanceClass())._name();
  30223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30224. $ctx1.sendIdx["name"]=1;
  30225. //>>excludeEnd("ctx");
  30226. $1=_st($3).__comma(".klass");
  30227. } else {
  30228. $4=_st(aClass)._isNil();
  30229. if(smalltalk.assert($4)){
  30230. $1="nil";
  30231. } else {
  30232. $1=_st(aClass)._name();
  30233. };
  30234. };
  30235. return $1;
  30236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30237. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractCodeGenerator)});
  30238. //>>excludeEnd("ctx");
  30239. },
  30240. //>>excludeStart("ide", pragmas.excludeIdeData);
  30241. args: ["aClass"],
  30242. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]",
  30243. referencedClasses: [],
  30244. //>>excludeEnd("ide");
  30245. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  30246. }),
  30247. globals.AbstractCodeGenerator);
  30248. smalltalk.addMethod(
  30249. smalltalk.method({
  30250. selector: "compileNode:",
  30251. protocol: 'compiling',
  30252. fn: function (aNode){
  30253. var self=this;
  30254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30255. return smalltalk.withContext(function($ctx1) {
  30256. //>>excludeEnd("ctx");
  30257. self._subclassResponsibility();
  30258. return self;
  30259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30260. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},globals.AbstractCodeGenerator)});
  30261. //>>excludeEnd("ctx");
  30262. },
  30263. //>>excludeStart("ide", pragmas.excludeIdeData);
  30264. args: ["aNode"],
  30265. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  30266. referencedClasses: [],
  30267. //>>excludeEnd("ide");
  30268. messageSends: ["subclassResponsibility"]
  30269. }),
  30270. globals.AbstractCodeGenerator);
  30271. smalltalk.addMethod(
  30272. smalltalk.method({
  30273. selector: "currentClass",
  30274. protocol: 'accessing',
  30275. fn: function (){
  30276. var self=this;
  30277. var $1;
  30278. $1=self["@currentClass"];
  30279. return $1;
  30280. },
  30281. //>>excludeStart("ide", pragmas.excludeIdeData);
  30282. args: [],
  30283. source: "currentClass\x0a\x09^ currentClass",
  30284. referencedClasses: [],
  30285. //>>excludeEnd("ide");
  30286. messageSends: []
  30287. }),
  30288. globals.AbstractCodeGenerator);
  30289. smalltalk.addMethod(
  30290. smalltalk.method({
  30291. selector: "currentClass:",
  30292. protocol: 'accessing',
  30293. fn: function (aClass){
  30294. var self=this;
  30295. self["@currentClass"]=aClass;
  30296. return self;
  30297. },
  30298. //>>excludeStart("ide", pragmas.excludeIdeData);
  30299. args: ["aClass"],
  30300. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30301. referencedClasses: [],
  30302. //>>excludeEnd("ide");
  30303. messageSends: []
  30304. }),
  30305. globals.AbstractCodeGenerator);
  30306. smalltalk.addMethod(
  30307. smalltalk.method({
  30308. selector: "pseudoVariables",
  30309. protocol: 'accessing',
  30310. fn: function (){
  30311. var self=this;
  30312. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30314. return smalltalk.withContext(function($ctx1) {
  30315. //>>excludeEnd("ctx");
  30316. var $1;
  30317. $1=_st($Smalltalk())._pseudoVariableNames();
  30318. return $1;
  30319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30320. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},globals.AbstractCodeGenerator)});
  30321. //>>excludeEnd("ctx");
  30322. },
  30323. //>>excludeStart("ide", pragmas.excludeIdeData);
  30324. args: [],
  30325. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30326. referencedClasses: ["Smalltalk"],
  30327. //>>excludeEnd("ide");
  30328. messageSends: ["pseudoVariableNames"]
  30329. }),
  30330. globals.AbstractCodeGenerator);
  30331. smalltalk.addMethod(
  30332. smalltalk.method({
  30333. selector: "source",
  30334. protocol: 'accessing',
  30335. fn: function (){
  30336. var self=this;
  30337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30338. return smalltalk.withContext(function($ctx1) {
  30339. //>>excludeEnd("ctx");
  30340. var $2,$1,$receiver;
  30341. $2=self["@source"];
  30342. if(($receiver = $2) == null || $receiver.isNil){
  30343. $1="";
  30344. } else {
  30345. $1=$2;
  30346. };
  30347. return $1;
  30348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30349. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.AbstractCodeGenerator)});
  30350. //>>excludeEnd("ctx");
  30351. },
  30352. //>>excludeStart("ide", pragmas.excludeIdeData);
  30353. args: [],
  30354. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30355. referencedClasses: [],
  30356. //>>excludeEnd("ide");
  30357. messageSends: ["ifNil:"]
  30358. }),
  30359. globals.AbstractCodeGenerator);
  30360. smalltalk.addMethod(
  30361. smalltalk.method({
  30362. selector: "source:",
  30363. protocol: 'accessing',
  30364. fn: function (aString){
  30365. var self=this;
  30366. self["@source"]=aString;
  30367. return self;
  30368. },
  30369. //>>excludeStart("ide", pragmas.excludeIdeData);
  30370. args: ["aString"],
  30371. source: "source: aString\x0a\x09source := aString",
  30372. referencedClasses: [],
  30373. //>>excludeEnd("ide");
  30374. messageSends: []
  30375. }),
  30376. globals.AbstractCodeGenerator);
  30377. smalltalk.addClass('CodeGenerator', globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30378. //>>excludeStart("ide", pragmas.excludeIdeData);
  30379. globals.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation.";
  30380. //>>excludeEnd("ide");
  30381. smalltalk.addMethod(
  30382. smalltalk.method({
  30383. selector: "compileNode:",
  30384. protocol: 'compiling',
  30385. fn: function (aNode){
  30386. var self=this;
  30387. var ir,stream;
  30388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30389. return smalltalk.withContext(function($ctx1) {
  30390. //>>excludeEnd("ctx");
  30391. var $2,$3,$1;
  30392. _st(self._semanticAnalyzer())._visit_(aNode);
  30393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30394. $ctx1.sendIdx["visit:"]=1;
  30395. //>>excludeEnd("ctx");
  30396. ir=_st(self._translator())._visit_(aNode);
  30397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30398. $ctx1.sendIdx["visit:"]=2;
  30399. //>>excludeEnd("ctx");
  30400. $2=self._irTranslator();
  30401. _st($2)._currentClass_(self._currentClass());
  30402. _st($2)._visit_(ir);
  30403. $3=_st($2)._contents();
  30404. $1=$3;
  30405. return $1;
  30406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30407. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.CodeGenerator)});
  30408. //>>excludeEnd("ctx");
  30409. },
  30410. //>>excludeStart("ide", pragmas.excludeIdeData);
  30411. args: ["aNode"],
  30412. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  30413. referencedClasses: [],
  30414. //>>excludeEnd("ide");
  30415. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30416. }),
  30417. globals.CodeGenerator);
  30418. smalltalk.addMethod(
  30419. smalltalk.method({
  30420. selector: "irTranslator",
  30421. protocol: 'compiling',
  30422. fn: function (){
  30423. var self=this;
  30424. function $IRJSTranslator(){return globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  30425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30426. return smalltalk.withContext(function($ctx1) {
  30427. //>>excludeEnd("ctx");
  30428. var $1;
  30429. $1=_st($IRJSTranslator())._new();
  30430. return $1;
  30431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30432. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.CodeGenerator)});
  30433. //>>excludeEnd("ctx");
  30434. },
  30435. //>>excludeStart("ide", pragmas.excludeIdeData);
  30436. args: [],
  30437. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30438. referencedClasses: ["IRJSTranslator"],
  30439. //>>excludeEnd("ide");
  30440. messageSends: ["new"]
  30441. }),
  30442. globals.CodeGenerator);
  30443. smalltalk.addMethod(
  30444. smalltalk.method({
  30445. selector: "semanticAnalyzer",
  30446. protocol: 'compiling',
  30447. fn: function (){
  30448. var self=this;
  30449. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  30450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30451. return smalltalk.withContext(function($ctx1) {
  30452. //>>excludeEnd("ctx");
  30453. var $1;
  30454. $1=_st($SemanticAnalyzer())._on_(self._currentClass());
  30455. return $1;
  30456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30457. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},globals.CodeGenerator)});
  30458. //>>excludeEnd("ctx");
  30459. },
  30460. //>>excludeStart("ide", pragmas.excludeIdeData);
  30461. args: [],
  30462. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  30463. referencedClasses: ["SemanticAnalyzer"],
  30464. //>>excludeEnd("ide");
  30465. messageSends: ["on:", "currentClass"]
  30466. }),
  30467. globals.CodeGenerator);
  30468. smalltalk.addMethod(
  30469. smalltalk.method({
  30470. selector: "translator",
  30471. protocol: 'compiling',
  30472. fn: function (){
  30473. var self=this;
  30474. function $IRASTTranslator(){return globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  30475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30476. return smalltalk.withContext(function($ctx1) {
  30477. //>>excludeEnd("ctx");
  30478. var $2,$3,$1;
  30479. $2=_st($IRASTTranslator())._new();
  30480. _st($2)._source_(self._source());
  30481. _st($2)._theClass_(self._currentClass());
  30482. $3=_st($2)._yourself();
  30483. $1=$3;
  30484. return $1;
  30485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30486. }, function($ctx1) {$ctx1.fill(self,"translator",{},globals.CodeGenerator)});
  30487. //>>excludeEnd("ctx");
  30488. },
  30489. //>>excludeStart("ide", pragmas.excludeIdeData);
  30490. args: [],
  30491. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30492. referencedClasses: ["IRASTTranslator"],
  30493. //>>excludeEnd("ide");
  30494. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30495. }),
  30496. globals.CodeGenerator);
  30497. smalltalk.addClass('Compiler', globals.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30498. //>>excludeStart("ide", pragmas.excludeIdeData);
  30499. globals.Compiler.comment="I provide the public interface for compiling Amber source code into JavaScript.\x0a\x0aThe code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.\x0aThe default code generator is an instance of `InlinedCodeGenerator`";
  30500. //>>excludeEnd("ide");
  30501. smalltalk.addMethod(
  30502. smalltalk.method({
  30503. selector: "codeGeneratorClass",
  30504. protocol: 'accessing',
  30505. fn: function (){
  30506. var self=this;
  30507. function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  30508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30509. return smalltalk.withContext(function($ctx1) {
  30510. //>>excludeEnd("ctx");
  30511. var $2,$1,$receiver;
  30512. $2=self["@codeGeneratorClass"];
  30513. if(($receiver = $2) == null || $receiver.isNil){
  30514. $1=$InliningCodeGenerator();
  30515. } else {
  30516. $1=$2;
  30517. };
  30518. return $1;
  30519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30520. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},globals.Compiler)});
  30521. //>>excludeEnd("ctx");
  30522. },
  30523. //>>excludeStart("ide", pragmas.excludeIdeData);
  30524. args: [],
  30525. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30526. referencedClasses: ["InliningCodeGenerator"],
  30527. //>>excludeEnd("ide");
  30528. messageSends: ["ifNil:"]
  30529. }),
  30530. globals.Compiler);
  30531. smalltalk.addMethod(
  30532. smalltalk.method({
  30533. selector: "codeGeneratorClass:",
  30534. protocol: 'accessing',
  30535. fn: function (aClass){
  30536. var self=this;
  30537. self["@codeGeneratorClass"]=aClass;
  30538. return self;
  30539. },
  30540. //>>excludeStart("ide", pragmas.excludeIdeData);
  30541. args: ["aClass"],
  30542. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30543. referencedClasses: [],
  30544. //>>excludeEnd("ide");
  30545. messageSends: []
  30546. }),
  30547. globals.Compiler);
  30548. smalltalk.addMethod(
  30549. smalltalk.method({
  30550. selector: "compile:",
  30551. protocol: 'compiling',
  30552. fn: function (aString){
  30553. var self=this;
  30554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30555. return smalltalk.withContext(function($ctx1) {
  30556. //>>excludeEnd("ctx");
  30557. var $1;
  30558. $1=self._compileNode_(self._parse_(aString));
  30559. return $1;
  30560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30561. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Compiler)});
  30562. //>>excludeEnd("ctx");
  30563. },
  30564. //>>excludeStart("ide", pragmas.excludeIdeData);
  30565. args: ["aString"],
  30566. source: "compile: aString\x0a\x09^ self compileNode: (self parse: aString)",
  30567. referencedClasses: [],
  30568. //>>excludeEnd("ide");
  30569. messageSends: ["compileNode:", "parse:"]
  30570. }),
  30571. globals.Compiler);
  30572. smalltalk.addMethod(
  30573. smalltalk.method({
  30574. selector: "compile:forClass:",
  30575. protocol: 'compiling',
  30576. fn: function (aString,aClass){
  30577. var self=this;
  30578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30579. return smalltalk.withContext(function($ctx1) {
  30580. //>>excludeEnd("ctx");
  30581. var $1;
  30582. self._currentClass_(aClass);
  30583. self._source_(aString);
  30584. $1=self._compile_(aString);
  30585. return $1;
  30586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30587. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass},globals.Compiler)});
  30588. //>>excludeEnd("ctx");
  30589. },
  30590. //>>excludeStart("ide", pragmas.excludeIdeData);
  30591. args: ["aString", "aClass"],
  30592. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^ self compile: aString",
  30593. referencedClasses: [],
  30594. //>>excludeEnd("ide");
  30595. messageSends: ["currentClass:", "source:", "compile:"]
  30596. }),
  30597. globals.Compiler);
  30598. smalltalk.addMethod(
  30599. smalltalk.method({
  30600. selector: "compileExpression:",
  30601. protocol: 'compiling',
  30602. fn: function (aString){
  30603. var self=this;
  30604. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  30605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30606. return smalltalk.withContext(function($ctx1) {
  30607. //>>excludeEnd("ctx");
  30608. var $1,$2;
  30609. self._currentClass_($DoIt());
  30610. $1=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30612. $ctx1.sendIdx[","]=1;
  30613. //>>excludeEnd("ctx");
  30614. self._source_($1);
  30615. $2=self._compileNode_(self._parse_(self._source()));
  30616. return $2;
  30617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30618. }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString},globals.Compiler)});
  30619. //>>excludeEnd("ctx");
  30620. },
  30621. //>>excludeStart("ide", pragmas.excludeIdeData);
  30622. args: ["aString"],
  30623. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  30624. referencedClasses: ["DoIt"],
  30625. //>>excludeEnd("ide");
  30626. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"]
  30627. }),
  30628. globals.Compiler);
  30629. smalltalk.addMethod(
  30630. smalltalk.method({
  30631. selector: "compileExpression:on:",
  30632. protocol: 'compiling',
  30633. fn: function (aString,anObject){
  30634. var self=this;
  30635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30636. return smalltalk.withContext(function($ctx1) {
  30637. //>>excludeEnd("ctx");
  30638. var $1,$2;
  30639. self._currentClass_(_st(anObject)._class());
  30640. $1=_st("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30642. $ctx1.sendIdx[","]=1;
  30643. //>>excludeEnd("ctx");
  30644. self._source_($1);
  30645. $2=self._compileNode_(self._parse_(self._source()));
  30646. return $2;
  30647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30648. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},globals.Compiler)});
  30649. //>>excludeEnd("ctx");
  30650. },
  30651. //>>excludeStart("ide", pragmas.excludeIdeData);
  30652. args: ["aString", "anObject"],
  30653. source: "compileExpression: aString on: anObject\x0a\x09self currentClass: anObject class.\x0a\x09self source: 'xxxDoIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  30654. referencedClasses: [],
  30655. //>>excludeEnd("ide");
  30656. messageSends: ["currentClass:", "class", "source:", ",", "compileNode:", "parse:", "source"]
  30657. }),
  30658. globals.Compiler);
  30659. smalltalk.addMethod(
  30660. smalltalk.method({
  30661. selector: "compileNode:",
  30662. protocol: 'compiling',
  30663. fn: function (aNode){
  30664. var self=this;
  30665. var generator,result;
  30666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30667. return smalltalk.withContext(function($ctx1) {
  30668. //>>excludeEnd("ctx");
  30669. var $1,$2,$3;
  30670. generator=_st(self._codeGeneratorClass())._new();
  30671. $1=generator;
  30672. _st($1)._source_(self._source());
  30673. $2=_st($1)._currentClass_(self._currentClass());
  30674. result=_st(generator)._compileNode_(aNode);
  30675. self._unknownVariables_([]);
  30676. $3=result;
  30677. return $3;
  30678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30679. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},globals.Compiler)});
  30680. //>>excludeEnd("ctx");
  30681. },
  30682. //>>excludeStart("ide", pragmas.excludeIdeData);
  30683. args: ["aNode"],
  30684. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
  30685. referencedClasses: [],
  30686. //>>excludeEnd("ide");
  30687. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"]
  30688. }),
  30689. globals.Compiler);
  30690. smalltalk.addMethod(
  30691. smalltalk.method({
  30692. selector: "currentClass",
  30693. protocol: 'accessing',
  30694. fn: function (){
  30695. var self=this;
  30696. var $1;
  30697. $1=self["@currentClass"];
  30698. return $1;
  30699. },
  30700. //>>excludeStart("ide", pragmas.excludeIdeData);
  30701. args: [],
  30702. source: "currentClass\x0a\x09^ currentClass",
  30703. referencedClasses: [],
  30704. //>>excludeEnd("ide");
  30705. messageSends: []
  30706. }),
  30707. globals.Compiler);
  30708. smalltalk.addMethod(
  30709. smalltalk.method({
  30710. selector: "currentClass:",
  30711. protocol: 'accessing',
  30712. fn: function (aClass){
  30713. var self=this;
  30714. self["@currentClass"]=aClass;
  30715. return self;
  30716. },
  30717. //>>excludeStart("ide", pragmas.excludeIdeData);
  30718. args: ["aClass"],
  30719. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30720. referencedClasses: [],
  30721. //>>excludeEnd("ide");
  30722. messageSends: []
  30723. }),
  30724. globals.Compiler);
  30725. smalltalk.addMethod(
  30726. smalltalk.method({
  30727. selector: "eval:",
  30728. protocol: 'compiling',
  30729. fn: function (aString){
  30730. var self=this;
  30731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30732. return smalltalk.withContext(function($ctx1) {
  30733. //>>excludeEnd("ctx");
  30734. return eval(aString);
  30735. return self;
  30736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30737. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},globals.Compiler)});
  30738. //>>excludeEnd("ctx");
  30739. },
  30740. //>>excludeStart("ide", pragmas.excludeIdeData);
  30741. args: ["aString"],
  30742. source: "eval: aString\x0a\x09<return eval(aString)>",
  30743. referencedClasses: [],
  30744. //>>excludeEnd("ide");
  30745. messageSends: []
  30746. }),
  30747. globals.Compiler);
  30748. smalltalk.addMethod(
  30749. smalltalk.method({
  30750. selector: "evaluateExpression:",
  30751. protocol: 'compiling',
  30752. fn: function (aString){
  30753. var self=this;
  30754. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  30755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30756. return smalltalk.withContext(function($ctx1) {
  30757. //>>excludeEnd("ctx");
  30758. var $1;
  30759. $1=self._evaluateExpression_on_(aString,_st($DoIt())._new());
  30760. return $1;
  30761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30762. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},globals.Compiler)});
  30763. //>>excludeEnd("ctx");
  30764. },
  30765. //>>excludeStart("ide", pragmas.excludeIdeData);
  30766. args: ["aString"],
  30767. source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09^ self evaluateExpression: aString on: DoIt new",
  30768. referencedClasses: ["DoIt"],
  30769. //>>excludeEnd("ide");
  30770. messageSends: ["evaluateExpression:on:", "new"]
  30771. }),
  30772. globals.Compiler);
  30773. smalltalk.addMethod(
  30774. smalltalk.method({
  30775. selector: "evaluateExpression:on:",
  30776. protocol: 'compiling',
  30777. fn: function (aString,anObject){
  30778. var self=this;
  30779. var result,method;
  30780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30781. return smalltalk.withContext(function($ctx1) {
  30782. //>>excludeEnd("ctx");
  30783. var $1,$2;
  30784. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30785. _st(method)._protocol_("**xxxDoIt");
  30786. $1=_st(anObject)._class();
  30787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30788. $ctx1.sendIdx["class"]=1;
  30789. //>>excludeEnd("ctx");
  30790. _st($1)._addCompiledMethod_(method);
  30791. result=_st(anObject)._xxxDoIt();
  30792. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  30793. $2=result;
  30794. return $2;
  30795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30796. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},globals.Compiler)});
  30797. //>>excludeEnd("ctx");
  30798. },
  30799. //>>excludeStart("ide", pragmas.excludeIdeData);
  30800. args: ["aString", "anObject"],
  30801. source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: '**xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  30802. referencedClasses: [],
  30803. //>>excludeEnd("ide");
  30804. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30805. }),
  30806. globals.Compiler);
  30807. smalltalk.addMethod(
  30808. smalltalk.method({
  30809. selector: "install:forClass:protocol:",
  30810. protocol: 'compiling',
  30811. fn: function (aString,aBehavior,anotherString){
  30812. var self=this;
  30813. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  30814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30815. return smalltalk.withContext(function($ctx1) {
  30816. //>>excludeEnd("ctx");
  30817. var $1;
  30818. $1=_st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(self._eval_(self._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
  30819. return $1;
  30820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30821. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString},globals.Compiler)});
  30822. //>>excludeEnd("ctx");
  30823. },
  30824. //>>excludeStart("ide", pragmas.excludeIdeData);
  30825. args: ["aString", "aBehavior", "anotherString"],
  30826. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: (self eval: (self compile: aString forClass: aBehavior))\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
  30827. referencedClasses: ["ClassBuilder"],
  30828. //>>excludeEnd("ide");
  30829. messageSends: ["installMethod:forClass:protocol:", "new", "eval:", "compile:forClass:"]
  30830. }),
  30831. globals.Compiler);
  30832. smalltalk.addMethod(
  30833. smalltalk.method({
  30834. selector: "parse:",
  30835. protocol: 'compiling',
  30836. fn: function (aString){
  30837. var self=this;
  30838. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30840. return smalltalk.withContext(function($ctx1) {
  30841. //>>excludeEnd("ctx");
  30842. var $1;
  30843. $1=_st($Smalltalk())._parse_(aString);
  30844. return $1;
  30845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30846. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.Compiler)});
  30847. //>>excludeEnd("ctx");
  30848. },
  30849. //>>excludeStart("ide", pragmas.excludeIdeData);
  30850. args: ["aString"],
  30851. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30852. referencedClasses: ["Smalltalk"],
  30853. //>>excludeEnd("ide");
  30854. messageSends: ["parse:"]
  30855. }),
  30856. globals.Compiler);
  30857. smalltalk.addMethod(
  30858. smalltalk.method({
  30859. selector: "parseExpression:",
  30860. protocol: 'compiling',
  30861. fn: function (aString){
  30862. var self=this;
  30863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30864. return smalltalk.withContext(function($ctx1) {
  30865. //>>excludeEnd("ctx");
  30866. var $2,$1;
  30867. $2=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30869. $ctx1.sendIdx[","]=1;
  30870. //>>excludeEnd("ctx");
  30871. $1=self._parse_($2);
  30872. return $1;
  30873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30874. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},globals.Compiler)});
  30875. //>>excludeEnd("ctx");
  30876. },
  30877. //>>excludeStart("ide", pragmas.excludeIdeData);
  30878. args: ["aString"],
  30879. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30880. referencedClasses: [],
  30881. //>>excludeEnd("ide");
  30882. messageSends: ["parse:", ","]
  30883. }),
  30884. globals.Compiler);
  30885. smalltalk.addMethod(
  30886. smalltalk.method({
  30887. selector: "recompile:",
  30888. protocol: 'compiling',
  30889. fn: function (aClass){
  30890. var self=this;
  30891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30892. return smalltalk.withContext(function($ctx1) {
  30893. //>>excludeEnd("ctx");
  30894. var $1;
  30895. _st(_st(_st(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30897. return smalltalk.withContext(function($ctx2) {
  30898. //>>excludeEnd("ctx");
  30899. return self._install_forClass_protocol_(_st(each)._source(),aClass,_st(each)._protocol());
  30900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30902. //>>excludeEnd("ctx");
  30903. }),"Recompiling ".__comma(_st(aClass)._name()));
  30904. $1=_st(aClass)._isMetaclass();
  30905. if(! smalltalk.assert($1)){
  30906. self._recompile_(_st(aClass)._class());
  30907. };
  30908. return self;
  30909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30910. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler)});
  30911. //>>excludeEnd("ctx");
  30912. },
  30913. //>>excludeStart("ide", pragmas.excludeIdeData);
  30914. args: ["aClass"],
  30915. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]",
  30916. referencedClasses: [],
  30917. //>>excludeEnd("ide");
  30918. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30919. }),
  30920. globals.Compiler);
  30921. smalltalk.addMethod(
  30922. smalltalk.method({
  30923. selector: "recompileAll",
  30924. protocol: 'compiling',
  30925. fn: function (){
  30926. var self=this;
  30927. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30929. return smalltalk.withContext(function($ctx1) {
  30930. //>>excludeEnd("ctx");
  30931. _st(_st($Smalltalk())._classes())._do_displayingProgress_((function(each){
  30932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30933. return smalltalk.withContext(function($ctx2) {
  30934. //>>excludeEnd("ctx");
  30935. return self._recompile_(each);
  30936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30938. //>>excludeEnd("ctx");
  30939. }),"Compiling all classes...");
  30940. return self;
  30941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30942. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler)});
  30943. //>>excludeEnd("ctx");
  30944. },
  30945. //>>excludeStart("ide", pragmas.excludeIdeData);
  30946. args: [],
  30947. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30948. referencedClasses: ["Smalltalk"],
  30949. //>>excludeEnd("ide");
  30950. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30951. }),
  30952. globals.Compiler);
  30953. smalltalk.addMethod(
  30954. smalltalk.method({
  30955. selector: "source",
  30956. protocol: 'accessing',
  30957. fn: function (){
  30958. var self=this;
  30959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30960. return smalltalk.withContext(function($ctx1) {
  30961. //>>excludeEnd("ctx");
  30962. var $2,$1,$receiver;
  30963. $2=self["@source"];
  30964. if(($receiver = $2) == null || $receiver.isNil){
  30965. $1="";
  30966. } else {
  30967. $1=$2;
  30968. };
  30969. return $1;
  30970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30971. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.Compiler)});
  30972. //>>excludeEnd("ctx");
  30973. },
  30974. //>>excludeStart("ide", pragmas.excludeIdeData);
  30975. args: [],
  30976. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30977. referencedClasses: [],
  30978. //>>excludeEnd("ide");
  30979. messageSends: ["ifNil:"]
  30980. }),
  30981. globals.Compiler);
  30982. smalltalk.addMethod(
  30983. smalltalk.method({
  30984. selector: "source:",
  30985. protocol: 'accessing',
  30986. fn: function (aString){
  30987. var self=this;
  30988. self["@source"]=aString;
  30989. return self;
  30990. },
  30991. //>>excludeStart("ide", pragmas.excludeIdeData);
  30992. args: ["aString"],
  30993. source: "source: aString\x0a\x09source := aString",
  30994. referencedClasses: [],
  30995. //>>excludeEnd("ide");
  30996. messageSends: []
  30997. }),
  30998. globals.Compiler);
  30999. smalltalk.addMethod(
  31000. smalltalk.method({
  31001. selector: "unknownVariables",
  31002. protocol: 'accessing',
  31003. fn: function (){
  31004. var self=this;
  31005. var $1;
  31006. $1=self["@unknownVariables"];
  31007. return $1;
  31008. },
  31009. //>>excludeStart("ide", pragmas.excludeIdeData);
  31010. args: [],
  31011. source: "unknownVariables\x0a\x09^ unknownVariables",
  31012. referencedClasses: [],
  31013. //>>excludeEnd("ide");
  31014. messageSends: []
  31015. }),
  31016. globals.Compiler);
  31017. smalltalk.addMethod(
  31018. smalltalk.method({
  31019. selector: "unknownVariables:",
  31020. protocol: 'accessing',
  31021. fn: function (aCollection){
  31022. var self=this;
  31023. self["@unknownVariables"]=aCollection;
  31024. return self;
  31025. },
  31026. //>>excludeStart("ide", pragmas.excludeIdeData);
  31027. args: ["aCollection"],
  31028. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  31029. referencedClasses: [],
  31030. //>>excludeEnd("ide");
  31031. messageSends: []
  31032. }),
  31033. globals.Compiler);
  31034. smalltalk.addMethod(
  31035. smalltalk.method({
  31036. selector: "recompile:",
  31037. protocol: 'compiling',
  31038. fn: function (aClass){
  31039. var self=this;
  31040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31041. return smalltalk.withContext(function($ctx1) {
  31042. //>>excludeEnd("ctx");
  31043. _st(self._new())._recompile_(aClass);
  31044. return self;
  31045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31046. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler.klass)});
  31047. //>>excludeEnd("ctx");
  31048. },
  31049. //>>excludeStart("ide", pragmas.excludeIdeData);
  31050. args: ["aClass"],
  31051. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  31052. referencedClasses: [],
  31053. //>>excludeEnd("ide");
  31054. messageSends: ["recompile:", "new"]
  31055. }),
  31056. globals.Compiler.klass);
  31057. smalltalk.addMethod(
  31058. smalltalk.method({
  31059. selector: "recompileAll",
  31060. protocol: 'compiling',
  31061. fn: function (){
  31062. var self=this;
  31063. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  31064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31065. return smalltalk.withContext(function($ctx1) {
  31066. //>>excludeEnd("ctx");
  31067. _st(_st($Smalltalk())._classes())._do_((function(each){
  31068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31069. return smalltalk.withContext(function($ctx2) {
  31070. //>>excludeEnd("ctx");
  31071. return self._recompile_(each);
  31072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31073. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31074. //>>excludeEnd("ctx");
  31075. }));
  31076. return self;
  31077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31078. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler.klass)});
  31079. //>>excludeEnd("ctx");
  31080. },
  31081. //>>excludeStart("ide", pragmas.excludeIdeData);
  31082. args: [],
  31083. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  31084. referencedClasses: ["Smalltalk"],
  31085. //>>excludeEnd("ide");
  31086. messageSends: ["do:", "classes", "recompile:"]
  31087. }),
  31088. globals.Compiler.klass);
  31089. smalltalk.addClass('DoIt', globals.Object, [], 'Compiler-Core');
  31090. //>>excludeStart("ide", pragmas.excludeIdeData);
  31091. globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  31092. //>>excludeEnd("ide");
  31093. smalltalk.addClass('Evaluator', globals.InterfacingObject, [], 'Compiler-Core');
  31094. //>>excludeStart("ide", pragmas.excludeIdeData);
  31095. globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  31096. //>>excludeEnd("ide");
  31097. smalltalk.addMethod(
  31098. smalltalk.method({
  31099. selector: "evaluate:context:",
  31100. protocol: 'evaluating',
  31101. fn: function (aString,aContext){
  31102. var self=this;
  31103. var compiler,ast;
  31104. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  31105. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  31106. function $AISemanticAnalyzer(){return globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  31107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31108. return smalltalk.withContext(function($ctx1) {
  31109. //>>excludeEnd("ctx");
  31110. var $1,$2,$3,$4;
  31111. var $early={};
  31112. try {
  31113. compiler=_st($Compiler())._new();
  31114. _st((function(){
  31115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31116. return smalltalk.withContext(function($ctx2) {
  31117. //>>excludeEnd("ctx");
  31118. ast=_st(compiler)._parseExpression_(aString);
  31119. return ast;
  31120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31122. //>>excludeEnd("ctx");
  31123. }))._on_do_($Error(),(function(ex){
  31124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31125. return smalltalk.withContext(function($ctx2) {
  31126. //>>excludeEnd("ctx");
  31127. $1=self._alert_(_st(ex)._messageText());
  31128. throw $early=[$1];
  31129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31130. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  31131. //>>excludeEnd("ctx");
  31132. }));
  31133. $2=_st($AISemanticAnalyzer())._on_(_st(_st(aContext)._receiver())._class());
  31134. _st($2)._context_(aContext);
  31135. $3=_st($2)._visit_(ast);
  31136. $4=_st(aContext)._evaluateNode_(ast);
  31137. return $4;
  31138. }
  31139. catch(e) {if(e===$early)return e[0]; throw e}
  31140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31141. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},globals.Evaluator)});
  31142. //>>excludeEnd("ctx");
  31143. },
  31144. //>>excludeStart("ide", pragmas.excludeIdeData);
  31145. args: ["aString", "aContext"],
  31146. source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast",
  31147. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  31148. //>>excludeEnd("ide");
  31149. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  31150. }),
  31151. globals.Evaluator);
  31152. smalltalk.addMethod(
  31153. smalltalk.method({
  31154. selector: "evaluate:for:",
  31155. protocol: 'evaluating',
  31156. fn: function (aString,anObject){
  31157. var self=this;
  31158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31159. return smalltalk.withContext(function($ctx1) {
  31160. //>>excludeEnd("ctx");
  31161. var $1;
  31162. $1=_st(anObject)._evaluate_on_(aString,self);
  31163. return $1;
  31164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31165. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Evaluator)});
  31166. //>>excludeEnd("ctx");
  31167. },
  31168. //>>excludeStart("ide", pragmas.excludeIdeData);
  31169. args: ["aString", "anObject"],
  31170. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  31171. referencedClasses: [],
  31172. //>>excludeEnd("ide");
  31173. messageSends: ["evaluate:on:"]
  31174. }),
  31175. globals.Evaluator);
  31176. smalltalk.addMethod(
  31177. smalltalk.method({
  31178. selector: "evaluate:receiver:",
  31179. protocol: 'evaluating',
  31180. fn: function (aString,anObject){
  31181. var self=this;
  31182. var compiler;
  31183. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  31184. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  31185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31186. return smalltalk.withContext(function($ctx1) {
  31187. //>>excludeEnd("ctx");
  31188. var $1,$2;
  31189. var $early={};
  31190. try {
  31191. compiler=_st($Compiler())._new();
  31192. _st((function(){
  31193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31194. return smalltalk.withContext(function($ctx2) {
  31195. //>>excludeEnd("ctx");
  31196. return _st(compiler)._parseExpression_(aString);
  31197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31199. //>>excludeEnd("ctx");
  31200. }))._on_do_($Error(),(function(ex){
  31201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31202. return smalltalk.withContext(function($ctx2) {
  31203. //>>excludeEnd("ctx");
  31204. $1=self._alert_(_st(ex)._messageText());
  31205. throw $early=[$1];
  31206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31207. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  31208. //>>excludeEnd("ctx");
  31209. }));
  31210. $2=_st(compiler)._evaluateExpression_on_(aString,anObject);
  31211. return $2;
  31212. }
  31213. catch(e) {if(e===$early)return e[0]; throw e}
  31214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31215. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},globals.Evaluator)});
  31216. //>>excludeEnd("ctx");
  31217. },
  31218. //>>excludeStart("ide", pragmas.excludeIdeData);
  31219. args: ["aString", "anObject"],
  31220. source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
  31221. referencedClasses: ["Compiler", "Error"],
  31222. //>>excludeEnd("ide");
  31223. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  31224. }),
  31225. globals.Evaluator);
  31226. smalltalk.addMethod(
  31227. smalltalk.method({
  31228. selector: "evaluate:for:",
  31229. protocol: 'instance creation',
  31230. fn: function (aString,anObject){
  31231. var self=this;
  31232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31233. return smalltalk.withContext(function($ctx1) {
  31234. //>>excludeEnd("ctx");
  31235. var $1;
  31236. $1=_st(self._new())._evaluate_for_(aString,anObject);
  31237. return $1;
  31238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31239. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Evaluator.klass)});
  31240. //>>excludeEnd("ctx");
  31241. },
  31242. //>>excludeStart("ide", pragmas.excludeIdeData);
  31243. args: ["aString", "anObject"],
  31244. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  31245. referencedClasses: [],
  31246. //>>excludeEnd("ide");
  31247. messageSends: ["evaluate:for:", "new"]
  31248. }),
  31249. globals.Evaluator.klass);
  31250. smalltalk.addClass('NodeVisitor', globals.Object, [], 'Compiler-Core');
  31251. //>>excludeStart("ide", pragmas.excludeIdeData);
  31252. globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  31253. //>>excludeEnd("ide");
  31254. smalltalk.addMethod(
  31255. smalltalk.method({
  31256. selector: "visit:",
  31257. protocol: 'visiting',
  31258. fn: function (aNode){
  31259. var self=this;
  31260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31261. return smalltalk.withContext(function($ctx1) {
  31262. //>>excludeEnd("ctx");
  31263. var $1;
  31264. $1=_st(aNode)._accept_(self);
  31265. return $1;
  31266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31267. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.NodeVisitor)});
  31268. //>>excludeEnd("ctx");
  31269. },
  31270. //>>excludeStart("ide", pragmas.excludeIdeData);
  31271. args: ["aNode"],
  31272. source: "visit: aNode\x0a\x09^ aNode accept: self",
  31273. referencedClasses: [],
  31274. //>>excludeEnd("ide");
  31275. messageSends: ["accept:"]
  31276. }),
  31277. globals.NodeVisitor);
  31278. smalltalk.addMethod(
  31279. smalltalk.method({
  31280. selector: "visitAll:",
  31281. protocol: 'visiting',
  31282. fn: function (aCollection){
  31283. var self=this;
  31284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31285. return smalltalk.withContext(function($ctx1) {
  31286. //>>excludeEnd("ctx");
  31287. var $1;
  31288. $1=_st(aCollection)._collect_((function(each){
  31289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31290. return smalltalk.withContext(function($ctx2) {
  31291. //>>excludeEnd("ctx");
  31292. return self._visit_(each);
  31293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31295. //>>excludeEnd("ctx");
  31296. }));
  31297. return $1;
  31298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31299. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},globals.NodeVisitor)});
  31300. //>>excludeEnd("ctx");
  31301. },
  31302. //>>excludeStart("ide", pragmas.excludeIdeData);
  31303. args: ["aCollection"],
  31304. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  31305. referencedClasses: [],
  31306. //>>excludeEnd("ide");
  31307. messageSends: ["collect:", "visit:"]
  31308. }),
  31309. globals.NodeVisitor);
  31310. smalltalk.addMethod(
  31311. smalltalk.method({
  31312. selector: "visitAssignmentNode:",
  31313. protocol: 'visiting',
  31314. fn: function (aNode){
  31315. var self=this;
  31316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31317. return smalltalk.withContext(function($ctx1) {
  31318. //>>excludeEnd("ctx");
  31319. var $1;
  31320. $1=self._visitNode_(aNode);
  31321. return $1;
  31322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31323. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.NodeVisitor)});
  31324. //>>excludeEnd("ctx");
  31325. },
  31326. //>>excludeStart("ide", pragmas.excludeIdeData);
  31327. args: ["aNode"],
  31328. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  31329. referencedClasses: [],
  31330. //>>excludeEnd("ide");
  31331. messageSends: ["visitNode:"]
  31332. }),
  31333. globals.NodeVisitor);
  31334. smalltalk.addMethod(
  31335. smalltalk.method({
  31336. selector: "visitBlockNode:",
  31337. protocol: 'visiting',
  31338. fn: function (aNode){
  31339. var self=this;
  31340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31341. return smalltalk.withContext(function($ctx1) {
  31342. //>>excludeEnd("ctx");
  31343. var $1;
  31344. $1=self._visitNode_(aNode);
  31345. return $1;
  31346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31347. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.NodeVisitor)});
  31348. //>>excludeEnd("ctx");
  31349. },
  31350. //>>excludeStart("ide", pragmas.excludeIdeData);
  31351. args: ["aNode"],
  31352. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  31353. referencedClasses: [],
  31354. //>>excludeEnd("ide");
  31355. messageSends: ["visitNode:"]
  31356. }),
  31357. globals.NodeVisitor);
  31358. smalltalk.addMethod(
  31359. smalltalk.method({
  31360. selector: "visitBlockSequenceNode:",
  31361. protocol: 'visiting',
  31362. fn: function (aNode){
  31363. var self=this;
  31364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31365. return smalltalk.withContext(function($ctx1) {
  31366. //>>excludeEnd("ctx");
  31367. var $1;
  31368. $1=self._visitSequenceNode_(aNode);
  31369. return $1;
  31370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31371. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.NodeVisitor)});
  31372. //>>excludeEnd("ctx");
  31373. },
  31374. //>>excludeStart("ide", pragmas.excludeIdeData);
  31375. args: ["aNode"],
  31376. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  31377. referencedClasses: [],
  31378. //>>excludeEnd("ide");
  31379. messageSends: ["visitSequenceNode:"]
  31380. }),
  31381. globals.NodeVisitor);
  31382. smalltalk.addMethod(
  31383. smalltalk.method({
  31384. selector: "visitCascadeNode:",
  31385. protocol: 'visiting',
  31386. fn: function (aNode){
  31387. var self=this;
  31388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31389. return smalltalk.withContext(function($ctx1) {
  31390. //>>excludeEnd("ctx");
  31391. var $1;
  31392. $1=self._visitNode_(aNode);
  31393. return $1;
  31394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31395. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.NodeVisitor)});
  31396. //>>excludeEnd("ctx");
  31397. },
  31398. //>>excludeStart("ide", pragmas.excludeIdeData);
  31399. args: ["aNode"],
  31400. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  31401. referencedClasses: [],
  31402. //>>excludeEnd("ide");
  31403. messageSends: ["visitNode:"]
  31404. }),
  31405. globals.NodeVisitor);
  31406. smalltalk.addMethod(
  31407. smalltalk.method({
  31408. selector: "visitDynamicArrayNode:",
  31409. protocol: 'visiting',
  31410. fn: function (aNode){
  31411. var self=this;
  31412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31413. return smalltalk.withContext(function($ctx1) {
  31414. //>>excludeEnd("ctx");
  31415. var $1;
  31416. $1=self._visitNode_(aNode);
  31417. return $1;
  31418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31419. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},globals.NodeVisitor)});
  31420. //>>excludeEnd("ctx");
  31421. },
  31422. //>>excludeStart("ide", pragmas.excludeIdeData);
  31423. args: ["aNode"],
  31424. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  31425. referencedClasses: [],
  31426. //>>excludeEnd("ide");
  31427. messageSends: ["visitNode:"]
  31428. }),
  31429. globals.NodeVisitor);
  31430. smalltalk.addMethod(
  31431. smalltalk.method({
  31432. selector: "visitDynamicDictionaryNode:",
  31433. protocol: 'visiting',
  31434. fn: function (aNode){
  31435. var self=this;
  31436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31437. return smalltalk.withContext(function($ctx1) {
  31438. //>>excludeEnd("ctx");
  31439. var $1;
  31440. $1=self._visitNode_(aNode);
  31441. return $1;
  31442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31443. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},globals.NodeVisitor)});
  31444. //>>excludeEnd("ctx");
  31445. },
  31446. //>>excludeStart("ide", pragmas.excludeIdeData);
  31447. args: ["aNode"],
  31448. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  31449. referencedClasses: [],
  31450. //>>excludeEnd("ide");
  31451. messageSends: ["visitNode:"]
  31452. }),
  31453. globals.NodeVisitor);
  31454. smalltalk.addMethod(
  31455. smalltalk.method({
  31456. selector: "visitJSStatementNode:",
  31457. protocol: 'visiting',
  31458. fn: function (aNode){
  31459. var self=this;
  31460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31461. return smalltalk.withContext(function($ctx1) {
  31462. //>>excludeEnd("ctx");
  31463. var $1;
  31464. $1=self._visitNode_(aNode);
  31465. return $1;
  31466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31467. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.NodeVisitor)});
  31468. //>>excludeEnd("ctx");
  31469. },
  31470. //>>excludeStart("ide", pragmas.excludeIdeData);
  31471. args: ["aNode"],
  31472. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  31473. referencedClasses: [],
  31474. //>>excludeEnd("ide");
  31475. messageSends: ["visitNode:"]
  31476. }),
  31477. globals.NodeVisitor);
  31478. smalltalk.addMethod(
  31479. smalltalk.method({
  31480. selector: "visitMethodNode:",
  31481. protocol: 'visiting',
  31482. fn: function (aNode){
  31483. var self=this;
  31484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31485. return smalltalk.withContext(function($ctx1) {
  31486. //>>excludeEnd("ctx");
  31487. var $1;
  31488. $1=self._visitNode_(aNode);
  31489. return $1;
  31490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31491. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.NodeVisitor)});
  31492. //>>excludeEnd("ctx");
  31493. },
  31494. //>>excludeStart("ide", pragmas.excludeIdeData);
  31495. args: ["aNode"],
  31496. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  31497. referencedClasses: [],
  31498. //>>excludeEnd("ide");
  31499. messageSends: ["visitNode:"]
  31500. }),
  31501. globals.NodeVisitor);
  31502. smalltalk.addMethod(
  31503. smalltalk.method({
  31504. selector: "visitNode:",
  31505. protocol: 'visiting',
  31506. fn: function (aNode){
  31507. var self=this;
  31508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31509. return smalltalk.withContext(function($ctx1) {
  31510. //>>excludeEnd("ctx");
  31511. var $1;
  31512. $1=self._visitAll_(_st(aNode)._nodes());
  31513. return $1;
  31514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31515. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},globals.NodeVisitor)});
  31516. //>>excludeEnd("ctx");
  31517. },
  31518. //>>excludeStart("ide", pragmas.excludeIdeData);
  31519. args: ["aNode"],
  31520. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  31521. referencedClasses: [],
  31522. //>>excludeEnd("ide");
  31523. messageSends: ["visitAll:", "nodes"]
  31524. }),
  31525. globals.NodeVisitor);
  31526. smalltalk.addMethod(
  31527. smalltalk.method({
  31528. selector: "visitReturnNode:",
  31529. protocol: 'visiting',
  31530. fn: function (aNode){
  31531. var self=this;
  31532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31533. return smalltalk.withContext(function($ctx1) {
  31534. //>>excludeEnd("ctx");
  31535. var $1;
  31536. $1=self._visitNode_(aNode);
  31537. return $1;
  31538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31539. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.NodeVisitor)});
  31540. //>>excludeEnd("ctx");
  31541. },
  31542. //>>excludeStart("ide", pragmas.excludeIdeData);
  31543. args: ["aNode"],
  31544. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  31545. referencedClasses: [],
  31546. //>>excludeEnd("ide");
  31547. messageSends: ["visitNode:"]
  31548. }),
  31549. globals.NodeVisitor);
  31550. smalltalk.addMethod(
  31551. smalltalk.method({
  31552. selector: "visitSendNode:",
  31553. protocol: 'visiting',
  31554. fn: function (aNode){
  31555. var self=this;
  31556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31557. return smalltalk.withContext(function($ctx1) {
  31558. //>>excludeEnd("ctx");
  31559. var $1;
  31560. $1=self._visitNode_(aNode);
  31561. return $1;
  31562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31563. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.NodeVisitor)});
  31564. //>>excludeEnd("ctx");
  31565. },
  31566. //>>excludeStart("ide", pragmas.excludeIdeData);
  31567. args: ["aNode"],
  31568. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  31569. referencedClasses: [],
  31570. //>>excludeEnd("ide");
  31571. messageSends: ["visitNode:"]
  31572. }),
  31573. globals.NodeVisitor);
  31574. smalltalk.addMethod(
  31575. smalltalk.method({
  31576. selector: "visitSequenceNode:",
  31577. protocol: 'visiting',
  31578. fn: function (aNode){
  31579. var self=this;
  31580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31581. return smalltalk.withContext(function($ctx1) {
  31582. //>>excludeEnd("ctx");
  31583. var $1;
  31584. $1=self._visitNode_(aNode);
  31585. return $1;
  31586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31587. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.NodeVisitor)});
  31588. //>>excludeEnd("ctx");
  31589. },
  31590. //>>excludeStart("ide", pragmas.excludeIdeData);
  31591. args: ["aNode"],
  31592. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  31593. referencedClasses: [],
  31594. //>>excludeEnd("ide");
  31595. messageSends: ["visitNode:"]
  31596. }),
  31597. globals.NodeVisitor);
  31598. smalltalk.addMethod(
  31599. smalltalk.method({
  31600. selector: "visitValueNode:",
  31601. protocol: 'visiting',
  31602. fn: function (aNode){
  31603. var self=this;
  31604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31605. return smalltalk.withContext(function($ctx1) {
  31606. //>>excludeEnd("ctx");
  31607. var $1;
  31608. $1=self._visitNode_(aNode);
  31609. return $1;
  31610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31611. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.NodeVisitor)});
  31612. //>>excludeEnd("ctx");
  31613. },
  31614. //>>excludeStart("ide", pragmas.excludeIdeData);
  31615. args: ["aNode"],
  31616. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  31617. referencedClasses: [],
  31618. //>>excludeEnd("ide");
  31619. messageSends: ["visitNode:"]
  31620. }),
  31621. globals.NodeVisitor);
  31622. smalltalk.addMethod(
  31623. smalltalk.method({
  31624. selector: "visitVariableNode:",
  31625. protocol: 'visiting',
  31626. fn: function (aNode){
  31627. var self=this;
  31628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31629. return smalltalk.withContext(function($ctx1) {
  31630. //>>excludeEnd("ctx");
  31631. var $1;
  31632. $1=self._visitNode_(aNode);
  31633. return $1;
  31634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31635. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.NodeVisitor)});
  31636. //>>excludeEnd("ctx");
  31637. },
  31638. //>>excludeStart("ide", pragmas.excludeIdeData);
  31639. args: ["aNode"],
  31640. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  31641. referencedClasses: [],
  31642. //>>excludeEnd("ide");
  31643. messageSends: ["visitNode:"]
  31644. }),
  31645. globals.NodeVisitor);
  31646. smalltalk.addMethod(
  31647. smalltalk.method({
  31648. selector: "asVariableName",
  31649. protocol: '*Compiler-Core',
  31650. fn: function (){
  31651. var self=this;
  31652. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  31653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31654. return smalltalk.withContext(function($ctx1) {
  31655. //>>excludeEnd("ctx");
  31656. var $2,$1;
  31657. $2=_st(_st($Smalltalk())._reservedWords())._includes_(self);
  31658. if(smalltalk.assert($2)){
  31659. $1=self.__comma("_");
  31660. } else {
  31661. $1=self;
  31662. };
  31663. return $1;
  31664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31665. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},globals.String)});
  31666. //>>excludeEnd("ctx");
  31667. },
  31668. //>>excludeStart("ide", pragmas.excludeIdeData);
  31669. args: [],
  31670. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  31671. referencedClasses: ["Smalltalk"],
  31672. //>>excludeEnd("ide");
  31673. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  31674. }),
  31675. globals.String);
  31676. });
  31677. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  31678. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  31679. smalltalk.addPackage('Compiler-AST');
  31680. smalltalk.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  31681. smalltalk.addClass('Node', globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  31682. //>>excludeStart("ide", pragmas.excludeIdeData);
  31683. globals.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
  31684. //>>excludeEnd("ide");
  31685. smalltalk.addMethod(
  31686. smalltalk.method({
  31687. selector: "accept:",
  31688. protocol: 'visiting',
  31689. fn: function (aVisitor){
  31690. var self=this;
  31691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31692. return smalltalk.withContext(function($ctx1) {
  31693. //>>excludeEnd("ctx");
  31694. var $1;
  31695. $1=_st(aVisitor)._visitNode_(self);
  31696. return $1;
  31697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31698. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.Node)});
  31699. //>>excludeEnd("ctx");
  31700. },
  31701. //>>excludeStart("ide", pragmas.excludeIdeData);
  31702. args: ["aVisitor"],
  31703. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  31704. referencedClasses: [],
  31705. //>>excludeEnd("ide");
  31706. messageSends: ["visitNode:"]
  31707. }),
  31708. globals.Node);
  31709. smalltalk.addMethod(
  31710. smalltalk.method({
  31711. selector: "addNode:",
  31712. protocol: 'accessing',
  31713. fn: function (aNode){
  31714. var self=this;
  31715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31716. return smalltalk.withContext(function($ctx1) {
  31717. //>>excludeEnd("ctx");
  31718. _st(self._nodes())._add_(aNode);
  31719. _st(aNode)._parent_(self);
  31720. return self;
  31721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31722. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},globals.Node)});
  31723. //>>excludeEnd("ctx");
  31724. },
  31725. //>>excludeStart("ide", pragmas.excludeIdeData);
  31726. args: ["aNode"],
  31727. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  31728. referencedClasses: [],
  31729. //>>excludeEnd("ide");
  31730. messageSends: ["add:", "nodes", "parent:"]
  31731. }),
  31732. globals.Node);
  31733. smalltalk.addMethod(
  31734. smalltalk.method({
  31735. selector: "allNodes",
  31736. protocol: 'accessing',
  31737. fn: function (){
  31738. var self=this;
  31739. var allNodes;
  31740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31741. return smalltalk.withContext(function($ctx1) {
  31742. //>>excludeEnd("ctx");
  31743. var $1,$2;
  31744. $1=self._nodes();
  31745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31746. $ctx1.sendIdx["nodes"]=1;
  31747. //>>excludeEnd("ctx");
  31748. allNodes=_st($1)._asSet();
  31749. _st(self._nodes())._do_((function(each){
  31750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31751. return smalltalk.withContext(function($ctx2) {
  31752. //>>excludeEnd("ctx");
  31753. return _st(allNodes)._addAll_(_st(each)._allNodes());
  31754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31756. //>>excludeEnd("ctx");
  31757. }));
  31758. $2=allNodes;
  31759. return $2;
  31760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31761. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},globals.Node)});
  31762. //>>excludeEnd("ctx");
  31763. },
  31764. //>>excludeStart("ide", pragmas.excludeIdeData);
  31765. args: [],
  31766. source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes",
  31767. referencedClasses: [],
  31768. //>>excludeEnd("ide");
  31769. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  31770. }),
  31771. globals.Node);
  31772. smalltalk.addMethod(
  31773. smalltalk.method({
  31774. selector: "inPosition:",
  31775. protocol: 'testing',
  31776. fn: function (aPoint){
  31777. var self=this;
  31778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31779. return smalltalk.withContext(function($ctx1) {
  31780. //>>excludeEnd("ctx");
  31781. var $1;
  31782. $1=_st(_st(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  31783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31784. return smalltalk.withContext(function($ctx2) {
  31785. //>>excludeEnd("ctx");
  31786. return _st(self._positionEnd()).__gt_eq(aPoint);
  31787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31789. //>>excludeEnd("ctx");
  31790. }));
  31791. return $1;
  31792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31793. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},globals.Node)});
  31794. //>>excludeEnd("ctx");
  31795. },
  31796. //>>excludeStart("ide", pragmas.excludeIdeData);
  31797. args: ["aPoint"],
  31798. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  31799. referencedClasses: [],
  31800. //>>excludeEnd("ide");
  31801. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  31802. }),
  31803. globals.Node);
  31804. smalltalk.addMethod(
  31805. smalltalk.method({
  31806. selector: "isAssignmentNode",
  31807. protocol: 'testing',
  31808. fn: function (){
  31809. var self=this;
  31810. return false;
  31811. },
  31812. //>>excludeStart("ide", pragmas.excludeIdeData);
  31813. args: [],
  31814. source: "isAssignmentNode\x0a\x09^ false",
  31815. referencedClasses: [],
  31816. //>>excludeEnd("ide");
  31817. messageSends: []
  31818. }),
  31819. globals.Node);
  31820. smalltalk.addMethod(
  31821. smalltalk.method({
  31822. selector: "isBlockNode",
  31823. protocol: 'testing',
  31824. fn: function (){
  31825. var self=this;
  31826. return false;
  31827. },
  31828. //>>excludeStart("ide", pragmas.excludeIdeData);
  31829. args: [],
  31830. source: "isBlockNode\x0a\x09^ false",
  31831. referencedClasses: [],
  31832. //>>excludeEnd("ide");
  31833. messageSends: []
  31834. }),
  31835. globals.Node);
  31836. smalltalk.addMethod(
  31837. smalltalk.method({
  31838. selector: "isBlockSequenceNode",
  31839. protocol: 'testing',
  31840. fn: function (){
  31841. var self=this;
  31842. return false;
  31843. },
  31844. //>>excludeStart("ide", pragmas.excludeIdeData);
  31845. args: [],
  31846. source: "isBlockSequenceNode\x0a\x09^ false",
  31847. referencedClasses: [],
  31848. //>>excludeEnd("ide");
  31849. messageSends: []
  31850. }),
  31851. globals.Node);
  31852. smalltalk.addMethod(
  31853. smalltalk.method({
  31854. selector: "isCascadeNode",
  31855. protocol: 'testing',
  31856. fn: function (){
  31857. var self=this;
  31858. return false;
  31859. },
  31860. //>>excludeStart("ide", pragmas.excludeIdeData);
  31861. args: [],
  31862. source: "isCascadeNode\x0a\x09^ false",
  31863. referencedClasses: [],
  31864. //>>excludeEnd("ide");
  31865. messageSends: []
  31866. }),
  31867. globals.Node);
  31868. smalltalk.addMethod(
  31869. smalltalk.method({
  31870. selector: "isImmutable",
  31871. protocol: 'testing',
  31872. fn: function (){
  31873. var self=this;
  31874. return false;
  31875. },
  31876. //>>excludeStart("ide", pragmas.excludeIdeData);
  31877. args: [],
  31878. source: "isImmutable\x0a\x09^ false",
  31879. referencedClasses: [],
  31880. //>>excludeEnd("ide");
  31881. messageSends: []
  31882. }),
  31883. globals.Node);
  31884. smalltalk.addMethod(
  31885. smalltalk.method({
  31886. selector: "isJSStatementNode",
  31887. protocol: 'testing',
  31888. fn: function (){
  31889. var self=this;
  31890. return false;
  31891. },
  31892. //>>excludeStart("ide", pragmas.excludeIdeData);
  31893. args: [],
  31894. source: "isJSStatementNode\x0a\x09^ false",
  31895. referencedClasses: [],
  31896. //>>excludeEnd("ide");
  31897. messageSends: []
  31898. }),
  31899. globals.Node);
  31900. smalltalk.addMethod(
  31901. smalltalk.method({
  31902. selector: "isLastChild",
  31903. protocol: 'testing',
  31904. fn: function (){
  31905. var self=this;
  31906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31907. return smalltalk.withContext(function($ctx1) {
  31908. //>>excludeEnd("ctx");
  31909. var $1;
  31910. $1=_st(_st(_st(self._parent())._nodes())._last()).__eq(self);
  31911. return $1;
  31912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31913. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},globals.Node)});
  31914. //>>excludeEnd("ctx");
  31915. },
  31916. //>>excludeStart("ide", pragmas.excludeIdeData);
  31917. args: [],
  31918. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  31919. referencedClasses: [],
  31920. //>>excludeEnd("ide");
  31921. messageSends: ["=", "last", "nodes", "parent"]
  31922. }),
  31923. globals.Node);
  31924. smalltalk.addMethod(
  31925. smalltalk.method({
  31926. selector: "isNavigationNode",
  31927. protocol: 'testing',
  31928. fn: function (){
  31929. var self=this;
  31930. return false;
  31931. },
  31932. //>>excludeStart("ide", pragmas.excludeIdeData);
  31933. args: [],
  31934. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  31935. referencedClasses: [],
  31936. //>>excludeEnd("ide");
  31937. messageSends: []
  31938. }),
  31939. globals.Node);
  31940. smalltalk.addMethod(
  31941. smalltalk.method({
  31942. selector: "isNode",
  31943. protocol: 'testing',
  31944. fn: function (){
  31945. var self=this;
  31946. return true;
  31947. },
  31948. //>>excludeStart("ide", pragmas.excludeIdeData);
  31949. args: [],
  31950. source: "isNode\x0a\x09^ true",
  31951. referencedClasses: [],
  31952. //>>excludeEnd("ide");
  31953. messageSends: []
  31954. }),
  31955. globals.Node);
  31956. smalltalk.addMethod(
  31957. smalltalk.method({
  31958. selector: "isReferenced",
  31959. protocol: 'testing',
  31960. fn: function (){
  31961. var self=this;
  31962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31963. return smalltalk.withContext(function($ctx1) {
  31964. //>>excludeEnd("ctx");
  31965. var $4,$3,$2,$1;
  31966. $4=self._parent();
  31967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31968. $ctx1.sendIdx["parent"]=1;
  31969. //>>excludeEnd("ctx");
  31970. $3=_st($4)._isSequenceNode();
  31971. $2=_st($3)._or_((function(){
  31972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31973. return smalltalk.withContext(function($ctx2) {
  31974. //>>excludeEnd("ctx");
  31975. return _st(self._parent())._isAssignmentNode();
  31976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31978. //>>excludeEnd("ctx");
  31979. }));
  31980. $1=_st($2)._not();
  31981. return $1;
  31982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31983. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},globals.Node)});
  31984. //>>excludeEnd("ctx");
  31985. },
  31986. //>>excludeStart("ide", pragmas.excludeIdeData);
  31987. args: [],
  31988. source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not",
  31989. referencedClasses: [],
  31990. //>>excludeEnd("ide");
  31991. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  31992. }),
  31993. globals.Node);
  31994. smalltalk.addMethod(
  31995. smalltalk.method({
  31996. selector: "isReturnNode",
  31997. protocol: 'testing',
  31998. fn: function (){
  31999. var self=this;
  32000. return false;
  32001. },
  32002. //>>excludeStart("ide", pragmas.excludeIdeData);
  32003. args: [],
  32004. source: "isReturnNode\x0a\x09^ false",
  32005. referencedClasses: [],
  32006. //>>excludeEnd("ide");
  32007. messageSends: []
  32008. }),
  32009. globals.Node);
  32010. smalltalk.addMethod(
  32011. smalltalk.method({
  32012. selector: "isSendNode",
  32013. protocol: 'testing',
  32014. fn: function (){
  32015. var self=this;
  32016. return false;
  32017. },
  32018. //>>excludeStart("ide", pragmas.excludeIdeData);
  32019. args: [],
  32020. source: "isSendNode\x0a\x09^ false",
  32021. referencedClasses: [],
  32022. //>>excludeEnd("ide");
  32023. messageSends: []
  32024. }),
  32025. globals.Node);
  32026. smalltalk.addMethod(
  32027. smalltalk.method({
  32028. selector: "isSequenceNode",
  32029. protocol: 'testing',
  32030. fn: function (){
  32031. var self=this;
  32032. return false;
  32033. },
  32034. //>>excludeStart("ide", pragmas.excludeIdeData);
  32035. args: [],
  32036. source: "isSequenceNode\x0a\x09^ false",
  32037. referencedClasses: [],
  32038. //>>excludeEnd("ide");
  32039. messageSends: []
  32040. }),
  32041. globals.Node);
  32042. smalltalk.addMethod(
  32043. smalltalk.method({
  32044. selector: "isValueNode",
  32045. protocol: 'testing',
  32046. fn: function (){
  32047. var self=this;
  32048. return false;
  32049. },
  32050. //>>excludeStart("ide", pragmas.excludeIdeData);
  32051. args: [],
  32052. source: "isValueNode\x0a\x09^ false",
  32053. referencedClasses: [],
  32054. //>>excludeEnd("ide");
  32055. messageSends: []
  32056. }),
  32057. globals.Node);
  32058. smalltalk.addMethod(
  32059. smalltalk.method({
  32060. selector: "isVariableNode",
  32061. protocol: 'testing',
  32062. fn: function (){
  32063. var self=this;
  32064. return false;
  32065. },
  32066. //>>excludeStart("ide", pragmas.excludeIdeData);
  32067. args: [],
  32068. source: "isVariableNode\x0a\x09^ false",
  32069. referencedClasses: [],
  32070. //>>excludeEnd("ide");
  32071. messageSends: []
  32072. }),
  32073. globals.Node);
  32074. smalltalk.addMethod(
  32075. smalltalk.method({
  32076. selector: "method",
  32077. protocol: 'accessing',
  32078. fn: function (){
  32079. var self=this;
  32080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32081. return smalltalk.withContext(function($ctx1) {
  32082. //>>excludeEnd("ctx");
  32083. var $2,$1,$receiver;
  32084. $2=self._parent();
  32085. if(($receiver = $2) == null || $receiver.isNil){
  32086. $1=$2;
  32087. } else {
  32088. var node;
  32089. node=$receiver;
  32090. $1=_st(node)._method();
  32091. };
  32092. return $1;
  32093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32094. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.Node)});
  32095. //>>excludeEnd("ctx");
  32096. },
  32097. //>>excludeStart("ide", pragmas.excludeIdeData);
  32098. args: [],
  32099. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  32100. referencedClasses: [],
  32101. //>>excludeEnd("ide");
  32102. messageSends: ["ifNotNil:", "parent", "method"]
  32103. }),
  32104. globals.Node);
  32105. smalltalk.addMethod(
  32106. smalltalk.method({
  32107. selector: "navigationNodeAt:ifAbsent:",
  32108. protocol: 'accessing',
  32109. fn: function (aPoint,aBlock){
  32110. var self=this;
  32111. var children;
  32112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32113. return smalltalk.withContext(function($ctx1) {
  32114. //>>excludeEnd("ctx");
  32115. var $1,$4,$3,$2;
  32116. var $early={};
  32117. try {
  32118. children=_st(self._allNodes())._select_((function(each){
  32119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32120. return smalltalk.withContext(function($ctx2) {
  32121. //>>excludeEnd("ctx");
  32122. return _st(_st(each)._isNavigationNode())._and_((function(){
  32123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32124. return smalltalk.withContext(function($ctx3) {
  32125. //>>excludeEnd("ctx");
  32126. return _st(each)._inPosition_(aPoint);
  32127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32128. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32129. //>>excludeEnd("ctx");
  32130. }));
  32131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32133. //>>excludeEnd("ctx");
  32134. }));
  32135. _st(children)._ifEmpty_((function(){
  32136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32137. return smalltalk.withContext(function($ctx2) {
  32138. //>>excludeEnd("ctx");
  32139. $1=_st(aBlock)._value();
  32140. throw $early=[$1];
  32141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  32143. //>>excludeEnd("ctx");
  32144. }));
  32145. $2=_st(_st(_st(children)._asArray())._sort_((function(a,b){
  32146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32147. return smalltalk.withContext(function($ctx2) {
  32148. //>>excludeEnd("ctx");
  32149. $4=_st(a)._positionStart();
  32150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32151. $ctx2.sendIdx["positionStart"]=1;
  32152. //>>excludeEnd("ctx");
  32153. $3=_st($4)._dist_(aPoint);
  32154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32155. $ctx2.sendIdx["dist:"]=1;
  32156. //>>excludeEnd("ctx");
  32157. return _st($3).__lt_eq(_st(_st(b)._positionStart())._dist_(aPoint));
  32158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32159. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  32160. //>>excludeEnd("ctx");
  32161. })))._first();
  32162. return $2;
  32163. }
  32164. catch(e) {if(e===$early)return e[0]; throw e}
  32165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32166. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},globals.Node)});
  32167. //>>excludeEnd("ctx");
  32168. },
  32169. //>>excludeStart("ide", pragmas.excludeIdeData);
  32170. args: ["aPoint", "aBlock"],
  32171. source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allNodes select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first",
  32172. referencedClasses: [],
  32173. //>>excludeEnd("ide");
  32174. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  32175. }),
  32176. globals.Node);
  32177. smalltalk.addMethod(
  32178. smalltalk.method({
  32179. selector: "nextChild",
  32180. protocol: 'accessing',
  32181. fn: function (){
  32182. var self=this;
  32183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32184. return smalltalk.withContext(function($ctx1) {
  32185. //>>excludeEnd("ctx");
  32186. var $3,$2,$1;
  32187. $3=self._nodes();
  32188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32189. $ctx1.sendIdx["nodes"]=1;
  32190. //>>excludeEnd("ctx");
  32191. $2=_st($3)._isEmpty();
  32192. if(smalltalk.assert($2)){
  32193. $1=self;
  32194. } else {
  32195. $1=_st(_st(self._nodes())._first())._nextChild();
  32196. };
  32197. return $1;
  32198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32199. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},globals.Node)});
  32200. //>>excludeEnd("ctx");
  32201. },
  32202. //>>excludeStart("ide", pragmas.excludeIdeData);
  32203. args: [],
  32204. source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
  32205. referencedClasses: [],
  32206. //>>excludeEnd("ide");
  32207. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
  32208. }),
  32209. globals.Node);
  32210. smalltalk.addMethod(
  32211. smalltalk.method({
  32212. selector: "nextNode",
  32213. protocol: 'accessing',
  32214. fn: function (){
  32215. var self=this;
  32216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32217. return smalltalk.withContext(function($ctx1) {
  32218. //>>excludeEnd("ctx");
  32219. var $2,$1,$receiver;
  32220. $2=self._parent();
  32221. if(($receiver = $2) == null || $receiver.isNil){
  32222. $1=$2;
  32223. } else {
  32224. var node;
  32225. node=$receiver;
  32226. $1=_st(node)._nextNode_(self);
  32227. };
  32228. return $1;
  32229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32230. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},globals.Node)});
  32231. //>>excludeEnd("ctx");
  32232. },
  32233. //>>excludeStart("ide", pragmas.excludeIdeData);
  32234. args: [],
  32235. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  32236. referencedClasses: [],
  32237. //>>excludeEnd("ide");
  32238. messageSends: ["ifNotNil:", "parent", "nextNode:"]
  32239. }),
  32240. globals.Node);
  32241. smalltalk.addMethod(
  32242. smalltalk.method({
  32243. selector: "nextNode:",
  32244. protocol: 'accessing',
  32245. fn: function (aNode){
  32246. var self=this;
  32247. var next;
  32248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32249. return smalltalk.withContext(function($ctx1) {
  32250. //>>excludeEnd("ctx");
  32251. var $1,$2;
  32252. var $early={};
  32253. try {
  32254. $1=self._nodes();
  32255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32256. $ctx1.sendIdx["nodes"]=1;
  32257. //>>excludeEnd("ctx");
  32258. next=_st($1)._at_ifAbsent_(_st(_st(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  32259. throw $early=[self];
  32260. }));
  32261. $2=_st(next)._nextChild();
  32262. return $2;
  32263. }
  32264. catch(e) {if(e===$early)return e[0]; throw e}
  32265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32266. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},globals.Node)});
  32267. //>>excludeEnd("ctx");
  32268. },
  32269. //>>excludeStart("ide", pragmas.excludeIdeData);
  32270. args: ["aNode"],
  32271. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
  32272. referencedClasses: [],
  32273. //>>excludeEnd("ide");
  32274. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
  32275. }),
  32276. globals.Node);
  32277. smalltalk.addMethod(
  32278. smalltalk.method({
  32279. selector: "nodes",
  32280. protocol: 'accessing',
  32281. fn: function (){
  32282. var self=this;
  32283. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  32284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32285. return smalltalk.withContext(function($ctx1) {
  32286. //>>excludeEnd("ctx");
  32287. var $2,$1,$receiver;
  32288. $2=self["@nodes"];
  32289. if(($receiver = $2) == null || $receiver.isNil){
  32290. self["@nodes"]=_st($Array())._new();
  32291. $1=self["@nodes"];
  32292. } else {
  32293. $1=$2;
  32294. };
  32295. return $1;
  32296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32297. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.Node)});
  32298. //>>excludeEnd("ctx");
  32299. },
  32300. //>>excludeStart("ide", pragmas.excludeIdeData);
  32301. args: [],
  32302. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  32303. referencedClasses: ["Array"],
  32304. //>>excludeEnd("ide");
  32305. messageSends: ["ifNil:", "new"]
  32306. }),
  32307. globals.Node);
  32308. smalltalk.addMethod(
  32309. smalltalk.method({
  32310. selector: "nodes:",
  32311. protocol: 'building',
  32312. fn: function (aCollection){
  32313. var self=this;
  32314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32315. return smalltalk.withContext(function($ctx1) {
  32316. //>>excludeEnd("ctx");
  32317. self["@nodes"]=aCollection;
  32318. _st(aCollection)._do_((function(each){
  32319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32320. return smalltalk.withContext(function($ctx2) {
  32321. //>>excludeEnd("ctx");
  32322. return _st(each)._parent_(self);
  32323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32324. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32325. //>>excludeEnd("ctx");
  32326. }));
  32327. return self;
  32328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32329. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},globals.Node)});
  32330. //>>excludeEnd("ctx");
  32331. },
  32332. //>>excludeStart("ide", pragmas.excludeIdeData);
  32333. args: ["aCollection"],
  32334. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  32335. referencedClasses: [],
  32336. //>>excludeEnd("ide");
  32337. messageSends: ["do:", "parent:"]
  32338. }),
  32339. globals.Node);
  32340. smalltalk.addMethod(
  32341. smalltalk.method({
  32342. selector: "parent",
  32343. protocol: 'accessing',
  32344. fn: function (){
  32345. var self=this;
  32346. var $1;
  32347. $1=self["@parent"];
  32348. return $1;
  32349. },
  32350. //>>excludeStart("ide", pragmas.excludeIdeData);
  32351. args: [],
  32352. source: "parent\x0a\x09^ parent",
  32353. referencedClasses: [],
  32354. //>>excludeEnd("ide");
  32355. messageSends: []
  32356. }),
  32357. globals.Node);
  32358. smalltalk.addMethod(
  32359. smalltalk.method({
  32360. selector: "parent:",
  32361. protocol: 'accessing',
  32362. fn: function (aNode){
  32363. var self=this;
  32364. self["@parent"]=aNode;
  32365. return self;
  32366. },
  32367. //>>excludeStart("ide", pragmas.excludeIdeData);
  32368. args: ["aNode"],
  32369. source: "parent: aNode\x0a\x09parent := aNode",
  32370. referencedClasses: [],
  32371. //>>excludeEnd("ide");
  32372. messageSends: []
  32373. }),
  32374. globals.Node);
  32375. smalltalk.addMethod(
  32376. smalltalk.method({
  32377. selector: "position",
  32378. protocol: 'accessing',
  32379. fn: function (){
  32380. var self=this;
  32381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32382. return smalltalk.withContext(function($ctx1) {
  32383. //>>excludeEnd("ctx");
  32384. var $2,$3,$1,$receiver;
  32385. $2=self["@position"];
  32386. if(($receiver = $2) == null || $receiver.isNil){
  32387. $3=self._parent();
  32388. if(($receiver = $3) == null || $receiver.isNil){
  32389. $1=$3;
  32390. } else {
  32391. var node;
  32392. node=$receiver;
  32393. $1=_st(node)._position();
  32394. };
  32395. } else {
  32396. $1=$2;
  32397. };
  32398. return $1;
  32399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32400. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Node)});
  32401. //>>excludeEnd("ctx");
  32402. },
  32403. //>>excludeStart("ide", pragmas.excludeIdeData);
  32404. args: [],
  32405. source: "position\x0a\x09\x22answer the line and column of the receiver in the source code\x22\x0a\x09\x0a\x09^ position ifNil: [ \x0a\x09\x09self parent ifNotNil: [ :node | node position ] ]",
  32406. referencedClasses: [],
  32407. //>>excludeEnd("ide");
  32408. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  32409. }),
  32410. globals.Node);
  32411. smalltalk.addMethod(
  32412. smalltalk.method({
  32413. selector: "position:",
  32414. protocol: 'accessing',
  32415. fn: function (aPosition){
  32416. var self=this;
  32417. self["@position"]=aPosition;
  32418. return self;
  32419. },
  32420. //>>excludeStart("ide", pragmas.excludeIdeData);
  32421. args: ["aPosition"],
  32422. source: "position: aPosition\x0a\x09position := aPosition",
  32423. referencedClasses: [],
  32424. //>>excludeEnd("ide");
  32425. messageSends: []
  32426. }),
  32427. globals.Node);
  32428. smalltalk.addMethod(
  32429. smalltalk.method({
  32430. selector: "positionEnd",
  32431. protocol: 'accessing',
  32432. fn: function (){
  32433. var self=this;
  32434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32435. return smalltalk.withContext(function($ctx1) {
  32436. //>>excludeEnd("ctx");
  32437. var $2,$7,$6,$5,$4,$3,$1;
  32438. $2=self._positionStart();
  32439. $7=self._source();
  32440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32441. $ctx1.sendIdx["source"]=1;
  32442. //>>excludeEnd("ctx");
  32443. $6=_st($7)._lines();
  32444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32445. $ctx1.sendIdx["lines"]=1;
  32446. //>>excludeEnd("ctx");
  32447. $5=_st($6)._size();
  32448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32449. $ctx1.sendIdx["size"]=1;
  32450. //>>excludeEnd("ctx");
  32451. $4=_st($5).__minus((1));
  32452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32453. $ctx1.sendIdx["-"]=1;
  32454. //>>excludeEnd("ctx");
  32455. $3=_st($4).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__minus((1)));
  32456. $1=_st($2).__plus($3);
  32457. return $1;
  32458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32459. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},globals.Node)});
  32460. //>>excludeEnd("ctx");
  32461. },
  32462. //>>excludeStart("ide", pragmas.excludeIdeData);
  32463. args: [],
  32464. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  32465. referencedClasses: [],
  32466. //>>excludeEnd("ide");
  32467. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  32468. }),
  32469. globals.Node);
  32470. smalltalk.addMethod(
  32471. smalltalk.method({
  32472. selector: "positionStart",
  32473. protocol: 'accessing',
  32474. fn: function (){
  32475. var self=this;
  32476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32477. return smalltalk.withContext(function($ctx1) {
  32478. //>>excludeEnd("ctx");
  32479. var $1;
  32480. $1=self._position();
  32481. return $1;
  32482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32483. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},globals.Node)});
  32484. //>>excludeEnd("ctx");
  32485. },
  32486. //>>excludeStart("ide", pragmas.excludeIdeData);
  32487. args: [],
  32488. source: "positionStart\x0a\x09^ self position",
  32489. referencedClasses: [],
  32490. //>>excludeEnd("ide");
  32491. messageSends: ["position"]
  32492. }),
  32493. globals.Node);
  32494. smalltalk.addMethod(
  32495. smalltalk.method({
  32496. selector: "postCopy",
  32497. protocol: 'copying',
  32498. fn: function (){
  32499. var self=this;
  32500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32501. return smalltalk.withContext(function($ctx1) {
  32502. //>>excludeEnd("ctx");
  32503. (
  32504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32505. $ctx1.supercall = true,
  32506. //>>excludeEnd("ctx");
  32507. globals.Node.superclass.fn.prototype._postCopy.apply(_st(self), []));
  32508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32509. $ctx1.supercall = false;
  32510. //>>excludeEnd("ctx");;
  32511. _st(self._nodes())._do_((function(each){
  32512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32513. return smalltalk.withContext(function($ctx2) {
  32514. //>>excludeEnd("ctx");
  32515. return _st(each)._parent_(self);
  32516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32518. //>>excludeEnd("ctx");
  32519. }));
  32520. return self;
  32521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32522. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},globals.Node)});
  32523. //>>excludeEnd("ctx");
  32524. },
  32525. //>>excludeStart("ide", pragmas.excludeIdeData);
  32526. args: [],
  32527. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  32528. referencedClasses: [],
  32529. //>>excludeEnd("ide");
  32530. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  32531. }),
  32532. globals.Node);
  32533. smalltalk.addMethod(
  32534. smalltalk.method({
  32535. selector: "requiresSmalltalkContext",
  32536. protocol: 'testing',
  32537. fn: function (){
  32538. var self=this;
  32539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32540. return smalltalk.withContext(function($ctx1) {
  32541. //>>excludeEnd("ctx");
  32542. var $1;
  32543. $1=_st(_st(self._nodes())._detect_ifNone_((function(each){
  32544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32545. return smalltalk.withContext(function($ctx2) {
  32546. //>>excludeEnd("ctx");
  32547. return _st(each)._requiresSmalltalkContext();
  32548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32550. //>>excludeEnd("ctx");
  32551. }),(function(){
  32552. return nil;
  32553. })))._notNil();
  32554. return $1;
  32555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32556. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.Node)});
  32557. //>>excludeEnd("ctx");
  32558. },
  32559. //>>excludeStart("ide", pragmas.excludeIdeData);
  32560. args: [],
  32561. source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  32562. referencedClasses: [],
  32563. //>>excludeEnd("ide");
  32564. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  32565. }),
  32566. globals.Node);
  32567. smalltalk.addMethod(
  32568. smalltalk.method({
  32569. selector: "shouldBeAliased",
  32570. protocol: 'accessing',
  32571. fn: function (){
  32572. var self=this;
  32573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32574. return smalltalk.withContext(function($ctx1) {
  32575. //>>excludeEnd("ctx");
  32576. var $2,$1,$receiver;
  32577. $2=self["@shouldBeAliased"];
  32578. if(($receiver = $2) == null || $receiver.isNil){
  32579. $1=false;
  32580. } else {
  32581. $1=$2;
  32582. };
  32583. return $1;
  32584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32585. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.Node)});
  32586. //>>excludeEnd("ctx");
  32587. },
  32588. //>>excludeStart("ide", pragmas.excludeIdeData);
  32589. args: [],
  32590. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  32591. referencedClasses: [],
  32592. //>>excludeEnd("ide");
  32593. messageSends: ["ifNil:"]
  32594. }),
  32595. globals.Node);
  32596. smalltalk.addMethod(
  32597. smalltalk.method({
  32598. selector: "shouldBeAliased:",
  32599. protocol: 'accessing',
  32600. fn: function (aBoolean){
  32601. var self=this;
  32602. self["@shouldBeAliased"]=aBoolean;
  32603. return self;
  32604. },
  32605. //>>excludeStart("ide", pragmas.excludeIdeData);
  32606. args: ["aBoolean"],
  32607. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  32608. referencedClasses: [],
  32609. //>>excludeEnd("ide");
  32610. messageSends: []
  32611. }),
  32612. globals.Node);
  32613. smalltalk.addMethod(
  32614. smalltalk.method({
  32615. selector: "shouldBeInlined",
  32616. protocol: 'accessing',
  32617. fn: function (){
  32618. var self=this;
  32619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32620. return smalltalk.withContext(function($ctx1) {
  32621. //>>excludeEnd("ctx");
  32622. var $2,$1,$receiver;
  32623. $2=self["@shouldBeInlined"];
  32624. if(($receiver = $2) == null || $receiver.isNil){
  32625. $1=false;
  32626. } else {
  32627. $1=$2;
  32628. };
  32629. return $1;
  32630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32631. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},globals.Node)});
  32632. //>>excludeEnd("ctx");
  32633. },
  32634. //>>excludeStart("ide", pragmas.excludeIdeData);
  32635. args: [],
  32636. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  32637. referencedClasses: [],
  32638. //>>excludeEnd("ide");
  32639. messageSends: ["ifNil:"]
  32640. }),
  32641. globals.Node);
  32642. smalltalk.addMethod(
  32643. smalltalk.method({
  32644. selector: "shouldBeInlined:",
  32645. protocol: 'accessing',
  32646. fn: function (aBoolean){
  32647. var self=this;
  32648. self["@shouldBeInlined"]=aBoolean;
  32649. return self;
  32650. },
  32651. //>>excludeStart("ide", pragmas.excludeIdeData);
  32652. args: ["aBoolean"],
  32653. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  32654. referencedClasses: [],
  32655. //>>excludeEnd("ide");
  32656. messageSends: []
  32657. }),
  32658. globals.Node);
  32659. smalltalk.addMethod(
  32660. smalltalk.method({
  32661. selector: "size",
  32662. protocol: 'accessing',
  32663. fn: function (){
  32664. var self=this;
  32665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32666. return smalltalk.withContext(function($ctx1) {
  32667. //>>excludeEnd("ctx");
  32668. var $1;
  32669. $1=_st(self._source())._size();
  32670. return $1;
  32671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32672. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Node)});
  32673. //>>excludeEnd("ctx");
  32674. },
  32675. //>>excludeStart("ide", pragmas.excludeIdeData);
  32676. args: [],
  32677. source: "size\x0a\x09^ self source size",
  32678. referencedClasses: [],
  32679. //>>excludeEnd("ide");
  32680. messageSends: ["size", "source"]
  32681. }),
  32682. globals.Node);
  32683. smalltalk.addMethod(
  32684. smalltalk.method({
  32685. selector: "source",
  32686. protocol: 'accessing',
  32687. fn: function (){
  32688. var self=this;
  32689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32690. return smalltalk.withContext(function($ctx1) {
  32691. //>>excludeEnd("ctx");
  32692. var $2,$1,$receiver;
  32693. $2=self["@source"];
  32694. if(($receiver = $2) == null || $receiver.isNil){
  32695. $1="";
  32696. } else {
  32697. $1=$2;
  32698. };
  32699. return $1;
  32700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32701. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.Node)});
  32702. //>>excludeEnd("ctx");
  32703. },
  32704. //>>excludeStart("ide", pragmas.excludeIdeData);
  32705. args: [],
  32706. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32707. referencedClasses: [],
  32708. //>>excludeEnd("ide");
  32709. messageSends: ["ifNil:"]
  32710. }),
  32711. globals.Node);
  32712. smalltalk.addMethod(
  32713. smalltalk.method({
  32714. selector: "source:",
  32715. protocol: 'accessing',
  32716. fn: function (aString){
  32717. var self=this;
  32718. self["@source"]=aString;
  32719. return self;
  32720. },
  32721. //>>excludeStart("ide", pragmas.excludeIdeData);
  32722. args: ["aString"],
  32723. source: "source: aString\x0a\x09source := aString",
  32724. referencedClasses: [],
  32725. //>>excludeEnd("ide");
  32726. messageSends: []
  32727. }),
  32728. globals.Node);
  32729. smalltalk.addMethod(
  32730. smalltalk.method({
  32731. selector: "stopOnStepping",
  32732. protocol: 'testing',
  32733. fn: function (){
  32734. var self=this;
  32735. return false;
  32736. },
  32737. //>>excludeStart("ide", pragmas.excludeIdeData);
  32738. args: [],
  32739. source: "stopOnStepping\x0a\x09^ false",
  32740. referencedClasses: [],
  32741. //>>excludeEnd("ide");
  32742. messageSends: []
  32743. }),
  32744. globals.Node);
  32745. smalltalk.addMethod(
  32746. smalltalk.method({
  32747. selector: "subtreeNeedsAliasing",
  32748. protocol: 'testing',
  32749. fn: function (){
  32750. var self=this;
  32751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32752. return smalltalk.withContext(function($ctx1) {
  32753. //>>excludeEnd("ctx");
  32754. var $1;
  32755. $1=_st(_st(self._shouldBeAliased())._or_((function(){
  32756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32757. return smalltalk.withContext(function($ctx2) {
  32758. //>>excludeEnd("ctx");
  32759. return self._shouldBeInlined();
  32760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32762. //>>excludeEnd("ctx");
  32763. })))._or_((function(){
  32764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32765. return smalltalk.withContext(function($ctx2) {
  32766. //>>excludeEnd("ctx");
  32767. return _st(self._nodes())._anySatisfy_((function(each){
  32768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32769. return smalltalk.withContext(function($ctx3) {
  32770. //>>excludeEnd("ctx");
  32771. return _st(each)._subtreeNeedsAliasing();
  32772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32773. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  32774. //>>excludeEnd("ctx");
  32775. }));
  32776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  32778. //>>excludeEnd("ctx");
  32779. }));
  32780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32781. $ctx1.sendIdx["or:"]=1;
  32782. //>>excludeEnd("ctx");
  32783. return $1;
  32784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32785. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.Node)});
  32786. //>>excludeEnd("ctx");
  32787. },
  32788. //>>excludeStart("ide", pragmas.excludeIdeData);
  32789. args: [],
  32790. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  32791. referencedClasses: [],
  32792. //>>excludeEnd("ide");
  32793. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  32794. }),
  32795. globals.Node);
  32796. smalltalk.addClass('AssignmentNode', globals.Node, ['left', 'right'], 'Compiler-AST');
  32797. //>>excludeStart("ide", pragmas.excludeIdeData);
  32798. globals.AssignmentNode.comment="I represent an assignment node.";
  32799. //>>excludeEnd("ide");
  32800. smalltalk.addMethod(
  32801. smalltalk.method({
  32802. selector: "accept:",
  32803. protocol: 'visiting',
  32804. fn: function (aVisitor){
  32805. var self=this;
  32806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32807. return smalltalk.withContext(function($ctx1) {
  32808. //>>excludeEnd("ctx");
  32809. var $1;
  32810. $1=_st(aVisitor)._visitAssignmentNode_(self);
  32811. return $1;
  32812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32813. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.AssignmentNode)});
  32814. //>>excludeEnd("ctx");
  32815. },
  32816. //>>excludeStart("ide", pragmas.excludeIdeData);
  32817. args: ["aVisitor"],
  32818. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  32819. referencedClasses: [],
  32820. //>>excludeEnd("ide");
  32821. messageSends: ["visitAssignmentNode:"]
  32822. }),
  32823. globals.AssignmentNode);
  32824. smalltalk.addMethod(
  32825. smalltalk.method({
  32826. selector: "isAssignmentNode",
  32827. protocol: 'testing',
  32828. fn: function (){
  32829. var self=this;
  32830. return true;
  32831. },
  32832. //>>excludeStart("ide", pragmas.excludeIdeData);
  32833. args: [],
  32834. source: "isAssignmentNode\x0a\x09^ true",
  32835. referencedClasses: [],
  32836. //>>excludeEnd("ide");
  32837. messageSends: []
  32838. }),
  32839. globals.AssignmentNode);
  32840. smalltalk.addMethod(
  32841. smalltalk.method({
  32842. selector: "left",
  32843. protocol: 'accessing',
  32844. fn: function (){
  32845. var self=this;
  32846. var $1;
  32847. $1=self["@left"];
  32848. return $1;
  32849. },
  32850. //>>excludeStart("ide", pragmas.excludeIdeData);
  32851. args: [],
  32852. source: "left\x0a\x09^ left",
  32853. referencedClasses: [],
  32854. //>>excludeEnd("ide");
  32855. messageSends: []
  32856. }),
  32857. globals.AssignmentNode);
  32858. smalltalk.addMethod(
  32859. smalltalk.method({
  32860. selector: "left:",
  32861. protocol: 'accessing',
  32862. fn: function (aNode){
  32863. var self=this;
  32864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32865. return smalltalk.withContext(function($ctx1) {
  32866. //>>excludeEnd("ctx");
  32867. self["@left"]=aNode;
  32868. _st(aNode)._parent_(self);
  32869. return self;
  32870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32871. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},globals.AssignmentNode)});
  32872. //>>excludeEnd("ctx");
  32873. },
  32874. //>>excludeStart("ide", pragmas.excludeIdeData);
  32875. args: ["aNode"],
  32876. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  32877. referencedClasses: [],
  32878. //>>excludeEnd("ide");
  32879. messageSends: ["parent:"]
  32880. }),
  32881. globals.AssignmentNode);
  32882. smalltalk.addMethod(
  32883. smalltalk.method({
  32884. selector: "nodes",
  32885. protocol: 'accessing',
  32886. fn: function (){
  32887. var self=this;
  32888. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  32889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32890. return smalltalk.withContext(function($ctx1) {
  32891. //>>excludeEnd("ctx");
  32892. var $1;
  32893. $1=_st($Array())._with_with_(self._left(),self._right());
  32894. return $1;
  32895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32896. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.AssignmentNode)});
  32897. //>>excludeEnd("ctx");
  32898. },
  32899. //>>excludeStart("ide", pragmas.excludeIdeData);
  32900. args: [],
  32901. source: "nodes\x0a\x09^ Array with: self left with: self right",
  32902. referencedClasses: ["Array"],
  32903. //>>excludeEnd("ide");
  32904. messageSends: ["with:with:", "left", "right"]
  32905. }),
  32906. globals.AssignmentNode);
  32907. smalltalk.addMethod(
  32908. smalltalk.method({
  32909. selector: "right",
  32910. protocol: 'accessing',
  32911. fn: function (){
  32912. var self=this;
  32913. var $1;
  32914. $1=self["@right"];
  32915. return $1;
  32916. },
  32917. //>>excludeStart("ide", pragmas.excludeIdeData);
  32918. args: [],
  32919. source: "right\x0a\x09^ right",
  32920. referencedClasses: [],
  32921. //>>excludeEnd("ide");
  32922. messageSends: []
  32923. }),
  32924. globals.AssignmentNode);
  32925. smalltalk.addMethod(
  32926. smalltalk.method({
  32927. selector: "right:",
  32928. protocol: 'accessing',
  32929. fn: function (aNode){
  32930. var self=this;
  32931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32932. return smalltalk.withContext(function($ctx1) {
  32933. //>>excludeEnd("ctx");
  32934. self["@right"]=aNode;
  32935. _st(aNode)._parent_(self);
  32936. return self;
  32937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32938. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},globals.AssignmentNode)});
  32939. //>>excludeEnd("ctx");
  32940. },
  32941. //>>excludeStart("ide", pragmas.excludeIdeData);
  32942. args: ["aNode"],
  32943. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  32944. referencedClasses: [],
  32945. //>>excludeEnd("ide");
  32946. messageSends: ["parent:"]
  32947. }),
  32948. globals.AssignmentNode);
  32949. smalltalk.addMethod(
  32950. smalltalk.method({
  32951. selector: "shouldBeAliased",
  32952. protocol: 'testing',
  32953. fn: function (){
  32954. var self=this;
  32955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32956. return smalltalk.withContext(function($ctx1) {
  32957. //>>excludeEnd("ctx");
  32958. var $2,$1;
  32959. $2=(
  32960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32961. $ctx1.supercall = true,
  32962. //>>excludeEnd("ctx");
  32963. globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
  32964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32965. $ctx1.supercall = false;
  32966. //>>excludeEnd("ctx");;
  32967. $1=_st($2)._or_((function(){
  32968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32969. return smalltalk.withContext(function($ctx2) {
  32970. //>>excludeEnd("ctx");
  32971. return self._isReferenced();
  32972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32974. //>>excludeEnd("ctx");
  32975. }));
  32976. return $1;
  32977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32978. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.AssignmentNode)});
  32979. //>>excludeEnd("ctx");
  32980. },
  32981. //>>excludeStart("ide", pragmas.excludeIdeData);
  32982. args: [],
  32983. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  32984. referencedClasses: [],
  32985. //>>excludeEnd("ide");
  32986. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  32987. }),
  32988. globals.AssignmentNode);
  32989. smalltalk.addClass('BlockNode', globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  32990. //>>excludeStart("ide", pragmas.excludeIdeData);
  32991. globals.BlockNode.comment="I represent an block closure node.";
  32992. //>>excludeEnd("ide");
  32993. smalltalk.addMethod(
  32994. smalltalk.method({
  32995. selector: "accept:",
  32996. protocol: 'visiting',
  32997. fn: function (aVisitor){
  32998. var self=this;
  32999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33000. return smalltalk.withContext(function($ctx1) {
  33001. //>>excludeEnd("ctx");
  33002. var $1;
  33003. $1=_st(aVisitor)._visitBlockNode_(self);
  33004. return $1;
  33005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33006. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockNode)});
  33007. //>>excludeEnd("ctx");
  33008. },
  33009. //>>excludeStart("ide", pragmas.excludeIdeData);
  33010. args: ["aVisitor"],
  33011. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33012. referencedClasses: [],
  33013. //>>excludeEnd("ide");
  33014. messageSends: ["visitBlockNode:"]
  33015. }),
  33016. globals.BlockNode);
  33017. smalltalk.addMethod(
  33018. smalltalk.method({
  33019. selector: "isBlockNode",
  33020. protocol: 'testing',
  33021. fn: function (){
  33022. var self=this;
  33023. return true;
  33024. },
  33025. //>>excludeStart("ide", pragmas.excludeIdeData);
  33026. args: [],
  33027. source: "isBlockNode\x0a\x09^ true",
  33028. referencedClasses: [],
  33029. //>>excludeEnd("ide");
  33030. messageSends: []
  33031. }),
  33032. globals.BlockNode);
  33033. smalltalk.addMethod(
  33034. smalltalk.method({
  33035. selector: "nextChild",
  33036. protocol: 'accessing',
  33037. fn: function (){
  33038. var self=this;
  33039. return self;
  33040. },
  33041. //>>excludeStart("ide", pragmas.excludeIdeData);
  33042. args: [],
  33043. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  33044. referencedClasses: [],
  33045. //>>excludeEnd("ide");
  33046. messageSends: []
  33047. }),
  33048. globals.BlockNode);
  33049. smalltalk.addMethod(
  33050. smalltalk.method({
  33051. selector: "nextNode:",
  33052. protocol: 'accessing',
  33053. fn: function (aNode){
  33054. var self=this;
  33055. return self;
  33056. },
  33057. //>>excludeStart("ide", pragmas.excludeIdeData);
  33058. args: ["aNode"],
  33059. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  33060. referencedClasses: [],
  33061. //>>excludeEnd("ide");
  33062. messageSends: []
  33063. }),
  33064. globals.BlockNode);
  33065. smalltalk.addMethod(
  33066. smalltalk.method({
  33067. selector: "parameters",
  33068. protocol: 'accessing',
  33069. fn: function (){
  33070. var self=this;
  33071. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  33072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33073. return smalltalk.withContext(function($ctx1) {
  33074. //>>excludeEnd("ctx");
  33075. var $2,$1,$receiver;
  33076. $2=self["@parameters"];
  33077. if(($receiver = $2) == null || $receiver.isNil){
  33078. self["@parameters"]=_st($Array())._new();
  33079. $1=self["@parameters"];
  33080. } else {
  33081. $1=$2;
  33082. };
  33083. return $1;
  33084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33085. }, function($ctx1) {$ctx1.fill(self,"parameters",{},globals.BlockNode)});
  33086. //>>excludeEnd("ctx");
  33087. },
  33088. //>>excludeStart("ide", pragmas.excludeIdeData);
  33089. args: [],
  33090. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  33091. referencedClasses: ["Array"],
  33092. //>>excludeEnd("ide");
  33093. messageSends: ["ifNil:", "new"]
  33094. }),
  33095. globals.BlockNode);
  33096. smalltalk.addMethod(
  33097. smalltalk.method({
  33098. selector: "parameters:",
  33099. protocol: 'accessing',
  33100. fn: function (aCollection){
  33101. var self=this;
  33102. self["@parameters"]=aCollection;
  33103. return self;
  33104. },
  33105. //>>excludeStart("ide", pragmas.excludeIdeData);
  33106. args: ["aCollection"],
  33107. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  33108. referencedClasses: [],
  33109. //>>excludeEnd("ide");
  33110. messageSends: []
  33111. }),
  33112. globals.BlockNode);
  33113. smalltalk.addMethod(
  33114. smalltalk.method({
  33115. selector: "scope",
  33116. protocol: 'accessing',
  33117. fn: function (){
  33118. var self=this;
  33119. var $1;
  33120. $1=self["@scope"];
  33121. return $1;
  33122. },
  33123. //>>excludeStart("ide", pragmas.excludeIdeData);
  33124. args: [],
  33125. source: "scope\x0a\x09^ scope",
  33126. referencedClasses: [],
  33127. //>>excludeEnd("ide");
  33128. messageSends: []
  33129. }),
  33130. globals.BlockNode);
  33131. smalltalk.addMethod(
  33132. smalltalk.method({
  33133. selector: "scope:",
  33134. protocol: 'accessing',
  33135. fn: function (aLexicalScope){
  33136. var self=this;
  33137. self["@scope"]=aLexicalScope;
  33138. return self;
  33139. },
  33140. //>>excludeStart("ide", pragmas.excludeIdeData);
  33141. args: ["aLexicalScope"],
  33142. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33143. referencedClasses: [],
  33144. //>>excludeEnd("ide");
  33145. messageSends: []
  33146. }),
  33147. globals.BlockNode);
  33148. smalltalk.addMethod(
  33149. smalltalk.method({
  33150. selector: "subtreeNeedsAliasing",
  33151. protocol: 'testing',
  33152. fn: function (){
  33153. var self=this;
  33154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33155. return smalltalk.withContext(function($ctx1) {
  33156. //>>excludeEnd("ctx");
  33157. var $1;
  33158. $1=_st(self._shouldBeAliased())._or_((function(){
  33159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33160. return smalltalk.withContext(function($ctx2) {
  33161. //>>excludeEnd("ctx");
  33162. return self._shouldBeInlined();
  33163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33165. //>>excludeEnd("ctx");
  33166. }));
  33167. return $1;
  33168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33169. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.BlockNode)});
  33170. //>>excludeEnd("ctx");
  33171. },
  33172. //>>excludeStart("ide", pragmas.excludeIdeData);
  33173. args: [],
  33174. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  33175. referencedClasses: [],
  33176. //>>excludeEnd("ide");
  33177. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  33178. }),
  33179. globals.BlockNode);
  33180. smalltalk.addClass('CascadeNode', globals.Node, ['receiver'], 'Compiler-AST');
  33181. //>>excludeStart("ide", pragmas.excludeIdeData);
  33182. globals.CascadeNode.comment="I represent an cascade node.";
  33183. //>>excludeEnd("ide");
  33184. smalltalk.addMethod(
  33185. smalltalk.method({
  33186. selector: "accept:",
  33187. protocol: 'visiting',
  33188. fn: function (aVisitor){
  33189. var self=this;
  33190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33191. return smalltalk.withContext(function($ctx1) {
  33192. //>>excludeEnd("ctx");
  33193. var $1;
  33194. $1=_st(aVisitor)._visitCascadeNode_(self);
  33195. return $1;
  33196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33197. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.CascadeNode)});
  33198. //>>excludeEnd("ctx");
  33199. },
  33200. //>>excludeStart("ide", pragmas.excludeIdeData);
  33201. args: ["aVisitor"],
  33202. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  33203. referencedClasses: [],
  33204. //>>excludeEnd("ide");
  33205. messageSends: ["visitCascadeNode:"]
  33206. }),
  33207. globals.CascadeNode);
  33208. smalltalk.addMethod(
  33209. smalltalk.method({
  33210. selector: "isCascadeNode",
  33211. protocol: 'testing',
  33212. fn: function (){
  33213. var self=this;
  33214. return true;
  33215. },
  33216. //>>excludeStart("ide", pragmas.excludeIdeData);
  33217. args: [],
  33218. source: "isCascadeNode\x0a\x09^ true",
  33219. referencedClasses: [],
  33220. //>>excludeEnd("ide");
  33221. messageSends: []
  33222. }),
  33223. globals.CascadeNode);
  33224. smalltalk.addMethod(
  33225. smalltalk.method({
  33226. selector: "receiver",
  33227. protocol: 'accessing',
  33228. fn: function (){
  33229. var self=this;
  33230. var $1;
  33231. $1=self["@receiver"];
  33232. return $1;
  33233. },
  33234. //>>excludeStart("ide", pragmas.excludeIdeData);
  33235. args: [],
  33236. source: "receiver\x0a\x09^ receiver",
  33237. referencedClasses: [],
  33238. //>>excludeEnd("ide");
  33239. messageSends: []
  33240. }),
  33241. globals.CascadeNode);
  33242. smalltalk.addMethod(
  33243. smalltalk.method({
  33244. selector: "receiver:",
  33245. protocol: 'accessing',
  33246. fn: function (aNode){
  33247. var self=this;
  33248. self["@receiver"]=aNode;
  33249. return self;
  33250. },
  33251. //>>excludeStart("ide", pragmas.excludeIdeData);
  33252. args: ["aNode"],
  33253. source: "receiver: aNode\x0a\x09receiver := aNode",
  33254. referencedClasses: [],
  33255. //>>excludeEnd("ide");
  33256. messageSends: []
  33257. }),
  33258. globals.CascadeNode);
  33259. smalltalk.addClass('DynamicArrayNode', globals.Node, [], 'Compiler-AST');
  33260. //>>excludeStart("ide", pragmas.excludeIdeData);
  33261. globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  33262. //>>excludeEnd("ide");
  33263. smalltalk.addMethod(
  33264. smalltalk.method({
  33265. selector: "accept:",
  33266. protocol: 'visiting',
  33267. fn: function (aVisitor){
  33268. var self=this;
  33269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33270. return smalltalk.withContext(function($ctx1) {
  33271. //>>excludeEnd("ctx");
  33272. var $1;
  33273. $1=_st(aVisitor)._visitDynamicArrayNode_(self);
  33274. return $1;
  33275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33276. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicArrayNode)});
  33277. //>>excludeEnd("ctx");
  33278. },
  33279. //>>excludeStart("ide", pragmas.excludeIdeData);
  33280. args: ["aVisitor"],
  33281. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  33282. referencedClasses: [],
  33283. //>>excludeEnd("ide");
  33284. messageSends: ["visitDynamicArrayNode:"]
  33285. }),
  33286. globals.DynamicArrayNode);
  33287. smalltalk.addClass('DynamicDictionaryNode', globals.Node, [], 'Compiler-AST');
  33288. //>>excludeStart("ide", pragmas.excludeIdeData);
  33289. globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  33290. //>>excludeEnd("ide");
  33291. smalltalk.addMethod(
  33292. smalltalk.method({
  33293. selector: "accept:",
  33294. protocol: 'visiting',
  33295. fn: function (aVisitor){
  33296. var self=this;
  33297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33298. return smalltalk.withContext(function($ctx1) {
  33299. //>>excludeEnd("ctx");
  33300. var $1;
  33301. $1=_st(aVisitor)._visitDynamicDictionaryNode_(self);
  33302. return $1;
  33303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33304. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicDictionaryNode)});
  33305. //>>excludeEnd("ctx");
  33306. },
  33307. //>>excludeStart("ide", pragmas.excludeIdeData);
  33308. args: ["aVisitor"],
  33309. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  33310. referencedClasses: [],
  33311. //>>excludeEnd("ide");
  33312. messageSends: ["visitDynamicDictionaryNode:"]
  33313. }),
  33314. globals.DynamicDictionaryNode);
  33315. smalltalk.addClass('JSStatementNode', globals.Node, [], 'Compiler-AST');
  33316. //>>excludeStart("ide", pragmas.excludeIdeData);
  33317. globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  33318. //>>excludeEnd("ide");
  33319. smalltalk.addMethod(
  33320. smalltalk.method({
  33321. selector: "accept:",
  33322. protocol: 'visiting',
  33323. fn: function (aVisitor){
  33324. var self=this;
  33325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33326. return smalltalk.withContext(function($ctx1) {
  33327. //>>excludeEnd("ctx");
  33328. var $1;
  33329. $1=_st(aVisitor)._visitJSStatementNode_(self);
  33330. return $1;
  33331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33332. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.JSStatementNode)});
  33333. //>>excludeEnd("ctx");
  33334. },
  33335. //>>excludeStart("ide", pragmas.excludeIdeData);
  33336. args: ["aVisitor"],
  33337. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  33338. referencedClasses: [],
  33339. //>>excludeEnd("ide");
  33340. messageSends: ["visitJSStatementNode:"]
  33341. }),
  33342. globals.JSStatementNode);
  33343. smalltalk.addMethod(
  33344. smalltalk.method({
  33345. selector: "isJSStatementNode",
  33346. protocol: 'testing',
  33347. fn: function (){
  33348. var self=this;
  33349. return true;
  33350. },
  33351. //>>excludeStart("ide", pragmas.excludeIdeData);
  33352. args: [],
  33353. source: "isJSStatementNode\x0a\x09^ true",
  33354. referencedClasses: [],
  33355. //>>excludeEnd("ide");
  33356. messageSends: []
  33357. }),
  33358. globals.JSStatementNode);
  33359. smalltalk.addMethod(
  33360. smalltalk.method({
  33361. selector: "requiresSmalltalkContext",
  33362. protocol: 'testing',
  33363. fn: function (){
  33364. var self=this;
  33365. return true;
  33366. },
  33367. //>>excludeStart("ide", pragmas.excludeIdeData);
  33368. args: [],
  33369. source: "requiresSmalltalkContext\x0a\x09^ true",
  33370. referencedClasses: [],
  33371. //>>excludeEnd("ide");
  33372. messageSends: []
  33373. }),
  33374. globals.JSStatementNode);
  33375. smalltalk.addClass('MethodNode', globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  33376. //>>excludeStart("ide", pragmas.excludeIdeData);
  33377. globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  33378. //>>excludeEnd("ide");
  33379. smalltalk.addMethod(
  33380. smalltalk.method({
  33381. selector: "accept:",
  33382. protocol: 'visiting',
  33383. fn: function (aVisitor){
  33384. var self=this;
  33385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33386. return smalltalk.withContext(function($ctx1) {
  33387. //>>excludeEnd("ctx");
  33388. var $1;
  33389. $1=_st(aVisitor)._visitMethodNode_(self);
  33390. return $1;
  33391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33392. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.MethodNode)});
  33393. //>>excludeEnd("ctx");
  33394. },
  33395. //>>excludeStart("ide", pragmas.excludeIdeData);
  33396. args: ["aVisitor"],
  33397. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  33398. referencedClasses: [],
  33399. //>>excludeEnd("ide");
  33400. messageSends: ["visitMethodNode:"]
  33401. }),
  33402. globals.MethodNode);
  33403. smalltalk.addMethod(
  33404. smalltalk.method({
  33405. selector: "arguments",
  33406. protocol: 'accessing',
  33407. fn: function (){
  33408. var self=this;
  33409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33410. return smalltalk.withContext(function($ctx1) {
  33411. //>>excludeEnd("ctx");
  33412. var $2,$1,$receiver;
  33413. $2=self["@arguments"];
  33414. if(($receiver = $2) == null || $receiver.isNil){
  33415. $1=[];
  33416. } else {
  33417. $1=$2;
  33418. };
  33419. return $1;
  33420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33421. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MethodNode)});
  33422. //>>excludeEnd("ctx");
  33423. },
  33424. //>>excludeStart("ide", pragmas.excludeIdeData);
  33425. args: [],
  33426. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  33427. referencedClasses: [],
  33428. //>>excludeEnd("ide");
  33429. messageSends: ["ifNil:"]
  33430. }),
  33431. globals.MethodNode);
  33432. smalltalk.addMethod(
  33433. smalltalk.method({
  33434. selector: "arguments:",
  33435. protocol: 'accessing',
  33436. fn: function (aCollection){
  33437. var self=this;
  33438. self["@arguments"]=aCollection;
  33439. return self;
  33440. },
  33441. //>>excludeStart("ide", pragmas.excludeIdeData);
  33442. args: ["aCollection"],
  33443. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  33444. referencedClasses: [],
  33445. //>>excludeEnd("ide");
  33446. messageSends: []
  33447. }),
  33448. globals.MethodNode);
  33449. smalltalk.addMethod(
  33450. smalltalk.method({
  33451. selector: "classReferences",
  33452. protocol: 'accessing',
  33453. fn: function (){
  33454. var self=this;
  33455. var $1;
  33456. $1=self["@classReferences"];
  33457. return $1;
  33458. },
  33459. //>>excludeStart("ide", pragmas.excludeIdeData);
  33460. args: [],
  33461. source: "classReferences\x0a\x09^ classReferences",
  33462. referencedClasses: [],
  33463. //>>excludeEnd("ide");
  33464. messageSends: []
  33465. }),
  33466. globals.MethodNode);
  33467. smalltalk.addMethod(
  33468. smalltalk.method({
  33469. selector: "classReferences:",
  33470. protocol: 'accessing',
  33471. fn: function (aCollection){
  33472. var self=this;
  33473. self["@classReferences"]=aCollection;
  33474. return self;
  33475. },
  33476. //>>excludeStart("ide", pragmas.excludeIdeData);
  33477. args: ["aCollection"],
  33478. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  33479. referencedClasses: [],
  33480. //>>excludeEnd("ide");
  33481. messageSends: []
  33482. }),
  33483. globals.MethodNode);
  33484. smalltalk.addMethod(
  33485. smalltalk.method({
  33486. selector: "messageSends",
  33487. protocol: 'accessing',
  33488. fn: function (){
  33489. var self=this;
  33490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33491. return smalltalk.withContext(function($ctx1) {
  33492. //>>excludeEnd("ctx");
  33493. var $1;
  33494. $1=_st(self._sendIndexes())._keys();
  33495. return $1;
  33496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33497. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.MethodNode)});
  33498. //>>excludeEnd("ctx");
  33499. },
  33500. //>>excludeStart("ide", pragmas.excludeIdeData);
  33501. args: [],
  33502. source: "messageSends\x0a\x09^ self sendIndexes keys",
  33503. referencedClasses: [],
  33504. //>>excludeEnd("ide");
  33505. messageSends: ["keys", "sendIndexes"]
  33506. }),
  33507. globals.MethodNode);
  33508. smalltalk.addMethod(
  33509. smalltalk.method({
  33510. selector: "method",
  33511. protocol: 'accessing',
  33512. fn: function (){
  33513. var self=this;
  33514. return self;
  33515. },
  33516. //>>excludeStart("ide", pragmas.excludeIdeData);
  33517. args: [],
  33518. source: "method\x0a\x09^ self",
  33519. referencedClasses: [],
  33520. //>>excludeEnd("ide");
  33521. messageSends: []
  33522. }),
  33523. globals.MethodNode);
  33524. smalltalk.addMethod(
  33525. smalltalk.method({
  33526. selector: "scope",
  33527. protocol: 'accessing',
  33528. fn: function (){
  33529. var self=this;
  33530. var $1;
  33531. $1=self["@scope"];
  33532. return $1;
  33533. },
  33534. //>>excludeStart("ide", pragmas.excludeIdeData);
  33535. args: [],
  33536. source: "scope\x0a\x09^ scope",
  33537. referencedClasses: [],
  33538. //>>excludeEnd("ide");
  33539. messageSends: []
  33540. }),
  33541. globals.MethodNode);
  33542. smalltalk.addMethod(
  33543. smalltalk.method({
  33544. selector: "scope:",
  33545. protocol: 'accessing',
  33546. fn: function (aMethodScope){
  33547. var self=this;
  33548. self["@scope"]=aMethodScope;
  33549. return self;
  33550. },
  33551. //>>excludeStart("ide", pragmas.excludeIdeData);
  33552. args: ["aMethodScope"],
  33553. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  33554. referencedClasses: [],
  33555. //>>excludeEnd("ide");
  33556. messageSends: []
  33557. }),
  33558. globals.MethodNode);
  33559. smalltalk.addMethod(
  33560. smalltalk.method({
  33561. selector: "selector",
  33562. protocol: 'accessing',
  33563. fn: function (){
  33564. var self=this;
  33565. var $1;
  33566. $1=self["@selector"];
  33567. return $1;
  33568. },
  33569. //>>excludeStart("ide", pragmas.excludeIdeData);
  33570. args: [],
  33571. source: "selector\x0a\x09^ selector",
  33572. referencedClasses: [],
  33573. //>>excludeEnd("ide");
  33574. messageSends: []
  33575. }),
  33576. globals.MethodNode);
  33577. smalltalk.addMethod(
  33578. smalltalk.method({
  33579. selector: "selector:",
  33580. protocol: 'accessing',
  33581. fn: function (aString){
  33582. var self=this;
  33583. self["@selector"]=aString;
  33584. return self;
  33585. },
  33586. //>>excludeStart("ide", pragmas.excludeIdeData);
  33587. args: ["aString"],
  33588. source: "selector: aString\x0a\x09selector := aString",
  33589. referencedClasses: [],
  33590. //>>excludeEnd("ide");
  33591. messageSends: []
  33592. }),
  33593. globals.MethodNode);
  33594. smalltalk.addMethod(
  33595. smalltalk.method({
  33596. selector: "sendIndexes",
  33597. protocol: 'accessing',
  33598. fn: function (){
  33599. var self=this;
  33600. var $1;
  33601. $1=self["@sendIndexes"];
  33602. return $1;
  33603. },
  33604. //>>excludeStart("ide", pragmas.excludeIdeData);
  33605. args: [],
  33606. source: "sendIndexes\x0a\x09^ sendIndexes",
  33607. referencedClasses: [],
  33608. //>>excludeEnd("ide");
  33609. messageSends: []
  33610. }),
  33611. globals.MethodNode);
  33612. smalltalk.addMethod(
  33613. smalltalk.method({
  33614. selector: "sendIndexes:",
  33615. protocol: 'accessing',
  33616. fn: function (aDictionary){
  33617. var self=this;
  33618. self["@sendIndexes"]=aDictionary;
  33619. return self;
  33620. },
  33621. //>>excludeStart("ide", pragmas.excludeIdeData);
  33622. args: ["aDictionary"],
  33623. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  33624. referencedClasses: [],
  33625. //>>excludeEnd("ide");
  33626. messageSends: []
  33627. }),
  33628. globals.MethodNode);
  33629. smalltalk.addMethod(
  33630. smalltalk.method({
  33631. selector: "sequenceNode",
  33632. protocol: 'accessing',
  33633. fn: function (){
  33634. var self=this;
  33635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33636. return smalltalk.withContext(function($ctx1) {
  33637. //>>excludeEnd("ctx");
  33638. var $1;
  33639. var $early={};
  33640. try {
  33641. _st(self._nodes())._do_((function(each){
  33642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33643. return smalltalk.withContext(function($ctx2) {
  33644. //>>excludeEnd("ctx");
  33645. $1=_st(each)._isSequenceNode();
  33646. if(smalltalk.assert($1)){
  33647. throw $early=[each];
  33648. };
  33649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33650. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33651. //>>excludeEnd("ctx");
  33652. }));
  33653. return nil;
  33654. }
  33655. catch(e) {if(e===$early)return e[0]; throw e}
  33656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33657. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},globals.MethodNode)});
  33658. //>>excludeEnd("ctx");
  33659. },
  33660. //>>excludeStart("ide", pragmas.excludeIdeData);
  33661. args: [],
  33662. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  33663. referencedClasses: [],
  33664. //>>excludeEnd("ide");
  33665. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  33666. }),
  33667. globals.MethodNode);
  33668. smalltalk.addMethod(
  33669. smalltalk.method({
  33670. selector: "source",
  33671. protocol: 'accessing',
  33672. fn: function (){
  33673. var self=this;
  33674. var $1;
  33675. $1=self["@source"];
  33676. return $1;
  33677. },
  33678. //>>excludeStart("ide", pragmas.excludeIdeData);
  33679. args: [],
  33680. source: "source\x0a\x09^ source",
  33681. referencedClasses: [],
  33682. //>>excludeEnd("ide");
  33683. messageSends: []
  33684. }),
  33685. globals.MethodNode);
  33686. smalltalk.addMethod(
  33687. smalltalk.method({
  33688. selector: "source:",
  33689. protocol: 'accessing',
  33690. fn: function (aString){
  33691. var self=this;
  33692. self["@source"]=aString;
  33693. return self;
  33694. },
  33695. //>>excludeStart("ide", pragmas.excludeIdeData);
  33696. args: ["aString"],
  33697. source: "source: aString\x0a\x09source := aString",
  33698. referencedClasses: [],
  33699. //>>excludeEnd("ide");
  33700. messageSends: []
  33701. }),
  33702. globals.MethodNode);
  33703. smalltalk.addMethod(
  33704. smalltalk.method({
  33705. selector: "superSends",
  33706. protocol: 'accessing',
  33707. fn: function (){
  33708. var self=this;
  33709. var $1;
  33710. $1=self["@superSends"];
  33711. return $1;
  33712. },
  33713. //>>excludeStart("ide", pragmas.excludeIdeData);
  33714. args: [],
  33715. source: "superSends\x0a\x09^ superSends",
  33716. referencedClasses: [],
  33717. //>>excludeEnd("ide");
  33718. messageSends: []
  33719. }),
  33720. globals.MethodNode);
  33721. smalltalk.addMethod(
  33722. smalltalk.method({
  33723. selector: "superSends:",
  33724. protocol: 'accessing',
  33725. fn: function (aCollection){
  33726. var self=this;
  33727. self["@superSends"]=aCollection;
  33728. return self;
  33729. },
  33730. //>>excludeStart("ide", pragmas.excludeIdeData);
  33731. args: ["aCollection"],
  33732. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  33733. referencedClasses: [],
  33734. //>>excludeEnd("ide");
  33735. messageSends: []
  33736. }),
  33737. globals.MethodNode);
  33738. smalltalk.addClass('ReturnNode', globals.Node, ['scope'], 'Compiler-AST');
  33739. //>>excludeStart("ide", pragmas.excludeIdeData);
  33740. globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  33741. //>>excludeEnd("ide");
  33742. smalltalk.addMethod(
  33743. smalltalk.method({
  33744. selector: "accept:",
  33745. protocol: 'visiting',
  33746. fn: function (aVisitor){
  33747. var self=this;
  33748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33749. return smalltalk.withContext(function($ctx1) {
  33750. //>>excludeEnd("ctx");
  33751. var $1;
  33752. $1=_st(aVisitor)._visitReturnNode_(self);
  33753. return $1;
  33754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33755. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ReturnNode)});
  33756. //>>excludeEnd("ctx");
  33757. },
  33758. //>>excludeStart("ide", pragmas.excludeIdeData);
  33759. args: ["aVisitor"],
  33760. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  33761. referencedClasses: [],
  33762. //>>excludeEnd("ide");
  33763. messageSends: ["visitReturnNode:"]
  33764. }),
  33765. globals.ReturnNode);
  33766. smalltalk.addMethod(
  33767. smalltalk.method({
  33768. selector: "isReturnNode",
  33769. protocol: 'testing',
  33770. fn: function (){
  33771. var self=this;
  33772. return true;
  33773. },
  33774. //>>excludeStart("ide", pragmas.excludeIdeData);
  33775. args: [],
  33776. source: "isReturnNode\x0a\x09^ true",
  33777. referencedClasses: [],
  33778. //>>excludeEnd("ide");
  33779. messageSends: []
  33780. }),
  33781. globals.ReturnNode);
  33782. smalltalk.addMethod(
  33783. smalltalk.method({
  33784. selector: "nonLocalReturn",
  33785. protocol: 'testing',
  33786. fn: function (){
  33787. var self=this;
  33788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33789. return smalltalk.withContext(function($ctx1) {
  33790. //>>excludeEnd("ctx");
  33791. var $1;
  33792. $1=_st(_st(self._scope())._isMethodScope())._not();
  33793. return $1;
  33794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33795. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},globals.ReturnNode)});
  33796. //>>excludeEnd("ctx");
  33797. },
  33798. //>>excludeStart("ide", pragmas.excludeIdeData);
  33799. args: [],
  33800. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  33801. referencedClasses: [],
  33802. //>>excludeEnd("ide");
  33803. messageSends: ["not", "isMethodScope", "scope"]
  33804. }),
  33805. globals.ReturnNode);
  33806. smalltalk.addMethod(
  33807. smalltalk.method({
  33808. selector: "scope",
  33809. protocol: 'accessing',
  33810. fn: function (){
  33811. var self=this;
  33812. var $1;
  33813. $1=self["@scope"];
  33814. return $1;
  33815. },
  33816. //>>excludeStart("ide", pragmas.excludeIdeData);
  33817. args: [],
  33818. source: "scope\x0a\x09^ scope",
  33819. referencedClasses: [],
  33820. //>>excludeEnd("ide");
  33821. messageSends: []
  33822. }),
  33823. globals.ReturnNode);
  33824. smalltalk.addMethod(
  33825. smalltalk.method({
  33826. selector: "scope:",
  33827. protocol: 'accessing',
  33828. fn: function (aLexicalScope){
  33829. var self=this;
  33830. self["@scope"]=aLexicalScope;
  33831. return self;
  33832. },
  33833. //>>excludeStart("ide", pragmas.excludeIdeData);
  33834. args: ["aLexicalScope"],
  33835. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33836. referencedClasses: [],
  33837. //>>excludeEnd("ide");
  33838. messageSends: []
  33839. }),
  33840. globals.ReturnNode);
  33841. smalltalk.addClass('SendNode', globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  33842. //>>excludeStart("ide", pragmas.excludeIdeData);
  33843. globals.SendNode.comment="I represent an message send node.";
  33844. //>>excludeEnd("ide");
  33845. smalltalk.addMethod(
  33846. smalltalk.method({
  33847. selector: "accept:",
  33848. protocol: 'visiting',
  33849. fn: function (aVisitor){
  33850. var self=this;
  33851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33852. return smalltalk.withContext(function($ctx1) {
  33853. //>>excludeEnd("ctx");
  33854. var $1;
  33855. $1=_st(aVisitor)._visitSendNode_(self);
  33856. return $1;
  33857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33858. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SendNode)});
  33859. //>>excludeEnd("ctx");
  33860. },
  33861. //>>excludeStart("ide", pragmas.excludeIdeData);
  33862. args: ["aVisitor"],
  33863. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  33864. referencedClasses: [],
  33865. //>>excludeEnd("ide");
  33866. messageSends: ["visitSendNode:"]
  33867. }),
  33868. globals.SendNode);
  33869. smalltalk.addMethod(
  33870. smalltalk.method({
  33871. selector: "arguments",
  33872. protocol: 'accessing',
  33873. fn: function (){
  33874. var self=this;
  33875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33876. return smalltalk.withContext(function($ctx1) {
  33877. //>>excludeEnd("ctx");
  33878. var $2,$1,$receiver;
  33879. $2=self["@arguments"];
  33880. if(($receiver = $2) == null || $receiver.isNil){
  33881. self["@arguments"]=[];
  33882. $1=self["@arguments"];
  33883. } else {
  33884. $1=$2;
  33885. };
  33886. return $1;
  33887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33888. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.SendNode)});
  33889. //>>excludeEnd("ctx");
  33890. },
  33891. //>>excludeStart("ide", pragmas.excludeIdeData);
  33892. args: [],
  33893. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  33894. referencedClasses: [],
  33895. //>>excludeEnd("ide");
  33896. messageSends: ["ifNil:"]
  33897. }),
  33898. globals.SendNode);
  33899. smalltalk.addMethod(
  33900. smalltalk.method({
  33901. selector: "arguments:",
  33902. protocol: 'accessing',
  33903. fn: function (aCollection){
  33904. var self=this;
  33905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33906. return smalltalk.withContext(function($ctx1) {
  33907. //>>excludeEnd("ctx");
  33908. self["@arguments"]=aCollection;
  33909. _st(aCollection)._do_((function(each){
  33910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33911. return smalltalk.withContext(function($ctx2) {
  33912. //>>excludeEnd("ctx");
  33913. return _st(each)._parent_(self);
  33914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33915. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33916. //>>excludeEnd("ctx");
  33917. }));
  33918. return self;
  33919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33920. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.SendNode)});
  33921. //>>excludeEnd("ctx");
  33922. },
  33923. //>>excludeStart("ide", pragmas.excludeIdeData);
  33924. args: ["aCollection"],
  33925. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  33926. referencedClasses: [],
  33927. //>>excludeEnd("ide");
  33928. messageSends: ["do:", "parent:"]
  33929. }),
  33930. globals.SendNode);
  33931. smalltalk.addMethod(
  33932. smalltalk.method({
  33933. selector: "cascadeNodeWithMessages:",
  33934. protocol: 'accessing',
  33935. fn: function (aCollection){
  33936. var self=this;
  33937. var first;
  33938. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33939. function $CascadeNode(){return globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  33940. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  33941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33942. return smalltalk.withContext(function($ctx1) {
  33943. //>>excludeEnd("ctx");
  33944. var $1,$2,$4,$5,$3;
  33945. $1=_st($SendNode())._new();
  33946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33947. $ctx1.sendIdx["new"]=1;
  33948. //>>excludeEnd("ctx");
  33949. _st($1)._selector_(self._selector());
  33950. _st($1)._arguments_(self._arguments());
  33951. $2=_st($1)._yourself();
  33952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33953. $ctx1.sendIdx["yourself"]=1;
  33954. //>>excludeEnd("ctx");
  33955. first=$2;
  33956. $4=_st($CascadeNode())._new();
  33957. _st($4)._receiver_(self._receiver());
  33958. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  33959. $5=_st($4)._yourself();
  33960. $3=$5;
  33961. return $3;
  33962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33963. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},globals.SendNode)});
  33964. //>>excludeEnd("ctx");
  33965. },
  33966. //>>excludeStart("ide", pragmas.excludeIdeData);
  33967. args: ["aCollection"],
  33968. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself",
  33969. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  33970. //>>excludeEnd("ide");
  33971. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  33972. }),
  33973. globals.SendNode);
  33974. smalltalk.addMethod(
  33975. smalltalk.method({
  33976. selector: "index",
  33977. protocol: 'accessing',
  33978. fn: function (){
  33979. var self=this;
  33980. var $1;
  33981. $1=self["@index"];
  33982. return $1;
  33983. },
  33984. //>>excludeStart("ide", pragmas.excludeIdeData);
  33985. args: [],
  33986. source: "index\x0a\x09^ index",
  33987. referencedClasses: [],
  33988. //>>excludeEnd("ide");
  33989. messageSends: []
  33990. }),
  33991. globals.SendNode);
  33992. smalltalk.addMethod(
  33993. smalltalk.method({
  33994. selector: "index:",
  33995. protocol: 'accessing',
  33996. fn: function (anInteger){
  33997. var self=this;
  33998. self["@index"]=anInteger;
  33999. return self;
  34000. },
  34001. //>>excludeStart("ide", pragmas.excludeIdeData);
  34002. args: ["anInteger"],
  34003. source: "index: anInteger\x0a\x09index := anInteger",
  34004. referencedClasses: [],
  34005. //>>excludeEnd("ide");
  34006. messageSends: []
  34007. }),
  34008. globals.SendNode);
  34009. smalltalk.addMethod(
  34010. smalltalk.method({
  34011. selector: "isCascadeSendNode",
  34012. protocol: 'testing',
  34013. fn: function (){
  34014. var self=this;
  34015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34016. return smalltalk.withContext(function($ctx1) {
  34017. //>>excludeEnd("ctx");
  34018. var $1;
  34019. $1=_st(self._parent())._isCascadeNode();
  34020. return $1;
  34021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34022. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},globals.SendNode)});
  34023. //>>excludeEnd("ctx");
  34024. },
  34025. //>>excludeStart("ide", pragmas.excludeIdeData);
  34026. args: [],
  34027. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  34028. referencedClasses: [],
  34029. //>>excludeEnd("ide");
  34030. messageSends: ["isCascadeNode", "parent"]
  34031. }),
  34032. globals.SendNode);
  34033. smalltalk.addMethod(
  34034. smalltalk.method({
  34035. selector: "isNavigationNode",
  34036. protocol: 'testing',
  34037. fn: function (){
  34038. var self=this;
  34039. return true;
  34040. },
  34041. //>>excludeStart("ide", pragmas.excludeIdeData);
  34042. args: [],
  34043. source: "isNavigationNode\x0a\x09^ true",
  34044. referencedClasses: [],
  34045. //>>excludeEnd("ide");
  34046. messageSends: []
  34047. }),
  34048. globals.SendNode);
  34049. smalltalk.addMethod(
  34050. smalltalk.method({
  34051. selector: "isSendNode",
  34052. protocol: 'testing',
  34053. fn: function (){
  34054. var self=this;
  34055. return true;
  34056. },
  34057. //>>excludeStart("ide", pragmas.excludeIdeData);
  34058. args: [],
  34059. source: "isSendNode\x0a\x09^ true",
  34060. referencedClasses: [],
  34061. //>>excludeEnd("ide");
  34062. messageSends: []
  34063. }),
  34064. globals.SendNode);
  34065. smalltalk.addMethod(
  34066. smalltalk.method({
  34067. selector: "navigationLink",
  34068. protocol: 'accessing',
  34069. fn: function (){
  34070. var self=this;
  34071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34072. return smalltalk.withContext(function($ctx1) {
  34073. //>>excludeEnd("ctx");
  34074. var $1;
  34075. $1=self._selector();
  34076. return $1;
  34077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34078. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.SendNode)});
  34079. //>>excludeEnd("ctx");
  34080. },
  34081. //>>excludeStart("ide", pragmas.excludeIdeData);
  34082. args: [],
  34083. source: "navigationLink\x0a\x09^ self selector",
  34084. referencedClasses: [],
  34085. //>>excludeEnd("ide");
  34086. messageSends: ["selector"]
  34087. }),
  34088. globals.SendNode);
  34089. smalltalk.addMethod(
  34090. smalltalk.method({
  34091. selector: "nodes",
  34092. protocol: 'accessing',
  34093. fn: function (){
  34094. var self=this;
  34095. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  34096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34097. return smalltalk.withContext(function($ctx1) {
  34098. //>>excludeEnd("ctx");
  34099. var $1,$3,$2,$5,$6,$4,$receiver;
  34100. $1=self._receiver();
  34101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34102. $ctx1.sendIdx["receiver"]=1;
  34103. //>>excludeEnd("ctx");
  34104. if(($receiver = $1) == null || $receiver.isNil){
  34105. $3=self._arguments();
  34106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34107. $ctx1.sendIdx["arguments"]=1;
  34108. //>>excludeEnd("ctx");
  34109. $2=_st($3)._copy();
  34110. return $2;
  34111. } else {
  34112. $1;
  34113. };
  34114. $5=_st($Array())._with_(self._receiver());
  34115. _st($5)._addAll_(self._arguments());
  34116. $6=_st($5)._yourself();
  34117. $4=$6;
  34118. return $4;
  34119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34120. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.SendNode)});
  34121. //>>excludeEnd("ctx");
  34122. },
  34123. //>>excludeStart("ide", pragmas.excludeIdeData);
  34124. args: [],
  34125. source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  34126. referencedClasses: ["Array"],
  34127. //>>excludeEnd("ide");
  34128. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34129. }),
  34130. globals.SendNode);
  34131. smalltalk.addMethod(
  34132. smalltalk.method({
  34133. selector: "receiver",
  34134. protocol: 'accessing',
  34135. fn: function (){
  34136. var self=this;
  34137. var $1;
  34138. $1=self["@receiver"];
  34139. return $1;
  34140. },
  34141. //>>excludeStart("ide", pragmas.excludeIdeData);
  34142. args: [],
  34143. source: "receiver\x0a\x09^ receiver",
  34144. referencedClasses: [],
  34145. //>>excludeEnd("ide");
  34146. messageSends: []
  34147. }),
  34148. globals.SendNode);
  34149. smalltalk.addMethod(
  34150. smalltalk.method({
  34151. selector: "receiver:",
  34152. protocol: 'accessing',
  34153. fn: function (aNode){
  34154. var self=this;
  34155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34156. return smalltalk.withContext(function($ctx1) {
  34157. //>>excludeEnd("ctx");
  34158. var $1;
  34159. self["@receiver"]=aNode;
  34160. $1=_st(aNode)._isNode();
  34161. if(smalltalk.assert($1)){
  34162. _st(aNode)._parent_(self);
  34163. };
  34164. return self;
  34165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34166. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},globals.SendNode)});
  34167. //>>excludeEnd("ctx");
  34168. },
  34169. //>>excludeStart("ide", pragmas.excludeIdeData);
  34170. args: ["aNode"],
  34171. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  34172. referencedClasses: [],
  34173. //>>excludeEnd("ide");
  34174. messageSends: ["ifTrue:", "isNode", "parent:"]
  34175. }),
  34176. globals.SendNode);
  34177. smalltalk.addMethod(
  34178. smalltalk.method({
  34179. selector: "requiresSmalltalkContext",
  34180. protocol: 'testing',
  34181. fn: function (){
  34182. var self=this;
  34183. return true;
  34184. },
  34185. //>>excludeStart("ide", pragmas.excludeIdeData);
  34186. args: [],
  34187. source: "requiresSmalltalkContext\x0a\x09^ true",
  34188. referencedClasses: [],
  34189. //>>excludeEnd("ide");
  34190. messageSends: []
  34191. }),
  34192. globals.SendNode);
  34193. smalltalk.addMethod(
  34194. smalltalk.method({
  34195. selector: "selector",
  34196. protocol: 'accessing',
  34197. fn: function (){
  34198. var self=this;
  34199. var $1;
  34200. $1=self["@selector"];
  34201. return $1;
  34202. },
  34203. //>>excludeStart("ide", pragmas.excludeIdeData);
  34204. args: [],
  34205. source: "selector\x0a\x09^ selector",
  34206. referencedClasses: [],
  34207. //>>excludeEnd("ide");
  34208. messageSends: []
  34209. }),
  34210. globals.SendNode);
  34211. smalltalk.addMethod(
  34212. smalltalk.method({
  34213. selector: "selector:",
  34214. protocol: 'accessing',
  34215. fn: function (aString){
  34216. var self=this;
  34217. self["@selector"]=aString;
  34218. return self;
  34219. },
  34220. //>>excludeStart("ide", pragmas.excludeIdeData);
  34221. args: ["aString"],
  34222. source: "selector: aString\x0a\x09selector := aString",
  34223. referencedClasses: [],
  34224. //>>excludeEnd("ide");
  34225. messageSends: []
  34226. }),
  34227. globals.SendNode);
  34228. smalltalk.addMethod(
  34229. smalltalk.method({
  34230. selector: "shouldBeAliased",
  34231. protocol: 'testing',
  34232. fn: function (){
  34233. var self=this;
  34234. var sends;
  34235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34236. return smalltalk.withContext(function($ctx1) {
  34237. //>>excludeEnd("ctx");
  34238. var $2,$1;
  34239. sends=_st(_st(_st(self._method())._sendIndexes())._at_(self._selector()))._size();
  34240. $2=(
  34241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34242. $ctx1.supercall = true,
  34243. //>>excludeEnd("ctx");
  34244. globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
  34245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34246. $ctx1.supercall = false;
  34247. //>>excludeEnd("ctx");;
  34248. $1=_st($2)._or_((function(){
  34249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34250. return smalltalk.withContext(function($ctx2) {
  34251. //>>excludeEnd("ctx");
  34252. return _st(self._isReferenced())._and_((function(){
  34253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34254. return smalltalk.withContext(function($ctx3) {
  34255. //>>excludeEnd("ctx");
  34256. return _st(_st(_st(sends).__gt((1)))._and_((function(){
  34257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34258. return smalltalk.withContext(function($ctx4) {
  34259. //>>excludeEnd("ctx");
  34260. return _st(self._index()).__lt(sends);
  34261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34262. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  34263. //>>excludeEnd("ctx");
  34264. })))._or_((function(){
  34265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34266. return smalltalk.withContext(function($ctx4) {
  34267. //>>excludeEnd("ctx");
  34268. return self._superSend();
  34269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34270. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  34271. //>>excludeEnd("ctx");
  34272. }));
  34273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34274. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34275. //>>excludeEnd("ctx");
  34276. }));
  34277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34278. $ctx2.sendIdx["and:"]=1;
  34279. //>>excludeEnd("ctx");
  34280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34282. //>>excludeEnd("ctx");
  34283. }));
  34284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34285. $ctx1.sendIdx["or:"]=1;
  34286. //>>excludeEnd("ctx");
  34287. return $1;
  34288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34289. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},globals.SendNode)});
  34290. //>>excludeEnd("ctx");
  34291. },
  34292. //>>excludeStart("ide", pragmas.excludeIdeData);
  34293. args: [],
  34294. source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])",
  34295. referencedClasses: [],
  34296. //>>excludeEnd("ide");
  34297. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  34298. }),
  34299. globals.SendNode);
  34300. smalltalk.addMethod(
  34301. smalltalk.method({
  34302. selector: "stopOnStepping",
  34303. protocol: 'testing',
  34304. fn: function (){
  34305. var self=this;
  34306. return true;
  34307. },
  34308. //>>excludeStart("ide", pragmas.excludeIdeData);
  34309. args: [],
  34310. source: "stopOnStepping\x0a\x09^ true",
  34311. referencedClasses: [],
  34312. //>>excludeEnd("ide");
  34313. messageSends: []
  34314. }),
  34315. globals.SendNode);
  34316. smalltalk.addMethod(
  34317. smalltalk.method({
  34318. selector: "superSend",
  34319. protocol: 'accessing',
  34320. fn: function (){
  34321. var self=this;
  34322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34323. return smalltalk.withContext(function($ctx1) {
  34324. //>>excludeEnd("ctx");
  34325. var $2,$1,$receiver;
  34326. $2=self["@superSend"];
  34327. if(($receiver = $2) == null || $receiver.isNil){
  34328. $1=false;
  34329. } else {
  34330. $1=$2;
  34331. };
  34332. return $1;
  34333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34334. }, function($ctx1) {$ctx1.fill(self,"superSend",{},globals.SendNode)});
  34335. //>>excludeEnd("ctx");
  34336. },
  34337. //>>excludeStart("ide", pragmas.excludeIdeData);
  34338. args: [],
  34339. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  34340. referencedClasses: [],
  34341. //>>excludeEnd("ide");
  34342. messageSends: ["ifNil:"]
  34343. }),
  34344. globals.SendNode);
  34345. smalltalk.addMethod(
  34346. smalltalk.method({
  34347. selector: "superSend:",
  34348. protocol: 'accessing',
  34349. fn: function (aBoolean){
  34350. var self=this;
  34351. self["@superSend"]=aBoolean;
  34352. return self;
  34353. },
  34354. //>>excludeStart("ide", pragmas.excludeIdeData);
  34355. args: ["aBoolean"],
  34356. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  34357. referencedClasses: [],
  34358. //>>excludeEnd("ide");
  34359. messageSends: []
  34360. }),
  34361. globals.SendNode);
  34362. smalltalk.addMethod(
  34363. smalltalk.method({
  34364. selector: "valueForReceiver:",
  34365. protocol: 'accessing',
  34366. fn: function (anObject){
  34367. var self=this;
  34368. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  34369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34370. return smalltalk.withContext(function($ctx1) {
  34371. //>>excludeEnd("ctx");
  34372. var $2,$3,$5,$4,$6,$1,$receiver;
  34373. $2=_st($SendNode())._new();
  34374. _st($2)._position_(self._position());
  34375. _st($2)._source_(self._source());
  34376. $3=$2;
  34377. $5=self._receiver();
  34378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34379. $ctx1.sendIdx["receiver"]=1;
  34380. //>>excludeEnd("ctx");
  34381. if(($receiver = $5) == null || $receiver.isNil){
  34382. $4=anObject;
  34383. } else {
  34384. $4=_st(self._receiver())._valueForReceiver_(anObject);
  34385. };
  34386. _st($3)._receiver_($4);
  34387. _st($2)._selector_(self._selector());
  34388. _st($2)._arguments_(self._arguments());
  34389. $6=_st($2)._yourself();
  34390. $1=$6;
  34391. return $1;
  34392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34393. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},globals.SendNode)});
  34394. //>>excludeEnd("ctx");
  34395. },
  34396. //>>excludeStart("ide", pragmas.excludeIdeData);
  34397. args: ["anObject"],
  34398. source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself",
  34399. referencedClasses: ["SendNode"],
  34400. //>>excludeEnd("ide");
  34401. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  34402. }),
  34403. globals.SendNode);
  34404. smalltalk.addClass('SequenceNode', globals.Node, ['temps', 'scope'], 'Compiler-AST');
  34405. //>>excludeStart("ide", pragmas.excludeIdeData);
  34406. globals.SequenceNode.comment="I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope).";
  34407. //>>excludeEnd("ide");
  34408. smalltalk.addMethod(
  34409. smalltalk.method({
  34410. selector: "accept:",
  34411. protocol: 'visiting',
  34412. fn: function (aVisitor){
  34413. var self=this;
  34414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34415. return smalltalk.withContext(function($ctx1) {
  34416. //>>excludeEnd("ctx");
  34417. var $1;
  34418. $1=_st(aVisitor)._visitSequenceNode_(self);
  34419. return $1;
  34420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34421. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SequenceNode)});
  34422. //>>excludeEnd("ctx");
  34423. },
  34424. //>>excludeStart("ide", pragmas.excludeIdeData);
  34425. args: ["aVisitor"],
  34426. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34427. referencedClasses: [],
  34428. //>>excludeEnd("ide");
  34429. messageSends: ["visitSequenceNode:"]
  34430. }),
  34431. globals.SequenceNode);
  34432. smalltalk.addMethod(
  34433. smalltalk.method({
  34434. selector: "asBlockSequenceNode",
  34435. protocol: 'converting',
  34436. fn: function (){
  34437. var self=this;
  34438. function $BlockSequenceNode(){return globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  34439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34440. return smalltalk.withContext(function($ctx1) {
  34441. //>>excludeEnd("ctx");
  34442. var $2,$3,$1;
  34443. $2=_st($BlockSequenceNode())._new();
  34444. _st($2)._position_(self._position());
  34445. _st($2)._source_(self._source());
  34446. _st($2)._nodes_(self._nodes());
  34447. _st($2)._temps_(self._temps());
  34448. $3=_st($2)._yourself();
  34449. $1=$3;
  34450. return $1;
  34451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34452. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},globals.SequenceNode)});
  34453. //>>excludeEnd("ctx");
  34454. },
  34455. //>>excludeStart("ide", pragmas.excludeIdeData);
  34456. args: [],
  34457. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  34458. referencedClasses: ["BlockSequenceNode"],
  34459. //>>excludeEnd("ide");
  34460. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  34461. }),
  34462. globals.SequenceNode);
  34463. smalltalk.addMethod(
  34464. smalltalk.method({
  34465. selector: "isSequenceNode",
  34466. protocol: 'testing',
  34467. fn: function (){
  34468. var self=this;
  34469. return true;
  34470. },
  34471. //>>excludeStart("ide", pragmas.excludeIdeData);
  34472. args: [],
  34473. source: "isSequenceNode\x0a\x09^ true",
  34474. referencedClasses: [],
  34475. //>>excludeEnd("ide");
  34476. messageSends: []
  34477. }),
  34478. globals.SequenceNode);
  34479. smalltalk.addMethod(
  34480. smalltalk.method({
  34481. selector: "scope",
  34482. protocol: 'accessing',
  34483. fn: function (){
  34484. var self=this;
  34485. var $1;
  34486. $1=self["@scope"];
  34487. return $1;
  34488. },
  34489. //>>excludeStart("ide", pragmas.excludeIdeData);
  34490. args: [],
  34491. source: "scope\x0a\x09^ scope",
  34492. referencedClasses: [],
  34493. //>>excludeEnd("ide");
  34494. messageSends: []
  34495. }),
  34496. globals.SequenceNode);
  34497. smalltalk.addMethod(
  34498. smalltalk.method({
  34499. selector: "scope:",
  34500. protocol: 'accessing',
  34501. fn: function (aLexicalScope){
  34502. var self=this;
  34503. self["@scope"]=aLexicalScope;
  34504. return self;
  34505. },
  34506. //>>excludeStart("ide", pragmas.excludeIdeData);
  34507. args: ["aLexicalScope"],
  34508. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34509. referencedClasses: [],
  34510. //>>excludeEnd("ide");
  34511. messageSends: []
  34512. }),
  34513. globals.SequenceNode);
  34514. smalltalk.addMethod(
  34515. smalltalk.method({
  34516. selector: "temps",
  34517. protocol: 'accessing',
  34518. fn: function (){
  34519. var self=this;
  34520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34521. return smalltalk.withContext(function($ctx1) {
  34522. //>>excludeEnd("ctx");
  34523. var $2,$1,$receiver;
  34524. $2=self["@temps"];
  34525. if(($receiver = $2) == null || $receiver.isNil){
  34526. $1=[];
  34527. } else {
  34528. $1=$2;
  34529. };
  34530. return $1;
  34531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34532. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.SequenceNode)});
  34533. //>>excludeEnd("ctx");
  34534. },
  34535. //>>excludeStart("ide", pragmas.excludeIdeData);
  34536. args: [],
  34537. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34538. referencedClasses: [],
  34539. //>>excludeEnd("ide");
  34540. messageSends: ["ifNil:"]
  34541. }),
  34542. globals.SequenceNode);
  34543. smalltalk.addMethod(
  34544. smalltalk.method({
  34545. selector: "temps:",
  34546. protocol: 'accessing',
  34547. fn: function (aCollection){
  34548. var self=this;
  34549. self["@temps"]=aCollection;
  34550. return self;
  34551. },
  34552. //>>excludeStart("ide", pragmas.excludeIdeData);
  34553. args: ["aCollection"],
  34554. source: "temps: aCollection\x0a\x09temps := aCollection",
  34555. referencedClasses: [],
  34556. //>>excludeEnd("ide");
  34557. messageSends: []
  34558. }),
  34559. globals.SequenceNode);
  34560. smalltalk.addClass('BlockSequenceNode', globals.SequenceNode, [], 'Compiler-AST');
  34561. //>>excludeStart("ide", pragmas.excludeIdeData);
  34562. globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34563. //>>excludeEnd("ide");
  34564. smalltalk.addMethod(
  34565. smalltalk.method({
  34566. selector: "accept:",
  34567. protocol: 'visiting',
  34568. fn: function (aVisitor){
  34569. var self=this;
  34570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34571. return smalltalk.withContext(function($ctx1) {
  34572. //>>excludeEnd("ctx");
  34573. var $1;
  34574. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  34575. return $1;
  34576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34577. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockSequenceNode)});
  34578. //>>excludeEnd("ctx");
  34579. },
  34580. //>>excludeStart("ide", pragmas.excludeIdeData);
  34581. args: ["aVisitor"],
  34582. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  34583. referencedClasses: [],
  34584. //>>excludeEnd("ide");
  34585. messageSends: ["visitBlockSequenceNode:"]
  34586. }),
  34587. globals.BlockSequenceNode);
  34588. smalltalk.addMethod(
  34589. smalltalk.method({
  34590. selector: "isBlockSequenceNode",
  34591. protocol: 'testing',
  34592. fn: function (){
  34593. var self=this;
  34594. return true;
  34595. },
  34596. //>>excludeStart("ide", pragmas.excludeIdeData);
  34597. args: [],
  34598. source: "isBlockSequenceNode\x0a\x09^ true",
  34599. referencedClasses: [],
  34600. //>>excludeEnd("ide");
  34601. messageSends: []
  34602. }),
  34603. globals.BlockSequenceNode);
  34604. smalltalk.addClass('ValueNode', globals.Node, ['value'], 'Compiler-AST');
  34605. //>>excludeStart("ide", pragmas.excludeIdeData);
  34606. globals.ValueNode.comment="I represent a value node.";
  34607. //>>excludeEnd("ide");
  34608. smalltalk.addMethod(
  34609. smalltalk.method({
  34610. selector: "accept:",
  34611. protocol: 'visiting',
  34612. fn: function (aVisitor){
  34613. var self=this;
  34614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34615. return smalltalk.withContext(function($ctx1) {
  34616. //>>excludeEnd("ctx");
  34617. var $1;
  34618. $1=_st(aVisitor)._visitValueNode_(self);
  34619. return $1;
  34620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34621. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ValueNode)});
  34622. //>>excludeEnd("ctx");
  34623. },
  34624. //>>excludeStart("ide", pragmas.excludeIdeData);
  34625. args: ["aVisitor"],
  34626. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  34627. referencedClasses: [],
  34628. //>>excludeEnd("ide");
  34629. messageSends: ["visitValueNode:"]
  34630. }),
  34631. globals.ValueNode);
  34632. smalltalk.addMethod(
  34633. smalltalk.method({
  34634. selector: "isImmutable",
  34635. protocol: 'testing',
  34636. fn: function (){
  34637. var self=this;
  34638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34639. return smalltalk.withContext(function($ctx1) {
  34640. //>>excludeEnd("ctx");
  34641. var $1;
  34642. $1=_st(self._value())._isImmutable();
  34643. return $1;
  34644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34645. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.ValueNode)});
  34646. //>>excludeEnd("ctx");
  34647. },
  34648. //>>excludeStart("ide", pragmas.excludeIdeData);
  34649. args: [],
  34650. source: "isImmutable\x0a\x09^ self value isImmutable",
  34651. referencedClasses: [],
  34652. //>>excludeEnd("ide");
  34653. messageSends: ["isImmutable", "value"]
  34654. }),
  34655. globals.ValueNode);
  34656. smalltalk.addMethod(
  34657. smalltalk.method({
  34658. selector: "isValueNode",
  34659. protocol: 'testing',
  34660. fn: function (){
  34661. var self=this;
  34662. return true;
  34663. },
  34664. //>>excludeStart("ide", pragmas.excludeIdeData);
  34665. args: [],
  34666. source: "isValueNode\x0a\x09^ true",
  34667. referencedClasses: [],
  34668. //>>excludeEnd("ide");
  34669. messageSends: []
  34670. }),
  34671. globals.ValueNode);
  34672. smalltalk.addMethod(
  34673. smalltalk.method({
  34674. selector: "value",
  34675. protocol: 'accessing',
  34676. fn: function (){
  34677. var self=this;
  34678. var $1;
  34679. $1=self["@value"];
  34680. return $1;
  34681. },
  34682. //>>excludeStart("ide", pragmas.excludeIdeData);
  34683. args: [],
  34684. source: "value\x0a\x09^ value",
  34685. referencedClasses: [],
  34686. //>>excludeEnd("ide");
  34687. messageSends: []
  34688. }),
  34689. globals.ValueNode);
  34690. smalltalk.addMethod(
  34691. smalltalk.method({
  34692. selector: "value:",
  34693. protocol: 'accessing',
  34694. fn: function (anObject){
  34695. var self=this;
  34696. self["@value"]=anObject;
  34697. return self;
  34698. },
  34699. //>>excludeStart("ide", pragmas.excludeIdeData);
  34700. args: ["anObject"],
  34701. source: "value: anObject\x0a\x09value := anObject",
  34702. referencedClasses: [],
  34703. //>>excludeEnd("ide");
  34704. messageSends: []
  34705. }),
  34706. globals.ValueNode);
  34707. smalltalk.addClass('VariableNode', globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  34708. //>>excludeStart("ide", pragmas.excludeIdeData);
  34709. globals.VariableNode.comment="I represent an variable node.";
  34710. //>>excludeEnd("ide");
  34711. smalltalk.addMethod(
  34712. smalltalk.method({
  34713. selector: "accept:",
  34714. protocol: 'visiting',
  34715. fn: function (aVisitor){
  34716. var self=this;
  34717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34718. return smalltalk.withContext(function($ctx1) {
  34719. //>>excludeEnd("ctx");
  34720. var $1;
  34721. $1=_st(aVisitor)._visitVariableNode_(self);
  34722. return $1;
  34723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34724. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.VariableNode)});
  34725. //>>excludeEnd("ctx");
  34726. },
  34727. //>>excludeStart("ide", pragmas.excludeIdeData);
  34728. args: ["aVisitor"],
  34729. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  34730. referencedClasses: [],
  34731. //>>excludeEnd("ide");
  34732. messageSends: ["visitVariableNode:"]
  34733. }),
  34734. globals.VariableNode);
  34735. smalltalk.addMethod(
  34736. smalltalk.method({
  34737. selector: "alias",
  34738. protocol: 'accessing',
  34739. fn: function (){
  34740. var self=this;
  34741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34742. return smalltalk.withContext(function($ctx1) {
  34743. //>>excludeEnd("ctx");
  34744. var $1;
  34745. $1=_st(self._binding())._alias();
  34746. return $1;
  34747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34748. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.VariableNode)});
  34749. //>>excludeEnd("ctx");
  34750. },
  34751. //>>excludeStart("ide", pragmas.excludeIdeData);
  34752. args: [],
  34753. source: "alias\x0a\x09^ self binding alias",
  34754. referencedClasses: [],
  34755. //>>excludeEnd("ide");
  34756. messageSends: ["alias", "binding"]
  34757. }),
  34758. globals.VariableNode);
  34759. smalltalk.addMethod(
  34760. smalltalk.method({
  34761. selector: "assigned",
  34762. protocol: 'accessing',
  34763. fn: function (){
  34764. var self=this;
  34765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34766. return smalltalk.withContext(function($ctx1) {
  34767. //>>excludeEnd("ctx");
  34768. var $2,$1,$receiver;
  34769. $2=self["@assigned"];
  34770. if(($receiver = $2) == null || $receiver.isNil){
  34771. $1=false;
  34772. } else {
  34773. $1=$2;
  34774. };
  34775. return $1;
  34776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34777. }, function($ctx1) {$ctx1.fill(self,"assigned",{},globals.VariableNode)});
  34778. //>>excludeEnd("ctx");
  34779. },
  34780. //>>excludeStart("ide", pragmas.excludeIdeData);
  34781. args: [],
  34782. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  34783. referencedClasses: [],
  34784. //>>excludeEnd("ide");
  34785. messageSends: ["ifNil:"]
  34786. }),
  34787. globals.VariableNode);
  34788. smalltalk.addMethod(
  34789. smalltalk.method({
  34790. selector: "assigned:",
  34791. protocol: 'accessing',
  34792. fn: function (aBoolean){
  34793. var self=this;
  34794. self["@assigned"]=aBoolean;
  34795. return self;
  34796. },
  34797. //>>excludeStart("ide", pragmas.excludeIdeData);
  34798. args: ["aBoolean"],
  34799. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  34800. referencedClasses: [],
  34801. //>>excludeEnd("ide");
  34802. messageSends: []
  34803. }),
  34804. globals.VariableNode);
  34805. smalltalk.addMethod(
  34806. smalltalk.method({
  34807. selector: "beAssigned",
  34808. protocol: 'accessing',
  34809. fn: function (){
  34810. var self=this;
  34811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34812. return smalltalk.withContext(function($ctx1) {
  34813. //>>excludeEnd("ctx");
  34814. _st(self._binding())._validateAssignment();
  34815. self["@assigned"]=true;
  34816. return self;
  34817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34818. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},globals.VariableNode)});
  34819. //>>excludeEnd("ctx");
  34820. },
  34821. //>>excludeStart("ide", pragmas.excludeIdeData);
  34822. args: [],
  34823. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  34824. referencedClasses: [],
  34825. //>>excludeEnd("ide");
  34826. messageSends: ["validateAssignment", "binding"]
  34827. }),
  34828. globals.VariableNode);
  34829. smalltalk.addMethod(
  34830. smalltalk.method({
  34831. selector: "binding",
  34832. protocol: 'accessing',
  34833. fn: function (){
  34834. var self=this;
  34835. var $1;
  34836. $1=self["@binding"];
  34837. return $1;
  34838. },
  34839. //>>excludeStart("ide", pragmas.excludeIdeData);
  34840. args: [],
  34841. source: "binding\x0a\x09^ binding",
  34842. referencedClasses: [],
  34843. //>>excludeEnd("ide");
  34844. messageSends: []
  34845. }),
  34846. globals.VariableNode);
  34847. smalltalk.addMethod(
  34848. smalltalk.method({
  34849. selector: "binding:",
  34850. protocol: 'accessing',
  34851. fn: function (aScopeVar){
  34852. var self=this;
  34853. self["@binding"]=aScopeVar;
  34854. return self;
  34855. },
  34856. //>>excludeStart("ide", pragmas.excludeIdeData);
  34857. args: ["aScopeVar"],
  34858. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  34859. referencedClasses: [],
  34860. //>>excludeEnd("ide");
  34861. messageSends: []
  34862. }),
  34863. globals.VariableNode);
  34864. smalltalk.addMethod(
  34865. smalltalk.method({
  34866. selector: "isArgument",
  34867. protocol: 'testing',
  34868. fn: function (){
  34869. var self=this;
  34870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34871. return smalltalk.withContext(function($ctx1) {
  34872. //>>excludeEnd("ctx");
  34873. var $1;
  34874. $1=_st(self._binding())._isArgVar();
  34875. return $1;
  34876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34877. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},globals.VariableNode)});
  34878. //>>excludeEnd("ctx");
  34879. },
  34880. //>>excludeStart("ide", pragmas.excludeIdeData);
  34881. args: [],
  34882. source: "isArgument\x0a\x09^ self binding isArgVar",
  34883. referencedClasses: [],
  34884. //>>excludeEnd("ide");
  34885. messageSends: ["isArgVar", "binding"]
  34886. }),
  34887. globals.VariableNode);
  34888. smalltalk.addMethod(
  34889. smalltalk.method({
  34890. selector: "isImmutable",
  34891. protocol: 'testing',
  34892. fn: function (){
  34893. var self=this;
  34894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34895. return smalltalk.withContext(function($ctx1) {
  34896. //>>excludeEnd("ctx");
  34897. var $1;
  34898. $1=_st(self._binding())._isImmutable();
  34899. return $1;
  34900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34901. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.VariableNode)});
  34902. //>>excludeEnd("ctx");
  34903. },
  34904. //>>excludeStart("ide", pragmas.excludeIdeData);
  34905. args: [],
  34906. source: "isImmutable\x0a\x09^ self binding isImmutable",
  34907. referencedClasses: [],
  34908. //>>excludeEnd("ide");
  34909. messageSends: ["isImmutable", "binding"]
  34910. }),
  34911. globals.VariableNode);
  34912. smalltalk.addMethod(
  34913. smalltalk.method({
  34914. selector: "isNavigationNode",
  34915. protocol: 'testing',
  34916. fn: function (){
  34917. var self=this;
  34918. return true;
  34919. },
  34920. //>>excludeStart("ide", pragmas.excludeIdeData);
  34921. args: [],
  34922. source: "isNavigationNode\x0a\x09^ true",
  34923. referencedClasses: [],
  34924. //>>excludeEnd("ide");
  34925. messageSends: []
  34926. }),
  34927. globals.VariableNode);
  34928. smalltalk.addMethod(
  34929. smalltalk.method({
  34930. selector: "isVariableNode",
  34931. protocol: 'testing',
  34932. fn: function (){
  34933. var self=this;
  34934. return true;
  34935. },
  34936. //>>excludeStart("ide", pragmas.excludeIdeData);
  34937. args: [],
  34938. source: "isVariableNode\x0a\x09^ true",
  34939. referencedClasses: [],
  34940. //>>excludeEnd("ide");
  34941. messageSends: []
  34942. }),
  34943. globals.VariableNode);
  34944. smalltalk.addMethod(
  34945. smalltalk.method({
  34946. selector: "navigationLink",
  34947. protocol: 'accessing',
  34948. fn: function (){
  34949. var self=this;
  34950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34951. return smalltalk.withContext(function($ctx1) {
  34952. //>>excludeEnd("ctx");
  34953. var $1;
  34954. $1=self._value();
  34955. return $1;
  34956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34957. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.VariableNode)});
  34958. //>>excludeEnd("ctx");
  34959. },
  34960. //>>excludeStart("ide", pragmas.excludeIdeData);
  34961. args: [],
  34962. source: "navigationLink\x0a\x09^ self value",
  34963. referencedClasses: [],
  34964. //>>excludeEnd("ide");
  34965. messageSends: ["value"]
  34966. }),
  34967. globals.VariableNode);
  34968. smalltalk.addMethod(
  34969. smalltalk.method({
  34970. selector: "ast",
  34971. protocol: '*Compiler-AST',
  34972. fn: function (){
  34973. var self=this;
  34974. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  34975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34976. return smalltalk.withContext(function($ctx1) {
  34977. //>>excludeEnd("ctx");
  34978. var $1,$2;
  34979. $1=self._source();
  34980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34981. $ctx1.sendIdx["source"]=1;
  34982. //>>excludeEnd("ctx");
  34983. _st($1)._ifEmpty_((function(){
  34984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34985. return smalltalk.withContext(function($ctx2) {
  34986. //>>excludeEnd("ctx");
  34987. return self._error_("Method source is empty");
  34988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34990. //>>excludeEnd("ctx");
  34991. }));
  34992. $2=_st($Smalltalk())._parse_(self._source());
  34993. return $2;
  34994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34995. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.CompiledMethod)});
  34996. //>>excludeEnd("ctx");
  34997. },
  34998. //>>excludeStart("ide", pragmas.excludeIdeData);
  34999. args: [],
  35000. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  35001. referencedClasses: ["Smalltalk"],
  35002. //>>excludeEnd("ide");
  35003. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  35004. }),
  35005. globals.CompiledMethod);
  35006. smalltalk.addMethod(
  35007. smalltalk.method({
  35008. selector: "isNode",
  35009. protocol: '*Compiler-AST',
  35010. fn: function (){
  35011. var self=this;
  35012. return false;
  35013. },
  35014. //>>excludeStart("ide", pragmas.excludeIdeData);
  35015. args: [],
  35016. source: "isNode\x0a\x09^ false",
  35017. referencedClasses: [],
  35018. //>>excludeEnd("ide");
  35019. messageSends: []
  35020. }),
  35021. globals.Object);
  35022. });
  35023. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  35024. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  35025. smalltalk.addPackage('Compiler-IR');
  35026. smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35027. smalltalk.addClass('IRASTTranslator', globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35028. //>>excludeStart("ide", pragmas.excludeIdeData);
  35029. globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35030. //>>excludeEnd("ide");
  35031. smalltalk.addMethod(
  35032. smalltalk.method({
  35033. selector: "alias:",
  35034. protocol: 'visiting',
  35035. fn: function (aNode){
  35036. var self=this;
  35037. var variable;
  35038. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  35039. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  35040. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  35041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35042. return smalltalk.withContext(function($ctx1) {
  35043. //>>excludeEnd("ctx");
  35044. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  35045. $1=_st(aNode)._isImmutable();
  35046. if(smalltalk.assert($1)){
  35047. $2=self._visit_(aNode);
  35048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35049. $ctx1.sendIdx["visit:"]=1;
  35050. //>>excludeEnd("ctx");
  35051. return $2;
  35052. };
  35053. $3=_st($IRVariable())._new();
  35054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35055. $ctx1.sendIdx["new"]=1;
  35056. //>>excludeEnd("ctx");
  35057. $4=$3;
  35058. $6=_st($AliasVar())._new();
  35059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35060. $ctx1.sendIdx["new"]=2;
  35061. //>>excludeEnd("ctx");
  35062. $5=_st($6)._name_("$".__comma(self._nextAlias()));
  35063. _st($4)._variable_($5);
  35064. $7=_st($3)._yourself();
  35065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35066. $ctx1.sendIdx["yourself"]=1;
  35067. //>>excludeEnd("ctx");
  35068. variable=$7;
  35069. $8=self._sequence();
  35070. $10=_st($IRAssignment())._new();
  35071. _st($10)._add_(variable);
  35072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35073. $ctx1.sendIdx["add:"]=2;
  35074. //>>excludeEnd("ctx");
  35075. _st($10)._add_(self._visit_(aNode));
  35076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35077. $ctx1.sendIdx["add:"]=3;
  35078. //>>excludeEnd("ctx");
  35079. $11=_st($10)._yourself();
  35080. $9=$11;
  35081. _st($8)._add_($9);
  35082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35083. $ctx1.sendIdx["add:"]=1;
  35084. //>>excludeEnd("ctx");
  35085. _st(_st(self._method())._internalVariables())._add_(variable);
  35086. $12=variable;
  35087. return $12;
  35088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35089. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},globals.IRASTTranslator)});
  35090. //>>excludeEnd("ctx");
  35091. },
  35092. //>>excludeStart("ide", pragmas.excludeIdeData);
  35093. args: ["aNode"],
  35094. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  35095. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  35096. //>>excludeEnd("ide");
  35097. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  35098. }),
  35099. globals.IRASTTranslator);
  35100. smalltalk.addMethod(
  35101. smalltalk.method({
  35102. selector: "aliasTemporally:",
  35103. protocol: 'visiting',
  35104. fn: function (aCollection){
  35105. var self=this;
  35106. var threshold,result;
  35107. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  35108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35109. return smalltalk.withContext(function($ctx1) {
  35110. //>>excludeEnd("ctx");
  35111. var $1,$2,$4,$3,$5;
  35112. threshold=(0);
  35113. _st(aCollection)._withIndexDo_((function(each,i){
  35114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35115. return smalltalk.withContext(function($ctx2) {
  35116. //>>excludeEnd("ctx");
  35117. $1=_st(each)._subtreeNeedsAliasing();
  35118. if(smalltalk.assert($1)){
  35119. threshold=i;
  35120. return threshold;
  35121. };
  35122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35123. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  35124. //>>excludeEnd("ctx");
  35125. }));
  35126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35127. $ctx1.sendIdx["withIndexDo:"]=1;
  35128. //>>excludeEnd("ctx");
  35129. result=_st($OrderedCollection())._new();
  35130. _st(aCollection)._withIndexDo_((function(each,i){
  35131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35132. return smalltalk.withContext(function($ctx2) {
  35133. //>>excludeEnd("ctx");
  35134. $2=result;
  35135. $4=_st(i).__lt_eq(threshold);
  35136. if(smalltalk.assert($4)){
  35137. $3=self._alias_(each);
  35138. } else {
  35139. $3=self._visit_(each);
  35140. };
  35141. return _st($2)._add_($3);
  35142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35143. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  35144. //>>excludeEnd("ctx");
  35145. }));
  35146. $5=result;
  35147. return $5;
  35148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35149. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},globals.IRASTTranslator)});
  35150. //>>excludeEnd("ctx");
  35151. },
  35152. //>>excludeStart("ide", pragmas.excludeIdeData);
  35153. args: ["aCollection"],
  35154. source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result",
  35155. referencedClasses: ["OrderedCollection"],
  35156. //>>excludeEnd("ide");
  35157. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  35158. }),
  35159. globals.IRASTTranslator);
  35160. smalltalk.addMethod(
  35161. smalltalk.method({
  35162. selector: "method",
  35163. protocol: 'accessing',
  35164. fn: function (){
  35165. var self=this;
  35166. var $1;
  35167. $1=self["@method"];
  35168. return $1;
  35169. },
  35170. //>>excludeStart("ide", pragmas.excludeIdeData);
  35171. args: [],
  35172. source: "method\x0a\x09^ method",
  35173. referencedClasses: [],
  35174. //>>excludeEnd("ide");
  35175. messageSends: []
  35176. }),
  35177. globals.IRASTTranslator);
  35178. smalltalk.addMethod(
  35179. smalltalk.method({
  35180. selector: "method:",
  35181. protocol: 'accessing',
  35182. fn: function (anIRMethod){
  35183. var self=this;
  35184. self["@method"]=anIRMethod;
  35185. return self;
  35186. },
  35187. //>>excludeStart("ide", pragmas.excludeIdeData);
  35188. args: ["anIRMethod"],
  35189. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  35190. referencedClasses: [],
  35191. //>>excludeEnd("ide");
  35192. messageSends: []
  35193. }),
  35194. globals.IRASTTranslator);
  35195. smalltalk.addMethod(
  35196. smalltalk.method({
  35197. selector: "nextAlias",
  35198. protocol: 'accessing',
  35199. fn: function (){
  35200. var self=this;
  35201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35202. return smalltalk.withContext(function($ctx1) {
  35203. //>>excludeEnd("ctx");
  35204. var $1,$2,$receiver;
  35205. $1=self["@nextAlias"];
  35206. if(($receiver = $1) == null || $receiver.isNil){
  35207. self["@nextAlias"]=(0);
  35208. self["@nextAlias"];
  35209. } else {
  35210. $1;
  35211. };
  35212. self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
  35213. $2=_st(self["@nextAlias"])._asString();
  35214. return $2;
  35215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35216. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},globals.IRASTTranslator)});
  35217. //>>excludeEnd("ctx");
  35218. },
  35219. //>>excludeStart("ide", pragmas.excludeIdeData);
  35220. args: [],
  35221. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  35222. referencedClasses: [],
  35223. //>>excludeEnd("ide");
  35224. messageSends: ["ifNil:", "+", "asString"]
  35225. }),
  35226. globals.IRASTTranslator);
  35227. smalltalk.addMethod(
  35228. smalltalk.method({
  35229. selector: "sequence",
  35230. protocol: 'accessing',
  35231. fn: function (){
  35232. var self=this;
  35233. var $1;
  35234. $1=self["@sequence"];
  35235. return $1;
  35236. },
  35237. //>>excludeStart("ide", pragmas.excludeIdeData);
  35238. args: [],
  35239. source: "sequence\x0a\x09^ sequence",
  35240. referencedClasses: [],
  35241. //>>excludeEnd("ide");
  35242. messageSends: []
  35243. }),
  35244. globals.IRASTTranslator);
  35245. smalltalk.addMethod(
  35246. smalltalk.method({
  35247. selector: "sequence:",
  35248. protocol: 'accessing',
  35249. fn: function (anIRSequence){
  35250. var self=this;
  35251. self["@sequence"]=anIRSequence;
  35252. return self;
  35253. },
  35254. //>>excludeStart("ide", pragmas.excludeIdeData);
  35255. args: ["anIRSequence"],
  35256. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  35257. referencedClasses: [],
  35258. //>>excludeEnd("ide");
  35259. messageSends: []
  35260. }),
  35261. globals.IRASTTranslator);
  35262. smalltalk.addMethod(
  35263. smalltalk.method({
  35264. selector: "source",
  35265. protocol: 'accessing',
  35266. fn: function (){
  35267. var self=this;
  35268. var $1;
  35269. $1=self["@source"];
  35270. return $1;
  35271. },
  35272. //>>excludeStart("ide", pragmas.excludeIdeData);
  35273. args: [],
  35274. source: "source\x0a\x09^ source",
  35275. referencedClasses: [],
  35276. //>>excludeEnd("ide");
  35277. messageSends: []
  35278. }),
  35279. globals.IRASTTranslator);
  35280. smalltalk.addMethod(
  35281. smalltalk.method({
  35282. selector: "source:",
  35283. protocol: 'accessing',
  35284. fn: function (aString){
  35285. var self=this;
  35286. self["@source"]=aString;
  35287. return self;
  35288. },
  35289. //>>excludeStart("ide", pragmas.excludeIdeData);
  35290. args: ["aString"],
  35291. source: "source: aString\x0a\x09source := aString",
  35292. referencedClasses: [],
  35293. //>>excludeEnd("ide");
  35294. messageSends: []
  35295. }),
  35296. globals.IRASTTranslator);
  35297. smalltalk.addMethod(
  35298. smalltalk.method({
  35299. selector: "theClass",
  35300. protocol: 'accessing',
  35301. fn: function (){
  35302. var self=this;
  35303. var $1;
  35304. $1=self["@theClass"];
  35305. return $1;
  35306. },
  35307. //>>excludeStart("ide", pragmas.excludeIdeData);
  35308. args: [],
  35309. source: "theClass\x0a\x09^ theClass",
  35310. referencedClasses: [],
  35311. //>>excludeEnd("ide");
  35312. messageSends: []
  35313. }),
  35314. globals.IRASTTranslator);
  35315. smalltalk.addMethod(
  35316. smalltalk.method({
  35317. selector: "theClass:",
  35318. protocol: 'accessing',
  35319. fn: function (aClass){
  35320. var self=this;
  35321. self["@theClass"]=aClass;
  35322. return self;
  35323. },
  35324. //>>excludeStart("ide", pragmas.excludeIdeData);
  35325. args: ["aClass"],
  35326. source: "theClass: aClass\x0a\x09theClass := aClass",
  35327. referencedClasses: [],
  35328. //>>excludeEnd("ide");
  35329. messageSends: []
  35330. }),
  35331. globals.IRASTTranslator);
  35332. smalltalk.addMethod(
  35333. smalltalk.method({
  35334. selector: "visitAssignmentNode:",
  35335. protocol: 'visiting',
  35336. fn: function (aNode){
  35337. var self=this;
  35338. var left,right,assignment;
  35339. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  35340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35341. return smalltalk.withContext(function($ctx1) {
  35342. //>>excludeEnd("ctx");
  35343. var $1,$3,$4,$2,$5;
  35344. right=self._visit_(_st(aNode)._right());
  35345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35346. $ctx1.sendIdx["visit:"]=1;
  35347. //>>excludeEnd("ctx");
  35348. left=self._visit_(_st(aNode)._left());
  35349. $1=self._sequence();
  35350. $3=_st($IRAssignment())._new();
  35351. _st($3)._add_(left);
  35352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35353. $ctx1.sendIdx["add:"]=2;
  35354. //>>excludeEnd("ctx");
  35355. _st($3)._add_(right);
  35356. $4=_st($3)._yourself();
  35357. $2=$4;
  35358. _st($1)._add_($2);
  35359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35360. $ctx1.sendIdx["add:"]=1;
  35361. //>>excludeEnd("ctx");
  35362. $5=left;
  35363. return $5;
  35364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35365. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},globals.IRASTTranslator)});
  35366. //>>excludeEnd("ctx");
  35367. },
  35368. //>>excludeStart("ide", pragmas.excludeIdeData);
  35369. args: ["aNode"],
  35370. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  35371. referencedClasses: ["IRAssignment"],
  35372. //>>excludeEnd("ide");
  35373. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  35374. }),
  35375. globals.IRASTTranslator);
  35376. smalltalk.addMethod(
  35377. smalltalk.method({
  35378. selector: "visitBlockNode:",
  35379. protocol: 'visiting',
  35380. fn: function (aNode){
  35381. var self=this;
  35382. var closure;
  35383. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  35384. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  35385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35386. return smalltalk.withContext(function($ctx1) {
  35387. //>>excludeEnd("ctx");
  35388. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  35389. $1=_st($IRClosure())._new();
  35390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35391. $ctx1.sendIdx["new"]=1;
  35392. //>>excludeEnd("ctx");
  35393. _st($1)._arguments_(_st(aNode)._parameters());
  35394. _st($1)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  35395. $2=$1;
  35396. $3=_st(aNode)._scope();
  35397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35398. $ctx1.sendIdx["scope"]=1;
  35399. //>>excludeEnd("ctx");
  35400. _st($2)._scope_($3);
  35401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35402. $ctx1.sendIdx["scope:"]=1;
  35403. //>>excludeEnd("ctx");
  35404. $4=_st($1)._yourself();
  35405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35406. $ctx1.sendIdx["yourself"]=1;
  35407. //>>excludeEnd("ctx");
  35408. closure=$4;
  35409. $6=_st(aNode)._scope();
  35410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35411. $ctx1.sendIdx["scope"]=2;
  35412. //>>excludeEnd("ctx");
  35413. $5=_st($6)._temps();
  35414. _st($5)._do_((function(each){
  35415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35416. return smalltalk.withContext(function($ctx2) {
  35417. //>>excludeEnd("ctx");
  35418. $7=_st($IRTempDeclaration())._new();
  35419. _st($7)._name_(_st(each)._name());
  35420. _st($7)._scope_(_st(aNode)._scope());
  35421. $8=_st($7)._yourself();
  35422. return _st(closure)._add_($8);
  35423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35424. $ctx2.sendIdx["add:"]=1;
  35425. //>>excludeEnd("ctx");
  35426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35428. //>>excludeEnd("ctx");
  35429. }));
  35430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35431. $ctx1.sendIdx["do:"]=1;
  35432. //>>excludeEnd("ctx");
  35433. _st(_st(aNode)._nodes())._do_((function(each){
  35434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35435. return smalltalk.withContext(function($ctx2) {
  35436. //>>excludeEnd("ctx");
  35437. return _st(closure)._add_(self._visit_(each));
  35438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35440. //>>excludeEnd("ctx");
  35441. }));
  35442. $9=closure;
  35443. return $9;
  35444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35445. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},globals.IRASTTranslator)});
  35446. //>>excludeEnd("ctx");
  35447. },
  35448. //>>excludeStart("ide", pragmas.excludeIdeData);
  35449. args: ["aNode"],
  35450. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  35451. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  35452. //>>excludeEnd("ide");
  35453. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  35454. }),
  35455. globals.IRASTTranslator);
  35456. smalltalk.addMethod(
  35457. smalltalk.method({
  35458. selector: "visitBlockSequenceNode:",
  35459. protocol: 'visiting',
  35460. fn: function (aNode){
  35461. var self=this;
  35462. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  35463. function $IRBlockReturn(){return globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  35464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35465. return smalltalk.withContext(function($ctx1) {
  35466. //>>excludeEnd("ctx");
  35467. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  35468. $2=_st($IRBlockSequence())._new();
  35469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35470. $ctx1.sendIdx["new"]=1;
  35471. //>>excludeEnd("ctx");
  35472. $1=self._withSequence_do_($2,(function(){
  35473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35474. return smalltalk.withContext(function($ctx2) {
  35475. //>>excludeEnd("ctx");
  35476. $3=_st(aNode)._nodes();
  35477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35478. $ctx2.sendIdx["nodes"]=1;
  35479. //>>excludeEnd("ctx");
  35480. return _st($3)._ifNotEmpty_((function(){
  35481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35482. return smalltalk.withContext(function($ctx3) {
  35483. //>>excludeEnd("ctx");
  35484. $5=_st(aNode)._nodes();
  35485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35486. $ctx3.sendIdx["nodes"]=2;
  35487. //>>excludeEnd("ctx");
  35488. $4=_st($5)._allButLast();
  35489. _st($4)._do_((function(each){
  35490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35491. return smalltalk.withContext(function($ctx4) {
  35492. //>>excludeEnd("ctx");
  35493. $6=self._sequence();
  35494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35495. $ctx4.sendIdx["sequence"]=1;
  35496. //>>excludeEnd("ctx");
  35497. $7=self._visitOrAlias_(each);
  35498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35499. $ctx4.sendIdx["visitOrAlias:"]=1;
  35500. //>>excludeEnd("ctx");
  35501. return _st($6)._add_($7);
  35502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35503. $ctx4.sendIdx["add:"]=1;
  35504. //>>excludeEnd("ctx");
  35505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35506. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  35507. //>>excludeEnd("ctx");
  35508. }));
  35509. $10=_st(aNode)._nodes();
  35510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35511. $ctx3.sendIdx["nodes"]=3;
  35512. //>>excludeEnd("ctx");
  35513. $9=_st($10)._last();
  35514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35515. $ctx3.sendIdx["last"]=1;
  35516. //>>excludeEnd("ctx");
  35517. $8=_st($9)._isReturnNode();
  35518. if(smalltalk.assert($8)){
  35519. return _st(self._sequence())._add_(self._visitOrAlias_(_st(_st(aNode)._nodes())._last()));
  35520. } else {
  35521. $11=self._sequence();
  35522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35523. $ctx3.sendIdx["sequence"]=2;
  35524. //>>excludeEnd("ctx");
  35525. $13=_st($IRBlockReturn())._new();
  35526. $14=$13;
  35527. $17=_st(aNode)._nodes();
  35528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35529. $ctx3.sendIdx["nodes"]=4;
  35530. //>>excludeEnd("ctx");
  35531. $16=_st($17)._last();
  35532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35533. $ctx3.sendIdx["last"]=2;
  35534. //>>excludeEnd("ctx");
  35535. $15=self._visitOrAlias_($16);
  35536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35537. $ctx3.sendIdx["visitOrAlias:"]=2;
  35538. //>>excludeEnd("ctx");
  35539. _st($14)._add_($15);
  35540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35541. $ctx3.sendIdx["add:"]=3;
  35542. //>>excludeEnd("ctx");
  35543. $18=_st($13)._yourself();
  35544. $12=$18;
  35545. return _st($11)._add_($12);
  35546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35547. $ctx3.sendIdx["add:"]=2;
  35548. //>>excludeEnd("ctx");
  35549. };
  35550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35551. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35552. //>>excludeEnd("ctx");
  35553. }));
  35554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35556. //>>excludeEnd("ctx");
  35557. }));
  35558. return $1;
  35559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35560. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.IRASTTranslator)});
  35561. //>>excludeEnd("ctx");
  35562. },
  35563. //>>excludeStart("ide", pragmas.excludeIdeData);
  35564. args: ["aNode"],
  35565. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]",
  35566. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  35567. //>>excludeEnd("ide");
  35568. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  35569. }),
  35570. globals.IRASTTranslator);
  35571. smalltalk.addMethod(
  35572. smalltalk.method({
  35573. selector: "visitCascadeNode:",
  35574. protocol: 'visiting',
  35575. fn: function (aNode){
  35576. var self=this;
  35577. var alias,receiver;
  35578. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  35579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35580. return smalltalk.withContext(function($ctx1) {
  35581. //>>excludeEnd("ctx");
  35582. var $2,$1,$3,$5,$4,$6;
  35583. $2=_st(aNode)._receiver();
  35584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35585. $ctx1.sendIdx["receiver"]=1;
  35586. //>>excludeEnd("ctx");
  35587. $1=_st($2)._isImmutable();
  35588. if(smalltalk.assert($1)){
  35589. receiver=_st(aNode)._receiver();
  35590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35591. $ctx1.sendIdx["receiver"]=2;
  35592. //>>excludeEnd("ctx");
  35593. receiver;
  35594. } else {
  35595. alias=self._alias_(_st(aNode)._receiver());
  35596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35597. $ctx1.sendIdx["alias:"]=1;
  35598. //>>excludeEnd("ctx");
  35599. alias;
  35600. receiver=_st(_st($VariableNode())._new())._binding_(_st(alias)._variable());
  35601. receiver;
  35602. };
  35603. $3=_st(aNode)._nodes();
  35604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35605. $ctx1.sendIdx["nodes"]=1;
  35606. //>>excludeEnd("ctx");
  35607. _st($3)._do_((function(each){
  35608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35609. return smalltalk.withContext(function($ctx2) {
  35610. //>>excludeEnd("ctx");
  35611. return _st(each)._receiver_(receiver);
  35612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35613. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35614. //>>excludeEnd("ctx");
  35615. }));
  35616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35617. $ctx1.sendIdx["do:"]=1;
  35618. //>>excludeEnd("ctx");
  35619. $5=_st(aNode)._nodes();
  35620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35621. $ctx1.sendIdx["nodes"]=2;
  35622. //>>excludeEnd("ctx");
  35623. $4=_st($5)._allButLast();
  35624. _st($4)._do_((function(each){
  35625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35626. return smalltalk.withContext(function($ctx2) {
  35627. //>>excludeEnd("ctx");
  35628. return _st(self._sequence())._add_(self._visit_(each));
  35629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  35631. //>>excludeEnd("ctx");
  35632. }));
  35633. $6=self._alias_(_st(_st(aNode)._nodes())._last());
  35634. return $6;
  35635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35636. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},globals.IRASTTranslator)});
  35637. //>>excludeEnd("ctx");
  35638. },
  35639. //>>excludeStart("ide", pragmas.excludeIdeData);
  35640. args: ["aNode"],
  35641. source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  35642. referencedClasses: ["VariableNode"],
  35643. //>>excludeEnd("ide");
  35644. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"]
  35645. }),
  35646. globals.IRASTTranslator);
  35647. smalltalk.addMethod(
  35648. smalltalk.method({
  35649. selector: "visitDynamicArrayNode:",
  35650. protocol: 'visiting',
  35651. fn: function (aNode){
  35652. var self=this;
  35653. var array;
  35654. function $IRDynamicArray(){return globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  35655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35656. return smalltalk.withContext(function($ctx1) {
  35657. //>>excludeEnd("ctx");
  35658. var $1;
  35659. array=_st($IRDynamicArray())._new();
  35660. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  35661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35662. return smalltalk.withContext(function($ctx2) {
  35663. //>>excludeEnd("ctx");
  35664. return _st(array)._add_(each);
  35665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35667. //>>excludeEnd("ctx");
  35668. }));
  35669. $1=array;
  35670. return $1;
  35671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35672. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.IRASTTranslator)});
  35673. //>>excludeEnd("ctx");
  35674. },
  35675. //>>excludeStart("ide", pragmas.excludeIdeData);
  35676. args: ["aNode"],
  35677. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  35678. referencedClasses: ["IRDynamicArray"],
  35679. //>>excludeEnd("ide");
  35680. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35681. }),
  35682. globals.IRASTTranslator);
  35683. smalltalk.addMethod(
  35684. smalltalk.method({
  35685. selector: "visitDynamicDictionaryNode:",
  35686. protocol: 'visiting',
  35687. fn: function (aNode){
  35688. var self=this;
  35689. var dictionary;
  35690. function $IRDynamicDictionary(){return globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  35691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35692. return smalltalk.withContext(function($ctx1) {
  35693. //>>excludeEnd("ctx");
  35694. var $1;
  35695. dictionary=_st($IRDynamicDictionary())._new();
  35696. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  35697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35698. return smalltalk.withContext(function($ctx2) {
  35699. //>>excludeEnd("ctx");
  35700. return _st(dictionary)._add_(each);
  35701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35702. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35703. //>>excludeEnd("ctx");
  35704. }));
  35705. $1=dictionary;
  35706. return $1;
  35707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35708. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},globals.IRASTTranslator)});
  35709. //>>excludeEnd("ctx");
  35710. },
  35711. //>>excludeStart("ide", pragmas.excludeIdeData);
  35712. args: ["aNode"],
  35713. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  35714. referencedClasses: ["IRDynamicDictionary"],
  35715. //>>excludeEnd("ide");
  35716. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35717. }),
  35718. globals.IRASTTranslator);
  35719. smalltalk.addMethod(
  35720. smalltalk.method({
  35721. selector: "visitJSStatementNode:",
  35722. protocol: 'visiting',
  35723. fn: function (aNode){
  35724. var self=this;
  35725. function $IRVerbatim(){return globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  35726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35727. return smalltalk.withContext(function($ctx1) {
  35728. //>>excludeEnd("ctx");
  35729. var $2,$3,$1;
  35730. $2=_st($IRVerbatim())._new();
  35731. _st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
  35732. $3=_st($2)._yourself();
  35733. $1=$3;
  35734. return $1;
  35735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35736. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.IRASTTranslator)});
  35737. //>>excludeEnd("ctx");
  35738. },
  35739. //>>excludeStart("ide", pragmas.excludeIdeData);
  35740. args: ["aNode"],
  35741. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  35742. referencedClasses: ["IRVerbatim"],
  35743. //>>excludeEnd("ide");
  35744. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  35745. }),
  35746. globals.IRASTTranslator);
  35747. smalltalk.addMethod(
  35748. smalltalk.method({
  35749. selector: "visitMethodNode:",
  35750. protocol: 'visiting',
  35751. fn: function (aNode){
  35752. var self=this;
  35753. function $IRMethod(){return globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  35754. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  35755. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  35756. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  35757. function $IRVerbatim(){return globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  35758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35759. return smalltalk.withContext(function($ctx1) {
  35760. //>>excludeEnd("ctx");
  35761. var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$17,$18,$20,$21,$23,$24,$22,$25,$19,$27,$28,$26,$29;
  35762. $2=_st($IRMethod())._new();
  35763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35764. $ctx1.sendIdx["new"]=1;
  35765. //>>excludeEnd("ctx");
  35766. _st($2)._source_(_st(self._source())._crlfSanitized());
  35767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35768. $ctx1.sendIdx["source:"]=1;
  35769. //>>excludeEnd("ctx");
  35770. _st($2)._theClass_(self._theClass());
  35771. _st($2)._arguments_(_st(aNode)._arguments());
  35772. _st($2)._selector_(_st(aNode)._selector());
  35773. _st($2)._sendIndexes_(_st(aNode)._sendIndexes());
  35774. _st($2)._superSends_(_st(aNode)._superSends());
  35775. _st($2)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  35776. _st($2)._classReferences_(_st(aNode)._classReferences());
  35777. $3=$2;
  35778. $4=_st(aNode)._scope();
  35779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35780. $ctx1.sendIdx["scope"]=1;
  35781. //>>excludeEnd("ctx");
  35782. _st($3)._scope_($4);
  35783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35784. $ctx1.sendIdx["scope:"]=1;
  35785. //>>excludeEnd("ctx");
  35786. $5=_st($2)._yourself();
  35787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35788. $ctx1.sendIdx["yourself"]=1;
  35789. //>>excludeEnd("ctx");
  35790. $1=$5;
  35791. self._method_($1);
  35792. $7=_st(aNode)._scope();
  35793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35794. $ctx1.sendIdx["scope"]=2;
  35795. //>>excludeEnd("ctx");
  35796. $6=_st($7)._temps();
  35797. _st($6)._do_((function(each){
  35798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35799. return smalltalk.withContext(function($ctx2) {
  35800. //>>excludeEnd("ctx");
  35801. $8=self._method();
  35802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35803. $ctx2.sendIdx["method"]=1;
  35804. //>>excludeEnd("ctx");
  35805. $10=_st($IRTempDeclaration())._new();
  35806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35807. $ctx2.sendIdx["new"]=2;
  35808. //>>excludeEnd("ctx");
  35809. _st($10)._name_(_st(each)._name());
  35810. $11=$10;
  35811. $12=_st(aNode)._scope();
  35812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35813. $ctx2.sendIdx["scope"]=3;
  35814. //>>excludeEnd("ctx");
  35815. _st($11)._scope_($12);
  35816. $13=_st($10)._yourself();
  35817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35818. $ctx2.sendIdx["yourself"]=2;
  35819. //>>excludeEnd("ctx");
  35820. $9=$13;
  35821. return _st($8)._add_($9);
  35822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35823. $ctx2.sendIdx["add:"]=1;
  35824. //>>excludeEnd("ctx");
  35825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35827. //>>excludeEnd("ctx");
  35828. }));
  35829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35830. $ctx1.sendIdx["do:"]=1;
  35831. //>>excludeEnd("ctx");
  35832. _st(_st(aNode)._nodes())._do_((function(each){
  35833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35834. return smalltalk.withContext(function($ctx2) {
  35835. //>>excludeEnd("ctx");
  35836. $14=self._method();
  35837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35838. $ctx2.sendIdx["method"]=2;
  35839. //>>excludeEnd("ctx");
  35840. return _st($14)._add_(self._visit_(each));
  35841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35842. $ctx2.sendIdx["add:"]=2;
  35843. //>>excludeEnd("ctx");
  35844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35846. //>>excludeEnd("ctx");
  35847. }));
  35848. $16=_st(aNode)._scope();
  35849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35850. $ctx1.sendIdx["scope"]=4;
  35851. //>>excludeEnd("ctx");
  35852. $15=_st($16)._hasLocalReturn();
  35853. if(! smalltalk.assert($15)){
  35854. $17=self._method();
  35855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35856. $ctx1.sendIdx["method"]=3;
  35857. //>>excludeEnd("ctx");
  35858. $18=$17;
  35859. $20=_st($IRReturn())._new();
  35860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35861. $ctx1.sendIdx["new"]=3;
  35862. //>>excludeEnd("ctx");
  35863. $21=$20;
  35864. $23=_st($IRVariable())._new();
  35865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35866. $ctx1.sendIdx["new"]=4;
  35867. //>>excludeEnd("ctx");
  35868. _st($23)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
  35869. $24=_st($23)._yourself();
  35870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35871. $ctx1.sendIdx["yourself"]=3;
  35872. //>>excludeEnd("ctx");
  35873. $22=$24;
  35874. _st($21)._add_($22);
  35875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35876. $ctx1.sendIdx["add:"]=4;
  35877. //>>excludeEnd("ctx");
  35878. $25=_st($20)._yourself();
  35879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35880. $ctx1.sendIdx["yourself"]=4;
  35881. //>>excludeEnd("ctx");
  35882. $19=$25;
  35883. _st($18)._add_($19);
  35884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35885. $ctx1.sendIdx["add:"]=3;
  35886. //>>excludeEnd("ctx");
  35887. $27=_st($IRVerbatim())._new();
  35888. _st($27)._source_("");
  35889. $28=_st($27)._yourself();
  35890. $26=_st($17)._add_($28);
  35891. $26;
  35892. };
  35893. $29=self._method();
  35894. return $29;
  35895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35896. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.IRASTTranslator)});
  35897. //>>excludeEnd("ctx");
  35898. },
  35899. //>>excludeStart("ide", pragmas.excludeIdeData);
  35900. args: ["aNode"],
  35901. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  35902. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  35903. //>>excludeEnd("ide");
  35904. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  35905. }),
  35906. globals.IRASTTranslator);
  35907. smalltalk.addMethod(
  35908. smalltalk.method({
  35909. selector: "visitOrAlias:",
  35910. protocol: 'visiting',
  35911. fn: function (aNode){
  35912. var self=this;
  35913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35914. return smalltalk.withContext(function($ctx1) {
  35915. //>>excludeEnd("ctx");
  35916. var $2,$1;
  35917. $2=_st(aNode)._shouldBeAliased();
  35918. if(smalltalk.assert($2)){
  35919. $1=self._alias_(aNode);
  35920. } else {
  35921. $1=self._visit_(aNode);
  35922. };
  35923. return $1;
  35924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35925. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},globals.IRASTTranslator)});
  35926. //>>excludeEnd("ctx");
  35927. },
  35928. //>>excludeStart("ide", pragmas.excludeIdeData);
  35929. args: ["aNode"],
  35930. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  35931. referencedClasses: [],
  35932. //>>excludeEnd("ide");
  35933. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  35934. }),
  35935. globals.IRASTTranslator);
  35936. smalltalk.addMethod(
  35937. smalltalk.method({
  35938. selector: "visitReturnNode:",
  35939. protocol: 'visiting',
  35940. fn: function (aNode){
  35941. var self=this;
  35942. var return_;
  35943. function $IRNonLocalReturn(){return globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  35944. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  35945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35946. return smalltalk.withContext(function($ctx1) {
  35947. //>>excludeEnd("ctx");
  35948. var $1,$2;
  35949. $1=_st(aNode)._nonLocalReturn();
  35950. if(smalltalk.assert($1)){
  35951. return_=_st($IRNonLocalReturn())._new();
  35952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35953. $ctx1.sendIdx["new"]=1;
  35954. //>>excludeEnd("ctx");
  35955. } else {
  35956. return_=_st($IRReturn())._new();
  35957. };
  35958. _st(return_)._scope_(_st(aNode)._scope());
  35959. _st(_st(aNode)._nodes())._do_((function(each){
  35960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35961. return smalltalk.withContext(function($ctx2) {
  35962. //>>excludeEnd("ctx");
  35963. return _st(return_)._add_(self._alias_(each));
  35964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35965. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35966. //>>excludeEnd("ctx");
  35967. }));
  35968. $2=return_;
  35969. return $2;
  35970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35971. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},globals.IRASTTranslator)});
  35972. //>>excludeEnd("ctx");
  35973. },
  35974. //>>excludeStart("ide", pragmas.excludeIdeData);
  35975. args: ["aNode"],
  35976. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self alias: each) ].\x0a\x09^ return",
  35977. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  35978. //>>excludeEnd("ide");
  35979. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"]
  35980. }),
  35981. globals.IRASTTranslator);
  35982. smalltalk.addMethod(
  35983. smalltalk.method({
  35984. selector: "visitSendNode:",
  35985. protocol: 'visiting',
  35986. fn: function (aNode){
  35987. var self=this;
  35988. var send,all,receiver,arguments;
  35989. function $IRSend(){return globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  35990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35991. return smalltalk.withContext(function($ctx1) {
  35992. //>>excludeEnd("ctx");
  35993. var $1,$2,$3,$4;
  35994. send=_st($IRSend())._new();
  35995. $1=send;
  35996. _st($1)._selector_(_st(aNode)._selector());
  35997. $2=_st($1)._index_(_st(aNode)._index());
  35998. $3=_st(aNode)._superSend();
  35999. if(smalltalk.assert($3)){
  36000. _st(send)._classSend_(_st(self._theClass())._superclass());
  36001. };
  36002. all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
  36003. receiver=_st(all)._first();
  36004. arguments=_st(all)._allButFirst();
  36005. _st(send)._add_(receiver);
  36006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36007. $ctx1.sendIdx["add:"]=1;
  36008. //>>excludeEnd("ctx");
  36009. _st(arguments)._do_((function(each){
  36010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36011. return smalltalk.withContext(function($ctx2) {
  36012. //>>excludeEnd("ctx");
  36013. return _st(send)._add_(each);
  36014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36016. //>>excludeEnd("ctx");
  36017. }));
  36018. $4=send;
  36019. return $4;
  36020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36021. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},globals.IRASTTranslator)});
  36022. //>>excludeEnd("ctx");
  36023. },
  36024. //>>excludeStart("ide", pragmas.excludeIdeData);
  36025. args: ["aNode"],
  36026. source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  36027. referencedClasses: ["IRSend"],
  36028. //>>excludeEnd("ide");
  36029. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"]
  36030. }),
  36031. globals.IRASTTranslator);
  36032. smalltalk.addMethod(
  36033. smalltalk.method({
  36034. selector: "visitSequenceNode:",
  36035. protocol: 'visiting',
  36036. fn: function (aNode){
  36037. var self=this;
  36038. function $IRSequence(){return globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  36039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36040. return smalltalk.withContext(function($ctx1) {
  36041. //>>excludeEnd("ctx");
  36042. var $2,$1;
  36043. $1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
  36044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36045. return smalltalk.withContext(function($ctx2) {
  36046. //>>excludeEnd("ctx");
  36047. return _st(_st(aNode)._nodes())._do_((function(each){
  36048. var instruction;
  36049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36050. return smalltalk.withContext(function($ctx3) {
  36051. //>>excludeEnd("ctx");
  36052. instruction=self._visitOrAlias_(each);
  36053. instruction;
  36054. $2=_st(instruction)._isVariable();
  36055. if(! smalltalk.assert($2)){
  36056. return _st(self._sequence())._add_(instruction);
  36057. };
  36058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36059. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  36060. //>>excludeEnd("ctx");
  36061. }));
  36062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36064. //>>excludeEnd("ctx");
  36065. }));
  36066. return $1;
  36067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36068. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.IRASTTranslator)});
  36069. //>>excludeEnd("ctx");
  36070. },
  36071. //>>excludeStart("ide", pragmas.excludeIdeData);
  36072. args: ["aNode"],
  36073. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  36074. referencedClasses: ["IRSequence"],
  36075. //>>excludeEnd("ide");
  36076. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  36077. }),
  36078. globals.IRASTTranslator);
  36079. smalltalk.addMethod(
  36080. smalltalk.method({
  36081. selector: "visitValueNode:",
  36082. protocol: 'visiting',
  36083. fn: function (aNode){
  36084. var self=this;
  36085. function $IRValue(){return globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  36086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36087. return smalltalk.withContext(function($ctx1) {
  36088. //>>excludeEnd("ctx");
  36089. var $2,$3,$1;
  36090. $2=_st($IRValue())._new();
  36091. _st($2)._value_(_st(aNode)._value());
  36092. $3=_st($2)._yourself();
  36093. $1=$3;
  36094. return $1;
  36095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36096. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.IRASTTranslator)});
  36097. //>>excludeEnd("ctx");
  36098. },
  36099. //>>excludeStart("ide", pragmas.excludeIdeData);
  36100. args: ["aNode"],
  36101. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  36102. referencedClasses: ["IRValue"],
  36103. //>>excludeEnd("ide");
  36104. messageSends: ["value:", "new", "value", "yourself"]
  36105. }),
  36106. globals.IRASTTranslator);
  36107. smalltalk.addMethod(
  36108. smalltalk.method({
  36109. selector: "visitVariableNode:",
  36110. protocol: 'visiting',
  36111. fn: function (aNode){
  36112. var self=this;
  36113. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36115. return smalltalk.withContext(function($ctx1) {
  36116. //>>excludeEnd("ctx");
  36117. var $2,$3,$1;
  36118. $2=_st($IRVariable())._new();
  36119. _st($2)._variable_(_st(aNode)._binding());
  36120. $3=_st($2)._yourself();
  36121. $1=$3;
  36122. return $1;
  36123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36124. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.IRASTTranslator)});
  36125. //>>excludeEnd("ctx");
  36126. },
  36127. //>>excludeStart("ide", pragmas.excludeIdeData);
  36128. args: ["aNode"],
  36129. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  36130. referencedClasses: ["IRVariable"],
  36131. //>>excludeEnd("ide");
  36132. messageSends: ["variable:", "new", "binding", "yourself"]
  36133. }),
  36134. globals.IRASTTranslator);
  36135. smalltalk.addMethod(
  36136. smalltalk.method({
  36137. selector: "withSequence:do:",
  36138. protocol: 'accessing',
  36139. fn: function (aSequence,aBlock){
  36140. var self=this;
  36141. var outerSequence;
  36142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36143. return smalltalk.withContext(function($ctx1) {
  36144. //>>excludeEnd("ctx");
  36145. outerSequence=self._sequence();
  36146. self._sequence_(aSequence);
  36147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36148. $ctx1.sendIdx["sequence:"]=1;
  36149. //>>excludeEnd("ctx");
  36150. _st(aBlock)._value();
  36151. self._sequence_(outerSequence);
  36152. return aSequence;
  36153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36154. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},globals.IRASTTranslator)});
  36155. //>>excludeEnd("ctx");
  36156. },
  36157. //>>excludeStart("ide", pragmas.excludeIdeData);
  36158. args: ["aSequence", "aBlock"],
  36159. source: "withSequence: aSequence do: aBlock\x0a\x09| outerSequence |\x0a\x09outerSequence := self sequence.\x0a\x09self sequence: aSequence.\x0a\x09aBlock value.\x0a\x09self sequence: outerSequence.\x0a\x09^ aSequence",
  36160. referencedClasses: [],
  36161. //>>excludeEnd("ide");
  36162. messageSends: ["sequence", "sequence:", "value"]
  36163. }),
  36164. globals.IRASTTranslator);
  36165. smalltalk.addClass('IRInstruction', globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  36166. //>>excludeStart("ide", pragmas.excludeIdeData);
  36167. globals.IRInstruction.comment="I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.\x0aThe IR graph is used to emit JavaScript code using a JSStream.";
  36168. //>>excludeEnd("ide");
  36169. smalltalk.addMethod(
  36170. smalltalk.method({
  36171. selector: "accept:",
  36172. protocol: 'visiting',
  36173. fn: function (aVisitor){
  36174. var self=this;
  36175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36176. return smalltalk.withContext(function($ctx1) {
  36177. //>>excludeEnd("ctx");
  36178. var $1;
  36179. $1=_st(aVisitor)._visitIRInstruction_(self);
  36180. return $1;
  36181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36182. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInstruction)});
  36183. //>>excludeEnd("ctx");
  36184. },
  36185. //>>excludeStart("ide", pragmas.excludeIdeData);
  36186. args: ["aVisitor"],
  36187. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  36188. referencedClasses: [],
  36189. //>>excludeEnd("ide");
  36190. messageSends: ["visitIRInstruction:"]
  36191. }),
  36192. globals.IRInstruction);
  36193. smalltalk.addMethod(
  36194. smalltalk.method({
  36195. selector: "add:",
  36196. protocol: 'building',
  36197. fn: function (anObject){
  36198. var self=this;
  36199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36200. return smalltalk.withContext(function($ctx1) {
  36201. //>>excludeEnd("ctx");
  36202. var $1;
  36203. _st(anObject)._parent_(self);
  36204. $1=_st(self._instructions())._add_(anObject);
  36205. return $1;
  36206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36207. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.IRInstruction)});
  36208. //>>excludeEnd("ctx");
  36209. },
  36210. //>>excludeStart("ide", pragmas.excludeIdeData);
  36211. args: ["anObject"],
  36212. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  36213. referencedClasses: [],
  36214. //>>excludeEnd("ide");
  36215. messageSends: ["parent:", "add:", "instructions"]
  36216. }),
  36217. globals.IRInstruction);
  36218. smalltalk.addMethod(
  36219. smalltalk.method({
  36220. selector: "canBeAssigned",
  36221. protocol: 'testing',
  36222. fn: function (){
  36223. var self=this;
  36224. return true;
  36225. },
  36226. //>>excludeStart("ide", pragmas.excludeIdeData);
  36227. args: [],
  36228. source: "canBeAssigned\x0a\x09^ true",
  36229. referencedClasses: [],
  36230. //>>excludeEnd("ide");
  36231. messageSends: []
  36232. }),
  36233. globals.IRInstruction);
  36234. smalltalk.addMethod(
  36235. smalltalk.method({
  36236. selector: "instructions",
  36237. protocol: 'accessing',
  36238. fn: function (){
  36239. var self=this;
  36240. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36242. return smalltalk.withContext(function($ctx1) {
  36243. //>>excludeEnd("ctx");
  36244. var $2,$1,$receiver;
  36245. $2=self["@instructions"];
  36246. if(($receiver = $2) == null || $receiver.isNil){
  36247. self["@instructions"]=_st($OrderedCollection())._new();
  36248. $1=self["@instructions"];
  36249. } else {
  36250. $1=$2;
  36251. };
  36252. return $1;
  36253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36254. }, function($ctx1) {$ctx1.fill(self,"instructions",{},globals.IRInstruction)});
  36255. //>>excludeEnd("ctx");
  36256. },
  36257. //>>excludeStart("ide", pragmas.excludeIdeData);
  36258. args: [],
  36259. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36260. referencedClasses: ["OrderedCollection"],
  36261. //>>excludeEnd("ide");
  36262. messageSends: ["ifNil:", "new"]
  36263. }),
  36264. globals.IRInstruction);
  36265. smalltalk.addMethod(
  36266. smalltalk.method({
  36267. selector: "isClosure",
  36268. protocol: 'testing',
  36269. fn: function (){
  36270. var self=this;
  36271. return false;
  36272. },
  36273. //>>excludeStart("ide", pragmas.excludeIdeData);
  36274. args: [],
  36275. source: "isClosure\x0a\x09^ false",
  36276. referencedClasses: [],
  36277. //>>excludeEnd("ide");
  36278. messageSends: []
  36279. }),
  36280. globals.IRInstruction);
  36281. smalltalk.addMethod(
  36282. smalltalk.method({
  36283. selector: "isInlined",
  36284. protocol: 'testing',
  36285. fn: function (){
  36286. var self=this;
  36287. return false;
  36288. },
  36289. //>>excludeStart("ide", pragmas.excludeIdeData);
  36290. args: [],
  36291. source: "isInlined\x0a\x09^ false",
  36292. referencedClasses: [],
  36293. //>>excludeEnd("ide");
  36294. messageSends: []
  36295. }),
  36296. globals.IRInstruction);
  36297. smalltalk.addMethod(
  36298. smalltalk.method({
  36299. selector: "isLocalReturn",
  36300. protocol: 'testing',
  36301. fn: function (){
  36302. var self=this;
  36303. return false;
  36304. },
  36305. //>>excludeStart("ide", pragmas.excludeIdeData);
  36306. args: [],
  36307. source: "isLocalReturn\x0a\x09^ false",
  36308. referencedClasses: [],
  36309. //>>excludeEnd("ide");
  36310. messageSends: []
  36311. }),
  36312. globals.IRInstruction);
  36313. smalltalk.addMethod(
  36314. smalltalk.method({
  36315. selector: "isMethod",
  36316. protocol: 'testing',
  36317. fn: function (){
  36318. var self=this;
  36319. return false;
  36320. },
  36321. //>>excludeStart("ide", pragmas.excludeIdeData);
  36322. args: [],
  36323. source: "isMethod\x0a\x09^ false",
  36324. referencedClasses: [],
  36325. //>>excludeEnd("ide");
  36326. messageSends: []
  36327. }),
  36328. globals.IRInstruction);
  36329. smalltalk.addMethod(
  36330. smalltalk.method({
  36331. selector: "isReturn",
  36332. protocol: 'testing',
  36333. fn: function (){
  36334. var self=this;
  36335. return false;
  36336. },
  36337. //>>excludeStart("ide", pragmas.excludeIdeData);
  36338. args: [],
  36339. source: "isReturn\x0a\x09^ false",
  36340. referencedClasses: [],
  36341. //>>excludeEnd("ide");
  36342. messageSends: []
  36343. }),
  36344. globals.IRInstruction);
  36345. smalltalk.addMethod(
  36346. smalltalk.method({
  36347. selector: "isSend",
  36348. protocol: 'testing',
  36349. fn: function (){
  36350. var self=this;
  36351. return false;
  36352. },
  36353. //>>excludeStart("ide", pragmas.excludeIdeData);
  36354. args: [],
  36355. source: "isSend\x0a\x09^ false",
  36356. referencedClasses: [],
  36357. //>>excludeEnd("ide");
  36358. messageSends: []
  36359. }),
  36360. globals.IRInstruction);
  36361. smalltalk.addMethod(
  36362. smalltalk.method({
  36363. selector: "isSequence",
  36364. protocol: 'testing',
  36365. fn: function (){
  36366. var self=this;
  36367. return false;
  36368. },
  36369. //>>excludeStart("ide", pragmas.excludeIdeData);
  36370. args: [],
  36371. source: "isSequence\x0a\x09^ false",
  36372. referencedClasses: [],
  36373. //>>excludeEnd("ide");
  36374. messageSends: []
  36375. }),
  36376. globals.IRInstruction);
  36377. smalltalk.addMethod(
  36378. smalltalk.method({
  36379. selector: "isTempDeclaration",
  36380. protocol: 'testing',
  36381. fn: function (){
  36382. var self=this;
  36383. return false;
  36384. },
  36385. //>>excludeStart("ide", pragmas.excludeIdeData);
  36386. args: [],
  36387. source: "isTempDeclaration\x0a\x09^ false",
  36388. referencedClasses: [],
  36389. //>>excludeEnd("ide");
  36390. messageSends: []
  36391. }),
  36392. globals.IRInstruction);
  36393. smalltalk.addMethod(
  36394. smalltalk.method({
  36395. selector: "isVariable",
  36396. protocol: 'testing',
  36397. fn: function (){
  36398. var self=this;
  36399. return false;
  36400. },
  36401. //>>excludeStart("ide", pragmas.excludeIdeData);
  36402. args: [],
  36403. source: "isVariable\x0a\x09^ false",
  36404. referencedClasses: [],
  36405. //>>excludeEnd("ide");
  36406. messageSends: []
  36407. }),
  36408. globals.IRInstruction);
  36409. smalltalk.addMethod(
  36410. smalltalk.method({
  36411. selector: "method",
  36412. protocol: 'accessing',
  36413. fn: function (){
  36414. var self=this;
  36415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36416. return smalltalk.withContext(function($ctx1) {
  36417. //>>excludeEnd("ctx");
  36418. var $1;
  36419. $1=_st(self._parent())._method();
  36420. return $1;
  36421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36422. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.IRInstruction)});
  36423. //>>excludeEnd("ctx");
  36424. },
  36425. //>>excludeStart("ide", pragmas.excludeIdeData);
  36426. args: [],
  36427. source: "method\x0a\x09^ self parent method",
  36428. referencedClasses: [],
  36429. //>>excludeEnd("ide");
  36430. messageSends: ["method", "parent"]
  36431. }),
  36432. globals.IRInstruction);
  36433. smalltalk.addMethod(
  36434. smalltalk.method({
  36435. selector: "needsBoxingAsReceiver",
  36436. protocol: 'testing',
  36437. fn: function (){
  36438. var self=this;
  36439. return true;
  36440. },
  36441. //>>excludeStart("ide", pragmas.excludeIdeData);
  36442. args: [],
  36443. source: "needsBoxingAsReceiver\x0a\x09^ true",
  36444. referencedClasses: [],
  36445. //>>excludeEnd("ide");
  36446. messageSends: []
  36447. }),
  36448. globals.IRInstruction);
  36449. smalltalk.addMethod(
  36450. smalltalk.method({
  36451. selector: "parent",
  36452. protocol: 'accessing',
  36453. fn: function (){
  36454. var self=this;
  36455. var $1;
  36456. $1=self["@parent"];
  36457. return $1;
  36458. },
  36459. //>>excludeStart("ide", pragmas.excludeIdeData);
  36460. args: [],
  36461. source: "parent\x0a\x09^ parent",
  36462. referencedClasses: [],
  36463. //>>excludeEnd("ide");
  36464. messageSends: []
  36465. }),
  36466. globals.IRInstruction);
  36467. smalltalk.addMethod(
  36468. smalltalk.method({
  36469. selector: "parent:",
  36470. protocol: 'accessing',
  36471. fn: function (anIRInstruction){
  36472. var self=this;
  36473. self["@parent"]=anIRInstruction;
  36474. return self;
  36475. },
  36476. //>>excludeStart("ide", pragmas.excludeIdeData);
  36477. args: ["anIRInstruction"],
  36478. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  36479. referencedClasses: [],
  36480. //>>excludeEnd("ide");
  36481. messageSends: []
  36482. }),
  36483. globals.IRInstruction);
  36484. smalltalk.addMethod(
  36485. smalltalk.method({
  36486. selector: "remove",
  36487. protocol: 'building',
  36488. fn: function (){
  36489. var self=this;
  36490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36491. return smalltalk.withContext(function($ctx1) {
  36492. //>>excludeEnd("ctx");
  36493. _st(self._parent())._remove_(self);
  36494. return self;
  36495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36496. }, function($ctx1) {$ctx1.fill(self,"remove",{},globals.IRInstruction)});
  36497. //>>excludeEnd("ctx");
  36498. },
  36499. //>>excludeStart("ide", pragmas.excludeIdeData);
  36500. args: [],
  36501. source: "remove\x0a\x09self parent remove: self",
  36502. referencedClasses: [],
  36503. //>>excludeEnd("ide");
  36504. messageSends: ["remove:", "parent"]
  36505. }),
  36506. globals.IRInstruction);
  36507. smalltalk.addMethod(
  36508. smalltalk.method({
  36509. selector: "remove:",
  36510. protocol: 'building',
  36511. fn: function (anIRInstruction){
  36512. var self=this;
  36513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36514. return smalltalk.withContext(function($ctx1) {
  36515. //>>excludeEnd("ctx");
  36516. _st(self._instructions())._remove_(anIRInstruction);
  36517. return self;
  36518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36519. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},globals.IRInstruction)});
  36520. //>>excludeEnd("ctx");
  36521. },
  36522. //>>excludeStart("ide", pragmas.excludeIdeData);
  36523. args: ["anIRInstruction"],
  36524. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  36525. referencedClasses: [],
  36526. //>>excludeEnd("ide");
  36527. messageSends: ["remove:", "instructions"]
  36528. }),
  36529. globals.IRInstruction);
  36530. smalltalk.addMethod(
  36531. smalltalk.method({
  36532. selector: "replace:with:",
  36533. protocol: 'building',
  36534. fn: function (anIRInstruction,anotherIRInstruction){
  36535. var self=this;
  36536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36537. return smalltalk.withContext(function($ctx1) {
  36538. //>>excludeEnd("ctx");
  36539. var $1;
  36540. _st(anotherIRInstruction)._parent_(self);
  36541. $1=self._instructions();
  36542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36543. $ctx1.sendIdx["instructions"]=1;
  36544. //>>excludeEnd("ctx");
  36545. _st($1)._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  36546. return self;
  36547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36548. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRInstruction)});
  36549. //>>excludeEnd("ctx");
  36550. },
  36551. //>>excludeStart("ide", pragmas.excludeIdeData);
  36552. args: ["anIRInstruction", "anotherIRInstruction"],
  36553. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  36554. referencedClasses: [],
  36555. //>>excludeEnd("ide");
  36556. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  36557. }),
  36558. globals.IRInstruction);
  36559. smalltalk.addMethod(
  36560. smalltalk.method({
  36561. selector: "replaceWith:",
  36562. protocol: 'building',
  36563. fn: function (anIRInstruction){
  36564. var self=this;
  36565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36566. return smalltalk.withContext(function($ctx1) {
  36567. //>>excludeEnd("ctx");
  36568. _st(self._parent())._replace_with_(self,anIRInstruction);
  36569. return self;
  36570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36571. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},globals.IRInstruction)});
  36572. //>>excludeEnd("ctx");
  36573. },
  36574. //>>excludeStart("ide", pragmas.excludeIdeData);
  36575. args: ["anIRInstruction"],
  36576. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  36577. referencedClasses: [],
  36578. //>>excludeEnd("ide");
  36579. messageSends: ["replace:with:", "parent"]
  36580. }),
  36581. globals.IRInstruction);
  36582. smalltalk.addMethod(
  36583. smalltalk.method({
  36584. selector: "scope",
  36585. protocol: 'accessing',
  36586. fn: function (){
  36587. var self=this;
  36588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36589. return smalltalk.withContext(function($ctx1) {
  36590. //>>excludeEnd("ctx");
  36591. var $2,$1,$receiver;
  36592. $2=self._parent();
  36593. if(($receiver = $2) == null || $receiver.isNil){
  36594. $1=$2;
  36595. } else {
  36596. var node;
  36597. node=$receiver;
  36598. $1=_st(node)._scope();
  36599. };
  36600. return $1;
  36601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36602. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRInstruction)});
  36603. //>>excludeEnd("ctx");
  36604. },
  36605. //>>excludeStart("ide", pragmas.excludeIdeData);
  36606. args: [],
  36607. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  36608. referencedClasses: [],
  36609. //>>excludeEnd("ide");
  36610. messageSends: ["ifNotNil:", "parent", "scope"]
  36611. }),
  36612. globals.IRInstruction);
  36613. smalltalk.addMethod(
  36614. smalltalk.method({
  36615. selector: "on:",
  36616. protocol: 'instance creation',
  36617. fn: function (aBuilder){
  36618. var self=this;
  36619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36620. return smalltalk.withContext(function($ctx1) {
  36621. //>>excludeEnd("ctx");
  36622. var $2,$3,$1;
  36623. $2=self._new();
  36624. _st($2)._builder_(aBuilder);
  36625. $3=_st($2)._yourself();
  36626. $1=$3;
  36627. return $1;
  36628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36629. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},globals.IRInstruction.klass)});
  36630. //>>excludeEnd("ctx");
  36631. },
  36632. //>>excludeStart("ide", pragmas.excludeIdeData);
  36633. args: ["aBuilder"],
  36634. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  36635. referencedClasses: [],
  36636. //>>excludeEnd("ide");
  36637. messageSends: ["builder:", "new", "yourself"]
  36638. }),
  36639. globals.IRInstruction.klass);
  36640. smalltalk.addClass('IRAssignment', globals.IRInstruction, [], 'Compiler-IR');
  36641. smalltalk.addMethod(
  36642. smalltalk.method({
  36643. selector: "accept:",
  36644. protocol: 'visiting',
  36645. fn: function (aVisitor){
  36646. var self=this;
  36647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36648. return smalltalk.withContext(function($ctx1) {
  36649. //>>excludeEnd("ctx");
  36650. var $1;
  36651. $1=_st(aVisitor)._visitIRAssignment_(self);
  36652. return $1;
  36653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36654. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRAssignment)});
  36655. //>>excludeEnd("ctx");
  36656. },
  36657. //>>excludeStart("ide", pragmas.excludeIdeData);
  36658. args: ["aVisitor"],
  36659. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  36660. referencedClasses: [],
  36661. //>>excludeEnd("ide");
  36662. messageSends: ["visitIRAssignment:"]
  36663. }),
  36664. globals.IRAssignment);
  36665. smalltalk.addClass('IRDynamicArray', globals.IRInstruction, [], 'Compiler-IR');
  36666. smalltalk.addMethod(
  36667. smalltalk.method({
  36668. selector: "accept:",
  36669. protocol: 'visiting',
  36670. fn: function (aVisitor){
  36671. var self=this;
  36672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36673. return smalltalk.withContext(function($ctx1) {
  36674. //>>excludeEnd("ctx");
  36675. var $1;
  36676. $1=_st(aVisitor)._visitIRDynamicArray_(self);
  36677. return $1;
  36678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36679. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicArray)});
  36680. //>>excludeEnd("ctx");
  36681. },
  36682. //>>excludeStart("ide", pragmas.excludeIdeData);
  36683. args: ["aVisitor"],
  36684. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  36685. referencedClasses: [],
  36686. //>>excludeEnd("ide");
  36687. messageSends: ["visitIRDynamicArray:"]
  36688. }),
  36689. globals.IRDynamicArray);
  36690. smalltalk.addClass('IRDynamicDictionary', globals.IRInstruction, [], 'Compiler-IR');
  36691. smalltalk.addMethod(
  36692. smalltalk.method({
  36693. selector: "accept:",
  36694. protocol: 'visiting',
  36695. fn: function (aVisitor){
  36696. var self=this;
  36697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36698. return smalltalk.withContext(function($ctx1) {
  36699. //>>excludeEnd("ctx");
  36700. var $1;
  36701. $1=_st(aVisitor)._visitIRDynamicDictionary_(self);
  36702. return $1;
  36703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36704. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicDictionary)});
  36705. //>>excludeEnd("ctx");
  36706. },
  36707. //>>excludeStart("ide", pragmas.excludeIdeData);
  36708. args: ["aVisitor"],
  36709. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  36710. referencedClasses: [],
  36711. //>>excludeEnd("ide");
  36712. messageSends: ["visitIRDynamicDictionary:"]
  36713. }),
  36714. globals.IRDynamicDictionary);
  36715. smalltalk.addClass('IRScopedInstruction', globals.IRInstruction, ['scope'], 'Compiler-IR');
  36716. smalltalk.addMethod(
  36717. smalltalk.method({
  36718. selector: "scope",
  36719. protocol: 'accessing',
  36720. fn: function (){
  36721. var self=this;
  36722. var $1;
  36723. $1=self["@scope"];
  36724. return $1;
  36725. },
  36726. //>>excludeStart("ide", pragmas.excludeIdeData);
  36727. args: [],
  36728. source: "scope\x0a\x09^ scope",
  36729. referencedClasses: [],
  36730. //>>excludeEnd("ide");
  36731. messageSends: []
  36732. }),
  36733. globals.IRScopedInstruction);
  36734. smalltalk.addMethod(
  36735. smalltalk.method({
  36736. selector: "scope:",
  36737. protocol: 'accessing',
  36738. fn: function (aScope){
  36739. var self=this;
  36740. self["@scope"]=aScope;
  36741. return self;
  36742. },
  36743. //>>excludeStart("ide", pragmas.excludeIdeData);
  36744. args: ["aScope"],
  36745. source: "scope: aScope\x0a\x09scope := aScope",
  36746. referencedClasses: [],
  36747. //>>excludeEnd("ide");
  36748. messageSends: []
  36749. }),
  36750. globals.IRScopedInstruction);
  36751. smalltalk.addClass('IRClosureInstruction', globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  36752. smalltalk.addMethod(
  36753. smalltalk.method({
  36754. selector: "arguments",
  36755. protocol: 'accessing',
  36756. fn: function (){
  36757. var self=this;
  36758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36759. return smalltalk.withContext(function($ctx1) {
  36760. //>>excludeEnd("ctx");
  36761. var $2,$1,$receiver;
  36762. $2=self["@arguments"];
  36763. if(($receiver = $2) == null || $receiver.isNil){
  36764. $1=[];
  36765. } else {
  36766. $1=$2;
  36767. };
  36768. return $1;
  36769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36770. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.IRClosureInstruction)});
  36771. //>>excludeEnd("ctx");
  36772. },
  36773. //>>excludeStart("ide", pragmas.excludeIdeData);
  36774. args: [],
  36775. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36776. referencedClasses: [],
  36777. //>>excludeEnd("ide");
  36778. messageSends: ["ifNil:"]
  36779. }),
  36780. globals.IRClosureInstruction);
  36781. smalltalk.addMethod(
  36782. smalltalk.method({
  36783. selector: "arguments:",
  36784. protocol: 'accessing',
  36785. fn: function (aCollection){
  36786. var self=this;
  36787. self["@arguments"]=aCollection;
  36788. return self;
  36789. },
  36790. //>>excludeStart("ide", pragmas.excludeIdeData);
  36791. args: ["aCollection"],
  36792. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36793. referencedClasses: [],
  36794. //>>excludeEnd("ide");
  36795. messageSends: []
  36796. }),
  36797. globals.IRClosureInstruction);
  36798. smalltalk.addMethod(
  36799. smalltalk.method({
  36800. selector: "locals",
  36801. protocol: 'accessing',
  36802. fn: function (){
  36803. var self=this;
  36804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36805. return smalltalk.withContext(function($ctx1) {
  36806. //>>excludeEnd("ctx");
  36807. var $2,$3,$1;
  36808. $2=_st(self._arguments())._copy();
  36809. _st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
  36810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36811. return smalltalk.withContext(function($ctx2) {
  36812. //>>excludeEnd("ctx");
  36813. return _st(each)._name();
  36814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36816. //>>excludeEnd("ctx");
  36817. })));
  36818. $3=_st($2)._yourself();
  36819. $1=$3;
  36820. return $1;
  36821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36822. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.IRClosureInstruction)});
  36823. //>>excludeEnd("ctx");
  36824. },
  36825. //>>excludeStart("ide", pragmas.excludeIdeData);
  36826. args: [],
  36827. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  36828. referencedClasses: [],
  36829. //>>excludeEnd("ide");
  36830. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  36831. }),
  36832. globals.IRClosureInstruction);
  36833. smalltalk.addMethod(
  36834. smalltalk.method({
  36835. selector: "requiresSmalltalkContext",
  36836. protocol: 'accessing',
  36837. fn: function (){
  36838. var self=this;
  36839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36840. return smalltalk.withContext(function($ctx1) {
  36841. //>>excludeEnd("ctx");
  36842. var $2,$1,$receiver;
  36843. $2=self["@requiresSmalltalkContext"];
  36844. if(($receiver = $2) == null || $receiver.isNil){
  36845. $1=false;
  36846. } else {
  36847. $1=$2;
  36848. };
  36849. return $1;
  36850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36851. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.IRClosureInstruction)});
  36852. //>>excludeEnd("ctx");
  36853. },
  36854. //>>excludeStart("ide", pragmas.excludeIdeData);
  36855. args: [],
  36856. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  36857. referencedClasses: [],
  36858. //>>excludeEnd("ide");
  36859. messageSends: ["ifNil:"]
  36860. }),
  36861. globals.IRClosureInstruction);
  36862. smalltalk.addMethod(
  36863. smalltalk.method({
  36864. selector: "requiresSmalltalkContext:",
  36865. protocol: 'accessing',
  36866. fn: function (anObject){
  36867. var self=this;
  36868. self["@requiresSmalltalkContext"]=anObject;
  36869. return self;
  36870. },
  36871. //>>excludeStart("ide", pragmas.excludeIdeData);
  36872. args: ["anObject"],
  36873. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  36874. referencedClasses: [],
  36875. //>>excludeEnd("ide");
  36876. messageSends: []
  36877. }),
  36878. globals.IRClosureInstruction);
  36879. smalltalk.addMethod(
  36880. smalltalk.method({
  36881. selector: "scope:",
  36882. protocol: 'accessing',
  36883. fn: function (aScope){
  36884. var self=this;
  36885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36886. return smalltalk.withContext(function($ctx1) {
  36887. //>>excludeEnd("ctx");
  36888. (
  36889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36890. $ctx1.supercall = true,
  36891. //>>excludeEnd("ctx");
  36892. globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply(_st(self), [aScope]));
  36893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36894. $ctx1.supercall = false;
  36895. //>>excludeEnd("ctx");;
  36896. _st(aScope)._instruction_(self);
  36897. return self;
  36898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36899. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},globals.IRClosureInstruction)});
  36900. //>>excludeEnd("ctx");
  36901. },
  36902. //>>excludeStart("ide", pragmas.excludeIdeData);
  36903. args: ["aScope"],
  36904. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  36905. referencedClasses: [],
  36906. //>>excludeEnd("ide");
  36907. messageSends: ["scope:", "instruction:"]
  36908. }),
  36909. globals.IRClosureInstruction);
  36910. smalltalk.addMethod(
  36911. smalltalk.method({
  36912. selector: "tempDeclarations",
  36913. protocol: 'accessing',
  36914. fn: function (){
  36915. var self=this;
  36916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36917. return smalltalk.withContext(function($ctx1) {
  36918. //>>excludeEnd("ctx");
  36919. var $1;
  36920. $1=_st(self._instructions())._select_((function(each){
  36921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36922. return smalltalk.withContext(function($ctx2) {
  36923. //>>excludeEnd("ctx");
  36924. return _st(each)._isTempDeclaration();
  36925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36927. //>>excludeEnd("ctx");
  36928. }));
  36929. return $1;
  36930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36931. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},globals.IRClosureInstruction)});
  36932. //>>excludeEnd("ctx");
  36933. },
  36934. //>>excludeStart("ide", pragmas.excludeIdeData);
  36935. args: [],
  36936. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  36937. referencedClasses: [],
  36938. //>>excludeEnd("ide");
  36939. messageSends: ["select:", "instructions", "isTempDeclaration"]
  36940. }),
  36941. globals.IRClosureInstruction);
  36942. smalltalk.addClass('IRClosure', globals.IRClosureInstruction, [], 'Compiler-IR');
  36943. smalltalk.addMethod(
  36944. smalltalk.method({
  36945. selector: "accept:",
  36946. protocol: 'visiting',
  36947. fn: function (aVisitor){
  36948. var self=this;
  36949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36950. return smalltalk.withContext(function($ctx1) {
  36951. //>>excludeEnd("ctx");
  36952. var $1;
  36953. $1=_st(aVisitor)._visitIRClosure_(self);
  36954. return $1;
  36955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36956. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRClosure)});
  36957. //>>excludeEnd("ctx");
  36958. },
  36959. //>>excludeStart("ide", pragmas.excludeIdeData);
  36960. args: ["aVisitor"],
  36961. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  36962. referencedClasses: [],
  36963. //>>excludeEnd("ide");
  36964. messageSends: ["visitIRClosure:"]
  36965. }),
  36966. globals.IRClosure);
  36967. smalltalk.addMethod(
  36968. smalltalk.method({
  36969. selector: "isClosure",
  36970. protocol: 'testing',
  36971. fn: function (){
  36972. var self=this;
  36973. return true;
  36974. },
  36975. //>>excludeStart("ide", pragmas.excludeIdeData);
  36976. args: [],
  36977. source: "isClosure\x0a\x09^ true",
  36978. referencedClasses: [],
  36979. //>>excludeEnd("ide");
  36980. messageSends: []
  36981. }),
  36982. globals.IRClosure);
  36983. smalltalk.addMethod(
  36984. smalltalk.method({
  36985. selector: "sequence",
  36986. protocol: 'accessing',
  36987. fn: function (){
  36988. var self=this;
  36989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36990. return smalltalk.withContext(function($ctx1) {
  36991. //>>excludeEnd("ctx");
  36992. var $1;
  36993. $1=_st(self._instructions())._last();
  36994. return $1;
  36995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36996. }, function($ctx1) {$ctx1.fill(self,"sequence",{},globals.IRClosure)});
  36997. //>>excludeEnd("ctx");
  36998. },
  36999. //>>excludeStart("ide", pragmas.excludeIdeData);
  37000. args: [],
  37001. source: "sequence\x0a\x09^ self instructions last",
  37002. referencedClasses: [],
  37003. //>>excludeEnd("ide");
  37004. messageSends: ["last", "instructions"]
  37005. }),
  37006. globals.IRClosure);
  37007. smalltalk.addClass('IRMethod', globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  37008. //>>excludeStart("ide", pragmas.excludeIdeData);
  37009. globals.IRMethod.comment="I am a method instruction";
  37010. //>>excludeEnd("ide");
  37011. smalltalk.addMethod(
  37012. smalltalk.method({
  37013. selector: "accept:",
  37014. protocol: 'visiting',
  37015. fn: function (aVisitor){
  37016. var self=this;
  37017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37018. return smalltalk.withContext(function($ctx1) {
  37019. //>>excludeEnd("ctx");
  37020. var $1;
  37021. $1=_st(aVisitor)._visitIRMethod_(self);
  37022. return $1;
  37023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37024. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRMethod)});
  37025. //>>excludeEnd("ctx");
  37026. },
  37027. //>>excludeStart("ide", pragmas.excludeIdeData);
  37028. args: ["aVisitor"],
  37029. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  37030. referencedClasses: [],
  37031. //>>excludeEnd("ide");
  37032. messageSends: ["visitIRMethod:"]
  37033. }),
  37034. globals.IRMethod);
  37035. smalltalk.addMethod(
  37036. smalltalk.method({
  37037. selector: "classReferences",
  37038. protocol: 'accessing',
  37039. fn: function (){
  37040. var self=this;
  37041. var $1;
  37042. $1=self["@classReferences"];
  37043. return $1;
  37044. },
  37045. //>>excludeStart("ide", pragmas.excludeIdeData);
  37046. args: [],
  37047. source: "classReferences\x0a\x09^ classReferences",
  37048. referencedClasses: [],
  37049. //>>excludeEnd("ide");
  37050. messageSends: []
  37051. }),
  37052. globals.IRMethod);
  37053. smalltalk.addMethod(
  37054. smalltalk.method({
  37055. selector: "classReferences:",
  37056. protocol: 'accessing',
  37057. fn: function (aCollection){
  37058. var self=this;
  37059. self["@classReferences"]=aCollection;
  37060. return self;
  37061. },
  37062. //>>excludeStart("ide", pragmas.excludeIdeData);
  37063. args: ["aCollection"],
  37064. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  37065. referencedClasses: [],
  37066. //>>excludeEnd("ide");
  37067. messageSends: []
  37068. }),
  37069. globals.IRMethod);
  37070. smalltalk.addMethod(
  37071. smalltalk.method({
  37072. selector: "internalVariables",
  37073. protocol: 'accessing',
  37074. fn: function (){
  37075. var self=this;
  37076. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  37077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37078. return smalltalk.withContext(function($ctx1) {
  37079. //>>excludeEnd("ctx");
  37080. var $2,$1,$receiver;
  37081. $2=self["@internalVariables"];
  37082. if(($receiver = $2) == null || $receiver.isNil){
  37083. self["@internalVariables"]=_st($Set())._new();
  37084. $1=self["@internalVariables"];
  37085. } else {
  37086. $1=$2;
  37087. };
  37088. return $1;
  37089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37090. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRMethod)});
  37091. //>>excludeEnd("ctx");
  37092. },
  37093. //>>excludeStart("ide", pragmas.excludeIdeData);
  37094. args: [],
  37095. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  37096. referencedClasses: ["Set"],
  37097. //>>excludeEnd("ide");
  37098. messageSends: ["ifNil:", "new"]
  37099. }),
  37100. globals.IRMethod);
  37101. smalltalk.addMethod(
  37102. smalltalk.method({
  37103. selector: "isMethod",
  37104. protocol: 'accessing',
  37105. fn: function (){
  37106. var self=this;
  37107. return true;
  37108. },
  37109. //>>excludeStart("ide", pragmas.excludeIdeData);
  37110. args: [],
  37111. source: "isMethod\x0a\x09^ true",
  37112. referencedClasses: [],
  37113. //>>excludeEnd("ide");
  37114. messageSends: []
  37115. }),
  37116. globals.IRMethod);
  37117. smalltalk.addMethod(
  37118. smalltalk.method({
  37119. selector: "messageSends",
  37120. protocol: 'accessing',
  37121. fn: function (){
  37122. var self=this;
  37123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37124. return smalltalk.withContext(function($ctx1) {
  37125. //>>excludeEnd("ctx");
  37126. var $1;
  37127. $1=_st(self._sendIndexes())._keys();
  37128. return $1;
  37129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37130. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.IRMethod)});
  37131. //>>excludeEnd("ctx");
  37132. },
  37133. //>>excludeStart("ide", pragmas.excludeIdeData);
  37134. args: [],
  37135. source: "messageSends\x0a\x09^ self sendIndexes keys",
  37136. referencedClasses: [],
  37137. //>>excludeEnd("ide");
  37138. messageSends: ["keys", "sendIndexes"]
  37139. }),
  37140. globals.IRMethod);
  37141. smalltalk.addMethod(
  37142. smalltalk.method({
  37143. selector: "method",
  37144. protocol: 'accessing',
  37145. fn: function (){
  37146. var self=this;
  37147. return self;
  37148. },
  37149. //>>excludeStart("ide", pragmas.excludeIdeData);
  37150. args: [],
  37151. source: "method\x0a\x09^ self",
  37152. referencedClasses: [],
  37153. //>>excludeEnd("ide");
  37154. messageSends: []
  37155. }),
  37156. globals.IRMethod);
  37157. smalltalk.addMethod(
  37158. smalltalk.method({
  37159. selector: "selector",
  37160. protocol: 'accessing',
  37161. fn: function (){
  37162. var self=this;
  37163. var $1;
  37164. $1=self["@selector"];
  37165. return $1;
  37166. },
  37167. //>>excludeStart("ide", pragmas.excludeIdeData);
  37168. args: [],
  37169. source: "selector\x0a\x09^ selector",
  37170. referencedClasses: [],
  37171. //>>excludeEnd("ide");
  37172. messageSends: []
  37173. }),
  37174. globals.IRMethod);
  37175. smalltalk.addMethod(
  37176. smalltalk.method({
  37177. selector: "selector:",
  37178. protocol: 'accessing',
  37179. fn: function (aString){
  37180. var self=this;
  37181. self["@selector"]=aString;
  37182. return self;
  37183. },
  37184. //>>excludeStart("ide", pragmas.excludeIdeData);
  37185. args: ["aString"],
  37186. source: "selector: aString\x0a\x09selector := aString",
  37187. referencedClasses: [],
  37188. //>>excludeEnd("ide");
  37189. messageSends: []
  37190. }),
  37191. globals.IRMethod);
  37192. smalltalk.addMethod(
  37193. smalltalk.method({
  37194. selector: "sendIndexes",
  37195. protocol: 'accessing',
  37196. fn: function (){
  37197. var self=this;
  37198. var $1;
  37199. $1=self["@sendIndexes"];
  37200. return $1;
  37201. },
  37202. //>>excludeStart("ide", pragmas.excludeIdeData);
  37203. args: [],
  37204. source: "sendIndexes\x0a\x09^ sendIndexes",
  37205. referencedClasses: [],
  37206. //>>excludeEnd("ide");
  37207. messageSends: []
  37208. }),
  37209. globals.IRMethod);
  37210. smalltalk.addMethod(
  37211. smalltalk.method({
  37212. selector: "sendIndexes:",
  37213. protocol: 'accessing',
  37214. fn: function (aDictionary){
  37215. var self=this;
  37216. self["@sendIndexes"]=aDictionary;
  37217. return self;
  37218. },
  37219. //>>excludeStart("ide", pragmas.excludeIdeData);
  37220. args: ["aDictionary"],
  37221. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  37222. referencedClasses: [],
  37223. //>>excludeEnd("ide");
  37224. messageSends: []
  37225. }),
  37226. globals.IRMethod);
  37227. smalltalk.addMethod(
  37228. smalltalk.method({
  37229. selector: "source",
  37230. protocol: 'accessing',
  37231. fn: function (){
  37232. var self=this;
  37233. var $1;
  37234. $1=self["@source"];
  37235. return $1;
  37236. },
  37237. //>>excludeStart("ide", pragmas.excludeIdeData);
  37238. args: [],
  37239. source: "source\x0a\x09^ source",
  37240. referencedClasses: [],
  37241. //>>excludeEnd("ide");
  37242. messageSends: []
  37243. }),
  37244. globals.IRMethod);
  37245. smalltalk.addMethod(
  37246. smalltalk.method({
  37247. selector: "source:",
  37248. protocol: 'accessing',
  37249. fn: function (aString){
  37250. var self=this;
  37251. self["@source"]=aString;
  37252. return self;
  37253. },
  37254. //>>excludeStart("ide", pragmas.excludeIdeData);
  37255. args: ["aString"],
  37256. source: "source: aString\x0a\x09source := aString",
  37257. referencedClasses: [],
  37258. //>>excludeEnd("ide");
  37259. messageSends: []
  37260. }),
  37261. globals.IRMethod);
  37262. smalltalk.addMethod(
  37263. smalltalk.method({
  37264. selector: "superSends",
  37265. protocol: 'accessing',
  37266. fn: function (){
  37267. var self=this;
  37268. var $1;
  37269. $1=self["@superSends"];
  37270. return $1;
  37271. },
  37272. //>>excludeStart("ide", pragmas.excludeIdeData);
  37273. args: [],
  37274. source: "superSends\x0a\x09^ superSends",
  37275. referencedClasses: [],
  37276. //>>excludeEnd("ide");
  37277. messageSends: []
  37278. }),
  37279. globals.IRMethod);
  37280. smalltalk.addMethod(
  37281. smalltalk.method({
  37282. selector: "superSends:",
  37283. protocol: 'accessing',
  37284. fn: function (aCollection){
  37285. var self=this;
  37286. self["@superSends"]=aCollection;
  37287. return self;
  37288. },
  37289. //>>excludeStart("ide", pragmas.excludeIdeData);
  37290. args: ["aCollection"],
  37291. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  37292. referencedClasses: [],
  37293. //>>excludeEnd("ide");
  37294. messageSends: []
  37295. }),
  37296. globals.IRMethod);
  37297. smalltalk.addMethod(
  37298. smalltalk.method({
  37299. selector: "theClass",
  37300. protocol: 'accessing',
  37301. fn: function (){
  37302. var self=this;
  37303. var $1;
  37304. $1=self["@theClass"];
  37305. return $1;
  37306. },
  37307. //>>excludeStart("ide", pragmas.excludeIdeData);
  37308. args: [],
  37309. source: "theClass\x0a\x09^ theClass",
  37310. referencedClasses: [],
  37311. //>>excludeEnd("ide");
  37312. messageSends: []
  37313. }),
  37314. globals.IRMethod);
  37315. smalltalk.addMethod(
  37316. smalltalk.method({
  37317. selector: "theClass:",
  37318. protocol: 'accessing',
  37319. fn: function (aClass){
  37320. var self=this;
  37321. self["@theClass"]=aClass;
  37322. return self;
  37323. },
  37324. //>>excludeStart("ide", pragmas.excludeIdeData);
  37325. args: ["aClass"],
  37326. source: "theClass: aClass\x0a\x09theClass := aClass",
  37327. referencedClasses: [],
  37328. //>>excludeEnd("ide");
  37329. messageSends: []
  37330. }),
  37331. globals.IRMethod);
  37332. smalltalk.addClass('IRReturn', globals.IRScopedInstruction, [], 'Compiler-IR');
  37333. //>>excludeStart("ide", pragmas.excludeIdeData);
  37334. globals.IRReturn.comment="I am a local return instruction.";
  37335. //>>excludeEnd("ide");
  37336. smalltalk.addMethod(
  37337. smalltalk.method({
  37338. selector: "accept:",
  37339. protocol: 'visiting',
  37340. fn: function (aVisitor){
  37341. var self=this;
  37342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37343. return smalltalk.withContext(function($ctx1) {
  37344. //>>excludeEnd("ctx");
  37345. var $1;
  37346. $1=_st(aVisitor)._visitIRReturn_(self);
  37347. return $1;
  37348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37349. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRReturn)});
  37350. //>>excludeEnd("ctx");
  37351. },
  37352. //>>excludeStart("ide", pragmas.excludeIdeData);
  37353. args: ["aVisitor"],
  37354. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  37355. referencedClasses: [],
  37356. //>>excludeEnd("ide");
  37357. messageSends: ["visitIRReturn:"]
  37358. }),
  37359. globals.IRReturn);
  37360. smalltalk.addMethod(
  37361. smalltalk.method({
  37362. selector: "canBeAssigned",
  37363. protocol: 'testing',
  37364. fn: function (){
  37365. var self=this;
  37366. return false;
  37367. },
  37368. //>>excludeStart("ide", pragmas.excludeIdeData);
  37369. args: [],
  37370. source: "canBeAssigned\x0a\x09^ false",
  37371. referencedClasses: [],
  37372. //>>excludeEnd("ide");
  37373. messageSends: []
  37374. }),
  37375. globals.IRReturn);
  37376. smalltalk.addMethod(
  37377. smalltalk.method({
  37378. selector: "isBlockReturn",
  37379. protocol: 'testing',
  37380. fn: function (){
  37381. var self=this;
  37382. return false;
  37383. },
  37384. //>>excludeStart("ide", pragmas.excludeIdeData);
  37385. args: [],
  37386. source: "isBlockReturn\x0a\x09^ false",
  37387. referencedClasses: [],
  37388. //>>excludeEnd("ide");
  37389. messageSends: []
  37390. }),
  37391. globals.IRReturn);
  37392. smalltalk.addMethod(
  37393. smalltalk.method({
  37394. selector: "isLocalReturn",
  37395. protocol: 'testing',
  37396. fn: function (){
  37397. var self=this;
  37398. return true;
  37399. },
  37400. //>>excludeStart("ide", pragmas.excludeIdeData);
  37401. args: [],
  37402. source: "isLocalReturn\x0a\x09^ true",
  37403. referencedClasses: [],
  37404. //>>excludeEnd("ide");
  37405. messageSends: []
  37406. }),
  37407. globals.IRReturn);
  37408. smalltalk.addMethod(
  37409. smalltalk.method({
  37410. selector: "isNonLocalReturn",
  37411. protocol: 'testing',
  37412. fn: function (){
  37413. var self=this;
  37414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37415. return smalltalk.withContext(function($ctx1) {
  37416. //>>excludeEnd("ctx");
  37417. var $1;
  37418. $1=_st(self._isLocalReturn())._not();
  37419. return $1;
  37420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37421. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},globals.IRReturn)});
  37422. //>>excludeEnd("ctx");
  37423. },
  37424. //>>excludeStart("ide", pragmas.excludeIdeData);
  37425. args: [],
  37426. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  37427. referencedClasses: [],
  37428. //>>excludeEnd("ide");
  37429. messageSends: ["not", "isLocalReturn"]
  37430. }),
  37431. globals.IRReturn);
  37432. smalltalk.addMethod(
  37433. smalltalk.method({
  37434. selector: "isReturn",
  37435. protocol: 'testing',
  37436. fn: function (){
  37437. var self=this;
  37438. return true;
  37439. },
  37440. //>>excludeStart("ide", pragmas.excludeIdeData);
  37441. args: [],
  37442. source: "isReturn\x0a\x09^ true",
  37443. referencedClasses: [],
  37444. //>>excludeEnd("ide");
  37445. messageSends: []
  37446. }),
  37447. globals.IRReturn);
  37448. smalltalk.addMethod(
  37449. smalltalk.method({
  37450. selector: "scope",
  37451. protocol: 'accessing',
  37452. fn: function (){
  37453. var self=this;
  37454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37455. return smalltalk.withContext(function($ctx1) {
  37456. //>>excludeEnd("ctx");
  37457. var $2,$1,$receiver;
  37458. $2=self["@scope"];
  37459. if(($receiver = $2) == null || $receiver.isNil){
  37460. $1=_st(self._parent())._scope();
  37461. } else {
  37462. $1=$2;
  37463. };
  37464. return $1;
  37465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37466. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRReturn)});
  37467. //>>excludeEnd("ctx");
  37468. },
  37469. //>>excludeStart("ide", pragmas.excludeIdeData);
  37470. args: [],
  37471. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  37472. referencedClasses: [],
  37473. //>>excludeEnd("ide");
  37474. messageSends: ["ifNil:", "scope", "parent"]
  37475. }),
  37476. globals.IRReturn);
  37477. smalltalk.addClass('IRBlockReturn', globals.IRReturn, [], 'Compiler-IR');
  37478. //>>excludeStart("ide", pragmas.excludeIdeData);
  37479. globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  37480. //>>excludeEnd("ide");
  37481. smalltalk.addMethod(
  37482. smalltalk.method({
  37483. selector: "accept:",
  37484. protocol: 'visiting',
  37485. fn: function (aVisitor){
  37486. var self=this;
  37487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37488. return smalltalk.withContext(function($ctx1) {
  37489. //>>excludeEnd("ctx");
  37490. var $1;
  37491. $1=_st(aVisitor)._visitIRBlockReturn_(self);
  37492. return $1;
  37493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37494. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockReturn)});
  37495. //>>excludeEnd("ctx");
  37496. },
  37497. //>>excludeStart("ide", pragmas.excludeIdeData);
  37498. args: ["aVisitor"],
  37499. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37500. referencedClasses: [],
  37501. //>>excludeEnd("ide");
  37502. messageSends: ["visitIRBlockReturn:"]
  37503. }),
  37504. globals.IRBlockReturn);
  37505. smalltalk.addMethod(
  37506. smalltalk.method({
  37507. selector: "isBlockReturn",
  37508. protocol: 'testing',
  37509. fn: function (){
  37510. var self=this;
  37511. return true;
  37512. },
  37513. //>>excludeStart("ide", pragmas.excludeIdeData);
  37514. args: [],
  37515. source: "isBlockReturn\x0a\x09^ true",
  37516. referencedClasses: [],
  37517. //>>excludeEnd("ide");
  37518. messageSends: []
  37519. }),
  37520. globals.IRBlockReturn);
  37521. smalltalk.addClass('IRNonLocalReturn', globals.IRReturn, [], 'Compiler-IR');
  37522. //>>excludeStart("ide", pragmas.excludeIdeData);
  37523. globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
  37524. //>>excludeEnd("ide");
  37525. smalltalk.addMethod(
  37526. smalltalk.method({
  37527. selector: "accept:",
  37528. protocol: 'visiting',
  37529. fn: function (aVisitor){
  37530. var self=this;
  37531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37532. return smalltalk.withContext(function($ctx1) {
  37533. //>>excludeEnd("ctx");
  37534. var $1;
  37535. $1=_st(aVisitor)._visitIRNonLocalReturn_(self);
  37536. return $1;
  37537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37538. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRNonLocalReturn)});
  37539. //>>excludeEnd("ctx");
  37540. },
  37541. //>>excludeStart("ide", pragmas.excludeIdeData);
  37542. args: ["aVisitor"],
  37543. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37544. referencedClasses: [],
  37545. //>>excludeEnd("ide");
  37546. messageSends: ["visitIRNonLocalReturn:"]
  37547. }),
  37548. globals.IRNonLocalReturn);
  37549. smalltalk.addMethod(
  37550. smalltalk.method({
  37551. selector: "isLocalReturn",
  37552. protocol: 'testing',
  37553. fn: function (){
  37554. var self=this;
  37555. return false;
  37556. },
  37557. //>>excludeStart("ide", pragmas.excludeIdeData);
  37558. args: [],
  37559. source: "isLocalReturn\x0a\x09^ false",
  37560. referencedClasses: [],
  37561. //>>excludeEnd("ide");
  37562. messageSends: []
  37563. }),
  37564. globals.IRNonLocalReturn);
  37565. smalltalk.addClass('IRTempDeclaration', globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37566. smalltalk.addMethod(
  37567. smalltalk.method({
  37568. selector: "accept:",
  37569. protocol: 'visiting',
  37570. fn: function (aVisitor){
  37571. var self=this;
  37572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37573. return smalltalk.withContext(function($ctx1) {
  37574. //>>excludeEnd("ctx");
  37575. var $1;
  37576. $1=_st(aVisitor)._visitIRTempDeclaration_(self);
  37577. return $1;
  37578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37579. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRTempDeclaration)});
  37580. //>>excludeEnd("ctx");
  37581. },
  37582. //>>excludeStart("ide", pragmas.excludeIdeData);
  37583. args: ["aVisitor"],
  37584. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  37585. referencedClasses: [],
  37586. //>>excludeEnd("ide");
  37587. messageSends: ["visitIRTempDeclaration:"]
  37588. }),
  37589. globals.IRTempDeclaration);
  37590. smalltalk.addMethod(
  37591. smalltalk.method({
  37592. selector: "isTempDeclaration",
  37593. protocol: 'testing',
  37594. fn: function (){
  37595. var self=this;
  37596. return true;
  37597. },
  37598. //>>excludeStart("ide", pragmas.excludeIdeData);
  37599. args: [],
  37600. source: "isTempDeclaration\x0a\x09^ true",
  37601. referencedClasses: [],
  37602. //>>excludeEnd("ide");
  37603. messageSends: []
  37604. }),
  37605. globals.IRTempDeclaration);
  37606. smalltalk.addMethod(
  37607. smalltalk.method({
  37608. selector: "name",
  37609. protocol: 'accessing',
  37610. fn: function (){
  37611. var self=this;
  37612. var $1;
  37613. $1=self["@name"];
  37614. return $1;
  37615. },
  37616. //>>excludeStart("ide", pragmas.excludeIdeData);
  37617. args: [],
  37618. source: "name\x0a\x09^ name",
  37619. referencedClasses: [],
  37620. //>>excludeEnd("ide");
  37621. messageSends: []
  37622. }),
  37623. globals.IRTempDeclaration);
  37624. smalltalk.addMethod(
  37625. smalltalk.method({
  37626. selector: "name:",
  37627. protocol: 'accessing',
  37628. fn: function (aString){
  37629. var self=this;
  37630. self["@name"]=aString;
  37631. return self;
  37632. },
  37633. //>>excludeStart("ide", pragmas.excludeIdeData);
  37634. args: ["aString"],
  37635. source: "name: aString\x0a\x09name := aString",
  37636. referencedClasses: [],
  37637. //>>excludeEnd("ide");
  37638. messageSends: []
  37639. }),
  37640. globals.IRTempDeclaration);
  37641. smalltalk.addClass('IRSend', globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  37642. //>>excludeStart("ide", pragmas.excludeIdeData);
  37643. globals.IRSend.comment="I am a message send instruction.";
  37644. //>>excludeEnd("ide");
  37645. smalltalk.addMethod(
  37646. smalltalk.method({
  37647. selector: "accept:",
  37648. protocol: 'visiting',
  37649. fn: function (aVisitor){
  37650. var self=this;
  37651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37652. return smalltalk.withContext(function($ctx1) {
  37653. //>>excludeEnd("ctx");
  37654. var $1;
  37655. $1=_st(aVisitor)._visitIRSend_(self);
  37656. return $1;
  37657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37658. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSend)});
  37659. //>>excludeEnd("ctx");
  37660. },
  37661. //>>excludeStart("ide", pragmas.excludeIdeData);
  37662. args: ["aVisitor"],
  37663. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37664. referencedClasses: [],
  37665. //>>excludeEnd("ide");
  37666. messageSends: ["visitIRSend:"]
  37667. }),
  37668. globals.IRSend);
  37669. smalltalk.addMethod(
  37670. smalltalk.method({
  37671. selector: "classSend",
  37672. protocol: 'accessing',
  37673. fn: function (){
  37674. var self=this;
  37675. var $1;
  37676. $1=self["@classSend"];
  37677. return $1;
  37678. },
  37679. //>>excludeStart("ide", pragmas.excludeIdeData);
  37680. args: [],
  37681. source: "classSend\x0a\x09^ classSend",
  37682. referencedClasses: [],
  37683. //>>excludeEnd("ide");
  37684. messageSends: []
  37685. }),
  37686. globals.IRSend);
  37687. smalltalk.addMethod(
  37688. smalltalk.method({
  37689. selector: "classSend:",
  37690. protocol: 'accessing',
  37691. fn: function (aClass){
  37692. var self=this;
  37693. self["@classSend"]=aClass;
  37694. return self;
  37695. },
  37696. //>>excludeStart("ide", pragmas.excludeIdeData);
  37697. args: ["aClass"],
  37698. source: "classSend: aClass\x0a\x09classSend := aClass",
  37699. referencedClasses: [],
  37700. //>>excludeEnd("ide");
  37701. messageSends: []
  37702. }),
  37703. globals.IRSend);
  37704. smalltalk.addMethod(
  37705. smalltalk.method({
  37706. selector: "index",
  37707. protocol: 'accessing',
  37708. fn: function (){
  37709. var self=this;
  37710. var $1;
  37711. $1=self["@index"];
  37712. return $1;
  37713. },
  37714. //>>excludeStart("ide", pragmas.excludeIdeData);
  37715. args: [],
  37716. source: "index\x0a\x09^ index",
  37717. referencedClasses: [],
  37718. //>>excludeEnd("ide");
  37719. messageSends: []
  37720. }),
  37721. globals.IRSend);
  37722. smalltalk.addMethod(
  37723. smalltalk.method({
  37724. selector: "index:",
  37725. protocol: 'accessing',
  37726. fn: function (anInteger){
  37727. var self=this;
  37728. self["@index"]=anInteger;
  37729. return self;
  37730. },
  37731. //>>excludeStart("ide", pragmas.excludeIdeData);
  37732. args: ["anInteger"],
  37733. source: "index: anInteger\x0a\x09index := anInteger",
  37734. referencedClasses: [],
  37735. //>>excludeEnd("ide");
  37736. messageSends: []
  37737. }),
  37738. globals.IRSend);
  37739. smalltalk.addMethod(
  37740. smalltalk.method({
  37741. selector: "isSend",
  37742. protocol: 'testing',
  37743. fn: function (){
  37744. var self=this;
  37745. return true;
  37746. },
  37747. //>>excludeStart("ide", pragmas.excludeIdeData);
  37748. args: [],
  37749. source: "isSend\x0a\x09^ true",
  37750. referencedClasses: [],
  37751. //>>excludeEnd("ide");
  37752. messageSends: []
  37753. }),
  37754. globals.IRSend);
  37755. smalltalk.addMethod(
  37756. smalltalk.method({
  37757. selector: "selector",
  37758. protocol: 'accessing',
  37759. fn: function (){
  37760. var self=this;
  37761. var $1;
  37762. $1=self["@selector"];
  37763. return $1;
  37764. },
  37765. //>>excludeStart("ide", pragmas.excludeIdeData);
  37766. args: [],
  37767. source: "selector\x0a\x09^ selector",
  37768. referencedClasses: [],
  37769. //>>excludeEnd("ide");
  37770. messageSends: []
  37771. }),
  37772. globals.IRSend);
  37773. smalltalk.addMethod(
  37774. smalltalk.method({
  37775. selector: "selector:",
  37776. protocol: 'accessing',
  37777. fn: function (aString){
  37778. var self=this;
  37779. self["@selector"]=aString;
  37780. return self;
  37781. },
  37782. //>>excludeStart("ide", pragmas.excludeIdeData);
  37783. args: ["aString"],
  37784. source: "selector: aString\x0a\x09selector := aString",
  37785. referencedClasses: [],
  37786. //>>excludeEnd("ide");
  37787. messageSends: []
  37788. }),
  37789. globals.IRSend);
  37790. smalltalk.addClass('IRSequence', globals.IRInstruction, [], 'Compiler-IR');
  37791. smalltalk.addMethod(
  37792. smalltalk.method({
  37793. selector: "accept:",
  37794. protocol: 'visiting',
  37795. fn: function (aVisitor){
  37796. var self=this;
  37797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37798. return smalltalk.withContext(function($ctx1) {
  37799. //>>excludeEnd("ctx");
  37800. var $1;
  37801. $1=_st(aVisitor)._visitIRSequence_(self);
  37802. return $1;
  37803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37804. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSequence)});
  37805. //>>excludeEnd("ctx");
  37806. },
  37807. //>>excludeStart("ide", pragmas.excludeIdeData);
  37808. args: ["aVisitor"],
  37809. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  37810. referencedClasses: [],
  37811. //>>excludeEnd("ide");
  37812. messageSends: ["visitIRSequence:"]
  37813. }),
  37814. globals.IRSequence);
  37815. smalltalk.addMethod(
  37816. smalltalk.method({
  37817. selector: "isSequence",
  37818. protocol: 'testing',
  37819. fn: function (){
  37820. var self=this;
  37821. return true;
  37822. },
  37823. //>>excludeStart("ide", pragmas.excludeIdeData);
  37824. args: [],
  37825. source: "isSequence\x0a\x09^ true",
  37826. referencedClasses: [],
  37827. //>>excludeEnd("ide");
  37828. messageSends: []
  37829. }),
  37830. globals.IRSequence);
  37831. smalltalk.addClass('IRBlockSequence', globals.IRSequence, [], 'Compiler-IR');
  37832. smalltalk.addMethod(
  37833. smalltalk.method({
  37834. selector: "accept:",
  37835. protocol: 'visiting',
  37836. fn: function (aVisitor){
  37837. var self=this;
  37838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37839. return smalltalk.withContext(function($ctx1) {
  37840. //>>excludeEnd("ctx");
  37841. var $1;
  37842. $1=_st(aVisitor)._visitIRBlockSequence_(self);
  37843. return $1;
  37844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37845. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockSequence)});
  37846. //>>excludeEnd("ctx");
  37847. },
  37848. //>>excludeStart("ide", pragmas.excludeIdeData);
  37849. args: ["aVisitor"],
  37850. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  37851. referencedClasses: [],
  37852. //>>excludeEnd("ide");
  37853. messageSends: ["visitIRBlockSequence:"]
  37854. }),
  37855. globals.IRBlockSequence);
  37856. smalltalk.addClass('IRValue', globals.IRInstruction, ['value'], 'Compiler-IR');
  37857. //>>excludeStart("ide", pragmas.excludeIdeData);
  37858. globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  37859. //>>excludeEnd("ide");
  37860. smalltalk.addMethod(
  37861. smalltalk.method({
  37862. selector: "accept:",
  37863. protocol: 'visiting',
  37864. fn: function (aVisitor){
  37865. var self=this;
  37866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37867. return smalltalk.withContext(function($ctx1) {
  37868. //>>excludeEnd("ctx");
  37869. var $1;
  37870. $1=_st(aVisitor)._visitIRValue_(self);
  37871. return $1;
  37872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37873. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRValue)});
  37874. //>>excludeEnd("ctx");
  37875. },
  37876. //>>excludeStart("ide", pragmas.excludeIdeData);
  37877. args: ["aVisitor"],
  37878. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  37879. referencedClasses: [],
  37880. //>>excludeEnd("ide");
  37881. messageSends: ["visitIRValue:"]
  37882. }),
  37883. globals.IRValue);
  37884. smalltalk.addMethod(
  37885. smalltalk.method({
  37886. selector: "needsBoxingAsReceiver",
  37887. protocol: 'testing',
  37888. fn: function (){
  37889. var self=this;
  37890. return false;
  37891. },
  37892. //>>excludeStart("ide", pragmas.excludeIdeData);
  37893. args: [],
  37894. source: "needsBoxingAsReceiver\x0a\x09^ false",
  37895. referencedClasses: [],
  37896. //>>excludeEnd("ide");
  37897. messageSends: []
  37898. }),
  37899. globals.IRValue);
  37900. smalltalk.addMethod(
  37901. smalltalk.method({
  37902. selector: "value",
  37903. protocol: 'accessing',
  37904. fn: function (){
  37905. var self=this;
  37906. var $1;
  37907. $1=self["@value"];
  37908. return $1;
  37909. },
  37910. //>>excludeStart("ide", pragmas.excludeIdeData);
  37911. args: [],
  37912. source: "value\x0a\x09^ value",
  37913. referencedClasses: [],
  37914. //>>excludeEnd("ide");
  37915. messageSends: []
  37916. }),
  37917. globals.IRValue);
  37918. smalltalk.addMethod(
  37919. smalltalk.method({
  37920. selector: "value:",
  37921. protocol: 'accessing',
  37922. fn: function (aString){
  37923. var self=this;
  37924. self["@value"]=aString;
  37925. return self;
  37926. },
  37927. //>>excludeStart("ide", pragmas.excludeIdeData);
  37928. args: ["aString"],
  37929. source: "value: aString\x0a\x09value := aString",
  37930. referencedClasses: [],
  37931. //>>excludeEnd("ide");
  37932. messageSends: []
  37933. }),
  37934. globals.IRValue);
  37935. smalltalk.addClass('IRVariable', globals.IRInstruction, ['variable'], 'Compiler-IR');
  37936. //>>excludeStart("ide", pragmas.excludeIdeData);
  37937. globals.IRVariable.comment="I am a variable instruction.";
  37938. //>>excludeEnd("ide");
  37939. smalltalk.addMethod(
  37940. smalltalk.method({
  37941. selector: "accept:",
  37942. protocol: 'visiting',
  37943. fn: function (aVisitor){
  37944. var self=this;
  37945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37946. return smalltalk.withContext(function($ctx1) {
  37947. //>>excludeEnd("ctx");
  37948. var $1;
  37949. $1=_st(aVisitor)._visitIRVariable_(self);
  37950. return $1;
  37951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37952. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVariable)});
  37953. //>>excludeEnd("ctx");
  37954. },
  37955. //>>excludeStart("ide", pragmas.excludeIdeData);
  37956. args: ["aVisitor"],
  37957. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  37958. referencedClasses: [],
  37959. //>>excludeEnd("ide");
  37960. messageSends: ["visitIRVariable:"]
  37961. }),
  37962. globals.IRVariable);
  37963. smalltalk.addMethod(
  37964. smalltalk.method({
  37965. selector: "isVariable",
  37966. protocol: 'testing',
  37967. fn: function (){
  37968. var self=this;
  37969. return true;
  37970. },
  37971. //>>excludeStart("ide", pragmas.excludeIdeData);
  37972. args: [],
  37973. source: "isVariable\x0a\x09^ true",
  37974. referencedClasses: [],
  37975. //>>excludeEnd("ide");
  37976. messageSends: []
  37977. }),
  37978. globals.IRVariable);
  37979. smalltalk.addMethod(
  37980. smalltalk.method({
  37981. selector: "needsBoxingAsReceiver",
  37982. protocol: 'testing',
  37983. fn: function (){
  37984. var self=this;
  37985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37986. return smalltalk.withContext(function($ctx1) {
  37987. //>>excludeEnd("ctx");
  37988. var $1;
  37989. $1=_st(_st(self._variable())._isPseudoVar())._not();
  37990. return $1;
  37991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37992. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},globals.IRVariable)});
  37993. //>>excludeEnd("ctx");
  37994. },
  37995. //>>excludeStart("ide", pragmas.excludeIdeData);
  37996. args: [],
  37997. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  37998. referencedClasses: [],
  37999. //>>excludeEnd("ide");
  38000. messageSends: ["not", "isPseudoVar", "variable"]
  38001. }),
  38002. globals.IRVariable);
  38003. smalltalk.addMethod(
  38004. smalltalk.method({
  38005. selector: "variable",
  38006. protocol: 'accessing',
  38007. fn: function (){
  38008. var self=this;
  38009. var $1;
  38010. $1=self["@variable"];
  38011. return $1;
  38012. },
  38013. //>>excludeStart("ide", pragmas.excludeIdeData);
  38014. args: [],
  38015. source: "variable\x0a\x09^ variable",
  38016. referencedClasses: [],
  38017. //>>excludeEnd("ide");
  38018. messageSends: []
  38019. }),
  38020. globals.IRVariable);
  38021. smalltalk.addMethod(
  38022. smalltalk.method({
  38023. selector: "variable:",
  38024. protocol: 'accessing',
  38025. fn: function (aScopeVariable){
  38026. var self=this;
  38027. self["@variable"]=aScopeVariable;
  38028. return self;
  38029. },
  38030. //>>excludeStart("ide", pragmas.excludeIdeData);
  38031. args: ["aScopeVariable"],
  38032. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  38033. referencedClasses: [],
  38034. //>>excludeEnd("ide");
  38035. messageSends: []
  38036. }),
  38037. globals.IRVariable);
  38038. smalltalk.addClass('IRVerbatim', globals.IRInstruction, ['source'], 'Compiler-IR');
  38039. smalltalk.addMethod(
  38040. smalltalk.method({
  38041. selector: "accept:",
  38042. protocol: 'visiting',
  38043. fn: function (aVisitor){
  38044. var self=this;
  38045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38046. return smalltalk.withContext(function($ctx1) {
  38047. //>>excludeEnd("ctx");
  38048. var $1;
  38049. $1=_st(aVisitor)._visitIRVerbatim_(self);
  38050. return $1;
  38051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38052. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVerbatim)});
  38053. //>>excludeEnd("ctx");
  38054. },
  38055. //>>excludeStart("ide", pragmas.excludeIdeData);
  38056. args: ["aVisitor"],
  38057. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  38058. referencedClasses: [],
  38059. //>>excludeEnd("ide");
  38060. messageSends: ["visitIRVerbatim:"]
  38061. }),
  38062. globals.IRVerbatim);
  38063. smalltalk.addMethod(
  38064. smalltalk.method({
  38065. selector: "source",
  38066. protocol: 'accessing',
  38067. fn: function (){
  38068. var self=this;
  38069. var $1;
  38070. $1=self["@source"];
  38071. return $1;
  38072. },
  38073. //>>excludeStart("ide", pragmas.excludeIdeData);
  38074. args: [],
  38075. source: "source\x0a\x09^ source",
  38076. referencedClasses: [],
  38077. //>>excludeEnd("ide");
  38078. messageSends: []
  38079. }),
  38080. globals.IRVerbatim);
  38081. smalltalk.addMethod(
  38082. smalltalk.method({
  38083. selector: "source:",
  38084. protocol: 'accessing',
  38085. fn: function (aString){
  38086. var self=this;
  38087. self["@source"]=aString;
  38088. return self;
  38089. },
  38090. //>>excludeStart("ide", pragmas.excludeIdeData);
  38091. args: ["aString"],
  38092. source: "source: aString\x0a\x09source := aString",
  38093. referencedClasses: [],
  38094. //>>excludeEnd("ide");
  38095. messageSends: []
  38096. }),
  38097. globals.IRVerbatim);
  38098. smalltalk.addClass('IRVisitor', globals.Object, [], 'Compiler-IR');
  38099. smalltalk.addMethod(
  38100. smalltalk.method({
  38101. selector: "visit:",
  38102. protocol: 'visiting',
  38103. fn: function (anIRInstruction){
  38104. var self=this;
  38105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38106. return smalltalk.withContext(function($ctx1) {
  38107. //>>excludeEnd("ctx");
  38108. var $1;
  38109. $1=_st(anIRInstruction)._accept_(self);
  38110. return $1;
  38111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38112. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},globals.IRVisitor)});
  38113. //>>excludeEnd("ctx");
  38114. },
  38115. //>>excludeStart("ide", pragmas.excludeIdeData);
  38116. args: ["anIRInstruction"],
  38117. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  38118. referencedClasses: [],
  38119. //>>excludeEnd("ide");
  38120. messageSends: ["accept:"]
  38121. }),
  38122. globals.IRVisitor);
  38123. smalltalk.addMethod(
  38124. smalltalk.method({
  38125. selector: "visitIRAssignment:",
  38126. protocol: 'visiting',
  38127. fn: function (anIRAssignment){
  38128. var self=this;
  38129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38130. return smalltalk.withContext(function($ctx1) {
  38131. //>>excludeEnd("ctx");
  38132. var $1;
  38133. $1=self._visitIRInstruction_(anIRAssignment);
  38134. return $1;
  38135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38136. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRVisitor)});
  38137. //>>excludeEnd("ctx");
  38138. },
  38139. //>>excludeStart("ide", pragmas.excludeIdeData);
  38140. args: ["anIRAssignment"],
  38141. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  38142. referencedClasses: [],
  38143. //>>excludeEnd("ide");
  38144. messageSends: ["visitIRInstruction:"]
  38145. }),
  38146. globals.IRVisitor);
  38147. smalltalk.addMethod(
  38148. smalltalk.method({
  38149. selector: "visitIRBlockReturn:",
  38150. protocol: 'visiting',
  38151. fn: function (anIRBlockReturn){
  38152. var self=this;
  38153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38154. return smalltalk.withContext(function($ctx1) {
  38155. //>>excludeEnd("ctx");
  38156. var $1;
  38157. $1=self._visitIRReturn_(anIRBlockReturn);
  38158. return $1;
  38159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38160. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},globals.IRVisitor)});
  38161. //>>excludeEnd("ctx");
  38162. },
  38163. //>>excludeStart("ide", pragmas.excludeIdeData);
  38164. args: ["anIRBlockReturn"],
  38165. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  38166. referencedClasses: [],
  38167. //>>excludeEnd("ide");
  38168. messageSends: ["visitIRReturn:"]
  38169. }),
  38170. globals.IRVisitor);
  38171. smalltalk.addMethod(
  38172. smalltalk.method({
  38173. selector: "visitIRBlockSequence:",
  38174. protocol: 'visiting',
  38175. fn: function (anIRBlockSequence){
  38176. var self=this;
  38177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38178. return smalltalk.withContext(function($ctx1) {
  38179. //>>excludeEnd("ctx");
  38180. var $1;
  38181. $1=self._visitIRSequence_(anIRBlockSequence);
  38182. return $1;
  38183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38184. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},globals.IRVisitor)});
  38185. //>>excludeEnd("ctx");
  38186. },
  38187. //>>excludeStart("ide", pragmas.excludeIdeData);
  38188. args: ["anIRBlockSequence"],
  38189. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  38190. referencedClasses: [],
  38191. //>>excludeEnd("ide");
  38192. messageSends: ["visitIRSequence:"]
  38193. }),
  38194. globals.IRVisitor);
  38195. smalltalk.addMethod(
  38196. smalltalk.method({
  38197. selector: "visitIRClosure:",
  38198. protocol: 'visiting',
  38199. fn: function (anIRClosure){
  38200. var self=this;
  38201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38202. return smalltalk.withContext(function($ctx1) {
  38203. //>>excludeEnd("ctx");
  38204. var $1;
  38205. $1=self._visitIRInstruction_(anIRClosure);
  38206. return $1;
  38207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38208. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRVisitor)});
  38209. //>>excludeEnd("ctx");
  38210. },
  38211. //>>excludeStart("ide", pragmas.excludeIdeData);
  38212. args: ["anIRClosure"],
  38213. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  38214. referencedClasses: [],
  38215. //>>excludeEnd("ide");
  38216. messageSends: ["visitIRInstruction:"]
  38217. }),
  38218. globals.IRVisitor);
  38219. smalltalk.addMethod(
  38220. smalltalk.method({
  38221. selector: "visitIRDynamicArray:",
  38222. protocol: 'visiting',
  38223. fn: function (anIRDynamicArray){
  38224. var self=this;
  38225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38226. return smalltalk.withContext(function($ctx1) {
  38227. //>>excludeEnd("ctx");
  38228. var $1;
  38229. $1=self._visitIRInstruction_(anIRDynamicArray);
  38230. return $1;
  38231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38232. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRVisitor)});
  38233. //>>excludeEnd("ctx");
  38234. },
  38235. //>>excludeStart("ide", pragmas.excludeIdeData);
  38236. args: ["anIRDynamicArray"],
  38237. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  38238. referencedClasses: [],
  38239. //>>excludeEnd("ide");
  38240. messageSends: ["visitIRInstruction:"]
  38241. }),
  38242. globals.IRVisitor);
  38243. smalltalk.addMethod(
  38244. smalltalk.method({
  38245. selector: "visitIRDynamicDictionary:",
  38246. protocol: 'visiting',
  38247. fn: function (anIRDynamicDictionary){
  38248. var self=this;
  38249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38250. return smalltalk.withContext(function($ctx1) {
  38251. //>>excludeEnd("ctx");
  38252. var $1;
  38253. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  38254. return $1;
  38255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38256. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRVisitor)});
  38257. //>>excludeEnd("ctx");
  38258. },
  38259. //>>excludeStart("ide", pragmas.excludeIdeData);
  38260. args: ["anIRDynamicDictionary"],
  38261. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  38262. referencedClasses: [],
  38263. //>>excludeEnd("ide");
  38264. messageSends: ["visitIRInstruction:"]
  38265. }),
  38266. globals.IRVisitor);
  38267. smalltalk.addMethod(
  38268. smalltalk.method({
  38269. selector: "visitIRInlinedClosure:",
  38270. protocol: 'visiting',
  38271. fn: function (anIRInlinedClosure){
  38272. var self=this;
  38273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38274. return smalltalk.withContext(function($ctx1) {
  38275. //>>excludeEnd("ctx");
  38276. var $1;
  38277. $1=self._visitIRClosure_(anIRInlinedClosure);
  38278. return $1;
  38279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38280. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRVisitor)});
  38281. //>>excludeEnd("ctx");
  38282. },
  38283. //>>excludeStart("ide", pragmas.excludeIdeData);
  38284. args: ["anIRInlinedClosure"],
  38285. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  38286. referencedClasses: [],
  38287. //>>excludeEnd("ide");
  38288. messageSends: ["visitIRClosure:"]
  38289. }),
  38290. globals.IRVisitor);
  38291. smalltalk.addMethod(
  38292. smalltalk.method({
  38293. selector: "visitIRInlinedSequence:",
  38294. protocol: 'visiting',
  38295. fn: function (anIRInlinedSequence){
  38296. var self=this;
  38297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38298. return smalltalk.withContext(function($ctx1) {
  38299. //>>excludeEnd("ctx");
  38300. var $1;
  38301. $1=self._visitIRSequence_(anIRInlinedSequence);
  38302. return $1;
  38303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38304. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRVisitor)});
  38305. //>>excludeEnd("ctx");
  38306. },
  38307. //>>excludeStart("ide", pragmas.excludeIdeData);
  38308. args: ["anIRInlinedSequence"],
  38309. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  38310. referencedClasses: [],
  38311. //>>excludeEnd("ide");
  38312. messageSends: ["visitIRSequence:"]
  38313. }),
  38314. globals.IRVisitor);
  38315. smalltalk.addMethod(
  38316. smalltalk.method({
  38317. selector: "visitIRInstruction:",
  38318. protocol: 'visiting',
  38319. fn: function (anIRInstruction){
  38320. var self=this;
  38321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38322. return smalltalk.withContext(function($ctx1) {
  38323. //>>excludeEnd("ctx");
  38324. _st(_st(anIRInstruction)._instructions())._do_((function(each){
  38325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38326. return smalltalk.withContext(function($ctx2) {
  38327. //>>excludeEnd("ctx");
  38328. return self._visit_(each);
  38329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38331. //>>excludeEnd("ctx");
  38332. }));
  38333. return anIRInstruction;
  38334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38335. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},globals.IRVisitor)});
  38336. //>>excludeEnd("ctx");
  38337. },
  38338. //>>excludeStart("ide", pragmas.excludeIdeData);
  38339. args: ["anIRInstruction"],
  38340. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  38341. referencedClasses: [],
  38342. //>>excludeEnd("ide");
  38343. messageSends: ["do:", "instructions", "visit:"]
  38344. }),
  38345. globals.IRVisitor);
  38346. smalltalk.addMethod(
  38347. smalltalk.method({
  38348. selector: "visitIRMethod:",
  38349. protocol: 'visiting',
  38350. fn: function (anIRMethod){
  38351. var self=this;
  38352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38353. return smalltalk.withContext(function($ctx1) {
  38354. //>>excludeEnd("ctx");
  38355. var $1;
  38356. $1=self._visitIRInstruction_(anIRMethod);
  38357. return $1;
  38358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38359. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRVisitor)});
  38360. //>>excludeEnd("ctx");
  38361. },
  38362. //>>excludeStart("ide", pragmas.excludeIdeData);
  38363. args: ["anIRMethod"],
  38364. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  38365. referencedClasses: [],
  38366. //>>excludeEnd("ide");
  38367. messageSends: ["visitIRInstruction:"]
  38368. }),
  38369. globals.IRVisitor);
  38370. smalltalk.addMethod(
  38371. smalltalk.method({
  38372. selector: "visitIRNonLocalReturn:",
  38373. protocol: 'visiting',
  38374. fn: function (anIRNonLocalReturn){
  38375. var self=this;
  38376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38377. return smalltalk.withContext(function($ctx1) {
  38378. //>>excludeEnd("ctx");
  38379. var $1;
  38380. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  38381. return $1;
  38382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38383. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRVisitor)});
  38384. //>>excludeEnd("ctx");
  38385. },
  38386. //>>excludeStart("ide", pragmas.excludeIdeData);
  38387. args: ["anIRNonLocalReturn"],
  38388. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  38389. referencedClasses: [],
  38390. //>>excludeEnd("ide");
  38391. messageSends: ["visitIRInstruction:"]
  38392. }),
  38393. globals.IRVisitor);
  38394. smalltalk.addMethod(
  38395. smalltalk.method({
  38396. selector: "visitIRNonLocalReturnHandling:",
  38397. protocol: 'visiting',
  38398. fn: function (anIRNonLocalReturnHandling){
  38399. var self=this;
  38400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38401. return smalltalk.withContext(function($ctx1) {
  38402. //>>excludeEnd("ctx");
  38403. var $1;
  38404. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  38405. return $1;
  38406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38407. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},globals.IRVisitor)});
  38408. //>>excludeEnd("ctx");
  38409. },
  38410. //>>excludeStart("ide", pragmas.excludeIdeData);
  38411. args: ["anIRNonLocalReturnHandling"],
  38412. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  38413. referencedClasses: [],
  38414. //>>excludeEnd("ide");
  38415. messageSends: ["visitIRInstruction:"]
  38416. }),
  38417. globals.IRVisitor);
  38418. smalltalk.addMethod(
  38419. smalltalk.method({
  38420. selector: "visitIRReturn:",
  38421. protocol: 'visiting',
  38422. fn: function (anIRReturn){
  38423. var self=this;
  38424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38425. return smalltalk.withContext(function($ctx1) {
  38426. //>>excludeEnd("ctx");
  38427. var $1;
  38428. $1=self._visitIRInstruction_(anIRReturn);
  38429. return $1;
  38430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38431. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRVisitor)});
  38432. //>>excludeEnd("ctx");
  38433. },
  38434. //>>excludeStart("ide", pragmas.excludeIdeData);
  38435. args: ["anIRReturn"],
  38436. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  38437. referencedClasses: [],
  38438. //>>excludeEnd("ide");
  38439. messageSends: ["visitIRInstruction:"]
  38440. }),
  38441. globals.IRVisitor);
  38442. smalltalk.addMethod(
  38443. smalltalk.method({
  38444. selector: "visitIRSend:",
  38445. protocol: 'visiting',
  38446. fn: function (anIRSend){
  38447. var self=this;
  38448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38449. return smalltalk.withContext(function($ctx1) {
  38450. //>>excludeEnd("ctx");
  38451. var $1;
  38452. $1=self._visitIRInstruction_(anIRSend);
  38453. return $1;
  38454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38455. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRVisitor)});
  38456. //>>excludeEnd("ctx");
  38457. },
  38458. //>>excludeStart("ide", pragmas.excludeIdeData);
  38459. args: ["anIRSend"],
  38460. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  38461. referencedClasses: [],
  38462. //>>excludeEnd("ide");
  38463. messageSends: ["visitIRInstruction:"]
  38464. }),
  38465. globals.IRVisitor);
  38466. smalltalk.addMethod(
  38467. smalltalk.method({
  38468. selector: "visitIRSequence:",
  38469. protocol: 'visiting',
  38470. fn: function (anIRSequence){
  38471. var self=this;
  38472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38473. return smalltalk.withContext(function($ctx1) {
  38474. //>>excludeEnd("ctx");
  38475. var $1;
  38476. $1=self._visitIRInstruction_(anIRSequence);
  38477. return $1;
  38478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38479. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRVisitor)});
  38480. //>>excludeEnd("ctx");
  38481. },
  38482. //>>excludeStart("ide", pragmas.excludeIdeData);
  38483. args: ["anIRSequence"],
  38484. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  38485. referencedClasses: [],
  38486. //>>excludeEnd("ide");
  38487. messageSends: ["visitIRInstruction:"]
  38488. }),
  38489. globals.IRVisitor);
  38490. smalltalk.addMethod(
  38491. smalltalk.method({
  38492. selector: "visitIRTempDeclaration:",
  38493. protocol: 'visiting',
  38494. fn: function (anIRTempDeclaration){
  38495. var self=this;
  38496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38497. return smalltalk.withContext(function($ctx1) {
  38498. //>>excludeEnd("ctx");
  38499. var $1;
  38500. $1=self._visitIRInstruction_(anIRTempDeclaration);
  38501. return $1;
  38502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38503. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},globals.IRVisitor)});
  38504. //>>excludeEnd("ctx");
  38505. },
  38506. //>>excludeStart("ide", pragmas.excludeIdeData);
  38507. args: ["anIRTempDeclaration"],
  38508. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  38509. referencedClasses: [],
  38510. //>>excludeEnd("ide");
  38511. messageSends: ["visitIRInstruction:"]
  38512. }),
  38513. globals.IRVisitor);
  38514. smalltalk.addMethod(
  38515. smalltalk.method({
  38516. selector: "visitIRValue:",
  38517. protocol: 'visiting',
  38518. fn: function (anIRValue){
  38519. var self=this;
  38520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38521. return smalltalk.withContext(function($ctx1) {
  38522. //>>excludeEnd("ctx");
  38523. var $1;
  38524. $1=self._visitIRInstruction_(anIRValue);
  38525. return $1;
  38526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38527. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRVisitor)});
  38528. //>>excludeEnd("ctx");
  38529. },
  38530. //>>excludeStart("ide", pragmas.excludeIdeData);
  38531. args: ["anIRValue"],
  38532. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  38533. referencedClasses: [],
  38534. //>>excludeEnd("ide");
  38535. messageSends: ["visitIRInstruction:"]
  38536. }),
  38537. globals.IRVisitor);
  38538. smalltalk.addMethod(
  38539. smalltalk.method({
  38540. selector: "visitIRVariable:",
  38541. protocol: 'visiting',
  38542. fn: function (anIRVariable){
  38543. var self=this;
  38544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38545. return smalltalk.withContext(function($ctx1) {
  38546. //>>excludeEnd("ctx");
  38547. var $1;
  38548. $1=self._visitIRInstruction_(anIRVariable);
  38549. return $1;
  38550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38551. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRVisitor)});
  38552. //>>excludeEnd("ctx");
  38553. },
  38554. //>>excludeStart("ide", pragmas.excludeIdeData);
  38555. args: ["anIRVariable"],
  38556. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  38557. referencedClasses: [],
  38558. //>>excludeEnd("ide");
  38559. messageSends: ["visitIRInstruction:"]
  38560. }),
  38561. globals.IRVisitor);
  38562. smalltalk.addMethod(
  38563. smalltalk.method({
  38564. selector: "visitIRVerbatim:",
  38565. protocol: 'visiting',
  38566. fn: function (anIRVerbatim){
  38567. var self=this;
  38568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38569. return smalltalk.withContext(function($ctx1) {
  38570. //>>excludeEnd("ctx");
  38571. var $1;
  38572. $1=self._visitIRInstruction_(anIRVerbatim);
  38573. return $1;
  38574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38575. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRVisitor)});
  38576. //>>excludeEnd("ctx");
  38577. },
  38578. //>>excludeStart("ide", pragmas.excludeIdeData);
  38579. args: ["anIRVerbatim"],
  38580. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  38581. referencedClasses: [],
  38582. //>>excludeEnd("ide");
  38583. messageSends: ["visitIRInstruction:"]
  38584. }),
  38585. globals.IRVisitor);
  38586. smalltalk.addClass('IRJSTranslator', globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  38587. smalltalk.addMethod(
  38588. smalltalk.method({
  38589. selector: "contents",
  38590. protocol: 'accessing',
  38591. fn: function (){
  38592. var self=this;
  38593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38594. return smalltalk.withContext(function($ctx1) {
  38595. //>>excludeEnd("ctx");
  38596. var $1;
  38597. $1=_st(self._stream())._contents();
  38598. return $1;
  38599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38600. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.IRJSTranslator)});
  38601. //>>excludeEnd("ctx");
  38602. },
  38603. //>>excludeStart("ide", pragmas.excludeIdeData);
  38604. args: [],
  38605. source: "contents\x0a\x09^ self stream contents",
  38606. referencedClasses: [],
  38607. //>>excludeEnd("ide");
  38608. messageSends: ["contents", "stream"]
  38609. }),
  38610. globals.IRJSTranslator);
  38611. smalltalk.addMethod(
  38612. smalltalk.method({
  38613. selector: "currentClass",
  38614. protocol: 'accessing',
  38615. fn: function (){
  38616. var self=this;
  38617. var $1;
  38618. $1=self["@currentClass"];
  38619. return $1;
  38620. },
  38621. //>>excludeStart("ide", pragmas.excludeIdeData);
  38622. args: [],
  38623. source: "currentClass\x0a\x09^ currentClass",
  38624. referencedClasses: [],
  38625. //>>excludeEnd("ide");
  38626. messageSends: []
  38627. }),
  38628. globals.IRJSTranslator);
  38629. smalltalk.addMethod(
  38630. smalltalk.method({
  38631. selector: "currentClass:",
  38632. protocol: 'accessing',
  38633. fn: function (aClass){
  38634. var self=this;
  38635. self["@currentClass"]=aClass;
  38636. return self;
  38637. },
  38638. //>>excludeStart("ide", pragmas.excludeIdeData);
  38639. args: ["aClass"],
  38640. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  38641. referencedClasses: [],
  38642. //>>excludeEnd("ide");
  38643. messageSends: []
  38644. }),
  38645. globals.IRJSTranslator);
  38646. smalltalk.addMethod(
  38647. smalltalk.method({
  38648. selector: "initialize",
  38649. protocol: 'initialization',
  38650. fn: function (){
  38651. var self=this;
  38652. function $JSStream(){return globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  38653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38654. return smalltalk.withContext(function($ctx1) {
  38655. //>>excludeEnd("ctx");
  38656. (
  38657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38658. $ctx1.supercall = true,
  38659. //>>excludeEnd("ctx");
  38660. globals.IRJSTranslator.superclass.fn.prototype._initialize.apply(_st(self), []));
  38661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38662. $ctx1.supercall = false;
  38663. //>>excludeEnd("ctx");;
  38664. self["@stream"]=_st($JSStream())._new();
  38665. return self;
  38666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38667. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.IRJSTranslator)});
  38668. //>>excludeEnd("ctx");
  38669. },
  38670. //>>excludeStart("ide", pragmas.excludeIdeData);
  38671. args: [],
  38672. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  38673. referencedClasses: ["JSStream"],
  38674. //>>excludeEnd("ide");
  38675. messageSends: ["initialize", "new"]
  38676. }),
  38677. globals.IRJSTranslator);
  38678. smalltalk.addMethod(
  38679. smalltalk.method({
  38680. selector: "stream",
  38681. protocol: 'accessing',
  38682. fn: function (){
  38683. var self=this;
  38684. var $1;
  38685. $1=self["@stream"];
  38686. return $1;
  38687. },
  38688. //>>excludeStart("ide", pragmas.excludeIdeData);
  38689. args: [],
  38690. source: "stream\x0a\x09^ stream",
  38691. referencedClasses: [],
  38692. //>>excludeEnd("ide");
  38693. messageSends: []
  38694. }),
  38695. globals.IRJSTranslator);
  38696. smalltalk.addMethod(
  38697. smalltalk.method({
  38698. selector: "stream:",
  38699. protocol: 'accessing',
  38700. fn: function (aStream){
  38701. var self=this;
  38702. self["@stream"]=aStream;
  38703. return self;
  38704. },
  38705. //>>excludeStart("ide", pragmas.excludeIdeData);
  38706. args: ["aStream"],
  38707. source: "stream: aStream\x0a\x09stream := aStream",
  38708. referencedClasses: [],
  38709. //>>excludeEnd("ide");
  38710. messageSends: []
  38711. }),
  38712. globals.IRJSTranslator);
  38713. smalltalk.addMethod(
  38714. smalltalk.method({
  38715. selector: "visitIRAssignment:",
  38716. protocol: 'visiting',
  38717. fn: function (anIRAssignment){
  38718. var self=this;
  38719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38720. return smalltalk.withContext(function($ctx1) {
  38721. //>>excludeEnd("ctx");
  38722. var $2,$1;
  38723. $2=_st(anIRAssignment)._instructions();
  38724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38725. $ctx1.sendIdx["instructions"]=1;
  38726. //>>excludeEnd("ctx");
  38727. $1=_st($2)._first();
  38728. self._visit_($1);
  38729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38730. $ctx1.sendIdx["visit:"]=1;
  38731. //>>excludeEnd("ctx");
  38732. _st(self._stream())._nextPutAssignment();
  38733. self._visit_(_st(_st(anIRAssignment)._instructions())._last());
  38734. return self;
  38735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38736. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRJSTranslator)});
  38737. //>>excludeEnd("ctx");
  38738. },
  38739. //>>excludeStart("ide", pragmas.excludeIdeData);
  38740. args: ["anIRAssignment"],
  38741. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  38742. referencedClasses: [],
  38743. //>>excludeEnd("ide");
  38744. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"]
  38745. }),
  38746. globals.IRJSTranslator);
  38747. smalltalk.addMethod(
  38748. smalltalk.method({
  38749. selector: "visitIRClosure:",
  38750. protocol: 'visiting',
  38751. fn: function (anIRClosure){
  38752. var self=this;
  38753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38754. return smalltalk.withContext(function($ctx1) {
  38755. //>>excludeEnd("ctx");
  38756. var $1,$2;
  38757. $1=self._stream();
  38758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38759. $ctx1.sendIdx["stream"]=1;
  38760. //>>excludeEnd("ctx");
  38761. _st($1)._nextPutClosureWith_arguments_((function(){
  38762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38763. return smalltalk.withContext(function($ctx2) {
  38764. //>>excludeEnd("ctx");
  38765. $2=self._stream();
  38766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38767. $ctx2.sendIdx["stream"]=2;
  38768. //>>excludeEnd("ctx");
  38769. _st($2)._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
  38770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38771. return smalltalk.withContext(function($ctx3) {
  38772. //>>excludeEnd("ctx");
  38773. return _st(_st(each)._name())._asVariableName();
  38774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38775. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38776. //>>excludeEnd("ctx");
  38777. })));
  38778. return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  38779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38780. return smalltalk.withContext(function($ctx3) {
  38781. //>>excludeEnd("ctx");
  38782. return (
  38783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38784. $ctx3.supercall = true,
  38785. //>>excludeEnd("ctx");
  38786. globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]));
  38787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38788. $ctx3.supercall = false;
  38789. //>>excludeEnd("ctx");;
  38790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38791. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38792. //>>excludeEnd("ctx");
  38793. }));
  38794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38796. //>>excludeEnd("ctx");
  38797. }),_st(anIRClosure)._arguments());
  38798. return self;
  38799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38800. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRJSTranslator)});
  38801. //>>excludeEnd("ctx");
  38802. },
  38803. //>>excludeStart("ide", pragmas.excludeIdeData);
  38804. args: ["anIRClosure"],
  38805. source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments",
  38806. referencedClasses: [],
  38807. //>>excludeEnd("ide");
  38808. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  38809. }),
  38810. globals.IRJSTranslator);
  38811. smalltalk.addMethod(
  38812. smalltalk.method({
  38813. selector: "visitIRDynamicArray:",
  38814. protocol: 'visiting',
  38815. fn: function (anIRDynamicArray){
  38816. var self=this;
  38817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38818. return smalltalk.withContext(function($ctx1) {
  38819. //>>excludeEnd("ctx");
  38820. var $1;
  38821. $1=self._stream();
  38822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38823. $ctx1.sendIdx["stream"]=1;
  38824. //>>excludeEnd("ctx");
  38825. _st($1)._nextPutAll_("[");
  38826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38827. $ctx1.sendIdx["nextPutAll:"]=1;
  38828. //>>excludeEnd("ctx");
  38829. _st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  38830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38831. return smalltalk.withContext(function($ctx2) {
  38832. //>>excludeEnd("ctx");
  38833. return self._visit_(each);
  38834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38836. //>>excludeEnd("ctx");
  38837. }),(function(){
  38838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38839. return smalltalk.withContext(function($ctx2) {
  38840. //>>excludeEnd("ctx");
  38841. return _st(self._stream())._nextPutAll_(",");
  38842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38843. $ctx2.sendIdx["nextPutAll:"]=2;
  38844. //>>excludeEnd("ctx");
  38845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38847. //>>excludeEnd("ctx");
  38848. }));
  38849. _st(self["@stream"])._nextPutAll_("]");
  38850. return self;
  38851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38852. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRJSTranslator)});
  38853. //>>excludeEnd("ctx");
  38854. },
  38855. //>>excludeStart("ide", pragmas.excludeIdeData);
  38856. args: ["anIRDynamicArray"],
  38857. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'",
  38858. referencedClasses: [],
  38859. //>>excludeEnd("ide");
  38860. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38861. }),
  38862. globals.IRJSTranslator);
  38863. smalltalk.addMethod(
  38864. smalltalk.method({
  38865. selector: "visitIRDynamicDictionary:",
  38866. protocol: 'visiting',
  38867. fn: function (anIRDynamicDictionary){
  38868. var self=this;
  38869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38870. return smalltalk.withContext(function($ctx1) {
  38871. //>>excludeEnd("ctx");
  38872. var $1,$2;
  38873. $1=self._stream();
  38874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38875. $ctx1.sendIdx["stream"]=1;
  38876. //>>excludeEnd("ctx");
  38877. _st($1)._nextPutAll_("globals.HashedCollection._newFromPairs_([");
  38878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38879. $ctx1.sendIdx["nextPutAll:"]=1;
  38880. //>>excludeEnd("ctx");
  38881. _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  38882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38883. return smalltalk.withContext(function($ctx2) {
  38884. //>>excludeEnd("ctx");
  38885. return self._visit_(each);
  38886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38887. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38888. //>>excludeEnd("ctx");
  38889. }),(function(){
  38890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38891. return smalltalk.withContext(function($ctx2) {
  38892. //>>excludeEnd("ctx");
  38893. $2=self._stream();
  38894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38895. $ctx2.sendIdx["stream"]=2;
  38896. //>>excludeEnd("ctx");
  38897. return _st($2)._nextPutAll_(",");
  38898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38899. $ctx2.sendIdx["nextPutAll:"]=2;
  38900. //>>excludeEnd("ctx");
  38901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38903. //>>excludeEnd("ctx");
  38904. }));
  38905. _st(self._stream())._nextPutAll_("])");
  38906. return self;
  38907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38908. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRJSTranslator)});
  38909. //>>excludeEnd("ctx");
  38910. },
  38911. //>>excludeStart("ide", pragmas.excludeIdeData);
  38912. args: ["anIRDynamicDictionary"],
  38913. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  38914. referencedClasses: [],
  38915. //>>excludeEnd("ide");
  38916. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38917. }),
  38918. globals.IRJSTranslator);
  38919. smalltalk.addMethod(
  38920. smalltalk.method({
  38921. selector: "visitIRMethod:",
  38922. protocol: 'visiting',
  38923. fn: function (anIRMethod){
  38924. var self=this;
  38925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38926. return smalltalk.withContext(function($ctx1) {
  38927. //>>excludeEnd("ctx");
  38928. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  38929. $1=self._stream();
  38930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38931. $ctx1.sendIdx["stream"]=1;
  38932. //>>excludeEnd("ctx");
  38933. _st($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  38934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38935. return smalltalk.withContext(function($ctx2) {
  38936. //>>excludeEnd("ctx");
  38937. $2=self._stream();
  38938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38939. $ctx2.sendIdx["stream"]=2;
  38940. //>>excludeEnd("ctx");
  38941. return _st($2)._nextPutFunctionWith_arguments_((function(){
  38942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38943. return smalltalk.withContext(function($ctx3) {
  38944. //>>excludeEnd("ctx");
  38945. $3=self._stream();
  38946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38947. $ctx3.sendIdx["stream"]=3;
  38948. //>>excludeEnd("ctx");
  38949. $4=_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
  38950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38951. return smalltalk.withContext(function($ctx4) {
  38952. //>>excludeEnd("ctx");
  38953. return _st(_st(each)._name())._asVariableName();
  38954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38955. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38956. //>>excludeEnd("ctx");
  38957. }));
  38958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38959. $ctx3.sendIdx["collect:"]=1;
  38960. //>>excludeEnd("ctx");
  38961. _st($3)._nextPutVars_($4);
  38962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38963. $ctx3.sendIdx["nextPutVars:"]=1;
  38964. //>>excludeEnd("ctx");
  38965. _st(_st(anIRMethod)._classReferences())._do_((function(each){
  38966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38967. return smalltalk.withContext(function($ctx4) {
  38968. //>>excludeEnd("ctx");
  38969. $5=self._stream();
  38970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38971. $ctx4.sendIdx["stream"]=4;
  38972. //>>excludeEnd("ctx");
  38973. return _st($5)._nextPutClassRefFunction_(each);
  38974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38975. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
  38976. //>>excludeEnd("ctx");
  38977. }));
  38978. $6=self._stream();
  38979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38980. $ctx3.sendIdx["stream"]=5;
  38981. //>>excludeEnd("ctx");
  38982. return _st($6)._nextPutContextFor_during_(anIRMethod,(function(){
  38983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38984. return smalltalk.withContext(function($ctx4) {
  38985. //>>excludeEnd("ctx");
  38986. $8=_st(anIRMethod)._internalVariables();
  38987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38988. $ctx4.sendIdx["internalVariables"]=1;
  38989. //>>excludeEnd("ctx");
  38990. $7=_st($8)._notEmpty();
  38991. if(smalltalk.assert($7)){
  38992. $9=self._stream();
  38993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38994. $ctx4.sendIdx["stream"]=6;
  38995. //>>excludeEnd("ctx");
  38996. _st($9)._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  38997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38998. return smalltalk.withContext(function($ctx5) {
  38999. //>>excludeEnd("ctx");
  39000. return _st(_st(each)._variable())._alias();
  39001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39002. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
  39003. //>>excludeEnd("ctx");
  39004. })));
  39005. };
  39006. $10=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
  39007. if(smalltalk.assert($10)){
  39008. return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  39009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39010. return smalltalk.withContext(function($ctx5) {
  39011. //>>excludeEnd("ctx");
  39012. return (
  39013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39014. $ctx5.supercall = true,
  39015. //>>excludeEnd("ctx");
  39016. globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  39017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39018. $ctx5.supercall = false;
  39019. //>>excludeEnd("ctx");;
  39020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39021. $ctx5.sendIdx["visitIRMethod:"]=1;
  39022. //>>excludeEnd("ctx");
  39023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39024. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
  39025. //>>excludeEnd("ctx");
  39026. }));
  39027. } else {
  39028. return (
  39029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39030. $ctx4.supercall = true,
  39031. //>>excludeEnd("ctx");
  39032. globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  39033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39034. $ctx4.supercall = false;
  39035. //>>excludeEnd("ctx");;
  39036. };
  39037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39038. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  39039. //>>excludeEnd("ctx");
  39040. }));
  39041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39042. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39043. //>>excludeEnd("ctx");
  39044. }),_st(anIRMethod)._arguments());
  39045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39047. //>>excludeEnd("ctx");
  39048. }));
  39049. return self;
  39050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39051. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRJSTranslator)});
  39052. //>>excludeEnd("ctx");
  39053. },
  39054. //>>excludeStart("ide", pragmas.excludeIdeData);
  39055. args: ["anIRMethod"],
  39056. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
  39057. referencedClasses: [],
  39058. //>>excludeEnd("ide");
  39059. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"]
  39060. }),
  39061. globals.IRJSTranslator);
  39062. smalltalk.addMethod(
  39063. smalltalk.method({
  39064. selector: "visitIRNonLocalReturn:",
  39065. protocol: 'visiting',
  39066. fn: function (anIRNonLocalReturn){
  39067. var self=this;
  39068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39069. return smalltalk.withContext(function($ctx1) {
  39070. //>>excludeEnd("ctx");
  39071. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  39072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39073. return smalltalk.withContext(function($ctx2) {
  39074. //>>excludeEnd("ctx");
  39075. return (
  39076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39077. $ctx2.supercall = true,
  39078. //>>excludeEnd("ctx");
  39079. globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
  39080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39081. $ctx2.supercall = false;
  39082. //>>excludeEnd("ctx");;
  39083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39085. //>>excludeEnd("ctx");
  39086. }));
  39087. return self;
  39088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39089. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRJSTranslator)});
  39090. //>>excludeEnd("ctx");
  39091. },
  39092. //>>excludeStart("ide", pragmas.excludeIdeData);
  39093. args: ["anIRNonLocalReturn"],
  39094. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39095. referencedClasses: [],
  39096. //>>excludeEnd("ide");
  39097. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39098. }),
  39099. globals.IRJSTranslator);
  39100. smalltalk.addMethod(
  39101. smalltalk.method({
  39102. selector: "visitIRReturn:",
  39103. protocol: 'visiting',
  39104. fn: function (anIRReturn){
  39105. var self=this;
  39106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39107. return smalltalk.withContext(function($ctx1) {
  39108. //>>excludeEnd("ctx");
  39109. _st(self._stream())._nextPutReturnWith_((function(){
  39110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39111. return smalltalk.withContext(function($ctx2) {
  39112. //>>excludeEnd("ctx");
  39113. return (
  39114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39115. $ctx2.supercall = true,
  39116. //>>excludeEnd("ctx");
  39117. globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
  39118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39119. $ctx2.supercall = false;
  39120. //>>excludeEnd("ctx");;
  39121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39123. //>>excludeEnd("ctx");
  39124. }));
  39125. return self;
  39126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39127. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRJSTranslator)});
  39128. //>>excludeEnd("ctx");
  39129. },
  39130. //>>excludeStart("ide", pragmas.excludeIdeData);
  39131. args: ["anIRReturn"],
  39132. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39133. referencedClasses: [],
  39134. //>>excludeEnd("ide");
  39135. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39136. }),
  39137. globals.IRJSTranslator);
  39138. smalltalk.addMethod(
  39139. smalltalk.method({
  39140. selector: "visitIRSend:",
  39141. protocol: 'visiting',
  39142. fn: function (anIRSend){
  39143. var self=this;
  39144. var sends;
  39145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39146. return smalltalk.withContext(function($ctx1) {
  39147. //>>excludeEnd("ctx");
  39148. var $1,$2,$receiver;
  39149. sends=_st(_st(_st(_st(anIRSend)._method())._sendIndexes())._at_(_st(anIRSend)._selector()))._size();
  39150. $1=_st(anIRSend)._classSend();
  39151. if(($receiver = $1) == null || $receiver.isNil){
  39152. self._visitSend_(anIRSend);
  39153. } else {
  39154. self._visitSuperSend_(anIRSend);
  39155. };
  39156. $2=_st(_st(sends).__gt((1)))._and_((function(){
  39157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39158. return smalltalk.withContext(function($ctx2) {
  39159. //>>excludeEnd("ctx");
  39160. return _st(_st(anIRSend)._index()).__lt(sends);
  39161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39163. //>>excludeEnd("ctx");
  39164. }));
  39165. if(smalltalk.assert($2)){
  39166. _st(self._stream())._nextPutSendIndexFor_(anIRSend);
  39167. };
  39168. return self;
  39169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39170. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},globals.IRJSTranslator)});
  39171. //>>excludeEnd("ctx");
  39172. },
  39173. //>>excludeStart("ide", pragmas.excludeIdeData);
  39174. args: ["anIRSend"],
  39175. source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  39176. referencedClasses: [],
  39177. //>>excludeEnd("ide");
  39178. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  39179. }),
  39180. globals.IRJSTranslator);
  39181. smalltalk.addMethod(
  39182. smalltalk.method({
  39183. selector: "visitIRSequence:",
  39184. protocol: 'visiting',
  39185. fn: function (anIRSequence){
  39186. var self=this;
  39187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39188. return smalltalk.withContext(function($ctx1) {
  39189. //>>excludeEnd("ctx");
  39190. var $1;
  39191. $1=self._stream();
  39192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39193. $ctx1.sendIdx["stream"]=1;
  39194. //>>excludeEnd("ctx");
  39195. _st($1)._nextPutSequenceWith_((function(){
  39196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39197. return smalltalk.withContext(function($ctx2) {
  39198. //>>excludeEnd("ctx");
  39199. return _st(_st(anIRSequence)._instructions())._do_((function(each){
  39200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39201. return smalltalk.withContext(function($ctx3) {
  39202. //>>excludeEnd("ctx");
  39203. return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
  39204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39205. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39206. //>>excludeEnd("ctx");
  39207. }));
  39208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39210. //>>excludeEnd("ctx");
  39211. }));
  39212. return self;
  39213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39214. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRJSTranslator)});
  39215. //>>excludeEnd("ctx");
  39216. },
  39217. //>>excludeStart("ide", pragmas.excludeIdeData);
  39218. args: ["anIRSequence"],
  39219. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  39220. referencedClasses: [],
  39221. //>>excludeEnd("ide");
  39222. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  39223. }),
  39224. globals.IRJSTranslator);
  39225. smalltalk.addMethod(
  39226. smalltalk.method({
  39227. selector: "visitIRTempDeclaration:",
  39228. protocol: 'visiting',
  39229. fn: function (anIRTempDeclaration){
  39230. var self=this;
  39231. return self;
  39232. },
  39233. //>>excludeStart("ide", pragmas.excludeIdeData);
  39234. args: ["anIRTempDeclaration"],
  39235. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39236. referencedClasses: [],
  39237. //>>excludeEnd("ide");
  39238. messageSends: []
  39239. }),
  39240. globals.IRJSTranslator);
  39241. smalltalk.addMethod(
  39242. smalltalk.method({
  39243. selector: "visitIRValue:",
  39244. protocol: 'visiting',
  39245. fn: function (anIRValue){
  39246. var self=this;
  39247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39248. return smalltalk.withContext(function($ctx1) {
  39249. //>>excludeEnd("ctx");
  39250. _st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
  39251. return self;
  39252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39253. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRJSTranslator)});
  39254. //>>excludeEnd("ctx");
  39255. },
  39256. //>>excludeStart("ide", pragmas.excludeIdeData);
  39257. args: ["anIRValue"],
  39258. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  39259. referencedClasses: [],
  39260. //>>excludeEnd("ide");
  39261. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  39262. }),
  39263. globals.IRJSTranslator);
  39264. smalltalk.addMethod(
  39265. smalltalk.method({
  39266. selector: "visitIRVariable:",
  39267. protocol: 'visiting',
  39268. fn: function (anIRVariable){
  39269. var self=this;
  39270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39271. return smalltalk.withContext(function($ctx1) {
  39272. //>>excludeEnd("ctx");
  39273. var $3,$2,$1,$4;
  39274. $3=_st(anIRVariable)._variable();
  39275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39276. $ctx1.sendIdx["variable"]=1;
  39277. //>>excludeEnd("ctx");
  39278. $2=_st($3)._name();
  39279. $1=_st($2).__eq("thisContext");
  39280. if(smalltalk.assert($1)){
  39281. $4=self._stream();
  39282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39283. $ctx1.sendIdx["stream"]=1;
  39284. //>>excludeEnd("ctx");
  39285. _st($4)._nextPutAll_("smalltalk.getThisContext()");
  39286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39287. $ctx1.sendIdx["nextPutAll:"]=1;
  39288. //>>excludeEnd("ctx");
  39289. } else {
  39290. _st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
  39291. };
  39292. return self;
  39293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39294. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRJSTranslator)});
  39295. //>>excludeEnd("ctx");
  39296. },
  39297. //>>excludeStart("ide", pragmas.excludeIdeData);
  39298. args: ["anIRVariable"],
  39299. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  39300. referencedClasses: [],
  39301. //>>excludeEnd("ide");
  39302. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39303. }),
  39304. globals.IRJSTranslator);
  39305. smalltalk.addMethod(
  39306. smalltalk.method({
  39307. selector: "visitIRVerbatim:",
  39308. protocol: 'visiting',
  39309. fn: function (anIRVerbatim){
  39310. var self=this;
  39311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39312. return smalltalk.withContext(function($ctx1) {
  39313. //>>excludeEnd("ctx");
  39314. var $1;
  39315. $1=self._stream();
  39316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39317. $ctx1.sendIdx["stream"]=1;
  39318. //>>excludeEnd("ctx");
  39319. _st($1)._nextPutStatementWith_((function(){
  39320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39321. return smalltalk.withContext(function($ctx2) {
  39322. //>>excludeEnd("ctx");
  39323. return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
  39324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39326. //>>excludeEnd("ctx");
  39327. }));
  39328. return self;
  39329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39330. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRJSTranslator)});
  39331. //>>excludeEnd("ctx");
  39332. },
  39333. //>>excludeStart("ide", pragmas.excludeIdeData);
  39334. args: ["anIRVerbatim"],
  39335. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  39336. referencedClasses: [],
  39337. //>>excludeEnd("ide");
  39338. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  39339. }),
  39340. globals.IRJSTranslator);
  39341. smalltalk.addMethod(
  39342. smalltalk.method({
  39343. selector: "visitReceiver:",
  39344. protocol: 'visiting',
  39345. fn: function (anIRInstruction){
  39346. var self=this;
  39347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39348. return smalltalk.withContext(function($ctx1) {
  39349. //>>excludeEnd("ctx");
  39350. var $1,$2,$3;
  39351. $1=_st(anIRInstruction)._needsBoxingAsReceiver();
  39352. if(! smalltalk.assert($1)){
  39353. $2=self._visit_(anIRInstruction);
  39354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39355. $ctx1.sendIdx["visit:"]=1;
  39356. //>>excludeEnd("ctx");
  39357. return $2;
  39358. };
  39359. $3=self._stream();
  39360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39361. $ctx1.sendIdx["stream"]=1;
  39362. //>>excludeEnd("ctx");
  39363. _st($3)._nextPutAll_("_st(");
  39364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39365. $ctx1.sendIdx["nextPutAll:"]=1;
  39366. //>>excludeEnd("ctx");
  39367. self._visit_(anIRInstruction);
  39368. _st(self._stream())._nextPutAll_(")");
  39369. return self;
  39370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39371. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},globals.IRJSTranslator)});
  39372. //>>excludeEnd("ctx");
  39373. },
  39374. //>>excludeStart("ide", pragmas.excludeIdeData);
  39375. args: ["anIRInstruction"],
  39376. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '_st('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  39377. referencedClasses: [],
  39378. //>>excludeEnd("ide");
  39379. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  39380. }),
  39381. globals.IRJSTranslator);
  39382. smalltalk.addMethod(
  39383. smalltalk.method({
  39384. selector: "visitSend:",
  39385. protocol: 'visiting',
  39386. fn: function (anIRSend){
  39387. var self=this;
  39388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39389. return smalltalk.withContext(function($ctx1) {
  39390. //>>excludeEnd("ctx");
  39391. var $2,$1,$3,$4,$5;
  39392. $2=_st(anIRSend)._instructions();
  39393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39394. $ctx1.sendIdx["instructions"]=1;
  39395. //>>excludeEnd("ctx");
  39396. $1=_st($2)._first();
  39397. self._visitReceiver_($1);
  39398. $3=self._stream();
  39399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39400. $ctx1.sendIdx["stream"]=1;
  39401. //>>excludeEnd("ctx");
  39402. $4=_st(".".__comma(_st(_st(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
  39403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39404. $ctx1.sendIdx[","]=1;
  39405. //>>excludeEnd("ctx");
  39406. _st($3)._nextPutAll_($4);
  39407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39408. $ctx1.sendIdx["nextPutAll:"]=1;
  39409. //>>excludeEnd("ctx");
  39410. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39412. return smalltalk.withContext(function($ctx2) {
  39413. //>>excludeEnd("ctx");
  39414. return self._visit_(each);
  39415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39417. //>>excludeEnd("ctx");
  39418. }),(function(){
  39419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39420. return smalltalk.withContext(function($ctx2) {
  39421. //>>excludeEnd("ctx");
  39422. $5=self._stream();
  39423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39424. $ctx2.sendIdx["stream"]=2;
  39425. //>>excludeEnd("ctx");
  39426. return _st($5)._nextPutAll_(",");
  39427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39428. $ctx2.sendIdx["nextPutAll:"]=2;
  39429. //>>excludeEnd("ctx");
  39430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39432. //>>excludeEnd("ctx");
  39433. }));
  39434. _st(self._stream())._nextPutAll_(")");
  39435. return self;
  39436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39437. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},globals.IRJSTranslator)});
  39438. //>>excludeEnd("ctx");
  39439. },
  39440. //>>excludeStart("ide", pragmas.excludeIdeData);
  39441. args: ["anIRSend"],
  39442. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  39443. referencedClasses: [],
  39444. //>>excludeEnd("ide");
  39445. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"]
  39446. }),
  39447. globals.IRJSTranslator);
  39448. smalltalk.addMethod(
  39449. smalltalk.method({
  39450. selector: "visitSuperSend:",
  39451. protocol: 'visiting',
  39452. fn: function (anIRSend){
  39453. var self=this;
  39454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39455. return smalltalk.withContext(function($ctx1) {
  39456. //>>excludeEnd("ctx");
  39457. var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14;
  39458. $1=self._stream();
  39459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39460. $ctx1.sendIdx["stream"]=1;
  39461. //>>excludeEnd("ctx");
  39462. _st($1)._nextPutAll_("(");
  39463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39464. $ctx1.sendIdx["nextPutAll:"]=1;
  39465. //>>excludeEnd("ctx");
  39466. _st($1)._lf();
  39467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39468. $ctx1.sendIdx["lf"]=1;
  39469. //>>excludeEnd("ctx");
  39470. _st($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39472. $ctx1.sendIdx["nextPutAll:"]=2;
  39473. //>>excludeEnd("ctx");
  39474. _st($1)._lf();
  39475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39476. $ctx1.sendIdx["lf"]=2;
  39477. //>>excludeEnd("ctx");
  39478. $2=$1;
  39479. $5=_st(anIRSend)._scope();
  39480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39481. $ctx1.sendIdx["scope"]=1;
  39482. //>>excludeEnd("ctx");
  39483. $4=_st($5)._alias();
  39484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39485. $ctx1.sendIdx["alias"]=1;
  39486. //>>excludeEnd("ctx");
  39487. $3=_st($4).__comma(".supercall = true, ");
  39488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39489. $ctx1.sendIdx[","]=1;
  39490. //>>excludeEnd("ctx");
  39491. _st($2)._nextPutAll_($3);
  39492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39493. $ctx1.sendIdx["nextPutAll:"]=3;
  39494. //>>excludeEnd("ctx");
  39495. _st($1)._lf();
  39496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39497. $ctx1.sendIdx["lf"]=3;
  39498. //>>excludeEnd("ctx");
  39499. _st($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39501. $ctx1.sendIdx["nextPutAll:"]=4;
  39502. //>>excludeEnd("ctx");
  39503. _st($1)._lf();
  39504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39505. $ctx1.sendIdx["lf"]=4;
  39506. //>>excludeEnd("ctx");
  39507. _st($1)._nextPutAll_(_st(self._currentClass())._asJavascript());
  39508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39509. $ctx1.sendIdx["nextPutAll:"]=5;
  39510. //>>excludeEnd("ctx");
  39511. _st($1)._nextPutAll_(".superclass.fn.prototype.");
  39512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39513. $ctx1.sendIdx["nextPutAll:"]=6;
  39514. //>>excludeEnd("ctx");
  39515. $6=$1;
  39516. $7=_st(_st(_st(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  39517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39518. $ctx1.sendIdx[","]=2;
  39519. //>>excludeEnd("ctx");
  39520. _st($6)._nextPutAll_($7);
  39521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39522. $ctx1.sendIdx["nextPutAll:"]=7;
  39523. //>>excludeEnd("ctx");
  39524. $8=_st($1)._nextPutAll_("_st(");
  39525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39526. $ctx1.sendIdx["nextPutAll:"]=8;
  39527. //>>excludeEnd("ctx");
  39528. $10=_st(anIRSend)._instructions();
  39529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39530. $ctx1.sendIdx["instructions"]=1;
  39531. //>>excludeEnd("ctx");
  39532. $9=_st($10)._first();
  39533. self._visit_($9);
  39534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39535. $ctx1.sendIdx["visit:"]=1;
  39536. //>>excludeEnd("ctx");
  39537. $11=self._stream();
  39538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39539. $ctx1.sendIdx["stream"]=2;
  39540. //>>excludeEnd("ctx");
  39541. _st($11)._nextPutAll_("), [");
  39542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39543. $ctx1.sendIdx["nextPutAll:"]=9;
  39544. //>>excludeEnd("ctx");
  39545. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39547. return smalltalk.withContext(function($ctx2) {
  39548. //>>excludeEnd("ctx");
  39549. return self._visit_(each);
  39550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39551. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39552. //>>excludeEnd("ctx");
  39553. }),(function(){
  39554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39555. return smalltalk.withContext(function($ctx2) {
  39556. //>>excludeEnd("ctx");
  39557. $12=self._stream();
  39558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39559. $ctx2.sendIdx["stream"]=3;
  39560. //>>excludeEnd("ctx");
  39561. return _st($12)._nextPutAll_(",");
  39562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39563. $ctx2.sendIdx["nextPutAll:"]=10;
  39564. //>>excludeEnd("ctx");
  39565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39567. //>>excludeEnd("ctx");
  39568. }));
  39569. $13=self._stream();
  39570. _st($13)._nextPutAll_("]));");
  39571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39572. $ctx1.sendIdx["nextPutAll:"]=11;
  39573. //>>excludeEnd("ctx");
  39574. _st($13)._lf();
  39575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39576. $ctx1.sendIdx["lf"]=5;
  39577. //>>excludeEnd("ctx");
  39578. _st($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39580. $ctx1.sendIdx["nextPutAll:"]=12;
  39581. //>>excludeEnd("ctx");
  39582. _st($13)._lf();
  39583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39584. $ctx1.sendIdx["lf"]=6;
  39585. //>>excludeEnd("ctx");
  39586. _st($13)._nextPutAll_(_st(_st(_st(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  39587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39588. $ctx1.sendIdx["nextPutAll:"]=13;
  39589. //>>excludeEnd("ctx");
  39590. _st($13)._lf();
  39591. $14=_st($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39592. return self;
  39593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39594. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},globals.IRJSTranslator)});
  39595. //>>excludeEnd("ctx");
  39596. },
  39597. //>>excludeStart("ide", pragmas.excludeIdeData);
  39598. args: ["anIRSend"],
  39599. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true, '; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '_st('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream \x0a\x09\x09nextPutAll: ']));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  39600. referencedClasses: [],
  39601. //>>excludeEnd("ide");
  39602. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"]
  39603. }),
  39604. globals.IRJSTranslator);
  39605. smalltalk.addClass('JSStream', globals.Object, ['stream'], 'Compiler-IR');
  39606. smalltalk.addMethod(
  39607. smalltalk.method({
  39608. selector: "contents",
  39609. protocol: 'accessing',
  39610. fn: function (){
  39611. var self=this;
  39612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39613. return smalltalk.withContext(function($ctx1) {
  39614. //>>excludeEnd("ctx");
  39615. var $1;
  39616. $1=_st(self["@stream"])._contents();
  39617. return $1;
  39618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39619. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.JSStream)});
  39620. //>>excludeEnd("ctx");
  39621. },
  39622. //>>excludeStart("ide", pragmas.excludeIdeData);
  39623. args: [],
  39624. source: "contents\x0a\x09^ stream contents",
  39625. referencedClasses: [],
  39626. //>>excludeEnd("ide");
  39627. messageSends: ["contents"]
  39628. }),
  39629. globals.JSStream);
  39630. smalltalk.addMethod(
  39631. smalltalk.method({
  39632. selector: "initialize",
  39633. protocol: 'initialization',
  39634. fn: function (){
  39635. var self=this;
  39636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39637. return smalltalk.withContext(function($ctx1) {
  39638. //>>excludeEnd("ctx");
  39639. (
  39640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39641. $ctx1.supercall = true,
  39642. //>>excludeEnd("ctx");
  39643. globals.JSStream.superclass.fn.prototype._initialize.apply(_st(self), []));
  39644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39645. $ctx1.supercall = false;
  39646. //>>excludeEnd("ctx");;
  39647. self["@stream"]=""._writeStream();
  39648. return self;
  39649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39650. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.JSStream)});
  39651. //>>excludeEnd("ctx");
  39652. },
  39653. //>>excludeStart("ide", pragmas.excludeIdeData);
  39654. args: [],
  39655. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  39656. referencedClasses: [],
  39657. //>>excludeEnd("ide");
  39658. messageSends: ["initialize", "writeStream"]
  39659. }),
  39660. globals.JSStream);
  39661. smalltalk.addMethod(
  39662. smalltalk.method({
  39663. selector: "lf",
  39664. protocol: 'streaming',
  39665. fn: function (){
  39666. var self=this;
  39667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39668. return smalltalk.withContext(function($ctx1) {
  39669. //>>excludeEnd("ctx");
  39670. _st(self["@stream"])._lf();
  39671. return self;
  39672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39673. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.JSStream)});
  39674. //>>excludeEnd("ctx");
  39675. },
  39676. //>>excludeStart("ide", pragmas.excludeIdeData);
  39677. args: [],
  39678. source: "lf\x0a\x09stream lf",
  39679. referencedClasses: [],
  39680. //>>excludeEnd("ide");
  39681. messageSends: ["lf"]
  39682. }),
  39683. globals.JSStream);
  39684. smalltalk.addMethod(
  39685. smalltalk.method({
  39686. selector: "nextPut:",
  39687. protocol: 'streaming',
  39688. fn: function (aString){
  39689. var self=this;
  39690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39691. return smalltalk.withContext(function($ctx1) {
  39692. //>>excludeEnd("ctx");
  39693. _st(self["@stream"])._nextPut_(aString);
  39694. return self;
  39695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39696. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.JSStream)});
  39697. //>>excludeEnd("ctx");
  39698. },
  39699. //>>excludeStart("ide", pragmas.excludeIdeData);
  39700. args: ["aString"],
  39701. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  39702. referencedClasses: [],
  39703. //>>excludeEnd("ide");
  39704. messageSends: ["nextPut:"]
  39705. }),
  39706. globals.JSStream);
  39707. smalltalk.addMethod(
  39708. smalltalk.method({
  39709. selector: "nextPutAll:",
  39710. protocol: 'streaming',
  39711. fn: function (aString){
  39712. var self=this;
  39713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39714. return smalltalk.withContext(function($ctx1) {
  39715. //>>excludeEnd("ctx");
  39716. _st(self["@stream"])._nextPutAll_(aString);
  39717. return self;
  39718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39719. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},globals.JSStream)});
  39720. //>>excludeEnd("ctx");
  39721. },
  39722. //>>excludeStart("ide", pragmas.excludeIdeData);
  39723. args: ["aString"],
  39724. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  39725. referencedClasses: [],
  39726. //>>excludeEnd("ide");
  39727. messageSends: ["nextPutAll:"]
  39728. }),
  39729. globals.JSStream);
  39730. smalltalk.addMethod(
  39731. smalltalk.method({
  39732. selector: "nextPutAssignment",
  39733. protocol: 'streaming',
  39734. fn: function (){
  39735. var self=this;
  39736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39737. return smalltalk.withContext(function($ctx1) {
  39738. //>>excludeEnd("ctx");
  39739. _st(self["@stream"])._nextPutAll_("=");
  39740. return self;
  39741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39742. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},globals.JSStream)});
  39743. //>>excludeEnd("ctx");
  39744. },
  39745. //>>excludeStart("ide", pragmas.excludeIdeData);
  39746. args: [],
  39747. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  39748. referencedClasses: [],
  39749. //>>excludeEnd("ide");
  39750. messageSends: ["nextPutAll:"]
  39751. }),
  39752. globals.JSStream);
  39753. smalltalk.addMethod(
  39754. smalltalk.method({
  39755. selector: "nextPutBlockContextFor:during:",
  39756. protocol: 'streaming',
  39757. fn: function (anIRClosure,aBlock){
  39758. var self=this;
  39759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39760. return smalltalk.withContext(function($ctx1) {
  39761. //>>excludeEnd("ctx");
  39762. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18,$24;
  39763. $1=_st(anIRClosure)._requiresSmalltalkContext();
  39764. if(! smalltalk.assert($1)){
  39765. $2=_st(aBlock)._value();
  39766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39767. $ctx1.sendIdx["value"]=1;
  39768. //>>excludeEnd("ctx");
  39769. return $2;
  39770. };
  39771. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39773. $ctx1.sendIdx["nextPutAll:"]=1;
  39774. //>>excludeEnd("ctx");
  39775. self._lf();
  39776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39777. $ctx1.sendIdx["lf"]=1;
  39778. //>>excludeEnd("ctx");
  39779. $6=_st(anIRClosure)._scope();
  39780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39781. $ctx1.sendIdx["scope"]=1;
  39782. //>>excludeEnd("ctx");
  39783. $5=_st($6)._alias();
  39784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39785. $ctx1.sendIdx["alias"]=1;
  39786. //>>excludeEnd("ctx");
  39787. $4="return smalltalk.withContext(function(".__comma($5);
  39788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39789. $ctx1.sendIdx[","]=2;
  39790. //>>excludeEnd("ctx");
  39791. $3=_st($4).__comma(") {");
  39792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39793. $ctx1.sendIdx[","]=1;
  39794. //>>excludeEnd("ctx");
  39795. self._nextPutAll_($3);
  39796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39797. $ctx1.sendIdx["nextPutAll:"]=2;
  39798. //>>excludeEnd("ctx");
  39799. self._lf();
  39800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39801. $ctx1.sendIdx["lf"]=2;
  39802. //>>excludeEnd("ctx");
  39803. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39805. $ctx1.sendIdx["nextPutAll:"]=3;
  39806. //>>excludeEnd("ctx");
  39807. $7=self._lf();
  39808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39809. $ctx1.sendIdx["lf"]=3;
  39810. //>>excludeEnd("ctx");
  39811. _st(aBlock)._value();
  39812. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39814. $ctx1.sendIdx["nextPutAll:"]=4;
  39815. //>>excludeEnd("ctx");
  39816. self._lf();
  39817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39818. $ctx1.sendIdx["lf"]=4;
  39819. //>>excludeEnd("ctx");
  39820. $11=_st(anIRClosure)._scope();
  39821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39822. $ctx1.sendIdx["scope"]=2;
  39823. //>>excludeEnd("ctx");
  39824. $10=_st($11)._alias();
  39825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39826. $ctx1.sendIdx["alias"]=2;
  39827. //>>excludeEnd("ctx");
  39828. $9="}, function(".__comma($10);
  39829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39830. $ctx1.sendIdx[","]=4;
  39831. //>>excludeEnd("ctx");
  39832. $8=_st($9).__comma(") {");
  39833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39834. $ctx1.sendIdx[","]=3;
  39835. //>>excludeEnd("ctx");
  39836. self._nextPutAll_($8);
  39837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39838. $ctx1.sendIdx["nextPutAll:"]=5;
  39839. //>>excludeEnd("ctx");
  39840. $15=_st(anIRClosure)._scope();
  39841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39842. $ctx1.sendIdx["scope"]=3;
  39843. //>>excludeEnd("ctx");
  39844. $14=_st($15)._alias();
  39845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39846. $ctx1.sendIdx["alias"]=3;
  39847. //>>excludeEnd("ctx");
  39848. $13=_st($14).__comma(".fillBlock({");
  39849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39850. $ctx1.sendIdx[","]=5;
  39851. //>>excludeEnd("ctx");
  39852. $12=self._nextPutAll_($13);
  39853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39854. $ctx1.sendIdx["nextPutAll:"]=6;
  39855. //>>excludeEnd("ctx");
  39856. _st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
  39857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39858. return smalltalk.withContext(function($ctx2) {
  39859. //>>excludeEnd("ctx");
  39860. $16=_st(each)._asVariableName();
  39861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39862. $ctx2.sendIdx["asVariableName"]=1;
  39863. //>>excludeEnd("ctx");
  39864. self._nextPutAll_($16);
  39865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39866. $ctx2.sendIdx["nextPutAll:"]=7;
  39867. //>>excludeEnd("ctx");
  39868. self._nextPutAll_(":");
  39869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39870. $ctx2.sendIdx["nextPutAll:"]=8;
  39871. //>>excludeEnd("ctx");
  39872. $17=self._nextPutAll_(_st(each)._asVariableName());
  39873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39874. $ctx2.sendIdx["nextPutAll:"]=9;
  39875. //>>excludeEnd("ctx");
  39876. return $17;
  39877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39879. //>>excludeEnd("ctx");
  39880. }),(function(){
  39881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39882. return smalltalk.withContext(function($ctx2) {
  39883. //>>excludeEnd("ctx");
  39884. return self._nextPutAll_(",");
  39885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39886. $ctx2.sendIdx["nextPutAll:"]=10;
  39887. //>>excludeEnd("ctx");
  39888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39890. //>>excludeEnd("ctx");
  39891. }));
  39892. self._nextPutAll_("},");
  39893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39894. $ctx1.sendIdx["nextPutAll:"]=11;
  39895. //>>excludeEnd("ctx");
  39896. $23=_st(anIRClosure)._scope();
  39897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39898. $ctx1.sendIdx["scope"]=4;
  39899. //>>excludeEnd("ctx");
  39900. $22=_st($23)._outerScope();
  39901. $21=_st($22)._alias();
  39902. $20=_st($21).__comma(",");
  39903. $19=_st($20).__comma(_st(_st(_st(anIRClosure)._scope())._blockIndex())._asString());
  39904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39905. $ctx1.sendIdx[","]=7;
  39906. //>>excludeEnd("ctx");
  39907. $18=_st($19).__comma(")});");
  39908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39909. $ctx1.sendIdx[","]=6;
  39910. //>>excludeEnd("ctx");
  39911. self._nextPutAll_($18);
  39912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39913. $ctx1.sendIdx["nextPutAll:"]=12;
  39914. //>>excludeEnd("ctx");
  39915. self._lf();
  39916. $24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39917. return self;
  39918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39919. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},globals.JSStream)});
  39920. //>>excludeEnd("ctx");
  39921. },
  39922. //>>excludeStart("ide", pragmas.excludeIdeData);
  39923. args: ["anIRClosure", "aBlock"],
  39924. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  39925. referencedClasses: [],
  39926. //>>excludeEnd("ide");
  39927. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  39928. }),
  39929. globals.JSStream);
  39930. smalltalk.addMethod(
  39931. smalltalk.method({
  39932. selector: "nextPutClassRefFunction:",
  39933. protocol: 'streaming',
  39934. fn: function (aString){
  39935. var self=this;
  39936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39937. return smalltalk.withContext(function($ctx1) {
  39938. //>>excludeEnd("ctx");
  39939. var $1,$2;
  39940. $1=self["@stream"];
  39941. _st($1)._nextPutAll_("function $");
  39942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39943. $ctx1.sendIdx["nextPutAll:"]=1;
  39944. //>>excludeEnd("ctx");
  39945. _st($1)._nextPutAll_(aString);
  39946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39947. $ctx1.sendIdx["nextPutAll:"]=2;
  39948. //>>excludeEnd("ctx");
  39949. _st($1)._nextPutAll_("(){return globals.");
  39950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39951. $ctx1.sendIdx["nextPutAll:"]=3;
  39952. //>>excludeEnd("ctx");
  39953. _st($1)._nextPutAll_(aString);
  39954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39955. $ctx1.sendIdx["nextPutAll:"]=4;
  39956. //>>excludeEnd("ctx");
  39957. _st($1)._nextPutAll_("||(typeof ");
  39958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39959. $ctx1.sendIdx["nextPutAll:"]=5;
  39960. //>>excludeEnd("ctx");
  39961. _st($1)._nextPutAll_(aString);
  39962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39963. $ctx1.sendIdx["nextPutAll:"]=6;
  39964. //>>excludeEnd("ctx");
  39965. _st($1)._nextPutAll_("==\x22undefined\x22?nil:");
  39966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39967. $ctx1.sendIdx["nextPutAll:"]=7;
  39968. //>>excludeEnd("ctx");
  39969. _st($1)._nextPutAll_(aString);
  39970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39971. $ctx1.sendIdx["nextPutAll:"]=8;
  39972. //>>excludeEnd("ctx");
  39973. _st($1)._nextPutAll_(")}");
  39974. $2=_st($1)._lf();
  39975. return self;
  39976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39977. }, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},globals.JSStream)});
  39978. //>>excludeEnd("ctx");
  39979. },
  39980. //>>excludeStart("ide", pragmas.excludeIdeData);
  39981. args: ["aString"],
  39982. source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf",
  39983. referencedClasses: [],
  39984. //>>excludeEnd("ide");
  39985. messageSends: ["nextPutAll:", "lf"]
  39986. }),
  39987. globals.JSStream);
  39988. smalltalk.addMethod(
  39989. smalltalk.method({
  39990. selector: "nextPutClosureWith:arguments:",
  39991. protocol: 'streaming',
  39992. fn: function (aBlock,anArray){
  39993. var self=this;
  39994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39995. return smalltalk.withContext(function($ctx1) {
  39996. //>>excludeEnd("ctx");
  39997. var $1,$2,$3,$4;
  39998. _st(self["@stream"])._nextPutAll_("(function(");
  39999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40000. $ctx1.sendIdx["nextPutAll:"]=1;
  40001. //>>excludeEnd("ctx");
  40002. _st(anArray)._do_separatedBy_((function(each){
  40003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40004. return smalltalk.withContext(function($ctx2) {
  40005. //>>excludeEnd("ctx");
  40006. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  40007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40008. $ctx2.sendIdx["nextPutAll:"]=2;
  40009. //>>excludeEnd("ctx");
  40010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40012. //>>excludeEnd("ctx");
  40013. }),(function(){
  40014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40015. return smalltalk.withContext(function($ctx2) {
  40016. //>>excludeEnd("ctx");
  40017. return _st(self["@stream"])._nextPut_(",");
  40018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40020. //>>excludeEnd("ctx");
  40021. }));
  40022. $1=self["@stream"];
  40023. _st($1)._nextPutAll_("){");
  40024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40025. $ctx1.sendIdx["nextPutAll:"]=3;
  40026. //>>excludeEnd("ctx");
  40027. $2=_st($1)._lf();
  40028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40029. $ctx1.sendIdx["lf"]=1;
  40030. //>>excludeEnd("ctx");
  40031. _st(aBlock)._value();
  40032. $3=self["@stream"];
  40033. _st($3)._lf();
  40034. $4=_st($3)._nextPutAll_("})");
  40035. return self;
  40036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40037. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)});
  40038. //>>excludeEnd("ctx");
  40039. },
  40040. //>>excludeStart("ide", pragmas.excludeIdeData);
  40041. args: ["aBlock", "anArray"],
  40042. source: "nextPutClosureWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '})'",
  40043. referencedClasses: [],
  40044. //>>excludeEnd("ide");
  40045. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40046. }),
  40047. globals.JSStream);
  40048. smalltalk.addMethod(
  40049. smalltalk.method({
  40050. selector: "nextPutContextFor:during:",
  40051. protocol: 'streaming',
  40052. fn: function (aMethod,aBlock){
  40053. var self=this;
  40054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40055. return smalltalk.withContext(function($ctx1) {
  40056. //>>excludeEnd("ctx");
  40057. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  40058. $1=_st(aMethod)._requiresSmalltalkContext();
  40059. if(! smalltalk.assert($1)){
  40060. $2=_st(aBlock)._value();
  40061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40062. $ctx1.sendIdx["value"]=1;
  40063. //>>excludeEnd("ctx");
  40064. return $2;
  40065. };
  40066. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40068. $ctx1.sendIdx["nextPutAll:"]=1;
  40069. //>>excludeEnd("ctx");
  40070. self._lf();
  40071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40072. $ctx1.sendIdx["lf"]=1;
  40073. //>>excludeEnd("ctx");
  40074. $6=_st(aMethod)._scope();
  40075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40076. $ctx1.sendIdx["scope"]=1;
  40077. //>>excludeEnd("ctx");
  40078. $5=_st($6)._alias();
  40079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40080. $ctx1.sendIdx["alias"]=1;
  40081. //>>excludeEnd("ctx");
  40082. $4="return smalltalk.withContext(function(".__comma($5);
  40083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40084. $ctx1.sendIdx[","]=2;
  40085. //>>excludeEnd("ctx");
  40086. $3=_st($4).__comma(") { ");
  40087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40088. $ctx1.sendIdx[","]=1;
  40089. //>>excludeEnd("ctx");
  40090. self._nextPutAll_($3);
  40091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40092. $ctx1.sendIdx["nextPutAll:"]=2;
  40093. //>>excludeEnd("ctx");
  40094. self._lf();
  40095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40096. $ctx1.sendIdx["lf"]=2;
  40097. //>>excludeEnd("ctx");
  40098. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40100. $ctx1.sendIdx["nextPutAll:"]=3;
  40101. //>>excludeEnd("ctx");
  40102. $7=self._lf();
  40103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40104. $ctx1.sendIdx["lf"]=3;
  40105. //>>excludeEnd("ctx");
  40106. _st(aBlock)._value();
  40107. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40109. $ctx1.sendIdx["nextPutAll:"]=4;
  40110. //>>excludeEnd("ctx");
  40111. self._lf();
  40112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40113. $ctx1.sendIdx["lf"]=4;
  40114. //>>excludeEnd("ctx");
  40115. $12=_st(aMethod)._scope();
  40116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40117. $ctx1.sendIdx["scope"]=2;
  40118. //>>excludeEnd("ctx");
  40119. $11=_st($12)._alias();
  40120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40121. $ctx1.sendIdx["alias"]=2;
  40122. //>>excludeEnd("ctx");
  40123. $10="}, function(".__comma($11);
  40124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40125. $ctx1.sendIdx[","]=5;
  40126. //>>excludeEnd("ctx");
  40127. $9=_st($10).__comma(") {");
  40128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40129. $ctx1.sendIdx[","]=4;
  40130. //>>excludeEnd("ctx");
  40131. $8=_st($9).__comma(_st(_st(aMethod)._scope())._alias());
  40132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40133. $ctx1.sendIdx[","]=3;
  40134. //>>excludeEnd("ctx");
  40135. self._nextPutAll_($8);
  40136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40137. $ctx1.sendIdx["nextPutAll:"]=5;
  40138. //>>excludeEnd("ctx");
  40139. $16=_st(_st(aMethod)._selector())._asJavascript();
  40140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40141. $ctx1.sendIdx["asJavascript"]=1;
  40142. //>>excludeEnd("ctx");
  40143. $15=".fill(self,".__comma($16);
  40144. $14=_st($15).__comma(",{");
  40145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40146. $ctx1.sendIdx[","]=6;
  40147. //>>excludeEnd("ctx");
  40148. $13=self._nextPutAll_($14);
  40149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40150. $ctx1.sendIdx["nextPutAll:"]=6;
  40151. //>>excludeEnd("ctx");
  40152. _st(_st(aMethod)._locals())._do_separatedBy_((function(each){
  40153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40154. return smalltalk.withContext(function($ctx2) {
  40155. //>>excludeEnd("ctx");
  40156. $17=_st(each)._asVariableName();
  40157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40158. $ctx2.sendIdx["asVariableName"]=1;
  40159. //>>excludeEnd("ctx");
  40160. self._nextPutAll_($17);
  40161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40162. $ctx2.sendIdx["nextPutAll:"]=7;
  40163. //>>excludeEnd("ctx");
  40164. self._nextPutAll_(":");
  40165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40166. $ctx2.sendIdx["nextPutAll:"]=8;
  40167. //>>excludeEnd("ctx");
  40168. $18=self._nextPutAll_(_st(each)._asVariableName());
  40169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40170. $ctx2.sendIdx["nextPutAll:"]=9;
  40171. //>>excludeEnd("ctx");
  40172. return $18;
  40173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40175. //>>excludeEnd("ctx");
  40176. }),(function(){
  40177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40178. return smalltalk.withContext(function($ctx2) {
  40179. //>>excludeEnd("ctx");
  40180. return self._nextPutAll_(",");
  40181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40182. $ctx2.sendIdx["nextPutAll:"]=10;
  40183. //>>excludeEnd("ctx");
  40184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40186. //>>excludeEnd("ctx");
  40187. }));
  40188. self._nextPutAll_("},");
  40189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40190. $ctx1.sendIdx["nextPutAll:"]=11;
  40191. //>>excludeEnd("ctx");
  40192. self._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
  40193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40194. $ctx1.sendIdx["nextPutAll:"]=12;
  40195. //>>excludeEnd("ctx");
  40196. self._nextPutAll_(")});");
  40197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40198. $ctx1.sendIdx["nextPutAll:"]=13;
  40199. //>>excludeEnd("ctx");
  40200. self._lf();
  40201. $19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40202. return self;
  40203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40204. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)});
  40205. //>>excludeEnd("ctx");
  40206. },
  40207. //>>excludeStart("ide", pragmas.excludeIdeData);
  40208. args: ["aMethod", "aBlock"],
  40209. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { ';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  40210. referencedClasses: [],
  40211. //>>excludeEnd("ide");
  40212. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  40213. }),
  40214. globals.JSStream);
  40215. smalltalk.addMethod(
  40216. smalltalk.method({
  40217. selector: "nextPutFunctionWith:arguments:",
  40218. protocol: 'streaming',
  40219. fn: function (aBlock,anArray){
  40220. var self=this;
  40221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40222. return smalltalk.withContext(function($ctx1) {
  40223. //>>excludeEnd("ctx");
  40224. var $1,$2,$3,$4,$5,$6;
  40225. _st(self["@stream"])._nextPutAll_("fn: function(");
  40226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40227. $ctx1.sendIdx["nextPutAll:"]=1;
  40228. //>>excludeEnd("ctx");
  40229. _st(anArray)._do_separatedBy_((function(each){
  40230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40231. return smalltalk.withContext(function($ctx2) {
  40232. //>>excludeEnd("ctx");
  40233. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  40234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40235. $ctx2.sendIdx["nextPutAll:"]=2;
  40236. //>>excludeEnd("ctx");
  40237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40239. //>>excludeEnd("ctx");
  40240. }),(function(){
  40241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40242. return smalltalk.withContext(function($ctx2) {
  40243. //>>excludeEnd("ctx");
  40244. return _st(self["@stream"])._nextPut_(",");
  40245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40247. //>>excludeEnd("ctx");
  40248. }));
  40249. $1=self["@stream"];
  40250. _st($1)._nextPutAll_("){");
  40251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40252. $ctx1.sendIdx["nextPutAll:"]=3;
  40253. //>>excludeEnd("ctx");
  40254. $2=_st($1)._lf();
  40255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40256. $ctx1.sendIdx["lf"]=1;
  40257. //>>excludeEnd("ctx");
  40258. $3=self["@stream"];
  40259. _st($3)._nextPutAll_("var self=this;");
  40260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40261. $ctx1.sendIdx["nextPutAll:"]=4;
  40262. //>>excludeEnd("ctx");
  40263. $4=_st($3)._lf();
  40264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40265. $ctx1.sendIdx["lf"]=2;
  40266. //>>excludeEnd("ctx");
  40267. _st(aBlock)._value();
  40268. $5=self["@stream"];
  40269. _st($5)._lf();
  40270. $6=_st($5)._nextPutAll_("}");
  40271. return self;
  40272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40273. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)});
  40274. //>>excludeEnd("ctx");
  40275. },
  40276. //>>excludeStart("ide", pragmas.excludeIdeData);
  40277. args: ["aBlock", "anArray"],
  40278. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  40279. referencedClasses: [],
  40280. //>>excludeEnd("ide");
  40281. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40282. }),
  40283. globals.JSStream);
  40284. smalltalk.addMethod(
  40285. smalltalk.method({
  40286. selector: "nextPutIf:with:",
  40287. protocol: 'streaming',
  40288. fn: function (aBlock,anotherBlock){
  40289. var self=this;
  40290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40291. return smalltalk.withContext(function($ctx1) {
  40292. //>>excludeEnd("ctx");
  40293. var $1,$2;
  40294. _st(self["@stream"])._nextPutAll_("if(");
  40295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40296. $ctx1.sendIdx["nextPutAll:"]=1;
  40297. //>>excludeEnd("ctx");
  40298. _st(aBlock)._value();
  40299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40300. $ctx1.sendIdx["value"]=1;
  40301. //>>excludeEnd("ctx");
  40302. $1=self["@stream"];
  40303. _st($1)._nextPutAll_("){");
  40304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40305. $ctx1.sendIdx["nextPutAll:"]=2;
  40306. //>>excludeEnd("ctx");
  40307. $2=_st($1)._lf();
  40308. _st(anotherBlock)._value();
  40309. _st(self["@stream"])._nextPutAll_("}");
  40310. return self;
  40311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40312. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.JSStream)});
  40313. //>>excludeEnd("ctx");
  40314. },
  40315. //>>excludeStart("ide", pragmas.excludeIdeData);
  40316. args: ["aBlock", "anotherBlock"],
  40317. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  40318. referencedClasses: [],
  40319. //>>excludeEnd("ide");
  40320. messageSends: ["nextPutAll:", "value", "lf"]
  40321. }),
  40322. globals.JSStream);
  40323. smalltalk.addMethod(
  40324. smalltalk.method({
  40325. selector: "nextPutIfElse:with:with:",
  40326. protocol: 'streaming',
  40327. fn: function (aBlock,ifBlock,elseBlock){
  40328. var self=this;
  40329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40330. return smalltalk.withContext(function($ctx1) {
  40331. //>>excludeEnd("ctx");
  40332. var $1,$2,$3,$4;
  40333. _st(self["@stream"])._nextPutAll_("if(");
  40334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40335. $ctx1.sendIdx["nextPutAll:"]=1;
  40336. //>>excludeEnd("ctx");
  40337. _st(aBlock)._value();
  40338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40339. $ctx1.sendIdx["value"]=1;
  40340. //>>excludeEnd("ctx");
  40341. $1=self["@stream"];
  40342. _st($1)._nextPutAll_("){");
  40343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40344. $ctx1.sendIdx["nextPutAll:"]=2;
  40345. //>>excludeEnd("ctx");
  40346. $2=_st($1)._lf();
  40347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40348. $ctx1.sendIdx["lf"]=1;
  40349. //>>excludeEnd("ctx");
  40350. _st(ifBlock)._value();
  40351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40352. $ctx1.sendIdx["value"]=2;
  40353. //>>excludeEnd("ctx");
  40354. $3=self["@stream"];
  40355. _st($3)._nextPutAll_("} else {");
  40356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40357. $ctx1.sendIdx["nextPutAll:"]=3;
  40358. //>>excludeEnd("ctx");
  40359. $4=_st($3)._lf();
  40360. _st(elseBlock)._value();
  40361. _st(self["@stream"])._nextPutAll_("}");
  40362. return self;
  40363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40364. }, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},globals.JSStream)});
  40365. //>>excludeEnd("ctx");
  40366. },
  40367. //>>excludeStart("ide", pragmas.excludeIdeData);
  40368. args: ["aBlock", "ifBlock", "elseBlock"],
  40369. source: "nextPutIfElse: aBlock with: ifBlock with: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'",
  40370. referencedClasses: [],
  40371. //>>excludeEnd("ide");
  40372. messageSends: ["nextPutAll:", "value", "lf"]
  40373. }),
  40374. globals.JSStream);
  40375. smalltalk.addMethod(
  40376. smalltalk.method({
  40377. selector: "nextPutMethodDeclaration:with:",
  40378. protocol: 'streaming',
  40379. fn: function (aMethod,aBlock){
  40380. var self=this;
  40381. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  40382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40383. return smalltalk.withContext(function($ctx1) {
  40384. //>>excludeEnd("ctx");
  40385. var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26;
  40386. $1=self["@stream"];
  40387. _st($1)._nextPutAll_("smalltalk.method({");
  40388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40389. $ctx1.sendIdx["nextPutAll:"]=1;
  40390. //>>excludeEnd("ctx");
  40391. _st($1)._lf();
  40392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40393. $ctx1.sendIdx["lf"]=1;
  40394. //>>excludeEnd("ctx");
  40395. $2=$1;
  40396. $5=_st(_st(aMethod)._selector())._asJavascript();
  40397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40398. $ctx1.sendIdx["asJavascript"]=1;
  40399. //>>excludeEnd("ctx");
  40400. $4="selector: ".__comma($5);
  40401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40402. $ctx1.sendIdx[","]=2;
  40403. //>>excludeEnd("ctx");
  40404. $3=_st($4).__comma(",");
  40405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40406. $ctx1.sendIdx[","]=1;
  40407. //>>excludeEnd("ctx");
  40408. _st($2)._nextPutAll_($3);
  40409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40410. $ctx1.sendIdx["nextPutAll:"]=2;
  40411. //>>excludeEnd("ctx");
  40412. _st($1)._lf();
  40413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40414. $ctx1.sendIdx["lf"]=2;
  40415. //>>excludeEnd("ctx");
  40416. $6=$1;
  40417. $9=_st(_st(aMethod)._source())._asJavascript();
  40418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40419. $ctx1.sendIdx["asJavascript"]=2;
  40420. //>>excludeEnd("ctx");
  40421. $8="source: ".__comma($9);
  40422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40423. $ctx1.sendIdx[","]=4;
  40424. //>>excludeEnd("ctx");
  40425. $7=_st($8).__comma(",");
  40426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40427. $ctx1.sendIdx[","]=3;
  40428. //>>excludeEnd("ctx");
  40429. _st($6)._nextPutAll_($7);
  40430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40431. $ctx1.sendIdx["nextPutAll:"]=3;
  40432. //>>excludeEnd("ctx");
  40433. $10=_st($1)._lf();
  40434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40435. $ctx1.sendIdx["lf"]=3;
  40436. //>>excludeEnd("ctx");
  40437. _st(aBlock)._value();
  40438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40439. $ctx1.sendIdx["value"]=1;
  40440. //>>excludeEnd("ctx");
  40441. $11=self["@stream"];
  40442. $12=$11;
  40443. $15=_st($String())._lf();
  40444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40445. $ctx1.sendIdx["lf"]=4;
  40446. //>>excludeEnd("ctx");
  40447. $14=",".__comma($15);
  40448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40449. $ctx1.sendIdx[","]=6;
  40450. //>>excludeEnd("ctx");
  40451. $13=_st($14).__comma("messageSends: ");
  40452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40453. $ctx1.sendIdx[","]=5;
  40454. //>>excludeEnd("ctx");
  40455. _st($12)._nextPutAll_($13);
  40456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40457. $ctx1.sendIdx["nextPutAll:"]=4;
  40458. //>>excludeEnd("ctx");
  40459. $16=$11;
  40460. $19=_st(_st(aMethod)._messageSends())._asArray();
  40461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40462. $ctx1.sendIdx["asArray"]=1;
  40463. //>>excludeEnd("ctx");
  40464. $18=_st($19)._asJavascript();
  40465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40466. $ctx1.sendIdx["asJavascript"]=3;
  40467. //>>excludeEnd("ctx");
  40468. $17=_st($18).__comma(",");
  40469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40470. $ctx1.sendIdx[","]=7;
  40471. //>>excludeEnd("ctx");
  40472. _st($16)._nextPutAll_($17);
  40473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40474. $ctx1.sendIdx["nextPutAll:"]=5;
  40475. //>>excludeEnd("ctx");
  40476. _st($11)._lf();
  40477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40478. $ctx1.sendIdx["lf"]=5;
  40479. //>>excludeEnd("ctx");
  40480. $20=$11;
  40481. $23=_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  40482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40483. return smalltalk.withContext(function($ctx2) {
  40484. //>>excludeEnd("ctx");
  40485. return _st(each)._value();
  40486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40487. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40488. //>>excludeEnd("ctx");
  40489. })))._asArray())._asJavascript();
  40490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40491. $ctx1.sendIdx["asJavascript"]=4;
  40492. //>>excludeEnd("ctx");
  40493. $22="args: ".__comma($23);
  40494. $21=_st($22).__comma(",");
  40495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40496. $ctx1.sendIdx[","]=8;
  40497. //>>excludeEnd("ctx");
  40498. _st($20)._nextPutAll_($21);
  40499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40500. $ctx1.sendIdx["nextPutAll:"]=6;
  40501. //>>excludeEnd("ctx");
  40502. _st($11)._lf();
  40503. $24=_st($11)._nextPutAll_("referencedClasses: [");
  40504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40505. $ctx1.sendIdx["nextPutAll:"]=7;
  40506. //>>excludeEnd("ctx");
  40507. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  40508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40509. return smalltalk.withContext(function($ctx2) {
  40510. //>>excludeEnd("ctx");
  40511. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  40512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40513. $ctx2.sendIdx["nextPutAll:"]=8;
  40514. //>>excludeEnd("ctx");
  40515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40517. //>>excludeEnd("ctx");
  40518. }),(function(){
  40519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40520. return smalltalk.withContext(function($ctx2) {
  40521. //>>excludeEnd("ctx");
  40522. return _st(self["@stream"])._nextPutAll_(",");
  40523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40524. $ctx2.sendIdx["nextPutAll:"]=9;
  40525. //>>excludeEnd("ctx");
  40526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40528. //>>excludeEnd("ctx");
  40529. }));
  40530. $25=self["@stream"];
  40531. _st($25)._nextPutAll_("]");
  40532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40533. $ctx1.sendIdx["nextPutAll:"]=10;
  40534. //>>excludeEnd("ctx");
  40535. $26=_st($25)._nextPutAll_("})");
  40536. return self;
  40537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40538. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)});
  40539. //>>excludeEnd("ctx");
  40540. },
  40541. //>>excludeStart("ide", pragmas.excludeIdeData);
  40542. args: ["aMethod", "aBlock"],
  40543. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  40544. referencedClasses: ["String"],
  40545. //>>excludeEnd("ide");
  40546. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  40547. }),
  40548. globals.JSStream);
  40549. smalltalk.addMethod(
  40550. smalltalk.method({
  40551. selector: "nextPutNonLocalReturnHandlingWith:",
  40552. protocol: 'streaming',
  40553. fn: function (aBlock){
  40554. var self=this;
  40555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40556. return smalltalk.withContext(function($ctx1) {
  40557. //>>excludeEnd("ctx");
  40558. var $1,$2,$3,$4;
  40559. $1=self["@stream"];
  40560. _st($1)._nextPutAll_("var $early={};");
  40561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40562. $ctx1.sendIdx["nextPutAll:"]=1;
  40563. //>>excludeEnd("ctx");
  40564. _st($1)._lf();
  40565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40566. $ctx1.sendIdx["lf"]=1;
  40567. //>>excludeEnd("ctx");
  40568. _st($1)._nextPutAll_("try {");
  40569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40570. $ctx1.sendIdx["nextPutAll:"]=2;
  40571. //>>excludeEnd("ctx");
  40572. $2=_st($1)._lf();
  40573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40574. $ctx1.sendIdx["lf"]=2;
  40575. //>>excludeEnd("ctx");
  40576. _st(aBlock)._value();
  40577. $3=self["@stream"];
  40578. _st($3)._nextPutAll_("}");
  40579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40580. $ctx1.sendIdx["nextPutAll:"]=3;
  40581. //>>excludeEnd("ctx");
  40582. _st($3)._lf();
  40583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40584. $ctx1.sendIdx["lf"]=3;
  40585. //>>excludeEnd("ctx");
  40586. _st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  40587. $4=_st($3)._lf();
  40588. return self;
  40589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40590. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},globals.JSStream)});
  40591. //>>excludeEnd("ctx");
  40592. },
  40593. //>>excludeStart("ide", pragmas.excludeIdeData);
  40594. args: ["aBlock"],
  40595. source: "nextPutNonLocalReturnHandlingWith: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'var $early={};'; lf;\x0a\x09\x09nextPutAll: 'try {'; lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: '}'; lf;\x0a\x09\x09nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf",
  40596. referencedClasses: [],
  40597. //>>excludeEnd("ide");
  40598. messageSends: ["nextPutAll:", "lf", "value"]
  40599. }),
  40600. globals.JSStream);
  40601. smalltalk.addMethod(
  40602. smalltalk.method({
  40603. selector: "nextPutNonLocalReturnWith:",
  40604. protocol: 'streaming',
  40605. fn: function (aBlock){
  40606. var self=this;
  40607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40608. return smalltalk.withContext(function($ctx1) {
  40609. //>>excludeEnd("ctx");
  40610. _st(self["@stream"])._nextPutAll_("throw $early=[");
  40611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40612. $ctx1.sendIdx["nextPutAll:"]=1;
  40613. //>>excludeEnd("ctx");
  40614. _st(aBlock)._value();
  40615. _st(self["@stream"])._nextPutAll_("]");
  40616. return self;
  40617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40618. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},globals.JSStream)});
  40619. //>>excludeEnd("ctx");
  40620. },
  40621. //>>excludeStart("ide", pragmas.excludeIdeData);
  40622. args: ["aBlock"],
  40623. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  40624. referencedClasses: [],
  40625. //>>excludeEnd("ide");
  40626. messageSends: ["nextPutAll:", "value"]
  40627. }),
  40628. globals.JSStream);
  40629. smalltalk.addMethod(
  40630. smalltalk.method({
  40631. selector: "nextPutReturn",
  40632. protocol: 'streaming',
  40633. fn: function (){
  40634. var self=this;
  40635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40636. return smalltalk.withContext(function($ctx1) {
  40637. //>>excludeEnd("ctx");
  40638. _st(self["@stream"])._nextPutAll_("return ");
  40639. return self;
  40640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40641. }, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},globals.JSStream)});
  40642. //>>excludeEnd("ctx");
  40643. },
  40644. //>>excludeStart("ide", pragmas.excludeIdeData);
  40645. args: [],
  40646. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  40647. referencedClasses: [],
  40648. //>>excludeEnd("ide");
  40649. messageSends: ["nextPutAll:"]
  40650. }),
  40651. globals.JSStream);
  40652. smalltalk.addMethod(
  40653. smalltalk.method({
  40654. selector: "nextPutReturnWith:",
  40655. protocol: 'streaming',
  40656. fn: function (aBlock){
  40657. var self=this;
  40658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40659. return smalltalk.withContext(function($ctx1) {
  40660. //>>excludeEnd("ctx");
  40661. self._nextPutReturn();
  40662. _st(aBlock)._value();
  40663. return self;
  40664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40665. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},globals.JSStream)});
  40666. //>>excludeEnd("ctx");
  40667. },
  40668. //>>excludeStart("ide", pragmas.excludeIdeData);
  40669. args: ["aBlock"],
  40670. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  40671. referencedClasses: [],
  40672. //>>excludeEnd("ide");
  40673. messageSends: ["nextPutReturn", "value"]
  40674. }),
  40675. globals.JSStream);
  40676. smalltalk.addMethod(
  40677. smalltalk.method({
  40678. selector: "nextPutSendIndexFor:",
  40679. protocol: 'streaming',
  40680. fn: function (anIRSend){
  40681. var self=this;
  40682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40683. return smalltalk.withContext(function($ctx1) {
  40684. //>>excludeEnd("ctx");
  40685. var $1;
  40686. self._nextPutAll_(";");
  40687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40688. $ctx1.sendIdx["nextPutAll:"]=1;
  40689. //>>excludeEnd("ctx");
  40690. self._lf();
  40691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40692. $ctx1.sendIdx["lf"]=1;
  40693. //>>excludeEnd("ctx");
  40694. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40696. $ctx1.sendIdx["nextPutAll:"]=2;
  40697. //>>excludeEnd("ctx");
  40698. self._lf();
  40699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40700. $ctx1.sendIdx["lf"]=2;
  40701. //>>excludeEnd("ctx");
  40702. self._nextPutAll_(_st(_st(anIRSend)._scope())._alias());
  40703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40704. $ctx1.sendIdx["nextPutAll:"]=3;
  40705. //>>excludeEnd("ctx");
  40706. self._nextPutAll_(".sendIdx[");
  40707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40708. $ctx1.sendIdx["nextPutAll:"]=4;
  40709. //>>excludeEnd("ctx");
  40710. self._nextPutAll_(_st(_st(anIRSend)._selector())._asJavascript());
  40711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40712. $ctx1.sendIdx["nextPutAll:"]=5;
  40713. //>>excludeEnd("ctx");
  40714. self._nextPutAll_("]=");
  40715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40716. $ctx1.sendIdx["nextPutAll:"]=6;
  40717. //>>excludeEnd("ctx");
  40718. self._nextPutAll_(_st(_st(anIRSend)._index())._asString());
  40719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40720. $ctx1.sendIdx["nextPutAll:"]=7;
  40721. //>>excludeEnd("ctx");
  40722. self._nextPutAll_(";");
  40723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40724. $ctx1.sendIdx["nextPutAll:"]=8;
  40725. //>>excludeEnd("ctx");
  40726. self._lf();
  40727. $1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40728. return self;
  40729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40730. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},globals.JSStream)});
  40731. //>>excludeEnd("ctx");
  40732. },
  40733. //>>excludeStart("ide", pragmas.excludeIdeData);
  40734. args: ["anIRSend"],
  40735. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  40736. referencedClasses: [],
  40737. //>>excludeEnd("ide");
  40738. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  40739. }),
  40740. globals.JSStream);
  40741. smalltalk.addMethod(
  40742. smalltalk.method({
  40743. selector: "nextPutSequenceWith:",
  40744. protocol: 'streaming',
  40745. fn: function (aBlock){
  40746. var self=this;
  40747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40748. return smalltalk.withContext(function($ctx1) {
  40749. //>>excludeEnd("ctx");
  40750. _st(aBlock)._value();
  40751. return self;
  40752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40753. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},globals.JSStream)});
  40754. //>>excludeEnd("ctx");
  40755. },
  40756. //>>excludeStart("ide", pragmas.excludeIdeData);
  40757. args: ["aBlock"],
  40758. source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch(smalltalk.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22",
  40759. referencedClasses: [],
  40760. //>>excludeEnd("ide");
  40761. messageSends: ["value"]
  40762. }),
  40763. globals.JSStream);
  40764. smalltalk.addMethod(
  40765. smalltalk.method({
  40766. selector: "nextPutStatementWith:",
  40767. protocol: 'streaming',
  40768. fn: function (aBlock){
  40769. var self=this;
  40770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40771. return smalltalk.withContext(function($ctx1) {
  40772. //>>excludeEnd("ctx");
  40773. var $1,$2;
  40774. _st(aBlock)._value();
  40775. $1=self["@stream"];
  40776. _st($1)._nextPutAll_(";");
  40777. $2=_st($1)._lf();
  40778. return self;
  40779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40780. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},globals.JSStream)});
  40781. //>>excludeEnd("ctx");
  40782. },
  40783. //>>excludeStart("ide", pragmas.excludeIdeData);
  40784. args: ["aBlock"],
  40785. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  40786. referencedClasses: [],
  40787. //>>excludeEnd("ide");
  40788. messageSends: ["value", "nextPutAll:", "lf"]
  40789. }),
  40790. globals.JSStream);
  40791. smalltalk.addMethod(
  40792. smalltalk.method({
  40793. selector: "nextPutVars:",
  40794. protocol: 'streaming',
  40795. fn: function (aCollection){
  40796. var self=this;
  40797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40798. return smalltalk.withContext(function($ctx1) {
  40799. //>>excludeEnd("ctx");
  40800. var $1,$2;
  40801. var $early={};
  40802. try {
  40803. _st(aCollection)._ifEmpty_((function(){
  40804. throw $early=[self];
  40805. }));
  40806. _st(self["@stream"])._nextPutAll_("var ");
  40807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40808. $ctx1.sendIdx["nextPutAll:"]=1;
  40809. //>>excludeEnd("ctx");
  40810. _st(aCollection)._do_separatedBy_((function(each){
  40811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40812. return smalltalk.withContext(function($ctx2) {
  40813. //>>excludeEnd("ctx");
  40814. return _st(self["@stream"])._nextPutAll_(each);
  40815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40816. $ctx2.sendIdx["nextPutAll:"]=2;
  40817. //>>excludeEnd("ctx");
  40818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40820. //>>excludeEnd("ctx");
  40821. }),(function(){
  40822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40823. return smalltalk.withContext(function($ctx2) {
  40824. //>>excludeEnd("ctx");
  40825. return _st(self["@stream"])._nextPutAll_(",");
  40826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40827. $ctx2.sendIdx["nextPutAll:"]=3;
  40828. //>>excludeEnd("ctx");
  40829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40831. //>>excludeEnd("ctx");
  40832. }));
  40833. $1=self["@stream"];
  40834. _st($1)._nextPutAll_(";");
  40835. $2=_st($1)._lf();
  40836. return self;
  40837. }
  40838. catch(e) {if(e===$early)return e[0]; throw e}
  40839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40840. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},globals.JSStream)});
  40841. //>>excludeEnd("ctx");
  40842. },
  40843. //>>excludeStart("ide", pragmas.excludeIdeData);
  40844. args: ["aCollection"],
  40845. source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  40846. referencedClasses: [],
  40847. //>>excludeEnd("ide");
  40848. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40849. }),
  40850. globals.JSStream);
  40851. smalltalk.addMethod(
  40852. smalltalk.method({
  40853. selector: "appendToInstruction:",
  40854. protocol: '*Compiler-IR',
  40855. fn: function (anIRInstruction){
  40856. var self=this;
  40857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40858. return smalltalk.withContext(function($ctx1) {
  40859. //>>excludeEnd("ctx");
  40860. _st(anIRInstruction)._appendBlock_(self);
  40861. return self;
  40862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40863. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},globals.BlockClosure)});
  40864. //>>excludeEnd("ctx");
  40865. },
  40866. //>>excludeStart("ide", pragmas.excludeIdeData);
  40867. args: ["anIRInstruction"],
  40868. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40869. referencedClasses: [],
  40870. //>>excludeEnd("ide");
  40871. messageSends: ["appendBlock:"]
  40872. }),
  40873. globals.BlockClosure);
  40874. });
  40875. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  40876. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  40877. smalltalk.addPackage('Compiler-Inlining');
  40878. smalltalk.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40879. smalltalk.addClass('IRInlinedAssignment', globals.IRAssignment, [], 'Compiler-Inlining');
  40880. //>>excludeStart("ide", pragmas.excludeIdeData);
  40881. globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  40882. //>>excludeEnd("ide");
  40883. smalltalk.addMethod(
  40884. smalltalk.method({
  40885. selector: "accept:",
  40886. protocol: 'visiting',
  40887. fn: function (aVisitor){
  40888. var self=this;
  40889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40890. return smalltalk.withContext(function($ctx1) {
  40891. //>>excludeEnd("ctx");
  40892. var $1;
  40893. $1=_st(aVisitor)._visitIRInlinedAssignment_(self);
  40894. return $1;
  40895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40896. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedAssignment)});
  40897. //>>excludeEnd("ctx");
  40898. },
  40899. //>>excludeStart("ide", pragmas.excludeIdeData);
  40900. args: ["aVisitor"],
  40901. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  40902. referencedClasses: [],
  40903. //>>excludeEnd("ide");
  40904. messageSends: ["visitIRInlinedAssignment:"]
  40905. }),
  40906. globals.IRInlinedAssignment);
  40907. smalltalk.addMethod(
  40908. smalltalk.method({
  40909. selector: "isInlined",
  40910. protocol: 'testing',
  40911. fn: function (){
  40912. var self=this;
  40913. return true;
  40914. },
  40915. //>>excludeStart("ide", pragmas.excludeIdeData);
  40916. args: [],
  40917. source: "isInlined\x0a\x09^ true",
  40918. referencedClasses: [],
  40919. //>>excludeEnd("ide");
  40920. messageSends: []
  40921. }),
  40922. globals.IRInlinedAssignment);
  40923. smalltalk.addClass('IRInlinedClosure', globals.IRClosure, [], 'Compiler-Inlining');
  40924. //>>excludeStart("ide", pragmas.excludeIdeData);
  40925. globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  40926. //>>excludeEnd("ide");
  40927. smalltalk.addMethod(
  40928. smalltalk.method({
  40929. selector: "accept:",
  40930. protocol: 'visiting',
  40931. fn: function (aVisitor){
  40932. var self=this;
  40933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40934. return smalltalk.withContext(function($ctx1) {
  40935. //>>excludeEnd("ctx");
  40936. _st(aVisitor)._visitIRInlinedClosure_(self);
  40937. return self;
  40938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40939. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedClosure)});
  40940. //>>excludeEnd("ctx");
  40941. },
  40942. //>>excludeStart("ide", pragmas.excludeIdeData);
  40943. args: ["aVisitor"],
  40944. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  40945. referencedClasses: [],
  40946. //>>excludeEnd("ide");
  40947. messageSends: ["visitIRInlinedClosure:"]
  40948. }),
  40949. globals.IRInlinedClosure);
  40950. smalltalk.addMethod(
  40951. smalltalk.method({
  40952. selector: "isInlined",
  40953. protocol: 'testing',
  40954. fn: function (){
  40955. var self=this;
  40956. return true;
  40957. },
  40958. //>>excludeStart("ide", pragmas.excludeIdeData);
  40959. args: [],
  40960. source: "isInlined\x0a\x09^ true",
  40961. referencedClasses: [],
  40962. //>>excludeEnd("ide");
  40963. messageSends: []
  40964. }),
  40965. globals.IRInlinedClosure);
  40966. smalltalk.addClass('IRInlinedReturn', globals.IRReturn, [], 'Compiler-Inlining');
  40967. //>>excludeStart("ide", pragmas.excludeIdeData);
  40968. globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  40969. //>>excludeEnd("ide");
  40970. smalltalk.addMethod(
  40971. smalltalk.method({
  40972. selector: "accept:",
  40973. protocol: 'visiting',
  40974. fn: function (aVisitor){
  40975. var self=this;
  40976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40977. return smalltalk.withContext(function($ctx1) {
  40978. //>>excludeEnd("ctx");
  40979. var $1;
  40980. $1=_st(aVisitor)._visitIRInlinedReturn_(self);
  40981. return $1;
  40982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40983. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedReturn)});
  40984. //>>excludeEnd("ctx");
  40985. },
  40986. //>>excludeStart("ide", pragmas.excludeIdeData);
  40987. args: ["aVisitor"],
  40988. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  40989. referencedClasses: [],
  40990. //>>excludeEnd("ide");
  40991. messageSends: ["visitIRInlinedReturn:"]
  40992. }),
  40993. globals.IRInlinedReturn);
  40994. smalltalk.addMethod(
  40995. smalltalk.method({
  40996. selector: "isInlined",
  40997. protocol: 'testing',
  40998. fn: function (){
  40999. var self=this;
  41000. return true;
  41001. },
  41002. //>>excludeStart("ide", pragmas.excludeIdeData);
  41003. args: [],
  41004. source: "isInlined\x0a\x09^ true",
  41005. referencedClasses: [],
  41006. //>>excludeEnd("ide");
  41007. messageSends: []
  41008. }),
  41009. globals.IRInlinedReturn);
  41010. smalltalk.addClass('IRInlinedSend', globals.IRSend, [], 'Compiler-Inlining');
  41011. //>>excludeStart("ide", pragmas.excludeIdeData);
  41012. globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  41013. //>>excludeEnd("ide");
  41014. smalltalk.addMethod(
  41015. smalltalk.method({
  41016. selector: "accept:",
  41017. protocol: 'visiting',
  41018. fn: function (aVisitor){
  41019. var self=this;
  41020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41021. return smalltalk.withContext(function($ctx1) {
  41022. //>>excludeEnd("ctx");
  41023. _st(aVisitor)._visitInlinedSend_(self);
  41024. return self;
  41025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41026. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSend)});
  41027. //>>excludeEnd("ctx");
  41028. },
  41029. //>>excludeStart("ide", pragmas.excludeIdeData);
  41030. args: ["aVisitor"],
  41031. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  41032. referencedClasses: [],
  41033. //>>excludeEnd("ide");
  41034. messageSends: ["visitInlinedSend:"]
  41035. }),
  41036. globals.IRInlinedSend);
  41037. smalltalk.addMethod(
  41038. smalltalk.method({
  41039. selector: "internalVariables",
  41040. protocol: 'accessing',
  41041. fn: function (){
  41042. var self=this;
  41043. var $1;
  41044. $1=[];
  41045. return $1;
  41046. },
  41047. //>>excludeStart("ide", pragmas.excludeIdeData);
  41048. args: [],
  41049. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  41050. referencedClasses: [],
  41051. //>>excludeEnd("ide");
  41052. messageSends: []
  41053. }),
  41054. globals.IRInlinedSend);
  41055. smalltalk.addMethod(
  41056. smalltalk.method({
  41057. selector: "isInlined",
  41058. protocol: 'testing',
  41059. fn: function (){
  41060. var self=this;
  41061. return true;
  41062. },
  41063. //>>excludeStart("ide", pragmas.excludeIdeData);
  41064. args: [],
  41065. source: "isInlined\x0a\x09^ true",
  41066. referencedClasses: [],
  41067. //>>excludeEnd("ide");
  41068. messageSends: []
  41069. }),
  41070. globals.IRInlinedSend);
  41071. smalltalk.addClass('IRInlinedIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
  41072. //>>excludeStart("ide", pragmas.excludeIdeData);
  41073. globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  41074. //>>excludeEnd("ide");
  41075. smalltalk.addMethod(
  41076. smalltalk.method({
  41077. selector: "accept:",
  41078. protocol: 'visiting',
  41079. fn: function (aVisitor){
  41080. var self=this;
  41081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41082. return smalltalk.withContext(function($ctx1) {
  41083. //>>excludeEnd("ctx");
  41084. _st(aVisitor)._visitIRInlinedIfFalse_(self);
  41085. return self;
  41086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41087. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfFalse)});
  41088. //>>excludeEnd("ctx");
  41089. },
  41090. //>>excludeStart("ide", pragmas.excludeIdeData);
  41091. args: ["aVisitor"],
  41092. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  41093. referencedClasses: [],
  41094. //>>excludeEnd("ide");
  41095. messageSends: ["visitIRInlinedIfFalse:"]
  41096. }),
  41097. globals.IRInlinedIfFalse);
  41098. smalltalk.addClass('IRInlinedIfNilIfNotNil', globals.IRInlinedSend, [], 'Compiler-Inlining');
  41099. //>>excludeStart("ide", pragmas.excludeIdeData);
  41100. globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  41101. //>>excludeEnd("ide");
  41102. smalltalk.addMethod(
  41103. smalltalk.method({
  41104. selector: "accept:",
  41105. protocol: 'visiting',
  41106. fn: function (aVisitor){
  41107. var self=this;
  41108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41109. return smalltalk.withContext(function($ctx1) {
  41110. //>>excludeEnd("ctx");
  41111. _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  41112. return self;
  41113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41114. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfNilIfNotNil)});
  41115. //>>excludeEnd("ctx");
  41116. },
  41117. //>>excludeStart("ide", pragmas.excludeIdeData);
  41118. args: ["aVisitor"],
  41119. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  41120. referencedClasses: [],
  41121. //>>excludeEnd("ide");
  41122. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  41123. }),
  41124. globals.IRInlinedIfNilIfNotNil);
  41125. smalltalk.addMethod(
  41126. smalltalk.method({
  41127. selector: "internalVariables",
  41128. protocol: 'accessing',
  41129. fn: function (){
  41130. var self=this;
  41131. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  41132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41133. return smalltalk.withContext(function($ctx1) {
  41134. //>>excludeEnd("ctx");
  41135. var $1;
  41136. $1=_st($Array())._with_(self._receiverInternalVariable());
  41137. return $1;
  41138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41139. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRInlinedIfNilIfNotNil)});
  41140. //>>excludeEnd("ctx");
  41141. },
  41142. //>>excludeStart("ide", pragmas.excludeIdeData);
  41143. args: [],
  41144. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  41145. referencedClasses: ["Array"],
  41146. //>>excludeEnd("ide");
  41147. messageSends: ["with:", "receiverInternalVariable"]
  41148. }),
  41149. globals.IRInlinedIfNilIfNotNil);
  41150. smalltalk.addMethod(
  41151. smalltalk.method({
  41152. selector: "receiverInternalVariable",
  41153. protocol: 'accessing',
  41154. fn: function (){
  41155. var self=this;
  41156. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  41157. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  41158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41159. return smalltalk.withContext(function($ctx1) {
  41160. //>>excludeEnd("ctx");
  41161. var $2,$3,$1;
  41162. $2=_st($IRVariable())._new();
  41163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41164. $ctx1.sendIdx["new"]=1;
  41165. //>>excludeEnd("ctx");
  41166. _st($2)._variable_(_st(_st($AliasVar())._new())._name_(self._receiverInternalVariableName()));
  41167. $3=_st($2)._yourself();
  41168. $1=$3;
  41169. return $1;
  41170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41171. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},globals.IRInlinedIfNilIfNotNil)});
  41172. //>>excludeEnd("ctx");
  41173. },
  41174. //>>excludeStart("ide", pragmas.excludeIdeData);
  41175. args: [],
  41176. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  41177. referencedClasses: ["IRVariable", "AliasVar"],
  41178. //>>excludeEnd("ide");
  41179. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  41180. }),
  41181. globals.IRInlinedIfNilIfNotNil);
  41182. smalltalk.addMethod(
  41183. smalltalk.method({
  41184. selector: "receiverInternalVariableName",
  41185. protocol: 'accessing',
  41186. fn: function (){
  41187. var self=this;
  41188. return "$receiver";
  41189. },
  41190. //>>excludeStart("ide", pragmas.excludeIdeData);
  41191. args: [],
  41192. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  41193. referencedClasses: [],
  41194. //>>excludeEnd("ide");
  41195. messageSends: []
  41196. }),
  41197. globals.IRInlinedIfNilIfNotNil);
  41198. smalltalk.addClass('IRInlinedIfTrue', globals.IRInlinedSend, [], 'Compiler-Inlining');
  41199. //>>excludeStart("ide", pragmas.excludeIdeData);
  41200. globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  41201. //>>excludeEnd("ide");
  41202. smalltalk.addMethod(
  41203. smalltalk.method({
  41204. selector: "accept:",
  41205. protocol: 'visiting',
  41206. fn: function (aVisitor){
  41207. var self=this;
  41208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41209. return smalltalk.withContext(function($ctx1) {
  41210. //>>excludeEnd("ctx");
  41211. _st(aVisitor)._visitIRInlinedIfTrue_(self);
  41212. return self;
  41213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41214. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrue)});
  41215. //>>excludeEnd("ctx");
  41216. },
  41217. //>>excludeStart("ide", pragmas.excludeIdeData);
  41218. args: ["aVisitor"],
  41219. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  41220. referencedClasses: [],
  41221. //>>excludeEnd("ide");
  41222. messageSends: ["visitIRInlinedIfTrue:"]
  41223. }),
  41224. globals.IRInlinedIfTrue);
  41225. smalltalk.addClass('IRInlinedIfTrueIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
  41226. //>>excludeStart("ide", pragmas.excludeIdeData);
  41227. globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  41228. //>>excludeEnd("ide");
  41229. smalltalk.addMethod(
  41230. smalltalk.method({
  41231. selector: "accept:",
  41232. protocol: 'visiting',
  41233. fn: function (aVisitor){
  41234. var self=this;
  41235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41236. return smalltalk.withContext(function($ctx1) {
  41237. //>>excludeEnd("ctx");
  41238. _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  41239. return self;
  41240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41241. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrueIfFalse)});
  41242. //>>excludeEnd("ctx");
  41243. },
  41244. //>>excludeStart("ide", pragmas.excludeIdeData);
  41245. args: ["aVisitor"],
  41246. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  41247. referencedClasses: [],
  41248. //>>excludeEnd("ide");
  41249. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  41250. }),
  41251. globals.IRInlinedIfTrueIfFalse);
  41252. smalltalk.addClass('IRInlinedSequence', globals.IRBlockSequence, [], 'Compiler-Inlining');
  41253. //>>excludeStart("ide", pragmas.excludeIdeData);
  41254. globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  41255. //>>excludeEnd("ide");
  41256. smalltalk.addMethod(
  41257. smalltalk.method({
  41258. selector: "accept:",
  41259. protocol: 'visiting',
  41260. fn: function (aVisitor){
  41261. var self=this;
  41262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41263. return smalltalk.withContext(function($ctx1) {
  41264. //>>excludeEnd("ctx");
  41265. _st(aVisitor)._visitIRInlinedSequence_(self);
  41266. return self;
  41267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41268. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSequence)});
  41269. //>>excludeEnd("ctx");
  41270. },
  41271. //>>excludeStart("ide", pragmas.excludeIdeData);
  41272. args: ["aVisitor"],
  41273. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  41274. referencedClasses: [],
  41275. //>>excludeEnd("ide");
  41276. messageSends: ["visitIRInlinedSequence:"]
  41277. }),
  41278. globals.IRInlinedSequence);
  41279. smalltalk.addMethod(
  41280. smalltalk.method({
  41281. selector: "isInlined",
  41282. protocol: 'testing',
  41283. fn: function (){
  41284. var self=this;
  41285. return true;
  41286. },
  41287. //>>excludeStart("ide", pragmas.excludeIdeData);
  41288. args: [],
  41289. source: "isInlined\x0a\x09^ true",
  41290. referencedClasses: [],
  41291. //>>excludeEnd("ide");
  41292. messageSends: []
  41293. }),
  41294. globals.IRInlinedSequence);
  41295. smalltalk.addClass('IRInliner', globals.IRVisitor, [], 'Compiler-Inlining');
  41296. //>>excludeStart("ide", pragmas.excludeIdeData);
  41297. globals.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`";
  41298. //>>excludeEnd("ide");
  41299. smalltalk.addMethod(
  41300. smalltalk.method({
  41301. selector: "assignmentInliner",
  41302. protocol: 'factory',
  41303. fn: function (){
  41304. var self=this;
  41305. function $IRAssignmentInliner(){return globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  41306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41307. return smalltalk.withContext(function($ctx1) {
  41308. //>>excludeEnd("ctx");
  41309. var $2,$3,$1;
  41310. $2=_st($IRAssignmentInliner())._new();
  41311. _st($2)._translator_(self);
  41312. $3=_st($2)._yourself();
  41313. $1=$3;
  41314. return $1;
  41315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41316. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},globals.IRInliner)});
  41317. //>>excludeEnd("ctx");
  41318. },
  41319. //>>excludeStart("ide", pragmas.excludeIdeData);
  41320. args: [],
  41321. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41322. referencedClasses: ["IRAssignmentInliner"],
  41323. //>>excludeEnd("ide");
  41324. messageSends: ["translator:", "new", "yourself"]
  41325. }),
  41326. globals.IRInliner);
  41327. smalltalk.addMethod(
  41328. smalltalk.method({
  41329. selector: "returnInliner",
  41330. protocol: 'factory',
  41331. fn: function (){
  41332. var self=this;
  41333. function $IRReturnInliner(){return globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  41334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41335. return smalltalk.withContext(function($ctx1) {
  41336. //>>excludeEnd("ctx");
  41337. var $2,$3,$1;
  41338. $2=_st($IRReturnInliner())._new();
  41339. _st($2)._translator_(self);
  41340. $3=_st($2)._yourself();
  41341. $1=$3;
  41342. return $1;
  41343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41344. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},globals.IRInliner)});
  41345. //>>excludeEnd("ctx");
  41346. },
  41347. //>>excludeStart("ide", pragmas.excludeIdeData);
  41348. args: [],
  41349. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41350. referencedClasses: ["IRReturnInliner"],
  41351. //>>excludeEnd("ide");
  41352. messageSends: ["translator:", "new", "yourself"]
  41353. }),
  41354. globals.IRInliner);
  41355. smalltalk.addMethod(
  41356. smalltalk.method({
  41357. selector: "sendInliner",
  41358. protocol: 'factory',
  41359. fn: function (){
  41360. var self=this;
  41361. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  41362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41363. return smalltalk.withContext(function($ctx1) {
  41364. //>>excludeEnd("ctx");
  41365. var $2,$3,$1;
  41366. $2=_st($IRSendInliner())._new();
  41367. _st($2)._translator_(self);
  41368. $3=_st($2)._yourself();
  41369. $1=$3;
  41370. return $1;
  41371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41372. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},globals.IRInliner)});
  41373. //>>excludeEnd("ctx");
  41374. },
  41375. //>>excludeStart("ide", pragmas.excludeIdeData);
  41376. args: [],
  41377. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41378. referencedClasses: ["IRSendInliner"],
  41379. //>>excludeEnd("ide");
  41380. messageSends: ["translator:", "new", "yourself"]
  41381. }),
  41382. globals.IRInliner);
  41383. smalltalk.addMethod(
  41384. smalltalk.method({
  41385. selector: "shouldInlineAssignment:",
  41386. protocol: 'testing',
  41387. fn: function (anIRAssignment){
  41388. var self=this;
  41389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41390. return smalltalk.withContext(function($ctx1) {
  41391. //>>excludeEnd("ctx");
  41392. var $4,$3,$2,$1;
  41393. $1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){
  41394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41395. return smalltalk.withContext(function($ctx2) {
  41396. //>>excludeEnd("ctx");
  41397. $4=_st(anIRAssignment)._instructions();
  41398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41399. $ctx2.sendIdx["instructions"]=1;
  41400. //>>excludeEnd("ctx");
  41401. $3=_st($4)._last();
  41402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41403. $ctx2.sendIdx["last"]=1;
  41404. //>>excludeEnd("ctx");
  41405. $2=_st($3)._isSend();
  41406. return _st($2)._and_((function(){
  41407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41408. return smalltalk.withContext(function($ctx3) {
  41409. //>>excludeEnd("ctx");
  41410. return self._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last());
  41411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41412. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41413. //>>excludeEnd("ctx");
  41414. }));
  41415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41417. //>>excludeEnd("ctx");
  41418. }));
  41419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41420. $ctx1.sendIdx["and:"]=1;
  41421. //>>excludeEnd("ctx");
  41422. return $1;
  41423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41424. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)});
  41425. //>>excludeEnd("ctx");
  41426. },
  41427. //>>excludeStart("ide", pragmas.excludeIdeData);
  41428. args: ["anIRAssignment"],
  41429. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  41430. referencedClasses: [],
  41431. //>>excludeEnd("ide");
  41432. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  41433. }),
  41434. globals.IRInliner);
  41435. smalltalk.addMethod(
  41436. smalltalk.method({
  41437. selector: "shouldInlineReturn:",
  41438. protocol: 'testing',
  41439. fn: function (anIRReturn){
  41440. var self=this;
  41441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41442. return smalltalk.withContext(function($ctx1) {
  41443. //>>excludeEnd("ctx");
  41444. var $4,$3,$2,$1;
  41445. $1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){
  41446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41447. return smalltalk.withContext(function($ctx2) {
  41448. //>>excludeEnd("ctx");
  41449. $4=_st(anIRReturn)._instructions();
  41450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41451. $ctx2.sendIdx["instructions"]=1;
  41452. //>>excludeEnd("ctx");
  41453. $3=_st($4)._first();
  41454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41455. $ctx2.sendIdx["first"]=1;
  41456. //>>excludeEnd("ctx");
  41457. $2=_st($3)._isSend();
  41458. return _st($2)._and_((function(){
  41459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41460. return smalltalk.withContext(function($ctx3) {
  41461. //>>excludeEnd("ctx");
  41462. return self._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first());
  41463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41464. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41465. //>>excludeEnd("ctx");
  41466. }));
  41467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41469. //>>excludeEnd("ctx");
  41470. }));
  41471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41472. $ctx1.sendIdx["and:"]=1;
  41473. //>>excludeEnd("ctx");
  41474. return $1;
  41475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41476. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},globals.IRInliner)});
  41477. //>>excludeEnd("ctx");
  41478. },
  41479. //>>excludeStart("ide", pragmas.excludeIdeData);
  41480. args: ["anIRReturn"],
  41481. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  41482. referencedClasses: [],
  41483. //>>excludeEnd("ide");
  41484. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  41485. }),
  41486. globals.IRInliner);
  41487. smalltalk.addMethod(
  41488. smalltalk.method({
  41489. selector: "shouldInlineSend:",
  41490. protocol: 'testing',
  41491. fn: function (anIRSend){
  41492. var self=this;
  41493. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  41494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41495. return smalltalk.withContext(function($ctx1) {
  41496. //>>excludeEnd("ctx");
  41497. var $1;
  41498. $1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){
  41499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41500. return smalltalk.withContext(function($ctx2) {
  41501. //>>excludeEnd("ctx");
  41502. return _st($IRSendInliner())._shouldInline_(anIRSend);
  41503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41505. //>>excludeEnd("ctx");
  41506. }));
  41507. return $1;
  41508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41509. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},globals.IRInliner)});
  41510. //>>excludeEnd("ctx");
  41511. },
  41512. //>>excludeStart("ide", pragmas.excludeIdeData);
  41513. args: ["anIRSend"],
  41514. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  41515. referencedClasses: ["IRSendInliner"],
  41516. //>>excludeEnd("ide");
  41517. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  41518. }),
  41519. globals.IRInliner);
  41520. smalltalk.addMethod(
  41521. smalltalk.method({
  41522. selector: "transformNonLocalReturn:",
  41523. protocol: 'visiting',
  41524. fn: function (anIRNonLocalReturn){
  41525. var self=this;
  41526. var localReturn;
  41527. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  41528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41529. return smalltalk.withContext(function($ctx1) {
  41530. //>>excludeEnd("ctx");
  41531. var $2,$1,$4,$3,$5,$6,$7,$8,$9;
  41532. $2=_st(anIRNonLocalReturn)._scope();
  41533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41534. $ctx1.sendIdx["scope"]=1;
  41535. //>>excludeEnd("ctx");
  41536. $1=_st($2)._canInlineNonLocalReturns();
  41537. if(smalltalk.assert($1)){
  41538. $4=_st(anIRNonLocalReturn)._scope();
  41539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41540. $ctx1.sendIdx["scope"]=2;
  41541. //>>excludeEnd("ctx");
  41542. $3=_st($4)._methodScope();
  41543. $5=_st(anIRNonLocalReturn)._scope();
  41544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41545. $ctx1.sendIdx["scope"]=3;
  41546. //>>excludeEnd("ctx");
  41547. _st($3)._removeNonLocalReturn_($5);
  41548. $6=_st($IRReturn())._new();
  41549. _st($6)._scope_(_st(anIRNonLocalReturn)._scope());
  41550. $7=_st($6)._yourself();
  41551. localReturn=$7;
  41552. localReturn;
  41553. _st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){
  41554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41555. return smalltalk.withContext(function($ctx2) {
  41556. //>>excludeEnd("ctx");
  41557. return _st(localReturn)._add_(each);
  41558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41560. //>>excludeEnd("ctx");
  41561. }));
  41562. _st(anIRNonLocalReturn)._replaceWith_(localReturn);
  41563. $8=localReturn;
  41564. return $8;
  41565. };
  41566. $9=(
  41567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41568. $ctx1.supercall = true,
  41569. //>>excludeEnd("ctx");
  41570. globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
  41571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41572. $ctx1.supercall = false;
  41573. //>>excludeEnd("ctx");;
  41574. return $9;
  41575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41576. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},globals.IRInliner)});
  41577. //>>excludeEnd("ctx");
  41578. },
  41579. //>>excludeStart("ide", pragmas.excludeIdeData);
  41580. args: ["anIRNonLocalReturn"],
  41581. source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  41582. referencedClasses: ["IRReturn"],
  41583. //>>excludeEnd("ide");
  41584. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  41585. }),
  41586. globals.IRInliner);
  41587. smalltalk.addMethod(
  41588. smalltalk.method({
  41589. selector: "visitIRAssignment:",
  41590. protocol: 'visiting',
  41591. fn: function (anIRAssignment){
  41592. var self=this;
  41593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41594. return smalltalk.withContext(function($ctx1) {
  41595. //>>excludeEnd("ctx");
  41596. var $2,$1;
  41597. $2=self._shouldInlineAssignment_(anIRAssignment);
  41598. if(smalltalk.assert($2)){
  41599. $1=_st(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  41600. } else {
  41601. $1=(
  41602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41603. $ctx1.supercall = true,
  41604. //>>excludeEnd("ctx");
  41605. globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]));
  41606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41607. $ctx1.supercall = false;
  41608. //>>excludeEnd("ctx");;
  41609. };
  41610. return $1;
  41611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41612. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)});
  41613. //>>excludeEnd("ctx");
  41614. },
  41615. //>>excludeStart("ide", pragmas.excludeIdeData);
  41616. args: ["anIRAssignment"],
  41617. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  41618. referencedClasses: [],
  41619. //>>excludeEnd("ide");
  41620. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  41621. }),
  41622. globals.IRInliner);
  41623. smalltalk.addMethod(
  41624. smalltalk.method({
  41625. selector: "visitIRNonLocalReturn:",
  41626. protocol: 'visiting',
  41627. fn: function (anIRNonLocalReturn){
  41628. var self=this;
  41629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41630. return smalltalk.withContext(function($ctx1) {
  41631. //>>excludeEnd("ctx");
  41632. var $1;
  41633. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  41634. return $1;
  41635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41636. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRInliner)});
  41637. //>>excludeEnd("ctx");
  41638. },
  41639. //>>excludeStart("ide", pragmas.excludeIdeData);
  41640. args: ["anIRNonLocalReturn"],
  41641. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  41642. referencedClasses: [],
  41643. //>>excludeEnd("ide");
  41644. messageSends: ["transformNonLocalReturn:"]
  41645. }),
  41646. globals.IRInliner);
  41647. smalltalk.addMethod(
  41648. smalltalk.method({
  41649. selector: "visitIRReturn:",
  41650. protocol: 'visiting',
  41651. fn: function (anIRReturn){
  41652. var self=this;
  41653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41654. return smalltalk.withContext(function($ctx1) {
  41655. //>>excludeEnd("ctx");
  41656. var $2,$1;
  41657. $2=self._shouldInlineReturn_(anIRReturn);
  41658. if(smalltalk.assert($2)){
  41659. $1=_st(self._returnInliner())._inlineReturn_(anIRReturn);
  41660. } else {
  41661. $1=(
  41662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41663. $ctx1.supercall = true,
  41664. //>>excludeEnd("ctx");
  41665. globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
  41666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41667. $ctx1.supercall = false;
  41668. //>>excludeEnd("ctx");;
  41669. };
  41670. return $1;
  41671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41672. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRInliner)});
  41673. //>>excludeEnd("ctx");
  41674. },
  41675. //>>excludeStart("ide", pragmas.excludeIdeData);
  41676. args: ["anIRReturn"],
  41677. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  41678. referencedClasses: [],
  41679. //>>excludeEnd("ide");
  41680. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  41681. }),
  41682. globals.IRInliner);
  41683. smalltalk.addMethod(
  41684. smalltalk.method({
  41685. selector: "visitIRSend:",
  41686. protocol: 'visiting',
  41687. fn: function (anIRSend){
  41688. var self=this;
  41689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41690. return smalltalk.withContext(function($ctx1) {
  41691. //>>excludeEnd("ctx");
  41692. var $2,$1;
  41693. $2=self._shouldInlineSend_(anIRSend);
  41694. if(smalltalk.assert($2)){
  41695. $1=_st(self._sendInliner())._inlineSend_(anIRSend);
  41696. } else {
  41697. $1=(
  41698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41699. $ctx1.supercall = true,
  41700. //>>excludeEnd("ctx");
  41701. globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]));
  41702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41703. $ctx1.supercall = false;
  41704. //>>excludeEnd("ctx");;
  41705. };
  41706. return $1;
  41707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41708. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRInliner)});
  41709. //>>excludeEnd("ctx");
  41710. },
  41711. //>>excludeStart("ide", pragmas.excludeIdeData);
  41712. args: ["anIRSend"],
  41713. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  41714. referencedClasses: [],
  41715. //>>excludeEnd("ide");
  41716. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  41717. }),
  41718. globals.IRInliner);
  41719. smalltalk.addClass('IRInliningJSTranslator', globals.IRJSTranslator, [], 'Compiler-Inlining');
  41720. //>>excludeStart("ide", pragmas.excludeIdeData);
  41721. globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  41722. //>>excludeEnd("ide");
  41723. smalltalk.addMethod(
  41724. smalltalk.method({
  41725. selector: "visitIRInlinedAssignment:",
  41726. protocol: 'visiting',
  41727. fn: function (anIRInlinedAssignment){
  41728. var self=this;
  41729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41730. return smalltalk.withContext(function($ctx1) {
  41731. //>>excludeEnd("ctx");
  41732. self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
  41733. return self;
  41734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41735. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},globals.IRInliningJSTranslator)});
  41736. //>>excludeEnd("ctx");
  41737. },
  41738. //>>excludeStart("ide", pragmas.excludeIdeData);
  41739. args: ["anIRInlinedAssignment"],
  41740. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  41741. referencedClasses: [],
  41742. //>>excludeEnd("ide");
  41743. messageSends: ["visit:", "last", "instructions"]
  41744. }),
  41745. globals.IRInliningJSTranslator);
  41746. smalltalk.addMethod(
  41747. smalltalk.method({
  41748. selector: "visitIRInlinedClosure:",
  41749. protocol: 'visiting',
  41750. fn: function (anIRInlinedClosure){
  41751. var self=this;
  41752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41753. return smalltalk.withContext(function($ctx1) {
  41754. //>>excludeEnd("ctx");
  41755. _st(self._stream())._nextPutVars_(_st(_st(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  41756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41757. return smalltalk.withContext(function($ctx2) {
  41758. //>>excludeEnd("ctx");
  41759. return _st(_st(each)._name())._asVariableName();
  41760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41762. //>>excludeEnd("ctx");
  41763. })));
  41764. _st(_st(anIRInlinedClosure)._instructions())._do_((function(each){
  41765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41766. return smalltalk.withContext(function($ctx2) {
  41767. //>>excludeEnd("ctx");
  41768. return self._visit_(each);
  41769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41771. //>>excludeEnd("ctx");
  41772. }));
  41773. return self;
  41774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41775. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRInliningJSTranslator)});
  41776. //>>excludeEnd("ctx");
  41777. },
  41778. //>>excludeStart("ide", pragmas.excludeIdeData);
  41779. args: ["anIRInlinedClosure"],
  41780. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  41781. referencedClasses: [],
  41782. //>>excludeEnd("ide");
  41783. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  41784. }),
  41785. globals.IRInliningJSTranslator);
  41786. smalltalk.addMethod(
  41787. smalltalk.method({
  41788. selector: "visitIRInlinedIfFalse:",
  41789. protocol: 'visiting',
  41790. fn: function (anIRInlinedIfFalse){
  41791. var self=this;
  41792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41793. return smalltalk.withContext(function($ctx1) {
  41794. //>>excludeEnd("ctx");
  41795. var $1,$2,$4,$3;
  41796. $1=self._stream();
  41797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41798. $ctx1.sendIdx["stream"]=1;
  41799. //>>excludeEnd("ctx");
  41800. _st($1)._nextPutIf_with_((function(){
  41801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41802. return smalltalk.withContext(function($ctx2) {
  41803. //>>excludeEnd("ctx");
  41804. $2=self._stream();
  41805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41806. $ctx2.sendIdx["stream"]=2;
  41807. //>>excludeEnd("ctx");
  41808. _st($2)._nextPutAll_("! smalltalk.assert(");
  41809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41810. $ctx2.sendIdx["nextPutAll:"]=1;
  41811. //>>excludeEnd("ctx");
  41812. $4=_st(anIRInlinedIfFalse)._instructions();
  41813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41814. $ctx2.sendIdx["instructions"]=1;
  41815. //>>excludeEnd("ctx");
  41816. $3=_st($4)._first();
  41817. self._visit_($3);
  41818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41819. $ctx2.sendIdx["visit:"]=1;
  41820. //>>excludeEnd("ctx");
  41821. return _st(self._stream())._nextPutAll_(")");
  41822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41824. //>>excludeEnd("ctx");
  41825. }),(function(){
  41826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41827. return smalltalk.withContext(function($ctx2) {
  41828. //>>excludeEnd("ctx");
  41829. return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
  41830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41832. //>>excludeEnd("ctx");
  41833. }));
  41834. return self;
  41835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41836. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},globals.IRInliningJSTranslator)});
  41837. //>>excludeEnd("ctx");
  41838. },
  41839. //>>excludeStart("ide", pragmas.excludeIdeData);
  41840. args: ["anIRInlinedIfFalse"],
  41841. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '! smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
  41842. referencedClasses: [],
  41843. //>>excludeEnd("ide");
  41844. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  41845. }),
  41846. globals.IRInliningJSTranslator);
  41847. smalltalk.addMethod(
  41848. smalltalk.method({
  41849. selector: "visitIRInlinedIfNilIfNotNil:",
  41850. protocol: 'visiting',
  41851. fn: function (anIRInlinedIfNilIfNotNil){
  41852. var self=this;
  41853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41854. return smalltalk.withContext(function($ctx1) {
  41855. //>>excludeEnd("ctx");
  41856. var $1,$2,$3,$5,$4,$7,$6;
  41857. $1=self._stream();
  41858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41859. $ctx1.sendIdx["stream"]=1;
  41860. //>>excludeEnd("ctx");
  41861. _st($1)._nextPutIfElse_with_with_((function(){
  41862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41863. return smalltalk.withContext(function($ctx2) {
  41864. //>>excludeEnd("ctx");
  41865. $2=self._stream();
  41866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41867. $ctx2.sendIdx["stream"]=2;
  41868. //>>excludeEnd("ctx");
  41869. $3=_st("(".__comma(_st(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
  41870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41871. $ctx2.sendIdx[","]=1;
  41872. //>>excludeEnd("ctx");
  41873. _st($2)._nextPutAll_($3);
  41874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41875. $ctx2.sendIdx["nextPutAll:"]=1;
  41876. //>>excludeEnd("ctx");
  41877. $5=_st(anIRInlinedIfNilIfNotNil)._instructions();
  41878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41879. $ctx2.sendIdx["instructions"]=1;
  41880. //>>excludeEnd("ctx");
  41881. $4=_st($5)._first();
  41882. self._visit_($4);
  41883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41884. $ctx2.sendIdx["visit:"]=1;
  41885. //>>excludeEnd("ctx");
  41886. return _st(self._stream())._nextPutAll_(") == null || $receiver.isNil");
  41887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41889. //>>excludeEnd("ctx");
  41890. }),(function(){
  41891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41892. return smalltalk.withContext(function($ctx2) {
  41893. //>>excludeEnd("ctx");
  41894. $7=_st(anIRInlinedIfNilIfNotNil)._instructions();
  41895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41896. $ctx2.sendIdx["instructions"]=2;
  41897. //>>excludeEnd("ctx");
  41898. $6=_st($7)._second();
  41899. return self._visit_($6);
  41900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41901. $ctx2.sendIdx["visit:"]=2;
  41902. //>>excludeEnd("ctx");
  41903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41905. //>>excludeEnd("ctx");
  41906. }),(function(){
  41907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41908. return smalltalk.withContext(function($ctx2) {
  41909. //>>excludeEnd("ctx");
  41910. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
  41911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41913. //>>excludeEnd("ctx");
  41914. }));
  41915. return self;
  41916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41917. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},globals.IRInliningJSTranslator)});
  41918. //>>excludeEnd("ctx");
  41919. },
  41920. //>>excludeStart("ide", pragmas.excludeIdeData);
  41921. args: ["anIRInlinedIfNilIfNotNil"],
  41922. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || $receiver.isNil' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  41923. referencedClasses: [],
  41924. //>>excludeEnd("ide");
  41925. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"]
  41926. }),
  41927. globals.IRInliningJSTranslator);
  41928. smalltalk.addMethod(
  41929. smalltalk.method({
  41930. selector: "visitIRInlinedIfTrue:",
  41931. protocol: 'visiting',
  41932. fn: function (anIRInlinedIfTrue){
  41933. var self=this;
  41934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41935. return smalltalk.withContext(function($ctx1) {
  41936. //>>excludeEnd("ctx");
  41937. var $1,$2,$4,$3;
  41938. $1=self._stream();
  41939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41940. $ctx1.sendIdx["stream"]=1;
  41941. //>>excludeEnd("ctx");
  41942. _st($1)._nextPutIf_with_((function(){
  41943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41944. return smalltalk.withContext(function($ctx2) {
  41945. //>>excludeEnd("ctx");
  41946. $2=self._stream();
  41947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41948. $ctx2.sendIdx["stream"]=2;
  41949. //>>excludeEnd("ctx");
  41950. _st($2)._nextPutAll_("smalltalk.assert(");
  41951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41952. $ctx2.sendIdx["nextPutAll:"]=1;
  41953. //>>excludeEnd("ctx");
  41954. $4=_st(anIRInlinedIfTrue)._instructions();
  41955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41956. $ctx2.sendIdx["instructions"]=1;
  41957. //>>excludeEnd("ctx");
  41958. $3=_st($4)._first();
  41959. self._visit_($3);
  41960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41961. $ctx2.sendIdx["visit:"]=1;
  41962. //>>excludeEnd("ctx");
  41963. return _st(self._stream())._nextPutAll_(")");
  41964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41966. //>>excludeEnd("ctx");
  41967. }),(function(){
  41968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41969. return smalltalk.withContext(function($ctx2) {
  41970. //>>excludeEnd("ctx");
  41971. return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
  41972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41974. //>>excludeEnd("ctx");
  41975. }));
  41976. return self;
  41977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41978. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},globals.IRInliningJSTranslator)});
  41979. //>>excludeEnd("ctx");
  41980. },
  41981. //>>excludeStart("ide", pragmas.excludeIdeData);
  41982. args: ["anIRInlinedIfTrue"],
  41983. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
  41984. referencedClasses: [],
  41985. //>>excludeEnd("ide");
  41986. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  41987. }),
  41988. globals.IRInliningJSTranslator);
  41989. smalltalk.addMethod(
  41990. smalltalk.method({
  41991. selector: "visitIRInlinedIfTrueIfFalse:",
  41992. protocol: 'visiting',
  41993. fn: function (anIRInlinedIfTrueIfFalse){
  41994. var self=this;
  41995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41996. return smalltalk.withContext(function($ctx1) {
  41997. //>>excludeEnd("ctx");
  41998. var $1,$2,$4,$3,$6,$5;
  41999. $1=self._stream();
  42000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42001. $ctx1.sendIdx["stream"]=1;
  42002. //>>excludeEnd("ctx");
  42003. _st($1)._nextPutIfElse_with_with_((function(){
  42004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42005. return smalltalk.withContext(function($ctx2) {
  42006. //>>excludeEnd("ctx");
  42007. $2=self._stream();
  42008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42009. $ctx2.sendIdx["stream"]=2;
  42010. //>>excludeEnd("ctx");
  42011. _st($2)._nextPutAll_("smalltalk.assert(");
  42012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42013. $ctx2.sendIdx["nextPutAll:"]=1;
  42014. //>>excludeEnd("ctx");
  42015. $4=_st(anIRInlinedIfTrueIfFalse)._instructions();
  42016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42017. $ctx2.sendIdx["instructions"]=1;
  42018. //>>excludeEnd("ctx");
  42019. $3=_st($4)._first();
  42020. self._visit_($3);
  42021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42022. $ctx2.sendIdx["visit:"]=1;
  42023. //>>excludeEnd("ctx");
  42024. return _st(self._stream())._nextPutAll_(")");
  42025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42027. //>>excludeEnd("ctx");
  42028. }),(function(){
  42029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42030. return smalltalk.withContext(function($ctx2) {
  42031. //>>excludeEnd("ctx");
  42032. $6=_st(anIRInlinedIfTrueIfFalse)._instructions();
  42033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42034. $ctx2.sendIdx["instructions"]=2;
  42035. //>>excludeEnd("ctx");
  42036. $5=_st($6)._second();
  42037. return self._visit_($5);
  42038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42039. $ctx2.sendIdx["visit:"]=2;
  42040. //>>excludeEnd("ctx");
  42041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42043. //>>excludeEnd("ctx");
  42044. }),(function(){
  42045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42046. return smalltalk.withContext(function($ctx2) {
  42047. //>>excludeEnd("ctx");
  42048. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
  42049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42051. //>>excludeEnd("ctx");
  42052. }));
  42053. return self;
  42054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42055. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},globals.IRInliningJSTranslator)});
  42056. //>>excludeEnd("ctx");
  42057. },
  42058. //>>excludeStart("ide", pragmas.excludeIdeData);
  42059. args: ["anIRInlinedIfTrueIfFalse"],
  42060. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  42061. referencedClasses: [],
  42062. //>>excludeEnd("ide");
  42063. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  42064. }),
  42065. globals.IRInliningJSTranslator);
  42066. smalltalk.addMethod(
  42067. smalltalk.method({
  42068. selector: "visitIRInlinedNonLocalReturn:",
  42069. protocol: 'visiting',
  42070. fn: function (anIRInlinedReturn){
  42071. var self=this;
  42072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42073. return smalltalk.withContext(function($ctx1) {
  42074. //>>excludeEnd("ctx");
  42075. var $1;
  42076. $1=self._stream();
  42077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42078. $ctx1.sendIdx["stream"]=1;
  42079. //>>excludeEnd("ctx");
  42080. _st($1)._nextPutStatementWith_((function(){
  42081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42082. return smalltalk.withContext(function($ctx2) {
  42083. //>>excludeEnd("ctx");
  42084. return self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  42085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42087. //>>excludeEnd("ctx");
  42088. }));
  42089. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  42090. }));
  42091. return self;
  42092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42093. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)});
  42094. //>>excludeEnd("ctx");
  42095. },
  42096. //>>excludeStart("ide", pragmas.excludeIdeData);
  42097. args: ["anIRInlinedReturn"],
  42098. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  42099. referencedClasses: [],
  42100. //>>excludeEnd("ide");
  42101. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  42102. }),
  42103. globals.IRInliningJSTranslator);
  42104. smalltalk.addMethod(
  42105. smalltalk.method({
  42106. selector: "visitIRInlinedReturn:",
  42107. protocol: 'visiting',
  42108. fn: function (anIRInlinedReturn){
  42109. var self=this;
  42110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42111. return smalltalk.withContext(function($ctx1) {
  42112. //>>excludeEnd("ctx");
  42113. self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  42114. return self;
  42115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42116. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)});
  42117. //>>excludeEnd("ctx");
  42118. },
  42119. //>>excludeStart("ide", pragmas.excludeIdeData);
  42120. args: ["anIRInlinedReturn"],
  42121. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  42122. referencedClasses: [],
  42123. //>>excludeEnd("ide");
  42124. messageSends: ["visit:", "last", "instructions"]
  42125. }),
  42126. globals.IRInliningJSTranslator);
  42127. smalltalk.addMethod(
  42128. smalltalk.method({
  42129. selector: "visitIRInlinedSequence:",
  42130. protocol: 'visiting',
  42131. fn: function (anIRInlinedSequence){
  42132. var self=this;
  42133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42134. return smalltalk.withContext(function($ctx1) {
  42135. //>>excludeEnd("ctx");
  42136. _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
  42137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42138. return smalltalk.withContext(function($ctx2) {
  42139. //>>excludeEnd("ctx");
  42140. return _st(self._stream())._nextPutStatementWith_((function(){
  42141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42142. return smalltalk.withContext(function($ctx3) {
  42143. //>>excludeEnd("ctx");
  42144. return self._visit_(each);
  42145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42147. //>>excludeEnd("ctx");
  42148. }));
  42149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42150. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42151. //>>excludeEnd("ctx");
  42152. }));
  42153. return self;
  42154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42155. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRInliningJSTranslator)});
  42156. //>>excludeEnd("ctx");
  42157. },
  42158. //>>excludeStart("ide", pragmas.excludeIdeData);
  42159. args: ["anIRInlinedSequence"],
  42160. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  42161. referencedClasses: [],
  42162. //>>excludeEnd("ide");
  42163. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  42164. }),
  42165. globals.IRInliningJSTranslator);
  42166. smalltalk.addClass('IRSendInliner', globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  42167. //>>excludeStart("ide", pragmas.excludeIdeData);
  42168. globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  42169. //>>excludeEnd("ide");
  42170. smalltalk.addMethod(
  42171. smalltalk.method({
  42172. selector: "ifFalse:",
  42173. protocol: 'inlining',
  42174. fn: function (anIRInstruction){
  42175. var self=this;
  42176. function $IRInlinedIfFalse(){return globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  42177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42178. return smalltalk.withContext(function($ctx1) {
  42179. //>>excludeEnd("ctx");
  42180. var $1;
  42181. $1=self._inlinedSend_with_(_st($IRInlinedIfFalse())._new(),anIRInstruction);
  42182. return $1;
  42183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42184. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)});
  42185. //>>excludeEnd("ctx");
  42186. },
  42187. //>>excludeStart("ide", pragmas.excludeIdeData);
  42188. args: ["anIRInstruction"],
  42189. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  42190. referencedClasses: ["IRInlinedIfFalse"],
  42191. //>>excludeEnd("ide");
  42192. messageSends: ["inlinedSend:with:", "new"]
  42193. }),
  42194. globals.IRSendInliner);
  42195. smalltalk.addMethod(
  42196. smalltalk.method({
  42197. selector: "ifFalse:ifTrue:",
  42198. protocol: 'inlining',
  42199. fn: function (anIRInstruction,anotherIRInstruction){
  42200. var self=this;
  42201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42202. return smalltalk.withContext(function($ctx1) {
  42203. //>>excludeEnd("ctx");
  42204. var $1;
  42205. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  42206. return $1;
  42207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42208. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)});
  42209. //>>excludeEnd("ctx");
  42210. },
  42211. //>>excludeStart("ide", pragmas.excludeIdeData);
  42212. args: ["anIRInstruction", "anotherIRInstruction"],
  42213. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  42214. referencedClasses: [],
  42215. //>>excludeEnd("ide");
  42216. messageSends: ["perform:withArguments:"]
  42217. }),
  42218. globals.IRSendInliner);
  42219. smalltalk.addMethod(
  42220. smalltalk.method({
  42221. selector: "ifNil:",
  42222. protocol: 'inlining',
  42223. fn: function (anIRInstruction){
  42224. var self=this;
  42225. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  42226. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  42227. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  42228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42229. return smalltalk.withContext(function($ctx1) {
  42230. //>>excludeEnd("ctx");
  42231. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  42232. $2=_st($IRInlinedIfNilIfNotNil())._new();
  42233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42234. $ctx1.sendIdx["new"]=1;
  42235. //>>excludeEnd("ctx");
  42236. $4=_st($IRClosure())._new();
  42237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42238. $ctx1.sendIdx["new"]=2;
  42239. //>>excludeEnd("ctx");
  42240. _st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  42241. $5=$4;
  42242. $7=_st($IRBlockSequence())._new();
  42243. _st($7)._add_(_st(_st(self._send())._instructions())._first());
  42244. $8=_st($7)._yourself();
  42245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42246. $ctx1.sendIdx["yourself"]=1;
  42247. //>>excludeEnd("ctx");
  42248. $6=$8;
  42249. _st($5)._add_($6);
  42250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42251. $ctx1.sendIdx["add:"]=1;
  42252. //>>excludeEnd("ctx");
  42253. $9=_st($4)._yourself();
  42254. $3=$9;
  42255. $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
  42256. return $1;
  42257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42258. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)});
  42259. //>>excludeEnd("ctx");
  42260. },
  42261. //>>excludeStart("ide", pragmas.excludeIdeData);
  42262. args: ["anIRInstruction"],
  42263. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  42264. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  42265. //>>excludeEnd("ide");
  42266. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  42267. }),
  42268. globals.IRSendInliner);
  42269. smalltalk.addMethod(
  42270. smalltalk.method({
  42271. selector: "ifNil:ifNotNil:",
  42272. protocol: 'inlining',
  42273. fn: function (anIRInstruction,anotherIRInstruction){
  42274. var self=this;
  42275. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  42276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42277. return smalltalk.withContext(function($ctx1) {
  42278. //>>excludeEnd("ctx");
  42279. var $1;
  42280. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  42281. return $1;
  42282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42283. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)});
  42284. //>>excludeEnd("ctx");
  42285. },
  42286. //>>excludeStart("ide", pragmas.excludeIdeData);
  42287. args: ["anIRInstruction", "anotherIRInstruction"],
  42288. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  42289. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  42290. //>>excludeEnd("ide");
  42291. messageSends: ["inlinedSend:with:with:", "new"]
  42292. }),
  42293. globals.IRSendInliner);
  42294. smalltalk.addMethod(
  42295. smalltalk.method({
  42296. selector: "ifNotNil:",
  42297. protocol: 'inlining',
  42298. fn: function (anIRInstruction){
  42299. var self=this;
  42300. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  42301. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  42302. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  42303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42304. return smalltalk.withContext(function($ctx1) {
  42305. //>>excludeEnd("ctx");
  42306. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  42307. $2=_st($IRInlinedIfNilIfNotNil())._new();
  42308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42309. $ctx1.sendIdx["new"]=1;
  42310. //>>excludeEnd("ctx");
  42311. $4=_st($IRClosure())._new();
  42312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42313. $ctx1.sendIdx["new"]=2;
  42314. //>>excludeEnd("ctx");
  42315. _st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  42316. $5=$4;
  42317. $7=_st($IRBlockSequence())._new();
  42318. _st($7)._add_(_st(_st(self._send())._instructions())._first());
  42319. $8=_st($7)._yourself();
  42320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42321. $ctx1.sendIdx["yourself"]=1;
  42322. //>>excludeEnd("ctx");
  42323. $6=$8;
  42324. _st($5)._add_($6);
  42325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42326. $ctx1.sendIdx["add:"]=1;
  42327. //>>excludeEnd("ctx");
  42328. $9=_st($4)._yourself();
  42329. $3=$9;
  42330. $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
  42331. return $1;
  42332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42333. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)});
  42334. //>>excludeEnd("ctx");
  42335. },
  42336. //>>excludeStart("ide", pragmas.excludeIdeData);
  42337. args: ["anIRInstruction"],
  42338. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09with: anIRInstruction",
  42339. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  42340. //>>excludeEnd("ide");
  42341. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  42342. }),
  42343. globals.IRSendInliner);
  42344. smalltalk.addMethod(
  42345. smalltalk.method({
  42346. selector: "ifNotNil:ifNil:",
  42347. protocol: 'inlining',
  42348. fn: function (anIRInstruction,anotherIRInstruction){
  42349. var self=this;
  42350. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  42351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42352. return smalltalk.withContext(function($ctx1) {
  42353. //>>excludeEnd("ctx");
  42354. var $1;
  42355. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  42356. return $1;
  42357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42358. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)});
  42359. //>>excludeEnd("ctx");
  42360. },
  42361. //>>excludeStart("ide", pragmas.excludeIdeData);
  42362. args: ["anIRInstruction", "anotherIRInstruction"],
  42363. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  42364. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  42365. //>>excludeEnd("ide");
  42366. messageSends: ["inlinedSend:with:with:", "new"]
  42367. }),
  42368. globals.IRSendInliner);
  42369. smalltalk.addMethod(
  42370. smalltalk.method({
  42371. selector: "ifTrue:",
  42372. protocol: 'inlining',
  42373. fn: function (anIRInstruction){
  42374. var self=this;
  42375. function $IRInlinedIfTrue(){return globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  42376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42377. return smalltalk.withContext(function($ctx1) {
  42378. //>>excludeEnd("ctx");
  42379. var $1;
  42380. $1=self._inlinedSend_with_(_st($IRInlinedIfTrue())._new(),anIRInstruction);
  42381. return $1;
  42382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42383. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)});
  42384. //>>excludeEnd("ctx");
  42385. },
  42386. //>>excludeStart("ide", pragmas.excludeIdeData);
  42387. args: ["anIRInstruction"],
  42388. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  42389. referencedClasses: ["IRInlinedIfTrue"],
  42390. //>>excludeEnd("ide");
  42391. messageSends: ["inlinedSend:with:", "new"]
  42392. }),
  42393. globals.IRSendInliner);
  42394. smalltalk.addMethod(
  42395. smalltalk.method({
  42396. selector: "ifTrue:ifFalse:",
  42397. protocol: 'inlining',
  42398. fn: function (anIRInstruction,anotherIRInstruction){
  42399. var self=this;
  42400. function $IRInlinedIfTrueIfFalse(){return globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  42401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42402. return smalltalk.withContext(function($ctx1) {
  42403. //>>excludeEnd("ctx");
  42404. var $1;
  42405. $1=self._inlinedSend_with_with_(_st($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  42406. return $1;
  42407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42408. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)});
  42409. //>>excludeEnd("ctx");
  42410. },
  42411. //>>excludeStart("ide", pragmas.excludeIdeData);
  42412. args: ["anIRInstruction", "anotherIRInstruction"],
  42413. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  42414. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  42415. //>>excludeEnd("ide");
  42416. messageSends: ["inlinedSend:with:with:", "new"]
  42417. }),
  42418. globals.IRSendInliner);
  42419. smalltalk.addMethod(
  42420. smalltalk.method({
  42421. selector: "inlineClosure:",
  42422. protocol: 'inlining',
  42423. fn: function (anIRClosure){
  42424. var self=this;
  42425. var inlinedClosure,sequence,statements;
  42426. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  42427. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  42428. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  42429. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  42430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42431. return smalltalk.withContext(function($ctx1) {
  42432. //>>excludeEnd("ctx");
  42433. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$11,$12,$14,$16,$17,$18,$19,$15,$13,$20,$22,$24,$25,$23,$21,$26,$10,$28,$27,$31,$30,$32,$29,$33,$36,$35,$34,$37;
  42434. inlinedClosure=self._inlinedClosure();
  42435. $1=inlinedClosure;
  42436. $2=$1;
  42437. $3=_st(anIRClosure)._scope();
  42438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42439. $ctx1.sendIdx["scope"]=1;
  42440. //>>excludeEnd("ctx");
  42441. _st($2)._scope_($3);
  42442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42443. $ctx1.sendIdx["scope:"]=1;
  42444. //>>excludeEnd("ctx");
  42445. $4=_st($1)._parent_(_st(anIRClosure)._parent());
  42446. _st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
  42447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42448. return smalltalk.withContext(function($ctx2) {
  42449. //>>excludeEnd("ctx");
  42450. return _st(inlinedClosure)._add_(each);
  42451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42452. $ctx2.sendIdx["add:"]=1;
  42453. //>>excludeEnd("ctx");
  42454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42456. //>>excludeEnd("ctx");
  42457. }));
  42458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42459. $ctx1.sendIdx["do:"]=1;
  42460. //>>excludeEnd("ctx");
  42461. sequence=self._inlinedSequence();
  42462. _st(_st(anIRClosure)._arguments())._do_((function(each){
  42463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42464. return smalltalk.withContext(function($ctx2) {
  42465. //>>excludeEnd("ctx");
  42466. $5=inlinedClosure;
  42467. $7=_st($IRTempDeclaration())._new();
  42468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42469. $ctx2.sendIdx["new"]=1;
  42470. //>>excludeEnd("ctx");
  42471. _st($7)._name_(each);
  42472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42473. $ctx2.sendIdx["name:"]=1;
  42474. //>>excludeEnd("ctx");
  42475. $8=_st($7)._yourself();
  42476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42477. $ctx2.sendIdx["yourself"]=1;
  42478. //>>excludeEnd("ctx");
  42479. $6=$8;
  42480. _st($5)._add_($6);
  42481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42482. $ctx2.sendIdx["add:"]=2;
  42483. //>>excludeEnd("ctx");
  42484. $9=sequence;
  42485. $11=_st($IRAssignment())._new();
  42486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42487. $ctx2.sendIdx["new"]=2;
  42488. //>>excludeEnd("ctx");
  42489. $12=$11;
  42490. $14=_st($IRVariable())._new();
  42491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42492. $ctx2.sendIdx["new"]=3;
  42493. //>>excludeEnd("ctx");
  42494. $16=_st($AliasVar())._new();
  42495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42496. $ctx2.sendIdx["new"]=4;
  42497. //>>excludeEnd("ctx");
  42498. $17=$16;
  42499. $18=_st(inlinedClosure)._scope();
  42500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42501. $ctx2.sendIdx["scope"]=2;
  42502. //>>excludeEnd("ctx");
  42503. _st($17)._scope_($18);
  42504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42505. $ctx2.sendIdx["scope:"]=2;
  42506. //>>excludeEnd("ctx");
  42507. _st($16)._name_(each);
  42508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42509. $ctx2.sendIdx["name:"]=2;
  42510. //>>excludeEnd("ctx");
  42511. $19=_st($16)._yourself();
  42512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42513. $ctx2.sendIdx["yourself"]=2;
  42514. //>>excludeEnd("ctx");
  42515. $15=$19;
  42516. $13=_st($14)._variable_($15);
  42517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42518. $ctx2.sendIdx["variable:"]=1;
  42519. //>>excludeEnd("ctx");
  42520. _st($12)._add_($13);
  42521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42522. $ctx2.sendIdx["add:"]=4;
  42523. //>>excludeEnd("ctx");
  42524. $20=$11;
  42525. $22=_st($IRVariable())._new();
  42526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42527. $ctx2.sendIdx["new"]=5;
  42528. //>>excludeEnd("ctx");
  42529. $24=_st($AliasVar())._new();
  42530. _st($24)._scope_(_st(inlinedClosure)._scope());
  42531. _st($24)._name_("$receiver");
  42532. $25=_st($24)._yourself();
  42533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42534. $ctx2.sendIdx["yourself"]=3;
  42535. //>>excludeEnd("ctx");
  42536. $23=$25;
  42537. $21=_st($22)._variable_($23);
  42538. _st($20)._add_($21);
  42539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42540. $ctx2.sendIdx["add:"]=5;
  42541. //>>excludeEnd("ctx");
  42542. $26=_st($11)._yourself();
  42543. $10=$26;
  42544. return _st($9)._add_($10);
  42545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42546. $ctx2.sendIdx["add:"]=3;
  42547. //>>excludeEnd("ctx");
  42548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42550. //>>excludeEnd("ctx");
  42551. }));
  42552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42553. $ctx1.sendIdx["do:"]=2;
  42554. //>>excludeEnd("ctx");
  42555. _st(inlinedClosure)._add_(sequence);
  42556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42557. $ctx1.sendIdx["add:"]=6;
  42558. //>>excludeEnd("ctx");
  42559. $28=_st(anIRClosure)._instructions();
  42560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42561. $ctx1.sendIdx["instructions"]=2;
  42562. //>>excludeEnd("ctx");
  42563. $27=_st($28)._last();
  42564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42565. $ctx1.sendIdx["last"]=1;
  42566. //>>excludeEnd("ctx");
  42567. statements=_st($27)._instructions();
  42568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42569. $ctx1.sendIdx["instructions"]=1;
  42570. //>>excludeEnd("ctx");
  42571. _st(statements)._ifNotEmpty_((function(){
  42572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42573. return smalltalk.withContext(function($ctx2) {
  42574. //>>excludeEnd("ctx");
  42575. _st(_st(statements)._allButLast())._do_((function(each){
  42576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42577. return smalltalk.withContext(function($ctx3) {
  42578. //>>excludeEnd("ctx");
  42579. return _st(sequence)._add_(each);
  42580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42581. $ctx3.sendIdx["add:"]=7;
  42582. //>>excludeEnd("ctx");
  42583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42584. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  42585. //>>excludeEnd("ctx");
  42586. }));
  42587. $31=_st(statements)._last();
  42588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42589. $ctx2.sendIdx["last"]=2;
  42590. //>>excludeEnd("ctx");
  42591. $30=_st($31)._isReturn();
  42592. $29=_st($30)._and_((function(){
  42593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42594. return smalltalk.withContext(function($ctx3) {
  42595. //>>excludeEnd("ctx");
  42596. $32=_st(statements)._last();
  42597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42598. $ctx3.sendIdx["last"]=3;
  42599. //>>excludeEnd("ctx");
  42600. return _st($32)._isBlockReturn();
  42601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42602. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  42603. //>>excludeEnd("ctx");
  42604. }));
  42605. if(smalltalk.assert($29)){
  42606. $33=sequence;
  42607. $36=_st(statements)._last();
  42608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42609. $ctx2.sendIdx["last"]=4;
  42610. //>>excludeEnd("ctx");
  42611. $35=_st($36)._instructions();
  42612. $34=_st($35)._first();
  42613. return _st($33)._add_($34);
  42614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42615. $ctx2.sendIdx["add:"]=8;
  42616. //>>excludeEnd("ctx");
  42617. } else {
  42618. return _st(sequence)._add_(_st(statements)._last());
  42619. };
  42620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42622. //>>excludeEnd("ctx");
  42623. }));
  42624. $37=inlinedClosure;
  42625. return $37;
  42626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42627. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},globals.IRSendInliner)});
  42628. //>>excludeEnd("ctx");
  42629. },
  42630. //>>excludeStart("ide", pragmas.excludeIdeData);
  42631. args: ["anIRClosure"],
  42632. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
  42633. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  42634. //>>excludeEnd("ide");
  42635. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"]
  42636. }),
  42637. globals.IRSendInliner);
  42638. smalltalk.addMethod(
  42639. smalltalk.method({
  42640. selector: "inlineSend:",
  42641. protocol: 'inlining',
  42642. fn: function (anIRSend){
  42643. var self=this;
  42644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42645. return smalltalk.withContext(function($ctx1) {
  42646. //>>excludeEnd("ctx");
  42647. var $3,$2,$1;
  42648. self._send_(anIRSend);
  42649. $3=self._send();
  42650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42651. $ctx1.sendIdx["send"]=1;
  42652. //>>excludeEnd("ctx");
  42653. $2=_st($3)._selector();
  42654. $1=self._perform_withArguments_($2,_st(_st(self._send())._instructions())._allButFirst());
  42655. return $1;
  42656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42657. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},globals.IRSendInliner)});
  42658. //>>excludeEnd("ctx");
  42659. },
  42660. //>>excludeStart("ide", pragmas.excludeIdeData);
  42661. args: ["anIRSend"],
  42662. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  42663. referencedClasses: [],
  42664. //>>excludeEnd("ide");
  42665. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  42666. }),
  42667. globals.IRSendInliner);
  42668. smalltalk.addMethod(
  42669. smalltalk.method({
  42670. selector: "inlinedClosure",
  42671. protocol: 'factory',
  42672. fn: function (){
  42673. var self=this;
  42674. function $IRInlinedClosure(){return globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  42675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42676. return smalltalk.withContext(function($ctx1) {
  42677. //>>excludeEnd("ctx");
  42678. var $1;
  42679. $1=_st($IRInlinedClosure())._new();
  42680. return $1;
  42681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42682. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},globals.IRSendInliner)});
  42683. //>>excludeEnd("ctx");
  42684. },
  42685. //>>excludeStart("ide", pragmas.excludeIdeData);
  42686. args: [],
  42687. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  42688. referencedClasses: ["IRInlinedClosure"],
  42689. //>>excludeEnd("ide");
  42690. messageSends: ["new"]
  42691. }),
  42692. globals.IRSendInliner);
  42693. smalltalk.addMethod(
  42694. smalltalk.method({
  42695. selector: "inlinedSend:with:",
  42696. protocol: 'inlining',
  42697. fn: function (inlinedSend,anIRInstruction){
  42698. var self=this;
  42699. var inlinedClosure;
  42700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42701. return smalltalk.withContext(function($ctx1) {
  42702. //>>excludeEnd("ctx");
  42703. var $1,$2,$5,$4,$3,$6,$7;
  42704. $1=_st(anIRInstruction)._isClosure();
  42705. if(! smalltalk.assert($1)){
  42706. self._inliningError_("Message argument should be a block");
  42707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42708. $ctx1.sendIdx["inliningError:"]=1;
  42709. //>>excludeEnd("ctx");
  42710. };
  42711. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  42712. if(! smalltalk.assert($2)){
  42713. self._inliningError_("Inlined block should have zero argument");
  42714. };
  42715. inlinedClosure=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  42716. $5=self._send();
  42717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42718. $ctx1.sendIdx["send"]=1;
  42719. //>>excludeEnd("ctx");
  42720. $4=_st($5)._instructions();
  42721. $3=_st($4)._first();
  42722. _st(inlinedSend)._add_($3);
  42723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42724. $ctx1.sendIdx["add:"]=1;
  42725. //>>excludeEnd("ctx");
  42726. $6=_st(inlinedSend)._add_(inlinedClosure);
  42727. _st(self._send())._replaceWith_(inlinedSend);
  42728. $7=_st(_st(inlinedSend)._method())._internalVariables();
  42729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42730. $ctx1.sendIdx["internalVariables"]=1;
  42731. //>>excludeEnd("ctx");
  42732. _st($7)._addAll_(_st(inlinedSend)._internalVariables());
  42733. return inlinedSend;
  42734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42735. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},globals.IRSendInliner)});
  42736. //>>excludeEnd("ctx");
  42737. },
  42738. //>>excludeStart("ide", pragmas.excludeIdeData);
  42739. args: ["inlinedSend", "anIRInstruction"],
  42740. source: "inlinedSend: inlinedSend with: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  42741. referencedClasses: [],
  42742. //>>excludeEnd("ide");
  42743. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  42744. }),
  42745. globals.IRSendInliner);
  42746. smalltalk.addMethod(
  42747. smalltalk.method({
  42748. selector: "inlinedSend:with:with:",
  42749. protocol: 'inlining',
  42750. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  42751. var self=this;
  42752. var inlinedClosure1,inlinedClosure2;
  42753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42754. return smalltalk.withContext(function($ctx1) {
  42755. //>>excludeEnd("ctx");
  42756. var $1,$2,$3,$4,$7,$6,$5,$8,$9;
  42757. $1=_st(anIRInstruction)._isClosure();
  42758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42759. $ctx1.sendIdx["isClosure"]=1;
  42760. //>>excludeEnd("ctx");
  42761. if(! smalltalk.assert($1)){
  42762. self._inliningError_("Message argument should be a block");
  42763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42764. $ctx1.sendIdx["inliningError:"]=1;
  42765. //>>excludeEnd("ctx");
  42766. };
  42767. $2=_st(anotherIRInstruction)._isClosure();
  42768. if(! smalltalk.assert($2)){
  42769. self._inliningError_("Message argument should be a block");
  42770. };
  42771. $3=self._translator();
  42772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42773. $ctx1.sendIdx["translator"]=1;
  42774. //>>excludeEnd("ctx");
  42775. $4=self._inlineClosure_(anIRInstruction);
  42776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42777. $ctx1.sendIdx["inlineClosure:"]=1;
  42778. //>>excludeEnd("ctx");
  42779. inlinedClosure1=_st($3)._visit_($4);
  42780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42781. $ctx1.sendIdx["visit:"]=1;
  42782. //>>excludeEnd("ctx");
  42783. inlinedClosure2=_st(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  42784. $7=self._send();
  42785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42786. $ctx1.sendIdx["send"]=1;
  42787. //>>excludeEnd("ctx");
  42788. $6=_st($7)._instructions();
  42789. $5=_st($6)._first();
  42790. _st(inlinedSend)._add_($5);
  42791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42792. $ctx1.sendIdx["add:"]=1;
  42793. //>>excludeEnd("ctx");
  42794. _st(inlinedSend)._add_(inlinedClosure1);
  42795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42796. $ctx1.sendIdx["add:"]=2;
  42797. //>>excludeEnd("ctx");
  42798. $8=_st(inlinedSend)._add_(inlinedClosure2);
  42799. _st(self._send())._replaceWith_(inlinedSend);
  42800. $9=_st(_st(inlinedSend)._method())._internalVariables();
  42801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42802. $ctx1.sendIdx["internalVariables"]=1;
  42803. //>>excludeEnd("ctx");
  42804. _st($9)._addAll_(_st(inlinedSend)._internalVariables());
  42805. return inlinedSend;
  42806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42807. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},globals.IRSendInliner)});
  42808. //>>excludeEnd("ctx");
  42809. },
  42810. //>>excludeStart("ide", pragmas.excludeIdeData);
  42811. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  42812. source: "inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  42813. referencedClasses: [],
  42814. //>>excludeEnd("ide");
  42815. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  42816. }),
  42817. globals.IRSendInliner);
  42818. smalltalk.addMethod(
  42819. smalltalk.method({
  42820. selector: "inlinedSequence",
  42821. protocol: 'factory',
  42822. fn: function (){
  42823. var self=this;
  42824. function $IRInlinedSequence(){return globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  42825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42826. return smalltalk.withContext(function($ctx1) {
  42827. //>>excludeEnd("ctx");
  42828. var $1;
  42829. $1=_st($IRInlinedSequence())._new();
  42830. return $1;
  42831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42832. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},globals.IRSendInliner)});
  42833. //>>excludeEnd("ctx");
  42834. },
  42835. //>>excludeStart("ide", pragmas.excludeIdeData);
  42836. args: [],
  42837. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  42838. referencedClasses: ["IRInlinedSequence"],
  42839. //>>excludeEnd("ide");
  42840. messageSends: ["new"]
  42841. }),
  42842. globals.IRSendInliner);
  42843. smalltalk.addMethod(
  42844. smalltalk.method({
  42845. selector: "inliningError:",
  42846. protocol: 'error handling',
  42847. fn: function (aString){
  42848. var self=this;
  42849. function $InliningError(){return globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  42850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42851. return smalltalk.withContext(function($ctx1) {
  42852. //>>excludeEnd("ctx");
  42853. _st($InliningError())._signal_(aString);
  42854. return self;
  42855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42856. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},globals.IRSendInliner)});
  42857. //>>excludeEnd("ctx");
  42858. },
  42859. //>>excludeStart("ide", pragmas.excludeIdeData);
  42860. args: ["aString"],
  42861. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  42862. referencedClasses: ["InliningError"],
  42863. //>>excludeEnd("ide");
  42864. messageSends: ["signal:"]
  42865. }),
  42866. globals.IRSendInliner);
  42867. smalltalk.addMethod(
  42868. smalltalk.method({
  42869. selector: "send",
  42870. protocol: 'accessing',
  42871. fn: function (){
  42872. var self=this;
  42873. var $1;
  42874. $1=self["@send"];
  42875. return $1;
  42876. },
  42877. //>>excludeStart("ide", pragmas.excludeIdeData);
  42878. args: [],
  42879. source: "send\x0a\x09^ send",
  42880. referencedClasses: [],
  42881. //>>excludeEnd("ide");
  42882. messageSends: []
  42883. }),
  42884. globals.IRSendInliner);
  42885. smalltalk.addMethod(
  42886. smalltalk.method({
  42887. selector: "send:",
  42888. protocol: 'accessing',
  42889. fn: function (anIRSend){
  42890. var self=this;
  42891. self["@send"]=anIRSend;
  42892. return self;
  42893. },
  42894. //>>excludeStart("ide", pragmas.excludeIdeData);
  42895. args: ["anIRSend"],
  42896. source: "send: anIRSend\x0a\x09send := anIRSend",
  42897. referencedClasses: [],
  42898. //>>excludeEnd("ide");
  42899. messageSends: []
  42900. }),
  42901. globals.IRSendInliner);
  42902. smalltalk.addMethod(
  42903. smalltalk.method({
  42904. selector: "translator",
  42905. protocol: 'accessing',
  42906. fn: function (){
  42907. var self=this;
  42908. var $1;
  42909. $1=self["@translator"];
  42910. return $1;
  42911. },
  42912. //>>excludeStart("ide", pragmas.excludeIdeData);
  42913. args: [],
  42914. source: "translator\x0a\x09^ translator",
  42915. referencedClasses: [],
  42916. //>>excludeEnd("ide");
  42917. messageSends: []
  42918. }),
  42919. globals.IRSendInliner);
  42920. smalltalk.addMethod(
  42921. smalltalk.method({
  42922. selector: "translator:",
  42923. protocol: 'accessing',
  42924. fn: function (anASTTranslator){
  42925. var self=this;
  42926. self["@translator"]=anASTTranslator;
  42927. return self;
  42928. },
  42929. //>>excludeStart("ide", pragmas.excludeIdeData);
  42930. args: ["anASTTranslator"],
  42931. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  42932. referencedClasses: [],
  42933. //>>excludeEnd("ide");
  42934. messageSends: []
  42935. }),
  42936. globals.IRSendInliner);
  42937. smalltalk.addMethod(
  42938. smalltalk.method({
  42939. selector: "inlinedSelectors",
  42940. protocol: 'accessing',
  42941. fn: function (){
  42942. var self=this;
  42943. var $1;
  42944. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  42945. return $1;
  42946. },
  42947. //>>excludeStart("ide", pragmas.excludeIdeData);
  42948. args: [],
  42949. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  42950. referencedClasses: [],
  42951. //>>excludeEnd("ide");
  42952. messageSends: []
  42953. }),
  42954. globals.IRSendInliner.klass);
  42955. smalltalk.addMethod(
  42956. smalltalk.method({
  42957. selector: "shouldInline:",
  42958. protocol: 'accessing',
  42959. fn: function (anIRInstruction){
  42960. var self=this;
  42961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42962. return smalltalk.withContext(function($ctx1) {
  42963. //>>excludeEnd("ctx");
  42964. var $1,$2;
  42965. var $early={};
  42966. try {
  42967. $1=_st(self._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
  42968. if(! smalltalk.assert($1)){
  42969. return false;
  42970. };
  42971. _st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
  42972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42973. return smalltalk.withContext(function($ctx2) {
  42974. //>>excludeEnd("ctx");
  42975. $2=_st(each)._isClosure();
  42976. if(! smalltalk.assert($2)){
  42977. throw $early=[false];
  42978. };
  42979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42981. //>>excludeEnd("ctx");
  42982. }));
  42983. return true;
  42984. }
  42985. catch(e) {if(e===$early)return e[0]; throw e}
  42986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42987. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},globals.IRSendInliner.klass)});
  42988. //>>excludeEnd("ctx");
  42989. },
  42990. //>>excludeStart("ide", pragmas.excludeIdeData);
  42991. args: ["anIRInstruction"],
  42992. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true",
  42993. referencedClasses: [],
  42994. //>>excludeEnd("ide");
  42995. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"]
  42996. }),
  42997. globals.IRSendInliner.klass);
  42998. smalltalk.addClass('IRAssignmentInliner', globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  42999. //>>excludeStart("ide", pragmas.excludeIdeData);
  43000. globals.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions.\x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if(smalltalk.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
  43001. //>>excludeEnd("ide");
  43002. smalltalk.addMethod(
  43003. smalltalk.method({
  43004. selector: "assignment",
  43005. protocol: 'accessing',
  43006. fn: function (){
  43007. var self=this;
  43008. var $1;
  43009. $1=self["@assignment"];
  43010. return $1;
  43011. },
  43012. //>>excludeStart("ide", pragmas.excludeIdeData);
  43013. args: [],
  43014. source: "assignment\x0a\x09^ assignment",
  43015. referencedClasses: [],
  43016. //>>excludeEnd("ide");
  43017. messageSends: []
  43018. }),
  43019. globals.IRAssignmentInliner);
  43020. smalltalk.addMethod(
  43021. smalltalk.method({
  43022. selector: "assignment:",
  43023. protocol: 'accessing',
  43024. fn: function (aNode){
  43025. var self=this;
  43026. self["@assignment"]=aNode;
  43027. return self;
  43028. },
  43029. //>>excludeStart("ide", pragmas.excludeIdeData);
  43030. args: ["aNode"],
  43031. source: "assignment: aNode\x0a\x09assignment := aNode",
  43032. referencedClasses: [],
  43033. //>>excludeEnd("ide");
  43034. messageSends: []
  43035. }),
  43036. globals.IRAssignmentInliner);
  43037. smalltalk.addMethod(
  43038. smalltalk.method({
  43039. selector: "inlineAssignment:",
  43040. protocol: 'inlining',
  43041. fn: function (anIRAssignment){
  43042. var self=this;
  43043. var inlinedAssignment;
  43044. function $IRInlinedAssignment(){return globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  43045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43046. return smalltalk.withContext(function($ctx1) {
  43047. //>>excludeEnd("ctx");
  43048. var $1,$2;
  43049. self._assignment_(anIRAssignment);
  43050. inlinedAssignment=_st($IRInlinedAssignment())._new();
  43051. $1=_st(anIRAssignment)._instructions();
  43052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43053. $ctx1.sendIdx["instructions"]=1;
  43054. //>>excludeEnd("ctx");
  43055. _st($1)._do_((function(each){
  43056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43057. return smalltalk.withContext(function($ctx2) {
  43058. //>>excludeEnd("ctx");
  43059. return _st(inlinedAssignment)._add_(each);
  43060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43061. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43062. //>>excludeEnd("ctx");
  43063. }));
  43064. _st(anIRAssignment)._replaceWith_(inlinedAssignment);
  43065. self._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
  43066. $2=inlinedAssignment;
  43067. return $2;
  43068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43069. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},globals.IRAssignmentInliner)});
  43070. //>>excludeEnd("ctx");
  43071. },
  43072. //>>excludeStart("ide", pragmas.excludeIdeData);
  43073. args: ["anIRAssignment"],
  43074. source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment",
  43075. referencedClasses: ["IRInlinedAssignment"],
  43076. //>>excludeEnd("ide");
  43077. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  43078. }),
  43079. globals.IRAssignmentInliner);
  43080. smalltalk.addMethod(
  43081. smalltalk.method({
  43082. selector: "inlineClosure:",
  43083. protocol: 'inlining',
  43084. fn: function (anIRClosure){
  43085. var self=this;
  43086. var inlinedClosure,statements;
  43087. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  43088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43089. return smalltalk.withContext(function($ctx1) {
  43090. //>>excludeEnd("ctx");
  43091. var $2,$1,$4,$3,$5,$7,$8,$6,$9;
  43092. inlinedClosure=(
  43093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43094. $ctx1.supercall = true,
  43095. //>>excludeEnd("ctx");
  43096. globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]));
  43097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43098. $ctx1.supercall = false;
  43099. //>>excludeEnd("ctx");;
  43100. $2=_st(inlinedClosure)._instructions();
  43101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43102. $ctx1.sendIdx["instructions"]=2;
  43103. //>>excludeEnd("ctx");
  43104. $1=_st($2)._last();
  43105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43106. $ctx1.sendIdx["last"]=1;
  43107. //>>excludeEnd("ctx");
  43108. statements=_st($1)._instructions();
  43109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43110. $ctx1.sendIdx["instructions"]=1;
  43111. //>>excludeEnd("ctx");
  43112. _st(statements)._ifNotEmpty_((function(){
  43113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43114. return smalltalk.withContext(function($ctx2) {
  43115. //>>excludeEnd("ctx");
  43116. $4=_st(statements)._last();
  43117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43118. $ctx2.sendIdx["last"]=2;
  43119. //>>excludeEnd("ctx");
  43120. $3=_st($4)._canBeAssigned();
  43121. if(smalltalk.assert($3)){
  43122. $5=_st(statements)._last();
  43123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43124. $ctx2.sendIdx["last"]=3;
  43125. //>>excludeEnd("ctx");
  43126. $7=_st($IRAssignment())._new();
  43127. _st($7)._add_(_st(_st(self._assignment())._instructions())._first());
  43128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43129. $ctx2.sendIdx["add:"]=1;
  43130. //>>excludeEnd("ctx");
  43131. _st($7)._add_(_st(_st(statements)._last())._copy());
  43132. $8=_st($7)._yourself();
  43133. $6=$8;
  43134. return _st($5)._replaceWith_($6);
  43135. };
  43136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43138. //>>excludeEnd("ctx");
  43139. }));
  43140. $9=inlinedClosure;
  43141. return $9;
  43142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43143. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},globals.IRAssignmentInliner)});
  43144. //>>excludeEnd("ctx");
  43145. },
  43146. //>>excludeStart("ide", pragmas.excludeIdeData);
  43147. args: ["anIRClosure"],
  43148. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
  43149. referencedClasses: ["IRAssignment"],
  43150. //>>excludeEnd("ide");
  43151. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  43152. }),
  43153. globals.IRAssignmentInliner);
  43154. smalltalk.addClass('IRReturnInliner', globals.IRSendInliner, [], 'Compiler-Inlining');
  43155. //>>excludeStart("ide", pragmas.excludeIdeData);
  43156. globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  43157. //>>excludeEnd("ide");
  43158. smalltalk.addMethod(
  43159. smalltalk.method({
  43160. selector: "inlineClosure:",
  43161. protocol: 'inlining',
  43162. fn: function (anIRClosure){
  43163. var self=this;
  43164. var closure,statements;
  43165. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  43166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43167. return smalltalk.withContext(function($ctx1) {
  43168. //>>excludeEnd("ctx");
  43169. var $1,$3,$2,$4,$5,$6,$7;
  43170. closure=(
  43171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43172. $ctx1.supercall = true,
  43173. //>>excludeEnd("ctx");
  43174. globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]));
  43175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43176. $ctx1.supercall = false;
  43177. //>>excludeEnd("ctx");;
  43178. $1=_st(_st(closure)._instructions())._last();
  43179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43180. $ctx1.sendIdx["last"]=1;
  43181. //>>excludeEnd("ctx");
  43182. statements=_st($1)._instructions();
  43183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43184. $ctx1.sendIdx["instructions"]=1;
  43185. //>>excludeEnd("ctx");
  43186. _st(statements)._ifNotEmpty_((function(){
  43187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43188. return smalltalk.withContext(function($ctx2) {
  43189. //>>excludeEnd("ctx");
  43190. $3=_st(statements)._last();
  43191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43192. $ctx2.sendIdx["last"]=2;
  43193. //>>excludeEnd("ctx");
  43194. $2=_st($3)._isReturn();
  43195. if(! smalltalk.assert($2)){
  43196. $4=_st(statements)._last();
  43197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43198. $ctx2.sendIdx["last"]=3;
  43199. //>>excludeEnd("ctx");
  43200. $5=_st($IRReturn())._new();
  43201. _st($5)._add_(_st(_st(statements)._last())._copy());
  43202. $6=_st($5)._yourself();
  43203. return _st($4)._replaceWith_($6);
  43204. };
  43205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43207. //>>excludeEnd("ctx");
  43208. }));
  43209. $7=closure;
  43210. return $7;
  43211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43212. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},globals.IRReturnInliner)});
  43213. //>>excludeEnd("ctx");
  43214. },
  43215. //>>excludeStart("ide", pragmas.excludeIdeData);
  43216. args: ["anIRClosure"],
  43217. source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
  43218. referencedClasses: ["IRReturn"],
  43219. //>>excludeEnd("ide");
  43220. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  43221. }),
  43222. globals.IRReturnInliner);
  43223. smalltalk.addMethod(
  43224. smalltalk.method({
  43225. selector: "inlineReturn:",
  43226. protocol: 'inlining',
  43227. fn: function (anIRReturn){
  43228. var self=this;
  43229. var return_;
  43230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43231. return smalltalk.withContext(function($ctx1) {
  43232. //>>excludeEnd("ctx");
  43233. var $1,$2;
  43234. return_=self._inlinedReturn();
  43235. $1=_st(anIRReturn)._instructions();
  43236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43237. $ctx1.sendIdx["instructions"]=1;
  43238. //>>excludeEnd("ctx");
  43239. _st($1)._do_((function(each){
  43240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43241. return smalltalk.withContext(function($ctx2) {
  43242. //>>excludeEnd("ctx");
  43243. return _st(return_)._add_(each);
  43244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43245. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43246. //>>excludeEnd("ctx");
  43247. }));
  43248. _st(anIRReturn)._replaceWith_(return_);
  43249. self._inlineSend_(_st(_st(return_)._instructions())._last());
  43250. $2=return_;
  43251. return $2;
  43252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43253. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},globals.IRReturnInliner)});
  43254. //>>excludeEnd("ctx");
  43255. },
  43256. //>>excludeStart("ide", pragmas.excludeIdeData);
  43257. args: ["anIRReturn"],
  43258. source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return",
  43259. referencedClasses: [],
  43260. //>>excludeEnd("ide");
  43261. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  43262. }),
  43263. globals.IRReturnInliner);
  43264. smalltalk.addMethod(
  43265. smalltalk.method({
  43266. selector: "inlinedReturn",
  43267. protocol: 'factory',
  43268. fn: function (){
  43269. var self=this;
  43270. function $IRInlinedReturn(){return globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  43271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43272. return smalltalk.withContext(function($ctx1) {
  43273. //>>excludeEnd("ctx");
  43274. var $1;
  43275. $1=_st($IRInlinedReturn())._new();
  43276. return $1;
  43277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43278. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},globals.IRReturnInliner)});
  43279. //>>excludeEnd("ctx");
  43280. },
  43281. //>>excludeStart("ide", pragmas.excludeIdeData);
  43282. args: [],
  43283. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  43284. referencedClasses: ["IRInlinedReturn"],
  43285. //>>excludeEnd("ide");
  43286. messageSends: ["new"]
  43287. }),
  43288. globals.IRReturnInliner);
  43289. smalltalk.addClass('InliningCodeGenerator', globals.CodeGenerator, [], 'Compiler-Inlining');
  43290. //>>excludeStart("ide", pragmas.excludeIdeData);
  43291. globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  43292. //>>excludeEnd("ide");
  43293. smalltalk.addMethod(
  43294. smalltalk.method({
  43295. selector: "compileNode:",
  43296. protocol: 'compiling',
  43297. fn: function (aNode){
  43298. var self=this;
  43299. var ir,stream;
  43300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43301. return smalltalk.withContext(function($ctx1) {
  43302. //>>excludeEnd("ctx");
  43303. var $2,$3,$1;
  43304. _st(self._semanticAnalyzer())._visit_(aNode);
  43305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43306. $ctx1.sendIdx["visit:"]=1;
  43307. //>>excludeEnd("ctx");
  43308. ir=_st(self._translator())._visit_(aNode);
  43309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43310. $ctx1.sendIdx["visit:"]=2;
  43311. //>>excludeEnd("ctx");
  43312. _st(self._inliner())._visit_(ir);
  43313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43314. $ctx1.sendIdx["visit:"]=3;
  43315. //>>excludeEnd("ctx");
  43316. $2=self._irTranslator();
  43317. _st($2)._currentClass_(self._currentClass());
  43318. _st($2)._visit_(ir);
  43319. $3=_st($2)._contents();
  43320. $1=$3;
  43321. return $1;
  43322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43323. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.InliningCodeGenerator)});
  43324. //>>excludeEnd("ctx");
  43325. },
  43326. //>>excludeStart("ide", pragmas.excludeIdeData);
  43327. args: ["aNode"],
  43328. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  43329. referencedClasses: [],
  43330. //>>excludeEnd("ide");
  43331. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  43332. }),
  43333. globals.InliningCodeGenerator);
  43334. smalltalk.addMethod(
  43335. smalltalk.method({
  43336. selector: "inliner",
  43337. protocol: 'compiling',
  43338. fn: function (){
  43339. var self=this;
  43340. function $IRInliner(){return globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  43341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43342. return smalltalk.withContext(function($ctx1) {
  43343. //>>excludeEnd("ctx");
  43344. var $1;
  43345. $1=_st($IRInliner())._new();
  43346. return $1;
  43347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43348. }, function($ctx1) {$ctx1.fill(self,"inliner",{},globals.InliningCodeGenerator)});
  43349. //>>excludeEnd("ctx");
  43350. },
  43351. //>>excludeStart("ide", pragmas.excludeIdeData);
  43352. args: [],
  43353. source: "inliner\x0a\x09^ IRInliner new",
  43354. referencedClasses: ["IRInliner"],
  43355. //>>excludeEnd("ide");
  43356. messageSends: ["new"]
  43357. }),
  43358. globals.InliningCodeGenerator);
  43359. smalltalk.addMethod(
  43360. smalltalk.method({
  43361. selector: "irTranslator",
  43362. protocol: 'compiling',
  43363. fn: function (){
  43364. var self=this;
  43365. function $IRInliningJSTranslator(){return globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  43366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43367. return smalltalk.withContext(function($ctx1) {
  43368. //>>excludeEnd("ctx");
  43369. var $1;
  43370. $1=_st($IRInliningJSTranslator())._new();
  43371. return $1;
  43372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43373. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.InliningCodeGenerator)});
  43374. //>>excludeEnd("ctx");
  43375. },
  43376. //>>excludeStart("ide", pragmas.excludeIdeData);
  43377. args: [],
  43378. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  43379. referencedClasses: ["IRInliningJSTranslator"],
  43380. //>>excludeEnd("ide");
  43381. messageSends: ["new"]
  43382. }),
  43383. globals.InliningCodeGenerator);
  43384. });
  43385. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  43386. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  43387. smalltalk.addPackage('Compiler-Semantic');
  43388. smalltalk.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43389. smalltalk.addClass('LexicalScope', globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  43390. //>>excludeStart("ide", pragmas.excludeIdeData);
  43391. globals.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope.";
  43392. //>>excludeEnd("ide");
  43393. smalltalk.addMethod(
  43394. smalltalk.method({
  43395. selector: "addArg:",
  43396. protocol: 'adding',
  43397. fn: function (aString){
  43398. var self=this;
  43399. function $ArgVar(){return globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  43400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43401. return smalltalk.withContext(function($ctx1) {
  43402. //>>excludeEnd("ctx");
  43403. var $1;
  43404. $1=self._args();
  43405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43406. $ctx1.sendIdx["args"]=1;
  43407. //>>excludeEnd("ctx");
  43408. _st($1)._at_put_(aString,_st($ArgVar())._on_(aString));
  43409. _st(_st(self._args())._at_(aString))._scope_(self);
  43410. return self;
  43411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43412. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},globals.LexicalScope)});
  43413. //>>excludeEnd("ctx");
  43414. },
  43415. //>>excludeStart("ide", pragmas.excludeIdeData);
  43416. args: ["aString"],
  43417. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  43418. referencedClasses: ["ArgVar"],
  43419. //>>excludeEnd("ide");
  43420. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  43421. }),
  43422. globals.LexicalScope);
  43423. smalltalk.addMethod(
  43424. smalltalk.method({
  43425. selector: "addTemp:",
  43426. protocol: 'adding',
  43427. fn: function (aString){
  43428. var self=this;
  43429. function $TempVar(){return globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  43430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43431. return smalltalk.withContext(function($ctx1) {
  43432. //>>excludeEnd("ctx");
  43433. var $1;
  43434. $1=self._temps();
  43435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43436. $ctx1.sendIdx["temps"]=1;
  43437. //>>excludeEnd("ctx");
  43438. _st($1)._at_put_(aString,_st($TempVar())._on_(aString));
  43439. _st(_st(self._temps())._at_(aString))._scope_(self);
  43440. return self;
  43441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43442. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},globals.LexicalScope)});
  43443. //>>excludeEnd("ctx");
  43444. },
  43445. //>>excludeStart("ide", pragmas.excludeIdeData);
  43446. args: ["aString"],
  43447. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  43448. referencedClasses: ["TempVar"],
  43449. //>>excludeEnd("ide");
  43450. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  43451. }),
  43452. globals.LexicalScope);
  43453. smalltalk.addMethod(
  43454. smalltalk.method({
  43455. selector: "alias",
  43456. protocol: 'accessing',
  43457. fn: function (){
  43458. var self=this;
  43459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43460. return smalltalk.withContext(function($ctx1) {
  43461. //>>excludeEnd("ctx");
  43462. var $1;
  43463. $1="$ctx".__comma(_st(self._scopeLevel())._asString());
  43464. return $1;
  43465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43466. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.LexicalScope)});
  43467. //>>excludeEnd("ctx");
  43468. },
  43469. //>>excludeStart("ide", pragmas.excludeIdeData);
  43470. args: [],
  43471. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  43472. referencedClasses: [],
  43473. //>>excludeEnd("ide");
  43474. messageSends: [",", "asString", "scopeLevel"]
  43475. }),
  43476. globals.LexicalScope);
  43477. smalltalk.addMethod(
  43478. smalltalk.method({
  43479. selector: "allVariableNames",
  43480. protocol: 'accessing',
  43481. fn: function (){
  43482. var self=this;
  43483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43484. return smalltalk.withContext(function($ctx1) {
  43485. //>>excludeEnd("ctx");
  43486. var $2,$1;
  43487. $2=_st(self._args())._keys();
  43488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43489. $ctx1.sendIdx["keys"]=1;
  43490. //>>excludeEnd("ctx");
  43491. $1=_st($2).__comma(_st(self._temps())._keys());
  43492. return $1;
  43493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43494. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.LexicalScope)});
  43495. //>>excludeEnd("ctx");
  43496. },
  43497. //>>excludeStart("ide", pragmas.excludeIdeData);
  43498. args: [],
  43499. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  43500. referencedClasses: [],
  43501. //>>excludeEnd("ide");
  43502. messageSends: [",", "keys", "args", "temps"]
  43503. }),
  43504. globals.LexicalScope);
  43505. smalltalk.addMethod(
  43506. smalltalk.method({
  43507. selector: "args",
  43508. protocol: 'accessing',
  43509. fn: function (){
  43510. var self=this;
  43511. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  43512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43513. return smalltalk.withContext(function($ctx1) {
  43514. //>>excludeEnd("ctx");
  43515. var $2,$1,$receiver;
  43516. $2=self["@args"];
  43517. if(($receiver = $2) == null || $receiver.isNil){
  43518. self["@args"]=_st($Dictionary())._new();
  43519. $1=self["@args"];
  43520. } else {
  43521. $1=$2;
  43522. };
  43523. return $1;
  43524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43525. }, function($ctx1) {$ctx1.fill(self,"args",{},globals.LexicalScope)});
  43526. //>>excludeEnd("ctx");
  43527. },
  43528. //>>excludeStart("ide", pragmas.excludeIdeData);
  43529. args: [],
  43530. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  43531. referencedClasses: ["Dictionary"],
  43532. //>>excludeEnd("ide");
  43533. messageSends: ["ifNil:", "new"]
  43534. }),
  43535. globals.LexicalScope);
  43536. smalltalk.addMethod(
  43537. smalltalk.method({
  43538. selector: "bindingFor:",
  43539. protocol: 'accessing',
  43540. fn: function (aStringOrNode){
  43541. var self=this;
  43542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43543. return smalltalk.withContext(function($ctx1) {
  43544. //>>excludeEnd("ctx");
  43545. var $2,$3,$4,$5,$1;
  43546. $2=self._pseudoVars();
  43547. $3=_st(aStringOrNode)._value();
  43548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43549. $ctx1.sendIdx["value"]=1;
  43550. //>>excludeEnd("ctx");
  43551. $1=_st($2)._at_ifAbsent_($3,(function(){
  43552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43553. return smalltalk.withContext(function($ctx2) {
  43554. //>>excludeEnd("ctx");
  43555. $4=self._args();
  43556. $5=_st(aStringOrNode)._value();
  43557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43558. $ctx2.sendIdx["value"]=2;
  43559. //>>excludeEnd("ctx");
  43560. return _st($4)._at_ifAbsent_($5,(function(){
  43561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43562. return smalltalk.withContext(function($ctx3) {
  43563. //>>excludeEnd("ctx");
  43564. return _st(self._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  43565. return nil;
  43566. }));
  43567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43568. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43569. //>>excludeEnd("ctx");
  43570. }));
  43571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43572. $ctx2.sendIdx["at:ifAbsent:"]=2;
  43573. //>>excludeEnd("ctx");
  43574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43576. //>>excludeEnd("ctx");
  43577. }));
  43578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43579. $ctx1.sendIdx["at:ifAbsent:"]=1;
  43580. //>>excludeEnd("ctx");
  43581. return $1;
  43582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43583. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},globals.LexicalScope)});
  43584. //>>excludeEnd("ctx");
  43585. },
  43586. //>>excludeStart("ide", pragmas.excludeIdeData);
  43587. args: ["aStringOrNode"],
  43588. source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [\x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]",
  43589. referencedClasses: [],
  43590. //>>excludeEnd("ide");
  43591. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  43592. }),
  43593. globals.LexicalScope);
  43594. smalltalk.addMethod(
  43595. smalltalk.method({
  43596. selector: "blockIndex",
  43597. protocol: 'accessing',
  43598. fn: function (){
  43599. var self=this;
  43600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43601. return smalltalk.withContext(function($ctx1) {
  43602. //>>excludeEnd("ctx");
  43603. var $2,$1,$receiver;
  43604. $2=self["@blockIndex"];
  43605. if(($receiver = $2) == null || $receiver.isNil){
  43606. $1=(0);
  43607. } else {
  43608. $1=$2;
  43609. };
  43610. return $1;
  43611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43612. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},globals.LexicalScope)});
  43613. //>>excludeEnd("ctx");
  43614. },
  43615. //>>excludeStart("ide", pragmas.excludeIdeData);
  43616. args: [],
  43617. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  43618. referencedClasses: [],
  43619. //>>excludeEnd("ide");
  43620. messageSends: ["ifNil:"]
  43621. }),
  43622. globals.LexicalScope);
  43623. smalltalk.addMethod(
  43624. smalltalk.method({
  43625. selector: "blockIndex:",
  43626. protocol: 'accessing',
  43627. fn: function (anInteger){
  43628. var self=this;
  43629. self["@blockIndex"]=anInteger;
  43630. return self;
  43631. },
  43632. //>>excludeStart("ide", pragmas.excludeIdeData);
  43633. args: ["anInteger"],
  43634. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  43635. referencedClasses: [],
  43636. //>>excludeEnd("ide");
  43637. messageSends: []
  43638. }),
  43639. globals.LexicalScope);
  43640. smalltalk.addMethod(
  43641. smalltalk.method({
  43642. selector: "canInlineNonLocalReturns",
  43643. protocol: 'testing',
  43644. fn: function (){
  43645. var self=this;
  43646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43647. return smalltalk.withContext(function($ctx1) {
  43648. //>>excludeEnd("ctx");
  43649. var $1;
  43650. $1=_st(self._isInlined())._and_((function(){
  43651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43652. return smalltalk.withContext(function($ctx2) {
  43653. //>>excludeEnd("ctx");
  43654. return _st(self._outerScope())._canInlineNonLocalReturns();
  43655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43657. //>>excludeEnd("ctx");
  43658. }));
  43659. return $1;
  43660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43661. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},globals.LexicalScope)});
  43662. //>>excludeEnd("ctx");
  43663. },
  43664. //>>excludeStart("ide", pragmas.excludeIdeData);
  43665. args: [],
  43666. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  43667. referencedClasses: [],
  43668. //>>excludeEnd("ide");
  43669. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  43670. }),
  43671. globals.LexicalScope);
  43672. smalltalk.addMethod(
  43673. smalltalk.method({
  43674. selector: "instruction",
  43675. protocol: 'accessing',
  43676. fn: function (){
  43677. var self=this;
  43678. var $1;
  43679. $1=self["@instruction"];
  43680. return $1;
  43681. },
  43682. //>>excludeStart("ide", pragmas.excludeIdeData);
  43683. args: [],
  43684. source: "instruction\x0a\x09^ instruction",
  43685. referencedClasses: [],
  43686. //>>excludeEnd("ide");
  43687. messageSends: []
  43688. }),
  43689. globals.LexicalScope);
  43690. smalltalk.addMethod(
  43691. smalltalk.method({
  43692. selector: "instruction:",
  43693. protocol: 'accessing',
  43694. fn: function (anIRInstruction){
  43695. var self=this;
  43696. self["@instruction"]=anIRInstruction;
  43697. return self;
  43698. },
  43699. //>>excludeStart("ide", pragmas.excludeIdeData);
  43700. args: ["anIRInstruction"],
  43701. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  43702. referencedClasses: [],
  43703. //>>excludeEnd("ide");
  43704. messageSends: []
  43705. }),
  43706. globals.LexicalScope);
  43707. smalltalk.addMethod(
  43708. smalltalk.method({
  43709. selector: "isBlockScope",
  43710. protocol: 'testing',
  43711. fn: function (){
  43712. var self=this;
  43713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43714. return smalltalk.withContext(function($ctx1) {
  43715. //>>excludeEnd("ctx");
  43716. var $1;
  43717. $1=_st(self._isMethodScope())._not();
  43718. return $1;
  43719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43720. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},globals.LexicalScope)});
  43721. //>>excludeEnd("ctx");
  43722. },
  43723. //>>excludeStart("ide", pragmas.excludeIdeData);
  43724. args: [],
  43725. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  43726. referencedClasses: [],
  43727. //>>excludeEnd("ide");
  43728. messageSends: ["not", "isMethodScope"]
  43729. }),
  43730. globals.LexicalScope);
  43731. smalltalk.addMethod(
  43732. smalltalk.method({
  43733. selector: "isInlined",
  43734. protocol: 'testing',
  43735. fn: function (){
  43736. var self=this;
  43737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43738. return smalltalk.withContext(function($ctx1) {
  43739. //>>excludeEnd("ctx");
  43740. var $3,$2,$1;
  43741. $3=self._instruction();
  43742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43743. $ctx1.sendIdx["instruction"]=1;
  43744. //>>excludeEnd("ctx");
  43745. $2=_st($3)._notNil();
  43746. $1=_st($2)._and_((function(){
  43747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43748. return smalltalk.withContext(function($ctx2) {
  43749. //>>excludeEnd("ctx");
  43750. return _st(self._instruction())._isInlined();
  43751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43753. //>>excludeEnd("ctx");
  43754. }));
  43755. return $1;
  43756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43757. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},globals.LexicalScope)});
  43758. //>>excludeEnd("ctx");
  43759. },
  43760. //>>excludeStart("ide", pragmas.excludeIdeData);
  43761. args: [],
  43762. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  43763. referencedClasses: [],
  43764. //>>excludeEnd("ide");
  43765. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  43766. }),
  43767. globals.LexicalScope);
  43768. smalltalk.addMethod(
  43769. smalltalk.method({
  43770. selector: "isMethodScope",
  43771. protocol: 'testing',
  43772. fn: function (){
  43773. var self=this;
  43774. return false;
  43775. },
  43776. //>>excludeStart("ide", pragmas.excludeIdeData);
  43777. args: [],
  43778. source: "isMethodScope\x0a\x09^ false",
  43779. referencedClasses: [],
  43780. //>>excludeEnd("ide");
  43781. messageSends: []
  43782. }),
  43783. globals.LexicalScope);
  43784. smalltalk.addMethod(
  43785. smalltalk.method({
  43786. selector: "lookupVariable:",
  43787. protocol: 'accessing',
  43788. fn: function (aNode){
  43789. var self=this;
  43790. var lookup;
  43791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43792. return smalltalk.withContext(function($ctx1) {
  43793. //>>excludeEnd("ctx");
  43794. var $1,$2,$3,$receiver;
  43795. lookup=self._bindingFor_(aNode);
  43796. $1=lookup;
  43797. if(($receiver = $1) == null || $receiver.isNil){
  43798. $2=self._outerScope();
  43799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43800. $ctx1.sendIdx["outerScope"]=1;
  43801. //>>excludeEnd("ctx");
  43802. if(($receiver = $2) == null || $receiver.isNil){
  43803. lookup=$2;
  43804. } else {
  43805. lookup=_st(self._outerScope())._lookupVariable_(aNode);
  43806. };
  43807. lookup;
  43808. } else {
  43809. $1;
  43810. };
  43811. $3=lookup;
  43812. return $3;
  43813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43814. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},globals.LexicalScope)});
  43815. //>>excludeEnd("ctx");
  43816. },
  43817. //>>excludeStart("ide", pragmas.excludeIdeData);
  43818. args: ["aNode"],
  43819. source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup",
  43820. referencedClasses: [],
  43821. //>>excludeEnd("ide");
  43822. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  43823. }),
  43824. globals.LexicalScope);
  43825. smalltalk.addMethod(
  43826. smalltalk.method({
  43827. selector: "methodScope",
  43828. protocol: 'accessing',
  43829. fn: function (){
  43830. var self=this;
  43831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43832. return smalltalk.withContext(function($ctx1) {
  43833. //>>excludeEnd("ctx");
  43834. var $2,$1,$receiver;
  43835. $2=self._outerScope();
  43836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43837. $ctx1.sendIdx["outerScope"]=1;
  43838. //>>excludeEnd("ctx");
  43839. if(($receiver = $2) == null || $receiver.isNil){
  43840. $1=$2;
  43841. } else {
  43842. $1=_st(self._outerScope())._methodScope();
  43843. };
  43844. return $1;
  43845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43846. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},globals.LexicalScope)});
  43847. //>>excludeEnd("ctx");
  43848. },
  43849. //>>excludeStart("ide", pragmas.excludeIdeData);
  43850. args: [],
  43851. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  43852. referencedClasses: [],
  43853. //>>excludeEnd("ide");
  43854. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  43855. }),
  43856. globals.LexicalScope);
  43857. smalltalk.addMethod(
  43858. smalltalk.method({
  43859. selector: "node",
  43860. protocol: 'accessing',
  43861. fn: function (){
  43862. var self=this;
  43863. var $1;
  43864. $1=self["@node"];
  43865. return $1;
  43866. },
  43867. //>>excludeStart("ide", pragmas.excludeIdeData);
  43868. args: [],
  43869. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  43870. referencedClasses: [],
  43871. //>>excludeEnd("ide");
  43872. messageSends: []
  43873. }),
  43874. globals.LexicalScope);
  43875. smalltalk.addMethod(
  43876. smalltalk.method({
  43877. selector: "node:",
  43878. protocol: 'accessing',
  43879. fn: function (aNode){
  43880. var self=this;
  43881. self["@node"]=aNode;
  43882. return self;
  43883. },
  43884. //>>excludeStart("ide", pragmas.excludeIdeData);
  43885. args: ["aNode"],
  43886. source: "node: aNode\x0a\x09node := aNode",
  43887. referencedClasses: [],
  43888. //>>excludeEnd("ide");
  43889. messageSends: []
  43890. }),
  43891. globals.LexicalScope);
  43892. smalltalk.addMethod(
  43893. smalltalk.method({
  43894. selector: "outerScope",
  43895. protocol: 'accessing',
  43896. fn: function (){
  43897. var self=this;
  43898. var $1;
  43899. $1=self["@outerScope"];
  43900. return $1;
  43901. },
  43902. //>>excludeStart("ide", pragmas.excludeIdeData);
  43903. args: [],
  43904. source: "outerScope\x0a\x09^ outerScope",
  43905. referencedClasses: [],
  43906. //>>excludeEnd("ide");
  43907. messageSends: []
  43908. }),
  43909. globals.LexicalScope);
  43910. smalltalk.addMethod(
  43911. smalltalk.method({
  43912. selector: "outerScope:",
  43913. protocol: 'accessing',
  43914. fn: function (aLexicalScope){
  43915. var self=this;
  43916. self["@outerScope"]=aLexicalScope;
  43917. return self;
  43918. },
  43919. //>>excludeStart("ide", pragmas.excludeIdeData);
  43920. args: ["aLexicalScope"],
  43921. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  43922. referencedClasses: [],
  43923. //>>excludeEnd("ide");
  43924. messageSends: []
  43925. }),
  43926. globals.LexicalScope);
  43927. smalltalk.addMethod(
  43928. smalltalk.method({
  43929. selector: "pseudoVars",
  43930. protocol: 'accessing',
  43931. fn: function (){
  43932. var self=this;
  43933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43934. return smalltalk.withContext(function($ctx1) {
  43935. //>>excludeEnd("ctx");
  43936. var $1;
  43937. $1=_st(self._methodScope())._pseudoVars();
  43938. return $1;
  43939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43940. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.LexicalScope)});
  43941. //>>excludeEnd("ctx");
  43942. },
  43943. //>>excludeStart("ide", pragmas.excludeIdeData);
  43944. args: [],
  43945. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  43946. referencedClasses: [],
  43947. //>>excludeEnd("ide");
  43948. messageSends: ["pseudoVars", "methodScope"]
  43949. }),
  43950. globals.LexicalScope);
  43951. smalltalk.addMethod(
  43952. smalltalk.method({
  43953. selector: "scopeLevel",
  43954. protocol: 'accessing',
  43955. fn: function (){
  43956. var self=this;
  43957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43958. return smalltalk.withContext(function($ctx1) {
  43959. //>>excludeEnd("ctx");
  43960. var $1,$2,$4,$3,$5,$receiver;
  43961. $1=self._outerScope();
  43962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43963. $ctx1.sendIdx["outerScope"]=1;
  43964. //>>excludeEnd("ctx");
  43965. if(($receiver = $1) == null || $receiver.isNil){
  43966. return (1);
  43967. } else {
  43968. $1;
  43969. };
  43970. $2=self._isInlined();
  43971. if(smalltalk.assert($2)){
  43972. $4=self._outerScope();
  43973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43974. $ctx1.sendIdx["outerScope"]=2;
  43975. //>>excludeEnd("ctx");
  43976. $3=_st($4)._scopeLevel();
  43977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43978. $ctx1.sendIdx["scopeLevel"]=1;
  43979. //>>excludeEnd("ctx");
  43980. return $3;
  43981. };
  43982. $5=_st(_st(self._outerScope())._scopeLevel()).__plus((1));
  43983. return $5;
  43984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43985. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},globals.LexicalScope)});
  43986. //>>excludeEnd("ctx");
  43987. },
  43988. //>>excludeStart("ide", pragmas.excludeIdeData);
  43989. args: [],
  43990. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  43991. referencedClasses: [],
  43992. //>>excludeEnd("ide");
  43993. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  43994. }),
  43995. globals.LexicalScope);
  43996. smalltalk.addMethod(
  43997. smalltalk.method({
  43998. selector: "temps",
  43999. protocol: 'accessing',
  44000. fn: function (){
  44001. var self=this;
  44002. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44004. return smalltalk.withContext(function($ctx1) {
  44005. //>>excludeEnd("ctx");
  44006. var $2,$1,$receiver;
  44007. $2=self["@temps"];
  44008. if(($receiver = $2) == null || $receiver.isNil){
  44009. self["@temps"]=_st($Dictionary())._new();
  44010. $1=self["@temps"];
  44011. } else {
  44012. $1=$2;
  44013. };
  44014. return $1;
  44015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44016. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.LexicalScope)});
  44017. //>>excludeEnd("ctx");
  44018. },
  44019. //>>excludeStart("ide", pragmas.excludeIdeData);
  44020. args: [],
  44021. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  44022. referencedClasses: ["Dictionary"],
  44023. //>>excludeEnd("ide");
  44024. messageSends: ["ifNil:", "new"]
  44025. }),
  44026. globals.LexicalScope);
  44027. smalltalk.addClass('MethodLexicalScope', globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  44028. //>>excludeStart("ide", pragmas.excludeIdeData);
  44029. globals.MethodLexicalScope.comment="I represent a method scope.";
  44030. //>>excludeEnd("ide");
  44031. smalltalk.addMethod(
  44032. smalltalk.method({
  44033. selector: "addIVar:",
  44034. protocol: 'adding',
  44035. fn: function (aString){
  44036. var self=this;
  44037. function $InstanceVar(){return globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  44038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44039. return smalltalk.withContext(function($ctx1) {
  44040. //>>excludeEnd("ctx");
  44041. var $1;
  44042. $1=self._iVars();
  44043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44044. $ctx1.sendIdx["iVars"]=1;
  44045. //>>excludeEnd("ctx");
  44046. _st($1)._at_put_(aString,_st($InstanceVar())._on_(aString));
  44047. _st(_st(self._iVars())._at_(aString))._scope_(self);
  44048. return self;
  44049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44050. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},globals.MethodLexicalScope)});
  44051. //>>excludeEnd("ctx");
  44052. },
  44053. //>>excludeStart("ide", pragmas.excludeIdeData);
  44054. args: ["aString"],
  44055. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  44056. referencedClasses: ["InstanceVar"],
  44057. //>>excludeEnd("ide");
  44058. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  44059. }),
  44060. globals.MethodLexicalScope);
  44061. smalltalk.addMethod(
  44062. smalltalk.method({
  44063. selector: "addNonLocalReturn:",
  44064. protocol: 'adding',
  44065. fn: function (aScope){
  44066. var self=this;
  44067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44068. return smalltalk.withContext(function($ctx1) {
  44069. //>>excludeEnd("ctx");
  44070. _st(self._nonLocalReturns())._add_(aScope);
  44071. return self;
  44072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44073. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)});
  44074. //>>excludeEnd("ctx");
  44075. },
  44076. //>>excludeStart("ide", pragmas.excludeIdeData);
  44077. args: ["aScope"],
  44078. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  44079. referencedClasses: [],
  44080. //>>excludeEnd("ide");
  44081. messageSends: ["add:", "nonLocalReturns"]
  44082. }),
  44083. globals.MethodLexicalScope);
  44084. smalltalk.addMethod(
  44085. smalltalk.method({
  44086. selector: "allVariableNames",
  44087. protocol: 'accessing',
  44088. fn: function (){
  44089. var self=this;
  44090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44091. return smalltalk.withContext(function($ctx1) {
  44092. //>>excludeEnd("ctx");
  44093. var $2,$1;
  44094. $2=(
  44095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44096. $ctx1.supercall = true,
  44097. //>>excludeEnd("ctx");
  44098. globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply(_st(self), []));
  44099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44100. $ctx1.supercall = false;
  44101. //>>excludeEnd("ctx");;
  44102. $1=_st($2).__comma(_st(self._iVars())._keys());
  44103. return $1;
  44104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44105. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.MethodLexicalScope)});
  44106. //>>excludeEnd("ctx");
  44107. },
  44108. //>>excludeStart("ide", pragmas.excludeIdeData);
  44109. args: [],
  44110. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  44111. referencedClasses: [],
  44112. //>>excludeEnd("ide");
  44113. messageSends: [",", "allVariableNames", "keys", "iVars"]
  44114. }),
  44115. globals.MethodLexicalScope);
  44116. smalltalk.addMethod(
  44117. smalltalk.method({
  44118. selector: "bindingFor:",
  44119. protocol: 'accessing',
  44120. fn: function (aNode){
  44121. var self=this;
  44122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44123. return smalltalk.withContext(function($ctx1) {
  44124. //>>excludeEnd("ctx");
  44125. var $2,$1,$receiver;
  44126. $2=(
  44127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44128. $ctx1.supercall = true,
  44129. //>>excludeEnd("ctx");
  44130. globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply(_st(self), [aNode]));
  44131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44132. $ctx1.supercall = false;
  44133. //>>excludeEnd("ctx");;
  44134. if(($receiver = $2) == null || $receiver.isNil){
  44135. $1=_st(self._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
  44136. return nil;
  44137. }));
  44138. } else {
  44139. $1=$2;
  44140. };
  44141. return $1;
  44142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44143. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},globals.MethodLexicalScope)});
  44144. //>>excludeEnd("ctx");
  44145. },
  44146. //>>excludeStart("ide", pragmas.excludeIdeData);
  44147. args: ["aNode"],
  44148. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  44149. referencedClasses: [],
  44150. //>>excludeEnd("ide");
  44151. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  44152. }),
  44153. globals.MethodLexicalScope);
  44154. smalltalk.addMethod(
  44155. smalltalk.method({
  44156. selector: "canInlineNonLocalReturns",
  44157. protocol: 'testing',
  44158. fn: function (){
  44159. var self=this;
  44160. return true;
  44161. },
  44162. //>>excludeStart("ide", pragmas.excludeIdeData);
  44163. args: [],
  44164. source: "canInlineNonLocalReturns\x0a\x09^ true",
  44165. referencedClasses: [],
  44166. //>>excludeEnd("ide");
  44167. messageSends: []
  44168. }),
  44169. globals.MethodLexicalScope);
  44170. smalltalk.addMethod(
  44171. smalltalk.method({
  44172. selector: "hasLocalReturn",
  44173. protocol: 'testing',
  44174. fn: function (){
  44175. var self=this;
  44176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44177. return smalltalk.withContext(function($ctx1) {
  44178. //>>excludeEnd("ctx");
  44179. var $1;
  44180. $1=self._localReturn();
  44181. return $1;
  44182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44183. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},globals.MethodLexicalScope)});
  44184. //>>excludeEnd("ctx");
  44185. },
  44186. //>>excludeStart("ide", pragmas.excludeIdeData);
  44187. args: [],
  44188. source: "hasLocalReturn\x0a\x09^ self localReturn",
  44189. referencedClasses: [],
  44190. //>>excludeEnd("ide");
  44191. messageSends: ["localReturn"]
  44192. }),
  44193. globals.MethodLexicalScope);
  44194. smalltalk.addMethod(
  44195. smalltalk.method({
  44196. selector: "hasNonLocalReturn",
  44197. protocol: 'testing',
  44198. fn: function (){
  44199. var self=this;
  44200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44201. return smalltalk.withContext(function($ctx1) {
  44202. //>>excludeEnd("ctx");
  44203. var $1;
  44204. $1=_st(self._nonLocalReturns())._notEmpty();
  44205. return $1;
  44206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44207. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},globals.MethodLexicalScope)});
  44208. //>>excludeEnd("ctx");
  44209. },
  44210. //>>excludeStart("ide", pragmas.excludeIdeData);
  44211. args: [],
  44212. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  44213. referencedClasses: [],
  44214. //>>excludeEnd("ide");
  44215. messageSends: ["notEmpty", "nonLocalReturns"]
  44216. }),
  44217. globals.MethodLexicalScope);
  44218. smalltalk.addMethod(
  44219. smalltalk.method({
  44220. selector: "iVars",
  44221. protocol: 'accessing',
  44222. fn: function (){
  44223. var self=this;
  44224. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44226. return smalltalk.withContext(function($ctx1) {
  44227. //>>excludeEnd("ctx");
  44228. var $2,$1,$receiver;
  44229. $2=self["@iVars"];
  44230. if(($receiver = $2) == null || $receiver.isNil){
  44231. self["@iVars"]=_st($Dictionary())._new();
  44232. $1=self["@iVars"];
  44233. } else {
  44234. $1=$2;
  44235. };
  44236. return $1;
  44237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44238. }, function($ctx1) {$ctx1.fill(self,"iVars",{},globals.MethodLexicalScope)});
  44239. //>>excludeEnd("ctx");
  44240. },
  44241. //>>excludeStart("ide", pragmas.excludeIdeData);
  44242. args: [],
  44243. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  44244. referencedClasses: ["Dictionary"],
  44245. //>>excludeEnd("ide");
  44246. messageSends: ["ifNil:", "new"]
  44247. }),
  44248. globals.MethodLexicalScope);
  44249. smalltalk.addMethod(
  44250. smalltalk.method({
  44251. selector: "isMethodScope",
  44252. protocol: 'testing',
  44253. fn: function (){
  44254. var self=this;
  44255. return true;
  44256. },
  44257. //>>excludeStart("ide", pragmas.excludeIdeData);
  44258. args: [],
  44259. source: "isMethodScope\x0a\x09^ true",
  44260. referencedClasses: [],
  44261. //>>excludeEnd("ide");
  44262. messageSends: []
  44263. }),
  44264. globals.MethodLexicalScope);
  44265. smalltalk.addMethod(
  44266. smalltalk.method({
  44267. selector: "localReturn",
  44268. protocol: 'accessing',
  44269. fn: function (){
  44270. var self=this;
  44271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44272. return smalltalk.withContext(function($ctx1) {
  44273. //>>excludeEnd("ctx");
  44274. var $2,$1,$receiver;
  44275. $2=self["@localReturn"];
  44276. if(($receiver = $2) == null || $receiver.isNil){
  44277. $1=false;
  44278. } else {
  44279. $1=$2;
  44280. };
  44281. return $1;
  44282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44283. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},globals.MethodLexicalScope)});
  44284. //>>excludeEnd("ctx");
  44285. },
  44286. //>>excludeStart("ide", pragmas.excludeIdeData);
  44287. args: [],
  44288. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  44289. referencedClasses: [],
  44290. //>>excludeEnd("ide");
  44291. messageSends: ["ifNil:"]
  44292. }),
  44293. globals.MethodLexicalScope);
  44294. smalltalk.addMethod(
  44295. smalltalk.method({
  44296. selector: "localReturn:",
  44297. protocol: 'accessing',
  44298. fn: function (aBoolean){
  44299. var self=this;
  44300. self["@localReturn"]=aBoolean;
  44301. return self;
  44302. },
  44303. //>>excludeStart("ide", pragmas.excludeIdeData);
  44304. args: ["aBoolean"],
  44305. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  44306. referencedClasses: [],
  44307. //>>excludeEnd("ide");
  44308. messageSends: []
  44309. }),
  44310. globals.MethodLexicalScope);
  44311. smalltalk.addMethod(
  44312. smalltalk.method({
  44313. selector: "methodScope",
  44314. protocol: 'accessing',
  44315. fn: function (){
  44316. var self=this;
  44317. return self;
  44318. },
  44319. //>>excludeStart("ide", pragmas.excludeIdeData);
  44320. args: [],
  44321. source: "methodScope\x0a\x09^ self",
  44322. referencedClasses: [],
  44323. //>>excludeEnd("ide");
  44324. messageSends: []
  44325. }),
  44326. globals.MethodLexicalScope);
  44327. smalltalk.addMethod(
  44328. smalltalk.method({
  44329. selector: "nonLocalReturns",
  44330. protocol: 'accessing',
  44331. fn: function (){
  44332. var self=this;
  44333. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44335. return smalltalk.withContext(function($ctx1) {
  44336. //>>excludeEnd("ctx");
  44337. var $2,$1,$receiver;
  44338. $2=self["@nonLocalReturns"];
  44339. if(($receiver = $2) == null || $receiver.isNil){
  44340. self["@nonLocalReturns"]=_st($OrderedCollection())._new();
  44341. $1=self["@nonLocalReturns"];
  44342. } else {
  44343. $1=$2;
  44344. };
  44345. return $1;
  44346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44347. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},globals.MethodLexicalScope)});
  44348. //>>excludeEnd("ctx");
  44349. },
  44350. //>>excludeStart("ide", pragmas.excludeIdeData);
  44351. args: [],
  44352. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  44353. referencedClasses: ["OrderedCollection"],
  44354. //>>excludeEnd("ide");
  44355. messageSends: ["ifNil:", "new"]
  44356. }),
  44357. globals.MethodLexicalScope);
  44358. smalltalk.addMethod(
  44359. smalltalk.method({
  44360. selector: "pseudoVars",
  44361. protocol: 'accessing',
  44362. fn: function (){
  44363. var self=this;
  44364. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44365. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  44366. function $PseudoVar(){return globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  44367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44368. return smalltalk.withContext(function($ctx1) {
  44369. //>>excludeEnd("ctx");
  44370. var $1,$2,$3,$4,$receiver;
  44371. $1=self["@pseudoVars"];
  44372. if(($receiver = $1) == null || $receiver.isNil){
  44373. self["@pseudoVars"]=_st($Dictionary())._new();
  44374. self["@pseudoVars"];
  44375. _st(_st($Smalltalk())._pseudoVariableNames())._do_((function(each){
  44376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44377. return smalltalk.withContext(function($ctx2) {
  44378. //>>excludeEnd("ctx");
  44379. $2=_st($PseudoVar())._on_(each);
  44380. _st($2)._scope_(self._methodScope());
  44381. $3=_st($2)._yourself();
  44382. return _st(self["@pseudoVars"])._at_put_(each,$3);
  44383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44385. //>>excludeEnd("ctx");
  44386. }));
  44387. } else {
  44388. $1;
  44389. };
  44390. $4=self["@pseudoVars"];
  44391. return $4;
  44392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44393. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.MethodLexicalScope)});
  44394. //>>excludeEnd("ctx");
  44395. },
  44396. //>>excludeStart("ide", pragmas.excludeIdeData);
  44397. args: [],
  44398. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
  44399. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  44400. //>>excludeEnd("ide");
  44401. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  44402. }),
  44403. globals.MethodLexicalScope);
  44404. smalltalk.addMethod(
  44405. smalltalk.method({
  44406. selector: "removeNonLocalReturn:",
  44407. protocol: 'adding',
  44408. fn: function (aScope){
  44409. var self=this;
  44410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44411. return smalltalk.withContext(function($ctx1) {
  44412. //>>excludeEnd("ctx");
  44413. _st(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  44414. }));
  44415. return self;
  44416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44417. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)});
  44418. //>>excludeEnd("ctx");
  44419. },
  44420. //>>excludeStart("ide", pragmas.excludeIdeData);
  44421. args: ["aScope"],
  44422. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  44423. referencedClasses: [],
  44424. //>>excludeEnd("ide");
  44425. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  44426. }),
  44427. globals.MethodLexicalScope);
  44428. smalltalk.addMethod(
  44429. smalltalk.method({
  44430. selector: "unknownVariables",
  44431. protocol: 'accessing',
  44432. fn: function (){
  44433. var self=this;
  44434. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44436. return smalltalk.withContext(function($ctx1) {
  44437. //>>excludeEnd("ctx");
  44438. var $2,$1,$receiver;
  44439. $2=self["@unknownVariables"];
  44440. if(($receiver = $2) == null || $receiver.isNil){
  44441. self["@unknownVariables"]=_st($OrderedCollection())._new();
  44442. $1=self["@unknownVariables"];
  44443. } else {
  44444. $1=$2;
  44445. };
  44446. return $1;
  44447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44448. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},globals.MethodLexicalScope)});
  44449. //>>excludeEnd("ctx");
  44450. },
  44451. //>>excludeStart("ide", pragmas.excludeIdeData);
  44452. args: [],
  44453. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  44454. referencedClasses: ["OrderedCollection"],
  44455. //>>excludeEnd("ide");
  44456. messageSends: ["ifNil:", "new"]
  44457. }),
  44458. globals.MethodLexicalScope);
  44459. smalltalk.addClass('ScopeVar', globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  44460. //>>excludeStart("ide", pragmas.excludeIdeData);
  44461. globals.ScopeVar.comment="I am an entry in a LexicalScope that gets associated with variable nodes of the same name.\x0aThere are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars.";
  44462. //>>excludeEnd("ide");
  44463. smalltalk.addMethod(
  44464. smalltalk.method({
  44465. selector: "alias",
  44466. protocol: 'accessing',
  44467. fn: function (){
  44468. var self=this;
  44469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44470. return smalltalk.withContext(function($ctx1) {
  44471. //>>excludeEnd("ctx");
  44472. var $1;
  44473. $1=_st(self._name())._asVariableName();
  44474. return $1;
  44475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44476. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ScopeVar)});
  44477. //>>excludeEnd("ctx");
  44478. },
  44479. //>>excludeStart("ide", pragmas.excludeIdeData);
  44480. args: [],
  44481. source: "alias\x0a\x09^ self name asVariableName",
  44482. referencedClasses: [],
  44483. //>>excludeEnd("ide");
  44484. messageSends: ["asVariableName", "name"]
  44485. }),
  44486. globals.ScopeVar);
  44487. smalltalk.addMethod(
  44488. smalltalk.method({
  44489. selector: "isArgVar",
  44490. protocol: 'testing',
  44491. fn: function (){
  44492. var self=this;
  44493. return false;
  44494. },
  44495. //>>excludeStart("ide", pragmas.excludeIdeData);
  44496. args: [],
  44497. source: "isArgVar\x0a\x09^ false",
  44498. referencedClasses: [],
  44499. //>>excludeEnd("ide");
  44500. messageSends: []
  44501. }),
  44502. globals.ScopeVar);
  44503. smalltalk.addMethod(
  44504. smalltalk.method({
  44505. selector: "isClassRefVar",
  44506. protocol: 'testing',
  44507. fn: function (){
  44508. var self=this;
  44509. return false;
  44510. },
  44511. //>>excludeStart("ide", pragmas.excludeIdeData);
  44512. args: [],
  44513. source: "isClassRefVar\x0a\x09^ false",
  44514. referencedClasses: [],
  44515. //>>excludeEnd("ide");
  44516. messageSends: []
  44517. }),
  44518. globals.ScopeVar);
  44519. smalltalk.addMethod(
  44520. smalltalk.method({
  44521. selector: "isImmutable",
  44522. protocol: 'testing',
  44523. fn: function (){
  44524. var self=this;
  44525. return false;
  44526. },
  44527. //>>excludeStart("ide", pragmas.excludeIdeData);
  44528. args: [],
  44529. source: "isImmutable\x0a\x09^ false",
  44530. referencedClasses: [],
  44531. //>>excludeEnd("ide");
  44532. messageSends: []
  44533. }),
  44534. globals.ScopeVar);
  44535. smalltalk.addMethod(
  44536. smalltalk.method({
  44537. selector: "isInstanceVar",
  44538. protocol: 'testing',
  44539. fn: function (){
  44540. var self=this;
  44541. return false;
  44542. },
  44543. //>>excludeStart("ide", pragmas.excludeIdeData);
  44544. args: [],
  44545. source: "isInstanceVar\x0a\x09^ false",
  44546. referencedClasses: [],
  44547. //>>excludeEnd("ide");
  44548. messageSends: []
  44549. }),
  44550. globals.ScopeVar);
  44551. smalltalk.addMethod(
  44552. smalltalk.method({
  44553. selector: "isPseudoVar",
  44554. protocol: 'testing',
  44555. fn: function (){
  44556. var self=this;
  44557. return false;
  44558. },
  44559. //>>excludeStart("ide", pragmas.excludeIdeData);
  44560. args: [],
  44561. source: "isPseudoVar\x0a\x09^ false",
  44562. referencedClasses: [],
  44563. //>>excludeEnd("ide");
  44564. messageSends: []
  44565. }),
  44566. globals.ScopeVar);
  44567. smalltalk.addMethod(
  44568. smalltalk.method({
  44569. selector: "isTempVar",
  44570. protocol: 'testing',
  44571. fn: function (){
  44572. var self=this;
  44573. return false;
  44574. },
  44575. //>>excludeStart("ide", pragmas.excludeIdeData);
  44576. args: [],
  44577. source: "isTempVar\x0a\x09^ false",
  44578. referencedClasses: [],
  44579. //>>excludeEnd("ide");
  44580. messageSends: []
  44581. }),
  44582. globals.ScopeVar);
  44583. smalltalk.addMethod(
  44584. smalltalk.method({
  44585. selector: "isUnknownVar",
  44586. protocol: 'testing',
  44587. fn: function (){
  44588. var self=this;
  44589. return false;
  44590. },
  44591. //>>excludeStart("ide", pragmas.excludeIdeData);
  44592. args: [],
  44593. source: "isUnknownVar\x0a\x09^ false",
  44594. referencedClasses: [],
  44595. //>>excludeEnd("ide");
  44596. messageSends: []
  44597. }),
  44598. globals.ScopeVar);
  44599. smalltalk.addMethod(
  44600. smalltalk.method({
  44601. selector: "name",
  44602. protocol: 'accessing',
  44603. fn: function (){
  44604. var self=this;
  44605. var $1;
  44606. $1=self["@name"];
  44607. return $1;
  44608. },
  44609. //>>excludeStart("ide", pragmas.excludeIdeData);
  44610. args: [],
  44611. source: "name\x0a\x09^ name",
  44612. referencedClasses: [],
  44613. //>>excludeEnd("ide");
  44614. messageSends: []
  44615. }),
  44616. globals.ScopeVar);
  44617. smalltalk.addMethod(
  44618. smalltalk.method({
  44619. selector: "name:",
  44620. protocol: 'accessing',
  44621. fn: function (aString){
  44622. var self=this;
  44623. self["@name"]=aString;
  44624. return self;
  44625. },
  44626. //>>excludeStart("ide", pragmas.excludeIdeData);
  44627. args: ["aString"],
  44628. source: "name: aString\x0a\x09name := aString",
  44629. referencedClasses: [],
  44630. //>>excludeEnd("ide");
  44631. messageSends: []
  44632. }),
  44633. globals.ScopeVar);
  44634. smalltalk.addMethod(
  44635. smalltalk.method({
  44636. selector: "scope",
  44637. protocol: 'accessing',
  44638. fn: function (){
  44639. var self=this;
  44640. var $1;
  44641. $1=self["@scope"];
  44642. return $1;
  44643. },
  44644. //>>excludeStart("ide", pragmas.excludeIdeData);
  44645. args: [],
  44646. source: "scope\x0a\x09^ scope",
  44647. referencedClasses: [],
  44648. //>>excludeEnd("ide");
  44649. messageSends: []
  44650. }),
  44651. globals.ScopeVar);
  44652. smalltalk.addMethod(
  44653. smalltalk.method({
  44654. selector: "scope:",
  44655. protocol: 'accessing',
  44656. fn: function (aScope){
  44657. var self=this;
  44658. self["@scope"]=aScope;
  44659. return self;
  44660. },
  44661. //>>excludeStart("ide", pragmas.excludeIdeData);
  44662. args: ["aScope"],
  44663. source: "scope: aScope\x0a\x09scope := aScope",
  44664. referencedClasses: [],
  44665. //>>excludeEnd("ide");
  44666. messageSends: []
  44667. }),
  44668. globals.ScopeVar);
  44669. smalltalk.addMethod(
  44670. smalltalk.method({
  44671. selector: "validateAssignment",
  44672. protocol: 'testing',
  44673. fn: function (){
  44674. var self=this;
  44675. function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  44676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44677. return smalltalk.withContext(function($ctx1) {
  44678. //>>excludeEnd("ctx");
  44679. var $1,$2,$3;
  44680. $1=_st(self._isArgVar())._or_((function(){
  44681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44682. return smalltalk.withContext(function($ctx2) {
  44683. //>>excludeEnd("ctx");
  44684. return self._isPseudoVar();
  44685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44687. //>>excludeEnd("ctx");
  44688. }));
  44689. if(smalltalk.assert($1)){
  44690. $2=_st($InvalidAssignmentError())._new();
  44691. _st($2)._variableName_(self._name());
  44692. $3=_st($2)._signal();
  44693. $3;
  44694. };
  44695. return self;
  44696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44697. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},globals.ScopeVar)});
  44698. //>>excludeEnd("ctx");
  44699. },
  44700. //>>excludeStart("ide", pragmas.excludeIdeData);
  44701. args: [],
  44702. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  44703. referencedClasses: ["InvalidAssignmentError"],
  44704. //>>excludeEnd("ide");
  44705. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  44706. }),
  44707. globals.ScopeVar);
  44708. smalltalk.addMethod(
  44709. smalltalk.method({
  44710. selector: "on:",
  44711. protocol: 'instance creation',
  44712. fn: function (aString){
  44713. var self=this;
  44714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44715. return smalltalk.withContext(function($ctx1) {
  44716. //>>excludeEnd("ctx");
  44717. var $2,$3,$1;
  44718. $2=self._new();
  44719. _st($2)._name_(aString);
  44720. $3=_st($2)._yourself();
  44721. $1=$3;
  44722. return $1;
  44723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44724. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},globals.ScopeVar.klass)});
  44725. //>>excludeEnd("ctx");
  44726. },
  44727. //>>excludeStart("ide", pragmas.excludeIdeData);
  44728. args: ["aString"],
  44729. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  44730. referencedClasses: [],
  44731. //>>excludeEnd("ide");
  44732. messageSends: ["name:", "new", "yourself"]
  44733. }),
  44734. globals.ScopeVar.klass);
  44735. smalltalk.addClass('AliasVar', globals.ScopeVar, ['node'], 'Compiler-Semantic');
  44736. //>>excludeStart("ide", pragmas.excludeIdeData);
  44737. globals.AliasVar.comment="I am an internally defined variable by the compiler";
  44738. //>>excludeEnd("ide");
  44739. smalltalk.addMethod(
  44740. smalltalk.method({
  44741. selector: "node",
  44742. protocol: 'accessing',
  44743. fn: function (){
  44744. var self=this;
  44745. var $1;
  44746. $1=self["@node"];
  44747. return $1;
  44748. },
  44749. //>>excludeStart("ide", pragmas.excludeIdeData);
  44750. args: [],
  44751. source: "node\x0a\x09^ node",
  44752. referencedClasses: [],
  44753. //>>excludeEnd("ide");
  44754. messageSends: []
  44755. }),
  44756. globals.AliasVar);
  44757. smalltalk.addMethod(
  44758. smalltalk.method({
  44759. selector: "node:",
  44760. protocol: 'accessing',
  44761. fn: function (aNode){
  44762. var self=this;
  44763. self["@node"]=aNode;
  44764. return self;
  44765. },
  44766. //>>excludeStart("ide", pragmas.excludeIdeData);
  44767. args: ["aNode"],
  44768. source: "node: aNode\x0a\x09node := aNode",
  44769. referencedClasses: [],
  44770. //>>excludeEnd("ide");
  44771. messageSends: []
  44772. }),
  44773. globals.AliasVar);
  44774. smalltalk.addClass('ArgVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44775. //>>excludeStart("ide", pragmas.excludeIdeData);
  44776. globals.ArgVar.comment="I am an argument of a method or block.";
  44777. //>>excludeEnd("ide");
  44778. smalltalk.addMethod(
  44779. smalltalk.method({
  44780. selector: "isArgVar",
  44781. protocol: 'testing',
  44782. fn: function (){
  44783. var self=this;
  44784. return true;
  44785. },
  44786. //>>excludeStart("ide", pragmas.excludeIdeData);
  44787. args: [],
  44788. source: "isArgVar\x0a\x09^ true",
  44789. referencedClasses: [],
  44790. //>>excludeEnd("ide");
  44791. messageSends: []
  44792. }),
  44793. globals.ArgVar);
  44794. smalltalk.addMethod(
  44795. smalltalk.method({
  44796. selector: "isImmutable",
  44797. protocol: 'testing',
  44798. fn: function (){
  44799. var self=this;
  44800. return true;
  44801. },
  44802. //>>excludeStart("ide", pragmas.excludeIdeData);
  44803. args: [],
  44804. source: "isImmutable\x0a\x09^ true",
  44805. referencedClasses: [],
  44806. //>>excludeEnd("ide");
  44807. messageSends: []
  44808. }),
  44809. globals.ArgVar);
  44810. smalltalk.addClass('ClassRefVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44811. //>>excludeStart("ide", pragmas.excludeIdeData);
  44812. globals.ClassRefVar.comment="I am an class reference variable";
  44813. //>>excludeEnd("ide");
  44814. smalltalk.addMethod(
  44815. smalltalk.method({
  44816. selector: "alias",
  44817. protocol: 'accessing',
  44818. fn: function (){
  44819. var self=this;
  44820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44821. return smalltalk.withContext(function($ctx1) {
  44822. //>>excludeEnd("ctx");
  44823. var $1;
  44824. $1=_st("$".__comma(self._name())).__comma("()");
  44825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44826. $ctx1.sendIdx[","]=1;
  44827. //>>excludeEnd("ctx");
  44828. return $1;
  44829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44830. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ClassRefVar)});
  44831. //>>excludeEnd("ctx");
  44832. },
  44833. //>>excludeStart("ide", pragmas.excludeIdeData);
  44834. args: [],
  44835. source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$', self name, '()'",
  44836. referencedClasses: [],
  44837. //>>excludeEnd("ide");
  44838. messageSends: [",", "name"]
  44839. }),
  44840. globals.ClassRefVar);
  44841. smalltalk.addMethod(
  44842. smalltalk.method({
  44843. selector: "isClassRefVar",
  44844. protocol: 'testing',
  44845. fn: function (){
  44846. var self=this;
  44847. return true;
  44848. },
  44849. //>>excludeStart("ide", pragmas.excludeIdeData);
  44850. args: [],
  44851. source: "isClassRefVar\x0a\x09^ true",
  44852. referencedClasses: [],
  44853. //>>excludeEnd("ide");
  44854. messageSends: []
  44855. }),
  44856. globals.ClassRefVar);
  44857. smalltalk.addMethod(
  44858. smalltalk.method({
  44859. selector: "isImmutable",
  44860. protocol: 'testing',
  44861. fn: function (){
  44862. var self=this;
  44863. return true;
  44864. },
  44865. //>>excludeStart("ide", pragmas.excludeIdeData);
  44866. args: [],
  44867. source: "isImmutable\x0a\x09^ true",
  44868. referencedClasses: [],
  44869. //>>excludeEnd("ide");
  44870. messageSends: []
  44871. }),
  44872. globals.ClassRefVar);
  44873. smalltalk.addClass('InstanceVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44874. //>>excludeStart("ide", pragmas.excludeIdeData);
  44875. globals.InstanceVar.comment="I am an instance variable of a method or block.";
  44876. //>>excludeEnd("ide");
  44877. smalltalk.addMethod(
  44878. smalltalk.method({
  44879. selector: "alias",
  44880. protocol: 'testing',
  44881. fn: function (){
  44882. var self=this;
  44883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44884. return smalltalk.withContext(function($ctx1) {
  44885. //>>excludeEnd("ctx");
  44886. var $1;
  44887. $1=_st("self[\x22@".__comma(self._name())).__comma("\x22]");
  44888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44889. $ctx1.sendIdx[","]=1;
  44890. //>>excludeEnd("ctx");
  44891. return $1;
  44892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44893. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.InstanceVar)});
  44894. //>>excludeEnd("ctx");
  44895. },
  44896. //>>excludeStart("ide", pragmas.excludeIdeData);
  44897. args: [],
  44898. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  44899. referencedClasses: [],
  44900. //>>excludeEnd("ide");
  44901. messageSends: [",", "name"]
  44902. }),
  44903. globals.InstanceVar);
  44904. smalltalk.addMethod(
  44905. smalltalk.method({
  44906. selector: "isInstanceVar",
  44907. protocol: 'testing',
  44908. fn: function (){
  44909. var self=this;
  44910. return true;
  44911. },
  44912. //>>excludeStart("ide", pragmas.excludeIdeData);
  44913. args: [],
  44914. source: "isInstanceVar\x0a\x09^ true",
  44915. referencedClasses: [],
  44916. //>>excludeEnd("ide");
  44917. messageSends: []
  44918. }),
  44919. globals.InstanceVar);
  44920. smalltalk.addClass('PseudoVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44921. //>>excludeStart("ide", pragmas.excludeIdeData);
  44922. globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  44923. //>>excludeEnd("ide");
  44924. smalltalk.addMethod(
  44925. smalltalk.method({
  44926. selector: "alias",
  44927. protocol: 'accessing',
  44928. fn: function (){
  44929. var self=this;
  44930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44931. return smalltalk.withContext(function($ctx1) {
  44932. //>>excludeEnd("ctx");
  44933. var $1;
  44934. $1=self._name();
  44935. return $1;
  44936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44937. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.PseudoVar)});
  44938. //>>excludeEnd("ctx");
  44939. },
  44940. //>>excludeStart("ide", pragmas.excludeIdeData);
  44941. args: [],
  44942. source: "alias\x0a\x09^ self name",
  44943. referencedClasses: [],
  44944. //>>excludeEnd("ide");
  44945. messageSends: ["name"]
  44946. }),
  44947. globals.PseudoVar);
  44948. smalltalk.addMethod(
  44949. smalltalk.method({
  44950. selector: "isImmutable",
  44951. protocol: 'testing',
  44952. fn: function (){
  44953. var self=this;
  44954. return true;
  44955. },
  44956. //>>excludeStart("ide", pragmas.excludeIdeData);
  44957. args: [],
  44958. source: "isImmutable\x0a\x09^ true",
  44959. referencedClasses: [],
  44960. //>>excludeEnd("ide");
  44961. messageSends: []
  44962. }),
  44963. globals.PseudoVar);
  44964. smalltalk.addMethod(
  44965. smalltalk.method({
  44966. selector: "isPseudoVar",
  44967. protocol: 'testing',
  44968. fn: function (){
  44969. var self=this;
  44970. return true;
  44971. },
  44972. //>>excludeStart("ide", pragmas.excludeIdeData);
  44973. args: [],
  44974. source: "isPseudoVar\x0a\x09^ true",
  44975. referencedClasses: [],
  44976. //>>excludeEnd("ide");
  44977. messageSends: []
  44978. }),
  44979. globals.PseudoVar);
  44980. smalltalk.addClass('TempVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44981. //>>excludeStart("ide", pragmas.excludeIdeData);
  44982. globals.TempVar.comment="I am an temporary variable of a method or block.";
  44983. //>>excludeEnd("ide");
  44984. smalltalk.addMethod(
  44985. smalltalk.method({
  44986. selector: "isTempVar",
  44987. protocol: 'testing',
  44988. fn: function (){
  44989. var self=this;
  44990. return true;
  44991. },
  44992. //>>excludeStart("ide", pragmas.excludeIdeData);
  44993. args: [],
  44994. source: "isTempVar\x0a\x09^ true",
  44995. referencedClasses: [],
  44996. //>>excludeEnd("ide");
  44997. messageSends: []
  44998. }),
  44999. globals.TempVar);
  45000. smalltalk.addClass('UnknownVar', globals.ScopeVar, [], 'Compiler-Semantic');
  45001. //>>excludeStart("ide", pragmas.excludeIdeData);
  45002. globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  45003. //>>excludeEnd("ide");
  45004. smalltalk.addMethod(
  45005. smalltalk.method({
  45006. selector: "isUnknownVar",
  45007. protocol: 'testing',
  45008. fn: function (){
  45009. var self=this;
  45010. return true;
  45011. },
  45012. //>>excludeStart("ide", pragmas.excludeIdeData);
  45013. args: [],
  45014. source: "isUnknownVar\x0a\x09^ true",
  45015. referencedClasses: [],
  45016. //>>excludeEnd("ide");
  45017. messageSends: []
  45018. }),
  45019. globals.UnknownVar);
  45020. smalltalk.addClass('SemanticAnalyzer', globals.NodeVisitor, ['currentScope', 'blockIndex', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  45021. //>>excludeStart("ide", pragmas.excludeIdeData);
  45022. globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  45023. //>>excludeEnd("ide");
  45024. smalltalk.addMethod(
  45025. smalltalk.method({
  45026. selector: "classReferences",
  45027. protocol: 'accessing',
  45028. fn: function (){
  45029. var self=this;
  45030. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  45031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45032. return smalltalk.withContext(function($ctx1) {
  45033. //>>excludeEnd("ctx");
  45034. var $2,$1,$receiver;
  45035. $2=self["@classReferences"];
  45036. if(($receiver = $2) == null || $receiver.isNil){
  45037. self["@classReferences"]=_st($Set())._new();
  45038. $1=self["@classReferences"];
  45039. } else {
  45040. $1=$2;
  45041. };
  45042. return $1;
  45043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45044. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},globals.SemanticAnalyzer)});
  45045. //>>excludeEnd("ctx");
  45046. },
  45047. //>>excludeStart("ide", pragmas.excludeIdeData);
  45048. args: [],
  45049. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  45050. referencedClasses: ["Set"],
  45051. //>>excludeEnd("ide");
  45052. messageSends: ["ifNil:", "new"]
  45053. }),
  45054. globals.SemanticAnalyzer);
  45055. smalltalk.addMethod(
  45056. smalltalk.method({
  45057. selector: "errorShadowingVariable:",
  45058. protocol: 'error handling',
  45059. fn: function (aString){
  45060. var self=this;
  45061. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  45062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45063. return smalltalk.withContext(function($ctx1) {
  45064. //>>excludeEnd("ctx");
  45065. var $1,$2;
  45066. $1=_st($ShadowingVariableError())._new();
  45067. _st($1)._variableName_(aString);
  45068. $2=_st($1)._signal();
  45069. return self;
  45070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45071. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},globals.SemanticAnalyzer)});
  45072. //>>excludeEnd("ctx");
  45073. },
  45074. //>>excludeStart("ide", pragmas.excludeIdeData);
  45075. args: ["aString"],
  45076. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  45077. referencedClasses: ["ShadowingVariableError"],
  45078. //>>excludeEnd("ide");
  45079. messageSends: ["variableName:", "new", "signal"]
  45080. }),
  45081. globals.SemanticAnalyzer);
  45082. smalltalk.addMethod(
  45083. smalltalk.method({
  45084. selector: "errorUnknownVariable:",
  45085. protocol: 'error handling',
  45086. fn: function (aNode){
  45087. var self=this;
  45088. var identifier;
  45089. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  45090. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  45091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45092. return smalltalk.withContext(function($ctx1) {
  45093. //>>excludeEnd("ctx");
  45094. var $1,$2,$3,$4,$5;
  45095. identifier=_st(aNode)._value();
  45096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45097. $ctx1.sendIdx["value"]=1;
  45098. //>>excludeEnd("ctx");
  45099. $1=_st(_st(_st(_st($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  45100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45101. return smalltalk.withContext(function($ctx2) {
  45102. //>>excludeEnd("ctx");
  45103. return self._isVariableGloballyUndefined_(identifier);
  45104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45106. //>>excludeEnd("ctx");
  45107. }));
  45108. if(smalltalk.assert($1)){
  45109. $2=_st($UnknownVariableError())._new();
  45110. $3=$2;
  45111. $4=_st(aNode)._value();
  45112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45113. $ctx1.sendIdx["value"]=2;
  45114. //>>excludeEnd("ctx");
  45115. _st($3)._variableName_($4);
  45116. $5=_st($2)._signal();
  45117. $5;
  45118. } else {
  45119. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  45120. };
  45121. return self;
  45122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45123. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},globals.SemanticAnalyzer)});
  45124. //>>excludeEnd("ctx");
  45125. },
  45126. //>>excludeStart("ide", pragmas.excludeIdeData);
  45127. args: ["aNode"],
  45128. source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `jQuery`, `window`, `document`, `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableGloballyUndefined: identifier ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
  45129. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  45130. //>>excludeEnd("ide");
  45131. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  45132. }),
  45133. globals.SemanticAnalyzer);
  45134. smalltalk.addMethod(
  45135. smalltalk.method({
  45136. selector: "isVariableGloballyUndefined:",
  45137. protocol: 'testing',
  45138. fn: function (aString){
  45139. var self=this;
  45140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45141. return smalltalk.withContext(function($ctx1) {
  45142. //>>excludeEnd("ctx");
  45143. return eval('typeof ' + aString + ' == "undefined"');
  45144. return self;
  45145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45146. }, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},globals.SemanticAnalyzer)});
  45147. //>>excludeEnd("ctx");
  45148. },
  45149. //>>excludeStart("ide", pragmas.excludeIdeData);
  45150. args: ["aString"],
  45151. source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
  45152. referencedClasses: [],
  45153. //>>excludeEnd("ide");
  45154. messageSends: []
  45155. }),
  45156. globals.SemanticAnalyzer);
  45157. smalltalk.addMethod(
  45158. smalltalk.method({
  45159. selector: "messageSends",
  45160. protocol: 'accessing',
  45161. fn: function (){
  45162. var self=this;
  45163. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  45164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45165. return smalltalk.withContext(function($ctx1) {
  45166. //>>excludeEnd("ctx");
  45167. var $2,$1,$receiver;
  45168. $2=self["@messageSends"];
  45169. if(($receiver = $2) == null || $receiver.isNil){
  45170. self["@messageSends"]=_st($Dictionary())._new();
  45171. $1=self["@messageSends"];
  45172. } else {
  45173. $1=$2;
  45174. };
  45175. return $1;
  45176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45177. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.SemanticAnalyzer)});
  45178. //>>excludeEnd("ctx");
  45179. },
  45180. //>>excludeStart("ide", pragmas.excludeIdeData);
  45181. args: [],
  45182. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  45183. referencedClasses: ["Dictionary"],
  45184. //>>excludeEnd("ide");
  45185. messageSends: ["ifNil:", "new"]
  45186. }),
  45187. globals.SemanticAnalyzer);
  45188. smalltalk.addMethod(
  45189. smalltalk.method({
  45190. selector: "newBlockScope",
  45191. protocol: 'factory',
  45192. fn: function (){
  45193. var self=this;
  45194. function $LexicalScope(){return globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  45195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45196. return smalltalk.withContext(function($ctx1) {
  45197. //>>excludeEnd("ctx");
  45198. var $1;
  45199. $1=self._newScopeOfClass_($LexicalScope());
  45200. return $1;
  45201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45202. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},globals.SemanticAnalyzer)});
  45203. //>>excludeEnd("ctx");
  45204. },
  45205. //>>excludeStart("ide", pragmas.excludeIdeData);
  45206. args: [],
  45207. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  45208. referencedClasses: ["LexicalScope"],
  45209. //>>excludeEnd("ide");
  45210. messageSends: ["newScopeOfClass:"]
  45211. }),
  45212. globals.SemanticAnalyzer);
  45213. smalltalk.addMethod(
  45214. smalltalk.method({
  45215. selector: "newMethodScope",
  45216. protocol: 'factory',
  45217. fn: function (){
  45218. var self=this;
  45219. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  45220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45221. return smalltalk.withContext(function($ctx1) {
  45222. //>>excludeEnd("ctx");
  45223. var $1;
  45224. $1=self._newScopeOfClass_($MethodLexicalScope());
  45225. return $1;
  45226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45227. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},globals.SemanticAnalyzer)});
  45228. //>>excludeEnd("ctx");
  45229. },
  45230. //>>excludeStart("ide", pragmas.excludeIdeData);
  45231. args: [],
  45232. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  45233. referencedClasses: ["MethodLexicalScope"],
  45234. //>>excludeEnd("ide");
  45235. messageSends: ["newScopeOfClass:"]
  45236. }),
  45237. globals.SemanticAnalyzer);
  45238. smalltalk.addMethod(
  45239. smalltalk.method({
  45240. selector: "newScopeOfClass:",
  45241. protocol: 'factory',
  45242. fn: function (aLexicalScopeClass){
  45243. var self=this;
  45244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45245. return smalltalk.withContext(function($ctx1) {
  45246. //>>excludeEnd("ctx");
  45247. var $2,$3,$1;
  45248. $2=_st(aLexicalScopeClass)._new();
  45249. _st($2)._outerScope_(self["@currentScope"]);
  45250. $3=_st($2)._yourself();
  45251. $1=$3;
  45252. return $1;
  45253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45254. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},globals.SemanticAnalyzer)});
  45255. //>>excludeEnd("ctx");
  45256. },
  45257. //>>excludeStart("ide", pragmas.excludeIdeData);
  45258. args: ["aLexicalScopeClass"],
  45259. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  45260. referencedClasses: [],
  45261. //>>excludeEnd("ide");
  45262. messageSends: ["outerScope:", "new", "yourself"]
  45263. }),
  45264. globals.SemanticAnalyzer);
  45265. smalltalk.addMethod(
  45266. smalltalk.method({
  45267. selector: "nextBlockIndex",
  45268. protocol: 'private',
  45269. fn: function (){
  45270. var self=this;
  45271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45272. return smalltalk.withContext(function($ctx1) {
  45273. //>>excludeEnd("ctx");
  45274. var $1,$2,$receiver;
  45275. $1=self["@blockIndex"];
  45276. if(($receiver = $1) == null || $receiver.isNil){
  45277. self["@blockIndex"]=(0);
  45278. self["@blockIndex"];
  45279. } else {
  45280. $1;
  45281. };
  45282. self["@blockIndex"]=_st(self["@blockIndex"]).__plus((1));
  45283. $2=self["@blockIndex"];
  45284. return $2;
  45285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45286. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},globals.SemanticAnalyzer)});
  45287. //>>excludeEnd("ctx");
  45288. },
  45289. //>>excludeStart("ide", pragmas.excludeIdeData);
  45290. args: [],
  45291. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  45292. referencedClasses: [],
  45293. //>>excludeEnd("ide");
  45294. messageSends: ["ifNil:", "+"]
  45295. }),
  45296. globals.SemanticAnalyzer);
  45297. smalltalk.addMethod(
  45298. smalltalk.method({
  45299. selector: "popScope",
  45300. protocol: 'scope',
  45301. fn: function (){
  45302. var self=this;
  45303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45304. return smalltalk.withContext(function($ctx1) {
  45305. //>>excludeEnd("ctx");
  45306. var $1,$receiver;
  45307. $1=self["@currentScope"];
  45308. if(($receiver = $1) == null || $receiver.isNil){
  45309. $1;
  45310. } else {
  45311. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  45312. self["@currentScope"];
  45313. };
  45314. return self;
  45315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45316. }, function($ctx1) {$ctx1.fill(self,"popScope",{},globals.SemanticAnalyzer)});
  45317. //>>excludeEnd("ctx");
  45318. },
  45319. //>>excludeStart("ide", pragmas.excludeIdeData);
  45320. args: [],
  45321. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  45322. referencedClasses: [],
  45323. //>>excludeEnd("ide");
  45324. messageSends: ["ifNotNil:", "outerScope"]
  45325. }),
  45326. globals.SemanticAnalyzer);
  45327. smalltalk.addMethod(
  45328. smalltalk.method({
  45329. selector: "pushScope:",
  45330. protocol: 'scope',
  45331. fn: function (aScope){
  45332. var self=this;
  45333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45334. return smalltalk.withContext(function($ctx1) {
  45335. //>>excludeEnd("ctx");
  45336. _st(aScope)._outerScope_(self["@currentScope"]);
  45337. self["@currentScope"]=aScope;
  45338. return self;
  45339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45340. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},globals.SemanticAnalyzer)});
  45341. //>>excludeEnd("ctx");
  45342. },
  45343. //>>excludeStart("ide", pragmas.excludeIdeData);
  45344. args: ["aScope"],
  45345. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  45346. referencedClasses: [],
  45347. //>>excludeEnd("ide");
  45348. messageSends: ["outerScope:"]
  45349. }),
  45350. globals.SemanticAnalyzer);
  45351. smalltalk.addMethod(
  45352. smalltalk.method({
  45353. selector: "superSends",
  45354. protocol: 'accessing',
  45355. fn: function (){
  45356. var self=this;
  45357. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  45358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45359. return smalltalk.withContext(function($ctx1) {
  45360. //>>excludeEnd("ctx");
  45361. var $2,$1,$receiver;
  45362. $2=self["@superSends"];
  45363. if(($receiver = $2) == null || $receiver.isNil){
  45364. self["@superSends"]=_st($Dictionary())._new();
  45365. $1=self["@superSends"];
  45366. } else {
  45367. $1=$2;
  45368. };
  45369. return $1;
  45370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45371. }, function($ctx1) {$ctx1.fill(self,"superSends",{},globals.SemanticAnalyzer)});
  45372. //>>excludeEnd("ctx");
  45373. },
  45374. //>>excludeStart("ide", pragmas.excludeIdeData);
  45375. args: [],
  45376. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  45377. referencedClasses: ["Dictionary"],
  45378. //>>excludeEnd("ide");
  45379. messageSends: ["ifNil:", "new"]
  45380. }),
  45381. globals.SemanticAnalyzer);
  45382. smalltalk.addMethod(
  45383. smalltalk.method({
  45384. selector: "theClass",
  45385. protocol: 'accessing',
  45386. fn: function (){
  45387. var self=this;
  45388. var $1;
  45389. $1=self["@theClass"];
  45390. return $1;
  45391. },
  45392. //>>excludeStart("ide", pragmas.excludeIdeData);
  45393. args: [],
  45394. source: "theClass\x0a\x09^ theClass",
  45395. referencedClasses: [],
  45396. //>>excludeEnd("ide");
  45397. messageSends: []
  45398. }),
  45399. globals.SemanticAnalyzer);
  45400. smalltalk.addMethod(
  45401. smalltalk.method({
  45402. selector: "theClass:",
  45403. protocol: 'accessing',
  45404. fn: function (aClass){
  45405. var self=this;
  45406. self["@theClass"]=aClass;
  45407. return self;
  45408. },
  45409. //>>excludeStart("ide", pragmas.excludeIdeData);
  45410. args: ["aClass"],
  45411. source: "theClass: aClass\x0a\x09theClass := aClass",
  45412. referencedClasses: [],
  45413. //>>excludeEnd("ide");
  45414. messageSends: []
  45415. }),
  45416. globals.SemanticAnalyzer);
  45417. smalltalk.addMethod(
  45418. smalltalk.method({
  45419. selector: "validateVariableScope:",
  45420. protocol: 'scope',
  45421. fn: function (aString){
  45422. var self=this;
  45423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45424. return smalltalk.withContext(function($ctx1) {
  45425. //>>excludeEnd("ctx");
  45426. var $1,$receiver;
  45427. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  45428. if(($receiver = $1) == null || $receiver.isNil){
  45429. $1;
  45430. } else {
  45431. self._errorShadowingVariable_(aString);
  45432. };
  45433. return self;
  45434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45435. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},globals.SemanticAnalyzer)});
  45436. //>>excludeEnd("ctx");
  45437. },
  45438. //>>excludeStart("ide", pragmas.excludeIdeData);
  45439. args: ["aString"],
  45440. source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]",
  45441. referencedClasses: [],
  45442. //>>excludeEnd("ide");
  45443. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  45444. }),
  45445. globals.SemanticAnalyzer);
  45446. smalltalk.addMethod(
  45447. smalltalk.method({
  45448. selector: "visitAssignmentNode:",
  45449. protocol: 'visiting',
  45450. fn: function (aNode){
  45451. var self=this;
  45452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45453. return smalltalk.withContext(function($ctx1) {
  45454. //>>excludeEnd("ctx");
  45455. (
  45456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45457. $ctx1.supercall = true,
  45458. //>>excludeEnd("ctx");
  45459. globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]));
  45460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45461. $ctx1.supercall = false;
  45462. //>>excludeEnd("ctx");;
  45463. _st(_st(aNode)._left())._beAssigned();
  45464. return self;
  45465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45466. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45467. //>>excludeEnd("ctx");
  45468. },
  45469. //>>excludeStart("ide", pragmas.excludeIdeData);
  45470. args: ["aNode"],
  45471. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  45472. referencedClasses: [],
  45473. //>>excludeEnd("ide");
  45474. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  45475. }),
  45476. globals.SemanticAnalyzer);
  45477. smalltalk.addMethod(
  45478. smalltalk.method({
  45479. selector: "visitBlockNode:",
  45480. protocol: 'visiting',
  45481. fn: function (aNode){
  45482. var self=this;
  45483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45484. return smalltalk.withContext(function($ctx1) {
  45485. //>>excludeEnd("ctx");
  45486. self._pushScope_(self._newBlockScope());
  45487. _st(aNode)._scope_(self["@currentScope"]);
  45488. _st(self["@currentScope"])._node_(aNode);
  45489. _st(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  45490. _st(_st(aNode)._parameters())._do_((function(each){
  45491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45492. return smalltalk.withContext(function($ctx2) {
  45493. //>>excludeEnd("ctx");
  45494. self._validateVariableScope_(each);
  45495. return _st(self["@currentScope"])._addArg_(each);
  45496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45498. //>>excludeEnd("ctx");
  45499. }));
  45500. (
  45501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45502. $ctx1.supercall = true,
  45503. //>>excludeEnd("ctx");
  45504. globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]));
  45505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45506. $ctx1.supercall = false;
  45507. //>>excludeEnd("ctx");;
  45508. self._popScope();
  45509. return self;
  45510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45511. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45512. //>>excludeEnd("ctx");
  45513. },
  45514. //>>excludeStart("ide", pragmas.excludeIdeData);
  45515. args: ["aNode"],
  45516. source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
  45517. referencedClasses: [],
  45518. //>>excludeEnd("ide");
  45519. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  45520. }),
  45521. globals.SemanticAnalyzer);
  45522. smalltalk.addMethod(
  45523. smalltalk.method({
  45524. selector: "visitCascadeNode:",
  45525. protocol: 'visiting',
  45526. fn: function (aNode){
  45527. var self=this;
  45528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45529. return smalltalk.withContext(function($ctx1) {
  45530. //>>excludeEnd("ctx");
  45531. var $3,$2,$1;
  45532. (
  45533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45534. $ctx1.supercall = true,
  45535. //>>excludeEnd("ctx");
  45536. globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]));
  45537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45538. $ctx1.supercall = false;
  45539. //>>excludeEnd("ctx");;
  45540. $3=_st(aNode)._nodes();
  45541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45542. $ctx1.sendIdx["nodes"]=1;
  45543. //>>excludeEnd("ctx");
  45544. $2=_st($3)._first();
  45545. $1=_st($2)._superSend();
  45546. if(smalltalk.assert($1)){
  45547. _st(_st(aNode)._nodes())._do_((function(each){
  45548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45549. return smalltalk.withContext(function($ctx2) {
  45550. //>>excludeEnd("ctx");
  45551. return _st(each)._superSend_(true);
  45552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45554. //>>excludeEnd("ctx");
  45555. }));
  45556. };
  45557. return self;
  45558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45559. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45560. //>>excludeEnd("ctx");
  45561. },
  45562. //>>excludeStart("ide", pragmas.excludeIdeData);
  45563. args: ["aNode"],
  45564. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  45565. referencedClasses: [],
  45566. //>>excludeEnd("ide");
  45567. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
  45568. }),
  45569. globals.SemanticAnalyzer);
  45570. smalltalk.addMethod(
  45571. smalltalk.method({
  45572. selector: "visitMethodNode:",
  45573. protocol: 'visiting',
  45574. fn: function (aNode){
  45575. var self=this;
  45576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45577. return smalltalk.withContext(function($ctx1) {
  45578. //>>excludeEnd("ctx");
  45579. var $1;
  45580. self._pushScope_(self._newMethodScope());
  45581. _st(aNode)._scope_(self["@currentScope"]);
  45582. _st(self["@currentScope"])._node_(aNode);
  45583. _st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
  45584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45585. return smalltalk.withContext(function($ctx2) {
  45586. //>>excludeEnd("ctx");
  45587. return _st(self["@currentScope"])._addIVar_(each);
  45588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45589. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45590. //>>excludeEnd("ctx");
  45591. }));
  45592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45593. $ctx1.sendIdx["do:"]=1;
  45594. //>>excludeEnd("ctx");
  45595. _st(_st(aNode)._arguments())._do_((function(each){
  45596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45597. return smalltalk.withContext(function($ctx2) {
  45598. //>>excludeEnd("ctx");
  45599. self._validateVariableScope_(each);
  45600. return _st(self["@currentScope"])._addArg_(each);
  45601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45603. //>>excludeEnd("ctx");
  45604. }));
  45605. (
  45606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45607. $ctx1.supercall = true,
  45608. //>>excludeEnd("ctx");
  45609. globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]));
  45610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45611. $ctx1.supercall = false;
  45612. //>>excludeEnd("ctx");;
  45613. _st(aNode)._classReferences_(self._classReferences());
  45614. _st(aNode)._sendIndexes_(self._messageSends());
  45615. $1=_st(aNode)._superSends_(_st(self._superSends())._keys());
  45616. self._popScope();
  45617. return self;
  45618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45619. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45620. //>>excludeEnd("ctx");
  45621. },
  45622. //>>excludeStart("ide", pragmas.excludeIdeData);
  45623. args: ["aNode"],
  45624. source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
  45625. referencedClasses: [],
  45626. //>>excludeEnd("ide");
  45627. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
  45628. }),
  45629. globals.SemanticAnalyzer);
  45630. smalltalk.addMethod(
  45631. smalltalk.method({
  45632. selector: "visitReturnNode:",
  45633. protocol: 'visiting',
  45634. fn: function (aNode){
  45635. var self=this;
  45636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45637. return smalltalk.withContext(function($ctx1) {
  45638. //>>excludeEnd("ctx");
  45639. var $1;
  45640. _st(aNode)._scope_(self["@currentScope"]);
  45641. $1=_st(self["@currentScope"])._isMethodScope();
  45642. if(smalltalk.assert($1)){
  45643. _st(self["@currentScope"])._localReturn_(true);
  45644. } else {
  45645. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  45646. };
  45647. (
  45648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45649. $ctx1.supercall = true,
  45650. //>>excludeEnd("ctx");
  45651. globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]));
  45652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45653. $ctx1.supercall = false;
  45654. //>>excludeEnd("ctx");;
  45655. return self;
  45656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45657. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45658. //>>excludeEnd("ctx");
  45659. },
  45660. //>>excludeStart("ide", pragmas.excludeIdeData);
  45661. args: ["aNode"],
  45662. source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
  45663. referencedClasses: [],
  45664. //>>excludeEnd("ide");
  45665. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  45666. }),
  45667. globals.SemanticAnalyzer);
  45668. smalltalk.addMethod(
  45669. smalltalk.method({
  45670. selector: "visitSendNode:",
  45671. protocol: 'visiting',
  45672. fn: function (aNode){
  45673. var self=this;
  45674. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  45675. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  45676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45677. return smalltalk.withContext(function($ctx1) {
  45678. //>>excludeEnd("ctx");
  45679. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  45680. $3=_st(aNode)._receiver();
  45681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45682. $ctx1.sendIdx["receiver"]=1;
  45683. //>>excludeEnd("ctx");
  45684. $2=_st($3)._value();
  45685. $1=_st($2).__eq("super");
  45686. if(smalltalk.assert($1)){
  45687. _st(aNode)._superSend_(true);
  45688. $4=_st(aNode)._receiver();
  45689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45690. $ctx1.sendIdx["receiver"]=2;
  45691. //>>excludeEnd("ctx");
  45692. _st($4)._value_("self");
  45693. $5=self._superSends();
  45694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45695. $ctx1.sendIdx["superSends"]=1;
  45696. //>>excludeEnd("ctx");
  45697. $6=_st(aNode)._selector();
  45698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45699. $ctx1.sendIdx["selector"]=1;
  45700. //>>excludeEnd("ctx");
  45701. _st($5)._at_ifAbsentPut_($6,(function(){
  45702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45703. return smalltalk.withContext(function($ctx2) {
  45704. //>>excludeEnd("ctx");
  45705. return _st($Set())._new();
  45706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45707. $ctx2.sendIdx["new"]=1;
  45708. //>>excludeEnd("ctx");
  45709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45711. //>>excludeEnd("ctx");
  45712. }));
  45713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45714. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  45715. //>>excludeEnd("ctx");
  45716. $8=self._superSends();
  45717. $9=_st(aNode)._selector();
  45718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45719. $ctx1.sendIdx["selector"]=2;
  45720. //>>excludeEnd("ctx");
  45721. $7=_st($8)._at_($9);
  45722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45723. $ctx1.sendIdx["at:"]=1;
  45724. //>>excludeEnd("ctx");
  45725. _st($7)._add_(aNode);
  45726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45727. $ctx1.sendIdx["add:"]=1;
  45728. //>>excludeEnd("ctx");
  45729. } else {
  45730. $11=_st($IRSendInliner())._inlinedSelectors();
  45731. $12=_st(aNode)._selector();
  45732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45733. $ctx1.sendIdx["selector"]=3;
  45734. //>>excludeEnd("ctx");
  45735. $10=_st($11)._includes_($12);
  45736. if(smalltalk.assert($10)){
  45737. _st(aNode)._shouldBeInlined_(true);
  45738. $13=_st(aNode)._receiver();
  45739. if(($receiver = $13) == null || $receiver.isNil){
  45740. $13;
  45741. } else {
  45742. var receiver;
  45743. receiver=$receiver;
  45744. _st(receiver)._shouldBeAliased_(true);
  45745. };
  45746. };
  45747. };
  45748. $14=self._messageSends();
  45749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45750. $ctx1.sendIdx["messageSends"]=1;
  45751. //>>excludeEnd("ctx");
  45752. $15=_st(aNode)._selector();
  45753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45754. $ctx1.sendIdx["selector"]=4;
  45755. //>>excludeEnd("ctx");
  45756. _st($14)._at_ifAbsentPut_($15,(function(){
  45757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45758. return smalltalk.withContext(function($ctx2) {
  45759. //>>excludeEnd("ctx");
  45760. return _st($Set())._new();
  45761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  45763. //>>excludeEnd("ctx");
  45764. }));
  45765. $17=self._messageSends();
  45766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45767. $ctx1.sendIdx["messageSends"]=2;
  45768. //>>excludeEnd("ctx");
  45769. $18=_st(aNode)._selector();
  45770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45771. $ctx1.sendIdx["selector"]=5;
  45772. //>>excludeEnd("ctx");
  45773. $16=_st($17)._at_($18);
  45774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45775. $ctx1.sendIdx["at:"]=2;
  45776. //>>excludeEnd("ctx");
  45777. _st($16)._add_(aNode);
  45778. _st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
  45779. (
  45780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45781. $ctx1.supercall = true,
  45782. //>>excludeEnd("ctx");
  45783. globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]));
  45784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45785. $ctx1.supercall = false;
  45786. //>>excludeEnd("ctx");;
  45787. return self;
  45788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45789. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45790. //>>excludeEnd("ctx");
  45791. },
  45792. //>>excludeStart("ide", pragmas.excludeIdeData);
  45793. args: ["aNode"],
  45794. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  45795. referencedClasses: ["Set", "IRSendInliner"],
  45796. //>>excludeEnd("ide");
  45797. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
  45798. }),
  45799. globals.SemanticAnalyzer);
  45800. smalltalk.addMethod(
  45801. smalltalk.method({
  45802. selector: "visitSequenceNode:",
  45803. protocol: 'visiting',
  45804. fn: function (aNode){
  45805. var self=this;
  45806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45807. return smalltalk.withContext(function($ctx1) {
  45808. //>>excludeEnd("ctx");
  45809. _st(_st(aNode)._temps())._do_((function(each){
  45810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45811. return smalltalk.withContext(function($ctx2) {
  45812. //>>excludeEnd("ctx");
  45813. self._validateVariableScope_(each);
  45814. return _st(self["@currentScope"])._addTemp_(each);
  45815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45817. //>>excludeEnd("ctx");
  45818. }));
  45819. (
  45820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45821. $ctx1.supercall = true,
  45822. //>>excludeEnd("ctx");
  45823. globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]));
  45824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45825. $ctx1.supercall = false;
  45826. //>>excludeEnd("ctx");;
  45827. return self;
  45828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45829. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45830. //>>excludeEnd("ctx");
  45831. },
  45832. //>>excludeStart("ide", pragmas.excludeIdeData);
  45833. args: ["aNode"],
  45834. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  45835. referencedClasses: [],
  45836. //>>excludeEnd("ide");
  45837. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  45838. }),
  45839. globals.SemanticAnalyzer);
  45840. smalltalk.addMethod(
  45841. smalltalk.method({
  45842. selector: "visitVariableNode:",
  45843. protocol: 'visiting',
  45844. fn: function (aNode){
  45845. var self=this;
  45846. var binding;
  45847. function $ClassRefVar(){return globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  45848. function $UnknownVar(){return globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  45849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45850. return smalltalk.withContext(function($ctx1) {
  45851. //>>excludeEnd("ctx");
  45852. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  45853. binding=_st(self["@currentScope"])._lookupVariable_(aNode);
  45854. $1=binding;
  45855. if(($receiver = $1) == null || $receiver.isNil){
  45856. $3=_st(aNode)._value();
  45857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45858. $ctx1.sendIdx["value"]=1;
  45859. //>>excludeEnd("ctx");
  45860. $2=_st($3)._isCapitalized();
  45861. if(smalltalk.assert($2)){
  45862. $4=_st($ClassRefVar())._new();
  45863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45864. $ctx1.sendIdx["new"]=1;
  45865. //>>excludeEnd("ctx");
  45866. $5=$4;
  45867. $6=_st(aNode)._value();
  45868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45869. $ctx1.sendIdx["value"]=2;
  45870. //>>excludeEnd("ctx");
  45871. _st($5)._name_($6);
  45872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45873. $ctx1.sendIdx["name:"]=1;
  45874. //>>excludeEnd("ctx");
  45875. $7=_st($4)._yourself();
  45876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45877. $ctx1.sendIdx["yourself"]=1;
  45878. //>>excludeEnd("ctx");
  45879. binding=$7;
  45880. binding;
  45881. $8=self._classReferences();
  45882. $9=_st(aNode)._value();
  45883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45884. $ctx1.sendIdx["value"]=3;
  45885. //>>excludeEnd("ctx");
  45886. _st($8)._add_($9);
  45887. } else {
  45888. self._errorUnknownVariable_(aNode);
  45889. $10=_st($UnknownVar())._new();
  45890. _st($10)._name_(_st(aNode)._value());
  45891. $11=_st($10)._yourself();
  45892. binding=$11;
  45893. binding;
  45894. };
  45895. } else {
  45896. $1;
  45897. };
  45898. _st(aNode)._binding_(binding);
  45899. return self;
  45900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45901. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},globals.SemanticAnalyzer)});
  45902. //>>excludeEnd("ctx");
  45903. },
  45904. //>>excludeStart("ide", pragmas.excludeIdeData);
  45905. args: ["aNode"],
  45906. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.",
  45907. referencedClasses: ["ClassRefVar", "UnknownVar"],
  45908. //>>excludeEnd("ide");
  45909. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  45910. }),
  45911. globals.SemanticAnalyzer);
  45912. smalltalk.addMethod(
  45913. smalltalk.method({
  45914. selector: "on:",
  45915. protocol: 'instance creation',
  45916. fn: function (aClass){
  45917. var self=this;
  45918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45919. return smalltalk.withContext(function($ctx1) {
  45920. //>>excludeEnd("ctx");
  45921. var $2,$3,$1;
  45922. $2=self._new();
  45923. _st($2)._theClass_(aClass);
  45924. $3=_st($2)._yourself();
  45925. $1=$3;
  45926. return $1;
  45927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45928. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},globals.SemanticAnalyzer.klass)});
  45929. //>>excludeEnd("ctx");
  45930. },
  45931. //>>excludeStart("ide", pragmas.excludeIdeData);
  45932. args: ["aClass"],
  45933. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  45934. referencedClasses: [],
  45935. //>>excludeEnd("ide");
  45936. messageSends: ["theClass:", "new", "yourself"]
  45937. }),
  45938. globals.SemanticAnalyzer.klass);
  45939. });
  45940. define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function($boot){
  45941. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  45942. smalltalk.addPackage('Compiler-Interpreter');
  45943. smalltalk.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45944. smalltalk.addClass('AIBlockClosure', globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  45945. //>>excludeStart("ide", pragmas.excludeIdeData);
  45946. globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
  45947. //>>excludeEnd("ide");
  45948. smalltalk.addMethod(
  45949. smalltalk.method({
  45950. selector: "applyTo:arguments:",
  45951. protocol: 'evaluating',
  45952. fn: function (anObject,aCollection){
  45953. var self=this;
  45954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45955. return smalltalk.withContext(function($ctx1) {
  45956. //>>excludeEnd("ctx");
  45957. self._interpreterError();
  45958. return self;
  45959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45960. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.AIBlockClosure)});
  45961. //>>excludeEnd("ctx");
  45962. },
  45963. //>>excludeStart("ide", pragmas.excludeIdeData);
  45964. args: ["anObject", "aCollection"],
  45965. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  45966. referencedClasses: [],
  45967. //>>excludeEnd("ide");
  45968. messageSends: ["interpreterError"]
  45969. }),
  45970. globals.AIBlockClosure);
  45971. smalltalk.addMethod(
  45972. smalltalk.method({
  45973. selector: "compiledSource",
  45974. protocol: 'accessing',
  45975. fn: function (){
  45976. var self=this;
  45977. return "[ AST Block closure ]";
  45978. },
  45979. //>>excludeStart("ide", pragmas.excludeIdeData);
  45980. args: [],
  45981. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  45982. referencedClasses: [],
  45983. //>>excludeEnd("ide");
  45984. messageSends: []
  45985. }),
  45986. globals.AIBlockClosure);
  45987. smalltalk.addMethod(
  45988. smalltalk.method({
  45989. selector: "currySelf",
  45990. protocol: 'converting',
  45991. fn: function (){
  45992. var self=this;
  45993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45994. return smalltalk.withContext(function($ctx1) {
  45995. //>>excludeEnd("ctx");
  45996. self._interpreterError();
  45997. return self;
  45998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45999. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.AIBlockClosure)});
  46000. //>>excludeEnd("ctx");
  46001. },
  46002. //>>excludeStart("ide", pragmas.excludeIdeData);
  46003. args: [],
  46004. source: "currySelf\x0a\x09self interpreterError",
  46005. referencedClasses: [],
  46006. //>>excludeEnd("ide");
  46007. messageSends: ["interpreterError"]
  46008. }),
  46009. globals.AIBlockClosure);
  46010. smalltalk.addMethod(
  46011. smalltalk.method({
  46012. selector: "initializeWithContext:node:",
  46013. protocol: 'initialization',
  46014. fn: function (aContext,aNode){
  46015. var self=this;
  46016. self["@node"]=aNode;
  46017. self["@outerContext"]=aContext;
  46018. return self;
  46019. },
  46020. //>>excludeStart("ide", pragmas.excludeIdeData);
  46021. args: ["aContext", "aNode"],
  46022. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  46023. referencedClasses: [],
  46024. //>>excludeEnd("ide");
  46025. messageSends: []
  46026. }),
  46027. globals.AIBlockClosure);
  46028. smalltalk.addMethod(
  46029. smalltalk.method({
  46030. selector: "interpreterError",
  46031. protocol: 'error handling',
  46032. fn: function (){
  46033. var self=this;
  46034. function $ASTInterpreterError(){return globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  46035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46036. return smalltalk.withContext(function($ctx1) {
  46037. //>>excludeEnd("ctx");
  46038. _st($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  46039. return self;
  46040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46041. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},globals.AIBlockClosure)});
  46042. //>>excludeEnd("ctx");
  46043. },
  46044. //>>excludeStart("ide", pragmas.excludeIdeData);
  46045. args: [],
  46046. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  46047. referencedClasses: ["ASTInterpreterError"],
  46048. //>>excludeEnd("ide");
  46049. messageSends: ["signal:"]
  46050. }),
  46051. globals.AIBlockClosure);
  46052. smalltalk.addMethod(
  46053. smalltalk.method({
  46054. selector: "numArgs",
  46055. protocol: 'accessing',
  46056. fn: function (){
  46057. var self=this;
  46058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46059. return smalltalk.withContext(function($ctx1) {
  46060. //>>excludeEnd("ctx");
  46061. var $1;
  46062. $1=_st(_st(self["@node"])._temps())._size();
  46063. return $1;
  46064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46065. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.AIBlockClosure)});
  46066. //>>excludeEnd("ctx");
  46067. },
  46068. //>>excludeStart("ide", pragmas.excludeIdeData);
  46069. args: [],
  46070. source: "numArgs\x0a\x09^ node temps size",
  46071. referencedClasses: [],
  46072. //>>excludeEnd("ide");
  46073. messageSends: ["size", "temps"]
  46074. }),
  46075. globals.AIBlockClosure);
  46076. smalltalk.addMethod(
  46077. smalltalk.method({
  46078. selector: "value",
  46079. protocol: 'evaluating',
  46080. fn: function (){
  46081. var self=this;
  46082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46083. return smalltalk.withContext(function($ctx1) {
  46084. //>>excludeEnd("ctx");
  46085. var $1;
  46086. $1=self._valueWithPossibleArguments_([]);
  46087. return $1;
  46088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46089. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.AIBlockClosure)});
  46090. //>>excludeEnd("ctx");
  46091. },
  46092. //>>excludeStart("ide", pragmas.excludeIdeData);
  46093. args: [],
  46094. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  46095. referencedClasses: [],
  46096. //>>excludeEnd("ide");
  46097. messageSends: ["valueWithPossibleArguments:"]
  46098. }),
  46099. globals.AIBlockClosure);
  46100. smalltalk.addMethod(
  46101. smalltalk.method({
  46102. selector: "value:",
  46103. protocol: 'evaluating',
  46104. fn: function (anArgument){
  46105. var self=this;
  46106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46107. return smalltalk.withContext(function($ctx1) {
  46108. //>>excludeEnd("ctx");
  46109. var $1;
  46110. $1=self._valueWithPossibleArguments_([anArgument]);
  46111. return $1;
  46112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46113. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},globals.AIBlockClosure)});
  46114. //>>excludeEnd("ctx");
  46115. },
  46116. //>>excludeStart("ide", pragmas.excludeIdeData);
  46117. args: ["anArgument"],
  46118. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  46119. referencedClasses: [],
  46120. //>>excludeEnd("ide");
  46121. messageSends: ["valueWithPossibleArguments:"]
  46122. }),
  46123. globals.AIBlockClosure);
  46124. smalltalk.addMethod(
  46125. smalltalk.method({
  46126. selector: "value:value:",
  46127. protocol: 'evaluating',
  46128. fn: function (firstArgument,secondArgument){
  46129. var self=this;
  46130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46131. return smalltalk.withContext(function($ctx1) {
  46132. //>>excludeEnd("ctx");
  46133. var $1;
  46134. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  46135. return $1;
  46136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46137. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.AIBlockClosure)});
  46138. //>>excludeEnd("ctx");
  46139. },
  46140. //>>excludeStart("ide", pragmas.excludeIdeData);
  46141. args: ["firstArgument", "secondArgument"],
  46142. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  46143. referencedClasses: [],
  46144. //>>excludeEnd("ide");
  46145. messageSends: ["valueWithPossibleArguments:"]
  46146. }),
  46147. globals.AIBlockClosure);
  46148. smalltalk.addMethod(
  46149. smalltalk.method({
  46150. selector: "value:value:value:",
  46151. protocol: 'evaluating',
  46152. fn: function (firstArgument,secondArgument,thirdArgument){
  46153. var self=this;
  46154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46155. return smalltalk.withContext(function($ctx1) {
  46156. //>>excludeEnd("ctx");
  46157. var $1;
  46158. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  46159. return $1;
  46160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46161. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.AIBlockClosure)});
  46162. //>>excludeEnd("ctx");
  46163. },
  46164. //>>excludeStart("ide", pragmas.excludeIdeData);
  46165. args: ["firstArgument", "secondArgument", "thirdArgument"],
  46166. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  46167. referencedClasses: [],
  46168. //>>excludeEnd("ide");
  46169. messageSends: ["valueWithPossibleArguments:"]
  46170. }),
  46171. globals.AIBlockClosure);
  46172. smalltalk.addMethod(
  46173. smalltalk.method({
  46174. selector: "valueWithPossibleArguments:",
  46175. protocol: 'evaluating',
  46176. fn: function (aCollection){
  46177. var self=this;
  46178. var context,sequenceNode;
  46179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46180. return smalltalk.withContext(function($ctx1) {
  46181. //>>excludeEnd("ctx");
  46182. var $1,$2,$3,$4,$5,$6;
  46183. context=_st(self["@outerContext"])._newInnerContext();
  46184. $1=_st(_st(_st(self["@node"])._nodes())._first())._copy();
  46185. _st($1)._parent_(nil);
  46186. $2=_st($1)._yourself();
  46187. sequenceNode=$2;
  46188. _st(_st(sequenceNode)._temps())._do_((function(each){
  46189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46190. return smalltalk.withContext(function($ctx2) {
  46191. //>>excludeEnd("ctx");
  46192. return _st(context)._defineLocal_(each);
  46193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46194. $ctx2.sendIdx["defineLocal:"]=1;
  46195. //>>excludeEnd("ctx");
  46196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46197. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46198. //>>excludeEnd("ctx");
  46199. }));
  46200. _st(_st(self["@node"])._parameters())._withIndexDo_((function(each,index){
  46201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46202. return smalltalk.withContext(function($ctx2) {
  46203. //>>excludeEnd("ctx");
  46204. _st(context)._defineLocal_(each);
  46205. return _st(context)._localAt_put_(each,_st(aCollection)._at_ifAbsent_(index,(function(){
  46206. return nil;
  46207. })));
  46208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46209. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  46210. //>>excludeEnd("ctx");
  46211. }));
  46212. $3=_st(context)._interpreter();
  46213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46214. $ctx1.sendIdx["interpreter"]=1;
  46215. //>>excludeEnd("ctx");
  46216. _st($3)._node_(_st(sequenceNode)._nextChild());
  46217. $4=_st($3)._proceed();
  46218. $5=_st(self["@outerContext"])._interpreter();
  46219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46220. $ctx1.sendIdx["interpreter"]=2;
  46221. //>>excludeEnd("ctx");
  46222. _st($5)._setNonLocalReturnFromContext_(context);
  46223. $6=_st(_st(context)._interpreter())._pop();
  46224. return $6;
  46225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46226. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},globals.AIBlockClosure)});
  46227. //>>excludeEnd("ctx");
  46228. },
  46229. //>>excludeStart("ide", pragmas.excludeIdeData);
  46230. args: ["aCollection"],
  46231. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  46232. referencedClasses: [],
  46233. //>>excludeEnd("ide");
  46234. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"]
  46235. }),
  46236. globals.AIBlockClosure);
  46237. smalltalk.addMethod(
  46238. smalltalk.method({
  46239. selector: "forContext:node:",
  46240. protocol: 'instance creation',
  46241. fn: function (aContext,aNode){
  46242. var self=this;
  46243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46244. return smalltalk.withContext(function($ctx1) {
  46245. //>>excludeEnd("ctx");
  46246. var $2,$3,$1;
  46247. $2=self._new();
  46248. _st($2)._initializeWithContext_node_(aContext,aNode);
  46249. $3=_st($2)._yourself();
  46250. $1=$3;
  46251. return $1;
  46252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46253. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},globals.AIBlockClosure.klass)});
  46254. //>>excludeEnd("ctx");
  46255. },
  46256. //>>excludeStart("ide", pragmas.excludeIdeData);
  46257. args: ["aContext", "aNode"],
  46258. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  46259. referencedClasses: [],
  46260. //>>excludeEnd("ide");
  46261. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  46262. }),
  46263. globals.AIBlockClosure.klass);
  46264. smalltalk.addClass('AIContext', globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  46265. //>>excludeStart("ide", pragmas.excludeIdeData);
  46266. globals.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
  46267. //>>excludeEnd("ide");
  46268. smalltalk.addMethod(
  46269. smalltalk.method({
  46270. selector: "arguments",
  46271. protocol: 'interpreting',
  46272. fn: function (){
  46273. var self=this;
  46274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46275. return smalltalk.withContext(function($ctx1) {
  46276. //>>excludeEnd("ctx");
  46277. var $1;
  46278. $1=_st(_st(self._ast())._arguments())._collect_((function(each){
  46279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46280. return smalltalk.withContext(function($ctx2) {
  46281. //>>excludeEnd("ctx");
  46282. return self._localAt_ifAbsent_(each,(function(){
  46283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46284. return smalltalk.withContext(function($ctx3) {
  46285. //>>excludeEnd("ctx");
  46286. return self._error_("Argument not in context");
  46287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46288. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46289. //>>excludeEnd("ctx");
  46290. }));
  46291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46292. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46293. //>>excludeEnd("ctx");
  46294. }));
  46295. return $1;
  46296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46297. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.AIContext)});
  46298. //>>excludeEnd("ctx");
  46299. },
  46300. //>>excludeStart("ide", pragmas.excludeIdeData);
  46301. args: [],
  46302. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  46303. referencedClasses: [],
  46304. //>>excludeEnd("ide");
  46305. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  46306. }),
  46307. globals.AIContext);
  46308. smalltalk.addMethod(
  46309. smalltalk.method({
  46310. selector: "ast",
  46311. protocol: 'interpreting',
  46312. fn: function (){
  46313. var self=this;
  46314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46315. return smalltalk.withContext(function($ctx1) {
  46316. //>>excludeEnd("ctx");
  46317. var $1,$3,$2,$4,$5,$receiver;
  46318. $1=self._isBlockContext();
  46319. if(smalltalk.assert($1)){
  46320. $3=self._outerContext();
  46321. if(($receiver = $3) == null || $receiver.isNil){
  46322. $2=$3;
  46323. } else {
  46324. var context;
  46325. context=$receiver;
  46326. $2=_st(context)._ast();
  46327. };
  46328. return $2;
  46329. };
  46330. $4=self["@ast"];
  46331. if(($receiver = $4) == null || $receiver.isNil){
  46332. self._initializeAST();
  46333. } else {
  46334. $4;
  46335. };
  46336. $5=self["@ast"];
  46337. return $5;
  46338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46339. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.AIContext)});
  46340. //>>excludeEnd("ctx");
  46341. },
  46342. //>>excludeStart("ide", pragmas.excludeIdeData);
  46343. args: [],
  46344. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  46345. referencedClasses: [],
  46346. //>>excludeEnd("ide");
  46347. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  46348. }),
  46349. globals.AIContext);
  46350. smalltalk.addMethod(
  46351. smalltalk.method({
  46352. selector: "basicLocalAt:",
  46353. protocol: 'private',
  46354. fn: function (aString){
  46355. var self=this;
  46356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46357. return smalltalk.withContext(function($ctx1) {
  46358. //>>excludeEnd("ctx");
  46359. var $1;
  46360. $1=_st(self._locals())._at_(aString);
  46361. return $1;
  46362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46363. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},globals.AIContext)});
  46364. //>>excludeEnd("ctx");
  46365. },
  46366. //>>excludeStart("ide", pragmas.excludeIdeData);
  46367. args: ["aString"],
  46368. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  46369. referencedClasses: [],
  46370. //>>excludeEnd("ide");
  46371. messageSends: ["at:", "locals"]
  46372. }),
  46373. globals.AIContext);
  46374. smalltalk.addMethod(
  46375. smalltalk.method({
  46376. selector: "basicLocalAt:put:",
  46377. protocol: 'private',
  46378. fn: function (aString,anObject){
  46379. var self=this;
  46380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46381. return smalltalk.withContext(function($ctx1) {
  46382. //>>excludeEnd("ctx");
  46383. _st(self._locals())._at_put_(aString,anObject);
  46384. return self;
  46385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46386. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},globals.AIContext)});
  46387. //>>excludeEnd("ctx");
  46388. },
  46389. //>>excludeStart("ide", pragmas.excludeIdeData);
  46390. args: ["aString", "anObject"],
  46391. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  46392. referencedClasses: [],
  46393. //>>excludeEnd("ide");
  46394. messageSends: ["at:put:", "locals"]
  46395. }),
  46396. globals.AIContext);
  46397. smalltalk.addMethod(
  46398. smalltalk.method({
  46399. selector: "basicReceiver",
  46400. protocol: 'interpreting',
  46401. fn: function (){
  46402. var self=this;
  46403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46404. return smalltalk.withContext(function($ctx1) {
  46405. //>>excludeEnd("ctx");
  46406. var $1;
  46407. $1=self._localAt_("self");
  46408. return $1;
  46409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46410. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},globals.AIContext)});
  46411. //>>excludeEnd("ctx");
  46412. },
  46413. //>>excludeStart("ide", pragmas.excludeIdeData);
  46414. args: [],
  46415. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  46416. referencedClasses: [],
  46417. //>>excludeEnd("ide");
  46418. messageSends: ["localAt:"]
  46419. }),
  46420. globals.AIContext);
  46421. smalltalk.addMethod(
  46422. smalltalk.method({
  46423. selector: "defineLocal:",
  46424. protocol: 'accessing',
  46425. fn: function (aString){
  46426. var self=this;
  46427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46428. return smalltalk.withContext(function($ctx1) {
  46429. //>>excludeEnd("ctx");
  46430. _st(self._locals())._at_put_(aString,nil);
  46431. return self;
  46432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46433. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},globals.AIContext)});
  46434. //>>excludeEnd("ctx");
  46435. },
  46436. //>>excludeStart("ide", pragmas.excludeIdeData);
  46437. args: ["aString"],
  46438. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  46439. referencedClasses: [],
  46440. //>>excludeEnd("ide");
  46441. messageSends: ["at:put:", "locals"]
  46442. }),
  46443. globals.AIContext);
  46444. smalltalk.addMethod(
  46445. smalltalk.method({
  46446. selector: "evaluate:on:",
  46447. protocol: 'evaluating',
  46448. fn: function (aString,anEvaluator){
  46449. var self=this;
  46450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46451. return smalltalk.withContext(function($ctx1) {
  46452. //>>excludeEnd("ctx");
  46453. var $1;
  46454. $1=_st(anEvaluator)._evaluate_context_(aString,self);
  46455. return $1;
  46456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46457. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},globals.AIContext)});
  46458. //>>excludeEnd("ctx");
  46459. },
  46460. //>>excludeStart("ide", pragmas.excludeIdeData);
  46461. args: ["aString", "anEvaluator"],
  46462. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  46463. referencedClasses: [],
  46464. //>>excludeEnd("ide");
  46465. messageSends: ["evaluate:context:"]
  46466. }),
  46467. globals.AIContext);
  46468. smalltalk.addMethod(
  46469. smalltalk.method({
  46470. selector: "evaluateNode:",
  46471. protocol: 'evaluating',
  46472. fn: function (aNode){
  46473. var self=this;
  46474. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  46475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46476. return smalltalk.withContext(function($ctx1) {
  46477. //>>excludeEnd("ctx");
  46478. var $2,$3,$1;
  46479. $2=_st($ASTInterpreter())._new();
  46480. _st($2)._context_(self);
  46481. _st($2)._node_(_st(aNode)._nextChild());
  46482. _st($2)._proceed();
  46483. $3=_st($2)._result();
  46484. $1=$3;
  46485. return $1;
  46486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46487. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},globals.AIContext)});
  46488. //>>excludeEnd("ctx");
  46489. },
  46490. //>>excludeStart("ide", pragmas.excludeIdeData);
  46491. args: ["aNode"],
  46492. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  46493. referencedClasses: ["ASTInterpreter"],
  46494. //>>excludeEnd("ide");
  46495. messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"]
  46496. }),
  46497. globals.AIContext);
  46498. smalltalk.addMethod(
  46499. smalltalk.method({
  46500. selector: "evaluatedSelector",
  46501. protocol: 'accessing',
  46502. fn: function (){
  46503. var self=this;
  46504. var $1;
  46505. $1=self["@evaluatedSelector"];
  46506. return $1;
  46507. },
  46508. //>>excludeStart("ide", pragmas.excludeIdeData);
  46509. args: [],
  46510. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  46511. referencedClasses: [],
  46512. //>>excludeEnd("ide");
  46513. messageSends: []
  46514. }),
  46515. globals.AIContext);
  46516. smalltalk.addMethod(
  46517. smalltalk.method({
  46518. selector: "evaluatedSelector:",
  46519. protocol: 'accessing',
  46520. fn: function (aString){
  46521. var self=this;
  46522. self["@evaluatedSelector"]=aString;
  46523. return self;
  46524. },
  46525. //>>excludeStart("ide", pragmas.excludeIdeData);
  46526. args: ["aString"],
  46527. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  46528. referencedClasses: [],
  46529. //>>excludeEnd("ide");
  46530. messageSends: []
  46531. }),
  46532. globals.AIContext);
  46533. smalltalk.addMethod(
  46534. smalltalk.method({
  46535. selector: "index",
  46536. protocol: 'accessing',
  46537. fn: function (){
  46538. var self=this;
  46539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46540. return smalltalk.withContext(function($ctx1) {
  46541. //>>excludeEnd("ctx");
  46542. var $2,$1,$receiver;
  46543. $2=self["@index"];
  46544. if(($receiver = $2) == null || $receiver.isNil){
  46545. $1=(0);
  46546. } else {
  46547. $1=$2;
  46548. };
  46549. return $1;
  46550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46551. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.AIContext)});
  46552. //>>excludeEnd("ctx");
  46553. },
  46554. //>>excludeStart("ide", pragmas.excludeIdeData);
  46555. args: [],
  46556. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  46557. referencedClasses: [],
  46558. //>>excludeEnd("ide");
  46559. messageSends: ["ifNil:"]
  46560. }),
  46561. globals.AIContext);
  46562. smalltalk.addMethod(
  46563. smalltalk.method({
  46564. selector: "index:",
  46565. protocol: 'accessing',
  46566. fn: function (anInteger){
  46567. var self=this;
  46568. self["@index"]=anInteger;
  46569. return self;
  46570. },
  46571. //>>excludeStart("ide", pragmas.excludeIdeData);
  46572. args: ["anInteger"],
  46573. source: "index: anInteger\x0a\x09index := anInteger",
  46574. referencedClasses: [],
  46575. //>>excludeEnd("ide");
  46576. messageSends: []
  46577. }),
  46578. globals.AIContext);
  46579. smalltalk.addMethod(
  46580. smalltalk.method({
  46581. selector: "initializeAST",
  46582. protocol: 'initialization',
  46583. fn: function (){
  46584. var self=this;
  46585. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  46586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46587. return smalltalk.withContext(function($ctx1) {
  46588. //>>excludeEnd("ctx");
  46589. var $1;
  46590. $1=self._method();
  46591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46592. $ctx1.sendIdx["method"]=1;
  46593. //>>excludeEnd("ctx");
  46594. self["@ast"]=_st($1)._ast();
  46595. _st(_st($SemanticAnalyzer())._on_(_st(self._method())._methodClass()))._visit_(self["@ast"]);
  46596. return self;
  46597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46598. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},globals.AIContext)});
  46599. //>>excludeEnd("ctx");
  46600. },
  46601. //>>excludeStart("ide", pragmas.excludeIdeData);
  46602. args: [],
  46603. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  46604. referencedClasses: ["SemanticAnalyzer"],
  46605. //>>excludeEnd("ide");
  46606. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  46607. }),
  46608. globals.AIContext);
  46609. smalltalk.addMethod(
  46610. smalltalk.method({
  46611. selector: "initializeFromMethodContext:",
  46612. protocol: 'initialization',
  46613. fn: function (aMethodContext){
  46614. var self=this;
  46615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46616. return smalltalk.withContext(function($ctx1) {
  46617. //>>excludeEnd("ctx");
  46618. var $1,$2,$3,$4,$receiver;
  46619. self._evaluatedSelector_(_st(aMethodContext)._evaluatedSelector());
  46620. self._index_(_st(aMethodContext)._index());
  46621. self._sendIndexes_(_st(aMethodContext)._sendIndexes());
  46622. self._receiver_(_st(aMethodContext)._receiver());
  46623. self._supercall_(_st(aMethodContext)._supercall());
  46624. $1=self._selector_(_st(aMethodContext)._selector());
  46625. $2=_st(aMethodContext)._outerContext();
  46626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46627. $ctx1.sendIdx["outerContext"]=1;
  46628. //>>excludeEnd("ctx");
  46629. if(($receiver = $2) == null || $receiver.isNil){
  46630. $2;
  46631. } else {
  46632. var outer;
  46633. outer=$receiver;
  46634. $3=_st(outer)._methodContext();
  46635. if(($receiver = $3) == null || $receiver.isNil){
  46636. $3;
  46637. } else {
  46638. self._outerContext_(_st(self._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  46639. };
  46640. $4=_st(aMethodContext)._locals();
  46641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46642. $ctx1.sendIdx["locals"]=1;
  46643. //>>excludeEnd("ctx");
  46644. _st($4)._keysAndValuesDo_((function(key,value){
  46645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46646. return smalltalk.withContext(function($ctx2) {
  46647. //>>excludeEnd("ctx");
  46648. return _st(self._locals())._at_put_(key,value);
  46649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46650. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46651. //>>excludeEnd("ctx");
  46652. }));
  46653. };
  46654. return self;
  46655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46656. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext)});
  46657. //>>excludeEnd("ctx");
  46658. },
  46659. //>>excludeStart("ide", pragmas.excludeIdeData);
  46660. args: ["aMethodContext"],
  46661. source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
  46662. referencedClasses: [],
  46663. //>>excludeEnd("ide");
  46664. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  46665. }),
  46666. globals.AIContext);
  46667. smalltalk.addMethod(
  46668. smalltalk.method({
  46669. selector: "initializeInterpreter",
  46670. protocol: 'initialization',
  46671. fn: function (){
  46672. var self=this;
  46673. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  46674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46675. return smalltalk.withContext(function($ctx1) {
  46676. //>>excludeEnd("ctx");
  46677. var $1,$2,$3,$receiver;
  46678. $1=_st($ASTInterpreter())._new();
  46679. _st($1)._context_(self);
  46680. $2=_st($1)._yourself();
  46681. self["@interpreter"]=$2;
  46682. $3=self._innerContext();
  46683. if(($receiver = $3) == null || $receiver.isNil){
  46684. $3;
  46685. } else {
  46686. self._setupInterpreter_(self["@interpreter"]);
  46687. };
  46688. return self;
  46689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46690. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},globals.AIContext)});
  46691. //>>excludeEnd("ctx");
  46692. },
  46693. //>>excludeStart("ide", pragmas.excludeIdeData);
  46694. args: [],
  46695. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  46696. referencedClasses: ["ASTInterpreter"],
  46697. //>>excludeEnd("ide");
  46698. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  46699. }),
  46700. globals.AIContext);
  46701. smalltalk.addMethod(
  46702. smalltalk.method({
  46703. selector: "initializeLocals",
  46704. protocol: 'initialization',
  46705. fn: function (){
  46706. var self=this;
  46707. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  46708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46709. return smalltalk.withContext(function($ctx1) {
  46710. //>>excludeEnd("ctx");
  46711. self["@locals"]=_st($Dictionary())._new();
  46712. _st(self["@locals"])._at_put_("thisContext",self);
  46713. return self;
  46714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46715. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},globals.AIContext)});
  46716. //>>excludeEnd("ctx");
  46717. },
  46718. //>>excludeStart("ide", pragmas.excludeIdeData);
  46719. args: [],
  46720. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  46721. referencedClasses: ["Dictionary"],
  46722. //>>excludeEnd("ide");
  46723. messageSends: ["new", "at:put:"]
  46724. }),
  46725. globals.AIContext);
  46726. smalltalk.addMethod(
  46727. smalltalk.method({
  46728. selector: "innerContext",
  46729. protocol: 'accessing',
  46730. fn: function (){
  46731. var self=this;
  46732. var $1;
  46733. $1=self["@innerContext"];
  46734. return $1;
  46735. },
  46736. //>>excludeStart("ide", pragmas.excludeIdeData);
  46737. args: [],
  46738. source: "innerContext\x0a\x09^ innerContext",
  46739. referencedClasses: [],
  46740. //>>excludeEnd("ide");
  46741. messageSends: []
  46742. }),
  46743. globals.AIContext);
  46744. smalltalk.addMethod(
  46745. smalltalk.method({
  46746. selector: "innerContext:",
  46747. protocol: 'accessing',
  46748. fn: function (anAIContext){
  46749. var self=this;
  46750. self["@innerContext"]=anAIContext;
  46751. return self;
  46752. },
  46753. //>>excludeStart("ide", pragmas.excludeIdeData);
  46754. args: ["anAIContext"],
  46755. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  46756. referencedClasses: [],
  46757. //>>excludeEnd("ide");
  46758. messageSends: []
  46759. }),
  46760. globals.AIContext);
  46761. smalltalk.addMethod(
  46762. smalltalk.method({
  46763. selector: "interpreter",
  46764. protocol: 'interpreting',
  46765. fn: function (){
  46766. var self=this;
  46767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46768. return smalltalk.withContext(function($ctx1) {
  46769. //>>excludeEnd("ctx");
  46770. var $1,$2,$receiver;
  46771. $1=self["@interpreter"];
  46772. if(($receiver = $1) == null || $receiver.isNil){
  46773. self._initializeInterpreter();
  46774. } else {
  46775. $1;
  46776. };
  46777. $2=self["@interpreter"];
  46778. return $2;
  46779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46780. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.AIContext)});
  46781. //>>excludeEnd("ctx");
  46782. },
  46783. //>>excludeStart("ide", pragmas.excludeIdeData);
  46784. args: [],
  46785. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  46786. referencedClasses: [],
  46787. //>>excludeEnd("ide");
  46788. messageSends: ["ifNil:", "initializeInterpreter"]
  46789. }),
  46790. globals.AIContext);
  46791. smalltalk.addMethod(
  46792. smalltalk.method({
  46793. selector: "interpreter:",
  46794. protocol: 'interpreting',
  46795. fn: function (anInterpreter){
  46796. var self=this;
  46797. self["@interpreter"]=anInterpreter;
  46798. return self;
  46799. },
  46800. //>>excludeStart("ide", pragmas.excludeIdeData);
  46801. args: ["anInterpreter"],
  46802. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  46803. referencedClasses: [],
  46804. //>>excludeEnd("ide");
  46805. messageSends: []
  46806. }),
  46807. globals.AIContext);
  46808. smalltalk.addMethod(
  46809. smalltalk.method({
  46810. selector: "isTopContext",
  46811. protocol: 'testing',
  46812. fn: function (){
  46813. var self=this;
  46814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46815. return smalltalk.withContext(function($ctx1) {
  46816. //>>excludeEnd("ctx");
  46817. var $1;
  46818. $1=_st(self._innerContext())._isNil();
  46819. return $1;
  46820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46821. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},globals.AIContext)});
  46822. //>>excludeEnd("ctx");
  46823. },
  46824. //>>excludeStart("ide", pragmas.excludeIdeData);
  46825. args: [],
  46826. source: "isTopContext\x0a\x09^ self innerContext isNil",
  46827. referencedClasses: [],
  46828. //>>excludeEnd("ide");
  46829. messageSends: ["isNil", "innerContext"]
  46830. }),
  46831. globals.AIContext);
  46832. smalltalk.addMethod(
  46833. smalltalk.method({
  46834. selector: "localAt:",
  46835. protocol: 'accessing',
  46836. fn: function (aString){
  46837. var self=this;
  46838. var context;
  46839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46840. return smalltalk.withContext(function($ctx1) {
  46841. //>>excludeEnd("ctx");
  46842. var $1;
  46843. context=self._lookupContextForLocal_(aString);
  46844. $1=_st(context)._basicLocalAt_(aString);
  46845. return $1;
  46846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46847. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},globals.AIContext)});
  46848. //>>excludeEnd("ctx");
  46849. },
  46850. //>>excludeStart("ide", pragmas.excludeIdeData);
  46851. args: ["aString"],
  46852. source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09^ context basicLocalAt: aString",
  46853. referencedClasses: [],
  46854. //>>excludeEnd("ide");
  46855. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  46856. }),
  46857. globals.AIContext);
  46858. smalltalk.addMethod(
  46859. smalltalk.method({
  46860. selector: "localAt:ifAbsent:",
  46861. protocol: 'accessing',
  46862. fn: function (aString,aBlock){
  46863. var self=this;
  46864. var context;
  46865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46866. return smalltalk.withContext(function($ctx1) {
  46867. //>>excludeEnd("ctx");
  46868. var $1,$2;
  46869. var $early={};
  46870. try {
  46871. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  46872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46873. return smalltalk.withContext(function($ctx2) {
  46874. //>>excludeEnd("ctx");
  46875. $1=_st(aBlock)._value();
  46876. throw $early=[$1];
  46877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46879. //>>excludeEnd("ctx");
  46880. }));
  46881. $2=_st(context)._basicLocalAt_(aString);
  46882. return $2;
  46883. }
  46884. catch(e) {if(e===$early)return e[0]; throw e}
  46885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46886. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},globals.AIContext)});
  46887. //>>excludeEnd("ctx");
  46888. },
  46889. //>>excludeStart("ide", pragmas.excludeIdeData);
  46890. args: ["aString", "aBlock"],
  46891. source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self \x09\x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ ^ aBlock value ].\x0a\x09\x0a\x09^ context basicLocalAt: aString",
  46892. referencedClasses: [],
  46893. //>>excludeEnd("ide");
  46894. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  46895. }),
  46896. globals.AIContext);
  46897. smalltalk.addMethod(
  46898. smalltalk.method({
  46899. selector: "localAt:put:",
  46900. protocol: 'accessing',
  46901. fn: function (aString,anObject){
  46902. var self=this;
  46903. var context;
  46904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46905. return smalltalk.withContext(function($ctx1) {
  46906. //>>excludeEnd("ctx");
  46907. context=self._lookupContextForLocal_(aString);
  46908. _st(context)._basicLocalAt_put_(aString,anObject);
  46909. return self;
  46910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46911. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},globals.AIContext)});
  46912. //>>excludeEnd("ctx");
  46913. },
  46914. //>>excludeStart("ide", pragmas.excludeIdeData);
  46915. args: ["aString", "anObject"],
  46916. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  46917. referencedClasses: [],
  46918. //>>excludeEnd("ide");
  46919. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  46920. }),
  46921. globals.AIContext);
  46922. smalltalk.addMethod(
  46923. smalltalk.method({
  46924. selector: "locals",
  46925. protocol: 'accessing',
  46926. fn: function (){
  46927. var self=this;
  46928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46929. return smalltalk.withContext(function($ctx1) {
  46930. //>>excludeEnd("ctx");
  46931. var $1,$2,$receiver;
  46932. $1=self["@locals"];
  46933. if(($receiver = $1) == null || $receiver.isNil){
  46934. self._initializeLocals();
  46935. } else {
  46936. $1;
  46937. };
  46938. $2=self["@locals"];
  46939. return $2;
  46940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46941. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.AIContext)});
  46942. //>>excludeEnd("ctx");
  46943. },
  46944. //>>excludeStart("ide", pragmas.excludeIdeData);
  46945. args: [],
  46946. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  46947. referencedClasses: [],
  46948. //>>excludeEnd("ide");
  46949. messageSends: ["ifNil:", "initializeLocals"]
  46950. }),
  46951. globals.AIContext);
  46952. smalltalk.addMethod(
  46953. smalltalk.method({
  46954. selector: "lookupContextForLocal:",
  46955. protocol: 'private',
  46956. fn: function (aString){
  46957. var self=this;
  46958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46959. return smalltalk.withContext(function($ctx1) {
  46960. //>>excludeEnd("ctx");
  46961. var $1;
  46962. $1=self._lookupContextForLocal_ifNone_(aString,(function(){
  46963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46964. return smalltalk.withContext(function($ctx2) {
  46965. //>>excludeEnd("ctx");
  46966. return self._variableNotFound();
  46967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46969. //>>excludeEnd("ctx");
  46970. }));
  46971. return $1;
  46972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46973. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},globals.AIContext)});
  46974. //>>excludeEnd("ctx");
  46975. },
  46976. //>>excludeStart("ide", pragmas.excludeIdeData);
  46977. args: ["aString"],
  46978. source: "lookupContextForLocal: aString\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self \x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ self variableNotFound ]",
  46979. referencedClasses: [],
  46980. //>>excludeEnd("ide");
  46981. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  46982. }),
  46983. globals.AIContext);
  46984. smalltalk.addMethod(
  46985. smalltalk.method({
  46986. selector: "lookupContextForLocal:ifNone:",
  46987. protocol: 'private',
  46988. fn: function (aString,aBlock){
  46989. var self=this;
  46990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46991. return smalltalk.withContext(function($ctx1) {
  46992. //>>excludeEnd("ctx");
  46993. var $2,$1;
  46994. $1=_st(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  46995. return self;
  46996. }),(function(){
  46997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46998. return smalltalk.withContext(function($ctx2) {
  46999. //>>excludeEnd("ctx");
  47000. $2=self._outerContext();
  47001. return _st($2)._ifNil_ifNotNil_(aBlock,(function(context){
  47002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47003. return smalltalk.withContext(function($ctx3) {
  47004. //>>excludeEnd("ctx");
  47005. return _st(context)._lookupContextForLocal_(aString);
  47006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47007. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  47008. //>>excludeEnd("ctx");
  47009. }));
  47010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47012. //>>excludeEnd("ctx");
  47013. }));
  47014. return $1;
  47015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47016. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},globals.AIContext)});
  47017. //>>excludeEnd("ctx");
  47018. },
  47019. //>>excludeStart("ide", pragmas.excludeIdeData);
  47020. args: ["aString", "aBlock"],
  47021. source: "lookupContextForLocal: aString ifNone: aBlock\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self locals \x0a\x09\x09at: aString\x0a\x09\x09ifPresent: [ self ]\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09self outerContext \x0a\x09\x09\x09\x09ifNil: aBlock\x0a\x09\x09\x09\x09ifNotNil: [ :context | \x0a\x09\x09\x09\x09\x09context lookupContextForLocal: aString ] ]",
  47022. referencedClasses: [],
  47023. //>>excludeEnd("ide");
  47024. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  47025. }),
  47026. globals.AIContext);
  47027. smalltalk.addMethod(
  47028. smalltalk.method({
  47029. selector: "newInnerContext",
  47030. protocol: 'factory',
  47031. fn: function (){
  47032. var self=this;
  47033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47034. return smalltalk.withContext(function($ctx1) {
  47035. //>>excludeEnd("ctx");
  47036. var $2,$3,$1;
  47037. $2=_st(self._class())._new();
  47038. _st($2)._outerContext_(self);
  47039. $3=_st($2)._yourself();
  47040. $1=$3;
  47041. return $1;
  47042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47043. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},globals.AIContext)});
  47044. //>>excludeEnd("ctx");
  47045. },
  47046. //>>excludeStart("ide", pragmas.excludeIdeData);
  47047. args: [],
  47048. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  47049. referencedClasses: [],
  47050. //>>excludeEnd("ide");
  47051. messageSends: ["outerContext:", "new", "class", "yourself"]
  47052. }),
  47053. globals.AIContext);
  47054. smalltalk.addMethod(
  47055. smalltalk.method({
  47056. selector: "outerContext",
  47057. protocol: 'accessing',
  47058. fn: function (){
  47059. var self=this;
  47060. var $1;
  47061. $1=self["@outerContext"];
  47062. return $1;
  47063. },
  47064. //>>excludeStart("ide", pragmas.excludeIdeData);
  47065. args: [],
  47066. source: "outerContext\x0a\x09^ outerContext",
  47067. referencedClasses: [],
  47068. //>>excludeEnd("ide");
  47069. messageSends: []
  47070. }),
  47071. globals.AIContext);
  47072. smalltalk.addMethod(
  47073. smalltalk.method({
  47074. selector: "outerContext:",
  47075. protocol: 'accessing',
  47076. fn: function (anAIContext){
  47077. var self=this;
  47078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47079. return smalltalk.withContext(function($ctx1) {
  47080. //>>excludeEnd("ctx");
  47081. var $1,$receiver;
  47082. self["@outerContext"]=anAIContext;
  47083. $1=self["@outerContext"];
  47084. if(($receiver = $1) == null || $receiver.isNil){
  47085. $1;
  47086. } else {
  47087. var context;
  47088. context=$receiver;
  47089. _st(context)._innerContext_(self);
  47090. };
  47091. return self;
  47092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47093. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},globals.AIContext)});
  47094. //>>excludeEnd("ctx");
  47095. },
  47096. //>>excludeStart("ide", pragmas.excludeIdeData);
  47097. args: ["anAIContext"],
  47098. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  47099. referencedClasses: [],
  47100. //>>excludeEnd("ide");
  47101. messageSends: ["ifNotNil:", "innerContext:"]
  47102. }),
  47103. globals.AIContext);
  47104. smalltalk.addMethod(
  47105. smalltalk.method({
  47106. selector: "receiver:",
  47107. protocol: 'interpreting',
  47108. fn: function (anObject){
  47109. var self=this;
  47110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47111. return smalltalk.withContext(function($ctx1) {
  47112. //>>excludeEnd("ctx");
  47113. _st(self._locals())._at_put_("self",anObject);
  47114. return self;
  47115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47116. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},globals.AIContext)});
  47117. //>>excludeEnd("ctx");
  47118. },
  47119. //>>excludeStart("ide", pragmas.excludeIdeData);
  47120. args: ["anObject"],
  47121. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  47122. referencedClasses: [],
  47123. //>>excludeEnd("ide");
  47124. messageSends: ["at:put:", "locals"]
  47125. }),
  47126. globals.AIContext);
  47127. smalltalk.addMethod(
  47128. smalltalk.method({
  47129. selector: "selector",
  47130. protocol: 'accessing',
  47131. fn: function (){
  47132. var self=this;
  47133. var $1;
  47134. $1=self["@selector"];
  47135. return $1;
  47136. },
  47137. //>>excludeStart("ide", pragmas.excludeIdeData);
  47138. args: [],
  47139. source: "selector\x0a\x09^ selector",
  47140. referencedClasses: [],
  47141. //>>excludeEnd("ide");
  47142. messageSends: []
  47143. }),
  47144. globals.AIContext);
  47145. smalltalk.addMethod(
  47146. smalltalk.method({
  47147. selector: "selector:",
  47148. protocol: 'accessing',
  47149. fn: function (aString){
  47150. var self=this;
  47151. self["@selector"]=aString;
  47152. return self;
  47153. },
  47154. //>>excludeStart("ide", pragmas.excludeIdeData);
  47155. args: ["aString"],
  47156. source: "selector: aString\x0a\x09selector := aString",
  47157. referencedClasses: [],
  47158. //>>excludeEnd("ide");
  47159. messageSends: []
  47160. }),
  47161. globals.AIContext);
  47162. smalltalk.addMethod(
  47163. smalltalk.method({
  47164. selector: "sendIndexAt:",
  47165. protocol: 'accessing',
  47166. fn: function (aString){
  47167. var self=this;
  47168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47169. return smalltalk.withContext(function($ctx1) {
  47170. //>>excludeEnd("ctx");
  47171. var $1;
  47172. $1=_st(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  47173. return (0);
  47174. }));
  47175. return $1;
  47176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47177. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},globals.AIContext)});
  47178. //>>excludeEnd("ctx");
  47179. },
  47180. //>>excludeStart("ide", pragmas.excludeIdeData);
  47181. args: ["aString"],
  47182. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  47183. referencedClasses: [],
  47184. //>>excludeEnd("ide");
  47185. messageSends: ["at:ifAbsent:", "sendIndexes"]
  47186. }),
  47187. globals.AIContext);
  47188. smalltalk.addMethod(
  47189. smalltalk.method({
  47190. selector: "sendIndexes",
  47191. protocol: 'accessing',
  47192. fn: function (){
  47193. var self=this;
  47194. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  47195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47196. return smalltalk.withContext(function($ctx1) {
  47197. //>>excludeEnd("ctx");
  47198. var $2,$1,$receiver;
  47199. $2=self["@sendIndexes"];
  47200. if(($receiver = $2) == null || $receiver.isNil){
  47201. $1=_st($Dictionary())._new();
  47202. } else {
  47203. $1=$2;
  47204. };
  47205. return $1;
  47206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47207. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.AIContext)});
  47208. //>>excludeEnd("ctx");
  47209. },
  47210. //>>excludeStart("ide", pragmas.excludeIdeData);
  47211. args: [],
  47212. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  47213. referencedClasses: ["Dictionary"],
  47214. //>>excludeEnd("ide");
  47215. messageSends: ["ifNil:", "new"]
  47216. }),
  47217. globals.AIContext);
  47218. smalltalk.addMethod(
  47219. smalltalk.method({
  47220. selector: "sendIndexes:",
  47221. protocol: 'accessing',
  47222. fn: function (aDictionary){
  47223. var self=this;
  47224. self["@sendIndexes"]=aDictionary;
  47225. return self;
  47226. },
  47227. //>>excludeStart("ide", pragmas.excludeIdeData);
  47228. args: ["aDictionary"],
  47229. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  47230. referencedClasses: [],
  47231. //>>excludeEnd("ide");
  47232. messageSends: []
  47233. }),
  47234. globals.AIContext);
  47235. smalltalk.addMethod(
  47236. smalltalk.method({
  47237. selector: "setupInterpreter:",
  47238. protocol: 'interpreting',
  47239. fn: function (anInterpreter){
  47240. var self=this;
  47241. var currentNode;
  47242. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  47243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47244. return smalltalk.withContext(function($ctx1) {
  47245. //>>excludeEnd("ctx");
  47246. var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
  47247. $1=_st($ASTPCNodeVisitor())._new();
  47248. _st($1)._selector_(self._evaluatedSelector());
  47249. _st($1)._context_(self);
  47250. $2=$1;
  47251. $3=self._ast();
  47252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47253. $ctx1.sendIdx["ast"]=1;
  47254. //>>excludeEnd("ctx");
  47255. _st($2)._visit_($3);
  47256. $4=_st($1)._currentNode();
  47257. currentNode=$4;
  47258. $5=_st(self._ast())._sequenceNode();
  47259. if(($receiver = $5) == null || $receiver.isNil){
  47260. $5;
  47261. } else {
  47262. var sequence;
  47263. sequence=$receiver;
  47264. _st(_st(sequence)._temps())._do_((function(each){
  47265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47266. return smalltalk.withContext(function($ctx2) {
  47267. //>>excludeEnd("ctx");
  47268. return self._defineLocal_(each);
  47269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47270. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47271. //>>excludeEnd("ctx");
  47272. }));
  47273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47274. $ctx1.sendIdx["do:"]=1;
  47275. //>>excludeEnd("ctx");
  47276. };
  47277. _st(anInterpreter)._node_(currentNode);
  47278. $8=self._innerContext();
  47279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47280. $ctx1.sendIdx["innerContext"]=1;
  47281. //>>excludeEnd("ctx");
  47282. $7=_st($8)._arguments();
  47283. $6=_st($7)._reversed();
  47284. _st($6)._do_((function(each){
  47285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47286. return smalltalk.withContext(function($ctx2) {
  47287. //>>excludeEnd("ctx");
  47288. return _st(anInterpreter)._push_(each);
  47289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47290. $ctx2.sendIdx["push:"]=1;
  47291. //>>excludeEnd("ctx");
  47292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  47294. //>>excludeEnd("ctx");
  47295. }));
  47296. _st(anInterpreter)._push_(_st(self._innerContext())._receiver());
  47297. return self;
  47298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47299. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},globals.AIContext)});
  47300. //>>excludeEnd("ctx");
  47301. },
  47302. //>>excludeStart("ide", pragmas.excludeIdeData);
  47303. args: ["anInterpreter"],
  47304. source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  47305. referencedClasses: ["ASTPCNodeVisitor"],
  47306. //>>excludeEnd("ide");
  47307. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  47308. }),
  47309. globals.AIContext);
  47310. smalltalk.addMethod(
  47311. smalltalk.method({
  47312. selector: "supercall",
  47313. protocol: 'interpreting',
  47314. fn: function (){
  47315. var self=this;
  47316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47317. return smalltalk.withContext(function($ctx1) {
  47318. //>>excludeEnd("ctx");
  47319. var $2,$1,$receiver;
  47320. $2=self["@supercall"];
  47321. if(($receiver = $2) == null || $receiver.isNil){
  47322. $1=false;
  47323. } else {
  47324. $1=$2;
  47325. };
  47326. return $1;
  47327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47328. }, function($ctx1) {$ctx1.fill(self,"supercall",{},globals.AIContext)});
  47329. //>>excludeEnd("ctx");
  47330. },
  47331. //>>excludeStart("ide", pragmas.excludeIdeData);
  47332. args: [],
  47333. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  47334. referencedClasses: [],
  47335. //>>excludeEnd("ide");
  47336. messageSends: ["ifNil:"]
  47337. }),
  47338. globals.AIContext);
  47339. smalltalk.addMethod(
  47340. smalltalk.method({
  47341. selector: "supercall:",
  47342. protocol: 'interpreting',
  47343. fn: function (aBoolean){
  47344. var self=this;
  47345. self["@supercall"]=aBoolean;
  47346. return self;
  47347. },
  47348. //>>excludeStart("ide", pragmas.excludeIdeData);
  47349. args: ["aBoolean"],
  47350. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  47351. referencedClasses: [],
  47352. //>>excludeEnd("ide");
  47353. messageSends: []
  47354. }),
  47355. globals.AIContext);
  47356. smalltalk.addMethod(
  47357. smalltalk.method({
  47358. selector: "variableNotFound",
  47359. protocol: 'error handling',
  47360. fn: function (){
  47361. var self=this;
  47362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47363. return smalltalk.withContext(function($ctx1) {
  47364. //>>excludeEnd("ctx");
  47365. self._error_("Variable missing");
  47366. return self;
  47367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47368. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},globals.AIContext)});
  47369. //>>excludeEnd("ctx");
  47370. },
  47371. //>>excludeStart("ide", pragmas.excludeIdeData);
  47372. args: [],
  47373. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  47374. referencedClasses: [],
  47375. //>>excludeEnd("ide");
  47376. messageSends: ["error:"]
  47377. }),
  47378. globals.AIContext);
  47379. smalltalk.addMethod(
  47380. smalltalk.method({
  47381. selector: "fromMethodContext:",
  47382. protocol: 'instance creation',
  47383. fn: function (aMethodContext){
  47384. var self=this;
  47385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47386. return smalltalk.withContext(function($ctx1) {
  47387. //>>excludeEnd("ctx");
  47388. var $2,$3,$1;
  47389. $2=self._new();
  47390. _st($2)._initializeFromMethodContext_(aMethodContext);
  47391. $3=_st($2)._yourself();
  47392. $1=$3;
  47393. return $1;
  47394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47395. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext.klass)});
  47396. //>>excludeEnd("ctx");
  47397. },
  47398. //>>excludeStart("ide", pragmas.excludeIdeData);
  47399. args: ["aMethodContext"],
  47400. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  47401. referencedClasses: [],
  47402. //>>excludeEnd("ide");
  47403. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  47404. }),
  47405. globals.AIContext.klass);
  47406. smalltalk.addClass('AISemanticAnalyzer', globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  47407. //>>excludeStart("ide", pragmas.excludeIdeData);
  47408. globals.AISemanticAnalyzer.comment="I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables.";
  47409. //>>excludeEnd("ide");
  47410. smalltalk.addMethod(
  47411. smalltalk.method({
  47412. selector: "context",
  47413. protocol: 'accessing',
  47414. fn: function (){
  47415. var self=this;
  47416. var $1;
  47417. $1=self["@context"];
  47418. return $1;
  47419. },
  47420. //>>excludeStart("ide", pragmas.excludeIdeData);
  47421. args: [],
  47422. source: "context\x0a\x09^ context",
  47423. referencedClasses: [],
  47424. //>>excludeEnd("ide");
  47425. messageSends: []
  47426. }),
  47427. globals.AISemanticAnalyzer);
  47428. smalltalk.addMethod(
  47429. smalltalk.method({
  47430. selector: "context:",
  47431. protocol: 'accessing',
  47432. fn: function (anAIContext){
  47433. var self=this;
  47434. self["@context"]=anAIContext;
  47435. return self;
  47436. },
  47437. //>>excludeStart("ide", pragmas.excludeIdeData);
  47438. args: ["anAIContext"],
  47439. source: "context: anAIContext\x0a\x09context := anAIContext",
  47440. referencedClasses: [],
  47441. //>>excludeEnd("ide");
  47442. messageSends: []
  47443. }),
  47444. globals.AISemanticAnalyzer);
  47445. smalltalk.addMethod(
  47446. smalltalk.method({
  47447. selector: "visitVariableNode:",
  47448. protocol: 'visiting',
  47449. fn: function (aNode){
  47450. var self=this;
  47451. function $ASTContextVar(){return globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
  47452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47453. return smalltalk.withContext(function($ctx1) {
  47454. //>>excludeEnd("ctx");
  47455. var $1;
  47456. var $early={};
  47457. try {
  47458. _st(self._context())._localAt_ifAbsent_(_st(aNode)._value(),(function(){
  47459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47460. return smalltalk.withContext(function($ctx2) {
  47461. //>>excludeEnd("ctx");
  47462. $1=(
  47463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47464. $ctx2.supercall = true,
  47465. //>>excludeEnd("ctx");
  47466. globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply(_st(self), [aNode]));
  47467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47468. $ctx2.supercall = false;
  47469. //>>excludeEnd("ctx");;
  47470. throw $early=[$1];
  47471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47473. //>>excludeEnd("ctx");
  47474. }));
  47475. _st(aNode)._binding_(_st($ASTContextVar())._new());
  47476. return self;
  47477. }
  47478. catch(e) {if(e===$early)return e[0]; throw e}
  47479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47480. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.AISemanticAnalyzer)});
  47481. //>>excludeEnd("ctx");
  47482. },
  47483. //>>excludeStart("ide", pragmas.excludeIdeData);
  47484. args: ["aNode"],
  47485. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  47486. referencedClasses: ["ASTContextVar"],
  47487. //>>excludeEnd("ide");
  47488. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  47489. }),
  47490. globals.AISemanticAnalyzer);
  47491. smalltalk.addClass('ASTContextVar', globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  47492. //>>excludeStart("ide", pragmas.excludeIdeData);
  47493. globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  47494. //>>excludeEnd("ide");
  47495. smalltalk.addMethod(
  47496. smalltalk.method({
  47497. selector: "context",
  47498. protocol: 'accessing',
  47499. fn: function (){
  47500. var self=this;
  47501. var $1;
  47502. $1=self["@context"];
  47503. return $1;
  47504. },
  47505. //>>excludeStart("ide", pragmas.excludeIdeData);
  47506. args: [],
  47507. source: "context\x0a\x09^ context",
  47508. referencedClasses: [],
  47509. //>>excludeEnd("ide");
  47510. messageSends: []
  47511. }),
  47512. globals.ASTContextVar);
  47513. smalltalk.addMethod(
  47514. smalltalk.method({
  47515. selector: "context:",
  47516. protocol: 'accessing',
  47517. fn: function (anObject){
  47518. var self=this;
  47519. self["@context"]=anObject;
  47520. return self;
  47521. },
  47522. //>>excludeStart("ide", pragmas.excludeIdeData);
  47523. args: ["anObject"],
  47524. source: "context: anObject\x0a\x09context := anObject",
  47525. referencedClasses: [],
  47526. //>>excludeEnd("ide");
  47527. messageSends: []
  47528. }),
  47529. globals.ASTContextVar);
  47530. smalltalk.addClass('ASTDebugger', globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  47531. //>>excludeStart("ide", pragmas.excludeIdeData);
  47532. globals.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping.";
  47533. //>>excludeEnd("ide");
  47534. smalltalk.addMethod(
  47535. smalltalk.method({
  47536. selector: "atEnd",
  47537. protocol: 'testing',
  47538. fn: function (){
  47539. var self=this;
  47540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47541. return smalltalk.withContext(function($ctx1) {
  47542. //>>excludeEnd("ctx");
  47543. var $1,$2,$receiver;
  47544. $1=self._context();
  47545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47546. $ctx1.sendIdx["context"]=1;
  47547. //>>excludeEnd("ctx");
  47548. if(($receiver = $1) == null || $receiver.isNil){
  47549. return true;
  47550. } else {
  47551. $1;
  47552. };
  47553. $2=_st(_st(self._interpreter())._atEnd())._and_((function(){
  47554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47555. return smalltalk.withContext(function($ctx2) {
  47556. //>>excludeEnd("ctx");
  47557. return _st(self._context())._isTopContext();
  47558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47560. //>>excludeEnd("ctx");
  47561. }));
  47562. return $2;
  47563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47564. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTDebugger)});
  47565. //>>excludeEnd("ctx");
  47566. },
  47567. //>>excludeStart("ide", pragmas.excludeIdeData);
  47568. args: [],
  47569. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  47570. referencedClasses: [],
  47571. //>>excludeEnd("ide");
  47572. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  47573. }),
  47574. globals.ASTDebugger);
  47575. smalltalk.addMethod(
  47576. smalltalk.method({
  47577. selector: "context",
  47578. protocol: 'accessing',
  47579. fn: function (){
  47580. var self=this;
  47581. var $1;
  47582. $1=self["@context"];
  47583. return $1;
  47584. },
  47585. //>>excludeStart("ide", pragmas.excludeIdeData);
  47586. args: [],
  47587. source: "context\x0a\x09^ context",
  47588. referencedClasses: [],
  47589. //>>excludeEnd("ide");
  47590. messageSends: []
  47591. }),
  47592. globals.ASTDebugger);
  47593. smalltalk.addMethod(
  47594. smalltalk.method({
  47595. selector: "context:",
  47596. protocol: 'accessing',
  47597. fn: function (aContext){
  47598. var self=this;
  47599. self["@context"]=aContext;
  47600. return self;
  47601. },
  47602. //>>excludeStart("ide", pragmas.excludeIdeData);
  47603. args: ["aContext"],
  47604. source: "context: aContext\x0a\x09context := aContext",
  47605. referencedClasses: [],
  47606. //>>excludeEnd("ide");
  47607. messageSends: []
  47608. }),
  47609. globals.ASTDebugger);
  47610. smalltalk.addMethod(
  47611. smalltalk.method({
  47612. selector: "flushInnerContexts",
  47613. protocol: 'actions',
  47614. fn: function (){
  47615. var self=this;
  47616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47617. return smalltalk.withContext(function($ctx1) {
  47618. //>>excludeEnd("ctx");
  47619. var $1,$receiver;
  47620. $1=self._context();
  47621. if(($receiver = $1) == null || $receiver.isNil){
  47622. $1;
  47623. } else {
  47624. var cxt;
  47625. cxt=$receiver;
  47626. _st(cxt)._innerContext_(nil);
  47627. };
  47628. return self;
  47629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47630. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},globals.ASTDebugger)});
  47631. //>>excludeEnd("ctx");
  47632. },
  47633. //>>excludeStart("ide", pragmas.excludeIdeData);
  47634. args: [],
  47635. source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self context ifNotNil: [ :cxt | \x0a\x09\x09cxt innerContext: nil ]",
  47636. referencedClasses: [],
  47637. //>>excludeEnd("ide");
  47638. messageSends: ["ifNotNil:", "context", "innerContext:"]
  47639. }),
  47640. globals.ASTDebugger);
  47641. smalltalk.addMethod(
  47642. smalltalk.method({
  47643. selector: "interpreter",
  47644. protocol: 'accessing',
  47645. fn: function (){
  47646. var self=this;
  47647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47648. return smalltalk.withContext(function($ctx1) {
  47649. //>>excludeEnd("ctx");
  47650. var $2,$1,$receiver;
  47651. $2=self._context();
  47652. if(($receiver = $2) == null || $receiver.isNil){
  47653. $1=$2;
  47654. } else {
  47655. var ctx;
  47656. ctx=$receiver;
  47657. $1=_st(ctx)._interpreter();
  47658. };
  47659. return $1;
  47660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47661. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.ASTDebugger)});
  47662. //>>excludeEnd("ctx");
  47663. },
  47664. //>>excludeStart("ide", pragmas.excludeIdeData);
  47665. args: [],
  47666. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  47667. referencedClasses: [],
  47668. //>>excludeEnd("ide");
  47669. messageSends: ["ifNotNil:", "context", "interpreter"]
  47670. }),
  47671. globals.ASTDebugger);
  47672. smalltalk.addMethod(
  47673. smalltalk.method({
  47674. selector: "method",
  47675. protocol: 'accessing',
  47676. fn: function (){
  47677. var self=this;
  47678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47679. return smalltalk.withContext(function($ctx1) {
  47680. //>>excludeEnd("ctx");
  47681. var $1;
  47682. $1=_st(self._context())._method();
  47683. return $1;
  47684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47685. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.ASTDebugger)});
  47686. //>>excludeEnd("ctx");
  47687. },
  47688. //>>excludeStart("ide", pragmas.excludeIdeData);
  47689. args: [],
  47690. source: "method\x0a\x09^ self context method",
  47691. referencedClasses: [],
  47692. //>>excludeEnd("ide");
  47693. messageSends: ["method", "context"]
  47694. }),
  47695. globals.ASTDebugger);
  47696. smalltalk.addMethod(
  47697. smalltalk.method({
  47698. selector: "node",
  47699. protocol: 'accessing',
  47700. fn: function (){
  47701. var self=this;
  47702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47703. return smalltalk.withContext(function($ctx1) {
  47704. //>>excludeEnd("ctx");
  47705. var $2,$1,$receiver;
  47706. $2=self._interpreter();
  47707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47708. $ctx1.sendIdx["interpreter"]=1;
  47709. //>>excludeEnd("ctx");
  47710. if(($receiver = $2) == null || $receiver.isNil){
  47711. $1=$2;
  47712. } else {
  47713. $1=_st(self._interpreter())._node();
  47714. };
  47715. return $1;
  47716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47717. }, function($ctx1) {$ctx1.fill(self,"node",{},globals.ASTDebugger)});
  47718. //>>excludeEnd("ctx");
  47719. },
  47720. //>>excludeStart("ide", pragmas.excludeIdeData);
  47721. args: [],
  47722. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  47723. referencedClasses: [],
  47724. //>>excludeEnd("ide");
  47725. messageSends: ["ifNotNil:", "interpreter", "node"]
  47726. }),
  47727. globals.ASTDebugger);
  47728. smalltalk.addMethod(
  47729. smalltalk.method({
  47730. selector: "onStep",
  47731. protocol: 'private',
  47732. fn: function (){
  47733. var self=this;
  47734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47735. return smalltalk.withContext(function($ctx1) {
  47736. //>>excludeEnd("ctx");
  47737. var $1,$3,$2,$4,$6,$5,$receiver;
  47738. $1=self._interpreter();
  47739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47740. $ctx1.sendIdx["interpreter"]=1;
  47741. //>>excludeEnd("ctx");
  47742. self["@result"]=_st($1)._result();
  47743. $3=self._interpreter();
  47744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47745. $ctx1.sendIdx["interpreter"]=2;
  47746. //>>excludeEnd("ctx");
  47747. $2=_st($3)._atEnd();
  47748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47749. $ctx1.sendIdx["atEnd"]=1;
  47750. //>>excludeEnd("ctx");
  47751. if(smalltalk.assert($2)){
  47752. $4=_st(self._context())._outerContext();
  47753. if(($receiver = $4) == null || $receiver.isNil){
  47754. $4;
  47755. } else {
  47756. var outerContext;
  47757. outerContext=$receiver;
  47758. self._context_(outerContext);
  47759. };
  47760. $6=self._interpreter();
  47761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47762. $ctx1.sendIdx["interpreter"]=3;
  47763. //>>excludeEnd("ctx");
  47764. $5=_st($6)._atEnd();
  47765. if(! smalltalk.assert($5)){
  47766. _st(self._interpreter())._skip();
  47767. };
  47768. };
  47769. self._flushInnerContexts();
  47770. return self;
  47771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47772. }, function($ctx1) {$ctx1.fill(self,"onStep",{},globals.ASTDebugger)});
  47773. //>>excludeEnd("ctx");
  47774. },
  47775. //>>excludeStart("ide", pragmas.excludeIdeData);
  47776. args: [],
  47777. source: "onStep\x0a\x09\x22After each step, check if the interpreter is at the end,\x0a\x09and if it is move to its outer context if any, skipping its \x0a\x09current node (which was just evaluated by the current \x0a\x09interpreter).\x0a\x09\x0a\x09After each step we also flush inner contexts.\x22\x0a\x09\x0a\x09result := self interpreter result.\x0a\x09\x0a\x09self interpreter atEnd ifTrue: [\x0a\x09\x09self context outerContext ifNotNil: [ :outerContext | \x0a\x09\x09\x09self context: outerContext ].\x0a\x09\x09self interpreter atEnd ifFalse: [ self interpreter skip ] ].\x0a\x09\x09\x0a\x09self flushInnerContexts",
  47778. referencedClasses: [],
  47779. //>>excludeEnd("ide");
  47780. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  47781. }),
  47782. globals.ASTDebugger);
  47783. smalltalk.addMethod(
  47784. smalltalk.method({
  47785. selector: "proceed",
  47786. protocol: 'stepping',
  47787. fn: function (){
  47788. var self=this;
  47789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47790. return smalltalk.withContext(function($ctx1) {
  47791. //>>excludeEnd("ctx");
  47792. _st((function(){
  47793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47794. return smalltalk.withContext(function($ctx2) {
  47795. //>>excludeEnd("ctx");
  47796. return self._atEnd();
  47797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47799. //>>excludeEnd("ctx");
  47800. }))._whileFalse_((function(){
  47801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47802. return smalltalk.withContext(function($ctx2) {
  47803. //>>excludeEnd("ctx");
  47804. return self._stepOver();
  47805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47807. //>>excludeEnd("ctx");
  47808. }));
  47809. return self;
  47810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47811. }, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTDebugger)});
  47812. //>>excludeEnd("ctx");
  47813. },
  47814. //>>excludeStart("ide", pragmas.excludeIdeData);
  47815. args: [],
  47816. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  47817. referencedClasses: [],
  47818. //>>excludeEnd("ide");
  47819. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  47820. }),
  47821. globals.ASTDebugger);
  47822. smalltalk.addMethod(
  47823. smalltalk.method({
  47824. selector: "restart",
  47825. protocol: 'stepping',
  47826. fn: function (){
  47827. var self=this;
  47828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47829. return smalltalk.withContext(function($ctx1) {
  47830. //>>excludeEnd("ctx");
  47831. _st(self._interpreter())._restart();
  47832. self._flushInnerContexts();
  47833. return self;
  47834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47835. }, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTDebugger)});
  47836. //>>excludeEnd("ctx");
  47837. },
  47838. //>>excludeStart("ide", pragmas.excludeIdeData);
  47839. args: [],
  47840. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  47841. referencedClasses: [],
  47842. //>>excludeEnd("ide");
  47843. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  47844. }),
  47845. globals.ASTDebugger);
  47846. smalltalk.addMethod(
  47847. smalltalk.method({
  47848. selector: "result",
  47849. protocol: 'accessing',
  47850. fn: function (){
  47851. var self=this;
  47852. var $1;
  47853. $1=self["@result"];
  47854. return $1;
  47855. },
  47856. //>>excludeStart("ide", pragmas.excludeIdeData);
  47857. args: [],
  47858. source: "result\x0a\x09^ result",
  47859. referencedClasses: [],
  47860. //>>excludeEnd("ide");
  47861. messageSends: []
  47862. }),
  47863. globals.ASTDebugger);
  47864. smalltalk.addMethod(
  47865. smalltalk.method({
  47866. selector: "stepInto",
  47867. protocol: 'stepping',
  47868. fn: function (){
  47869. var self=this;
  47870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47871. return smalltalk.withContext(function($ctx1) {
  47872. //>>excludeEnd("ctx");
  47873. self._shouldBeImplemented();
  47874. return self;
  47875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47876. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},globals.ASTDebugger)});
  47877. //>>excludeEnd("ctx");
  47878. },
  47879. //>>excludeStart("ide", pragmas.excludeIdeData);
  47880. args: [],
  47881. source: "stepInto\x0a\x09self shouldBeImplemented",
  47882. referencedClasses: [],
  47883. //>>excludeEnd("ide");
  47884. messageSends: ["shouldBeImplemented"]
  47885. }),
  47886. globals.ASTDebugger);
  47887. smalltalk.addMethod(
  47888. smalltalk.method({
  47889. selector: "stepOver",
  47890. protocol: 'stepping',
  47891. fn: function (){
  47892. var self=this;
  47893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47894. return smalltalk.withContext(function($ctx1) {
  47895. //>>excludeEnd("ctx");
  47896. var $1,$2;
  47897. $1=_st(self._context())._isTopContext();
  47898. if(smalltalk.assert($1)){
  47899. _st(self._interpreter())._stepOver();
  47900. } else {
  47901. $2=self._interpreter();
  47902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47903. $ctx1.sendIdx["interpreter"]=1;
  47904. //>>excludeEnd("ctx");
  47905. _st($2)._skip();
  47906. };
  47907. self._onStep();
  47908. return self;
  47909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47910. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTDebugger)});
  47911. //>>excludeEnd("ctx");
  47912. },
  47913. //>>excludeStart("ide", pragmas.excludeIdeData);
  47914. args: [],
  47915. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  47916. referencedClasses: [],
  47917. //>>excludeEnd("ide");
  47918. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  47919. }),
  47920. globals.ASTDebugger);
  47921. smalltalk.addMethod(
  47922. smalltalk.method({
  47923. selector: "context:",
  47924. protocol: 'instance creation',
  47925. fn: function (aContext){
  47926. var self=this;
  47927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47928. return smalltalk.withContext(function($ctx1) {
  47929. //>>excludeEnd("ctx");
  47930. var $2,$3,$1;
  47931. $2=self._new();
  47932. _st($2)._context_(aContext);
  47933. $3=_st($2)._yourself();
  47934. $1=$3;
  47935. return $1;
  47936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47937. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},globals.ASTDebugger.klass)});
  47938. //>>excludeEnd("ctx");
  47939. },
  47940. //>>excludeStart("ide", pragmas.excludeIdeData);
  47941. args: ["aContext"],
  47942. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  47943. referencedClasses: [],
  47944. //>>excludeEnd("ide");
  47945. messageSends: ["context:", "new", "yourself"]
  47946. }),
  47947. globals.ASTDebugger.klass);
  47948. smalltalk.addClass('ASTInterpreter', globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  47949. //>>excludeStart("ide", pragmas.excludeIdeData);
  47950. globals.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
  47951. //>>excludeEnd("ide");
  47952. smalltalk.addMethod(
  47953. smalltalk.method({
  47954. selector: "assign:to:",
  47955. protocol: 'private',
  47956. fn: function (aNode,anObject){
  47957. var self=this;
  47958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47959. return smalltalk.withContext(function($ctx1) {
  47960. //>>excludeEnd("ctx");
  47961. var $1,$3,$2,$4;
  47962. $1=_st(_st(aNode)._binding())._isInstanceVar();
  47963. if(smalltalk.assert($1)){
  47964. $3=self._context();
  47965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47966. $ctx1.sendIdx["context"]=1;
  47967. //>>excludeEnd("ctx");
  47968. $2=_st($3)._receiver();
  47969. $4=_st(aNode)._value();
  47970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47971. $ctx1.sendIdx["value"]=1;
  47972. //>>excludeEnd("ctx");
  47973. _st($2)._instVarAt_put_($4,anObject);
  47974. } else {
  47975. _st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
  47976. };
  47977. return self;
  47978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47979. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},globals.ASTInterpreter)});
  47980. //>>excludeEnd("ctx");
  47981. },
  47982. //>>excludeStart("ide", pragmas.excludeIdeData);
  47983. args: ["aNode", "anObject"],
  47984. source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  47985. referencedClasses: [],
  47986. //>>excludeEnd("ide");
  47987. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  47988. }),
  47989. globals.ASTInterpreter);
  47990. smalltalk.addMethod(
  47991. smalltalk.method({
  47992. selector: "atEnd",
  47993. protocol: 'testing',
  47994. fn: function (){
  47995. var self=this;
  47996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47997. return smalltalk.withContext(function($ctx1) {
  47998. //>>excludeEnd("ctx");
  47999. var $1,$2;
  48000. $1=self["@forceAtEnd"];
  48001. if(smalltalk.assert($1)){
  48002. return true;
  48003. };
  48004. $2=_st(self._hasReturned())._or_((function(){
  48005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48006. return smalltalk.withContext(function($ctx2) {
  48007. //>>excludeEnd("ctx");
  48008. return _st(self._node())._isNil();
  48009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48011. //>>excludeEnd("ctx");
  48012. }));
  48013. return $2;
  48014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48015. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTInterpreter)});
  48016. //>>excludeEnd("ctx");
  48017. },
  48018. //>>excludeStart("ide", pragmas.excludeIdeData);
  48019. args: [],
  48020. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  48021. referencedClasses: [],
  48022. //>>excludeEnd("ide");
  48023. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  48024. }),
  48025. globals.ASTInterpreter);
  48026. smalltalk.addMethod(
  48027. smalltalk.method({
  48028. selector: "context",
  48029. protocol: 'accessing',
  48030. fn: function (){
  48031. var self=this;
  48032. var $1;
  48033. $1=self["@context"];
  48034. return $1;
  48035. },
  48036. //>>excludeStart("ide", pragmas.excludeIdeData);
  48037. args: [],
  48038. source: "context\x0a\x09^ context",
  48039. referencedClasses: [],
  48040. //>>excludeEnd("ide");
  48041. messageSends: []
  48042. }),
  48043. globals.ASTInterpreter);
  48044. smalltalk.addMethod(
  48045. smalltalk.method({
  48046. selector: "context:",
  48047. protocol: 'accessing',
  48048. fn: function (aContext){
  48049. var self=this;
  48050. self["@context"]=aContext;
  48051. return self;
  48052. },
  48053. //>>excludeStart("ide", pragmas.excludeIdeData);
  48054. args: ["aContext"],
  48055. source: "context: aContext\x0a\x09context := aContext",
  48056. referencedClasses: [],
  48057. //>>excludeEnd("ide");
  48058. messageSends: []
  48059. }),
  48060. globals.ASTInterpreter);
  48061. smalltalk.addMethod(
  48062. smalltalk.method({
  48063. selector: "eval:",
  48064. protocol: 'private',
  48065. fn: function (aString){
  48066. var self=this;
  48067. var source,function_;
  48068. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  48069. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  48070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48071. return smalltalk.withContext(function($ctx1) {
  48072. //>>excludeEnd("ctx");
  48073. var $3,$2,$1,$4,$5;
  48074. source=_st($String())._streamContents_((function(str){
  48075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48076. return smalltalk.withContext(function($ctx2) {
  48077. //>>excludeEnd("ctx");
  48078. _st(str)._nextPutAll_("(function(");
  48079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48080. $ctx2.sendIdx["nextPutAll:"]=1;
  48081. //>>excludeEnd("ctx");
  48082. $3=self._context();
  48083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48084. $ctx2.sendIdx["context"]=1;
  48085. //>>excludeEnd("ctx");
  48086. $2=_st($3)._locals();
  48087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48088. $ctx2.sendIdx["locals"]=1;
  48089. //>>excludeEnd("ctx");
  48090. $1=_st($2)._keys();
  48091. _st($1)._do_separatedBy_((function(each){
  48092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48093. return smalltalk.withContext(function($ctx3) {
  48094. //>>excludeEnd("ctx");
  48095. return _st(str)._nextPutAll_(each);
  48096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48097. $ctx3.sendIdx["nextPutAll:"]=2;
  48098. //>>excludeEnd("ctx");
  48099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48100. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  48101. //>>excludeEnd("ctx");
  48102. }),(function(){
  48103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48104. return smalltalk.withContext(function($ctx3) {
  48105. //>>excludeEnd("ctx");
  48106. return _st(str)._nextPutAll_(",");
  48107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48108. $ctx3.sendIdx["nextPutAll:"]=3;
  48109. //>>excludeEnd("ctx");
  48110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48111. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  48112. //>>excludeEnd("ctx");
  48113. }));
  48114. _st(str)._nextPutAll_("){ return (function() {");
  48115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48116. $ctx2.sendIdx["nextPutAll:"]=4;
  48117. //>>excludeEnd("ctx");
  48118. _st(str)._nextPutAll_(aString);
  48119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48120. $ctx2.sendIdx["nextPutAll:"]=5;
  48121. //>>excludeEnd("ctx");
  48122. $4=_st(str)._nextPutAll_("})() })");
  48123. return $4;
  48124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48125. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  48126. //>>excludeEnd("ctx");
  48127. }));
  48128. function_=_st(_st($Compiler())._new())._eval_(source);
  48129. $5=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
  48130. return $5;
  48131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48132. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},globals.ASTInterpreter)});
  48133. //>>excludeEnd("ctx");
  48134. },
  48135. //>>excludeStart("ide", pragmas.excludeIdeData);
  48136. args: ["aString"],
  48137. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})() })' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  48138. referencedClasses: ["String", "Compiler"],
  48139. //>>excludeEnd("ide");
  48140. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  48141. }),
  48142. globals.ASTInterpreter);
  48143. smalltalk.addMethod(
  48144. smalltalk.method({
  48145. selector: "hasReturned",
  48146. protocol: 'testing',
  48147. fn: function (){
  48148. var self=this;
  48149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48150. return smalltalk.withContext(function($ctx1) {
  48151. //>>excludeEnd("ctx");
  48152. var $2,$1,$receiver;
  48153. $2=self["@returned"];
  48154. if(($receiver = $2) == null || $receiver.isNil){
  48155. $1=false;
  48156. } else {
  48157. $1=$2;
  48158. };
  48159. return $1;
  48160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48161. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},globals.ASTInterpreter)});
  48162. //>>excludeEnd("ctx");
  48163. },
  48164. //>>excludeStart("ide", pragmas.excludeIdeData);
  48165. args: [],
  48166. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  48167. referencedClasses: [],
  48168. //>>excludeEnd("ide");
  48169. messageSends: ["ifNil:"]
  48170. }),
  48171. globals.ASTInterpreter);
  48172. smalltalk.addMethod(
  48173. smalltalk.method({
  48174. selector: "initialize",
  48175. protocol: 'initialization',
  48176. fn: function (){
  48177. var self=this;
  48178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48179. return smalltalk.withContext(function($ctx1) {
  48180. //>>excludeEnd("ctx");
  48181. (
  48182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48183. $ctx1.supercall = true,
  48184. //>>excludeEnd("ctx");
  48185. globals.ASTInterpreter.superclass.fn.prototype._initialize.apply(_st(self), []));
  48186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48187. $ctx1.supercall = false;
  48188. //>>excludeEnd("ctx");;
  48189. self["@forceAtEnd"]=false;
  48190. return self;
  48191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48192. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ASTInterpreter)});
  48193. //>>excludeEnd("ctx");
  48194. },
  48195. //>>excludeStart("ide", pragmas.excludeIdeData);
  48196. args: [],
  48197. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  48198. referencedClasses: [],
  48199. //>>excludeEnd("ide");
  48200. messageSends: ["initialize"]
  48201. }),
  48202. globals.ASTInterpreter);
  48203. smalltalk.addMethod(
  48204. smalltalk.method({
  48205. selector: "interpret",
  48206. protocol: 'interpreting',
  48207. fn: function (){
  48208. var self=this;
  48209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48210. return smalltalk.withContext(function($ctx1) {
  48211. //>>excludeEnd("ctx");
  48212. self._visit_(self._node());
  48213. return self;
  48214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48215. }, function($ctx1) {$ctx1.fill(self,"interpret",{},globals.ASTInterpreter)});
  48216. //>>excludeEnd("ctx");
  48217. },
  48218. //>>excludeStart("ide", pragmas.excludeIdeData);
  48219. args: [],
  48220. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  48221. referencedClasses: [],
  48222. //>>excludeEnd("ide");
  48223. messageSends: ["visit:", "node"]
  48224. }),
  48225. globals.ASTInterpreter);
  48226. smalltalk.addMethod(
  48227. smalltalk.method({
  48228. selector: "interpret:",
  48229. protocol: 'interpreting',
  48230. fn: function (aNode){
  48231. var self=this;
  48232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48233. return smalltalk.withContext(function($ctx1) {
  48234. //>>excludeEnd("ctx");
  48235. self._node_(aNode);
  48236. self._interpret();
  48237. return self;
  48238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48239. }, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},globals.ASTInterpreter)});
  48240. //>>excludeEnd("ctx");
  48241. },
  48242. //>>excludeStart("ide", pragmas.excludeIdeData);
  48243. args: ["aNode"],
  48244. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  48245. referencedClasses: [],
  48246. //>>excludeEnd("ide");
  48247. messageSends: ["node:", "interpret"]
  48248. }),
  48249. globals.ASTInterpreter);
  48250. smalltalk.addMethod(
  48251. smalltalk.method({
  48252. selector: "messageFromSendNode:arguments:",
  48253. protocol: 'private',
  48254. fn: function (aSendNode,aCollection){
  48255. var self=this;
  48256. function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
  48257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48258. return smalltalk.withContext(function($ctx1) {
  48259. //>>excludeEnd("ctx");
  48260. var $2,$3,$1;
  48261. $2=_st($Message())._new();
  48262. _st($2)._selector_(_st(aSendNode)._selector());
  48263. _st($2)._arguments_(aCollection);
  48264. $3=_st($2)._yourself();
  48265. $1=$3;
  48266. return $1;
  48267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48268. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},globals.ASTInterpreter)});
  48269. //>>excludeEnd("ctx");
  48270. },
  48271. //>>excludeStart("ide", pragmas.excludeIdeData);
  48272. args: ["aSendNode", "aCollection"],
  48273. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  48274. referencedClasses: ["Message"],
  48275. //>>excludeEnd("ide");
  48276. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  48277. }),
  48278. globals.ASTInterpreter);
  48279. smalltalk.addMethod(
  48280. smalltalk.method({
  48281. selector: "messageNotUnderstood:receiver:",
  48282. protocol: 'private',
  48283. fn: function (aMessage,anObject){
  48284. var self=this;
  48285. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  48286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48287. return smalltalk.withContext(function($ctx1) {
  48288. //>>excludeEnd("ctx");
  48289. var $1,$2;
  48290. $1=_st($MessageNotUnderstood())._new();
  48291. _st($1)._meesage_(aMessage);
  48292. _st($1)._receiver_(anObject);
  48293. $2=_st($1)._signal();
  48294. return self;
  48295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48296. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},globals.ASTInterpreter)});
  48297. //>>excludeEnd("ctx");
  48298. },
  48299. //>>excludeStart("ide", pragmas.excludeIdeData);
  48300. args: ["aMessage", "anObject"],
  48301. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  48302. referencedClasses: ["MessageNotUnderstood"],
  48303. //>>excludeEnd("ide");
  48304. messageSends: ["meesage:", "new", "receiver:", "signal"]
  48305. }),
  48306. globals.ASTInterpreter);
  48307. smalltalk.addMethod(
  48308. smalltalk.method({
  48309. selector: "next",
  48310. protocol: 'interpreting',
  48311. fn: function (){
  48312. var self=this;
  48313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48314. return smalltalk.withContext(function($ctx1) {
  48315. //>>excludeEnd("ctx");
  48316. self._node_(_st(self._node())._nextNode());
  48317. return self;
  48318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48319. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.ASTInterpreter)});
  48320. //>>excludeEnd("ctx");
  48321. },
  48322. //>>excludeStart("ide", pragmas.excludeIdeData);
  48323. args: [],
  48324. source: "next\x0a\x09self node: self node nextNode",
  48325. referencedClasses: [],
  48326. //>>excludeEnd("ide");
  48327. messageSends: ["node:", "nextNode", "node"]
  48328. }),
  48329. globals.ASTInterpreter);
  48330. smalltalk.addMethod(
  48331. smalltalk.method({
  48332. selector: "node",
  48333. protocol: 'accessing',
  48334. fn: function (){
  48335. var self=this;
  48336. var $1;
  48337. $1=self["@node"];
  48338. return $1;
  48339. },
  48340. //>>excludeStart("ide", pragmas.excludeIdeData);
  48341. args: [],
  48342. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  48343. referencedClasses: [],
  48344. //>>excludeEnd("ide");
  48345. messageSends: []
  48346. }),
  48347. globals.ASTInterpreter);
  48348. smalltalk.addMethod(
  48349. smalltalk.method({
  48350. selector: "node:",
  48351. protocol: 'accessing',
  48352. fn: function (aNode){
  48353. var self=this;
  48354. self["@node"]=aNode;
  48355. return self;
  48356. },
  48357. //>>excludeStart("ide", pragmas.excludeIdeData);
  48358. args: ["aNode"],
  48359. source: "node: aNode\x0a\x09node := aNode",
  48360. referencedClasses: [],
  48361. //>>excludeEnd("ide");
  48362. messageSends: []
  48363. }),
  48364. globals.ASTInterpreter);
  48365. smalltalk.addMethod(
  48366. smalltalk.method({
  48367. selector: "peek",
  48368. protocol: 'stack',
  48369. fn: function (){
  48370. var self=this;
  48371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48372. return smalltalk.withContext(function($ctx1) {
  48373. //>>excludeEnd("ctx");
  48374. var $1,$2;
  48375. var $early={};
  48376. try {
  48377. $1=self._stack();
  48378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48379. $ctx1.sendIdx["stack"]=1;
  48380. //>>excludeEnd("ctx");
  48381. _st($1)._ifEmpty_((function(){
  48382. throw $early=[nil];
  48383. }));
  48384. $2=_st(self._stack())._last();
  48385. return $2;
  48386. }
  48387. catch(e) {if(e===$early)return e[0]; throw e}
  48388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48389. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.ASTInterpreter)});
  48390. //>>excludeEnd("ctx");
  48391. },
  48392. //>>excludeStart("ide", pragmas.excludeIdeData);
  48393. args: [],
  48394. source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last",
  48395. referencedClasses: [],
  48396. //>>excludeEnd("ide");
  48397. messageSends: ["ifEmpty:", "stack", "last"]
  48398. }),
  48399. globals.ASTInterpreter);
  48400. smalltalk.addMethod(
  48401. smalltalk.method({
  48402. selector: "pop",
  48403. protocol: 'stack',
  48404. fn: function (){
  48405. var self=this;
  48406. var peekedValue;
  48407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48408. return smalltalk.withContext(function($ctx1) {
  48409. //>>excludeEnd("ctx");
  48410. var $1;
  48411. peekedValue=self._peek();
  48412. _st(self._stack())._removeLast();
  48413. $1=peekedValue;
  48414. return $1;
  48415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48416. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},globals.ASTInterpreter)});
  48417. //>>excludeEnd("ctx");
  48418. },
  48419. //>>excludeStart("ide", pragmas.excludeIdeData);
  48420. args: [],
  48421. source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue",
  48422. referencedClasses: [],
  48423. //>>excludeEnd("ide");
  48424. messageSends: ["peek", "removeLast", "stack"]
  48425. }),
  48426. globals.ASTInterpreter);
  48427. smalltalk.addMethod(
  48428. smalltalk.method({
  48429. selector: "proceed",
  48430. protocol: 'interpreting',
  48431. fn: function (){
  48432. var self=this;
  48433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48434. return smalltalk.withContext(function($ctx1) {
  48435. //>>excludeEnd("ctx");
  48436. _st((function(){
  48437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48438. return smalltalk.withContext(function($ctx2) {
  48439. //>>excludeEnd("ctx");
  48440. return self._atEnd();
  48441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48443. //>>excludeEnd("ctx");
  48444. }))._whileFalse_((function(){
  48445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48446. return smalltalk.withContext(function($ctx2) {
  48447. //>>excludeEnd("ctx");
  48448. return self._step();
  48449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48451. //>>excludeEnd("ctx");
  48452. }));
  48453. return self;
  48454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48455. }, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTInterpreter)});
  48456. //>>excludeEnd("ctx");
  48457. },
  48458. //>>excludeStart("ide", pragmas.excludeIdeData);
  48459. args: [],
  48460. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  48461. referencedClasses: [],
  48462. //>>excludeEnd("ide");
  48463. messageSends: ["whileFalse:", "atEnd", "step"]
  48464. }),
  48465. globals.ASTInterpreter);
  48466. smalltalk.addMethod(
  48467. smalltalk.method({
  48468. selector: "push:",
  48469. protocol: 'stack',
  48470. fn: function (anObject){
  48471. var self=this;
  48472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48473. return smalltalk.withContext(function($ctx1) {
  48474. //>>excludeEnd("ctx");
  48475. var $1;
  48476. $1=_st(self._stack())._add_(anObject);
  48477. return $1;
  48478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48479. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},globals.ASTInterpreter)});
  48480. //>>excludeEnd("ctx");
  48481. },
  48482. //>>excludeStart("ide", pragmas.excludeIdeData);
  48483. args: ["anObject"],
  48484. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  48485. referencedClasses: [],
  48486. //>>excludeEnd("ide");
  48487. messageSends: ["add:", "stack"]
  48488. }),
  48489. globals.ASTInterpreter);
  48490. smalltalk.addMethod(
  48491. smalltalk.method({
  48492. selector: "restart",
  48493. protocol: 'interpreting',
  48494. fn: function (){
  48495. var self=this;
  48496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48497. return smalltalk.withContext(function($ctx1) {
  48498. //>>excludeEnd("ctx");
  48499. self._node_(_st(_st(self._context())._ast())._nextChild());
  48500. return self;
  48501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48502. }, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTInterpreter)});
  48503. //>>excludeEnd("ctx");
  48504. },
  48505. //>>excludeStart("ide", pragmas.excludeIdeData);
  48506. args: [],
  48507. source: "restart\x0a\x09self node: self context ast nextChild",
  48508. referencedClasses: [],
  48509. //>>excludeEnd("ide");
  48510. messageSends: ["node:", "nextChild", "ast", "context"]
  48511. }),
  48512. globals.ASTInterpreter);
  48513. smalltalk.addMethod(
  48514. smalltalk.method({
  48515. selector: "result",
  48516. protocol: 'accessing',
  48517. fn: function (){
  48518. var self=this;
  48519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48520. return smalltalk.withContext(function($ctx1) {
  48521. //>>excludeEnd("ctx");
  48522. var $2,$1;
  48523. $2=self._hasReturned();
  48524. if(smalltalk.assert($2)){
  48525. $1=self._returnValue();
  48526. } else {
  48527. $1=_st(self._context())._receiver();
  48528. };
  48529. return $1;
  48530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48531. }, function($ctx1) {$ctx1.fill(self,"result",{},globals.ASTInterpreter)});
  48532. //>>excludeEnd("ctx");
  48533. },
  48534. //>>excludeStart("ide", pragmas.excludeIdeData);
  48535. args: [],
  48536. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  48537. referencedClasses: [],
  48538. //>>excludeEnd("ide");
  48539. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  48540. }),
  48541. globals.ASTInterpreter);
  48542. smalltalk.addMethod(
  48543. smalltalk.method({
  48544. selector: "returnValue",
  48545. protocol: 'accessing',
  48546. fn: function (){
  48547. var self=this;
  48548. var $1;
  48549. $1=self["@returnValue"];
  48550. return $1;
  48551. },
  48552. //>>excludeStart("ide", pragmas.excludeIdeData);
  48553. args: [],
  48554. source: "returnValue\x0a\x09^ returnValue",
  48555. referencedClasses: [],
  48556. //>>excludeEnd("ide");
  48557. messageSends: []
  48558. }),
  48559. globals.ASTInterpreter);
  48560. smalltalk.addMethod(
  48561. smalltalk.method({
  48562. selector: "returnValue:",
  48563. protocol: 'accessing',
  48564. fn: function (anObject){
  48565. var self=this;
  48566. self["@returnValue"]=anObject;
  48567. return self;
  48568. },
  48569. //>>excludeStart("ide", pragmas.excludeIdeData);
  48570. args: ["anObject"],
  48571. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  48572. referencedClasses: [],
  48573. //>>excludeEnd("ide");
  48574. messageSends: []
  48575. }),
  48576. globals.ASTInterpreter);
  48577. smalltalk.addMethod(
  48578. smalltalk.method({
  48579. selector: "sendMessage:to:superSend:",
  48580. protocol: 'private',
  48581. fn: function (aMessage,anObject,aBoolean){
  48582. var self=this;
  48583. var method;
  48584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48585. return smalltalk.withContext(function($ctx1) {
  48586. //>>excludeEnd("ctx");
  48587. var $1,$3,$2,$4,$5,$6,$receiver;
  48588. var $early={};
  48589. try {
  48590. if(! smalltalk.assert(aBoolean)){
  48591. $1=_st(aMessage)._sendTo_(anObject);
  48592. return $1;
  48593. };
  48594. $3=_st(anObject)._class();
  48595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48596. $ctx1.sendIdx["class"]=1;
  48597. //>>excludeEnd("ctx");
  48598. $2=_st($3)._superclass();
  48599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48600. $ctx1.sendIdx["superclass"]=1;
  48601. //>>excludeEnd("ctx");
  48602. if(($receiver = $2) == null || $receiver.isNil){
  48603. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  48604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48605. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  48606. //>>excludeEnd("ctx");
  48607. return $4;
  48608. } else {
  48609. $2;
  48610. };
  48611. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  48612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48613. return smalltalk.withContext(function($ctx2) {
  48614. //>>excludeEnd("ctx");
  48615. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  48616. throw $early=[$5];
  48617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48619. //>>excludeEnd("ctx");
  48620. }));
  48621. $6=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
  48622. return $6;
  48623. }
  48624. catch(e) {if(e===$early)return e[0]; throw e}
  48625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48626. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},globals.ASTInterpreter)});
  48627. //>>excludeEnd("ctx");
  48628. },
  48629. //>>excludeStart("ide", pragmas.excludeIdeData);
  48630. args: ["aMessage", "anObject", "aBoolean"],
  48631. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  48632. referencedClasses: [],
  48633. //>>excludeEnd("ide");
  48634. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  48635. }),
  48636. globals.ASTInterpreter);
  48637. smalltalk.addMethod(
  48638. smalltalk.method({
  48639. selector: "setNonLocalReturnFromContext:",
  48640. protocol: 'interpreting',
  48641. fn: function (aContext){
  48642. var self=this;
  48643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48644. return smalltalk.withContext(function($ctx1) {
  48645. //>>excludeEnd("ctx");
  48646. var $2,$1;
  48647. $2=_st(aContext)._interpreter();
  48648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48649. $ctx1.sendIdx["interpreter"]=1;
  48650. //>>excludeEnd("ctx");
  48651. $1=_st($2)._hasReturned();
  48652. if(smalltalk.assert($1)){
  48653. self["@returned"]=true;
  48654. self["@returned"];
  48655. self._returnValue_(_st(_st(aContext)._interpreter())._returnValue());
  48656. };
  48657. return self;
  48658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48659. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},globals.ASTInterpreter)});
  48660. //>>excludeEnd("ctx");
  48661. },
  48662. //>>excludeStart("ide", pragmas.excludeIdeData);
  48663. args: ["aContext"],
  48664. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  48665. referencedClasses: [],
  48666. //>>excludeEnd("ide");
  48667. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  48668. }),
  48669. globals.ASTInterpreter);
  48670. smalltalk.addMethod(
  48671. smalltalk.method({
  48672. selector: "skip",
  48673. protocol: 'interpreting',
  48674. fn: function (){
  48675. var self=this;
  48676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48677. return smalltalk.withContext(function($ctx1) {
  48678. //>>excludeEnd("ctx");
  48679. self._next();
  48680. return self;
  48681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48682. }, function($ctx1) {$ctx1.fill(self,"skip",{},globals.ASTInterpreter)});
  48683. //>>excludeEnd("ctx");
  48684. },
  48685. //>>excludeStart("ide", pragmas.excludeIdeData);
  48686. args: [],
  48687. source: "skip\x0a\x09self next",
  48688. referencedClasses: [],
  48689. //>>excludeEnd("ide");
  48690. messageSends: ["next"]
  48691. }),
  48692. globals.ASTInterpreter);
  48693. smalltalk.addMethod(
  48694. smalltalk.method({
  48695. selector: "stack",
  48696. protocol: 'accessing',
  48697. fn: function (){
  48698. var self=this;
  48699. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  48700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48701. return smalltalk.withContext(function($ctx1) {
  48702. //>>excludeEnd("ctx");
  48703. var $2,$1,$receiver;
  48704. $2=self["@stack"];
  48705. if(($receiver = $2) == null || $receiver.isNil){
  48706. self["@stack"]=_st($OrderedCollection())._new();
  48707. $1=self["@stack"];
  48708. } else {
  48709. $1=$2;
  48710. };
  48711. return $1;
  48712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48713. }, function($ctx1) {$ctx1.fill(self,"stack",{},globals.ASTInterpreter)});
  48714. //>>excludeEnd("ctx");
  48715. },
  48716. //>>excludeStart("ide", pragmas.excludeIdeData);
  48717. args: [],
  48718. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  48719. referencedClasses: ["OrderedCollection"],
  48720. //>>excludeEnd("ide");
  48721. messageSends: ["ifNil:", "new"]
  48722. }),
  48723. globals.ASTInterpreter);
  48724. smalltalk.addMethod(
  48725. smalltalk.method({
  48726. selector: "step",
  48727. protocol: 'interpreting',
  48728. fn: function (){
  48729. var self=this;
  48730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48731. return smalltalk.withContext(function($ctx1) {
  48732. //>>excludeEnd("ctx");
  48733. var $1;
  48734. self._interpret();
  48735. $1=self._next();
  48736. return self;
  48737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48738. }, function($ctx1) {$ctx1.fill(self,"step",{},globals.ASTInterpreter)});
  48739. //>>excludeEnd("ctx");
  48740. },
  48741. //>>excludeStart("ide", pragmas.excludeIdeData);
  48742. args: [],
  48743. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  48744. referencedClasses: [],
  48745. //>>excludeEnd("ide");
  48746. messageSends: ["interpret", "next"]
  48747. }),
  48748. globals.ASTInterpreter);
  48749. smalltalk.addMethod(
  48750. smalltalk.method({
  48751. selector: "stepOver",
  48752. protocol: 'interpreting',
  48753. fn: function (){
  48754. var self=this;
  48755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48756. return smalltalk.withContext(function($ctx1) {
  48757. //>>excludeEnd("ctx");
  48758. var $2,$1;
  48759. self._step();
  48760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48761. $ctx1.sendIdx["step"]=1;
  48762. //>>excludeEnd("ctx");
  48763. _st((function(){
  48764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48765. return smalltalk.withContext(function($ctx2) {
  48766. //>>excludeEnd("ctx");
  48767. $2=self._node();
  48768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48769. $ctx2.sendIdx["node"]=1;
  48770. //>>excludeEnd("ctx");
  48771. $1=_st($2)._isNil();
  48772. return _st($1)._or_((function(){
  48773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48774. return smalltalk.withContext(function($ctx3) {
  48775. //>>excludeEnd("ctx");
  48776. return _st(self._node())._isSteppingNode();
  48777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48778. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48779. //>>excludeEnd("ctx");
  48780. }));
  48781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48783. //>>excludeEnd("ctx");
  48784. }))._whileFalse_((function(){
  48785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48786. return smalltalk.withContext(function($ctx2) {
  48787. //>>excludeEnd("ctx");
  48788. return self._step();
  48789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48791. //>>excludeEnd("ctx");
  48792. }));
  48793. return self;
  48794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48795. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTInterpreter)});
  48796. //>>excludeEnd("ctx");
  48797. },
  48798. //>>excludeStart("ide", pragmas.excludeIdeData);
  48799. args: [],
  48800. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  48801. referencedClasses: [],
  48802. //>>excludeEnd("ide");
  48803. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  48804. }),
  48805. globals.ASTInterpreter);
  48806. smalltalk.addMethod(
  48807. smalltalk.method({
  48808. selector: "visit:",
  48809. protocol: 'visiting',
  48810. fn: function (aNode){
  48811. var self=this;
  48812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48813. return smalltalk.withContext(function($ctx1) {
  48814. //>>excludeEnd("ctx");
  48815. var $1;
  48816. $1=self._hasReturned();
  48817. if(! smalltalk.assert($1)){
  48818. (
  48819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48820. $ctx1.supercall = true,
  48821. //>>excludeEnd("ctx");
  48822. globals.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]));
  48823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48824. $ctx1.supercall = false;
  48825. //>>excludeEnd("ctx");;
  48826. };
  48827. return self;
  48828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48829. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.ASTInterpreter)});
  48830. //>>excludeEnd("ctx");
  48831. },
  48832. //>>excludeStart("ide", pragmas.excludeIdeData);
  48833. args: ["aNode"],
  48834. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  48835. referencedClasses: [],
  48836. //>>excludeEnd("ide");
  48837. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  48838. }),
  48839. globals.ASTInterpreter);
  48840. smalltalk.addMethod(
  48841. smalltalk.method({
  48842. selector: "visitAssignmentNode:",
  48843. protocol: 'visiting',
  48844. fn: function (aNode){
  48845. var self=this;
  48846. var poppedValue;
  48847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48848. return smalltalk.withContext(function($ctx1) {
  48849. //>>excludeEnd("ctx");
  48850. poppedValue=self._pop();
  48851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48852. $ctx1.sendIdx["pop"]=1;
  48853. //>>excludeEnd("ctx");
  48854. self._pop();
  48855. self._push_(poppedValue);
  48856. self._assign_to_(_st(aNode)._left(),poppedValue);
  48857. return self;
  48858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48859. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},globals.ASTInterpreter)});
  48860. //>>excludeEnd("ctx");
  48861. },
  48862. //>>excludeStart("ide", pragmas.excludeIdeData);
  48863. args: ["aNode"],
  48864. source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue",
  48865. referencedClasses: [],
  48866. //>>excludeEnd("ide");
  48867. messageSends: ["pop", "push:", "assign:to:", "left"]
  48868. }),
  48869. globals.ASTInterpreter);
  48870. smalltalk.addMethod(
  48871. smalltalk.method({
  48872. selector: "visitBlockNode:",
  48873. protocol: 'visiting',
  48874. fn: function (aNode){
  48875. var self=this;
  48876. var block;
  48877. function $AIBlockClosure(){return globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  48878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48879. return smalltalk.withContext(function($ctx1) {
  48880. //>>excludeEnd("ctx");
  48881. block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
  48882. self._push_(block);
  48883. return self;
  48884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48885. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},globals.ASTInterpreter)});
  48886. //>>excludeEnd("ctx");
  48887. },
  48888. //>>excludeStart("ide", pragmas.excludeIdeData);
  48889. args: ["aNode"],
  48890. source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block",
  48891. referencedClasses: ["AIBlockClosure"],
  48892. //>>excludeEnd("ide");
  48893. messageSends: ["forContext:node:", "context", "push:"]
  48894. }),
  48895. globals.ASTInterpreter);
  48896. smalltalk.addMethod(
  48897. smalltalk.method({
  48898. selector: "visitBlockSequenceNode:",
  48899. protocol: 'visiting',
  48900. fn: function (aNode){
  48901. var self=this;
  48902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48903. return smalltalk.withContext(function($ctx1) {
  48904. //>>excludeEnd("ctx");
  48905. (
  48906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48907. $ctx1.supercall = true,
  48908. //>>excludeEnd("ctx");
  48909. globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply(_st(self), [aNode]));
  48910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48911. $ctx1.supercall = false;
  48912. //>>excludeEnd("ctx");;
  48913. self["@forceAtEnd"]=true;
  48914. return self;
  48915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48916. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.ASTInterpreter)});
  48917. //>>excludeEnd("ctx");
  48918. },
  48919. //>>excludeStart("ide", pragmas.excludeIdeData);
  48920. args: ["aNode"],
  48921. source: "visitBlockSequenceNode: aNode\x0a\x09\x22If the receiver is actually visiting a BlockSequenceNode,\x0a\x09it means the the context is a block context. Evaluation should \x0a\x09stop right after evaluating the block sequence and the outer\x0a\x09context's interpreter should take over. \x0a\x09Therefore we force #atEnd.\x22\x0a\x09\x0a\x09super visitBlockSequenceNode: aNode.\x0a\x09forceAtEnd := true",
  48922. referencedClasses: [],
  48923. //>>excludeEnd("ide");
  48924. messageSends: ["visitBlockSequenceNode:"]
  48925. }),
  48926. globals.ASTInterpreter);
  48927. smalltalk.addMethod(
  48928. smalltalk.method({
  48929. selector: "visitDynamicArrayNode:",
  48930. protocol: 'visiting',
  48931. fn: function (aNode){
  48932. var self=this;
  48933. var array;
  48934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48935. return smalltalk.withContext(function($ctx1) {
  48936. //>>excludeEnd("ctx");
  48937. array=[];
  48938. _st(_st(aNode)._nodes())._do_((function(each){
  48939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48940. return smalltalk.withContext(function($ctx2) {
  48941. //>>excludeEnd("ctx");
  48942. return _st(array)._addFirst_(self._pop());
  48943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48944. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48945. //>>excludeEnd("ctx");
  48946. }));
  48947. self._push_(array);
  48948. return self;
  48949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48950. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.ASTInterpreter)});
  48951. //>>excludeEnd("ctx");
  48952. },
  48953. //>>excludeStart("ide", pragmas.excludeIdeData);
  48954. args: ["aNode"],
  48955. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  48956. referencedClasses: [],
  48957. //>>excludeEnd("ide");
  48958. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  48959. }),
  48960. globals.ASTInterpreter);
  48961. smalltalk.addMethod(
  48962. smalltalk.method({
  48963. selector: "visitDynamicDictionaryNode:",
  48964. protocol: 'visiting',
  48965. fn: function (aNode){
  48966. var self=this;
  48967. var keyValueList;
  48968. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  48969. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  48970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48971. return smalltalk.withContext(function($ctx1) {
  48972. //>>excludeEnd("ctx");
  48973. keyValueList=_st($OrderedCollection())._new();
  48974. _st(_st(aNode)._nodes())._do_((function(each){
  48975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48976. return smalltalk.withContext(function($ctx2) {
  48977. //>>excludeEnd("ctx");
  48978. return _st(keyValueList)._add_(self._pop());
  48979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48981. //>>excludeEnd("ctx");
  48982. }));
  48983. self._push_(_st($HashedCollection())._newFromPairs_(_st(keyValueList)._reversed()));
  48984. return self;
  48985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48986. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},globals.ASTInterpreter)});
  48987. //>>excludeEnd("ctx");
  48988. },
  48989. //>>excludeStart("ide", pragmas.excludeIdeData);
  48990. args: ["aNode"],
  48991. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  48992. referencedClasses: ["OrderedCollection", "HashedCollection"],
  48993. //>>excludeEnd("ide");
  48994. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  48995. }),
  48996. globals.ASTInterpreter);
  48997. smalltalk.addMethod(
  48998. smalltalk.method({
  48999. selector: "visitJSStatementNode:",
  49000. protocol: 'visiting',
  49001. fn: function (aNode){
  49002. var self=this;
  49003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49004. return smalltalk.withContext(function($ctx1) {
  49005. //>>excludeEnd("ctx");
  49006. self["@returned"]=true;
  49007. self._returnValue_(self._eval_(_st(aNode)._source()));
  49008. return self;
  49009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49010. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.ASTInterpreter)});
  49011. //>>excludeEnd("ctx");
  49012. },
  49013. //>>excludeStart("ide", pragmas.excludeIdeData);
  49014. args: ["aNode"],
  49015. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  49016. referencedClasses: [],
  49017. //>>excludeEnd("ide");
  49018. messageSends: ["returnValue:", "eval:", "source"]
  49019. }),
  49020. globals.ASTInterpreter);
  49021. smalltalk.addMethod(
  49022. smalltalk.method({
  49023. selector: "visitNode:",
  49024. protocol: 'visiting',
  49025. fn: function (aNode){
  49026. var self=this;
  49027. return self;
  49028. },
  49029. //>>excludeStart("ide", pragmas.excludeIdeData);
  49030. args: ["aNode"],
  49031. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  49032. referencedClasses: [],
  49033. //>>excludeEnd("ide");
  49034. messageSends: []
  49035. }),
  49036. globals.ASTInterpreter);
  49037. smalltalk.addMethod(
  49038. smalltalk.method({
  49039. selector: "visitReturnNode:",
  49040. protocol: 'visiting',
  49041. fn: function (aNode){
  49042. var self=this;
  49043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49044. return smalltalk.withContext(function($ctx1) {
  49045. //>>excludeEnd("ctx");
  49046. self["@returned"]=true;
  49047. self._returnValue_(self._pop());
  49048. return self;
  49049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49050. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.ASTInterpreter)});
  49051. //>>excludeEnd("ctx");
  49052. },
  49053. //>>excludeStart("ide", pragmas.excludeIdeData);
  49054. args: ["aNode"],
  49055. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  49056. referencedClasses: [],
  49057. //>>excludeEnd("ide");
  49058. messageSends: ["returnValue:", "pop"]
  49059. }),
  49060. globals.ASTInterpreter);
  49061. smalltalk.addMethod(
  49062. smalltalk.method({
  49063. selector: "visitSendNode:",
  49064. protocol: 'visiting',
  49065. fn: function (aNode){
  49066. var self=this;
  49067. var receiver,args,message,result;
  49068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49069. return smalltalk.withContext(function($ctx1) {
  49070. //>>excludeEnd("ctx");
  49071. var $1;
  49072. args=_st(_st(aNode)._arguments())._collect_((function(each){
  49073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49074. return smalltalk.withContext(function($ctx2) {
  49075. //>>excludeEnd("ctx");
  49076. return self._pop();
  49077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49078. $ctx2.sendIdx["pop"]=1;
  49079. //>>excludeEnd("ctx");
  49080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49081. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49082. //>>excludeEnd("ctx");
  49083. }));
  49084. receiver=self._pop();
  49085. message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
  49086. result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
  49087. $1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
  49088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49089. return smalltalk.withContext(function($ctx2) {
  49090. //>>excludeEnd("ctx");
  49091. return _st(_st(aNode)._isLastChild())._not();
  49092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49094. //>>excludeEnd("ctx");
  49095. }));
  49096. if(smalltalk.assert($1)){
  49097. self._push_(receiver);
  49098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49099. $ctx1.sendIdx["push:"]=1;
  49100. //>>excludeEnd("ctx");
  49101. } else {
  49102. self._push_(result);
  49103. };
  49104. return self;
  49105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49106. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},globals.ASTInterpreter)});
  49107. //>>excludeEnd("ctx");
  49108. },
  49109. //>>excludeStart("ide", pragmas.excludeIdeData);
  49110. args: ["aNode"],
  49111. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]",
  49112. referencedClasses: [],
  49113. //>>excludeEnd("ide");
  49114. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  49115. }),
  49116. globals.ASTInterpreter);
  49117. smalltalk.addMethod(
  49118. smalltalk.method({
  49119. selector: "visitSequenceNode:",
  49120. protocol: 'visiting',
  49121. fn: function (aNode){
  49122. var self=this;
  49123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49124. return smalltalk.withContext(function($ctx1) {
  49125. //>>excludeEnd("ctx");
  49126. _st(_st(aNode)._temps())._do_((function(each){
  49127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49128. return smalltalk.withContext(function($ctx2) {
  49129. //>>excludeEnd("ctx");
  49130. return _st(self._context())._defineLocal_(each);
  49131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49133. //>>excludeEnd("ctx");
  49134. }));
  49135. return self;
  49136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49137. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.ASTInterpreter)});
  49138. //>>excludeEnd("ctx");
  49139. },
  49140. //>>excludeStart("ide", pragmas.excludeIdeData);
  49141. args: ["aNode"],
  49142. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
  49143. referencedClasses: [],
  49144. //>>excludeEnd("ide");
  49145. messageSends: ["do:", "temps", "defineLocal:", "context"]
  49146. }),
  49147. globals.ASTInterpreter);
  49148. smalltalk.addMethod(
  49149. smalltalk.method({
  49150. selector: "visitValueNode:",
  49151. protocol: 'visiting',
  49152. fn: function (aNode){
  49153. var self=this;
  49154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49155. return smalltalk.withContext(function($ctx1) {
  49156. //>>excludeEnd("ctx");
  49157. self._push_(_st(aNode)._value());
  49158. return self;
  49159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49160. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.ASTInterpreter)});
  49161. //>>excludeEnd("ctx");
  49162. },
  49163. //>>excludeStart("ide", pragmas.excludeIdeData);
  49164. args: ["aNode"],
  49165. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  49166. referencedClasses: [],
  49167. //>>excludeEnd("ide");
  49168. messageSends: ["push:", "value"]
  49169. }),
  49170. globals.ASTInterpreter);
  49171. smalltalk.addMethod(
  49172. smalltalk.method({
  49173. selector: "visitVariableNode:",
  49174. protocol: 'visiting',
  49175. fn: function (aNode){
  49176. var self=this;
  49177. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  49178. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49180. return smalltalk.withContext(function($ctx1) {
  49181. //>>excludeEnd("ctx");
  49182. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  49183. $2=_st(aNode)._binding();
  49184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49185. $ctx1.sendIdx["binding"]=1;
  49186. //>>excludeEnd("ctx");
  49187. $1=_st($2)._isUnknownVar();
  49188. if(smalltalk.assert($1)){
  49189. $5=_st($PlatformInterface())._globals();
  49190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49191. $ctx1.sendIdx["globals"]=1;
  49192. //>>excludeEnd("ctx");
  49193. $6=_st(aNode)._value();
  49194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49195. $ctx1.sendIdx["value"]=1;
  49196. //>>excludeEnd("ctx");
  49197. $4=_st($5)._at_ifAbsent_($6,(function(){
  49198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49199. return smalltalk.withContext(function($ctx2) {
  49200. //>>excludeEnd("ctx");
  49201. return self._error_("Unknown variable");
  49202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49204. //>>excludeEnd("ctx");
  49205. }));
  49206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49207. $ctx1.sendIdx["at:ifAbsent:"]=1;
  49208. //>>excludeEnd("ctx");
  49209. $3=self._push_($4);
  49210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49211. $ctx1.sendIdx["push:"]=1;
  49212. //>>excludeEnd("ctx");
  49213. return $3;
  49214. };
  49215. $8=_st(_st(aNode)._binding())._isInstanceVar();
  49216. if(smalltalk.assert($8)){
  49217. $10=self._context();
  49218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49219. $ctx1.sendIdx["context"]=1;
  49220. //>>excludeEnd("ctx");
  49221. $9=_st($10)._receiver();
  49222. $11=_st(aNode)._value();
  49223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49224. $ctx1.sendIdx["value"]=2;
  49225. //>>excludeEnd("ctx");
  49226. $7=_st($9)._instVarAt_($11);
  49227. } else {
  49228. $12=self._context();
  49229. $13=_st(aNode)._value();
  49230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49231. $ctx1.sendIdx["value"]=3;
  49232. //>>excludeEnd("ctx");
  49233. $7=_st($12)._localAt_ifAbsent_($13,(function(){
  49234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49235. return smalltalk.withContext(function($ctx2) {
  49236. //>>excludeEnd("ctx");
  49237. $15=_st(aNode)._value();
  49238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49239. $ctx2.sendIdx["value"]=4;
  49240. //>>excludeEnd("ctx");
  49241. $14=_st($15)._isCapitalized();
  49242. if(smalltalk.assert($14)){
  49243. $16=_st($Smalltalk())._globals();
  49244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49245. $ctx2.sendIdx["globals"]=2;
  49246. //>>excludeEnd("ctx");
  49247. $17=_st(aNode)._value();
  49248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49249. $ctx2.sendIdx["value"]=5;
  49250. //>>excludeEnd("ctx");
  49251. return _st($16)._at_ifAbsent_($17,(function(){
  49252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49253. return smalltalk.withContext(function($ctx3) {
  49254. //>>excludeEnd("ctx");
  49255. return _st(_st($PlatformInterface())._globals())._at_(_st(aNode)._value());
  49256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49257. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  49258. //>>excludeEnd("ctx");
  49259. }));
  49260. };
  49261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  49263. //>>excludeEnd("ctx");
  49264. }));
  49265. };
  49266. self._push_($7);
  49267. return self;
  49268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49269. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.ASTInterpreter)});
  49270. //>>excludeEnd("ctx");
  49271. },
  49272. //>>excludeStart("ide", pragmas.excludeIdeData);
  49273. args: ["aNode"],
  49274. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (PlatformInterface globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ PlatformInterface globals at: aNode value ] ] ] ])",
  49275. referencedClasses: ["PlatformInterface", "Smalltalk"],
  49276. //>>excludeEnd("ide");
  49277. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  49278. }),
  49279. globals.ASTInterpreter);
  49280. smalltalk.addClass('ASTInterpreterError', globals.Error, [], 'Compiler-Interpreter');
  49281. //>>excludeStart("ide", pragmas.excludeIdeData);
  49282. globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  49283. //>>excludeEnd("ide");
  49284. smalltalk.addClass('ASTPCNodeVisitor', globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  49285. //>>excludeStart("ide", pragmas.excludeIdeData);
  49286. globals.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node is answered by `#currentNode`";
  49287. //>>excludeEnd("ide");
  49288. smalltalk.addMethod(
  49289. smalltalk.method({
  49290. selector: "context",
  49291. protocol: 'accessing',
  49292. fn: function (){
  49293. var self=this;
  49294. var $1;
  49295. $1=self["@context"];
  49296. return $1;
  49297. },
  49298. //>>excludeStart("ide", pragmas.excludeIdeData);
  49299. args: [],
  49300. source: "context\x0a\x09^ context",
  49301. referencedClasses: [],
  49302. //>>excludeEnd("ide");
  49303. messageSends: []
  49304. }),
  49305. globals.ASTPCNodeVisitor);
  49306. smalltalk.addMethod(
  49307. smalltalk.method({
  49308. selector: "context:",
  49309. protocol: 'accessing',
  49310. fn: function (aContext){
  49311. var self=this;
  49312. self["@context"]=aContext;
  49313. return self;
  49314. },
  49315. //>>excludeStart("ide", pragmas.excludeIdeData);
  49316. args: ["aContext"],
  49317. source: "context: aContext\x0a\x09context := aContext",
  49318. referencedClasses: [],
  49319. //>>excludeEnd("ide");
  49320. messageSends: []
  49321. }),
  49322. globals.ASTPCNodeVisitor);
  49323. smalltalk.addMethod(
  49324. smalltalk.method({
  49325. selector: "currentNode",
  49326. protocol: 'accessing',
  49327. fn: function (){
  49328. var self=this;
  49329. var $1;
  49330. $1=self["@currentNode"];
  49331. return $1;
  49332. },
  49333. //>>excludeStart("ide", pragmas.excludeIdeData);
  49334. args: [],
  49335. source: "currentNode\x0a\x09^ currentNode",
  49336. referencedClasses: [],
  49337. //>>excludeEnd("ide");
  49338. messageSends: []
  49339. }),
  49340. globals.ASTPCNodeVisitor);
  49341. smalltalk.addMethod(
  49342. smalltalk.method({
  49343. selector: "increaseIndex",
  49344. protocol: 'accessing',
  49345. fn: function (){
  49346. var self=this;
  49347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49348. return smalltalk.withContext(function($ctx1) {
  49349. //>>excludeEnd("ctx");
  49350. self["@index"]=_st(self._index()).__plus((1));
  49351. return self;
  49352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49353. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},globals.ASTPCNodeVisitor)});
  49354. //>>excludeEnd("ctx");
  49355. },
  49356. //>>excludeStart("ide", pragmas.excludeIdeData);
  49357. args: [],
  49358. source: "increaseIndex\x0a\x09index := self index + 1",
  49359. referencedClasses: [],
  49360. //>>excludeEnd("ide");
  49361. messageSends: ["+", "index"]
  49362. }),
  49363. globals.ASTPCNodeVisitor);
  49364. smalltalk.addMethod(
  49365. smalltalk.method({
  49366. selector: "index",
  49367. protocol: 'accessing',
  49368. fn: function (){
  49369. var self=this;
  49370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49371. return smalltalk.withContext(function($ctx1) {
  49372. //>>excludeEnd("ctx");
  49373. var $2,$1,$receiver;
  49374. $2=self["@index"];
  49375. if(($receiver = $2) == null || $receiver.isNil){
  49376. self["@index"]=(0);
  49377. $1=self["@index"];
  49378. } else {
  49379. $1=$2;
  49380. };
  49381. return $1;
  49382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49383. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.ASTPCNodeVisitor)});
  49384. //>>excludeEnd("ctx");
  49385. },
  49386. //>>excludeStart("ide", pragmas.excludeIdeData);
  49387. args: [],
  49388. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  49389. referencedClasses: [],
  49390. //>>excludeEnd("ide");
  49391. messageSends: ["ifNil:"]
  49392. }),
  49393. globals.ASTPCNodeVisitor);
  49394. smalltalk.addMethod(
  49395. smalltalk.method({
  49396. selector: "selector",
  49397. protocol: 'accessing',
  49398. fn: function (){
  49399. var self=this;
  49400. var $1;
  49401. $1=self["@selector"];
  49402. return $1;
  49403. },
  49404. //>>excludeStart("ide", pragmas.excludeIdeData);
  49405. args: [],
  49406. source: "selector\x0a\x09^ selector",
  49407. referencedClasses: [],
  49408. //>>excludeEnd("ide");
  49409. messageSends: []
  49410. }),
  49411. globals.ASTPCNodeVisitor);
  49412. smalltalk.addMethod(
  49413. smalltalk.method({
  49414. selector: "selector:",
  49415. protocol: 'accessing',
  49416. fn: function (aString){
  49417. var self=this;
  49418. self["@selector"]=aString;
  49419. return self;
  49420. },
  49421. //>>excludeStart("ide", pragmas.excludeIdeData);
  49422. args: ["aString"],
  49423. source: "selector: aString\x0a\x09selector := aString",
  49424. referencedClasses: [],
  49425. //>>excludeEnd("ide");
  49426. messageSends: []
  49427. }),
  49428. globals.ASTPCNodeVisitor);
  49429. smalltalk.addMethod(
  49430. smalltalk.method({
  49431. selector: "visitJSStatementNode:",
  49432. protocol: 'visiting',
  49433. fn: function (aNode){
  49434. var self=this;
  49435. self["@currentNode"]=aNode;
  49436. return self;
  49437. },
  49438. //>>excludeStart("ide", pragmas.excludeIdeData);
  49439. args: ["aNode"],
  49440. source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode",
  49441. referencedClasses: [],
  49442. //>>excludeEnd("ide");
  49443. messageSends: []
  49444. }),
  49445. globals.ASTPCNodeVisitor);
  49446. smalltalk.addMethod(
  49447. smalltalk.method({
  49448. selector: "visitSendNode:",
  49449. protocol: 'visiting',
  49450. fn: function (aNode){
  49451. var self=this;
  49452. var sendIndex;
  49453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49454. return smalltalk.withContext(function($ctx1) {
  49455. //>>excludeEnd("ctx");
  49456. var $1,$2,$4,$3,$5;
  49457. $1=self._context();
  49458. $2=self._selector();
  49459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49460. $ctx1.sendIdx["selector"]=1;
  49461. //>>excludeEnd("ctx");
  49462. sendIndex=_st($1)._sendIndexAt_($2);
  49463. (
  49464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49465. $ctx1.supercall = true,
  49466. //>>excludeEnd("ctx");
  49467. globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]));
  49468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49469. $ctx1.supercall = false;
  49470. //>>excludeEnd("ctx");;
  49471. $4=self._selector();
  49472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49473. $ctx1.sendIdx["selector"]=2;
  49474. //>>excludeEnd("ctx");
  49475. $3=_st($4).__eq(_st(aNode)._selector());
  49476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49477. $ctx1.sendIdx["="]=1;
  49478. //>>excludeEnd("ctx");
  49479. if(smalltalk.assert($3)){
  49480. $5=_st(self._index()).__eq(sendIndex);
  49481. if(smalltalk.assert($5)){
  49482. self["@currentNode"]=aNode;
  49483. self["@currentNode"];
  49484. };
  49485. self._increaseIndex();
  49486. };
  49487. return self;
  49488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49489. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},globals.ASTPCNodeVisitor)});
  49490. //>>excludeEnd("ctx");
  49491. },
  49492. //>>excludeStart("ide", pragmas.excludeIdeData);
  49493. args: ["aNode"],
  49494. source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index = sendIndex ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseIndex ]",
  49495. referencedClasses: [],
  49496. //>>excludeEnd("ide");
  49497. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  49498. }),
  49499. globals.ASTPCNodeVisitor);
  49500. smalltalk.addMethod(
  49501. smalltalk.method({
  49502. selector: "isSteppingNode",
  49503. protocol: '*Compiler-Interpreter',
  49504. fn: function (){
  49505. var self=this;
  49506. return true;
  49507. },
  49508. //>>excludeStart("ide", pragmas.excludeIdeData);
  49509. args: [],
  49510. source: "isSteppingNode\x0a\x09^ true",
  49511. referencedClasses: [],
  49512. //>>excludeEnd("ide");
  49513. messageSends: []
  49514. }),
  49515. globals.AssignmentNode);
  49516. smalltalk.addMethod(
  49517. smalltalk.method({
  49518. selector: "isSteppingNode",
  49519. protocol: '*Compiler-Interpreter',
  49520. fn: function (){
  49521. var self=this;
  49522. return true;
  49523. },
  49524. //>>excludeStart("ide", pragmas.excludeIdeData);
  49525. args: [],
  49526. source: "isSteppingNode\x0a\x09^ true",
  49527. referencedClasses: [],
  49528. //>>excludeEnd("ide");
  49529. messageSends: []
  49530. }),
  49531. globals.BlockNode);
  49532. smalltalk.addMethod(
  49533. smalltalk.method({
  49534. selector: "isSteppingNode",
  49535. protocol: '*Compiler-Interpreter',
  49536. fn: function (){
  49537. var self=this;
  49538. return true;
  49539. },
  49540. //>>excludeStart("ide", pragmas.excludeIdeData);
  49541. args: [],
  49542. source: "isSteppingNode\x0a\x09^ true",
  49543. referencedClasses: [],
  49544. //>>excludeEnd("ide");
  49545. messageSends: []
  49546. }),
  49547. globals.DynamicArrayNode);
  49548. smalltalk.addMethod(
  49549. smalltalk.method({
  49550. selector: "isSteppingNode",
  49551. protocol: '*Compiler-Interpreter',
  49552. fn: function (){
  49553. var self=this;
  49554. return true;
  49555. },
  49556. //>>excludeStart("ide", pragmas.excludeIdeData);
  49557. args: [],
  49558. source: "isSteppingNode\x0a\x09^ true",
  49559. referencedClasses: [],
  49560. //>>excludeEnd("ide");
  49561. messageSends: []
  49562. }),
  49563. globals.DynamicDictionaryNode);
  49564. smalltalk.addMethod(
  49565. smalltalk.method({
  49566. selector: "isSteppingNode",
  49567. protocol: '*Compiler-Interpreter',
  49568. fn: function (){
  49569. var self=this;
  49570. return true;
  49571. },
  49572. //>>excludeStart("ide", pragmas.excludeIdeData);
  49573. args: [],
  49574. source: "isSteppingNode\x0a\x09^ true",
  49575. referencedClasses: [],
  49576. //>>excludeEnd("ide");
  49577. messageSends: []
  49578. }),
  49579. globals.JSStatementNode);
  49580. smalltalk.addMethod(
  49581. smalltalk.method({
  49582. selector: "isSteppingNode",
  49583. protocol: '*Compiler-Interpreter',
  49584. fn: function (){
  49585. var self=this;
  49586. return false;
  49587. },
  49588. //>>excludeStart("ide", pragmas.excludeIdeData);
  49589. args: [],
  49590. source: "isSteppingNode\x0a\x09^ false",
  49591. referencedClasses: [],
  49592. //>>excludeEnd("ide");
  49593. messageSends: []
  49594. }),
  49595. globals.Node);
  49596. smalltalk.addMethod(
  49597. smalltalk.method({
  49598. selector: "isSteppingNode",
  49599. protocol: '*Compiler-Interpreter',
  49600. fn: function (){
  49601. var self=this;
  49602. return true;
  49603. },
  49604. //>>excludeStart("ide", pragmas.excludeIdeData);
  49605. args: [],
  49606. source: "isSteppingNode\x0a\x09^ true",
  49607. referencedClasses: [],
  49608. //>>excludeEnd("ide");
  49609. messageSends: []
  49610. }),
  49611. globals.SendNode);
  49612. });
  49613. define("amber/parser", ["./boot"], function(boot) {
  49614. var globals = boot.globals, nil = boot.nil;
  49615. globals.SmalltalkParser = (function() {
  49616. /*
  49617. * Generated by PEG.js 0.8.0.
  49618. *
  49619. * http://pegjs.majda.cz/
  49620. */
  49621. function peg$subclass(child, parent) {
  49622. function ctor() { this.constructor = child; }
  49623. ctor.prototype = parent.prototype;
  49624. child.prototype = new ctor();
  49625. }
  49626. function SyntaxError(message, expected, found, offset, line, column) {
  49627. this.message = message;
  49628. this.expected = expected;
  49629. this.found = found;
  49630. this.offset = offset;
  49631. this.line = line;
  49632. this.column = column;
  49633. this.name = "SyntaxError";
  49634. }
  49635. peg$subclass(SyntaxError, Error);
  49636. function parse(input) {
  49637. var options = arguments.length > 1 ? arguments[1] : {},
  49638. peg$FAILED = {},
  49639. peg$startRuleFunctions = { start: peg$parsestart },
  49640. peg$startRuleFunction = peg$parsestart,
  49641. peg$c0 = [],
  49642. peg$c1 = peg$FAILED,
  49643. peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  49644. peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
  49645. peg$c4 = "\"",
  49646. peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  49647. peg$c6 = /^[^"]/,
  49648. peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
  49649. peg$c8 = /^[a-zA-Z]/,
  49650. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  49651. peg$c10 = /^[a-zA-Z0-9]/,
  49652. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  49653. peg$c12 = function(first, others) {return first + others.join("");},
  49654. peg$c13 = ":",
  49655. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  49656. peg$c15 = function(first, last) {return first + last;},
  49657. peg$c16 = /^[a-zA-Z0-9:]/,
  49658. peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
  49659. peg$c18 = /^[A-Z]/,
  49660. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  49661. peg$c20 = "'",
  49662. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  49663. peg$c22 = "''",
  49664. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  49665. peg$c24 = function() {return "'";},
  49666. peg$c25 = /^[^']/,
  49667. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  49668. peg$c27 = function(val) {
  49669. return globals.ValueNode._new()
  49670. ._position_((line()).__at(column()))
  49671. ._source_(text())
  49672. ._value_(val.join(""));
  49673. },
  49674. peg$c28 = "$",
  49675. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  49676. peg$c30 = { type: "any", description: "any character" },
  49677. peg$c31 = function(char) {
  49678. return globals.ValueNode._new()
  49679. ._position_((line()).__at(column()))
  49680. ._source_(text())
  49681. ._value_(char);
  49682. },
  49683. peg$c32 = "#",
  49684. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  49685. peg$c34 = function(rest) {return rest;},
  49686. peg$c35 = function(node) {return node._value();},
  49687. peg$c36 = function(val) {
  49688. return globals.ValueNode._new()
  49689. ._position_((line()).__at(column()))
  49690. ._source_(text())
  49691. ._value_(val);
  49692. },
  49693. peg$c37 = function(n) {
  49694. return globals.ValueNode._new()
  49695. ._position_((line()).__at(column()))
  49696. ._source_(text())
  49697. ._value_(n);
  49698. },
  49699. peg$c38 = "e",
  49700. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  49701. peg$c40 = function(n) {return parseFloat(n.join(""));},
  49702. peg$c41 = null,
  49703. peg$c42 = "-",
  49704. peg$c43 = { type: "literal", value: "-", description: "\"-\"" },
  49705. peg$c44 = "16r",
  49706. peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" },
  49707. peg$c46 = /^[0-9a-fA-F]/,
  49708. peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  49709. peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  49710. peg$c49 = /^[0-9]/,
  49711. peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" },
  49712. peg$c51 = ".",
  49713. peg$c52 = { type: "literal", value: ".", description: "\".\"" },
  49714. peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  49715. peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  49716. peg$c55 = "#(",
  49717. peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" },
  49718. peg$c57 = "(",
  49719. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  49720. peg$c59 = function(lit) {return lit._value();},
  49721. peg$c60 = ")",
  49722. peg$c61 = { type: "literal", value: ")", description: "\")\"" },
  49723. peg$c62 = function(lits) {
  49724. return globals.ValueNode._new()
  49725. ._position_((line()).__at(column()))
  49726. ._source_(text())
  49727. ._value_(lits);
  49728. },
  49729. peg$c63 = "{",
  49730. peg$c64 = { type: "literal", value: "{", description: "\"{\"" },
  49731. peg$c65 = "}",
  49732. peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
  49733. peg$c67 = function(expressions) {
  49734. return globals.DynamicArrayNode._new()
  49735. ._position_((line()).__at(column()))
  49736. ._source_(text())
  49737. ._nodes_(expressions || []);
  49738. },
  49739. peg$c68 = "#{",
  49740. peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" },
  49741. peg$c70 = function(expressions) {
  49742. return globals.DynamicDictionaryNode._new()
  49743. ._position_((line()).__at(column()))
  49744. ._source_(text())
  49745. ._nodes_(expressions || []);
  49746. },
  49747. peg$c71 = "true",
  49748. peg$c72 = { type: "literal", value: "true", description: "\"true\"" },
  49749. peg$c73 = function() {return true;},
  49750. peg$c74 = "false",
  49751. peg$c75 = { type: "literal", value: "false", description: "\"false\"" },
  49752. peg$c76 = function() {return false;},
  49753. peg$c77 = "nil",
  49754. peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" },
  49755. peg$c79 = function() {return nil;},
  49756. peg$c80 = function(val) {
  49757. return globals.ValueNode._new()
  49758. ._position_((line()).__at(column()))
  49759. ._source_(text())
  49760. ._value_(val);
  49761. },
  49762. peg$c81 = function(identifier) {
  49763. return globals.VariableNode._new()
  49764. ._position_((line()).__at(column()))
  49765. ._source_(text())
  49766. ._value_(identifier);
  49767. },
  49768. peg$c82 = function(key, arg) {return {key:key, arg:arg};},
  49769. peg$c83 = /^[\\+*\/=><,@%~|&\-]/,
  49770. peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
  49771. peg$c85 = function(bin) {return bin.join("");},
  49772. peg$c86 = function(pairs) {
  49773. var keywords = [];
  49774. var params = [];
  49775. var i = 0;
  49776. for(i = 0; i < pairs.length; i++){
  49777. keywords.push(pairs[i].key);
  49778. }
  49779. for(i = 0; i < pairs.length; i++){
  49780. params.push(pairs[i].arg);
  49781. }
  49782. return [keywords.join(""), params];
  49783. },
  49784. peg$c87 = function(selector, arg) {return [selector, [arg]];},
  49785. peg$c88 = function(selector) {return [selector, []];},
  49786. peg$c89 = function(expression) {return expression;},
  49787. peg$c90 = function(first, others) { return [first].concat(others); },
  49788. peg$c91 = ":=",
  49789. peg$c92 = { type: "literal", value: ":=", description: "\":=\"" },
  49790. peg$c93 = function(variable, expression) {
  49791. return globals.AssignmentNode._new()
  49792. ._position_((line()).__at(column()))
  49793. ._source_(text())
  49794. ._left_(variable)
  49795. ._right_(expression);
  49796. },
  49797. peg$c94 = "^",
  49798. peg$c95 = { type: "literal", value: "^", description: "\"^\"" },
  49799. peg$c96 = function(expression) {
  49800. return globals.ReturnNode._new()
  49801. ._position_((line()).__at(column()))
  49802. ._source_(text())
  49803. ._nodes_([expression]);
  49804. },
  49805. peg$c97 = "|",
  49806. peg$c98 = { type: "literal", value: "|", description: "\"|\"" },
  49807. peg$c99 = function(variable) {return variable;},
  49808. peg$c100 = function(vars) {return vars;},
  49809. peg$c101 = function(param) {return param;},
  49810. peg$c102 = function(params) {return params;},
  49811. peg$c103 = function(ret) {return [ret];},
  49812. peg$c104 = function(exps, ret) {
  49813. var expressions = exps;
  49814. expressions.push(ret);
  49815. return expressions;
  49816. },
  49817. peg$c105 = function(expressions) {
  49818. return expressions || [];
  49819. },
  49820. peg$c106 = function(temps, statements) {
  49821. return globals.SequenceNode._new()
  49822. ._position_((line()).__at(column()))
  49823. ._source_(text())
  49824. ._temps_(temps || [])
  49825. ._nodes_(statements || []);
  49826. },
  49827. peg$c107 = "[",
  49828. peg$c108 = { type: "literal", value: "[", description: "\"[\"" },
  49829. peg$c109 = "]",
  49830. peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
  49831. peg$c111 = function(params, sequence) {
  49832. return globals.BlockNode._new()
  49833. ._position_((line()).__at(column()))
  49834. ._source_(text())
  49835. ._parameters_(params || [])
  49836. ._nodes_([sequence._asBlockSequenceNode()]);
  49837. },
  49838. peg$c112 = void 0,
  49839. peg$c113 = function(selector) {
  49840. return globals.SendNode._new()
  49841. ._position_((line()).__at(column()))
  49842. ._source_(text())
  49843. ._selector_(selector);
  49844. },
  49845. peg$c114 = function(message, tail) {
  49846. if(tail) {
  49847. return tail._valueForReceiver_(message);
  49848. }
  49849. else {
  49850. return message;
  49851. }
  49852. },
  49853. peg$c115 = function(receiver, tail) {
  49854. if(tail) {
  49855. return tail._valueForReceiver_(receiver);
  49856. }
  49857. else {
  49858. return receiver;
  49859. }
  49860. },
  49861. peg$c116 = function(selector, arg) {
  49862. return globals.SendNode._new()
  49863. ._position_((line()).__at(column()))
  49864. ._source_(text())
  49865. ._selector_(selector)
  49866. ._arguments_([arg]);
  49867. },
  49868. peg$c117 = function(message, tail) {
  49869. if(tail) {
  49870. return tail._valueForReceiver_(message);
  49871. }
  49872. else {
  49873. return message;
  49874. }
  49875. },
  49876. peg$c118 = function(pairs) {
  49877. var selector = [];
  49878. var args = [];
  49879. for(var i = 0; i < pairs.length; i++) {
  49880. selector.push(pairs[i].key);
  49881. args.push(pairs[i].arg);
  49882. }
  49883. return globals.SendNode._new()
  49884. ._position_((line()).__at(column()))
  49885. ._source_(text())
  49886. ._selector_(selector.join(""))
  49887. ._arguments_(args);
  49888. },
  49889. peg$c119 = function(receiver, tail) {
  49890. return tail._valueForReceiver_(receiver);
  49891. },
  49892. peg$c120 = ";",
  49893. peg$c121 = { type: "literal", value: ";", description: "\";\"" },
  49894. peg$c122 = function(mess) {return mess;},
  49895. peg$c123 = function(send, messages) {
  49896. var cascade = [];
  49897. cascade.push(send);
  49898. for(var i = 0; i < messages.length; i++) {
  49899. cascade.push(messages[i]);
  49900. }
  49901. return globals.CascadeNode._new()
  49902. ._position_((line()).__at(column()))
  49903. ._source_(text())
  49904. ._receiver_(send._receiver())
  49905. ._nodes_(cascade);
  49906. },
  49907. peg$c124 = "<",
  49908. peg$c125 = { type: "literal", value: "<", description: "\"<\"" },
  49909. peg$c126 = ">>",
  49910. peg$c127 = { type: "literal", value: ">>", description: "\">>\"" },
  49911. peg$c128 = function() {return ">";},
  49912. peg$c129 = /^[^>]/,
  49913. peg$c130 = { type: "class", value: "[^>]", description: "[^>]" },
  49914. peg$c131 = ">",
  49915. peg$c132 = { type: "literal", value: ">", description: "\">\"" },
  49916. peg$c133 = function(val) {
  49917. return globals.JSStatementNode._new()
  49918. ._position_((line()).__at(column()))
  49919. ._source_(val.join(""))
  49920. },
  49921. peg$c134 = function(pattern, sequence) {
  49922. return globals.MethodNode._new()
  49923. ._position_((line()).__at(column()))
  49924. ._source_(text())
  49925. ._selector_(pattern[0])
  49926. ._arguments_(pattern[1])
  49927. ._nodes_([sequence]);
  49928. },
  49929. peg$c135 = function(send) { return send._selector() === "->" },
  49930. peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  49931. peg$c137 = function(first, others) { return first.concat.apply(first, others); },
  49932. peg$currPos = 0,
  49933. peg$reportedPos = 0,
  49934. peg$cachedPos = 0,
  49935. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  49936. peg$maxFailPos = 0,
  49937. peg$maxFailExpected = [],
  49938. peg$silentFails = 0,
  49939. peg$cache = {},
  49940. peg$result;
  49941. if ("startRule" in options) {
  49942. if (!(options.startRule in peg$startRuleFunctions)) {
  49943. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  49944. }
  49945. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  49946. }
  49947. function text() {
  49948. return input.substring(peg$reportedPos, peg$currPos);
  49949. }
  49950. function offset() {
  49951. return peg$reportedPos;
  49952. }
  49953. function line() {
  49954. return peg$computePosDetails(peg$reportedPos).line;
  49955. }
  49956. function column() {
  49957. return peg$computePosDetails(peg$reportedPos).column;
  49958. }
  49959. function expected(description) {
  49960. throw peg$buildException(
  49961. null,
  49962. [{ type: "other", description: description }],
  49963. peg$reportedPos
  49964. );
  49965. }
  49966. function error(message) {
  49967. throw peg$buildException(message, null, peg$reportedPos);
  49968. }
  49969. function peg$computePosDetails(pos) {
  49970. function advance(details, startPos, endPos) {
  49971. var p, ch;
  49972. for (p = startPos; p < endPos; p++) {
  49973. ch = input.charAt(p);
  49974. if (ch === "\n") {
  49975. if (!details.seenCR) { details.line++; }
  49976. details.column = 1;
  49977. details.seenCR = false;
  49978. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  49979. details.line++;
  49980. details.column = 1;
  49981. details.seenCR = true;
  49982. } else {
  49983. details.column++;
  49984. details.seenCR = false;
  49985. }
  49986. }
  49987. }
  49988. if (peg$cachedPos !== pos) {
  49989. if (peg$cachedPos > pos) {
  49990. peg$cachedPos = 0;
  49991. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  49992. }
  49993. advance(peg$cachedPosDetails, peg$cachedPos, pos);
  49994. peg$cachedPos = pos;
  49995. }
  49996. return peg$cachedPosDetails;
  49997. }
  49998. function peg$fail(expected) {
  49999. if (peg$currPos < peg$maxFailPos) { return; }
  50000. if (peg$currPos > peg$maxFailPos) {
  50001. peg$maxFailPos = peg$currPos;
  50002. peg$maxFailExpected = [];
  50003. }
  50004. peg$maxFailExpected.push(expected);
  50005. }
  50006. function peg$buildException(message, expected, pos) {
  50007. function cleanupExpected(expected) {
  50008. var i = 1;
  50009. expected.sort(function(a, b) {
  50010. if (a.description < b.description) {
  50011. return -1;
  50012. } else if (a.description > b.description) {
  50013. return 1;
  50014. } else {
  50015. return 0;
  50016. }
  50017. });
  50018. while (i < expected.length) {
  50019. if (expected[i - 1] === expected[i]) {
  50020. expected.splice(i, 1);
  50021. } else {
  50022. i++;
  50023. }
  50024. }
  50025. }
  50026. function buildMessage(expected, found) {
  50027. function stringEscape(s) {
  50028. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  50029. return s
  50030. .replace(/\\/g, '\\\\')
  50031. .replace(/"/g, '\\"')
  50032. .replace(/\x08/g, '\\b')
  50033. .replace(/\t/g, '\\t')
  50034. .replace(/\n/g, '\\n')
  50035. .replace(/\f/g, '\\f')
  50036. .replace(/\r/g, '\\r')
  50037. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  50038. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  50039. .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  50040. .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  50041. }
  50042. var expectedDescs = new Array(expected.length),
  50043. expectedDesc, foundDesc, i;
  50044. for (i = 0; i < expected.length; i++) {
  50045. expectedDescs[i] = expected[i].description;
  50046. }
  50047. expectedDesc = expected.length > 1
  50048. ? expectedDescs.slice(0, -1).join(", ")
  50049. + " or "
  50050. + expectedDescs[expected.length - 1]
  50051. : expectedDescs[0];
  50052. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  50053. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  50054. }
  50055. var posDetails = peg$computePosDetails(pos),
  50056. found = pos < input.length ? input.charAt(pos) : null;
  50057. if (expected !== null) {
  50058. cleanupExpected(expected);
  50059. }
  50060. return new SyntaxError(
  50061. message !== null ? message : buildMessage(expected, found),
  50062. expected,
  50063. found,
  50064. pos,
  50065. posDetails.line,
  50066. posDetails.column
  50067. );
  50068. }
  50069. function peg$parsestart() {
  50070. var s0;
  50071. var key = peg$currPos * 60 + 0,
  50072. cached = peg$cache[key];
  50073. if (cached) {
  50074. peg$currPos = cached.nextPos;
  50075. return cached.result;
  50076. }
  50077. s0 = peg$parsemethod();
  50078. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50079. return s0;
  50080. }
  50081. function peg$parseseparator() {
  50082. var s0, s1;
  50083. var key = peg$currPos * 60 + 1,
  50084. cached = peg$cache[key];
  50085. if (cached) {
  50086. peg$currPos = cached.nextPos;
  50087. return cached.result;
  50088. }
  50089. s0 = [];
  50090. if (peg$c2.test(input.charAt(peg$currPos))) {
  50091. s1 = input.charAt(peg$currPos);
  50092. peg$currPos++;
  50093. } else {
  50094. s1 = peg$FAILED;
  50095. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  50096. }
  50097. if (s1 !== peg$FAILED) {
  50098. while (s1 !== peg$FAILED) {
  50099. s0.push(s1);
  50100. if (peg$c2.test(input.charAt(peg$currPos))) {
  50101. s1 = input.charAt(peg$currPos);
  50102. peg$currPos++;
  50103. } else {
  50104. s1 = peg$FAILED;
  50105. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  50106. }
  50107. }
  50108. } else {
  50109. s0 = peg$c1;
  50110. }
  50111. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50112. return s0;
  50113. }
  50114. function peg$parsecomments() {
  50115. var s0, s1, s2, s3, s4;
  50116. var key = peg$currPos * 60 + 2,
  50117. cached = peg$cache[key];
  50118. if (cached) {
  50119. peg$currPos = cached.nextPos;
  50120. return cached.result;
  50121. }
  50122. s0 = [];
  50123. s1 = peg$currPos;
  50124. if (input.charCodeAt(peg$currPos) === 34) {
  50125. s2 = peg$c4;
  50126. peg$currPos++;
  50127. } else {
  50128. s2 = peg$FAILED;
  50129. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  50130. }
  50131. if (s2 !== peg$FAILED) {
  50132. s3 = [];
  50133. if (peg$c6.test(input.charAt(peg$currPos))) {
  50134. s4 = input.charAt(peg$currPos);
  50135. peg$currPos++;
  50136. } else {
  50137. s4 = peg$FAILED;
  50138. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  50139. }
  50140. while (s4 !== peg$FAILED) {
  50141. s3.push(s4);
  50142. if (peg$c6.test(input.charAt(peg$currPos))) {
  50143. s4 = input.charAt(peg$currPos);
  50144. peg$currPos++;
  50145. } else {
  50146. s4 = peg$FAILED;
  50147. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  50148. }
  50149. }
  50150. if (s3 !== peg$FAILED) {
  50151. if (input.charCodeAt(peg$currPos) === 34) {
  50152. s4 = peg$c4;
  50153. peg$currPos++;
  50154. } else {
  50155. s4 = peg$FAILED;
  50156. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  50157. }
  50158. if (s4 !== peg$FAILED) {
  50159. s2 = [s2, s3, s4];
  50160. s1 = s2;
  50161. } else {
  50162. peg$currPos = s1;
  50163. s1 = peg$c1;
  50164. }
  50165. } else {
  50166. peg$currPos = s1;
  50167. s1 = peg$c1;
  50168. }
  50169. } else {
  50170. peg$currPos = s1;
  50171. s1 = peg$c1;
  50172. }
  50173. if (s1 !== peg$FAILED) {
  50174. while (s1 !== peg$FAILED) {
  50175. s0.push(s1);
  50176. s1 = peg$currPos;
  50177. if (input.charCodeAt(peg$currPos) === 34) {
  50178. s2 = peg$c4;
  50179. peg$currPos++;
  50180. } else {
  50181. s2 = peg$FAILED;
  50182. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  50183. }
  50184. if (s2 !== peg$FAILED) {
  50185. s3 = [];
  50186. if (peg$c6.test(input.charAt(peg$currPos))) {
  50187. s4 = input.charAt(peg$currPos);
  50188. peg$currPos++;
  50189. } else {
  50190. s4 = peg$FAILED;
  50191. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  50192. }
  50193. while (s4 !== peg$FAILED) {
  50194. s3.push(s4);
  50195. if (peg$c6.test(input.charAt(peg$currPos))) {
  50196. s4 = input.charAt(peg$currPos);
  50197. peg$currPos++;
  50198. } else {
  50199. s4 = peg$FAILED;
  50200. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  50201. }
  50202. }
  50203. if (s3 !== peg$FAILED) {
  50204. if (input.charCodeAt(peg$currPos) === 34) {
  50205. s4 = peg$c4;
  50206. peg$currPos++;
  50207. } else {
  50208. s4 = peg$FAILED;
  50209. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  50210. }
  50211. if (s4 !== peg$FAILED) {
  50212. s2 = [s2, s3, s4];
  50213. s1 = s2;
  50214. } else {
  50215. peg$currPos = s1;
  50216. s1 = peg$c1;
  50217. }
  50218. } else {
  50219. peg$currPos = s1;
  50220. s1 = peg$c1;
  50221. }
  50222. } else {
  50223. peg$currPos = s1;
  50224. s1 = peg$c1;
  50225. }
  50226. }
  50227. } else {
  50228. s0 = peg$c1;
  50229. }
  50230. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50231. return s0;
  50232. }
  50233. function peg$parsews() {
  50234. var s0, s1;
  50235. var key = peg$currPos * 60 + 3,
  50236. cached = peg$cache[key];
  50237. if (cached) {
  50238. peg$currPos = cached.nextPos;
  50239. return cached.result;
  50240. }
  50241. s0 = [];
  50242. s1 = peg$parseseparator();
  50243. if (s1 === peg$FAILED) {
  50244. s1 = peg$parsecomments();
  50245. }
  50246. while (s1 !== peg$FAILED) {
  50247. s0.push(s1);
  50248. s1 = peg$parseseparator();
  50249. if (s1 === peg$FAILED) {
  50250. s1 = peg$parsecomments();
  50251. }
  50252. }
  50253. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50254. return s0;
  50255. }
  50256. function peg$parseidentifier() {
  50257. var s0, s1, s2, s3;
  50258. var key = peg$currPos * 60 + 4,
  50259. cached = peg$cache[key];
  50260. if (cached) {
  50261. peg$currPos = cached.nextPos;
  50262. return cached.result;
  50263. }
  50264. s0 = peg$currPos;
  50265. if (peg$c8.test(input.charAt(peg$currPos))) {
  50266. s1 = input.charAt(peg$currPos);
  50267. peg$currPos++;
  50268. } else {
  50269. s1 = peg$FAILED;
  50270. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  50271. }
  50272. if (s1 !== peg$FAILED) {
  50273. s2 = [];
  50274. if (peg$c10.test(input.charAt(peg$currPos))) {
  50275. s3 = input.charAt(peg$currPos);
  50276. peg$currPos++;
  50277. } else {
  50278. s3 = peg$FAILED;
  50279. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  50280. }
  50281. while (s3 !== peg$FAILED) {
  50282. s2.push(s3);
  50283. if (peg$c10.test(input.charAt(peg$currPos))) {
  50284. s3 = input.charAt(peg$currPos);
  50285. peg$currPos++;
  50286. } else {
  50287. s3 = peg$FAILED;
  50288. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  50289. }
  50290. }
  50291. if (s2 !== peg$FAILED) {
  50292. peg$reportedPos = s0;
  50293. s1 = peg$c12(s1, s2);
  50294. s0 = s1;
  50295. } else {
  50296. peg$currPos = s0;
  50297. s0 = peg$c1;
  50298. }
  50299. } else {
  50300. peg$currPos = s0;
  50301. s0 = peg$c1;
  50302. }
  50303. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50304. return s0;
  50305. }
  50306. function peg$parsekeyword() {
  50307. var s0, s1, s2;
  50308. var key = peg$currPos * 60 + 5,
  50309. cached = peg$cache[key];
  50310. if (cached) {
  50311. peg$currPos = cached.nextPos;
  50312. return cached.result;
  50313. }
  50314. s0 = peg$currPos;
  50315. s1 = peg$parseidentifier();
  50316. if (s1 !== peg$FAILED) {
  50317. if (input.charCodeAt(peg$currPos) === 58) {
  50318. s2 = peg$c13;
  50319. peg$currPos++;
  50320. } else {
  50321. s2 = peg$FAILED;
  50322. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  50323. }
  50324. if (s2 !== peg$FAILED) {
  50325. peg$reportedPos = s0;
  50326. s1 = peg$c15(s1, s2);
  50327. s0 = s1;
  50328. } else {
  50329. peg$currPos = s0;
  50330. s0 = peg$c1;
  50331. }
  50332. } else {
  50333. peg$currPos = s0;
  50334. s0 = peg$c1;
  50335. }
  50336. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50337. return s0;
  50338. }
  50339. function peg$parseselector() {
  50340. var s0, s1, s2, s3;
  50341. var key = peg$currPos * 60 + 6,
  50342. cached = peg$cache[key];
  50343. if (cached) {
  50344. peg$currPos = cached.nextPos;
  50345. return cached.result;
  50346. }
  50347. s0 = peg$currPos;
  50348. if (peg$c8.test(input.charAt(peg$currPos))) {
  50349. s1 = input.charAt(peg$currPos);
  50350. peg$currPos++;
  50351. } else {
  50352. s1 = peg$FAILED;
  50353. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  50354. }
  50355. if (s1 !== peg$FAILED) {
  50356. s2 = [];
  50357. if (peg$c16.test(input.charAt(peg$currPos))) {
  50358. s3 = input.charAt(peg$currPos);
  50359. peg$currPos++;
  50360. } else {
  50361. s3 = peg$FAILED;
  50362. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  50363. }
  50364. while (s3 !== peg$FAILED) {
  50365. s2.push(s3);
  50366. if (peg$c16.test(input.charAt(peg$currPos))) {
  50367. s3 = input.charAt(peg$currPos);
  50368. peg$currPos++;
  50369. } else {
  50370. s3 = peg$FAILED;
  50371. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  50372. }
  50373. }
  50374. if (s2 !== peg$FAILED) {
  50375. peg$reportedPos = s0;
  50376. s1 = peg$c12(s1, s2);
  50377. s0 = s1;
  50378. } else {
  50379. peg$currPos = s0;
  50380. s0 = peg$c1;
  50381. }
  50382. } else {
  50383. peg$currPos = s0;
  50384. s0 = peg$c1;
  50385. }
  50386. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50387. return s0;
  50388. }
  50389. function peg$parseclassName() {
  50390. var s0, s1, s2, s3;
  50391. var key = peg$currPos * 60 + 7,
  50392. cached = peg$cache[key];
  50393. if (cached) {
  50394. peg$currPos = cached.nextPos;
  50395. return cached.result;
  50396. }
  50397. s0 = peg$currPos;
  50398. if (peg$c18.test(input.charAt(peg$currPos))) {
  50399. s1 = input.charAt(peg$currPos);
  50400. peg$currPos++;
  50401. } else {
  50402. s1 = peg$FAILED;
  50403. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  50404. }
  50405. if (s1 !== peg$FAILED) {
  50406. s2 = [];
  50407. if (peg$c10.test(input.charAt(peg$currPos))) {
  50408. s3 = input.charAt(peg$currPos);
  50409. peg$currPos++;
  50410. } else {
  50411. s3 = peg$FAILED;
  50412. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  50413. }
  50414. while (s3 !== peg$FAILED) {
  50415. s2.push(s3);
  50416. if (peg$c10.test(input.charAt(peg$currPos))) {
  50417. s3 = input.charAt(peg$currPos);
  50418. peg$currPos++;
  50419. } else {
  50420. s3 = peg$FAILED;
  50421. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  50422. }
  50423. }
  50424. if (s2 !== peg$FAILED) {
  50425. peg$reportedPos = s0;
  50426. s1 = peg$c12(s1, s2);
  50427. s0 = s1;
  50428. } else {
  50429. peg$currPos = s0;
  50430. s0 = peg$c1;
  50431. }
  50432. } else {
  50433. peg$currPos = s0;
  50434. s0 = peg$c1;
  50435. }
  50436. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50437. return s0;
  50438. }
  50439. function peg$parsestring() {
  50440. var s0, s1, s2, s3, s4;
  50441. var key = peg$currPos * 60 + 8,
  50442. cached = peg$cache[key];
  50443. if (cached) {
  50444. peg$currPos = cached.nextPos;
  50445. return cached.result;
  50446. }
  50447. s0 = peg$currPos;
  50448. if (input.charCodeAt(peg$currPos) === 39) {
  50449. s1 = peg$c20;
  50450. peg$currPos++;
  50451. } else {
  50452. s1 = peg$FAILED;
  50453. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  50454. }
  50455. if (s1 !== peg$FAILED) {
  50456. s2 = [];
  50457. s3 = peg$currPos;
  50458. if (input.substr(peg$currPos, 2) === peg$c22) {
  50459. s4 = peg$c22;
  50460. peg$currPos += 2;
  50461. } else {
  50462. s4 = peg$FAILED;
  50463. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  50464. }
  50465. if (s4 !== peg$FAILED) {
  50466. peg$reportedPos = s3;
  50467. s4 = peg$c24();
  50468. }
  50469. s3 = s4;
  50470. if (s3 === peg$FAILED) {
  50471. if (peg$c25.test(input.charAt(peg$currPos))) {
  50472. s3 = input.charAt(peg$currPos);
  50473. peg$currPos++;
  50474. } else {
  50475. s3 = peg$FAILED;
  50476. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  50477. }
  50478. }
  50479. while (s3 !== peg$FAILED) {
  50480. s2.push(s3);
  50481. s3 = peg$currPos;
  50482. if (input.substr(peg$currPos, 2) === peg$c22) {
  50483. s4 = peg$c22;
  50484. peg$currPos += 2;
  50485. } else {
  50486. s4 = peg$FAILED;
  50487. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  50488. }
  50489. if (s4 !== peg$FAILED) {
  50490. peg$reportedPos = s3;
  50491. s4 = peg$c24();
  50492. }
  50493. s3 = s4;
  50494. if (s3 === peg$FAILED) {
  50495. if (peg$c25.test(input.charAt(peg$currPos))) {
  50496. s3 = input.charAt(peg$currPos);
  50497. peg$currPos++;
  50498. } else {
  50499. s3 = peg$FAILED;
  50500. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  50501. }
  50502. }
  50503. }
  50504. if (s2 !== peg$FAILED) {
  50505. if (input.charCodeAt(peg$currPos) === 39) {
  50506. s3 = peg$c20;
  50507. peg$currPos++;
  50508. } else {
  50509. s3 = peg$FAILED;
  50510. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  50511. }
  50512. if (s3 !== peg$FAILED) {
  50513. peg$reportedPos = s0;
  50514. s1 = peg$c27(s2);
  50515. s0 = s1;
  50516. } else {
  50517. peg$currPos = s0;
  50518. s0 = peg$c1;
  50519. }
  50520. } else {
  50521. peg$currPos = s0;
  50522. s0 = peg$c1;
  50523. }
  50524. } else {
  50525. peg$currPos = s0;
  50526. s0 = peg$c1;
  50527. }
  50528. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50529. return s0;
  50530. }
  50531. function peg$parsecharacter() {
  50532. var s0, s1, s2;
  50533. var key = peg$currPos * 60 + 9,
  50534. cached = peg$cache[key];
  50535. if (cached) {
  50536. peg$currPos = cached.nextPos;
  50537. return cached.result;
  50538. }
  50539. s0 = peg$currPos;
  50540. if (input.charCodeAt(peg$currPos) === 36) {
  50541. s1 = peg$c28;
  50542. peg$currPos++;
  50543. } else {
  50544. s1 = peg$FAILED;
  50545. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  50546. }
  50547. if (s1 !== peg$FAILED) {
  50548. if (input.length > peg$currPos) {
  50549. s2 = input.charAt(peg$currPos);
  50550. peg$currPos++;
  50551. } else {
  50552. s2 = peg$FAILED;
  50553. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  50554. }
  50555. if (s2 !== peg$FAILED) {
  50556. peg$reportedPos = s0;
  50557. s1 = peg$c31(s2);
  50558. s0 = s1;
  50559. } else {
  50560. peg$currPos = s0;
  50561. s0 = peg$c1;
  50562. }
  50563. } else {
  50564. peg$currPos = s0;
  50565. s0 = peg$c1;
  50566. }
  50567. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50568. return s0;
  50569. }
  50570. function peg$parsesymbol() {
  50571. var s0, s1, s2;
  50572. var key = peg$currPos * 60 + 10,
  50573. cached = peg$cache[key];
  50574. if (cached) {
  50575. peg$currPos = cached.nextPos;
  50576. return cached.result;
  50577. }
  50578. s0 = peg$currPos;
  50579. if (input.charCodeAt(peg$currPos) === 35) {
  50580. s1 = peg$c32;
  50581. peg$currPos++;
  50582. } else {
  50583. s1 = peg$FAILED;
  50584. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  50585. }
  50586. if (s1 !== peg$FAILED) {
  50587. s2 = peg$parsebareSymbol();
  50588. if (s2 !== peg$FAILED) {
  50589. peg$reportedPos = s0;
  50590. s1 = peg$c34(s2);
  50591. s0 = s1;
  50592. } else {
  50593. peg$currPos = s0;
  50594. s0 = peg$c1;
  50595. }
  50596. } else {
  50597. peg$currPos = s0;
  50598. s0 = peg$c1;
  50599. }
  50600. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50601. return s0;
  50602. }
  50603. function peg$parsebareSymbol() {
  50604. var s0, s1, s2;
  50605. var key = peg$currPos * 60 + 11,
  50606. cached = peg$cache[key];
  50607. if (cached) {
  50608. peg$currPos = cached.nextPos;
  50609. return cached.result;
  50610. }
  50611. s0 = peg$currPos;
  50612. s1 = peg$parseselector();
  50613. if (s1 === peg$FAILED) {
  50614. s1 = peg$parsebinarySelector();
  50615. if (s1 === peg$FAILED) {
  50616. s1 = peg$currPos;
  50617. s2 = peg$parsestring();
  50618. if (s2 !== peg$FAILED) {
  50619. peg$reportedPos = s1;
  50620. s2 = peg$c35(s2);
  50621. }
  50622. s1 = s2;
  50623. }
  50624. }
  50625. if (s1 !== peg$FAILED) {
  50626. peg$reportedPos = s0;
  50627. s1 = peg$c36(s1);
  50628. }
  50629. s0 = s1;
  50630. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50631. return s0;
  50632. }
  50633. function peg$parsenumber() {
  50634. var s0, s1;
  50635. var key = peg$currPos * 60 + 12,
  50636. cached = peg$cache[key];
  50637. if (cached) {
  50638. peg$currPos = cached.nextPos;
  50639. return cached.result;
  50640. }
  50641. s0 = peg$currPos;
  50642. s1 = peg$parsenumberExp();
  50643. if (s1 === peg$FAILED) {
  50644. s1 = peg$parsehex();
  50645. if (s1 === peg$FAILED) {
  50646. s1 = peg$parsefloat();
  50647. if (s1 === peg$FAILED) {
  50648. s1 = peg$parseinteger();
  50649. }
  50650. }
  50651. }
  50652. if (s1 !== peg$FAILED) {
  50653. peg$reportedPos = s0;
  50654. s1 = peg$c37(s1);
  50655. }
  50656. s0 = s1;
  50657. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50658. return s0;
  50659. }
  50660. function peg$parsenumberExp() {
  50661. var s0, s1, s2, s3, s4;
  50662. var key = peg$currPos * 60 + 13,
  50663. cached = peg$cache[key];
  50664. if (cached) {
  50665. peg$currPos = cached.nextPos;
  50666. return cached.result;
  50667. }
  50668. s0 = peg$currPos;
  50669. s1 = peg$currPos;
  50670. s2 = peg$parsefloat();
  50671. if (s2 === peg$FAILED) {
  50672. s2 = peg$parseinteger();
  50673. }
  50674. if (s2 !== peg$FAILED) {
  50675. if (input.charCodeAt(peg$currPos) === 101) {
  50676. s3 = peg$c38;
  50677. peg$currPos++;
  50678. } else {
  50679. s3 = peg$FAILED;
  50680. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  50681. }
  50682. if (s3 !== peg$FAILED) {
  50683. s4 = peg$parseinteger();
  50684. if (s4 !== peg$FAILED) {
  50685. s2 = [s2, s3, s4];
  50686. s1 = s2;
  50687. } else {
  50688. peg$currPos = s1;
  50689. s1 = peg$c1;
  50690. }
  50691. } else {
  50692. peg$currPos = s1;
  50693. s1 = peg$c1;
  50694. }
  50695. } else {
  50696. peg$currPos = s1;
  50697. s1 = peg$c1;
  50698. }
  50699. if (s1 !== peg$FAILED) {
  50700. peg$reportedPos = s0;
  50701. s1 = peg$c40(s1);
  50702. }
  50703. s0 = s1;
  50704. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50705. return s0;
  50706. }
  50707. function peg$parsehex() {
  50708. var s0, s1, s2, s3, s4;
  50709. var key = peg$currPos * 60 + 14,
  50710. cached = peg$cache[key];
  50711. if (cached) {
  50712. peg$currPos = cached.nextPos;
  50713. return cached.result;
  50714. }
  50715. s0 = peg$currPos;
  50716. if (input.charCodeAt(peg$currPos) === 45) {
  50717. s1 = peg$c42;
  50718. peg$currPos++;
  50719. } else {
  50720. s1 = peg$FAILED;
  50721. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  50722. }
  50723. if (s1 === peg$FAILED) {
  50724. s1 = peg$c41;
  50725. }
  50726. if (s1 !== peg$FAILED) {
  50727. if (input.substr(peg$currPos, 3) === peg$c44) {
  50728. s2 = peg$c44;
  50729. peg$currPos += 3;
  50730. } else {
  50731. s2 = peg$FAILED;
  50732. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  50733. }
  50734. if (s2 !== peg$FAILED) {
  50735. s3 = [];
  50736. if (peg$c46.test(input.charAt(peg$currPos))) {
  50737. s4 = input.charAt(peg$currPos);
  50738. peg$currPos++;
  50739. } else {
  50740. s4 = peg$FAILED;
  50741. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  50742. }
  50743. if (s4 !== peg$FAILED) {
  50744. while (s4 !== peg$FAILED) {
  50745. s3.push(s4);
  50746. if (peg$c46.test(input.charAt(peg$currPos))) {
  50747. s4 = input.charAt(peg$currPos);
  50748. peg$currPos++;
  50749. } else {
  50750. s4 = peg$FAILED;
  50751. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  50752. }
  50753. }
  50754. } else {
  50755. s3 = peg$c1;
  50756. }
  50757. if (s3 !== peg$FAILED) {
  50758. peg$reportedPos = s0;
  50759. s1 = peg$c48(s1, s3);
  50760. s0 = s1;
  50761. } else {
  50762. peg$currPos = s0;
  50763. s0 = peg$c1;
  50764. }
  50765. } else {
  50766. peg$currPos = s0;
  50767. s0 = peg$c1;
  50768. }
  50769. } else {
  50770. peg$currPos = s0;
  50771. s0 = peg$c1;
  50772. }
  50773. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50774. return s0;
  50775. }
  50776. function peg$parsefloat() {
  50777. var s0, s1, s2, s3, s4, s5;
  50778. var key = peg$currPos * 60 + 15,
  50779. cached = peg$cache[key];
  50780. if (cached) {
  50781. peg$currPos = cached.nextPos;
  50782. return cached.result;
  50783. }
  50784. s0 = peg$currPos;
  50785. if (input.charCodeAt(peg$currPos) === 45) {
  50786. s1 = peg$c42;
  50787. peg$currPos++;
  50788. } else {
  50789. s1 = peg$FAILED;
  50790. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  50791. }
  50792. if (s1 === peg$FAILED) {
  50793. s1 = peg$c41;
  50794. }
  50795. if (s1 !== peg$FAILED) {
  50796. s2 = [];
  50797. if (peg$c49.test(input.charAt(peg$currPos))) {
  50798. s3 = input.charAt(peg$currPos);
  50799. peg$currPos++;
  50800. } else {
  50801. s3 = peg$FAILED;
  50802. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50803. }
  50804. if (s3 !== peg$FAILED) {
  50805. while (s3 !== peg$FAILED) {
  50806. s2.push(s3);
  50807. if (peg$c49.test(input.charAt(peg$currPos))) {
  50808. s3 = input.charAt(peg$currPos);
  50809. peg$currPos++;
  50810. } else {
  50811. s3 = peg$FAILED;
  50812. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50813. }
  50814. }
  50815. } else {
  50816. s2 = peg$c1;
  50817. }
  50818. if (s2 !== peg$FAILED) {
  50819. if (input.charCodeAt(peg$currPos) === 46) {
  50820. s3 = peg$c51;
  50821. peg$currPos++;
  50822. } else {
  50823. s3 = peg$FAILED;
  50824. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  50825. }
  50826. if (s3 !== peg$FAILED) {
  50827. s4 = [];
  50828. if (peg$c49.test(input.charAt(peg$currPos))) {
  50829. s5 = input.charAt(peg$currPos);
  50830. peg$currPos++;
  50831. } else {
  50832. s5 = peg$FAILED;
  50833. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50834. }
  50835. if (s5 !== peg$FAILED) {
  50836. while (s5 !== peg$FAILED) {
  50837. s4.push(s5);
  50838. if (peg$c49.test(input.charAt(peg$currPos))) {
  50839. s5 = input.charAt(peg$currPos);
  50840. peg$currPos++;
  50841. } else {
  50842. s5 = peg$FAILED;
  50843. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50844. }
  50845. }
  50846. } else {
  50847. s4 = peg$c1;
  50848. }
  50849. if (s4 !== peg$FAILED) {
  50850. peg$reportedPos = s0;
  50851. s1 = peg$c53(s1, s2, s4);
  50852. s0 = s1;
  50853. } else {
  50854. peg$currPos = s0;
  50855. s0 = peg$c1;
  50856. }
  50857. } else {
  50858. peg$currPos = s0;
  50859. s0 = peg$c1;
  50860. }
  50861. } else {
  50862. peg$currPos = s0;
  50863. s0 = peg$c1;
  50864. }
  50865. } else {
  50866. peg$currPos = s0;
  50867. s0 = peg$c1;
  50868. }
  50869. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50870. return s0;
  50871. }
  50872. function peg$parseinteger() {
  50873. var s0, s1, s2, s3;
  50874. var key = peg$currPos * 60 + 16,
  50875. cached = peg$cache[key];
  50876. if (cached) {
  50877. peg$currPos = cached.nextPos;
  50878. return cached.result;
  50879. }
  50880. s0 = peg$currPos;
  50881. if (input.charCodeAt(peg$currPos) === 45) {
  50882. s1 = peg$c42;
  50883. peg$currPos++;
  50884. } else {
  50885. s1 = peg$FAILED;
  50886. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  50887. }
  50888. if (s1 === peg$FAILED) {
  50889. s1 = peg$c41;
  50890. }
  50891. if (s1 !== peg$FAILED) {
  50892. s2 = [];
  50893. if (peg$c49.test(input.charAt(peg$currPos))) {
  50894. s3 = input.charAt(peg$currPos);
  50895. peg$currPos++;
  50896. } else {
  50897. s3 = peg$FAILED;
  50898. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50899. }
  50900. if (s3 !== peg$FAILED) {
  50901. while (s3 !== peg$FAILED) {
  50902. s2.push(s3);
  50903. if (peg$c49.test(input.charAt(peg$currPos))) {
  50904. s3 = input.charAt(peg$currPos);
  50905. peg$currPos++;
  50906. } else {
  50907. s3 = peg$FAILED;
  50908. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50909. }
  50910. }
  50911. } else {
  50912. s2 = peg$c1;
  50913. }
  50914. if (s2 !== peg$FAILED) {
  50915. peg$reportedPos = s0;
  50916. s1 = peg$c54(s1, s2);
  50917. s0 = s1;
  50918. } else {
  50919. peg$currPos = s0;
  50920. s0 = peg$c1;
  50921. }
  50922. } else {
  50923. peg$currPos = s0;
  50924. s0 = peg$c1;
  50925. }
  50926. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50927. return s0;
  50928. }
  50929. function peg$parseliteralArray() {
  50930. var s0, s1, s2;
  50931. var key = peg$currPos * 60 + 17,
  50932. cached = peg$cache[key];
  50933. if (cached) {
  50934. peg$currPos = cached.nextPos;
  50935. return cached.result;
  50936. }
  50937. s0 = peg$currPos;
  50938. if (input.substr(peg$currPos, 2) === peg$c55) {
  50939. s1 = peg$c55;
  50940. peg$currPos += 2;
  50941. } else {
  50942. s1 = peg$FAILED;
  50943. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  50944. }
  50945. if (s1 !== peg$FAILED) {
  50946. s2 = peg$parseliteralArrayRest();
  50947. if (s2 !== peg$FAILED) {
  50948. peg$reportedPos = s0;
  50949. s1 = peg$c34(s2);
  50950. s0 = s1;
  50951. } else {
  50952. peg$currPos = s0;
  50953. s0 = peg$c1;
  50954. }
  50955. } else {
  50956. peg$currPos = s0;
  50957. s0 = peg$c1;
  50958. }
  50959. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50960. return s0;
  50961. }
  50962. function peg$parsebareLiteralArray() {
  50963. var s0, s1, s2;
  50964. var key = peg$currPos * 60 + 18,
  50965. cached = peg$cache[key];
  50966. if (cached) {
  50967. peg$currPos = cached.nextPos;
  50968. return cached.result;
  50969. }
  50970. s0 = peg$currPos;
  50971. if (input.charCodeAt(peg$currPos) === 40) {
  50972. s1 = peg$c57;
  50973. peg$currPos++;
  50974. } else {
  50975. s1 = peg$FAILED;
  50976. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  50977. }
  50978. if (s1 !== peg$FAILED) {
  50979. s2 = peg$parseliteralArrayRest();
  50980. if (s2 !== peg$FAILED) {
  50981. peg$reportedPos = s0;
  50982. s1 = peg$c34(s2);
  50983. s0 = s1;
  50984. } else {
  50985. peg$currPos = s0;
  50986. s0 = peg$c1;
  50987. }
  50988. } else {
  50989. peg$currPos = s0;
  50990. s0 = peg$c1;
  50991. }
  50992. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50993. return s0;
  50994. }
  50995. function peg$parseliteralArrayRest() {
  50996. var s0, s1, s2, s3, s4;
  50997. var key = peg$currPos * 60 + 19,
  50998. cached = peg$cache[key];
  50999. if (cached) {
  51000. peg$currPos = cached.nextPos;
  51001. return cached.result;
  51002. }
  51003. s0 = peg$currPos;
  51004. s1 = [];
  51005. s2 = peg$currPos;
  51006. s3 = peg$parsews();
  51007. if (s3 !== peg$FAILED) {
  51008. s4 = peg$parseparseTimeLiteral();
  51009. if (s4 === peg$FAILED) {
  51010. s4 = peg$parsebareLiteralArray();
  51011. if (s4 === peg$FAILED) {
  51012. s4 = peg$parsebareSymbol();
  51013. }
  51014. }
  51015. if (s4 !== peg$FAILED) {
  51016. peg$reportedPos = s2;
  51017. s3 = peg$c59(s4);
  51018. s2 = s3;
  51019. } else {
  51020. peg$currPos = s2;
  51021. s2 = peg$c1;
  51022. }
  51023. } else {
  51024. peg$currPos = s2;
  51025. s2 = peg$c1;
  51026. }
  51027. while (s2 !== peg$FAILED) {
  51028. s1.push(s2);
  51029. s2 = peg$currPos;
  51030. s3 = peg$parsews();
  51031. if (s3 !== peg$FAILED) {
  51032. s4 = peg$parseparseTimeLiteral();
  51033. if (s4 === peg$FAILED) {
  51034. s4 = peg$parsebareLiteralArray();
  51035. if (s4 === peg$FAILED) {
  51036. s4 = peg$parsebareSymbol();
  51037. }
  51038. }
  51039. if (s4 !== peg$FAILED) {
  51040. peg$reportedPos = s2;
  51041. s3 = peg$c59(s4);
  51042. s2 = s3;
  51043. } else {
  51044. peg$currPos = s2;
  51045. s2 = peg$c1;
  51046. }
  51047. } else {
  51048. peg$currPos = s2;
  51049. s2 = peg$c1;
  51050. }
  51051. }
  51052. if (s1 !== peg$FAILED) {
  51053. s2 = peg$parsews();
  51054. if (s2 !== peg$FAILED) {
  51055. if (input.charCodeAt(peg$currPos) === 41) {
  51056. s3 = peg$c60;
  51057. peg$currPos++;
  51058. } else {
  51059. s3 = peg$FAILED;
  51060. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  51061. }
  51062. if (s3 !== peg$FAILED) {
  51063. peg$reportedPos = s0;
  51064. s1 = peg$c62(s1);
  51065. s0 = s1;
  51066. } else {
  51067. peg$currPos = s0;
  51068. s0 = peg$c1;
  51069. }
  51070. } else {
  51071. peg$currPos = s0;
  51072. s0 = peg$c1;
  51073. }
  51074. } else {
  51075. peg$currPos = s0;
  51076. s0 = peg$c1;
  51077. }
  51078. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51079. return s0;
  51080. }
  51081. function peg$parsedynamicArray() {
  51082. var s0, s1, s2, s3, s4, s5, s6;
  51083. var key = peg$currPos * 60 + 20,
  51084. cached = peg$cache[key];
  51085. if (cached) {
  51086. peg$currPos = cached.nextPos;
  51087. return cached.result;
  51088. }
  51089. s0 = peg$currPos;
  51090. if (input.charCodeAt(peg$currPos) === 123) {
  51091. s1 = peg$c63;
  51092. peg$currPos++;
  51093. } else {
  51094. s1 = peg$FAILED;
  51095. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  51096. }
  51097. if (s1 !== peg$FAILED) {
  51098. s2 = peg$parsews();
  51099. if (s2 !== peg$FAILED) {
  51100. s3 = peg$parseexpressions();
  51101. if (s3 === peg$FAILED) {
  51102. s3 = peg$c41;
  51103. }
  51104. if (s3 !== peg$FAILED) {
  51105. s4 = peg$parsews();
  51106. if (s4 !== peg$FAILED) {
  51107. if (input.charCodeAt(peg$currPos) === 46) {
  51108. s5 = peg$c51;
  51109. peg$currPos++;
  51110. } else {
  51111. s5 = peg$FAILED;
  51112. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  51113. }
  51114. if (s5 === peg$FAILED) {
  51115. s5 = peg$c41;
  51116. }
  51117. if (s5 !== peg$FAILED) {
  51118. if (input.charCodeAt(peg$currPos) === 125) {
  51119. s6 = peg$c65;
  51120. peg$currPos++;
  51121. } else {
  51122. s6 = peg$FAILED;
  51123. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  51124. }
  51125. if (s6 !== peg$FAILED) {
  51126. peg$reportedPos = s0;
  51127. s1 = peg$c67(s3);
  51128. s0 = s1;
  51129. } else {
  51130. peg$currPos = s0;
  51131. s0 = peg$c1;
  51132. }
  51133. } else {
  51134. peg$currPos = s0;
  51135. s0 = peg$c1;
  51136. }
  51137. } else {
  51138. peg$currPos = s0;
  51139. s0 = peg$c1;
  51140. }
  51141. } else {
  51142. peg$currPos = s0;
  51143. s0 = peg$c1;
  51144. }
  51145. } else {
  51146. peg$currPos = s0;
  51147. s0 = peg$c1;
  51148. }
  51149. } else {
  51150. peg$currPos = s0;
  51151. s0 = peg$c1;
  51152. }
  51153. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51154. return s0;
  51155. }
  51156. function peg$parsedynamicDictionary() {
  51157. var s0, s1, s2, s3, s4, s5;
  51158. var key = peg$currPos * 60 + 21,
  51159. cached = peg$cache[key];
  51160. if (cached) {
  51161. peg$currPos = cached.nextPos;
  51162. return cached.result;
  51163. }
  51164. s0 = peg$currPos;
  51165. if (input.substr(peg$currPos, 2) === peg$c68) {
  51166. s1 = peg$c68;
  51167. peg$currPos += 2;
  51168. } else {
  51169. s1 = peg$FAILED;
  51170. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  51171. }
  51172. if (s1 !== peg$FAILED) {
  51173. s2 = peg$parsews();
  51174. if (s2 !== peg$FAILED) {
  51175. s3 = peg$parseassociations();
  51176. if (s3 === peg$FAILED) {
  51177. s3 = peg$c41;
  51178. }
  51179. if (s3 !== peg$FAILED) {
  51180. s4 = peg$parsews();
  51181. if (s4 !== peg$FAILED) {
  51182. if (input.charCodeAt(peg$currPos) === 125) {
  51183. s5 = peg$c65;
  51184. peg$currPos++;
  51185. } else {
  51186. s5 = peg$FAILED;
  51187. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  51188. }
  51189. if (s5 !== peg$FAILED) {
  51190. peg$reportedPos = s0;
  51191. s1 = peg$c70(s3);
  51192. s0 = s1;
  51193. } else {
  51194. peg$currPos = s0;
  51195. s0 = peg$c1;
  51196. }
  51197. } else {
  51198. peg$currPos = s0;
  51199. s0 = peg$c1;
  51200. }
  51201. } else {
  51202. peg$currPos = s0;
  51203. s0 = peg$c1;
  51204. }
  51205. } else {
  51206. peg$currPos = s0;
  51207. s0 = peg$c1;
  51208. }
  51209. } else {
  51210. peg$currPos = s0;
  51211. s0 = peg$c1;
  51212. }
  51213. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51214. return s0;
  51215. }
  51216. function peg$parsepseudoVariable() {
  51217. var s0, s1, s2;
  51218. var key = peg$currPos * 60 + 22,
  51219. cached = peg$cache[key];
  51220. if (cached) {
  51221. peg$currPos = cached.nextPos;
  51222. return cached.result;
  51223. }
  51224. s0 = peg$currPos;
  51225. s1 = peg$currPos;
  51226. if (input.substr(peg$currPos, 4) === peg$c71) {
  51227. s2 = peg$c71;
  51228. peg$currPos += 4;
  51229. } else {
  51230. s2 = peg$FAILED;
  51231. if (peg$silentFails === 0) { peg$fail(peg$c72); }
  51232. }
  51233. if (s2 !== peg$FAILED) {
  51234. peg$reportedPos = s1;
  51235. s2 = peg$c73();
  51236. }
  51237. s1 = s2;
  51238. if (s1 === peg$FAILED) {
  51239. s1 = peg$currPos;
  51240. if (input.substr(peg$currPos, 5) === peg$c74) {
  51241. s2 = peg$c74;
  51242. peg$currPos += 5;
  51243. } else {
  51244. s2 = peg$FAILED;
  51245. if (peg$silentFails === 0) { peg$fail(peg$c75); }
  51246. }
  51247. if (s2 !== peg$FAILED) {
  51248. peg$reportedPos = s1;
  51249. s2 = peg$c76();
  51250. }
  51251. s1 = s2;
  51252. if (s1 === peg$FAILED) {
  51253. s1 = peg$currPos;
  51254. if (input.substr(peg$currPos, 3) === peg$c77) {
  51255. s2 = peg$c77;
  51256. peg$currPos += 3;
  51257. } else {
  51258. s2 = peg$FAILED;
  51259. if (peg$silentFails === 0) { peg$fail(peg$c78); }
  51260. }
  51261. if (s2 !== peg$FAILED) {
  51262. peg$reportedPos = s1;
  51263. s2 = peg$c79();
  51264. }
  51265. s1 = s2;
  51266. }
  51267. }
  51268. if (s1 !== peg$FAILED) {
  51269. peg$reportedPos = s0;
  51270. s1 = peg$c80(s1);
  51271. }
  51272. s0 = s1;
  51273. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51274. return s0;
  51275. }
  51276. function peg$parseparseTimeLiteral() {
  51277. var s0;
  51278. var key = peg$currPos * 60 + 23,
  51279. cached = peg$cache[key];
  51280. if (cached) {
  51281. peg$currPos = cached.nextPos;
  51282. return cached.result;
  51283. }
  51284. s0 = peg$parsepseudoVariable();
  51285. if (s0 === peg$FAILED) {
  51286. s0 = peg$parsenumber();
  51287. if (s0 === peg$FAILED) {
  51288. s0 = peg$parseliteralArray();
  51289. if (s0 === peg$FAILED) {
  51290. s0 = peg$parsestring();
  51291. if (s0 === peg$FAILED) {
  51292. s0 = peg$parsesymbol();
  51293. if (s0 === peg$FAILED) {
  51294. s0 = peg$parsecharacter();
  51295. }
  51296. }
  51297. }
  51298. }
  51299. }
  51300. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51301. return s0;
  51302. }
  51303. function peg$parseruntimeLiteral() {
  51304. var s0;
  51305. var key = peg$currPos * 60 + 24,
  51306. cached = peg$cache[key];
  51307. if (cached) {
  51308. peg$currPos = cached.nextPos;
  51309. return cached.result;
  51310. }
  51311. s0 = peg$parsedynamicDictionary();
  51312. if (s0 === peg$FAILED) {
  51313. s0 = peg$parsedynamicArray();
  51314. if (s0 === peg$FAILED) {
  51315. s0 = peg$parseblock();
  51316. }
  51317. }
  51318. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51319. return s0;
  51320. }
  51321. function peg$parseliteral() {
  51322. var s0;
  51323. var key = peg$currPos * 60 + 25,
  51324. cached = peg$cache[key];
  51325. if (cached) {
  51326. peg$currPos = cached.nextPos;
  51327. return cached.result;
  51328. }
  51329. s0 = peg$parseruntimeLiteral();
  51330. if (s0 === peg$FAILED) {
  51331. s0 = peg$parseparseTimeLiteral();
  51332. }
  51333. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51334. return s0;
  51335. }
  51336. function peg$parsevariable() {
  51337. var s0, s1;
  51338. var key = peg$currPos * 60 + 26,
  51339. cached = peg$cache[key];
  51340. if (cached) {
  51341. peg$currPos = cached.nextPos;
  51342. return cached.result;
  51343. }
  51344. s0 = peg$currPos;
  51345. s1 = peg$parseidentifier();
  51346. if (s1 !== peg$FAILED) {
  51347. peg$reportedPos = s0;
  51348. s1 = peg$c81(s1);
  51349. }
  51350. s0 = s1;
  51351. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51352. return s0;
  51353. }
  51354. function peg$parsekeywordPair() {
  51355. var s0, s1, s2, s3, s4;
  51356. var key = peg$currPos * 60 + 27,
  51357. cached = peg$cache[key];
  51358. if (cached) {
  51359. peg$currPos = cached.nextPos;
  51360. return cached.result;
  51361. }
  51362. s0 = peg$currPos;
  51363. s1 = peg$parsews();
  51364. if (s1 !== peg$FAILED) {
  51365. s2 = peg$parsekeyword();
  51366. if (s2 !== peg$FAILED) {
  51367. s3 = peg$parsews();
  51368. if (s3 !== peg$FAILED) {
  51369. s4 = peg$parsebinarySend();
  51370. if (s4 !== peg$FAILED) {
  51371. peg$reportedPos = s0;
  51372. s1 = peg$c82(s2, s4);
  51373. s0 = s1;
  51374. } else {
  51375. peg$currPos = s0;
  51376. s0 = peg$c1;
  51377. }
  51378. } else {
  51379. peg$currPos = s0;
  51380. s0 = peg$c1;
  51381. }
  51382. } else {
  51383. peg$currPos = s0;
  51384. s0 = peg$c1;
  51385. }
  51386. } else {
  51387. peg$currPos = s0;
  51388. s0 = peg$c1;
  51389. }
  51390. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51391. return s0;
  51392. }
  51393. function peg$parsebinarySelector() {
  51394. var s0, s1, s2;
  51395. var key = peg$currPos * 60 + 28,
  51396. cached = peg$cache[key];
  51397. if (cached) {
  51398. peg$currPos = cached.nextPos;
  51399. return cached.result;
  51400. }
  51401. s0 = peg$currPos;
  51402. s1 = [];
  51403. if (peg$c83.test(input.charAt(peg$currPos))) {
  51404. s2 = input.charAt(peg$currPos);
  51405. peg$currPos++;
  51406. } else {
  51407. s2 = peg$FAILED;
  51408. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  51409. }
  51410. if (s2 !== peg$FAILED) {
  51411. while (s2 !== peg$FAILED) {
  51412. s1.push(s2);
  51413. if (peg$c83.test(input.charAt(peg$currPos))) {
  51414. s2 = input.charAt(peg$currPos);
  51415. peg$currPos++;
  51416. } else {
  51417. s2 = peg$FAILED;
  51418. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  51419. }
  51420. }
  51421. } else {
  51422. s1 = peg$c1;
  51423. }
  51424. if (s1 !== peg$FAILED) {
  51425. peg$reportedPos = s0;
  51426. s1 = peg$c85(s1);
  51427. }
  51428. s0 = s1;
  51429. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51430. return s0;
  51431. }
  51432. function peg$parsekeywordPattern() {
  51433. var s0, s1, s2, s3, s4, s5, s6;
  51434. var key = peg$currPos * 60 + 29,
  51435. cached = peg$cache[key];
  51436. if (cached) {
  51437. peg$currPos = cached.nextPos;
  51438. return cached.result;
  51439. }
  51440. s0 = peg$currPos;
  51441. s1 = [];
  51442. s2 = peg$currPos;
  51443. s3 = peg$parsews();
  51444. if (s3 !== peg$FAILED) {
  51445. s4 = peg$parsekeyword();
  51446. if (s4 !== peg$FAILED) {
  51447. s5 = peg$parsews();
  51448. if (s5 !== peg$FAILED) {
  51449. s6 = peg$parseidentifier();
  51450. if (s6 !== peg$FAILED) {
  51451. peg$reportedPos = s2;
  51452. s3 = peg$c82(s4, s6);
  51453. s2 = s3;
  51454. } else {
  51455. peg$currPos = s2;
  51456. s2 = peg$c1;
  51457. }
  51458. } else {
  51459. peg$currPos = s2;
  51460. s2 = peg$c1;
  51461. }
  51462. } else {
  51463. peg$currPos = s2;
  51464. s2 = peg$c1;
  51465. }
  51466. } else {
  51467. peg$currPos = s2;
  51468. s2 = peg$c1;
  51469. }
  51470. if (s2 !== peg$FAILED) {
  51471. while (s2 !== peg$FAILED) {
  51472. s1.push(s2);
  51473. s2 = peg$currPos;
  51474. s3 = peg$parsews();
  51475. if (s3 !== peg$FAILED) {
  51476. s4 = peg$parsekeyword();
  51477. if (s4 !== peg$FAILED) {
  51478. s5 = peg$parsews();
  51479. if (s5 !== peg$FAILED) {
  51480. s6 = peg$parseidentifier();
  51481. if (s6 !== peg$FAILED) {
  51482. peg$reportedPos = s2;
  51483. s3 = peg$c82(s4, s6);
  51484. s2 = s3;
  51485. } else {
  51486. peg$currPos = s2;
  51487. s2 = peg$c1;
  51488. }
  51489. } else {
  51490. peg$currPos = s2;
  51491. s2 = peg$c1;
  51492. }
  51493. } else {
  51494. peg$currPos = s2;
  51495. s2 = peg$c1;
  51496. }
  51497. } else {
  51498. peg$currPos = s2;
  51499. s2 = peg$c1;
  51500. }
  51501. }
  51502. } else {
  51503. s1 = peg$c1;
  51504. }
  51505. if (s1 !== peg$FAILED) {
  51506. peg$reportedPos = s0;
  51507. s1 = peg$c86(s1);
  51508. }
  51509. s0 = s1;
  51510. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51511. return s0;
  51512. }
  51513. function peg$parsebinaryPattern() {
  51514. var s0, s1, s2, s3, s4;
  51515. var key = peg$currPos * 60 + 30,
  51516. cached = peg$cache[key];
  51517. if (cached) {
  51518. peg$currPos = cached.nextPos;
  51519. return cached.result;
  51520. }
  51521. s0 = peg$currPos;
  51522. s1 = peg$parsews();
  51523. if (s1 !== peg$FAILED) {
  51524. s2 = peg$parsebinarySelector();
  51525. if (s2 !== peg$FAILED) {
  51526. s3 = peg$parsews();
  51527. if (s3 !== peg$FAILED) {
  51528. s4 = peg$parseidentifier();
  51529. if (s4 !== peg$FAILED) {
  51530. peg$reportedPos = s0;
  51531. s1 = peg$c87(s2, s4);
  51532. s0 = s1;
  51533. } else {
  51534. peg$currPos = s0;
  51535. s0 = peg$c1;
  51536. }
  51537. } else {
  51538. peg$currPos = s0;
  51539. s0 = peg$c1;
  51540. }
  51541. } else {
  51542. peg$currPos = s0;
  51543. s0 = peg$c1;
  51544. }
  51545. } else {
  51546. peg$currPos = s0;
  51547. s0 = peg$c1;
  51548. }
  51549. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51550. return s0;
  51551. }
  51552. function peg$parseunaryPattern() {
  51553. var s0, s1, s2;
  51554. var key = peg$currPos * 60 + 31,
  51555. cached = peg$cache[key];
  51556. if (cached) {
  51557. peg$currPos = cached.nextPos;
  51558. return cached.result;
  51559. }
  51560. s0 = peg$currPos;
  51561. s1 = peg$parsews();
  51562. if (s1 !== peg$FAILED) {
  51563. s2 = peg$parseidentifier();
  51564. if (s2 !== peg$FAILED) {
  51565. peg$reportedPos = s0;
  51566. s1 = peg$c88(s2);
  51567. s0 = s1;
  51568. } else {
  51569. peg$currPos = s0;
  51570. s0 = peg$c1;
  51571. }
  51572. } else {
  51573. peg$currPos = s0;
  51574. s0 = peg$c1;
  51575. }
  51576. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51577. return s0;
  51578. }
  51579. function peg$parseexpression() {
  51580. var s0;
  51581. var key = peg$currPos * 60 + 32,
  51582. cached = peg$cache[key];
  51583. if (cached) {
  51584. peg$currPos = cached.nextPos;
  51585. return cached.result;
  51586. }
  51587. s0 = peg$parseassignment();
  51588. if (s0 === peg$FAILED) {
  51589. s0 = peg$parsecascade();
  51590. if (s0 === peg$FAILED) {
  51591. s0 = peg$parsekeywordSend();
  51592. if (s0 === peg$FAILED) {
  51593. s0 = peg$parsebinarySend();
  51594. }
  51595. }
  51596. }
  51597. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51598. return s0;
  51599. }
  51600. function peg$parseexpressionList() {
  51601. var s0, s1, s2, s3, s4;
  51602. var key = peg$currPos * 60 + 33,
  51603. cached = peg$cache[key];
  51604. if (cached) {
  51605. peg$currPos = cached.nextPos;
  51606. return cached.result;
  51607. }
  51608. s0 = peg$currPos;
  51609. s1 = peg$parsews();
  51610. if (s1 !== peg$FAILED) {
  51611. if (input.charCodeAt(peg$currPos) === 46) {
  51612. s2 = peg$c51;
  51613. peg$currPos++;
  51614. } else {
  51615. s2 = peg$FAILED;
  51616. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  51617. }
  51618. if (s2 !== peg$FAILED) {
  51619. s3 = peg$parsews();
  51620. if (s3 !== peg$FAILED) {
  51621. s4 = peg$parseexpression();
  51622. if (s4 !== peg$FAILED) {
  51623. peg$reportedPos = s0;
  51624. s1 = peg$c89(s4);
  51625. s0 = s1;
  51626. } else {
  51627. peg$currPos = s0;
  51628. s0 = peg$c1;
  51629. }
  51630. } else {
  51631. peg$currPos = s0;
  51632. s0 = peg$c1;
  51633. }
  51634. } else {
  51635. peg$currPos = s0;
  51636. s0 = peg$c1;
  51637. }
  51638. } else {
  51639. peg$currPos = s0;
  51640. s0 = peg$c1;
  51641. }
  51642. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51643. return s0;
  51644. }
  51645. function peg$parseexpressions() {
  51646. var s0, s1, s2, s3;
  51647. var key = peg$currPos * 60 + 34,
  51648. cached = peg$cache[key];
  51649. if (cached) {
  51650. peg$currPos = cached.nextPos;
  51651. return cached.result;
  51652. }
  51653. s0 = peg$currPos;
  51654. s1 = peg$parseexpression();
  51655. if (s1 !== peg$FAILED) {
  51656. s2 = [];
  51657. s3 = peg$parseexpressionList();
  51658. while (s3 !== peg$FAILED) {
  51659. s2.push(s3);
  51660. s3 = peg$parseexpressionList();
  51661. }
  51662. if (s2 !== peg$FAILED) {
  51663. peg$reportedPos = s0;
  51664. s1 = peg$c90(s1, s2);
  51665. s0 = s1;
  51666. } else {
  51667. peg$currPos = s0;
  51668. s0 = peg$c1;
  51669. }
  51670. } else {
  51671. peg$currPos = s0;
  51672. s0 = peg$c1;
  51673. }
  51674. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51675. return s0;
  51676. }
  51677. function peg$parseassignment() {
  51678. var s0, s1, s2, s3, s4, s5;
  51679. var key = peg$currPos * 60 + 35,
  51680. cached = peg$cache[key];
  51681. if (cached) {
  51682. peg$currPos = cached.nextPos;
  51683. return cached.result;
  51684. }
  51685. s0 = peg$currPos;
  51686. s1 = peg$parsevariable();
  51687. if (s1 !== peg$FAILED) {
  51688. s2 = peg$parsews();
  51689. if (s2 !== peg$FAILED) {
  51690. if (input.substr(peg$currPos, 2) === peg$c91) {
  51691. s3 = peg$c91;
  51692. peg$currPos += 2;
  51693. } else {
  51694. s3 = peg$FAILED;
  51695. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  51696. }
  51697. if (s3 !== peg$FAILED) {
  51698. s4 = peg$parsews();
  51699. if (s4 !== peg$FAILED) {
  51700. s5 = peg$parseexpression();
  51701. if (s5 !== peg$FAILED) {
  51702. peg$reportedPos = s0;
  51703. s1 = peg$c93(s1, s5);
  51704. s0 = s1;
  51705. } else {
  51706. peg$currPos = s0;
  51707. s0 = peg$c1;
  51708. }
  51709. } else {
  51710. peg$currPos = s0;
  51711. s0 = peg$c1;
  51712. }
  51713. } else {
  51714. peg$currPos = s0;
  51715. s0 = peg$c1;
  51716. }
  51717. } else {
  51718. peg$currPos = s0;
  51719. s0 = peg$c1;
  51720. }
  51721. } else {
  51722. peg$currPos = s0;
  51723. s0 = peg$c1;
  51724. }
  51725. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51726. return s0;
  51727. }
  51728. function peg$parseret() {
  51729. var s0, s1, s2, s3, s4, s5;
  51730. var key = peg$currPos * 60 + 36,
  51731. cached = peg$cache[key];
  51732. if (cached) {
  51733. peg$currPos = cached.nextPos;
  51734. return cached.result;
  51735. }
  51736. s0 = peg$currPos;
  51737. if (input.charCodeAt(peg$currPos) === 94) {
  51738. s1 = peg$c94;
  51739. peg$currPos++;
  51740. } else {
  51741. s1 = peg$FAILED;
  51742. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  51743. }
  51744. if (s1 !== peg$FAILED) {
  51745. s2 = peg$parsews();
  51746. if (s2 !== peg$FAILED) {
  51747. s3 = peg$parseexpression();
  51748. if (s3 !== peg$FAILED) {
  51749. s4 = peg$parsews();
  51750. if (s4 !== peg$FAILED) {
  51751. if (input.charCodeAt(peg$currPos) === 46) {
  51752. s5 = peg$c51;
  51753. peg$currPos++;
  51754. } else {
  51755. s5 = peg$FAILED;
  51756. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  51757. }
  51758. if (s5 === peg$FAILED) {
  51759. s5 = peg$c41;
  51760. }
  51761. if (s5 !== peg$FAILED) {
  51762. peg$reportedPos = s0;
  51763. s1 = peg$c96(s3);
  51764. s0 = s1;
  51765. } else {
  51766. peg$currPos = s0;
  51767. s0 = peg$c1;
  51768. }
  51769. } else {
  51770. peg$currPos = s0;
  51771. s0 = peg$c1;
  51772. }
  51773. } else {
  51774. peg$currPos = s0;
  51775. s0 = peg$c1;
  51776. }
  51777. } else {
  51778. peg$currPos = s0;
  51779. s0 = peg$c1;
  51780. }
  51781. } else {
  51782. peg$currPos = s0;
  51783. s0 = peg$c1;
  51784. }
  51785. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51786. return s0;
  51787. }
  51788. function peg$parsetemps() {
  51789. var s0, s1, s2, s3, s4, s5;
  51790. var key = peg$currPos * 60 + 37,
  51791. cached = peg$cache[key];
  51792. if (cached) {
  51793. peg$currPos = cached.nextPos;
  51794. return cached.result;
  51795. }
  51796. s0 = peg$currPos;
  51797. if (input.charCodeAt(peg$currPos) === 124) {
  51798. s1 = peg$c97;
  51799. peg$currPos++;
  51800. } else {
  51801. s1 = peg$FAILED;
  51802. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  51803. }
  51804. if (s1 !== peg$FAILED) {
  51805. s2 = [];
  51806. s3 = peg$currPos;
  51807. s4 = peg$parsews();
  51808. if (s4 !== peg$FAILED) {
  51809. s5 = peg$parseidentifier();
  51810. if (s5 !== peg$FAILED) {
  51811. peg$reportedPos = s3;
  51812. s4 = peg$c99(s5);
  51813. s3 = s4;
  51814. } else {
  51815. peg$currPos = s3;
  51816. s3 = peg$c1;
  51817. }
  51818. } else {
  51819. peg$currPos = s3;
  51820. s3 = peg$c1;
  51821. }
  51822. while (s3 !== peg$FAILED) {
  51823. s2.push(s3);
  51824. s3 = peg$currPos;
  51825. s4 = peg$parsews();
  51826. if (s4 !== peg$FAILED) {
  51827. s5 = peg$parseidentifier();
  51828. if (s5 !== peg$FAILED) {
  51829. peg$reportedPos = s3;
  51830. s4 = peg$c99(s5);
  51831. s3 = s4;
  51832. } else {
  51833. peg$currPos = s3;
  51834. s3 = peg$c1;
  51835. }
  51836. } else {
  51837. peg$currPos = s3;
  51838. s3 = peg$c1;
  51839. }
  51840. }
  51841. if (s2 !== peg$FAILED) {
  51842. s3 = peg$parsews();
  51843. if (s3 !== peg$FAILED) {
  51844. if (input.charCodeAt(peg$currPos) === 124) {
  51845. s4 = peg$c97;
  51846. peg$currPos++;
  51847. } else {
  51848. s4 = peg$FAILED;
  51849. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  51850. }
  51851. if (s4 !== peg$FAILED) {
  51852. peg$reportedPos = s0;
  51853. s1 = peg$c100(s2);
  51854. s0 = s1;
  51855. } else {
  51856. peg$currPos = s0;
  51857. s0 = peg$c1;
  51858. }
  51859. } else {
  51860. peg$currPos = s0;
  51861. s0 = peg$c1;
  51862. }
  51863. } else {
  51864. peg$currPos = s0;
  51865. s0 = peg$c1;
  51866. }
  51867. } else {
  51868. peg$currPos = s0;
  51869. s0 = peg$c1;
  51870. }
  51871. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51872. return s0;
  51873. }
  51874. function peg$parseblockParamList() {
  51875. var s0, s1, s2, s3, s4, s5, s6;
  51876. var key = peg$currPos * 60 + 38,
  51877. cached = peg$cache[key];
  51878. if (cached) {
  51879. peg$currPos = cached.nextPos;
  51880. return cached.result;
  51881. }
  51882. s0 = peg$currPos;
  51883. s1 = [];
  51884. s2 = peg$currPos;
  51885. s3 = peg$parsews();
  51886. if (s3 !== peg$FAILED) {
  51887. if (input.charCodeAt(peg$currPos) === 58) {
  51888. s4 = peg$c13;
  51889. peg$currPos++;
  51890. } else {
  51891. s4 = peg$FAILED;
  51892. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  51893. }
  51894. if (s4 !== peg$FAILED) {
  51895. s5 = peg$parsews();
  51896. if (s5 !== peg$FAILED) {
  51897. s6 = peg$parseidentifier();
  51898. if (s6 !== peg$FAILED) {
  51899. peg$reportedPos = s2;
  51900. s3 = peg$c101(s6);
  51901. s2 = s3;
  51902. } else {
  51903. peg$currPos = s2;
  51904. s2 = peg$c1;
  51905. }
  51906. } else {
  51907. peg$currPos = s2;
  51908. s2 = peg$c1;
  51909. }
  51910. } else {
  51911. peg$currPos = s2;
  51912. s2 = peg$c1;
  51913. }
  51914. } else {
  51915. peg$currPos = s2;
  51916. s2 = peg$c1;
  51917. }
  51918. if (s2 !== peg$FAILED) {
  51919. while (s2 !== peg$FAILED) {
  51920. s1.push(s2);
  51921. s2 = peg$currPos;
  51922. s3 = peg$parsews();
  51923. if (s3 !== peg$FAILED) {
  51924. if (input.charCodeAt(peg$currPos) === 58) {
  51925. s4 = peg$c13;
  51926. peg$currPos++;
  51927. } else {
  51928. s4 = peg$FAILED;
  51929. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  51930. }
  51931. if (s4 !== peg$FAILED) {
  51932. s5 = peg$parsews();
  51933. if (s5 !== peg$FAILED) {
  51934. s6 = peg$parseidentifier();
  51935. if (s6 !== peg$FAILED) {
  51936. peg$reportedPos = s2;
  51937. s3 = peg$c101(s6);
  51938. s2 = s3;
  51939. } else {
  51940. peg$currPos = s2;
  51941. s2 = peg$c1;
  51942. }
  51943. } else {
  51944. peg$currPos = s2;
  51945. s2 = peg$c1;
  51946. }
  51947. } else {
  51948. peg$currPos = s2;
  51949. s2 = peg$c1;
  51950. }
  51951. } else {
  51952. peg$currPos = s2;
  51953. s2 = peg$c1;
  51954. }
  51955. }
  51956. } else {
  51957. s1 = peg$c1;
  51958. }
  51959. if (s1 !== peg$FAILED) {
  51960. s2 = peg$parsews();
  51961. if (s2 !== peg$FAILED) {
  51962. if (input.charCodeAt(peg$currPos) === 124) {
  51963. s3 = peg$c97;
  51964. peg$currPos++;
  51965. } else {
  51966. s3 = peg$FAILED;
  51967. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  51968. }
  51969. if (s3 !== peg$FAILED) {
  51970. peg$reportedPos = s0;
  51971. s1 = peg$c102(s1);
  51972. s0 = s1;
  51973. } else {
  51974. peg$currPos = s0;
  51975. s0 = peg$c1;
  51976. }
  51977. } else {
  51978. peg$currPos = s0;
  51979. s0 = peg$c1;
  51980. }
  51981. } else {
  51982. peg$currPos = s0;
  51983. s0 = peg$c1;
  51984. }
  51985. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51986. return s0;
  51987. }
  51988. function peg$parsesubexpression() {
  51989. var s0, s1, s2, s3, s4, s5;
  51990. var key = peg$currPos * 60 + 39,
  51991. cached = peg$cache[key];
  51992. if (cached) {
  51993. peg$currPos = cached.nextPos;
  51994. return cached.result;
  51995. }
  51996. s0 = peg$currPos;
  51997. if (input.charCodeAt(peg$currPos) === 40) {
  51998. s1 = peg$c57;
  51999. peg$currPos++;
  52000. } else {
  52001. s1 = peg$FAILED;
  52002. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  52003. }
  52004. if (s1 !== peg$FAILED) {
  52005. s2 = peg$parsews();
  52006. if (s2 !== peg$FAILED) {
  52007. s3 = peg$parseexpression();
  52008. if (s3 !== peg$FAILED) {
  52009. s4 = peg$parsews();
  52010. if (s4 !== peg$FAILED) {
  52011. if (input.charCodeAt(peg$currPos) === 41) {
  52012. s5 = peg$c60;
  52013. peg$currPos++;
  52014. } else {
  52015. s5 = peg$FAILED;
  52016. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  52017. }
  52018. if (s5 !== peg$FAILED) {
  52019. peg$reportedPos = s0;
  52020. s1 = peg$c89(s3);
  52021. s0 = s1;
  52022. } else {
  52023. peg$currPos = s0;
  52024. s0 = peg$c1;
  52025. }
  52026. } else {
  52027. peg$currPos = s0;
  52028. s0 = peg$c1;
  52029. }
  52030. } else {
  52031. peg$currPos = s0;
  52032. s0 = peg$c1;
  52033. }
  52034. } else {
  52035. peg$currPos = s0;
  52036. s0 = peg$c1;
  52037. }
  52038. } else {
  52039. peg$currPos = s0;
  52040. s0 = peg$c1;
  52041. }
  52042. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52043. return s0;
  52044. }
  52045. function peg$parsestatements() {
  52046. var s0, s1, s2, s3, s4, s5, s6, s7;
  52047. var key = peg$currPos * 60 + 40,
  52048. cached = peg$cache[key];
  52049. if (cached) {
  52050. peg$currPos = cached.nextPos;
  52051. return cached.result;
  52052. }
  52053. s0 = peg$currPos;
  52054. s1 = peg$parseret();
  52055. if (s1 !== peg$FAILED) {
  52056. s2 = [];
  52057. if (input.charCodeAt(peg$currPos) === 46) {
  52058. s3 = peg$c51;
  52059. peg$currPos++;
  52060. } else {
  52061. s3 = peg$FAILED;
  52062. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52063. }
  52064. while (s3 !== peg$FAILED) {
  52065. s2.push(s3);
  52066. if (input.charCodeAt(peg$currPos) === 46) {
  52067. s3 = peg$c51;
  52068. peg$currPos++;
  52069. } else {
  52070. s3 = peg$FAILED;
  52071. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52072. }
  52073. }
  52074. if (s2 !== peg$FAILED) {
  52075. peg$reportedPos = s0;
  52076. s1 = peg$c103(s1);
  52077. s0 = s1;
  52078. } else {
  52079. peg$currPos = s0;
  52080. s0 = peg$c1;
  52081. }
  52082. } else {
  52083. peg$currPos = s0;
  52084. s0 = peg$c1;
  52085. }
  52086. if (s0 === peg$FAILED) {
  52087. s0 = peg$currPos;
  52088. s1 = peg$parseexpressions();
  52089. if (s1 !== peg$FAILED) {
  52090. s2 = peg$parsews();
  52091. if (s2 !== peg$FAILED) {
  52092. s3 = [];
  52093. if (input.charCodeAt(peg$currPos) === 46) {
  52094. s4 = peg$c51;
  52095. peg$currPos++;
  52096. } else {
  52097. s4 = peg$FAILED;
  52098. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52099. }
  52100. if (s4 !== peg$FAILED) {
  52101. while (s4 !== peg$FAILED) {
  52102. s3.push(s4);
  52103. if (input.charCodeAt(peg$currPos) === 46) {
  52104. s4 = peg$c51;
  52105. peg$currPos++;
  52106. } else {
  52107. s4 = peg$FAILED;
  52108. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52109. }
  52110. }
  52111. } else {
  52112. s3 = peg$c1;
  52113. }
  52114. if (s3 !== peg$FAILED) {
  52115. s4 = peg$parsews();
  52116. if (s4 !== peg$FAILED) {
  52117. s5 = peg$parseret();
  52118. if (s5 !== peg$FAILED) {
  52119. s6 = [];
  52120. if (input.charCodeAt(peg$currPos) === 46) {
  52121. s7 = peg$c51;
  52122. peg$currPos++;
  52123. } else {
  52124. s7 = peg$FAILED;
  52125. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52126. }
  52127. while (s7 !== peg$FAILED) {
  52128. s6.push(s7);
  52129. if (input.charCodeAt(peg$currPos) === 46) {
  52130. s7 = peg$c51;
  52131. peg$currPos++;
  52132. } else {
  52133. s7 = peg$FAILED;
  52134. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52135. }
  52136. }
  52137. if (s6 !== peg$FAILED) {
  52138. peg$reportedPos = s0;
  52139. s1 = peg$c104(s1, s5);
  52140. s0 = s1;
  52141. } else {
  52142. peg$currPos = s0;
  52143. s0 = peg$c1;
  52144. }
  52145. } else {
  52146. peg$currPos = s0;
  52147. s0 = peg$c1;
  52148. }
  52149. } else {
  52150. peg$currPos = s0;
  52151. s0 = peg$c1;
  52152. }
  52153. } else {
  52154. peg$currPos = s0;
  52155. s0 = peg$c1;
  52156. }
  52157. } else {
  52158. peg$currPos = s0;
  52159. s0 = peg$c1;
  52160. }
  52161. } else {
  52162. peg$currPos = s0;
  52163. s0 = peg$c1;
  52164. }
  52165. if (s0 === peg$FAILED) {
  52166. s0 = peg$currPos;
  52167. s1 = peg$parseexpressions();
  52168. if (s1 === peg$FAILED) {
  52169. s1 = peg$c41;
  52170. }
  52171. if (s1 !== peg$FAILED) {
  52172. s2 = [];
  52173. if (input.charCodeAt(peg$currPos) === 46) {
  52174. s3 = peg$c51;
  52175. peg$currPos++;
  52176. } else {
  52177. s3 = peg$FAILED;
  52178. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52179. }
  52180. while (s3 !== peg$FAILED) {
  52181. s2.push(s3);
  52182. if (input.charCodeAt(peg$currPos) === 46) {
  52183. s3 = peg$c51;
  52184. peg$currPos++;
  52185. } else {
  52186. s3 = peg$FAILED;
  52187. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52188. }
  52189. }
  52190. if (s2 !== peg$FAILED) {
  52191. peg$reportedPos = s0;
  52192. s1 = peg$c105(s1);
  52193. s0 = s1;
  52194. } else {
  52195. peg$currPos = s0;
  52196. s0 = peg$c1;
  52197. }
  52198. } else {
  52199. peg$currPos = s0;
  52200. s0 = peg$c1;
  52201. }
  52202. }
  52203. }
  52204. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52205. return s0;
  52206. }
  52207. function peg$parsesequence() {
  52208. var s0;
  52209. var key = peg$currPos * 60 + 41,
  52210. cached = peg$cache[key];
  52211. if (cached) {
  52212. peg$currPos = cached.nextPos;
  52213. return cached.result;
  52214. }
  52215. s0 = peg$parsejsStatement();
  52216. if (s0 === peg$FAILED) {
  52217. s0 = peg$parsestSequence();
  52218. }
  52219. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52220. return s0;
  52221. }
  52222. function peg$parsestSequence() {
  52223. var s0, s1, s2, s3, s4;
  52224. var key = peg$currPos * 60 + 42,
  52225. cached = peg$cache[key];
  52226. if (cached) {
  52227. peg$currPos = cached.nextPos;
  52228. return cached.result;
  52229. }
  52230. s0 = peg$currPos;
  52231. s1 = peg$parsetemps();
  52232. if (s1 === peg$FAILED) {
  52233. s1 = peg$c41;
  52234. }
  52235. if (s1 !== peg$FAILED) {
  52236. s2 = peg$parsews();
  52237. if (s2 !== peg$FAILED) {
  52238. s3 = peg$parsestatements();
  52239. if (s3 === peg$FAILED) {
  52240. s3 = peg$c41;
  52241. }
  52242. if (s3 !== peg$FAILED) {
  52243. s4 = peg$parsews();
  52244. if (s4 !== peg$FAILED) {
  52245. peg$reportedPos = s0;
  52246. s1 = peg$c106(s1, s3);
  52247. s0 = s1;
  52248. } else {
  52249. peg$currPos = s0;
  52250. s0 = peg$c1;
  52251. }
  52252. } else {
  52253. peg$currPos = s0;
  52254. s0 = peg$c1;
  52255. }
  52256. } else {
  52257. peg$currPos = s0;
  52258. s0 = peg$c1;
  52259. }
  52260. } else {
  52261. peg$currPos = s0;
  52262. s0 = peg$c1;
  52263. }
  52264. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52265. return s0;
  52266. }
  52267. function peg$parseblock() {
  52268. var s0, s1, s2, s3, s4, s5, s6;
  52269. var key = peg$currPos * 60 + 43,
  52270. cached = peg$cache[key];
  52271. if (cached) {
  52272. peg$currPos = cached.nextPos;
  52273. return cached.result;
  52274. }
  52275. s0 = peg$currPos;
  52276. if (input.charCodeAt(peg$currPos) === 91) {
  52277. s1 = peg$c107;
  52278. peg$currPos++;
  52279. } else {
  52280. s1 = peg$FAILED;
  52281. if (peg$silentFails === 0) { peg$fail(peg$c108); }
  52282. }
  52283. if (s1 !== peg$FAILED) {
  52284. s2 = peg$parseblockParamList();
  52285. if (s2 === peg$FAILED) {
  52286. s2 = peg$c41;
  52287. }
  52288. if (s2 !== peg$FAILED) {
  52289. s3 = peg$parsews();
  52290. if (s3 !== peg$FAILED) {
  52291. s4 = peg$parsesequence();
  52292. if (s4 === peg$FAILED) {
  52293. s4 = peg$c41;
  52294. }
  52295. if (s4 !== peg$FAILED) {
  52296. s5 = peg$parsews();
  52297. if (s5 !== peg$FAILED) {
  52298. if (input.charCodeAt(peg$currPos) === 93) {
  52299. s6 = peg$c109;
  52300. peg$currPos++;
  52301. } else {
  52302. s6 = peg$FAILED;
  52303. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  52304. }
  52305. if (s6 !== peg$FAILED) {
  52306. peg$reportedPos = s0;
  52307. s1 = peg$c111(s2, s4);
  52308. s0 = s1;
  52309. } else {
  52310. peg$currPos = s0;
  52311. s0 = peg$c1;
  52312. }
  52313. } else {
  52314. peg$currPos = s0;
  52315. s0 = peg$c1;
  52316. }
  52317. } else {
  52318. peg$currPos = s0;
  52319. s0 = peg$c1;
  52320. }
  52321. } else {
  52322. peg$currPos = s0;
  52323. s0 = peg$c1;
  52324. }
  52325. } else {
  52326. peg$currPos = s0;
  52327. s0 = peg$c1;
  52328. }
  52329. } else {
  52330. peg$currPos = s0;
  52331. s0 = peg$c1;
  52332. }
  52333. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52334. return s0;
  52335. }
  52336. function peg$parseoperand() {
  52337. var s0;
  52338. var key = peg$currPos * 60 + 44,
  52339. cached = peg$cache[key];
  52340. if (cached) {
  52341. peg$currPos = cached.nextPos;
  52342. return cached.result;
  52343. }
  52344. s0 = peg$parseliteral();
  52345. if (s0 === peg$FAILED) {
  52346. s0 = peg$parsevariable();
  52347. if (s0 === peg$FAILED) {
  52348. s0 = peg$parsesubexpression();
  52349. }
  52350. }
  52351. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52352. return s0;
  52353. }
  52354. function peg$parseunaryMessage() {
  52355. var s0, s1, s2, s3, s4;
  52356. var key = peg$currPos * 60 + 45,
  52357. cached = peg$cache[key];
  52358. if (cached) {
  52359. peg$currPos = cached.nextPos;
  52360. return cached.result;
  52361. }
  52362. s0 = peg$currPos;
  52363. s1 = peg$parsews();
  52364. if (s1 !== peg$FAILED) {
  52365. s2 = peg$parseidentifier();
  52366. if (s2 !== peg$FAILED) {
  52367. s3 = peg$currPos;
  52368. peg$silentFails++;
  52369. if (input.charCodeAt(peg$currPos) === 58) {
  52370. s4 = peg$c13;
  52371. peg$currPos++;
  52372. } else {
  52373. s4 = peg$FAILED;
  52374. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  52375. }
  52376. peg$silentFails--;
  52377. if (s4 === peg$FAILED) {
  52378. s3 = peg$c112;
  52379. } else {
  52380. peg$currPos = s3;
  52381. s3 = peg$c1;
  52382. }
  52383. if (s3 !== peg$FAILED) {
  52384. peg$reportedPos = s0;
  52385. s1 = peg$c113(s2);
  52386. s0 = s1;
  52387. } else {
  52388. peg$currPos = s0;
  52389. s0 = peg$c1;
  52390. }
  52391. } else {
  52392. peg$currPos = s0;
  52393. s0 = peg$c1;
  52394. }
  52395. } else {
  52396. peg$currPos = s0;
  52397. s0 = peg$c1;
  52398. }
  52399. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52400. return s0;
  52401. }
  52402. function peg$parseunaryTail() {
  52403. var s0, s1, s2, s3, s4;
  52404. var key = peg$currPos * 60 + 46,
  52405. cached = peg$cache[key];
  52406. if (cached) {
  52407. peg$currPos = cached.nextPos;
  52408. return cached.result;
  52409. }
  52410. s0 = peg$currPos;
  52411. s1 = peg$parseunaryMessage();
  52412. if (s1 !== peg$FAILED) {
  52413. s2 = peg$parsews();
  52414. if (s2 !== peg$FAILED) {
  52415. s3 = peg$parseunaryTail();
  52416. if (s3 === peg$FAILED) {
  52417. s3 = peg$c41;
  52418. }
  52419. if (s3 !== peg$FAILED) {
  52420. s4 = peg$parsews();
  52421. if (s4 !== peg$FAILED) {
  52422. peg$reportedPos = s0;
  52423. s1 = peg$c114(s1, s3);
  52424. s0 = s1;
  52425. } else {
  52426. peg$currPos = s0;
  52427. s0 = peg$c1;
  52428. }
  52429. } else {
  52430. peg$currPos = s0;
  52431. s0 = peg$c1;
  52432. }
  52433. } else {
  52434. peg$currPos = s0;
  52435. s0 = peg$c1;
  52436. }
  52437. } else {
  52438. peg$currPos = s0;
  52439. s0 = peg$c1;
  52440. }
  52441. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52442. return s0;
  52443. }
  52444. function peg$parseunarySend() {
  52445. var s0, s1, s2, s3;
  52446. var key = peg$currPos * 60 + 47,
  52447. cached = peg$cache[key];
  52448. if (cached) {
  52449. peg$currPos = cached.nextPos;
  52450. return cached.result;
  52451. }
  52452. s0 = peg$currPos;
  52453. s1 = peg$parseoperand();
  52454. if (s1 !== peg$FAILED) {
  52455. s2 = peg$parsews();
  52456. if (s2 !== peg$FAILED) {
  52457. s3 = peg$parseunaryTail();
  52458. if (s3 === peg$FAILED) {
  52459. s3 = peg$c41;
  52460. }
  52461. if (s3 !== peg$FAILED) {
  52462. peg$reportedPos = s0;
  52463. s1 = peg$c115(s1, s3);
  52464. s0 = s1;
  52465. } else {
  52466. peg$currPos = s0;
  52467. s0 = peg$c1;
  52468. }
  52469. } else {
  52470. peg$currPos = s0;
  52471. s0 = peg$c1;
  52472. }
  52473. } else {
  52474. peg$currPos = s0;
  52475. s0 = peg$c1;
  52476. }
  52477. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52478. return s0;
  52479. }
  52480. function peg$parsebinaryMessage() {
  52481. var s0, s1, s2, s3, s4;
  52482. var key = peg$currPos * 60 + 48,
  52483. cached = peg$cache[key];
  52484. if (cached) {
  52485. peg$currPos = cached.nextPos;
  52486. return cached.result;
  52487. }
  52488. s0 = peg$currPos;
  52489. s1 = peg$parsews();
  52490. if (s1 !== peg$FAILED) {
  52491. s2 = peg$parsebinarySelector();
  52492. if (s2 !== peg$FAILED) {
  52493. s3 = peg$parsews();
  52494. if (s3 !== peg$FAILED) {
  52495. s4 = peg$parseunarySend();
  52496. if (s4 === peg$FAILED) {
  52497. s4 = peg$parseoperand();
  52498. }
  52499. if (s4 !== peg$FAILED) {
  52500. peg$reportedPos = s0;
  52501. s1 = peg$c116(s2, s4);
  52502. s0 = s1;
  52503. } else {
  52504. peg$currPos = s0;
  52505. s0 = peg$c1;
  52506. }
  52507. } else {
  52508. peg$currPos = s0;
  52509. s0 = peg$c1;
  52510. }
  52511. } else {
  52512. peg$currPos = s0;
  52513. s0 = peg$c1;
  52514. }
  52515. } else {
  52516. peg$currPos = s0;
  52517. s0 = peg$c1;
  52518. }
  52519. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52520. return s0;
  52521. }
  52522. function peg$parsebinaryTail() {
  52523. var s0, s1, s2;
  52524. var key = peg$currPos * 60 + 49,
  52525. cached = peg$cache[key];
  52526. if (cached) {
  52527. peg$currPos = cached.nextPos;
  52528. return cached.result;
  52529. }
  52530. s0 = peg$currPos;
  52531. s1 = peg$parsebinaryMessage();
  52532. if (s1 !== peg$FAILED) {
  52533. s2 = peg$parsebinaryTail();
  52534. if (s2 === peg$FAILED) {
  52535. s2 = peg$c41;
  52536. }
  52537. if (s2 !== peg$FAILED) {
  52538. peg$reportedPos = s0;
  52539. s1 = peg$c117(s1, s2);
  52540. s0 = s1;
  52541. } else {
  52542. peg$currPos = s0;
  52543. s0 = peg$c1;
  52544. }
  52545. } else {
  52546. peg$currPos = s0;
  52547. s0 = peg$c1;
  52548. }
  52549. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52550. return s0;
  52551. }
  52552. function peg$parsebinarySend() {
  52553. var s0, s1, s2;
  52554. var key = peg$currPos * 60 + 50,
  52555. cached = peg$cache[key];
  52556. if (cached) {
  52557. peg$currPos = cached.nextPos;
  52558. return cached.result;
  52559. }
  52560. s0 = peg$currPos;
  52561. s1 = peg$parseunarySend();
  52562. if (s1 !== peg$FAILED) {
  52563. s2 = peg$parsebinaryTail();
  52564. if (s2 === peg$FAILED) {
  52565. s2 = peg$c41;
  52566. }
  52567. if (s2 !== peg$FAILED) {
  52568. peg$reportedPos = s0;
  52569. s1 = peg$c115(s1, s2);
  52570. s0 = s1;
  52571. } else {
  52572. peg$currPos = s0;
  52573. s0 = peg$c1;
  52574. }
  52575. } else {
  52576. peg$currPos = s0;
  52577. s0 = peg$c1;
  52578. }
  52579. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52580. return s0;
  52581. }
  52582. function peg$parsekeywordMessage() {
  52583. var s0, s1, s2;
  52584. var key = peg$currPos * 60 + 51,
  52585. cached = peg$cache[key];
  52586. if (cached) {
  52587. peg$currPos = cached.nextPos;
  52588. return cached.result;
  52589. }
  52590. s0 = peg$currPos;
  52591. s1 = [];
  52592. s2 = peg$parsekeywordPair();
  52593. if (s2 !== peg$FAILED) {
  52594. while (s2 !== peg$FAILED) {
  52595. s1.push(s2);
  52596. s2 = peg$parsekeywordPair();
  52597. }
  52598. } else {
  52599. s1 = peg$c1;
  52600. }
  52601. if (s1 !== peg$FAILED) {
  52602. peg$reportedPos = s0;
  52603. s1 = peg$c118(s1);
  52604. }
  52605. s0 = s1;
  52606. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52607. return s0;
  52608. }
  52609. function peg$parsekeywordSend() {
  52610. var s0, s1, s2;
  52611. var key = peg$currPos * 60 + 52,
  52612. cached = peg$cache[key];
  52613. if (cached) {
  52614. peg$currPos = cached.nextPos;
  52615. return cached.result;
  52616. }
  52617. s0 = peg$currPos;
  52618. s1 = peg$parsebinarySend();
  52619. if (s1 !== peg$FAILED) {
  52620. s2 = peg$parsekeywordMessage();
  52621. if (s2 !== peg$FAILED) {
  52622. peg$reportedPos = s0;
  52623. s1 = peg$c119(s1, s2);
  52624. s0 = s1;
  52625. } else {
  52626. peg$currPos = s0;
  52627. s0 = peg$c1;
  52628. }
  52629. } else {
  52630. peg$currPos = s0;
  52631. s0 = peg$c1;
  52632. }
  52633. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52634. return s0;
  52635. }
  52636. function peg$parsemessage() {
  52637. var s0;
  52638. var key = peg$currPos * 60 + 53,
  52639. cached = peg$cache[key];
  52640. if (cached) {
  52641. peg$currPos = cached.nextPos;
  52642. return cached.result;
  52643. }
  52644. s0 = peg$parsebinaryMessage();
  52645. if (s0 === peg$FAILED) {
  52646. s0 = peg$parseunaryMessage();
  52647. if (s0 === peg$FAILED) {
  52648. s0 = peg$parsekeywordMessage();
  52649. }
  52650. }
  52651. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52652. return s0;
  52653. }
  52654. function peg$parsecascade() {
  52655. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  52656. var key = peg$currPos * 60 + 54,
  52657. cached = peg$cache[key];
  52658. if (cached) {
  52659. peg$currPos = cached.nextPos;
  52660. return cached.result;
  52661. }
  52662. s0 = peg$currPos;
  52663. s1 = peg$parsews();
  52664. if (s1 !== peg$FAILED) {
  52665. s2 = peg$parsekeywordSend();
  52666. if (s2 === peg$FAILED) {
  52667. s2 = peg$parsebinarySend();
  52668. }
  52669. if (s2 !== peg$FAILED) {
  52670. s3 = [];
  52671. s4 = peg$currPos;
  52672. s5 = peg$parsews();
  52673. if (s5 !== peg$FAILED) {
  52674. if (input.charCodeAt(peg$currPos) === 59) {
  52675. s6 = peg$c120;
  52676. peg$currPos++;
  52677. } else {
  52678. s6 = peg$FAILED;
  52679. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  52680. }
  52681. if (s6 !== peg$FAILED) {
  52682. s7 = peg$parsews();
  52683. if (s7 !== peg$FAILED) {
  52684. s8 = peg$parsemessage();
  52685. if (s8 !== peg$FAILED) {
  52686. peg$reportedPos = s4;
  52687. s5 = peg$c122(s8);
  52688. s4 = s5;
  52689. } else {
  52690. peg$currPos = s4;
  52691. s4 = peg$c1;
  52692. }
  52693. } else {
  52694. peg$currPos = s4;
  52695. s4 = peg$c1;
  52696. }
  52697. } else {
  52698. peg$currPos = s4;
  52699. s4 = peg$c1;
  52700. }
  52701. } else {
  52702. peg$currPos = s4;
  52703. s4 = peg$c1;
  52704. }
  52705. if (s4 !== peg$FAILED) {
  52706. while (s4 !== peg$FAILED) {
  52707. s3.push(s4);
  52708. s4 = peg$currPos;
  52709. s5 = peg$parsews();
  52710. if (s5 !== peg$FAILED) {
  52711. if (input.charCodeAt(peg$currPos) === 59) {
  52712. s6 = peg$c120;
  52713. peg$currPos++;
  52714. } else {
  52715. s6 = peg$FAILED;
  52716. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  52717. }
  52718. if (s6 !== peg$FAILED) {
  52719. s7 = peg$parsews();
  52720. if (s7 !== peg$FAILED) {
  52721. s8 = peg$parsemessage();
  52722. if (s8 !== peg$FAILED) {
  52723. peg$reportedPos = s4;
  52724. s5 = peg$c122(s8);
  52725. s4 = s5;
  52726. } else {
  52727. peg$currPos = s4;
  52728. s4 = peg$c1;
  52729. }
  52730. } else {
  52731. peg$currPos = s4;
  52732. s4 = peg$c1;
  52733. }
  52734. } else {
  52735. peg$currPos = s4;
  52736. s4 = peg$c1;
  52737. }
  52738. } else {
  52739. peg$currPos = s4;
  52740. s4 = peg$c1;
  52741. }
  52742. }
  52743. } else {
  52744. s3 = peg$c1;
  52745. }
  52746. if (s3 !== peg$FAILED) {
  52747. peg$reportedPos = s0;
  52748. s1 = peg$c123(s2, s3);
  52749. s0 = s1;
  52750. } else {
  52751. peg$currPos = s0;
  52752. s0 = peg$c1;
  52753. }
  52754. } else {
  52755. peg$currPos = s0;
  52756. s0 = peg$c1;
  52757. }
  52758. } else {
  52759. peg$currPos = s0;
  52760. s0 = peg$c1;
  52761. }
  52762. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52763. return s0;
  52764. }
  52765. function peg$parsejsStatement() {
  52766. var s0, s1, s2, s3, s4;
  52767. var key = peg$currPos * 60 + 55,
  52768. cached = peg$cache[key];
  52769. if (cached) {
  52770. peg$currPos = cached.nextPos;
  52771. return cached.result;
  52772. }
  52773. s0 = peg$currPos;
  52774. if (input.charCodeAt(peg$currPos) === 60) {
  52775. s1 = peg$c124;
  52776. peg$currPos++;
  52777. } else {
  52778. s1 = peg$FAILED;
  52779. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  52780. }
  52781. if (s1 !== peg$FAILED) {
  52782. s2 = [];
  52783. s3 = peg$currPos;
  52784. if (input.substr(peg$currPos, 2) === peg$c126) {
  52785. s4 = peg$c126;
  52786. peg$currPos += 2;
  52787. } else {
  52788. s4 = peg$FAILED;
  52789. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  52790. }
  52791. if (s4 !== peg$FAILED) {
  52792. peg$reportedPos = s3;
  52793. s4 = peg$c128();
  52794. }
  52795. s3 = s4;
  52796. if (s3 === peg$FAILED) {
  52797. if (peg$c129.test(input.charAt(peg$currPos))) {
  52798. s3 = input.charAt(peg$currPos);
  52799. peg$currPos++;
  52800. } else {
  52801. s3 = peg$FAILED;
  52802. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  52803. }
  52804. }
  52805. while (s3 !== peg$FAILED) {
  52806. s2.push(s3);
  52807. s3 = peg$currPos;
  52808. if (input.substr(peg$currPos, 2) === peg$c126) {
  52809. s4 = peg$c126;
  52810. peg$currPos += 2;
  52811. } else {
  52812. s4 = peg$FAILED;
  52813. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  52814. }
  52815. if (s4 !== peg$FAILED) {
  52816. peg$reportedPos = s3;
  52817. s4 = peg$c128();
  52818. }
  52819. s3 = s4;
  52820. if (s3 === peg$FAILED) {
  52821. if (peg$c129.test(input.charAt(peg$currPos))) {
  52822. s3 = input.charAt(peg$currPos);
  52823. peg$currPos++;
  52824. } else {
  52825. s3 = peg$FAILED;
  52826. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  52827. }
  52828. }
  52829. }
  52830. if (s2 !== peg$FAILED) {
  52831. if (input.charCodeAt(peg$currPos) === 62) {
  52832. s3 = peg$c131;
  52833. peg$currPos++;
  52834. } else {
  52835. s3 = peg$FAILED;
  52836. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  52837. }
  52838. if (s3 !== peg$FAILED) {
  52839. peg$reportedPos = s0;
  52840. s1 = peg$c133(s2);
  52841. s0 = s1;
  52842. } else {
  52843. peg$currPos = s0;
  52844. s0 = peg$c1;
  52845. }
  52846. } else {
  52847. peg$currPos = s0;
  52848. s0 = peg$c1;
  52849. }
  52850. } else {
  52851. peg$currPos = s0;
  52852. s0 = peg$c1;
  52853. }
  52854. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52855. return s0;
  52856. }
  52857. function peg$parsemethod() {
  52858. var s0, s1, s2, s3, s4;
  52859. var key = peg$currPos * 60 + 56,
  52860. cached = peg$cache[key];
  52861. if (cached) {
  52862. peg$currPos = cached.nextPos;
  52863. return cached.result;
  52864. }
  52865. s0 = peg$currPos;
  52866. s1 = peg$parsekeywordPattern();
  52867. if (s1 === peg$FAILED) {
  52868. s1 = peg$parsebinaryPattern();
  52869. if (s1 === peg$FAILED) {
  52870. s1 = peg$parseunaryPattern();
  52871. }
  52872. }
  52873. if (s1 !== peg$FAILED) {
  52874. s2 = peg$parsews();
  52875. if (s2 !== peg$FAILED) {
  52876. s3 = peg$parsesequence();
  52877. if (s3 === peg$FAILED) {
  52878. s3 = peg$c41;
  52879. }
  52880. if (s3 !== peg$FAILED) {
  52881. s4 = peg$parsews();
  52882. if (s4 !== peg$FAILED) {
  52883. peg$reportedPos = s0;
  52884. s1 = peg$c134(s1, s3);
  52885. s0 = s1;
  52886. } else {
  52887. peg$currPos = s0;
  52888. s0 = peg$c1;
  52889. }
  52890. } else {
  52891. peg$currPos = s0;
  52892. s0 = peg$c1;
  52893. }
  52894. } else {
  52895. peg$currPos = s0;
  52896. s0 = peg$c1;
  52897. }
  52898. } else {
  52899. peg$currPos = s0;
  52900. s0 = peg$c1;
  52901. }
  52902. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52903. return s0;
  52904. }
  52905. function peg$parseassociationSend() {
  52906. var s0, s1, s2;
  52907. var key = peg$currPos * 60 + 57,
  52908. cached = peg$cache[key];
  52909. if (cached) {
  52910. peg$currPos = cached.nextPos;
  52911. return cached.result;
  52912. }
  52913. s0 = peg$currPos;
  52914. s1 = peg$parsebinarySend();
  52915. if (s1 !== peg$FAILED) {
  52916. peg$reportedPos = peg$currPos;
  52917. s2 = peg$c135(s1);
  52918. if (s2) {
  52919. s2 = peg$c112;
  52920. } else {
  52921. s2 = peg$c1;
  52922. }
  52923. if (s2 !== peg$FAILED) {
  52924. peg$reportedPos = s0;
  52925. s1 = peg$c136(s1);
  52926. s0 = s1;
  52927. } else {
  52928. peg$currPos = s0;
  52929. s0 = peg$c1;
  52930. }
  52931. } else {
  52932. peg$currPos = s0;
  52933. s0 = peg$c1;
  52934. }
  52935. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52936. return s0;
  52937. }
  52938. function peg$parseassociationList() {
  52939. var s0, s1, s2, s3, s4;
  52940. var key = peg$currPos * 60 + 58,
  52941. cached = peg$cache[key];
  52942. if (cached) {
  52943. peg$currPos = cached.nextPos;
  52944. return cached.result;
  52945. }
  52946. s0 = peg$currPos;
  52947. s1 = peg$parsews();
  52948. if (s1 !== peg$FAILED) {
  52949. if (input.charCodeAt(peg$currPos) === 46) {
  52950. s2 = peg$c51;
  52951. peg$currPos++;
  52952. } else {
  52953. s2 = peg$FAILED;
  52954. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52955. }
  52956. if (s2 !== peg$FAILED) {
  52957. s3 = peg$parsews();
  52958. if (s3 !== peg$FAILED) {
  52959. s4 = peg$parseassociationSend();
  52960. if (s4 !== peg$FAILED) {
  52961. peg$reportedPos = s0;
  52962. s1 = peg$c89(s4);
  52963. s0 = s1;
  52964. } else {
  52965. peg$currPos = s0;
  52966. s0 = peg$c1;
  52967. }
  52968. } else {
  52969. peg$currPos = s0;
  52970. s0 = peg$c1;
  52971. }
  52972. } else {
  52973. peg$currPos = s0;
  52974. s0 = peg$c1;
  52975. }
  52976. } else {
  52977. peg$currPos = s0;
  52978. s0 = peg$c1;
  52979. }
  52980. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52981. return s0;
  52982. }
  52983. function peg$parseassociations() {
  52984. var s0, s1, s2, s3;
  52985. var key = peg$currPos * 60 + 59,
  52986. cached = peg$cache[key];
  52987. if (cached) {
  52988. peg$currPos = cached.nextPos;
  52989. return cached.result;
  52990. }
  52991. s0 = peg$currPos;
  52992. s1 = peg$parseassociationSend();
  52993. if (s1 !== peg$FAILED) {
  52994. s2 = [];
  52995. s3 = peg$parseassociationList();
  52996. while (s3 !== peg$FAILED) {
  52997. s2.push(s3);
  52998. s3 = peg$parseassociationList();
  52999. }
  53000. if (s2 !== peg$FAILED) {
  53001. peg$reportedPos = s0;
  53002. s1 = peg$c137(s1, s2);
  53003. s0 = s1;
  53004. } else {
  53005. peg$currPos = s0;
  53006. s0 = peg$c1;
  53007. }
  53008. } else {
  53009. peg$currPos = s0;
  53010. s0 = peg$c1;
  53011. }
  53012. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  53013. return s0;
  53014. }
  53015. peg$result = peg$startRuleFunction();
  53016. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  53017. return peg$result;
  53018. } else {
  53019. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  53020. peg$fail({ type: "end", description: "end of input" });
  53021. }
  53022. throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  53023. }
  53024. }
  53025. return {
  53026. SyntaxError: SyntaxError,
  53027. parse: parse
  53028. };
  53029. })();
  53030. });
  53031. define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Classes", "amber_core/Kernel-Infrastructure"], function($boot){
  53032. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  53033. smalltalk.addPackage('SUnit');
  53034. smalltalk.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  53035. smalltalk.addClass('ResultAnnouncement', globals.Object, ['result'], 'SUnit');
  53036. //>>excludeStart("ide", pragmas.excludeIdeData);
  53037. globals.ResultAnnouncement.comment="I get signaled when a `TestCase` has been run.\x0a\x0aMy instances hold the result (instance of `TestResult`) of the test run.";
  53038. //>>excludeEnd("ide");
  53039. smalltalk.addMethod(
  53040. smalltalk.method({
  53041. selector: "result",
  53042. protocol: 'accessing',
  53043. fn: function (){
  53044. var self=this;
  53045. var $1;
  53046. $1=self["@result"];
  53047. return $1;
  53048. },
  53049. //>>excludeStart("ide", pragmas.excludeIdeData);
  53050. args: [],
  53051. source: "result\x0a\x09^ result",
  53052. referencedClasses: [],
  53053. //>>excludeEnd("ide");
  53054. messageSends: []
  53055. }),
  53056. globals.ResultAnnouncement);
  53057. smalltalk.addMethod(
  53058. smalltalk.method({
  53059. selector: "result:",
  53060. protocol: 'accessing',
  53061. fn: function (aTestResult){
  53062. var self=this;
  53063. self["@result"]=aTestResult;
  53064. return self;
  53065. },
  53066. //>>excludeStart("ide", pragmas.excludeIdeData);
  53067. args: ["aTestResult"],
  53068. source: "result: aTestResult\x0a\x09result := aTestResult",
  53069. referencedClasses: [],
  53070. //>>excludeEnd("ide");
  53071. messageSends: []
  53072. }),
  53073. globals.ResultAnnouncement);
  53074. smalltalk.addClass('TestCase', globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  53075. //>>excludeStart("ide", pragmas.excludeIdeData);
  53076. globals.TestCase.comment="I am an implementation of the command pattern to run a test.\x0a\x0a## API\x0a\x0aMy instances are created with the class method `#selector:`,\x0apassing the symbol that names the method to be executed when the test case runs.\x0a\x0aWhen you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.\x0aAs that method develops and more `#test...` methods are added, you will find yourself refactoring temps\x0ainto instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.\x0aAs required, override `#tearDown` to nil references, release objects and deallocate.";
  53077. //>>excludeEnd("ide");
  53078. smalltalk.addMethod(
  53079. smalltalk.method({
  53080. selector: "assert:",
  53081. protocol: 'testing',
  53082. fn: function (aBoolean){
  53083. var self=this;
  53084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53085. return smalltalk.withContext(function($ctx1) {
  53086. //>>excludeEnd("ctx");
  53087. self._assert_description_(aBoolean,"Assertion failed");
  53088. return self;
  53089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53090. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},globals.TestCase)});
  53091. //>>excludeEnd("ctx");
  53092. },
  53093. //>>excludeStart("ide", pragmas.excludeIdeData);
  53094. args: ["aBoolean"],
  53095. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  53096. referencedClasses: [],
  53097. //>>excludeEnd("ide");
  53098. messageSends: ["assert:description:"]
  53099. }),
  53100. globals.TestCase);
  53101. smalltalk.addMethod(
  53102. smalltalk.method({
  53103. selector: "assert:description:",
  53104. protocol: 'testing',
  53105. fn: function (aBoolean,aString){
  53106. var self=this;
  53107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53108. return smalltalk.withContext(function($ctx1) {
  53109. //>>excludeEnd("ctx");
  53110. if(! smalltalk.assert(aBoolean)){
  53111. self._signalFailure_(aString);
  53112. };
  53113. return self;
  53114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53115. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},globals.TestCase)});
  53116. //>>excludeEnd("ctx");
  53117. },
  53118. //>>excludeStart("ide", pragmas.excludeIdeData);
  53119. args: ["aBoolean", "aString"],
  53120. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  53121. referencedClasses: [],
  53122. //>>excludeEnd("ide");
  53123. messageSends: ["ifFalse:", "signalFailure:"]
  53124. }),
  53125. globals.TestCase);
  53126. smalltalk.addMethod(
  53127. smalltalk.method({
  53128. selector: "assert:equals:",
  53129. protocol: 'testing',
  53130. fn: function (actual,expected){
  53131. var self=this;
  53132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53133. return smalltalk.withContext(function($ctx1) {
  53134. //>>excludeEnd("ctx");
  53135. var $2,$6,$5,$4,$3,$1;
  53136. $2=_st(actual).__eq(expected);
  53137. $6=_st(expected)._printString();
  53138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53139. $ctx1.sendIdx["printString"]=1;
  53140. //>>excludeEnd("ctx");
  53141. $5="Expected: ".__comma($6);
  53142. $4=_st($5).__comma(" but was: ");
  53143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53144. $ctx1.sendIdx[","]=2;
  53145. //>>excludeEnd("ctx");
  53146. $3=_st($4).__comma(_st(actual)._printString());
  53147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53148. $ctx1.sendIdx[","]=1;
  53149. //>>excludeEnd("ctx");
  53150. $1=self._assert_description_($2,$3);
  53151. return $1;
  53152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53153. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},globals.TestCase)});
  53154. //>>excludeEnd("ctx");
  53155. },
  53156. //>>excludeStart("ide", pragmas.excludeIdeData);
  53157. args: ["actual", "expected"],
  53158. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  53159. referencedClasses: [],
  53160. //>>excludeEnd("ide");
  53161. messageSends: ["assert:description:", "=", ",", "printString"]
  53162. }),
  53163. globals.TestCase);
  53164. smalltalk.addMethod(
  53165. smalltalk.method({
  53166. selector: "async:",
  53167. protocol: 'async',
  53168. fn: function (aBlock){
  53169. var self=this;
  53170. var c;
  53171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53172. return smalltalk.withContext(function($ctx1) {
  53173. //>>excludeEnd("ctx");
  53174. var $2,$1;
  53175. self._errorIfNotAsync_("#async");
  53176. c=self["@context"];
  53177. $1=(function(){
  53178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53179. return smalltalk.withContext(function($ctx2) {
  53180. //>>excludeEnd("ctx");
  53181. $2=self._isAsync();
  53182. if(smalltalk.assert($2)){
  53183. return _st(c)._execute_(aBlock);
  53184. };
  53185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53187. //>>excludeEnd("ctx");
  53188. });
  53189. return $1;
  53190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53191. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},globals.TestCase)});
  53192. //>>excludeEnd("ctx");
  53193. },
  53194. //>>excludeStart("ide", pragmas.excludeIdeData);
  53195. args: ["aBlock"],
  53196. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  53197. referencedClasses: [],
  53198. //>>excludeEnd("ide");
  53199. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  53200. }),
  53201. globals.TestCase);
  53202. smalltalk.addMethod(
  53203. smalltalk.method({
  53204. selector: "context:",
  53205. protocol: 'accessing',
  53206. fn: function (aRunningTestContext){
  53207. var self=this;
  53208. self["@context"]=aRunningTestContext;
  53209. return self;
  53210. },
  53211. //>>excludeStart("ide", pragmas.excludeIdeData);
  53212. args: ["aRunningTestContext"],
  53213. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  53214. referencedClasses: [],
  53215. //>>excludeEnd("ide");
  53216. messageSends: []
  53217. }),
  53218. globals.TestCase);
  53219. smalltalk.addMethod(
  53220. smalltalk.method({
  53221. selector: "deny:",
  53222. protocol: 'testing',
  53223. fn: function (aBoolean){
  53224. var self=this;
  53225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53226. return smalltalk.withContext(function($ctx1) {
  53227. //>>excludeEnd("ctx");
  53228. self._assert_(_st(aBoolean)._not());
  53229. return self;
  53230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53231. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},globals.TestCase)});
  53232. //>>excludeEnd("ctx");
  53233. },
  53234. //>>excludeStart("ide", pragmas.excludeIdeData);
  53235. args: ["aBoolean"],
  53236. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  53237. referencedClasses: [],
  53238. //>>excludeEnd("ide");
  53239. messageSends: ["assert:", "not"]
  53240. }),
  53241. globals.TestCase);
  53242. smalltalk.addMethod(
  53243. smalltalk.method({
  53244. selector: "errorIfNotAsync:",
  53245. protocol: 'error handling',
  53246. fn: function (aString){
  53247. var self=this;
  53248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53249. return smalltalk.withContext(function($ctx1) {
  53250. //>>excludeEnd("ctx");
  53251. var $1;
  53252. $1=self._isAsync();
  53253. if(! smalltalk.assert($1)){
  53254. self._error_(_st(aString).__comma(" used without prior #timeout:"));
  53255. };
  53256. return self;
  53257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53258. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},globals.TestCase)});
  53259. //>>excludeEnd("ctx");
  53260. },
  53261. //>>excludeStart("ide", pragmas.excludeIdeData);
  53262. args: ["aString"],
  53263. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  53264. referencedClasses: [],
  53265. //>>excludeEnd("ide");
  53266. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  53267. }),
  53268. globals.TestCase);
  53269. smalltalk.addMethod(
  53270. smalltalk.method({
  53271. selector: "finished",
  53272. protocol: 'async',
  53273. fn: function (){
  53274. var self=this;
  53275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53276. return smalltalk.withContext(function($ctx1) {
  53277. //>>excludeEnd("ctx");
  53278. self._errorIfNotAsync_("#finished");
  53279. self["@asyncTimeout"]=nil;
  53280. return self;
  53281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53282. }, function($ctx1) {$ctx1.fill(self,"finished",{},globals.TestCase)});
  53283. //>>excludeEnd("ctx");
  53284. },
  53285. //>>excludeStart("ide", pragmas.excludeIdeData);
  53286. args: [],
  53287. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  53288. referencedClasses: [],
  53289. //>>excludeEnd("ide");
  53290. messageSends: ["errorIfNotAsync:"]
  53291. }),
  53292. globals.TestCase);
  53293. smalltalk.addMethod(
  53294. smalltalk.method({
  53295. selector: "isAsync",
  53296. protocol: 'testing',
  53297. fn: function (){
  53298. var self=this;
  53299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53300. return smalltalk.withContext(function($ctx1) {
  53301. //>>excludeEnd("ctx");
  53302. var $1;
  53303. $1=_st(self["@asyncTimeout"])._notNil();
  53304. return $1;
  53305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53306. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},globals.TestCase)});
  53307. //>>excludeEnd("ctx");
  53308. },
  53309. //>>excludeStart("ide", pragmas.excludeIdeData);
  53310. args: [],
  53311. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  53312. referencedClasses: [],
  53313. //>>excludeEnd("ide");
  53314. messageSends: ["notNil"]
  53315. }),
  53316. globals.TestCase);
  53317. smalltalk.addMethod(
  53318. smalltalk.method({
  53319. selector: "performTest",
  53320. protocol: 'running',
  53321. fn: function (){
  53322. var self=this;
  53323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53324. return smalltalk.withContext(function($ctx1) {
  53325. //>>excludeEnd("ctx");
  53326. self["@asyncTimeout"]=nil;
  53327. self._perform_(self._selector());
  53328. return self;
  53329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53330. }, function($ctx1) {$ctx1.fill(self,"performTest",{},globals.TestCase)});
  53331. //>>excludeEnd("ctx");
  53332. },
  53333. //>>excludeStart("ide", pragmas.excludeIdeData);
  53334. args: [],
  53335. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  53336. referencedClasses: [],
  53337. //>>excludeEnd("ide");
  53338. messageSends: ["perform:", "selector"]
  53339. }),
  53340. globals.TestCase);
  53341. smalltalk.addMethod(
  53342. smalltalk.method({
  53343. selector: "runCase",
  53344. protocol: 'running',
  53345. fn: function (){
  53346. var self=this;
  53347. function $TestContext(){return globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
  53348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53349. return smalltalk.withContext(function($ctx1) {
  53350. //>>excludeEnd("ctx");
  53351. _st(_st($TestContext())._testCase_(self))._start();
  53352. return self;
  53353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53354. }, function($ctx1) {$ctx1.fill(self,"runCase",{},globals.TestCase)});
  53355. //>>excludeEnd("ctx");
  53356. },
  53357. //>>excludeStart("ide", pragmas.excludeIdeData);
  53358. args: [],
  53359. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  53360. referencedClasses: ["TestContext"],
  53361. //>>excludeEnd("ide");
  53362. messageSends: ["start", "testCase:"]
  53363. }),
  53364. globals.TestCase);
  53365. smalltalk.addMethod(
  53366. smalltalk.method({
  53367. selector: "selector",
  53368. protocol: 'accessing',
  53369. fn: function (){
  53370. var self=this;
  53371. var $1;
  53372. $1=self["@testSelector"];
  53373. return $1;
  53374. },
  53375. //>>excludeStart("ide", pragmas.excludeIdeData);
  53376. args: [],
  53377. source: "selector\x0a\x09^ testSelector",
  53378. referencedClasses: [],
  53379. //>>excludeEnd("ide");
  53380. messageSends: []
  53381. }),
  53382. globals.TestCase);
  53383. smalltalk.addMethod(
  53384. smalltalk.method({
  53385. selector: "setTestSelector:",
  53386. protocol: 'accessing',
  53387. fn: function (aSelector){
  53388. var self=this;
  53389. self["@testSelector"]=aSelector;
  53390. return self;
  53391. },
  53392. //>>excludeStart("ide", pragmas.excludeIdeData);
  53393. args: ["aSelector"],
  53394. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  53395. referencedClasses: [],
  53396. //>>excludeEnd("ide");
  53397. messageSends: []
  53398. }),
  53399. globals.TestCase);
  53400. smalltalk.addMethod(
  53401. smalltalk.method({
  53402. selector: "setUp",
  53403. protocol: 'running',
  53404. fn: function (){
  53405. var self=this;
  53406. return self;
  53407. },
  53408. //>>excludeStart("ide", pragmas.excludeIdeData);
  53409. args: [],
  53410. source: "setUp",
  53411. referencedClasses: [],
  53412. //>>excludeEnd("ide");
  53413. messageSends: []
  53414. }),
  53415. globals.TestCase);
  53416. smalltalk.addMethod(
  53417. smalltalk.method({
  53418. selector: "should:",
  53419. protocol: 'testing',
  53420. fn: function (aBlock){
  53421. var self=this;
  53422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53423. return smalltalk.withContext(function($ctx1) {
  53424. //>>excludeEnd("ctx");
  53425. self._assert_(_st(aBlock)._value());
  53426. return self;
  53427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53428. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},globals.TestCase)});
  53429. //>>excludeEnd("ctx");
  53430. },
  53431. //>>excludeStart("ide", pragmas.excludeIdeData);
  53432. args: ["aBlock"],
  53433. source: "should: aBlock\x0a\x09self assert: aBlock value",
  53434. referencedClasses: [],
  53435. //>>excludeEnd("ide");
  53436. messageSends: ["assert:", "value"]
  53437. }),
  53438. globals.TestCase);
  53439. smalltalk.addMethod(
  53440. smalltalk.method({
  53441. selector: "should:raise:",
  53442. protocol: 'testing',
  53443. fn: function (aBlock,anExceptionClass){
  53444. var self=this;
  53445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53446. return smalltalk.withContext(function($ctx1) {
  53447. //>>excludeEnd("ctx");
  53448. self._assert_(_st((function(){
  53449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53450. return smalltalk.withContext(function($ctx2) {
  53451. //>>excludeEnd("ctx");
  53452. _st(aBlock)._value();
  53453. return false;
  53454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53456. //>>excludeEnd("ctx");
  53457. }))._on_do_(anExceptionClass,(function(ex){
  53458. return true;
  53459. })));
  53460. return self;
  53461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53462. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},globals.TestCase)});
  53463. //>>excludeEnd("ctx");
  53464. },
  53465. //>>excludeStart("ide", pragmas.excludeIdeData);
  53466. args: ["aBlock", "anExceptionClass"],
  53467. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  53468. referencedClasses: [],
  53469. //>>excludeEnd("ide");
  53470. messageSends: ["assert:", "on:do:", "value"]
  53471. }),
  53472. globals.TestCase);
  53473. smalltalk.addMethod(
  53474. smalltalk.method({
  53475. selector: "shouldnt:raise:",
  53476. protocol: 'testing',
  53477. fn: function (aBlock,anExceptionClass){
  53478. var self=this;
  53479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53480. return smalltalk.withContext(function($ctx1) {
  53481. //>>excludeEnd("ctx");
  53482. self._assert_(_st((function(){
  53483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53484. return smalltalk.withContext(function($ctx2) {
  53485. //>>excludeEnd("ctx");
  53486. _st(aBlock)._value();
  53487. return true;
  53488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53490. //>>excludeEnd("ctx");
  53491. }))._on_do_(anExceptionClass,(function(ex){
  53492. return false;
  53493. })));
  53494. return self;
  53495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53496. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},globals.TestCase)});
  53497. //>>excludeEnd("ctx");
  53498. },
  53499. //>>excludeStart("ide", pragmas.excludeIdeData);
  53500. args: ["aBlock", "anExceptionClass"],
  53501. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  53502. referencedClasses: [],
  53503. //>>excludeEnd("ide");
  53504. messageSends: ["assert:", "on:do:", "value"]
  53505. }),
  53506. globals.TestCase);
  53507. smalltalk.addMethod(
  53508. smalltalk.method({
  53509. selector: "signalFailure:",
  53510. protocol: 'private',
  53511. fn: function (aString){
  53512. var self=this;
  53513. function $TestFailure(){return globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  53514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53515. return smalltalk.withContext(function($ctx1) {
  53516. //>>excludeEnd("ctx");
  53517. var $1,$2;
  53518. $1=_st($TestFailure())._new();
  53519. _st($1)._messageText_(aString);
  53520. $2=_st($1)._signal();
  53521. return self;
  53522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53523. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},globals.TestCase)});
  53524. //>>excludeEnd("ctx");
  53525. },
  53526. //>>excludeStart("ide", pragmas.excludeIdeData);
  53527. args: ["aString"],
  53528. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  53529. referencedClasses: ["TestFailure"],
  53530. //>>excludeEnd("ide");
  53531. messageSends: ["messageText:", "new", "signal"]
  53532. }),
  53533. globals.TestCase);
  53534. smalltalk.addMethod(
  53535. smalltalk.method({
  53536. selector: "tearDown",
  53537. protocol: 'running',
  53538. fn: function (){
  53539. var self=this;
  53540. return self;
  53541. },
  53542. //>>excludeStart("ide", pragmas.excludeIdeData);
  53543. args: [],
  53544. source: "tearDown",
  53545. referencedClasses: [],
  53546. //>>excludeEnd("ide");
  53547. messageSends: []
  53548. }),
  53549. globals.TestCase);
  53550. smalltalk.addMethod(
  53551. smalltalk.method({
  53552. selector: "timeout:",
  53553. protocol: 'async',
  53554. fn: function (aNumber){
  53555. var self=this;
  53556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53557. return smalltalk.withContext(function($ctx1) {
  53558. //>>excludeEnd("ctx");
  53559. var $1,$receiver;
  53560. $1=self["@asyncTimeout"];
  53561. if(($receiver = $1) == null || $receiver.isNil){
  53562. $1;
  53563. } else {
  53564. _st(self["@asyncTimeout"])._clearTimeout();
  53565. };
  53566. self["@asyncTimeout"]=(0);
  53567. self["@asyncTimeout"]=_st(self._async_((function(){
  53568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53569. return smalltalk.withContext(function($ctx2) {
  53570. //>>excludeEnd("ctx");
  53571. return self._assert_description_(false,"SUnit grace time exhausted");
  53572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53574. //>>excludeEnd("ctx");
  53575. })))._valueWithTimeout_(aNumber);
  53576. return self;
  53577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53578. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},globals.TestCase)});
  53579. //>>excludeEnd("ctx");
  53580. },
  53581. //>>excludeStart("ide", pragmas.excludeIdeData);
  53582. args: ["aNumber"],
  53583. source: "timeout: aNumber\x0a\x09\x22Set a grace time timeout in milliseconds to run the test asynchronously\x22\x0a\x09\x0a\x09asyncTimeout ifNotNil: [ asyncTimeout clearTimeout ].\x0a\x09\x0a\x09\x22to allow #async: message send without throwing an error\x22\x0a\x09asyncTimeout := 0.\x0a\x09\x0a\x09asyncTimeout := (self async: [\x0a\x09\x09self assert: false description: 'SUnit grace time exhausted' ])\x0a\x09\x09\x09valueWithTimeout: aNumber",
  53584. referencedClasses: [],
  53585. //>>excludeEnd("ide");
  53586. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  53587. }),
  53588. globals.TestCase);
  53589. smalltalk.addMethod(
  53590. smalltalk.method({
  53591. selector: "allTestSelectors",
  53592. protocol: 'accessing',
  53593. fn: function (){
  53594. var self=this;
  53595. var selectors;
  53596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53597. return smalltalk.withContext(function($ctx1) {
  53598. //>>excludeEnd("ctx");
  53599. var $1,$2;
  53600. selectors=self._testSelectors();
  53601. $1=self._shouldInheritSelectors();
  53602. if(smalltalk.assert($1)){
  53603. _st(selectors)._addAll_(_st(self._superclass())._allTestSelectors());
  53604. };
  53605. $2=selectors;
  53606. return $2;
  53607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53608. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},globals.TestCase.klass)});
  53609. //>>excludeEnd("ctx");
  53610. },
  53611. //>>excludeStart("ide", pragmas.excludeIdeData);
  53612. args: [],
  53613. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  53614. referencedClasses: [],
  53615. //>>excludeEnd("ide");
  53616. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  53617. }),
  53618. globals.TestCase.klass);
  53619. smalltalk.addMethod(
  53620. smalltalk.method({
  53621. selector: "buildSuite",
  53622. protocol: 'accessing',
  53623. fn: function (){
  53624. var self=this;
  53625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53626. return smalltalk.withContext(function($ctx1) {
  53627. //>>excludeEnd("ctx");
  53628. var $1;
  53629. $1=_st(self._allTestSelectors())._collect_((function(each){
  53630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53631. return smalltalk.withContext(function($ctx2) {
  53632. //>>excludeEnd("ctx");
  53633. return self._selector_(each);
  53634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53635. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53636. //>>excludeEnd("ctx");
  53637. }));
  53638. return $1;
  53639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53640. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},globals.TestCase.klass)});
  53641. //>>excludeEnd("ctx");
  53642. },
  53643. //>>excludeStart("ide", pragmas.excludeIdeData);
  53644. args: [],
  53645. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  53646. referencedClasses: [],
  53647. //>>excludeEnd("ide");
  53648. messageSends: ["collect:", "allTestSelectors", "selector:"]
  53649. }),
  53650. globals.TestCase.klass);
  53651. smalltalk.addMethod(
  53652. smalltalk.method({
  53653. selector: "heliosClass",
  53654. protocol: 'helios',
  53655. fn: function (){
  53656. var self=this;
  53657. return "test";
  53658. },
  53659. //>>excludeStart("ide", pragmas.excludeIdeData);
  53660. args: [],
  53661. source: "heliosClass\x0a\x09^ 'test'",
  53662. referencedClasses: [],
  53663. //>>excludeEnd("ide");
  53664. messageSends: []
  53665. }),
  53666. globals.TestCase.klass);
  53667. smalltalk.addMethod(
  53668. smalltalk.method({
  53669. selector: "isAbstract",
  53670. protocol: 'testing',
  53671. fn: function (){
  53672. var self=this;
  53673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53674. return smalltalk.withContext(function($ctx1) {
  53675. //>>excludeEnd("ctx");
  53676. var $1;
  53677. $1=_st(self._name()).__eq("TestCase");
  53678. return $1;
  53679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53680. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.TestCase.klass)});
  53681. //>>excludeEnd("ctx");
  53682. },
  53683. //>>excludeStart("ide", pragmas.excludeIdeData);
  53684. args: [],
  53685. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  53686. referencedClasses: [],
  53687. //>>excludeEnd("ide");
  53688. messageSends: ["=", "name"]
  53689. }),
  53690. globals.TestCase.klass);
  53691. smalltalk.addMethod(
  53692. smalltalk.method({
  53693. selector: "lookupHierarchyRoot",
  53694. protocol: 'accessing',
  53695. fn: function (){
  53696. var self=this;
  53697. function $TestCase(){return globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  53698. return $TestCase();
  53699. },
  53700. //>>excludeStart("ide", pragmas.excludeIdeData);
  53701. args: [],
  53702. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  53703. referencedClasses: ["TestCase"],
  53704. //>>excludeEnd("ide");
  53705. messageSends: []
  53706. }),
  53707. globals.TestCase.klass);
  53708. smalltalk.addMethod(
  53709. smalltalk.method({
  53710. selector: "selector:",
  53711. protocol: 'accessing',
  53712. fn: function (aSelector){
  53713. var self=this;
  53714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53715. return smalltalk.withContext(function($ctx1) {
  53716. //>>excludeEnd("ctx");
  53717. var $2,$3,$1;
  53718. $2=self._new();
  53719. _st($2)._setTestSelector_(aSelector);
  53720. $3=_st($2)._yourself();
  53721. $1=$3;
  53722. return $1;
  53723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53724. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},globals.TestCase.klass)});
  53725. //>>excludeEnd("ctx");
  53726. },
  53727. //>>excludeStart("ide", pragmas.excludeIdeData);
  53728. args: ["aSelector"],
  53729. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  53730. referencedClasses: [],
  53731. //>>excludeEnd("ide");
  53732. messageSends: ["setTestSelector:", "new", "yourself"]
  53733. }),
  53734. globals.TestCase.klass);
  53735. smalltalk.addMethod(
  53736. smalltalk.method({
  53737. selector: "shouldInheritSelectors",
  53738. protocol: 'testing',
  53739. fn: function (){
  53740. var self=this;
  53741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53742. return smalltalk.withContext(function($ctx1) {
  53743. //>>excludeEnd("ctx");
  53744. var $1;
  53745. $1=self.__tild_eq(self._lookupHierarchyRoot());
  53746. return $1;
  53747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53748. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},globals.TestCase.klass)});
  53749. //>>excludeEnd("ctx");
  53750. },
  53751. //>>excludeStart("ide", pragmas.excludeIdeData);
  53752. args: [],
  53753. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  53754. referencedClasses: [],
  53755. //>>excludeEnd("ide");
  53756. messageSends: ["~=", "lookupHierarchyRoot"]
  53757. }),
  53758. globals.TestCase.klass);
  53759. smalltalk.addMethod(
  53760. smalltalk.method({
  53761. selector: "testSelectors",
  53762. protocol: 'accessing',
  53763. fn: function (){
  53764. var self=this;
  53765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53766. return smalltalk.withContext(function($ctx1) {
  53767. //>>excludeEnd("ctx");
  53768. var $1;
  53769. $1=_st(_st(self._methodDictionary())._keys())._select_((function(each){
  53770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53771. return smalltalk.withContext(function($ctx2) {
  53772. //>>excludeEnd("ctx");
  53773. return _st(each)._match_("^test");
  53774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53776. //>>excludeEnd("ctx");
  53777. }));
  53778. return $1;
  53779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53780. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},globals.TestCase.klass)});
  53781. //>>excludeEnd("ctx");
  53782. },
  53783. //>>excludeStart("ide", pragmas.excludeIdeData);
  53784. args: [],
  53785. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  53786. referencedClasses: [],
  53787. //>>excludeEnd("ide");
  53788. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  53789. }),
  53790. globals.TestCase.klass);
  53791. smalltalk.addClass('TestContext', globals.Object, ['testCase'], 'SUnit');
  53792. //>>excludeStart("ide", pragmas.excludeIdeData);
  53793. globals.TestContext.comment="I govern running a particular test case.\x0a\x0aMy main added value is `#execute:` method which runs a block as a part of test case (restores context, nilling it afterwards, cleaning/calling `#tearDown` as appropriate for sync/async scenario).";
  53794. //>>excludeEnd("ide");
  53795. smalltalk.addMethod(
  53796. smalltalk.method({
  53797. selector: "execute:",
  53798. protocol: 'running',
  53799. fn: function (aBlock){
  53800. var self=this;
  53801. var failed;
  53802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53803. return smalltalk.withContext(function($ctx1) {
  53804. //>>excludeEnd("ctx");
  53805. var $1,$2;
  53806. _st(self["@testCase"])._context_(self);
  53807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53808. $ctx1.sendIdx["context:"]=1;
  53809. //>>excludeEnd("ctx");
  53810. _st((function(){
  53811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53812. return smalltalk.withContext(function($ctx2) {
  53813. //>>excludeEnd("ctx");
  53814. failed=true;
  53815. failed;
  53816. _st(aBlock)._value();
  53817. failed=false;
  53818. return failed;
  53819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53821. //>>excludeEnd("ctx");
  53822. }))._ensure_((function(){
  53823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53824. return smalltalk.withContext(function($ctx2) {
  53825. //>>excludeEnd("ctx");
  53826. _st(self["@testCase"])._context_(nil);
  53827. $1=_st(failed)._and_((function(){
  53828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53829. return smalltalk.withContext(function($ctx3) {
  53830. //>>excludeEnd("ctx");
  53831. return _st(self["@testCase"])._isAsync();
  53832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53833. $ctx3.sendIdx["isAsync"]=1;
  53834. //>>excludeEnd("ctx");
  53835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53836. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53837. //>>excludeEnd("ctx");
  53838. }));
  53839. if(smalltalk.assert($1)){
  53840. _st(self["@testCase"])._finished();
  53841. };
  53842. $2=_st(self["@testCase"])._isAsync();
  53843. if(! smalltalk.assert($2)){
  53844. return _st(self["@testCase"])._tearDown();
  53845. };
  53846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53848. //>>excludeEnd("ctx");
  53849. }));
  53850. return self;
  53851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53852. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},globals.TestContext)});
  53853. //>>excludeEnd("ctx");
  53854. },
  53855. //>>excludeStart("ide", pragmas.excludeIdeData);
  53856. args: ["aBlock"],
  53857. source: "execute: aBlock\x0a\x09| failed |\x0a\x09\x0a\x09testCase context: self.\x0a\x09[\x0a\x09\x09failed := true.\x0a\x09\x09aBlock value.\x0a\x09\x09failed := false\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase context: nil.\x0a\x09\x09\x09\x0a\x09\x09\x09(failed and: [ testCase isAsync ]) ifTrue: [\x0a\x09\x09\x09\x09testCase finished ].\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09testCase tearDown ] ]",
  53858. referencedClasses: [],
  53859. //>>excludeEnd("ide");
  53860. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  53861. }),
  53862. globals.TestContext);
  53863. smalltalk.addMethod(
  53864. smalltalk.method({
  53865. selector: "start",
  53866. protocol: 'running',
  53867. fn: function (){
  53868. var self=this;
  53869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53870. return smalltalk.withContext(function($ctx1) {
  53871. //>>excludeEnd("ctx");
  53872. self._execute_((function(){
  53873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53874. return smalltalk.withContext(function($ctx2) {
  53875. //>>excludeEnd("ctx");
  53876. _st(self["@testCase"])._setUp();
  53877. return _st(self["@testCase"])._performTest();
  53878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53880. //>>excludeEnd("ctx");
  53881. }));
  53882. return self;
  53883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53884. }, function($ctx1) {$ctx1.fill(self,"start",{},globals.TestContext)});
  53885. //>>excludeEnd("ctx");
  53886. },
  53887. //>>excludeStart("ide", pragmas.excludeIdeData);
  53888. args: [],
  53889. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  53890. referencedClasses: [],
  53891. //>>excludeEnd("ide");
  53892. messageSends: ["execute:", "setUp", "performTest"]
  53893. }),
  53894. globals.TestContext);
  53895. smalltalk.addMethod(
  53896. smalltalk.method({
  53897. selector: "testCase:",
  53898. protocol: 'accessing',
  53899. fn: function (aTestCase){
  53900. var self=this;
  53901. self["@testCase"]=aTestCase;
  53902. return self;
  53903. },
  53904. //>>excludeStart("ide", pragmas.excludeIdeData);
  53905. args: ["aTestCase"],
  53906. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  53907. referencedClasses: [],
  53908. //>>excludeEnd("ide");
  53909. messageSends: []
  53910. }),
  53911. globals.TestContext);
  53912. smalltalk.addMethod(
  53913. smalltalk.method({
  53914. selector: "testCase:",
  53915. protocol: 'instance creation',
  53916. fn: function (aTestCase){
  53917. var self=this;
  53918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53919. return smalltalk.withContext(function($ctx1) {
  53920. //>>excludeEnd("ctx");
  53921. var $2,$3,$1;
  53922. $2=self._new();
  53923. _st($2)._testCase_(aTestCase);
  53924. $3=_st($2)._yourself();
  53925. $1=$3;
  53926. return $1;
  53927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53928. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},globals.TestContext.klass)});
  53929. //>>excludeEnd("ctx");
  53930. },
  53931. //>>excludeStart("ide", pragmas.excludeIdeData);
  53932. args: ["aTestCase"],
  53933. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  53934. referencedClasses: [],
  53935. //>>excludeEnd("ide");
  53936. messageSends: ["testCase:", "new", "yourself"]
  53937. }),
  53938. globals.TestContext.klass);
  53939. smalltalk.addClass('ReportingTestContext', globals.TestContext, ['finished', 'result'], 'SUnit');
  53940. //>>excludeStart("ide", pragmas.excludeIdeData);
  53941. globals.ReportingTestContext.comment="I add `TestResult` reporting to `TestContext`.\x0a\x0aErrors are caught and save into a `TestResult`,\x0aWhen test case is finished (which can be later for async tests), a callback block is executed; this is used by a `TestSuiteRunner`.";
  53942. //>>excludeEnd("ide");
  53943. smalltalk.addMethod(
  53944. smalltalk.method({
  53945. selector: "execute:",
  53946. protocol: 'running',
  53947. fn: function (aBlock){
  53948. var self=this;
  53949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53950. return smalltalk.withContext(function($ctx1) {
  53951. //>>excludeEnd("ctx");
  53952. var $1;
  53953. _st((function(){
  53954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53955. return smalltalk.withContext(function($ctx2) {
  53956. //>>excludeEnd("ctx");
  53957. return self._withErrorReporting_((function(){
  53958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53959. return smalltalk.withContext(function($ctx3) {
  53960. //>>excludeEnd("ctx");
  53961. return (
  53962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53963. $ctx3.supercall = true,
  53964. //>>excludeEnd("ctx");
  53965. globals.ReportingTestContext.superclass.fn.prototype._execute_.apply(_st(self), [aBlock]));
  53966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53967. $ctx3.supercall = false;
  53968. //>>excludeEnd("ctx");;
  53969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53970. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53971. //>>excludeEnd("ctx");
  53972. }));
  53973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53975. //>>excludeEnd("ctx");
  53976. }))._ensure_((function(){
  53977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53978. return smalltalk.withContext(function($ctx2) {
  53979. //>>excludeEnd("ctx");
  53980. $1=_st(self["@testCase"])._isAsync();
  53981. if(! smalltalk.assert($1)){
  53982. _st(self["@result"])._increaseRuns();
  53983. return _st(self["@finished"])._value();
  53984. };
  53985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53987. //>>excludeEnd("ctx");
  53988. }));
  53989. return self;
  53990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53991. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},globals.ReportingTestContext)});
  53992. //>>excludeEnd("ctx");
  53993. },
  53994. //>>excludeStart("ide", pragmas.excludeIdeData);
  53995. args: ["aBlock"],
  53996. source: "execute: aBlock\x0a\x09[\x0a\x09\x09self withErrorReporting: [ super execute: aBlock ]\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09result increaseRuns. finished value ] ]",
  53997. referencedClasses: [],
  53998. //>>excludeEnd("ide");
  53999. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  54000. }),
  54001. globals.ReportingTestContext);
  54002. smalltalk.addMethod(
  54003. smalltalk.method({
  54004. selector: "finished:",
  54005. protocol: 'accessing',
  54006. fn: function (aBlock){
  54007. var self=this;
  54008. self["@finished"]=aBlock;
  54009. return self;
  54010. },
  54011. //>>excludeStart("ide", pragmas.excludeIdeData);
  54012. args: ["aBlock"],
  54013. source: "finished: aBlock\x0a\x09finished := aBlock",
  54014. referencedClasses: [],
  54015. //>>excludeEnd("ide");
  54016. messageSends: []
  54017. }),
  54018. globals.ReportingTestContext);
  54019. smalltalk.addMethod(
  54020. smalltalk.method({
  54021. selector: "result:",
  54022. protocol: 'accessing',
  54023. fn: function (aTestResult){
  54024. var self=this;
  54025. self["@result"]=aTestResult;
  54026. return self;
  54027. },
  54028. //>>excludeStart("ide", pragmas.excludeIdeData);
  54029. args: ["aTestResult"],
  54030. source: "result: aTestResult\x0a\x09result := aTestResult",
  54031. referencedClasses: [],
  54032. //>>excludeEnd("ide");
  54033. messageSends: []
  54034. }),
  54035. globals.ReportingTestContext);
  54036. smalltalk.addMethod(
  54037. smalltalk.method({
  54038. selector: "withErrorReporting:",
  54039. protocol: 'private',
  54040. fn: function (aBlock){
  54041. var self=this;
  54042. function $TestFailure(){return globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  54043. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  54044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54045. return smalltalk.withContext(function($ctx1) {
  54046. //>>excludeEnd("ctx");
  54047. _st((function(){
  54048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54049. return smalltalk.withContext(function($ctx2) {
  54050. //>>excludeEnd("ctx");
  54051. return _st(aBlock)._on_do_($TestFailure(),(function(ex){
  54052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54053. return smalltalk.withContext(function($ctx3) {
  54054. //>>excludeEnd("ctx");
  54055. return _st(self["@result"])._addFailure_(self["@testCase"]);
  54056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54057. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  54058. //>>excludeEnd("ctx");
  54059. }));
  54060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54062. //>>excludeEnd("ctx");
  54063. }))._on_do_($Error(),(function(ex){
  54064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54065. return smalltalk.withContext(function($ctx2) {
  54066. //>>excludeEnd("ctx");
  54067. return _st(self["@result"])._addError_(self["@testCase"]);
  54068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54069. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  54070. //>>excludeEnd("ctx");
  54071. }));
  54072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54073. $ctx1.sendIdx["on:do:"]=1;
  54074. //>>excludeEnd("ctx");
  54075. return self;
  54076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54077. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},globals.ReportingTestContext)});
  54078. //>>excludeEnd("ctx");
  54079. },
  54080. //>>excludeStart("ide", pragmas.excludeIdeData);
  54081. args: ["aBlock"],
  54082. source: "withErrorReporting: aBlock\x0a\x09[ aBlock\x0a\x09\x09on: TestFailure\x0a\x09\x09do: [ :ex | result addFailure: testCase ]\x0a\x09]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | result addError: testCase ]",
  54083. referencedClasses: ["TestFailure", "Error"],
  54084. //>>excludeEnd("ide");
  54085. messageSends: ["on:do:", "addFailure:", "addError:"]
  54086. }),
  54087. globals.ReportingTestContext);
  54088. smalltalk.addMethod(
  54089. smalltalk.method({
  54090. selector: "testCase:result:finished:",
  54091. protocol: 'instance creation',
  54092. fn: function (aTestCase,aTestResult,aBlock){
  54093. var self=this;
  54094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54095. return smalltalk.withContext(function($ctx1) {
  54096. //>>excludeEnd("ctx");
  54097. var $2,$3,$1;
  54098. $2=(
  54099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54100. $ctx1.supercall = true,
  54101. //>>excludeEnd("ctx");
  54102. globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply(_st(self), [aTestCase]));
  54103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54104. $ctx1.supercall = false;
  54105. //>>excludeEnd("ctx");;
  54106. _st($2)._result_(aTestResult);
  54107. _st($2)._finished_(aBlock);
  54108. $3=_st($2)._yourself();
  54109. $1=$3;
  54110. return $1;
  54111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54112. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},globals.ReportingTestContext.klass)});
  54113. //>>excludeEnd("ctx");
  54114. },
  54115. //>>excludeStart("ide", pragmas.excludeIdeData);
  54116. args: ["aTestCase", "aTestResult", "aBlock"],
  54117. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  54118. referencedClasses: [],
  54119. //>>excludeEnd("ide");
  54120. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  54121. }),
  54122. globals.ReportingTestContext.klass);
  54123. smalltalk.addClass('TestFailure', globals.Error, [], 'SUnit');
  54124. //>>excludeStart("ide", pragmas.excludeIdeData);
  54125. globals.TestFailure.comment="I am raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.\x0a\x0aThe test framework distinguishes between failures and errors.\x0aA failure is an event whose possibiity is explicitly anticipated and checked for in an assertion,\x0awhereas an error is an unanticipated problem like a division by 0 or an index out of bounds.";
  54126. //>>excludeEnd("ide");
  54127. smalltalk.addClass('TestResult', globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  54128. //>>excludeStart("ide", pragmas.excludeIdeData);
  54129. globals.TestResult.comment="I implement the collecting parameter pattern for running a bunch of tests.\x0a\x0aMy instances hold tests that have run, sorted into the result categories of passed, failures and errors.\x0a\x0a`TestResult` is an interesting object to subclass or substitute. `#runCase:` is the external protocol you need to reproduce";
  54130. //>>excludeEnd("ide");
  54131. smalltalk.addMethod(
  54132. smalltalk.method({
  54133. selector: "addError:",
  54134. protocol: 'accessing',
  54135. fn: function (anError){
  54136. var self=this;
  54137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54138. return smalltalk.withContext(function($ctx1) {
  54139. //>>excludeEnd("ctx");
  54140. _st(self._errors())._add_(anError);
  54141. return self;
  54142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54143. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},globals.TestResult)});
  54144. //>>excludeEnd("ctx");
  54145. },
  54146. //>>excludeStart("ide", pragmas.excludeIdeData);
  54147. args: ["anError"],
  54148. source: "addError: anError\x0a\x09self errors add: anError",
  54149. referencedClasses: [],
  54150. //>>excludeEnd("ide");
  54151. messageSends: ["add:", "errors"]
  54152. }),
  54153. globals.TestResult);
  54154. smalltalk.addMethod(
  54155. smalltalk.method({
  54156. selector: "addFailure:",
  54157. protocol: 'accessing',
  54158. fn: function (aFailure){
  54159. var self=this;
  54160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54161. return smalltalk.withContext(function($ctx1) {
  54162. //>>excludeEnd("ctx");
  54163. _st(self._failures())._add_(aFailure);
  54164. return self;
  54165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54166. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},globals.TestResult)});
  54167. //>>excludeEnd("ctx");
  54168. },
  54169. //>>excludeStart("ide", pragmas.excludeIdeData);
  54170. args: ["aFailure"],
  54171. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  54172. referencedClasses: [],
  54173. //>>excludeEnd("ide");
  54174. messageSends: ["add:", "failures"]
  54175. }),
  54176. globals.TestResult);
  54177. smalltalk.addMethod(
  54178. smalltalk.method({
  54179. selector: "errors",
  54180. protocol: 'accessing',
  54181. fn: function (){
  54182. var self=this;
  54183. var $1;
  54184. $1=self["@errors"];
  54185. return $1;
  54186. },
  54187. //>>excludeStart("ide", pragmas.excludeIdeData);
  54188. args: [],
  54189. source: "errors\x0a\x09^ errors",
  54190. referencedClasses: [],
  54191. //>>excludeEnd("ide");
  54192. messageSends: []
  54193. }),
  54194. globals.TestResult);
  54195. smalltalk.addMethod(
  54196. smalltalk.method({
  54197. selector: "failures",
  54198. protocol: 'accessing',
  54199. fn: function (){
  54200. var self=this;
  54201. var $1;
  54202. $1=self["@failures"];
  54203. return $1;
  54204. },
  54205. //>>excludeStart("ide", pragmas.excludeIdeData);
  54206. args: [],
  54207. source: "failures\x0a\x09^ failures",
  54208. referencedClasses: [],
  54209. //>>excludeEnd("ide");
  54210. messageSends: []
  54211. }),
  54212. globals.TestResult);
  54213. smalltalk.addMethod(
  54214. smalltalk.method({
  54215. selector: "increaseRuns",
  54216. protocol: 'accessing',
  54217. fn: function (){
  54218. var self=this;
  54219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54220. return smalltalk.withContext(function($ctx1) {
  54221. //>>excludeEnd("ctx");
  54222. self["@runs"]=_st(self["@runs"]).__plus((1));
  54223. return self;
  54224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54225. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},globals.TestResult)});
  54226. //>>excludeEnd("ctx");
  54227. },
  54228. //>>excludeStart("ide", pragmas.excludeIdeData);
  54229. args: [],
  54230. source: "increaseRuns\x0a\x09runs := runs + 1",
  54231. referencedClasses: [],
  54232. //>>excludeEnd("ide");
  54233. messageSends: ["+"]
  54234. }),
  54235. globals.TestResult);
  54236. smalltalk.addMethod(
  54237. smalltalk.method({
  54238. selector: "initialize",
  54239. protocol: 'initialization',
  54240. fn: function (){
  54241. var self=this;
  54242. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  54243. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  54244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54245. return smalltalk.withContext(function($ctx1) {
  54246. //>>excludeEnd("ctx");
  54247. (
  54248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54249. $ctx1.supercall = true,
  54250. //>>excludeEnd("ctx");
  54251. globals.TestResult.superclass.fn.prototype._initialize.apply(_st(self), []));
  54252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54253. $ctx1.supercall = false;
  54254. //>>excludeEnd("ctx");;
  54255. self["@timestamp"]=_st($Date())._now();
  54256. self["@runs"]=(0);
  54257. self["@errors"]=_st($Array())._new();
  54258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54259. $ctx1.sendIdx["new"]=1;
  54260. //>>excludeEnd("ctx");
  54261. self["@failures"]=_st($Array())._new();
  54262. self["@total"]=(0);
  54263. return self;
  54264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54265. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.TestResult)});
  54266. //>>excludeEnd("ctx");
  54267. },
  54268. //>>excludeStart("ide", pragmas.excludeIdeData);
  54269. args: [],
  54270. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  54271. referencedClasses: ["Date", "Array"],
  54272. //>>excludeEnd("ide");
  54273. messageSends: ["initialize", "now", "new"]
  54274. }),
  54275. globals.TestResult);
  54276. smalltalk.addMethod(
  54277. smalltalk.method({
  54278. selector: "nextRunDo:",
  54279. protocol: 'running',
  54280. fn: function (aBlock){
  54281. var self=this;
  54282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54283. return smalltalk.withContext(function($ctx1) {
  54284. //>>excludeEnd("ctx");
  54285. var $3,$2,$1;
  54286. $3=self._runs();
  54287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54288. $ctx1.sendIdx["runs"]=1;
  54289. //>>excludeEnd("ctx");
  54290. $2=_st($3).__eq_eq(self._total());
  54291. if(! smalltalk.assert($2)){
  54292. $1=_st(aBlock)._value_(_st(self._runs()).__plus((1)));
  54293. };
  54294. return $1;
  54295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54296. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},globals.TestResult)});
  54297. //>>excludeEnd("ctx");
  54298. },
  54299. //>>excludeStart("ide", pragmas.excludeIdeData);
  54300. args: ["aBlock"],
  54301. source: "nextRunDo: aBlock\x0a\x09\x22Runs aBlock with index of next run or does nothing if no more runs\x22\x0a\x09^ self runs == self total\x0a\x09\x09ifFalse: [ aBlock value: self runs + 1 ]",
  54302. referencedClasses: [],
  54303. //>>excludeEnd("ide");
  54304. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  54305. }),
  54306. globals.TestResult);
  54307. smalltalk.addMethod(
  54308. smalltalk.method({
  54309. selector: "runCase:",
  54310. protocol: 'running',
  54311. fn: function (aTestCase){
  54312. var self=this;
  54313. function $TestFailure(){return globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  54314. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  54315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54316. return smalltalk.withContext(function($ctx1) {
  54317. //>>excludeEnd("ctx");
  54318. _st((function(){
  54319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54320. return smalltalk.withContext(function($ctx2) {
  54321. //>>excludeEnd("ctx");
  54322. return _st((function(){
  54323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54324. return smalltalk.withContext(function($ctx3) {
  54325. //>>excludeEnd("ctx");
  54326. self._increaseRuns();
  54327. return _st(aTestCase)._runCase();
  54328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54329. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54330. //>>excludeEnd("ctx");
  54331. }))._on_do_($TestFailure(),(function(ex){
  54332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54333. return smalltalk.withContext(function($ctx3) {
  54334. //>>excludeEnd("ctx");
  54335. return self._addFailure_(aTestCase);
  54336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54337. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  54338. //>>excludeEnd("ctx");
  54339. }));
  54340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54342. //>>excludeEnd("ctx");
  54343. }))._on_do_($Error(),(function(ex){
  54344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54345. return smalltalk.withContext(function($ctx2) {
  54346. //>>excludeEnd("ctx");
  54347. return self._addError_(aTestCase);
  54348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54349. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  54350. //>>excludeEnd("ctx");
  54351. }));
  54352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54353. $ctx1.sendIdx["on:do:"]=1;
  54354. //>>excludeEnd("ctx");
  54355. return self;
  54356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54357. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},globals.TestResult)});
  54358. //>>excludeEnd("ctx");
  54359. },
  54360. //>>excludeStart("ide", pragmas.excludeIdeData);
  54361. args: ["aTestCase"],
  54362. source: "runCase: aTestCase\x0a\x09[ [ self increaseRuns.\x0a\x09\x09aTestCase runCase ]\x0a\x09on: TestFailure do: [ :ex | self addFailure: aTestCase ]]\x0a\x09on: Error do: [ :ex | self addError: aTestCase ]",
  54363. referencedClasses: ["TestFailure", "Error"],
  54364. //>>excludeEnd("ide");
  54365. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  54366. }),
  54367. globals.TestResult);
  54368. smalltalk.addMethod(
  54369. smalltalk.method({
  54370. selector: "runs",
  54371. protocol: 'accessing',
  54372. fn: function (){
  54373. var self=this;
  54374. var $1;
  54375. $1=self["@runs"];
  54376. return $1;
  54377. },
  54378. //>>excludeStart("ide", pragmas.excludeIdeData);
  54379. args: [],
  54380. source: "runs\x0a\x09^ runs",
  54381. referencedClasses: [],
  54382. //>>excludeEnd("ide");
  54383. messageSends: []
  54384. }),
  54385. globals.TestResult);
  54386. smalltalk.addMethod(
  54387. smalltalk.method({
  54388. selector: "status",
  54389. protocol: 'accessing',
  54390. fn: function (){
  54391. var self=this;
  54392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54393. return smalltalk.withContext(function($ctx1) {
  54394. //>>excludeEnd("ctx");
  54395. var $2,$3,$1;
  54396. $2=_st(self._errors())._isEmpty();
  54397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54398. $ctx1.sendIdx["isEmpty"]=1;
  54399. //>>excludeEnd("ctx");
  54400. if(smalltalk.assert($2)){
  54401. $3=_st(self._failures())._isEmpty();
  54402. if(smalltalk.assert($3)){
  54403. $1="success";
  54404. } else {
  54405. $1="failure";
  54406. };
  54407. } else {
  54408. $1="error";
  54409. };
  54410. return $1;
  54411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54412. }, function($ctx1) {$ctx1.fill(self,"status",{},globals.TestResult)});
  54413. //>>excludeEnd("ctx");
  54414. },
  54415. //>>excludeStart("ide", pragmas.excludeIdeData);
  54416. args: [],
  54417. source: "status\x0a\x09^ self errors isEmpty\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self failures isEmpty\x0a\x09\x09\x09\x09ifTrue: [ 'success' ]\x0a\x09\x09\x09\x09ifFalse: [ 'failure' ]]\x0a\x09\x09ifFalse: [ 'error' ]",
  54418. referencedClasses: [],
  54419. //>>excludeEnd("ide");
  54420. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  54421. }),
  54422. globals.TestResult);
  54423. smalltalk.addMethod(
  54424. smalltalk.method({
  54425. selector: "timestamp",
  54426. protocol: 'accessing',
  54427. fn: function (){
  54428. var self=this;
  54429. var $1;
  54430. $1=self["@timestamp"];
  54431. return $1;
  54432. },
  54433. //>>excludeStart("ide", pragmas.excludeIdeData);
  54434. args: [],
  54435. source: "timestamp\x0a\x09^ timestamp",
  54436. referencedClasses: [],
  54437. //>>excludeEnd("ide");
  54438. messageSends: []
  54439. }),
  54440. globals.TestResult);
  54441. smalltalk.addMethod(
  54442. smalltalk.method({
  54443. selector: "total",
  54444. protocol: 'accessing',
  54445. fn: function (){
  54446. var self=this;
  54447. var $1;
  54448. $1=self["@total"];
  54449. return $1;
  54450. },
  54451. //>>excludeStart("ide", pragmas.excludeIdeData);
  54452. args: [],
  54453. source: "total\x0a\x09^ total",
  54454. referencedClasses: [],
  54455. //>>excludeEnd("ide");
  54456. messageSends: []
  54457. }),
  54458. globals.TestResult);
  54459. smalltalk.addMethod(
  54460. smalltalk.method({
  54461. selector: "total:",
  54462. protocol: 'accessing',
  54463. fn: function (aNumber){
  54464. var self=this;
  54465. self["@total"]=aNumber;
  54466. return self;
  54467. },
  54468. //>>excludeStart("ide", pragmas.excludeIdeData);
  54469. args: ["aNumber"],
  54470. source: "total: aNumber\x0a\x09total := aNumber",
  54471. referencedClasses: [],
  54472. //>>excludeEnd("ide");
  54473. messageSends: []
  54474. }),
  54475. globals.TestResult);
  54476. smalltalk.addClass('TestSuiteRunner', globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  54477. //>>excludeStart("ide", pragmas.excludeIdeData);
  54478. globals.TestSuiteRunner.comment="I am responsible for running a collection (`suite`) of tests.\x0a\x0a## API\x0a\x0aInstances should be created using the class-side `#on:` method, taking a collection of tests to run as parameter.\x0aTo run the test suite, use `#run`.";
  54479. //>>excludeEnd("ide");
  54480. smalltalk.addMethod(
  54481. smalltalk.method({
  54482. selector: "announcer",
  54483. protocol: 'accessing',
  54484. fn: function (){
  54485. var self=this;
  54486. var $1;
  54487. $1=self["@announcer"];
  54488. return $1;
  54489. },
  54490. //>>excludeStart("ide", pragmas.excludeIdeData);
  54491. args: [],
  54492. source: "announcer\x0a\x09^ announcer",
  54493. referencedClasses: [],
  54494. //>>excludeEnd("ide");
  54495. messageSends: []
  54496. }),
  54497. globals.TestSuiteRunner);
  54498. smalltalk.addMethod(
  54499. smalltalk.method({
  54500. selector: "contextOf:",
  54501. protocol: 'private',
  54502. fn: function (anInteger){
  54503. var self=this;
  54504. function $ReportingTestContext(){return globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
  54505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54506. return smalltalk.withContext(function($ctx1) {
  54507. //>>excludeEnd("ctx");
  54508. var $1;
  54509. $1=_st($ReportingTestContext())._testCase_result_finished_(_st(self["@suite"])._at_(anInteger),self["@result"],(function(){
  54510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54511. return smalltalk.withContext(function($ctx2) {
  54512. //>>excludeEnd("ctx");
  54513. return self._resume();
  54514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54516. //>>excludeEnd("ctx");
  54517. }));
  54518. return $1;
  54519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54520. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},globals.TestSuiteRunner)});
  54521. //>>excludeEnd("ctx");
  54522. },
  54523. //>>excludeStart("ide", pragmas.excludeIdeData);
  54524. args: ["anInteger"],
  54525. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  54526. referencedClasses: ["ReportingTestContext"],
  54527. //>>excludeEnd("ide");
  54528. messageSends: ["testCase:result:finished:", "at:", "resume"]
  54529. }),
  54530. globals.TestSuiteRunner);
  54531. smalltalk.addMethod(
  54532. smalltalk.method({
  54533. selector: "initialize",
  54534. protocol: 'initialization',
  54535. fn: function (){
  54536. var self=this;
  54537. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  54538. function $TestResult(){return globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  54539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54540. return smalltalk.withContext(function($ctx1) {
  54541. //>>excludeEnd("ctx");
  54542. var $1;
  54543. (
  54544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54545. $ctx1.supercall = true,
  54546. //>>excludeEnd("ctx");
  54547. globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply(_st(self), []));
  54548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54549. $ctx1.supercall = false;
  54550. //>>excludeEnd("ctx");;
  54551. self["@announcer"]=_st($Announcer())._new();
  54552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54553. $ctx1.sendIdx["new"]=1;
  54554. //>>excludeEnd("ctx");
  54555. self["@result"]=_st($TestResult())._new();
  54556. self["@runNextTest"]=(function(){
  54557. var runs;
  54558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54559. return smalltalk.withContext(function($ctx2) {
  54560. //>>excludeEnd("ctx");
  54561. runs=_st(self["@result"])._runs();
  54562. runs;
  54563. $1=_st(runs).__lt(_st(self["@result"])._total());
  54564. if(smalltalk.assert($1)){
  54565. return _st(self._contextOf_(_st(runs).__plus((1))))._start();
  54566. };
  54567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54568. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  54569. //>>excludeEnd("ctx");
  54570. });
  54571. return self;
  54572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54573. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.TestSuiteRunner)});
  54574. //>>excludeEnd("ctx");
  54575. },
  54576. //>>excludeStart("ide", pragmas.excludeIdeData);
  54577. args: [],
  54578. source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new.\x0a\x09result := TestResult new.\x0a\x09runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ] ].",
  54579. referencedClasses: ["Announcer", "TestResult"],
  54580. //>>excludeEnd("ide");
  54581. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  54582. }),
  54583. globals.TestSuiteRunner);
  54584. smalltalk.addMethod(
  54585. smalltalk.method({
  54586. selector: "result",
  54587. protocol: 'accessing',
  54588. fn: function (){
  54589. var self=this;
  54590. var $1;
  54591. $1=self["@result"];
  54592. return $1;
  54593. },
  54594. //>>excludeStart("ide", pragmas.excludeIdeData);
  54595. args: [],
  54596. source: "result\x0a\x09^ result",
  54597. referencedClasses: [],
  54598. //>>excludeEnd("ide");
  54599. messageSends: []
  54600. }),
  54601. globals.TestSuiteRunner);
  54602. smalltalk.addMethod(
  54603. smalltalk.method({
  54604. selector: "resume",
  54605. protocol: 'actions',
  54606. fn: function (){
  54607. var self=this;
  54608. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  54609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54610. return smalltalk.withContext(function($ctx1) {
  54611. //>>excludeEnd("ctx");
  54612. _st(self["@runNextTest"])._fork();
  54613. _st(self["@announcer"])._announce_(_st(_st($ResultAnnouncement())._new())._result_(self["@result"]));
  54614. return self;
  54615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54616. }, function($ctx1) {$ctx1.fill(self,"resume",{},globals.TestSuiteRunner)});
  54617. //>>excludeEnd("ctx");
  54618. },
  54619. //>>excludeStart("ide", pragmas.excludeIdeData);
  54620. args: [],
  54621. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  54622. referencedClasses: ["ResultAnnouncement"],
  54623. //>>excludeEnd("ide");
  54624. messageSends: ["fork", "announce:", "result:", "new"]
  54625. }),
  54626. globals.TestSuiteRunner);
  54627. smalltalk.addMethod(
  54628. smalltalk.method({
  54629. selector: "run",
  54630. protocol: 'actions',
  54631. fn: function (){
  54632. var self=this;
  54633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54634. return smalltalk.withContext(function($ctx1) {
  54635. //>>excludeEnd("ctx");
  54636. _st(self["@result"])._total_(_st(self["@suite"])._size());
  54637. self._resume();
  54638. return self;
  54639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54640. }, function($ctx1) {$ctx1.fill(self,"run",{},globals.TestSuiteRunner)});
  54641. //>>excludeEnd("ctx");
  54642. },
  54643. //>>excludeStart("ide", pragmas.excludeIdeData);
  54644. args: [],
  54645. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  54646. referencedClasses: [],
  54647. //>>excludeEnd("ide");
  54648. messageSends: ["total:", "size", "resume"]
  54649. }),
  54650. globals.TestSuiteRunner);
  54651. smalltalk.addMethod(
  54652. smalltalk.method({
  54653. selector: "suite:",
  54654. protocol: 'accessing',
  54655. fn: function (aCollection){
  54656. var self=this;
  54657. self["@suite"]=aCollection;
  54658. return self;
  54659. },
  54660. //>>excludeStart("ide", pragmas.excludeIdeData);
  54661. args: ["aCollection"],
  54662. source: "suite: aCollection\x0a\x09suite := aCollection",
  54663. referencedClasses: [],
  54664. //>>excludeEnd("ide");
  54665. messageSends: []
  54666. }),
  54667. globals.TestSuiteRunner);
  54668. smalltalk.addMethod(
  54669. smalltalk.method({
  54670. selector: "new",
  54671. protocol: 'instance creation',
  54672. fn: function (){
  54673. var self=this;
  54674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54675. return smalltalk.withContext(function($ctx1) {
  54676. //>>excludeEnd("ctx");
  54677. self._shouldNotImplement();
  54678. return self;
  54679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54680. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.TestSuiteRunner.klass)});
  54681. //>>excludeEnd("ctx");
  54682. },
  54683. //>>excludeStart("ide", pragmas.excludeIdeData);
  54684. args: [],
  54685. source: "new\x0a\x09self shouldNotImplement",
  54686. referencedClasses: [],
  54687. //>>excludeEnd("ide");
  54688. messageSends: ["shouldNotImplement"]
  54689. }),
  54690. globals.TestSuiteRunner.klass);
  54691. smalltalk.addMethod(
  54692. smalltalk.method({
  54693. selector: "on:",
  54694. protocol: 'instance creation',
  54695. fn: function (aCollection){
  54696. var self=this;
  54697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54698. return smalltalk.withContext(function($ctx1) {
  54699. //>>excludeEnd("ctx");
  54700. var $2,$1;
  54701. $2=(
  54702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54703. $ctx1.supercall = true,
  54704. //>>excludeEnd("ctx");
  54705. globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply(_st(self), []));
  54706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54707. $ctx1.supercall = false;
  54708. //>>excludeEnd("ctx");;
  54709. $1=_st($2)._suite_(aCollection);
  54710. return $1;
  54711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54712. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.TestSuiteRunner.klass)});
  54713. //>>excludeEnd("ctx");
  54714. },
  54715. //>>excludeStart("ide", pragmas.excludeIdeData);
  54716. args: ["aCollection"],
  54717. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  54718. referencedClasses: [],
  54719. //>>excludeEnd("ide");
  54720. messageSends: ["suite:", "new"]
  54721. }),
  54722. globals.TestSuiteRunner.klass);
  54723. smalltalk.addMethod(
  54724. smalltalk.method({
  54725. selector: "isTestClass",
  54726. protocol: '*SUnit',
  54727. fn: function (){
  54728. var self=this;
  54729. function $TestCase(){return globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  54730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54731. return smalltalk.withContext(function($ctx1) {
  54732. //>>excludeEnd("ctx");
  54733. var $1;
  54734. $1=_st(self._includesBehavior_($TestCase()))._and_((function(){
  54735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54736. return smalltalk.withContext(function($ctx2) {
  54737. //>>excludeEnd("ctx");
  54738. return _st(self._isAbstract())._not();
  54739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54741. //>>excludeEnd("ctx");
  54742. }));
  54743. return $1;
  54744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54745. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},globals.Behavior)});
  54746. //>>excludeEnd("ctx");
  54747. },
  54748. //>>excludeStart("ide", pragmas.excludeIdeData);
  54749. args: [],
  54750. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  54751. referencedClasses: ["TestCase"],
  54752. //>>excludeEnd("ide");
  54753. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  54754. }),
  54755. globals.Behavior);
  54756. smalltalk.addMethod(
  54757. smalltalk.method({
  54758. selector: "isTestPackage",
  54759. protocol: '*SUnit',
  54760. fn: function (){
  54761. var self=this;
  54762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54763. return smalltalk.withContext(function($ctx1) {
  54764. //>>excludeEnd("ctx");
  54765. var $1;
  54766. $1=_st(self._classes())._anySatisfy_((function(each){
  54767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54768. return smalltalk.withContext(function($ctx2) {
  54769. //>>excludeEnd("ctx");
  54770. return _st(each)._isTestClass();
  54771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54773. //>>excludeEnd("ctx");
  54774. }));
  54775. return $1;
  54776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54777. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},globals.Package)});
  54778. //>>excludeEnd("ctx");
  54779. },
  54780. //>>excludeStart("ide", pragmas.excludeIdeData);
  54781. args: [],
  54782. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  54783. referencedClasses: [],
  54784. //>>excludeEnd("ide");
  54785. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  54786. }),
  54787. globals.Package);
  54788. });
  54789. define("amber_core/Kernel-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function($boot){
  54790. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  54791. smalltalk.addPackage('Kernel-ImportExport');
  54792. smalltalk.packages["Kernel-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  54793. smalltalk.addClass('AbstractExporter', globals.Object, [], 'Kernel-ImportExport');
  54794. //>>excludeStart("ide", pragmas.excludeIdeData);
  54795. globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream.";
  54796. //>>excludeEnd("ide");
  54797. smalltalk.addMethod(
  54798. smalltalk.method({
  54799. selector: "chunkEscape:",
  54800. protocol: 'convenience',
  54801. fn: function (aString){
  54802. var self=this;
  54803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54804. return smalltalk.withContext(function($ctx1) {
  54805. //>>excludeEnd("ctx");
  54806. var $1;
  54807. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  54808. return $1;
  54809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54810. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},globals.AbstractExporter)});
  54811. //>>excludeEnd("ctx");
  54812. },
  54813. //>>excludeStart("ide", pragmas.excludeIdeData);
  54814. args: ["aString"],
  54815. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  54816. referencedClasses: [],
  54817. //>>excludeEnd("ide");
  54818. messageSends: ["trimBoth", "replace:with:"]
  54819. }),
  54820. globals.AbstractExporter);
  54821. smalltalk.addMethod(
  54822. smalltalk.method({
  54823. selector: "classNameFor:",
  54824. protocol: 'convenience',
  54825. fn: function (aClass){
  54826. var self=this;
  54827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54828. return smalltalk.withContext(function($ctx1) {
  54829. //>>excludeEnd("ctx");
  54830. var $2,$3,$4,$1;
  54831. $2=_st(aClass)._isMetaclass();
  54832. if(smalltalk.assert($2)){
  54833. $3=_st(_st(aClass)._instanceClass())._name();
  54834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54835. $ctx1.sendIdx["name"]=1;
  54836. //>>excludeEnd("ctx");
  54837. $1=_st($3).__comma(" class");
  54838. } else {
  54839. $4=_st(aClass)._isNil();
  54840. if(smalltalk.assert($4)){
  54841. $1="nil";
  54842. } else {
  54843. $1=_st(aClass)._name();
  54844. };
  54845. };
  54846. return $1;
  54847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54848. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractExporter)});
  54849. //>>excludeEnd("ctx");
  54850. },
  54851. //>>excludeStart("ide", pragmas.excludeIdeData);
  54852. args: ["aClass"],
  54853. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
  54854. referencedClasses: [],
  54855. //>>excludeEnd("ide");
  54856. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  54857. }),
  54858. globals.AbstractExporter);
  54859. smalltalk.addMethod(
  54860. smalltalk.method({
  54861. selector: "exportPackage:on:",
  54862. protocol: 'output',
  54863. fn: function (aPackage,aStream){
  54864. var self=this;
  54865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54866. return smalltalk.withContext(function($ctx1) {
  54867. //>>excludeEnd("ctx");
  54868. self._subclassResponsibility();
  54869. return self;
  54870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54871. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.AbstractExporter)});
  54872. //>>excludeEnd("ctx");
  54873. },
  54874. //>>excludeStart("ide", pragmas.excludeIdeData);
  54875. args: ["aPackage", "aStream"],
  54876. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  54877. referencedClasses: [],
  54878. //>>excludeEnd("ide");
  54879. messageSends: ["subclassResponsibility"]
  54880. }),
  54881. globals.AbstractExporter);
  54882. smalltalk.addMethod(
  54883. smalltalk.method({
  54884. selector: "extensionMethodsOfPackage:",
  54885. protocol: 'accessing',
  54886. fn: function (aPackage){
  54887. var self=this;
  54888. var result;
  54889. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  54890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54891. return smalltalk.withContext(function($ctx1) {
  54892. //>>excludeEnd("ctx");
  54893. var $1;
  54894. result=_st($OrderedCollection())._new();
  54895. _st(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  54896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54897. return smalltalk.withContext(function($ctx2) {
  54898. //>>excludeEnd("ctx");
  54899. return _st(result)._addAll_(_st(each)._methods());
  54900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54902. //>>excludeEnd("ctx");
  54903. }));
  54904. $1=result;
  54905. return $1;
  54906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54907. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},globals.AbstractExporter)});
  54908. //>>excludeEnd("ctx");
  54909. },
  54910. //>>excludeStart("ide", pragmas.excludeIdeData);
  54911. args: ["aPackage"],
  54912. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result",
  54913. referencedClasses: ["OrderedCollection"],
  54914. //>>excludeEnd("ide");
  54915. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  54916. }),
  54917. globals.AbstractExporter);
  54918. smalltalk.addMethod(
  54919. smalltalk.method({
  54920. selector: "extensionProtocolsOfPackage:",
  54921. protocol: 'accessing',
  54922. fn: function (aPackage){
  54923. var self=this;
  54924. var extensionName,result;
  54925. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  54926. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  54927. function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  54928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54929. return smalltalk.withContext(function($ctx1) {
  54930. //>>excludeEnd("ctx");
  54931. var $1,$2,$3,$4;
  54932. $1=_st(aPackage)._name();
  54933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54934. $ctx1.sendIdx["name"]=1;
  54935. //>>excludeEnd("ctx");
  54936. extensionName="*".__comma($1);
  54937. result=_st($OrderedCollection())._new();
  54938. _st(_st(_st(_st($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  54939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54940. return smalltalk.withContext(function($ctx2) {
  54941. //>>excludeEnd("ctx");
  54942. $2=_st(a)._name();
  54943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54944. $ctx2.sendIdx["name"]=2;
  54945. //>>excludeEnd("ctx");
  54946. return _st($2).__lt(_st(b)._name());
  54947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54948. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  54949. //>>excludeEnd("ctx");
  54950. })))._do_((function(each){
  54951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54952. return smalltalk.withContext(function($ctx2) {
  54953. //>>excludeEnd("ctx");
  54954. return _st([each,_st(each)._class()])._do_((function(behavior){
  54955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54956. return smalltalk.withContext(function($ctx3) {
  54957. //>>excludeEnd("ctx");
  54958. $3=_st(_st(behavior)._protocols())._includes_(extensionName);
  54959. if(smalltalk.assert($3)){
  54960. return _st(result)._add_(_st($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  54961. };
  54962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54963. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  54964. //>>excludeEnd("ctx");
  54965. }));
  54966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54967. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  54968. //>>excludeEnd("ctx");
  54969. }));
  54970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54971. $ctx1.sendIdx["do:"]=1;
  54972. //>>excludeEnd("ctx");
  54973. $4=result;
  54974. return $4;
  54975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54976. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},globals.AbstractExporter)});
  54977. //>>excludeEnd("ctx");
  54978. },
  54979. //>>excludeStart("ide", pragmas.excludeIdeData);
  54980. args: ["aPackage"],
  54981. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
  54982. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  54983. //>>excludeEnd("ide");
  54984. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  54985. }),
  54986. globals.AbstractExporter);
  54987. smalltalk.addClass('ChunkExporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
  54988. //>>excludeStart("ide", pragmas.excludeIdeData);
  54989. globals.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code.";
  54990. //>>excludeEnd("ide");
  54991. smalltalk.addMethod(
  54992. smalltalk.method({
  54993. selector: "exportCategoryEpilogueOf:on:",
  54994. protocol: 'output',
  54995. fn: function (aCategory,aStream){
  54996. var self=this;
  54997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54998. return smalltalk.withContext(function($ctx1) {
  54999. //>>excludeEnd("ctx");
  55000. var $1;
  55001. _st(aStream)._nextPutAll_(" !");
  55002. _st(aStream)._lf();
  55003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55004. $ctx1.sendIdx["lf"]=1;
  55005. //>>excludeEnd("ctx");
  55006. $1=_st(aStream)._lf();
  55007. return self;
  55008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55009. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)});
  55010. //>>excludeEnd("ctx");
  55011. },
  55012. //>>excludeStart("ide", pragmas.excludeIdeData);
  55013. args: ["aCategory", "aStream"],
  55014. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  55015. referencedClasses: [],
  55016. //>>excludeEnd("ide");
  55017. messageSends: ["nextPutAll:", "lf"]
  55018. }),
  55019. globals.ChunkExporter);
  55020. smalltalk.addMethod(
  55021. smalltalk.method({
  55022. selector: "exportCategoryPrologueOf:on:",
  55023. protocol: 'output',
  55024. fn: function (aCategory,aStream){
  55025. var self=this;
  55026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55027. return smalltalk.withContext(function($ctx1) {
  55028. //>>excludeEnd("ctx");
  55029. var $1,$3,$2;
  55030. $1="!".__comma(self._classNameFor_(_st(aCategory)._theClass()));
  55031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55032. $ctx1.sendIdx[","]=1;
  55033. //>>excludeEnd("ctx");
  55034. _st(aStream)._nextPutAll_($1);
  55035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55036. $ctx1.sendIdx["nextPutAll:"]=1;
  55037. //>>excludeEnd("ctx");
  55038. $3=_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!");
  55039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55040. $ctx1.sendIdx[","]=2;
  55041. //>>excludeEnd("ctx");
  55042. $2=_st(aStream)._nextPutAll_($3);
  55043. return self;
  55044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55045. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)});
  55046. //>>excludeEnd("ctx");
  55047. },
  55048. //>>excludeStart("ide", pragmas.excludeIdeData);
  55049. args: ["aCategory", "aStream"],
  55050. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  55051. referencedClasses: [],
  55052. //>>excludeEnd("ide");
  55053. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  55054. }),
  55055. globals.ChunkExporter);
  55056. smalltalk.addMethod(
  55057. smalltalk.method({
  55058. selector: "exportDefinitionOf:on:",
  55059. protocol: 'output',
  55060. fn: function (aClass,aStream){
  55061. var self=this;
  55062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55063. return smalltalk.withContext(function($ctx1) {
  55064. //>>excludeEnd("ctx");
  55065. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  55066. $1=self._classNameFor_(_st(aClass)._superclass());
  55067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55068. $ctx1.sendIdx["classNameFor:"]=1;
  55069. //>>excludeEnd("ctx");
  55070. _st(aStream)._nextPutAll_($1);
  55071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55072. $ctx1.sendIdx["nextPutAll:"]=1;
  55073. //>>excludeEnd("ctx");
  55074. $3=self._classNameFor_(aClass);
  55075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55076. $ctx1.sendIdx["classNameFor:"]=2;
  55077. //>>excludeEnd("ctx");
  55078. $2=" subclass: #".__comma($3);
  55079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55080. $ctx1.sendIdx[","]=1;
  55081. //>>excludeEnd("ctx");
  55082. _st(aStream)._nextPutAll_($2);
  55083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55084. $ctx1.sendIdx["nextPutAll:"]=2;
  55085. //>>excludeEnd("ctx");
  55086. _st(aStream)._lf();
  55087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55088. $ctx1.sendIdx["lf"]=1;
  55089. //>>excludeEnd("ctx");
  55090. _st(aStream)._tab();
  55091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55092. $ctx1.sendIdx["tab"]=1;
  55093. //>>excludeEnd("ctx");
  55094. $4=_st(aStream)._nextPutAll_("instanceVariableNames: '");
  55095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55096. $ctx1.sendIdx["nextPutAll:"]=3;
  55097. //>>excludeEnd("ctx");
  55098. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  55099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55100. return smalltalk.withContext(function($ctx2) {
  55101. //>>excludeEnd("ctx");
  55102. return _st(aStream)._nextPutAll_(each);
  55103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55104. $ctx2.sendIdx["nextPutAll:"]=4;
  55105. //>>excludeEnd("ctx");
  55106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55107. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55108. //>>excludeEnd("ctx");
  55109. }),(function(){
  55110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55111. return smalltalk.withContext(function($ctx2) {
  55112. //>>excludeEnd("ctx");
  55113. return _st(aStream)._nextPutAll_(" ");
  55114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55115. $ctx2.sendIdx["nextPutAll:"]=5;
  55116. //>>excludeEnd("ctx");
  55117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55119. //>>excludeEnd("ctx");
  55120. }));
  55121. _st(aStream)._nextPutAll_("'");
  55122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55123. $ctx1.sendIdx["nextPutAll:"]=6;
  55124. //>>excludeEnd("ctx");
  55125. _st(aStream)._lf();
  55126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55127. $ctx1.sendIdx["lf"]=2;
  55128. //>>excludeEnd("ctx");
  55129. _st(aStream)._tab();
  55130. $6="package: '".__comma(_st(aClass)._category());
  55131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55132. $ctx1.sendIdx[","]=3;
  55133. //>>excludeEnd("ctx");
  55134. $5=_st($6).__comma("'!");
  55135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55136. $ctx1.sendIdx[","]=2;
  55137. //>>excludeEnd("ctx");
  55138. _st(aStream)._nextPutAll_($5);
  55139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55140. $ctx1.sendIdx["nextPutAll:"]=7;
  55141. //>>excludeEnd("ctx");
  55142. $7=_st(aStream)._lf();
  55143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55144. $ctx1.sendIdx["lf"]=3;
  55145. //>>excludeEnd("ctx");
  55146. $9=_st(aClass)._comment();
  55147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55148. $ctx1.sendIdx["comment"]=1;
  55149. //>>excludeEnd("ctx");
  55150. $8=_st($9)._notEmpty();
  55151. if(smalltalk.assert($8)){
  55152. $11="!".__comma(self._classNameFor_(aClass));
  55153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55154. $ctx1.sendIdx[","]=5;
  55155. //>>excludeEnd("ctx");
  55156. $10=_st($11).__comma(" commentStamp!");
  55157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55158. $ctx1.sendIdx[","]=4;
  55159. //>>excludeEnd("ctx");
  55160. _st(aStream)._nextPutAll_($10);
  55161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55162. $ctx1.sendIdx["nextPutAll:"]=8;
  55163. //>>excludeEnd("ctx");
  55164. _st(aStream)._lf();
  55165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55166. $ctx1.sendIdx["lf"]=4;
  55167. //>>excludeEnd("ctx");
  55168. _st(aStream)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  55169. $12=_st(aStream)._lf();
  55170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55171. $ctx1.sendIdx["lf"]=5;
  55172. //>>excludeEnd("ctx");
  55173. $12;
  55174. };
  55175. _st(aStream)._lf();
  55176. return self;
  55177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55178. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)});
  55179. //>>excludeEnd("ctx");
  55180. },
  55181. //>>excludeStart("ide", pragmas.excludeIdeData);
  55182. args: ["aClass", "aStream"],
  55183. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf",
  55184. referencedClasses: [],
  55185. //>>excludeEnd("ide");
  55186. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  55187. }),
  55188. globals.ChunkExporter);
  55189. smalltalk.addMethod(
  55190. smalltalk.method({
  55191. selector: "exportMetaDefinitionOf:on:",
  55192. protocol: 'output',
  55193. fn: function (aClass,aStream){
  55194. var self=this;
  55195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55196. return smalltalk.withContext(function($ctx1) {
  55197. //>>excludeEnd("ctx");
  55198. var $3,$2,$1,$5,$4,$6,$7;
  55199. $3=_st(aClass)._class();
  55200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55201. $ctx1.sendIdx["class"]=1;
  55202. //>>excludeEnd("ctx");
  55203. $2=_st($3)._instanceVariableNames();
  55204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55205. $ctx1.sendIdx["instanceVariableNames"]=1;
  55206. //>>excludeEnd("ctx");
  55207. $1=_st($2)._isEmpty();
  55208. if(! smalltalk.assert($1)){
  55209. $5=_st(aClass)._class();
  55210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55211. $ctx1.sendIdx["class"]=2;
  55212. //>>excludeEnd("ctx");
  55213. $4=self._classNameFor_($5);
  55214. _st(aStream)._nextPutAll_($4);
  55215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55216. $ctx1.sendIdx["nextPutAll:"]=1;
  55217. //>>excludeEnd("ctx");
  55218. $6=_st(aStream)._nextPutAll_(" instanceVariableNames: '");
  55219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55220. $ctx1.sendIdx["nextPutAll:"]=2;
  55221. //>>excludeEnd("ctx");
  55222. $6;
  55223. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  55224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55225. return smalltalk.withContext(function($ctx2) {
  55226. //>>excludeEnd("ctx");
  55227. return _st(aStream)._nextPutAll_(each);
  55228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55229. $ctx2.sendIdx["nextPutAll:"]=3;
  55230. //>>excludeEnd("ctx");
  55231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55233. //>>excludeEnd("ctx");
  55234. }),(function(){
  55235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55236. return smalltalk.withContext(function($ctx2) {
  55237. //>>excludeEnd("ctx");
  55238. return _st(aStream)._nextPutAll_(" ");
  55239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55240. $ctx2.sendIdx["nextPutAll:"]=4;
  55241. //>>excludeEnd("ctx");
  55242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55244. //>>excludeEnd("ctx");
  55245. }));
  55246. _st(aStream)._nextPutAll_("'!");
  55247. _st(aStream)._lf();
  55248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55249. $ctx1.sendIdx["lf"]=1;
  55250. //>>excludeEnd("ctx");
  55251. $7=_st(aStream)._lf();
  55252. $7;
  55253. };
  55254. return self;
  55255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55256. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)});
  55257. //>>excludeEnd("ctx");
  55258. },
  55259. //>>excludeStart("ide", pragmas.excludeIdeData);
  55260. args: ["aClass", "aStream"],
  55261. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]",
  55262. referencedClasses: [],
  55263. //>>excludeEnd("ide");
  55264. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  55265. }),
  55266. globals.ChunkExporter);
  55267. smalltalk.addMethod(
  55268. smalltalk.method({
  55269. selector: "exportMethod:on:",
  55270. protocol: 'output',
  55271. fn: function (aMethod,aStream){
  55272. var self=this;
  55273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55274. return smalltalk.withContext(function($ctx1) {
  55275. //>>excludeEnd("ctx");
  55276. var $1;
  55277. _st(aStream)._lf();
  55278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55279. $ctx1.sendIdx["lf"]=1;
  55280. //>>excludeEnd("ctx");
  55281. _st(aStream)._lf();
  55282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55283. $ctx1.sendIdx["lf"]=2;
  55284. //>>excludeEnd("ctx");
  55285. _st(aStream)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  55286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55287. $ctx1.sendIdx["nextPutAll:"]=1;
  55288. //>>excludeEnd("ctx");
  55289. _st(aStream)._lf();
  55290. $1=_st(aStream)._nextPutAll_("!");
  55291. return self;
  55292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55293. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.ChunkExporter)});
  55294. //>>excludeEnd("ctx");
  55295. },
  55296. //>>excludeStart("ide", pragmas.excludeIdeData);
  55297. args: ["aMethod", "aStream"],
  55298. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  55299. referencedClasses: [],
  55300. //>>excludeEnd("ide");
  55301. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  55302. }),
  55303. globals.ChunkExporter);
  55304. smalltalk.addMethod(
  55305. smalltalk.method({
  55306. selector: "exportPackage:on:",
  55307. protocol: 'output',
  55308. fn: function (aPackage,aStream){
  55309. var self=this;
  55310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55311. return smalltalk.withContext(function($ctx1) {
  55312. //>>excludeEnd("ctx");
  55313. var $1;
  55314. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  55315. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  55316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55317. return smalltalk.withContext(function($ctx2) {
  55318. //>>excludeEnd("ctx");
  55319. self._exportDefinitionOf_on_(each,aStream);
  55320. $1=self._ownMethodProtocolsOfClass_(each);
  55321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55322. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  55323. //>>excludeEnd("ctx");
  55324. self._exportProtocols_on_($1,aStream);
  55325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55326. $ctx2.sendIdx["exportProtocols:on:"]=1;
  55327. //>>excludeEnd("ctx");
  55328. self._exportMetaDefinitionOf_on_(each,aStream);
  55329. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(_st(each)._class()),aStream);
  55330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55331. $ctx2.sendIdx["exportProtocols:on:"]=2;
  55332. //>>excludeEnd("ctx");
  55333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55334. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55335. //>>excludeEnd("ctx");
  55336. }));
  55337. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  55338. return self;
  55339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55340. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)});
  55341. //>>excludeEnd("ctx");
  55342. },
  55343. //>>excludeStart("ide", pragmas.excludeIdeData);
  55344. args: ["aPackage", "aStream"],
  55345. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self exportPackageDefinitionOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  55346. referencedClasses: [],
  55347. //>>excludeEnd("ide");
  55348. messageSends: ["exportPackageDefinitionOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  55349. }),
  55350. globals.ChunkExporter);
  55351. smalltalk.addMethod(
  55352. smalltalk.method({
  55353. selector: "exportPackageDefinitionOf:on:",
  55354. protocol: 'output',
  55355. fn: function (aPackage,aStream){
  55356. var self=this;
  55357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55358. return smalltalk.withContext(function($ctx1) {
  55359. //>>excludeEnd("ctx");
  55360. var $1,$2;
  55361. $1=_st("Smalltalk createPackage: '".__comma(_st(aPackage)._name())).__comma("'!");
  55362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55363. $ctx1.sendIdx[","]=1;
  55364. //>>excludeEnd("ctx");
  55365. _st(aStream)._nextPutAll_($1);
  55366. $2=_st(aStream)._lf();
  55367. return self;
  55368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55369. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)});
  55370. //>>excludeEnd("ctx");
  55371. },
  55372. //>>excludeStart("ide", pragmas.excludeIdeData);
  55373. args: ["aPackage", "aStream"],
  55374. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  55375. referencedClasses: [],
  55376. //>>excludeEnd("ide");
  55377. messageSends: ["nextPutAll:", ",", "name", "lf"]
  55378. }),
  55379. globals.ChunkExporter);
  55380. smalltalk.addMethod(
  55381. smalltalk.method({
  55382. selector: "exportProtocol:on:",
  55383. protocol: 'output',
  55384. fn: function (aProtocol,aStream){
  55385. var self=this;
  55386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55387. return smalltalk.withContext(function($ctx1) {
  55388. //>>excludeEnd("ctx");
  55389. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  55390. _st(_st(aProtocol)._methods())._do_((function(method){
  55391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55392. return smalltalk.withContext(function($ctx2) {
  55393. //>>excludeEnd("ctx");
  55394. return self._exportMethod_on_(method,aStream);
  55395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55396. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  55397. //>>excludeEnd("ctx");
  55398. }));
  55399. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  55400. return self;
  55401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55402. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)});
  55403. //>>excludeEnd("ctx");
  55404. },
  55405. //>>excludeStart("ide", pragmas.excludeIdeData);
  55406. args: ["aProtocol", "aStream"],
  55407. source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream",
  55408. referencedClasses: [],
  55409. //>>excludeEnd("ide");
  55410. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  55411. }),
  55412. globals.ChunkExporter);
  55413. smalltalk.addMethod(
  55414. smalltalk.method({
  55415. selector: "exportProtocolEpilogueOf:on:",
  55416. protocol: 'output',
  55417. fn: function (aProtocol,aStream){
  55418. var self=this;
  55419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55420. return smalltalk.withContext(function($ctx1) {
  55421. //>>excludeEnd("ctx");
  55422. var $1;
  55423. _st(aStream)._nextPutAll_(" !");
  55424. _st(aStream)._lf();
  55425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55426. $ctx1.sendIdx["lf"]=1;
  55427. //>>excludeEnd("ctx");
  55428. $1=_st(aStream)._lf();
  55429. return self;
  55430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55431. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)});
  55432. //>>excludeEnd("ctx");
  55433. },
  55434. //>>excludeStart("ide", pragmas.excludeIdeData);
  55435. args: ["aProtocol", "aStream"],
  55436. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  55437. referencedClasses: [],
  55438. //>>excludeEnd("ide");
  55439. messageSends: ["nextPutAll:", "lf"]
  55440. }),
  55441. globals.ChunkExporter);
  55442. smalltalk.addMethod(
  55443. smalltalk.method({
  55444. selector: "exportProtocolPrologueOf:on:",
  55445. protocol: 'output',
  55446. fn: function (aProtocol,aStream){
  55447. var self=this;
  55448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55449. return smalltalk.withContext(function($ctx1) {
  55450. //>>excludeEnd("ctx");
  55451. var $1,$3,$2;
  55452. $1="!".__comma(self._classNameFor_(_st(aProtocol)._theClass()));
  55453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55454. $ctx1.sendIdx[","]=1;
  55455. //>>excludeEnd("ctx");
  55456. _st(aStream)._nextPutAll_($1);
  55457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55458. $ctx1.sendIdx["nextPutAll:"]=1;
  55459. //>>excludeEnd("ctx");
  55460. $3=_st(" methodsFor: '".__comma(_st(aProtocol)._name())).__comma("'!");
  55461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55462. $ctx1.sendIdx[","]=2;
  55463. //>>excludeEnd("ctx");
  55464. $2=_st(aStream)._nextPutAll_($3);
  55465. return self;
  55466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55467. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)});
  55468. //>>excludeEnd("ctx");
  55469. },
  55470. //>>excludeStart("ide", pragmas.excludeIdeData);
  55471. args: ["aProtocol", "aStream"],
  55472. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  55473. referencedClasses: [],
  55474. //>>excludeEnd("ide");
  55475. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  55476. }),
  55477. globals.ChunkExporter);
  55478. smalltalk.addMethod(
  55479. smalltalk.method({
  55480. selector: "exportProtocols:on:",
  55481. protocol: 'output',
  55482. fn: function (aCollection,aStream){
  55483. var self=this;
  55484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55485. return smalltalk.withContext(function($ctx1) {
  55486. //>>excludeEnd("ctx");
  55487. _st(aCollection)._do_((function(each){
  55488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55489. return smalltalk.withContext(function($ctx2) {
  55490. //>>excludeEnd("ctx");
  55491. return self._exportProtocol_on_(each,aStream);
  55492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55493. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55494. //>>excludeEnd("ctx");
  55495. }));
  55496. return self;
  55497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55498. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},globals.ChunkExporter)});
  55499. //>>excludeEnd("ctx");
  55500. },
  55501. //>>excludeStart("ide", pragmas.excludeIdeData);
  55502. args: ["aCollection", "aStream"],
  55503. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  55504. referencedClasses: [],
  55505. //>>excludeEnd("ide");
  55506. messageSends: ["do:", "exportProtocol:on:"]
  55507. }),
  55508. globals.ChunkExporter);
  55509. smalltalk.addMethod(
  55510. smalltalk.method({
  55511. selector: "extensionCategoriesOfPackage:",
  55512. protocol: 'accessing',
  55513. fn: function (aPackage){
  55514. var self=this;
  55515. var name,map,result;
  55516. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  55517. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  55518. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  55519. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  55520. function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  55521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55522. return smalltalk.withContext(function($ctx1) {
  55523. //>>excludeEnd("ctx");
  55524. var $1,$2;
  55525. name=_st(aPackage)._name();
  55526. result=_st($OrderedCollection())._new();
  55527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55528. $ctx1.sendIdx["new"]=1;
  55529. //>>excludeEnd("ctx");
  55530. _st(_st($Package())._sortedClasses_(_st($Smalltalk())._classes()))._do_((function(each){
  55531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55532. return smalltalk.withContext(function($ctx2) {
  55533. //>>excludeEnd("ctx");
  55534. return _st([each,_st(each)._class()])._do_((function(aClass){
  55535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55536. return smalltalk.withContext(function($ctx3) {
  55537. //>>excludeEnd("ctx");
  55538. map=_st($Dictionary())._new();
  55539. map;
  55540. _st(aClass)._protocolsDo_((function(category,methods){
  55541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55542. return smalltalk.withContext(function($ctx4) {
  55543. //>>excludeEnd("ctx");
  55544. $1=_st(category).__eq("*".__comma(name));
  55545. if(smalltalk.assert($1)){
  55546. return _st(map)._at_put_(category,methods);
  55547. };
  55548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55549. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  55550. //>>excludeEnd("ctx");
  55551. }));
  55552. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  55553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55554. return smalltalk.withContext(function($ctx4) {
  55555. //>>excludeEnd("ctx");
  55556. return _st(a).__lt_eq(b);
  55557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55558. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  55559. //>>excludeEnd("ctx");
  55560. })))._collect_((function(category){
  55561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55562. return smalltalk.withContext(function($ctx4) {
  55563. //>>excludeEnd("ctx");
  55564. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  55565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55566. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  55567. //>>excludeEnd("ctx");
  55568. })));
  55569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55570. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  55571. //>>excludeEnd("ctx");
  55572. }));
  55573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55575. //>>excludeEnd("ctx");
  55576. }));
  55577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55578. $ctx1.sendIdx["do:"]=1;
  55579. //>>excludeEnd("ctx");
  55580. $2=result;
  55581. return $2;
  55582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55583. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},globals.ChunkExporter)});
  55584. //>>excludeEnd("ctx");
  55585. },
  55586. //>>excludeStart("ide", pragmas.excludeIdeData);
  55587. args: ["aPackage"],
  55588. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
  55589. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  55590. //>>excludeEnd("ide");
  55591. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  55592. }),
  55593. globals.ChunkExporter);
  55594. smalltalk.addMethod(
  55595. smalltalk.method({
  55596. selector: "ownCategoriesOfClass:",
  55597. protocol: 'accessing',
  55598. fn: function (aClass){
  55599. var self=this;
  55600. var map;
  55601. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  55602. function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  55603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55604. return smalltalk.withContext(function($ctx1) {
  55605. //>>excludeEnd("ctx");
  55606. var $1,$2;
  55607. map=_st($Dictionary())._new();
  55608. _st(aClass)._protocolsDo_((function(each,methods){
  55609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55610. return smalltalk.withContext(function($ctx2) {
  55611. //>>excludeEnd("ctx");
  55612. $1=_st(each)._match_("^\x5c*");
  55613. if(! smalltalk.assert($1)){
  55614. return _st(map)._at_put_(each,methods);
  55615. };
  55616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55617. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  55618. //>>excludeEnd("ctx");
  55619. }));
  55620. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  55621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55622. return smalltalk.withContext(function($ctx2) {
  55623. //>>excludeEnd("ctx");
  55624. return _st(a).__lt_eq(b);
  55625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55626. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  55627. //>>excludeEnd("ctx");
  55628. })))._collect_((function(each){
  55629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55630. return smalltalk.withContext(function($ctx2) {
  55631. //>>excludeEnd("ctx");
  55632. return _st($MethodCategory())._name_theClass_methods_(each,aClass,_st(map)._at_(each));
  55633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  55635. //>>excludeEnd("ctx");
  55636. }));
  55637. return $2;
  55638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55639. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},globals.ChunkExporter)});
  55640. //>>excludeEnd("ctx");
  55641. },
  55642. //>>excludeStart("ide", pragmas.excludeIdeData);
  55643. args: ["aClass"],
  55644. source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]",
  55645. referencedClasses: ["Dictionary", "MethodCategory"],
  55646. //>>excludeEnd("ide");
  55647. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  55648. }),
  55649. globals.ChunkExporter);
  55650. smalltalk.addMethod(
  55651. smalltalk.method({
  55652. selector: "ownCategoriesOfMetaClass:",
  55653. protocol: 'accessing',
  55654. fn: function (aClass){
  55655. var self=this;
  55656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55657. return smalltalk.withContext(function($ctx1) {
  55658. //>>excludeEnd("ctx");
  55659. var $1;
  55660. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  55661. return $1;
  55662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55663. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},globals.ChunkExporter)});
  55664. //>>excludeEnd("ctx");
  55665. },
  55666. //>>excludeStart("ide", pragmas.excludeIdeData);
  55667. args: ["aClass"],
  55668. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  55669. referencedClasses: [],
  55670. //>>excludeEnd("ide");
  55671. messageSends: ["ownCategoriesOfClass:", "class"]
  55672. }),
  55673. globals.ChunkExporter);
  55674. smalltalk.addMethod(
  55675. smalltalk.method({
  55676. selector: "ownMethodProtocolsOfClass:",
  55677. protocol: 'accessing',
  55678. fn: function (aClass){
  55679. var self=this;
  55680. function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  55681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55682. return smalltalk.withContext(function($ctx1) {
  55683. //>>excludeEnd("ctx");
  55684. var $1;
  55685. $1=_st(_st(aClass)._ownProtocols())._collect_((function(each){
  55686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55687. return smalltalk.withContext(function($ctx2) {
  55688. //>>excludeEnd("ctx");
  55689. return _st($ExportMethodProtocol())._name_theClass_(each,aClass);
  55690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55692. //>>excludeEnd("ctx");
  55693. }));
  55694. return $1;
  55695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55696. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},globals.ChunkExporter)});
  55697. //>>excludeEnd("ctx");
  55698. },
  55699. //>>excludeStart("ide", pragmas.excludeIdeData);
  55700. args: ["aClass"],
  55701. source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]",
  55702. referencedClasses: ["ExportMethodProtocol"],
  55703. //>>excludeEnd("ide");
  55704. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  55705. }),
  55706. globals.ChunkExporter);
  55707. smalltalk.addClass('Exporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
  55708. //>>excludeStart("ide", pragmas.excludeIdeData);
  55709. globals.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).";
  55710. //>>excludeEnd("ide");
  55711. smalltalk.addMethod(
  55712. smalltalk.method({
  55713. selector: "exportDefinitionOf:on:",
  55714. protocol: 'output',
  55715. fn: function (aClass,aStream){
  55716. var self=this;
  55717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55718. return smalltalk.withContext(function($ctx1) {
  55719. //>>excludeEnd("ctx");
  55720. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10;
  55721. _st(aStream)._lf();
  55722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55723. $ctx1.sendIdx["lf"]=1;
  55724. //>>excludeEnd("ctx");
  55725. _st(aStream)._nextPutAll_("smalltalk.addClass(");
  55726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55727. $ctx1.sendIdx["nextPutAll:"]=1;
  55728. //>>excludeEnd("ctx");
  55729. $2="'".__comma(self._classNameFor_(aClass));
  55730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55731. $ctx1.sendIdx[","]=2;
  55732. //>>excludeEnd("ctx");
  55733. $1=_st($2).__comma("', ");
  55734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55735. $ctx1.sendIdx[","]=1;
  55736. //>>excludeEnd("ctx");
  55737. _st(aStream)._nextPutAll_($1);
  55738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55739. $ctx1.sendIdx["nextPutAll:"]=2;
  55740. //>>excludeEnd("ctx");
  55741. $3=self._jsClassNameFor_(_st(aClass)._superclass());
  55742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55743. $ctx1.sendIdx["jsClassNameFor:"]=1;
  55744. //>>excludeEnd("ctx");
  55745. _st(aStream)._nextPutAll_($3);
  55746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55747. $ctx1.sendIdx["nextPutAll:"]=3;
  55748. //>>excludeEnd("ctx");
  55749. $4=_st(aStream)._nextPutAll_(", [");
  55750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55751. $ctx1.sendIdx["nextPutAll:"]=4;
  55752. //>>excludeEnd("ctx");
  55753. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  55754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55755. return smalltalk.withContext(function($ctx2) {
  55756. //>>excludeEnd("ctx");
  55757. $6="'".__comma(each);
  55758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55759. $ctx2.sendIdx[","]=4;
  55760. //>>excludeEnd("ctx");
  55761. $5=_st($6).__comma("'");
  55762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55763. $ctx2.sendIdx[","]=3;
  55764. //>>excludeEnd("ctx");
  55765. return _st(aStream)._nextPutAll_($5);
  55766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55767. $ctx2.sendIdx["nextPutAll:"]=5;
  55768. //>>excludeEnd("ctx");
  55769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55771. //>>excludeEnd("ctx");
  55772. }),(function(){
  55773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55774. return smalltalk.withContext(function($ctx2) {
  55775. //>>excludeEnd("ctx");
  55776. return _st(aStream)._nextPutAll_(", ");
  55777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55778. $ctx2.sendIdx["nextPutAll:"]=6;
  55779. //>>excludeEnd("ctx");
  55780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55782. //>>excludeEnd("ctx");
  55783. }));
  55784. _st(aStream)._nextPutAll_("], '");
  55785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55786. $ctx1.sendIdx["nextPutAll:"]=7;
  55787. //>>excludeEnd("ctx");
  55788. _st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  55789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55790. $ctx1.sendIdx["nextPutAll:"]=8;
  55791. //>>excludeEnd("ctx");
  55792. $7=_st(aStream)._nextPutAll_(");");
  55793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55794. $ctx1.sendIdx["nextPutAll:"]=9;
  55795. //>>excludeEnd("ctx");
  55796. $9=_st(aClass)._comment();
  55797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55798. $ctx1.sendIdx["comment"]=1;
  55799. //>>excludeEnd("ctx");
  55800. $8=_st($9)._notEmpty();
  55801. if(smalltalk.assert($8)){
  55802. _st(aStream)._lf();
  55803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55804. $ctx1.sendIdx["lf"]=2;
  55805. //>>excludeEnd("ctx");
  55806. _st(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  55807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55808. $ctx1.sendIdx["nextPutAll:"]=10;
  55809. //>>excludeEnd("ctx");
  55810. _st(aStream)._lf();
  55811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55812. $ctx1.sendIdx["lf"]=3;
  55813. //>>excludeEnd("ctx");
  55814. _st(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  55815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55816. $ctx1.sendIdx["nextPutAll:"]=11;
  55817. //>>excludeEnd("ctx");
  55818. _st(aStream)._nextPutAll_(".comment=");
  55819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55820. $ctx1.sendIdx["nextPutAll:"]=12;
  55821. //>>excludeEnd("ctx");
  55822. _st(aStream)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  55823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55824. $ctx1.sendIdx["nextPutAll:"]=13;
  55825. //>>excludeEnd("ctx");
  55826. _st(aStream)._nextPutAll_(";");
  55827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55828. $ctx1.sendIdx["nextPutAll:"]=14;
  55829. //>>excludeEnd("ctx");
  55830. _st(aStream)._lf();
  55831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55832. $ctx1.sendIdx["lf"]=4;
  55833. //>>excludeEnd("ctx");
  55834. $10=_st(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  55835. $10;
  55836. };
  55837. _st(aStream)._lf();
  55838. return self;
  55839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55840. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)});
  55841. //>>excludeEnd("ctx");
  55842. },
  55843. //>>excludeStart("ide", pragmas.excludeIdeData);
  55844. args: ["aClass", "aStream"],
  55845. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ', ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: (self jsClassNameFor: aClass);\x0a\x09\x09\x09nextPutAll: '.comment=';\x0a\x09\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  55846. referencedClasses: [],
  55847. //>>excludeEnd("ide");
  55848. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript"]
  55849. }),
  55850. globals.Exporter);
  55851. smalltalk.addMethod(
  55852. smalltalk.method({
  55853. selector: "exportMetaDefinitionOf:on:",
  55854. protocol: 'output',
  55855. fn: function (aClass,aStream){
  55856. var self=this;
  55857. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  55858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55859. return smalltalk.withContext(function($ctx1) {
  55860. //>>excludeEnd("ctx");
  55861. var $3,$2,$1,$5,$4,$6,$8,$7;
  55862. _st(aStream)._lf();
  55863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55864. $ctx1.sendIdx["lf"]=1;
  55865. //>>excludeEnd("ctx");
  55866. $3=_st(aClass)._class();
  55867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55868. $ctx1.sendIdx["class"]=1;
  55869. //>>excludeEnd("ctx");
  55870. $2=_st($3)._instanceVariableNames();
  55871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55872. $ctx1.sendIdx["instanceVariableNames"]=1;
  55873. //>>excludeEnd("ctx");
  55874. $1=_st($2)._isEmpty();
  55875. if(! smalltalk.assert($1)){
  55876. $5=_st(aClass)._class();
  55877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55878. $ctx1.sendIdx["class"]=2;
  55879. //>>excludeEnd("ctx");
  55880. $4=self._jsClassNameFor_($5);
  55881. _st(aStream)._nextPutAll_($4);
  55882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55883. $ctx1.sendIdx["nextPutAll:"]=1;
  55884. //>>excludeEnd("ctx");
  55885. $6=_st(aStream)._nextPutAll_(".iVarNames = [");
  55886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55887. $ctx1.sendIdx["nextPutAll:"]=2;
  55888. //>>excludeEnd("ctx");
  55889. $6;
  55890. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  55891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55892. return smalltalk.withContext(function($ctx2) {
  55893. //>>excludeEnd("ctx");
  55894. $8="'".__comma(each);
  55895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55896. $ctx2.sendIdx[","]=2;
  55897. //>>excludeEnd("ctx");
  55898. $7=_st($8).__comma("'");
  55899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55900. $ctx2.sendIdx[","]=1;
  55901. //>>excludeEnd("ctx");
  55902. return _st(aStream)._nextPutAll_($7);
  55903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55904. $ctx2.sendIdx["nextPutAll:"]=3;
  55905. //>>excludeEnd("ctx");
  55906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55907. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55908. //>>excludeEnd("ctx");
  55909. }),(function(){
  55910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55911. return smalltalk.withContext(function($ctx2) {
  55912. //>>excludeEnd("ctx");
  55913. return _st(aStream)._nextPutAll_(",");
  55914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55915. $ctx2.sendIdx["nextPutAll:"]=4;
  55916. //>>excludeEnd("ctx");
  55917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55919. //>>excludeEnd("ctx");
  55920. }));
  55921. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  55922. };
  55923. return self;
  55924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55925. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)});
  55926. //>>excludeEnd("ctx");
  55927. },
  55928. //>>excludeStart("ide", pragmas.excludeIdeData);
  55929. args: ["aClass", "aStream"],
  55930. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]",
  55931. referencedClasses: ["String"],
  55932. //>>excludeEnd("ide");
  55933. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  55934. }),
  55935. globals.Exporter);
  55936. smalltalk.addMethod(
  55937. smalltalk.method({
  55938. selector: "exportMethod:on:",
  55939. protocol: 'output',
  55940. fn: function (aMethod,aStream){
  55941. var self=this;
  55942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55943. return smalltalk.withContext(function($ctx1) {
  55944. //>>excludeEnd("ctx");
  55945. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17;
  55946. _st(aStream)._nextPutAll_("smalltalk.addMethod(");
  55947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55948. $ctx1.sendIdx["nextPutAll:"]=1;
  55949. //>>excludeEnd("ctx");
  55950. _st(aStream)._lf();
  55951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55952. $ctx1.sendIdx["lf"]=1;
  55953. //>>excludeEnd("ctx");
  55954. _st(aStream)._nextPutAll_("smalltalk.method({");
  55955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55956. $ctx1.sendIdx["nextPutAll:"]=2;
  55957. //>>excludeEnd("ctx");
  55958. _st(aStream)._lf();
  55959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55960. $ctx1.sendIdx["lf"]=2;
  55961. //>>excludeEnd("ctx");
  55962. $3=_st(_st(aMethod)._selector())._asJavascript();
  55963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55964. $ctx1.sendIdx["asJavascript"]=1;
  55965. //>>excludeEnd("ctx");
  55966. $2="selector: ".__comma($3);
  55967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55968. $ctx1.sendIdx[","]=2;
  55969. //>>excludeEnd("ctx");
  55970. $1=_st($2).__comma(",");
  55971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55972. $ctx1.sendIdx[","]=1;
  55973. //>>excludeEnd("ctx");
  55974. _st(aStream)._nextPutAll_($1);
  55975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55976. $ctx1.sendIdx["nextPutAll:"]=3;
  55977. //>>excludeEnd("ctx");
  55978. _st(aStream)._lf();
  55979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55980. $ctx1.sendIdx["lf"]=3;
  55981. //>>excludeEnd("ctx");
  55982. $5="protocol: '".__comma(_st(aMethod)._protocol());
  55983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55984. $ctx1.sendIdx[","]=4;
  55985. //>>excludeEnd("ctx");
  55986. $4=_st($5).__comma("',");
  55987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55988. $ctx1.sendIdx[","]=3;
  55989. //>>excludeEnd("ctx");
  55990. _st(aStream)._nextPutAll_($4);
  55991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55992. $ctx1.sendIdx["nextPutAll:"]=4;
  55993. //>>excludeEnd("ctx");
  55994. _st(aStream)._lf();
  55995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55996. $ctx1.sendIdx["lf"]=4;
  55997. //>>excludeEnd("ctx");
  55998. $7="fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource());
  55999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56000. $ctx1.sendIdx[","]=6;
  56001. //>>excludeEnd("ctx");
  56002. $6=_st($7).__comma(",");
  56003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56004. $ctx1.sendIdx[","]=5;
  56005. //>>excludeEnd("ctx");
  56006. _st(aStream)._nextPutAll_($6);
  56007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56008. $ctx1.sendIdx["nextPutAll:"]=5;
  56009. //>>excludeEnd("ctx");
  56010. _st(aStream)._lf();
  56011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56012. $ctx1.sendIdx["lf"]=5;
  56013. //>>excludeEnd("ctx");
  56014. _st(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  56015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56016. $ctx1.sendIdx["nextPutAll:"]=6;
  56017. //>>excludeEnd("ctx");
  56018. _st(aStream)._lf();
  56019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56020. $ctx1.sendIdx["lf"]=6;
  56021. //>>excludeEnd("ctx");
  56022. $10=_st(_st(aMethod)._arguments())._asJavascript();
  56023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56024. $ctx1.sendIdx["asJavascript"]=2;
  56025. //>>excludeEnd("ctx");
  56026. $9="args: ".__comma($10);
  56027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56028. $ctx1.sendIdx[","]=8;
  56029. //>>excludeEnd("ctx");
  56030. $8=_st($9).__comma(",");
  56031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56032. $ctx1.sendIdx[","]=7;
  56033. //>>excludeEnd("ctx");
  56034. _st(aStream)._nextPutAll_($8);
  56035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56036. $ctx1.sendIdx["nextPutAll:"]=7;
  56037. //>>excludeEnd("ctx");
  56038. _st(aStream)._lf();
  56039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56040. $ctx1.sendIdx["lf"]=7;
  56041. //>>excludeEnd("ctx");
  56042. $13=_st(_st(aMethod)._source())._asJavascript();
  56043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56044. $ctx1.sendIdx["asJavascript"]=3;
  56045. //>>excludeEnd("ctx");
  56046. $12="source: ".__comma($13);
  56047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56048. $ctx1.sendIdx[","]=10;
  56049. //>>excludeEnd("ctx");
  56050. $11=_st($12).__comma(",");
  56051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56052. $ctx1.sendIdx[","]=9;
  56053. //>>excludeEnd("ctx");
  56054. _st(aStream)._nextPutAll_($11);
  56055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56056. $ctx1.sendIdx["nextPutAll:"]=8;
  56057. //>>excludeEnd("ctx");
  56058. _st(aStream)._lf();
  56059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56060. $ctx1.sendIdx["lf"]=8;
  56061. //>>excludeEnd("ctx");
  56062. $16=_st(_st(aMethod)._referencedClasses())._asJavascript();
  56063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56064. $ctx1.sendIdx["asJavascript"]=4;
  56065. //>>excludeEnd("ctx");
  56066. $15="referencedClasses: ".__comma($16);
  56067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56068. $ctx1.sendIdx[","]=12;
  56069. //>>excludeEnd("ctx");
  56070. $14=_st($15).__comma(",");
  56071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56072. $ctx1.sendIdx[","]=11;
  56073. //>>excludeEnd("ctx");
  56074. _st(aStream)._nextPutAll_($14);
  56075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56076. $ctx1.sendIdx["nextPutAll:"]=9;
  56077. //>>excludeEnd("ctx");
  56078. _st(aStream)._lf();
  56079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56080. $ctx1.sendIdx["lf"]=9;
  56081. //>>excludeEnd("ctx");
  56082. _st(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  56083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56084. $ctx1.sendIdx["nextPutAll:"]=10;
  56085. //>>excludeEnd("ctx");
  56086. _st(aStream)._lf();
  56087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56088. $ctx1.sendIdx["lf"]=10;
  56089. //>>excludeEnd("ctx");
  56090. _st(aStream)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  56091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56092. $ctx1.sendIdx["nextPutAll:"]=11;
  56093. //>>excludeEnd("ctx");
  56094. _st(aStream)._lf();
  56095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56096. $ctx1.sendIdx["lf"]=11;
  56097. //>>excludeEnd("ctx");
  56098. _st(aStream)._nextPutAll_("}),");
  56099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56100. $ctx1.sendIdx["nextPutAll:"]=12;
  56101. //>>excludeEnd("ctx");
  56102. _st(aStream)._lf();
  56103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56104. $ctx1.sendIdx["lf"]=12;
  56105. //>>excludeEnd("ctx");
  56106. _st(aStream)._nextPutAll_(self._jsClassNameFor_(_st(aMethod)._methodClass()));
  56107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56108. $ctx1.sendIdx["nextPutAll:"]=13;
  56109. //>>excludeEnd("ctx");
  56110. _st(aStream)._nextPutAll_(");");
  56111. _st(aStream)._lf();
  56112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56113. $ctx1.sendIdx["lf"]=13;
  56114. //>>excludeEnd("ctx");
  56115. $17=_st(aStream)._lf();
  56116. return self;
  56117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56118. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.Exporter)});
  56119. //>>excludeEnd("ctx");
  56120. },
  56121. //>>excludeStart("ide", pragmas.excludeIdeData);
  56122. args: ["aMethod", "aStream"],
  56123. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  56124. referencedClasses: [],
  56125. //>>excludeEnd("ide");
  56126. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  56127. }),
  56128. globals.Exporter);
  56129. smalltalk.addMethod(
  56130. smalltalk.method({
  56131. selector: "exportPackage:on:",
  56132. protocol: 'output',
  56133. fn: function (aPackage,aStream){
  56134. var self=this;
  56135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56136. return smalltalk.withContext(function($ctx1) {
  56137. //>>excludeEnd("ctx");
  56138. var $1,$2;
  56139. self._exportPackagePrologueOf_on_(aPackage,aStream);
  56140. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  56141. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  56142. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  56143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56144. return smalltalk.withContext(function($ctx2) {
  56145. //>>excludeEnd("ctx");
  56146. self._exportDefinitionOf_on_(each,aStream);
  56147. $2=_st(each)._ownMethods();
  56148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56149. $ctx2.sendIdx["ownMethods"]=1;
  56150. //>>excludeEnd("ctx");
  56151. _st($2)._do_((function(method){
  56152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56153. return smalltalk.withContext(function($ctx3) {
  56154. //>>excludeEnd("ctx");
  56155. return self._exportMethod_on_(method,aStream);
  56156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56157. $ctx3.sendIdx["exportMethod:on:"]=1;
  56158. //>>excludeEnd("ctx");
  56159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56160. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  56161. //>>excludeEnd("ctx");
  56162. }));
  56163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56164. $ctx2.sendIdx["do:"]=2;
  56165. //>>excludeEnd("ctx");
  56166. self._exportMetaDefinitionOf_on_(each,aStream);
  56167. return _st(_st(_st(each)._class())._ownMethods())._do_((function(method){
  56168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56169. return smalltalk.withContext(function($ctx3) {
  56170. //>>excludeEnd("ctx");
  56171. return self._exportMethod_on_(method,aStream);
  56172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56173. $ctx3.sendIdx["exportMethod:on:"]=2;
  56174. //>>excludeEnd("ctx");
  56175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56176. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  56177. //>>excludeEnd("ctx");
  56178. }));
  56179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56180. $ctx2.sendIdx["do:"]=3;
  56181. //>>excludeEnd("ctx");
  56182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56184. //>>excludeEnd("ctx");
  56185. }));
  56186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56187. $ctx1.sendIdx["do:"]=1;
  56188. //>>excludeEnd("ctx");
  56189. _st(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  56190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56191. return smalltalk.withContext(function($ctx2) {
  56192. //>>excludeEnd("ctx");
  56193. return self._exportMethod_on_(each,aStream);
  56194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56195. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  56196. //>>excludeEnd("ctx");
  56197. }));
  56198. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  56199. return self;
  56200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56201. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56202. //>>excludeEnd("ctx");
  56203. },
  56204. //>>excludeStart("ide", pragmas.excludeIdeData);
  56205. args: ["aPackage", "aStream"],
  56206. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  56207. referencedClasses: [],
  56208. //>>excludeEnd("ide");
  56209. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  56210. }),
  56211. globals.Exporter);
  56212. smalltalk.addMethod(
  56213. smalltalk.method({
  56214. selector: "exportPackageDefinitionOf:on:",
  56215. protocol: 'output',
  56216. fn: function (aPackage,aStream){
  56217. var self=this;
  56218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56219. return smalltalk.withContext(function($ctx1) {
  56220. //>>excludeEnd("ctx");
  56221. var $1,$2;
  56222. _st(aStream)._nextPutAll_("smalltalk.addPackage(");
  56223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56224. $ctx1.sendIdx["nextPutAll:"]=1;
  56225. //>>excludeEnd("ctx");
  56226. $1=_st("'".__comma(_st(aPackage)._name())).__comma("');");
  56227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56228. $ctx1.sendIdx[","]=1;
  56229. //>>excludeEnd("ctx");
  56230. _st(aStream)._nextPutAll_($1);
  56231. $2=_st(aStream)._lf();
  56232. return self;
  56233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56234. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56235. //>>excludeEnd("ctx");
  56236. },
  56237. //>>excludeStart("ide", pragmas.excludeIdeData);
  56238. args: ["aPackage", "aStream"],
  56239. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  56240. referencedClasses: [],
  56241. //>>excludeEnd("ide");
  56242. messageSends: ["nextPutAll:", ",", "name", "lf"]
  56243. }),
  56244. globals.Exporter);
  56245. smalltalk.addMethod(
  56246. smalltalk.method({
  56247. selector: "exportPackageEpilogueOf:on:",
  56248. protocol: 'output',
  56249. fn: function (aPackage,aStream){
  56250. var self=this;
  56251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56252. return smalltalk.withContext(function($ctx1) {
  56253. //>>excludeEnd("ctx");
  56254. var $1;
  56255. _st(aStream)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  56256. $1=_st(aStream)._lf();
  56257. return self;
  56258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56259. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56260. //>>excludeEnd("ctx");
  56261. },
  56262. //>>excludeStart("ide", pragmas.excludeIdeData);
  56263. args: ["aPackage", "aStream"],
  56264. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '})(global_smalltalk,global_nil,global__st);';\x0a\x09\x09lf",
  56265. referencedClasses: [],
  56266. //>>excludeEnd("ide");
  56267. messageSends: ["nextPutAll:", "lf"]
  56268. }),
  56269. globals.Exporter);
  56270. smalltalk.addMethod(
  56271. smalltalk.method({
  56272. selector: "exportPackagePrologueOf:on:",
  56273. protocol: 'output',
  56274. fn: function (aPackage,aStream){
  56275. var self=this;
  56276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56277. return smalltalk.withContext(function($ctx1) {
  56278. //>>excludeEnd("ctx");
  56279. var $1;
  56280. _st(aStream)._nextPutAll_("(function(smalltalk,nil,_st){");
  56281. $1=_st(aStream)._lf();
  56282. return self;
  56283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56284. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56285. //>>excludeEnd("ctx");
  56286. },
  56287. //>>excludeStart("ide", pragmas.excludeIdeData);
  56288. args: ["aPackage", "aStream"],
  56289. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '(function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  56290. referencedClasses: [],
  56291. //>>excludeEnd("ide");
  56292. messageSends: ["nextPutAll:", "lf"]
  56293. }),
  56294. globals.Exporter);
  56295. smalltalk.addMethod(
  56296. smalltalk.method({
  56297. selector: "exportPackageTransportOf:on:",
  56298. protocol: 'output',
  56299. fn: function (aPackage,aStream){
  56300. var self=this;
  56301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56302. return smalltalk.withContext(function($ctx1) {
  56303. //>>excludeEnd("ctx");
  56304. var $1;
  56305. _st(aStream)._nextPutAll_("smalltalk.packages[");
  56306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56307. $ctx1.sendIdx["nextPutAll:"]=1;
  56308. //>>excludeEnd("ctx");
  56309. _st(aStream)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  56310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56311. $ctx1.sendIdx["nextPutAll:"]=2;
  56312. //>>excludeEnd("ctx");
  56313. _st(aStream)._nextPutAll_("].transport = ");
  56314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56315. $ctx1.sendIdx["nextPutAll:"]=3;
  56316. //>>excludeEnd("ctx");
  56317. _st(aStream)._nextPutAll_(_st(_st(aPackage)._transport())._asJSONString());
  56318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56319. $ctx1.sendIdx["nextPutAll:"]=4;
  56320. //>>excludeEnd("ctx");
  56321. _st(aStream)._nextPutAll_(";");
  56322. $1=_st(aStream)._lf();
  56323. return self;
  56324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56325. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56326. //>>excludeEnd("ctx");
  56327. },
  56328. //>>excludeStart("ide", pragmas.excludeIdeData);
  56329. args: ["aPackage", "aStream"],
  56330. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  56331. referencedClasses: [],
  56332. //>>excludeEnd("ide");
  56333. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  56334. }),
  56335. globals.Exporter);
  56336. smalltalk.addMethod(
  56337. smalltalk.method({
  56338. selector: "jsClassNameFor:",
  56339. protocol: 'convenience',
  56340. fn: function (aClass){
  56341. var self=this;
  56342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56343. return smalltalk.withContext(function($ctx1) {
  56344. //>>excludeEnd("ctx");
  56345. var $2,$1,$receiver;
  56346. $2=_st(aClass)._isMetaclass();
  56347. if(smalltalk.assert($2)){
  56348. $1=_st(self._jsClassNameFor_(_st(aClass)._instanceClass())).__comma(".klass");
  56349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56350. $ctx1.sendIdx[","]=1;
  56351. //>>excludeEnd("ctx");
  56352. } else {
  56353. if(($receiver = aClass) == null || $receiver.isNil){
  56354. $1="null";
  56355. } else {
  56356. $1="globals.".__comma(_st(aClass)._name());
  56357. };
  56358. };
  56359. return $1;
  56360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56361. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},globals.Exporter)});
  56362. //>>excludeEnd("ctx");
  56363. },
  56364. //>>excludeStart("ide", pragmas.excludeIdeData);
  56365. args: ["aClass"],
  56366. source: "jsClassNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ (self jsClassNameFor: aClass instanceClass), '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'null' ]\x0a\x09\x09\x09\x09ifNotNil: [ 'globals.', aClass name ] ]",
  56367. referencedClasses: [],
  56368. //>>excludeEnd("ide");
  56369. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  56370. }),
  56371. globals.Exporter);
  56372. smalltalk.addMethod(
  56373. smalltalk.method({
  56374. selector: "ownMethodsOfClass:",
  56375. protocol: 'accessing',
  56376. fn: function (aClass){
  56377. var self=this;
  56378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56379. return smalltalk.withContext(function($ctx1) {
  56380. //>>excludeEnd("ctx");
  56381. var $2,$1;
  56382. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  56383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56384. return smalltalk.withContext(function($ctx2) {
  56385. //>>excludeEnd("ctx");
  56386. $2=_st(a)._selector();
  56387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56388. $ctx2.sendIdx["selector"]=1;
  56389. //>>excludeEnd("ctx");
  56390. return _st($2).__lt_eq(_st(b)._selector());
  56391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56392. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  56393. //>>excludeEnd("ctx");
  56394. })))._reject_((function(each){
  56395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56396. return smalltalk.withContext(function($ctx2) {
  56397. //>>excludeEnd("ctx");
  56398. return _st(_st(each)._protocol())._match_("^\x5c*");
  56399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  56401. //>>excludeEnd("ctx");
  56402. }));
  56403. return $1;
  56404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56405. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},globals.Exporter)});
  56406. //>>excludeEnd("ctx");
  56407. },
  56408. //>>excludeStart("ide", pragmas.excludeIdeData);
  56409. args: ["aClass"],
  56410. source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])\x0a\x09\x09reject: [ :each | (each protocol match: '^\x5c*') ]",
  56411. referencedClasses: [],
  56412. //>>excludeEnd("ide");
  56413. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  56414. }),
  56415. globals.Exporter);
  56416. smalltalk.addMethod(
  56417. smalltalk.method({
  56418. selector: "ownMethodsOfMetaClass:",
  56419. protocol: 'accessing',
  56420. fn: function (aClass){
  56421. var self=this;
  56422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56423. return smalltalk.withContext(function($ctx1) {
  56424. //>>excludeEnd("ctx");
  56425. var $1;
  56426. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  56427. return $1;
  56428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56429. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},globals.Exporter)});
  56430. //>>excludeEnd("ctx");
  56431. },
  56432. //>>excludeStart("ide", pragmas.excludeIdeData);
  56433. args: ["aClass"],
  56434. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  56435. referencedClasses: [],
  56436. //>>excludeEnd("ide");
  56437. messageSends: ["ownMethodsOfClass:", "class"]
  56438. }),
  56439. globals.Exporter);
  56440. smalltalk.addClass('AmdExporter', globals.Exporter, ['namespace'], 'Kernel-ImportExport');
  56441. //>>excludeStart("ide", pragmas.excludeIdeData);
  56442. globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  56443. //>>excludeEnd("ide");
  56444. smalltalk.addMethod(
  56445. smalltalk.method({
  56446. selector: "amdNamesOfPackages:",
  56447. protocol: 'private',
  56448. fn: function (anArray){
  56449. var self=this;
  56450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56451. return smalltalk.withContext(function($ctx1) {
  56452. //>>excludeEnd("ctx");
  56453. var $2,$1;
  56454. $1=_st(_st(anArray)._select_((function(each){
  56455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56456. return smalltalk.withContext(function($ctx2) {
  56457. //>>excludeEnd("ctx");
  56458. $2=self._amdNamespaceOfPackage_(each);
  56459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56460. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  56461. //>>excludeEnd("ctx");
  56462. return _st($2)._notNil();
  56463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56465. //>>excludeEnd("ctx");
  56466. })))._collect_((function(each){
  56467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56468. return smalltalk.withContext(function($ctx2) {
  56469. //>>excludeEnd("ctx");
  56470. return _st(_st(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma(_st(each)._name());
  56471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56472. $ctx2.sendIdx[","]=1;
  56473. //>>excludeEnd("ctx");
  56474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56475. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  56476. //>>excludeEnd("ctx");
  56477. }));
  56478. return $1;
  56479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56480. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},globals.AmdExporter)});
  56481. //>>excludeEnd("ctx");
  56482. },
  56483. //>>excludeStart("ide", pragmas.excludeIdeData);
  56484. args: ["anArray"],
  56485. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  56486. referencedClasses: [],
  56487. //>>excludeEnd("ide");
  56488. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  56489. }),
  56490. globals.AmdExporter);
  56491. smalltalk.addMethod(
  56492. smalltalk.method({
  56493. selector: "amdNamespaceOfPackage:",
  56494. protocol: 'private',
  56495. fn: function (aPackage){
  56496. var self=this;
  56497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56498. return smalltalk.withContext(function($ctx1) {
  56499. //>>excludeEnd("ctx");
  56500. var $4,$3,$2,$1;
  56501. $4=_st(aPackage)._transport();
  56502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56503. $ctx1.sendIdx["transport"]=1;
  56504. //>>excludeEnd("ctx");
  56505. $3=_st($4)._type();
  56506. $2=_st($3).__eq("amd");
  56507. if(smalltalk.assert($2)){
  56508. $1=_st(_st(aPackage)._transport())._namespace();
  56509. } else {
  56510. $1=nil;
  56511. };
  56512. return $1;
  56513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56514. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},globals.AmdExporter)});
  56515. //>>excludeEnd("ctx");
  56516. },
  56517. //>>excludeStart("ide", pragmas.excludeIdeData);
  56518. args: ["aPackage"],
  56519. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  56520. referencedClasses: [],
  56521. //>>excludeEnd("ide");
  56522. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  56523. }),
  56524. globals.AmdExporter);
  56525. smalltalk.addMethod(
  56526. smalltalk.method({
  56527. selector: "exportPackageEpilogueOf:on:",
  56528. protocol: 'output',
  56529. fn: function (aPackage,aStream){
  56530. var self=this;
  56531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56532. return smalltalk.withContext(function($ctx1) {
  56533. //>>excludeEnd("ctx");
  56534. var $1;
  56535. _st(aStream)._nextPutAll_("});");
  56536. $1=_st(aStream)._lf();
  56537. return self;
  56538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56539. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)});
  56540. //>>excludeEnd("ctx");
  56541. },
  56542. //>>excludeStart("ide", pragmas.excludeIdeData);
  56543. args: ["aPackage", "aStream"],
  56544. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  56545. referencedClasses: [],
  56546. //>>excludeEnd("ide");
  56547. messageSends: ["nextPutAll:", "lf"]
  56548. }),
  56549. globals.AmdExporter);
  56550. smalltalk.addMethod(
  56551. smalltalk.method({
  56552. selector: "exportPackagePrologueOf:on:",
  56553. protocol: 'output',
  56554. fn: function (aPackage,aStream){
  56555. var self=this;
  56556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56557. return smalltalk.withContext(function($ctx1) {
  56558. //>>excludeEnd("ctx");
  56559. var $1;
  56560. _st(aStream)._nextPutAll_("define(\x22");
  56561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56562. $ctx1.sendIdx["nextPutAll:"]=1;
  56563. //>>excludeEnd("ctx");
  56564. _st(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  56565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56566. $ctx1.sendIdx["nextPutAll:"]=2;
  56567. //>>excludeEnd("ctx");
  56568. _st(aStream)._nextPutAll_("/");
  56569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56570. $ctx1.sendIdx["nextPutAll:"]=3;
  56571. //>>excludeEnd("ctx");
  56572. _st(aStream)._nextPutAll_(_st(aPackage)._name());
  56573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56574. $ctx1.sendIdx["nextPutAll:"]=4;
  56575. //>>excludeEnd("ctx");
  56576. _st(aStream)._nextPutAll_("\x22, ");
  56577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56578. $ctx1.sendIdx["nextPutAll:"]=5;
  56579. //>>excludeEnd("ctx");
  56580. _st(aStream)._nextPutAll_(_st(["amber/boot"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
  56581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56582. $ctx1.sendIdx["nextPutAll:"]=6;
  56583. //>>excludeEnd("ctx");
  56584. _st(aStream)._nextPutAll_(", function($boot){");
  56585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56586. $ctx1.sendIdx["nextPutAll:"]=7;
  56587. //>>excludeEnd("ctx");
  56588. _st(aStream)._lf();
  56589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56590. $ctx1.sendIdx["lf"]=1;
  56591. //>>excludeEnd("ctx");
  56592. _st(aStream)._nextPutAll_("var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;");
  56593. $1=_st(aStream)._lf();
  56594. return self;
  56595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56596. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)});
  56597. //>>excludeEnd("ctx");
  56598. },
  56599. //>>excludeStart("ide", pragmas.excludeIdeData);
  56600. args: ["aPackage", "aStream"],
  56601. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (#('amber/boot'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;\x0a\x09\x09nextPutAll: ', function($boot){';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;';\x0a\x09\x09lf",
  56602. referencedClasses: [],
  56603. //>>excludeEnd("ide");
  56604. messageSends: ["nextPutAll:", "amdNamespaceOfPackage:", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"]
  56605. }),
  56606. globals.AmdExporter);
  56607. smalltalk.addClass('ChunkParser', globals.Object, ['stream', 'last'], 'Kernel-ImportExport');
  56608. //>>excludeStart("ide", pragmas.excludeIdeData);
  56609. globals.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk";
  56610. //>>excludeEnd("ide");
  56611. smalltalk.addMethod(
  56612. smalltalk.method({
  56613. selector: "last",
  56614. protocol: 'accessing',
  56615. fn: function (){
  56616. var self=this;
  56617. var $1;
  56618. $1=self["@last"];
  56619. return $1;
  56620. },
  56621. //>>excludeStart("ide", pragmas.excludeIdeData);
  56622. args: [],
  56623. source: "last\x0a\x09^ last",
  56624. referencedClasses: [],
  56625. //>>excludeEnd("ide");
  56626. messageSends: []
  56627. }),
  56628. globals.ChunkParser);
  56629. smalltalk.addMethod(
  56630. smalltalk.method({
  56631. selector: "nextChunk",
  56632. protocol: 'reading',
  56633. fn: function (){
  56634. var self=this;
  56635. var char,result,chunk;
  56636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56637. return smalltalk.withContext(function($ctx1) {
  56638. //>>excludeEnd("ctx");
  56639. var $1,$2,$3,$4;
  56640. var $early={};
  56641. try {
  56642. result=""._writeStream();
  56643. _st((function(){
  56644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56645. return smalltalk.withContext(function($ctx2) {
  56646. //>>excludeEnd("ctx");
  56647. char=_st(self["@stream"])._next();
  56648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56649. $ctx2.sendIdx["next"]=1;
  56650. //>>excludeEnd("ctx");
  56651. char;
  56652. return _st(char)._notNil();
  56653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56655. //>>excludeEnd("ctx");
  56656. }))._whileTrue_((function(){
  56657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56658. return smalltalk.withContext(function($ctx2) {
  56659. //>>excludeEnd("ctx");
  56660. $1=_st(char).__eq("!");
  56661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56662. $ctx2.sendIdx["="]=1;
  56663. //>>excludeEnd("ctx");
  56664. if(smalltalk.assert($1)){
  56665. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  56666. if(smalltalk.assert($2)){
  56667. _st(self["@stream"])._next();
  56668. } else {
  56669. self["@last"]=_st(_st(result)._contents())._trimBoth();
  56670. $3=self["@last"];
  56671. throw $early=[$3];
  56672. };
  56673. };
  56674. return _st(result)._nextPut_(char);
  56675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56677. //>>excludeEnd("ctx");
  56678. }));
  56679. self["@last"]=nil;
  56680. $4=self["@last"];
  56681. return $4;
  56682. }
  56683. catch(e) {if(e===$early)return e[0]; throw e}
  56684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56685. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},globals.ChunkParser)});
  56686. //>>excludeEnd("ctx");
  56687. },
  56688. //>>excludeStart("ide", pragmas.excludeIdeData);
  56689. args: [],
  56690. source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[ char := stream next.\x0a\x09\x09char notNil ] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [ stream next \x22skipping the escape double\x22 ]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22",
  56691. referencedClasses: [],
  56692. //>>excludeEnd("ide");
  56693. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  56694. }),
  56695. globals.ChunkParser);
  56696. smalltalk.addMethod(
  56697. smalltalk.method({
  56698. selector: "stream:",
  56699. protocol: 'accessing',
  56700. fn: function (aStream){
  56701. var self=this;
  56702. self["@stream"]=aStream;
  56703. return self;
  56704. },
  56705. //>>excludeStart("ide", pragmas.excludeIdeData);
  56706. args: ["aStream"],
  56707. source: "stream: aStream\x0a\x09stream := aStream",
  56708. referencedClasses: [],
  56709. //>>excludeEnd("ide");
  56710. messageSends: []
  56711. }),
  56712. globals.ChunkParser);
  56713. smalltalk.addMethod(
  56714. smalltalk.method({
  56715. selector: "on:",
  56716. protocol: 'instance creation',
  56717. fn: function (aStream){
  56718. var self=this;
  56719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56720. return smalltalk.withContext(function($ctx1) {
  56721. //>>excludeEnd("ctx");
  56722. var $1;
  56723. $1=_st(self._new())._stream_(aStream);
  56724. return $1;
  56725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56726. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},globals.ChunkParser.klass)});
  56727. //>>excludeEnd("ctx");
  56728. },
  56729. //>>excludeStart("ide", pragmas.excludeIdeData);
  56730. args: ["aStream"],
  56731. source: "on: aStream\x0a\x09^ self new stream: aStream",
  56732. referencedClasses: [],
  56733. //>>excludeEnd("ide");
  56734. messageSends: ["stream:", "new"]
  56735. }),
  56736. globals.ChunkParser.klass);
  56737. smalltalk.addClass('ExportMethodProtocol', globals.Object, ['name', 'theClass'], 'Kernel-ImportExport');
  56738. //>>excludeStart("ide", pragmas.excludeIdeData);
  56739. globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
  56740. //>>excludeEnd("ide");
  56741. smalltalk.addMethod(
  56742. smalltalk.method({
  56743. selector: "methods",
  56744. protocol: 'accessing',
  56745. fn: function (){
  56746. var self=this;
  56747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56748. return smalltalk.withContext(function($ctx1) {
  56749. //>>excludeEnd("ctx");
  56750. var $2,$1;
  56751. $1=_st(_st(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  56752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56753. return smalltalk.withContext(function($ctx2) {
  56754. //>>excludeEnd("ctx");
  56755. $2=_st(a)._selector();
  56756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56757. $ctx2.sendIdx["selector"]=1;
  56758. //>>excludeEnd("ctx");
  56759. return _st($2).__lt_eq(_st(b)._selector());
  56760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56761. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  56762. //>>excludeEnd("ctx");
  56763. }));
  56764. return $1;
  56765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56766. }, function($ctx1) {$ctx1.fill(self,"methods",{},globals.ExportMethodProtocol)});
  56767. //>>excludeEnd("ctx");
  56768. },
  56769. //>>excludeStart("ide", pragmas.excludeIdeData);
  56770. args: [],
  56771. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  56772. referencedClasses: [],
  56773. //>>excludeEnd("ide");
  56774. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  56775. }),
  56776. globals.ExportMethodProtocol);
  56777. smalltalk.addMethod(
  56778. smalltalk.method({
  56779. selector: "name",
  56780. protocol: 'accessing',
  56781. fn: function (){
  56782. var self=this;
  56783. var $1;
  56784. $1=self["@name"];
  56785. return $1;
  56786. },
  56787. //>>excludeStart("ide", pragmas.excludeIdeData);
  56788. args: [],
  56789. source: "name\x0a\x09^ name",
  56790. referencedClasses: [],
  56791. //>>excludeEnd("ide");
  56792. messageSends: []
  56793. }),
  56794. globals.ExportMethodProtocol);
  56795. smalltalk.addMethod(
  56796. smalltalk.method({
  56797. selector: "name:",
  56798. protocol: 'accessing',
  56799. fn: function (aString){
  56800. var self=this;
  56801. self["@name"]=aString;
  56802. return self;
  56803. },
  56804. //>>excludeStart("ide", pragmas.excludeIdeData);
  56805. args: ["aString"],
  56806. source: "name: aString\x0a\x09name := aString",
  56807. referencedClasses: [],
  56808. //>>excludeEnd("ide");
  56809. messageSends: []
  56810. }),
  56811. globals.ExportMethodProtocol);
  56812. smalltalk.addMethod(
  56813. smalltalk.method({
  56814. selector: "theClass",
  56815. protocol: 'accessing',
  56816. fn: function (){
  56817. var self=this;
  56818. var $1;
  56819. $1=self["@theClass"];
  56820. return $1;
  56821. },
  56822. //>>excludeStart("ide", pragmas.excludeIdeData);
  56823. args: [],
  56824. source: "theClass\x0a\x09^ theClass",
  56825. referencedClasses: [],
  56826. //>>excludeEnd("ide");
  56827. messageSends: []
  56828. }),
  56829. globals.ExportMethodProtocol);
  56830. smalltalk.addMethod(
  56831. smalltalk.method({
  56832. selector: "theClass:",
  56833. protocol: 'accessing',
  56834. fn: function (aClass){
  56835. var self=this;
  56836. self["@theClass"]=aClass;
  56837. return self;
  56838. },
  56839. //>>excludeStart("ide", pragmas.excludeIdeData);
  56840. args: ["aClass"],
  56841. source: "theClass: aClass\x0a\x09theClass := aClass",
  56842. referencedClasses: [],
  56843. //>>excludeEnd("ide");
  56844. messageSends: []
  56845. }),
  56846. globals.ExportMethodProtocol);
  56847. smalltalk.addMethod(
  56848. smalltalk.method({
  56849. selector: "name:theClass:",
  56850. protocol: 'instance creation',
  56851. fn: function (aString,aClass){
  56852. var self=this;
  56853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56854. return smalltalk.withContext(function($ctx1) {
  56855. //>>excludeEnd("ctx");
  56856. var $2,$3,$1;
  56857. $2=self._new();
  56858. _st($2)._name_(aString);
  56859. _st($2)._theClass_(aClass);
  56860. $3=_st($2)._yourself();
  56861. $1=$3;
  56862. return $1;
  56863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56864. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},globals.ExportMethodProtocol.klass)});
  56865. //>>excludeEnd("ctx");
  56866. },
  56867. //>>excludeStart("ide", pragmas.excludeIdeData);
  56868. args: ["aString", "aClass"],
  56869. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  56870. referencedClasses: [],
  56871. //>>excludeEnd("ide");
  56872. messageSends: ["name:", "new", "theClass:", "yourself"]
  56873. }),
  56874. globals.ExportMethodProtocol.klass);
  56875. smalltalk.addClass('Importer', globals.Object, ['lastSection', 'lastChunk'], 'Kernel-ImportExport');
  56876. //>>excludeStart("ide", pragmas.excludeIdeData);
  56877. globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  56878. //>>excludeEnd("ide");
  56879. smalltalk.addMethod(
  56880. smalltalk.method({
  56881. selector: "import:",
  56882. protocol: 'fileIn',
  56883. fn: function (aStream){
  56884. var self=this;
  56885. var chunk,result,parser,lastEmpty;
  56886. function $ChunkParser(){return globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  56887. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  56888. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  56889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56890. return smalltalk.withContext(function($ctx1) {
  56891. //>>excludeEnd("ctx");
  56892. var $1,$2;
  56893. parser=_st($ChunkParser())._on_(aStream);
  56894. lastEmpty=false;
  56895. self["@lastSection"]="n/a, not started";
  56896. self["@lastChunk"]=nil;
  56897. _st((function(){
  56898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56899. return smalltalk.withContext(function($ctx2) {
  56900. //>>excludeEnd("ctx");
  56901. _st((function(){
  56902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56903. return smalltalk.withContext(function($ctx3) {
  56904. //>>excludeEnd("ctx");
  56905. chunk=_st(parser)._nextChunk();
  56906. chunk;
  56907. return _st(chunk)._isNil();
  56908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56909. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56910. //>>excludeEnd("ctx");
  56911. }))._whileFalse_((function(){
  56912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56913. return smalltalk.withContext(function($ctx3) {
  56914. //>>excludeEnd("ctx");
  56915. $1=_st(chunk)._isEmpty();
  56916. if(smalltalk.assert($1)){
  56917. lastEmpty=true;
  56918. return lastEmpty;
  56919. } else {
  56920. self["@lastSection"]=chunk;
  56921. self["@lastSection"];
  56922. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  56923. result;
  56924. $2=lastEmpty;
  56925. if(smalltalk.assert($2)){
  56926. lastEmpty=false;
  56927. lastEmpty;
  56928. return _st(result)._scanFrom_(parser);
  56929. };
  56930. };
  56931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56932. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  56933. //>>excludeEnd("ctx");
  56934. }));
  56935. self["@lastSection"]="n/a, finished";
  56936. return self["@lastSection"];
  56937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56939. //>>excludeEnd("ctx");
  56940. }))._on_do_($Error(),(function(e){
  56941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56942. return smalltalk.withContext(function($ctx2) {
  56943. //>>excludeEnd("ctx");
  56944. self["@lastChunk"]=_st(parser)._last();
  56945. self["@lastChunk"];
  56946. return _st(e)._signal();
  56947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56948. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  56949. //>>excludeEnd("ctx");
  56950. }));
  56951. return self;
  56952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56953. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},globals.Importer)});
  56954. //>>excludeEnd("ctx");
  56955. },
  56956. //>>excludeStart("ide", pragmas.excludeIdeData);
  56957. args: ["aStream"],
  56958. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [ lastEmpty := true ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e signal ].",
  56959. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  56960. //>>excludeEnd("ide");
  56961. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "signal"]
  56962. }),
  56963. globals.Importer);
  56964. smalltalk.addMethod(
  56965. smalltalk.method({
  56966. selector: "lastChunk",
  56967. protocol: 'accessing',
  56968. fn: function (){
  56969. var self=this;
  56970. var $1;
  56971. $1=self["@lastChunk"];
  56972. return $1;
  56973. },
  56974. //>>excludeStart("ide", pragmas.excludeIdeData);
  56975. args: [],
  56976. source: "lastChunk\x0a\x09^ lastChunk",
  56977. referencedClasses: [],
  56978. //>>excludeEnd("ide");
  56979. messageSends: []
  56980. }),
  56981. globals.Importer);
  56982. smalltalk.addMethod(
  56983. smalltalk.method({
  56984. selector: "lastSection",
  56985. protocol: 'accessing',
  56986. fn: function (){
  56987. var self=this;
  56988. var $1;
  56989. $1=self["@lastSection"];
  56990. return $1;
  56991. },
  56992. //>>excludeStart("ide", pragmas.excludeIdeData);
  56993. args: [],
  56994. source: "lastSection\x0a\x09^ lastSection",
  56995. referencedClasses: [],
  56996. //>>excludeEnd("ide");
  56997. messageSends: []
  56998. }),
  56999. globals.Importer);
  57000. smalltalk.addClass('PackageHandler', globals.InterfacingObject, [], 'Kernel-ImportExport');
  57001. //>>excludeStart("ide", pragmas.excludeIdeData);
  57002. globals.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  57003. //>>excludeEnd("ide");
  57004. smalltalk.addMethod(
  57005. smalltalk.method({
  57006. selector: "ajaxPutAt:data:onSuccess:onError:",
  57007. protocol: 'private',
  57008. fn: function (aURL,aString,aBlock,anotherBlock){
  57009. var self=this;
  57010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57011. return smalltalk.withContext(function($ctx1) {
  57012. //>>excludeEnd("ctx");
  57013. self._ajax_(globals.HashedCollection._newFromPairs_(["url",aURL,"type","PUT","data",aString,"contentType","text/plain;charset=UTF-8","success",aBlock,"error",anotherBlock]));
  57014. return self;
  57015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57016. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)});
  57017. //>>excludeEnd("ctx");
  57018. },
  57019. //>>excludeStart("ide", pragmas.excludeIdeData);
  57020. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  57021. source: "ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock\x0a\x09self\x0a\x09\x09ajax: #{\x0a\x09\x09\x09'url' -> aURL.\x0a\x09\x09\x09'type' -> 'PUT'.\x0a\x09\x09\x09'data' -> aString.\x0a\x09\x09\x09'contentType' -> 'text/plain;charset=UTF-8'.\x0a\x09\x09\x09'success' -> aBlock.\x0a\x09\x09\x09'error' -> anotherBlock\x0a\x09\x09}",
  57022. referencedClasses: [],
  57023. //>>excludeEnd("ide");
  57024. messageSends: ["ajax:"]
  57025. }),
  57026. globals.PackageHandler);
  57027. smalltalk.addMethod(
  57028. smalltalk.method({
  57029. selector: "chunkContentsFor:",
  57030. protocol: 'accessing',
  57031. fn: function (aPackage){
  57032. var self=this;
  57033. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  57034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57035. return smalltalk.withContext(function($ctx1) {
  57036. //>>excludeEnd("ctx");
  57037. var $1;
  57038. $1=_st($String())._streamContents_((function(str){
  57039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57040. return smalltalk.withContext(function($ctx2) {
  57041. //>>excludeEnd("ctx");
  57042. return _st(self._chunkExporter())._exportPackage_on_(aPackage,str);
  57043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57044. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  57045. //>>excludeEnd("ctx");
  57046. }));
  57047. return $1;
  57048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57049. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},globals.PackageHandler)});
  57050. //>>excludeEnd("ctx");
  57051. },
  57052. //>>excludeStart("ide", pragmas.excludeIdeData);
  57053. args: ["aPackage"],
  57054. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  57055. referencedClasses: ["String"],
  57056. //>>excludeEnd("ide");
  57057. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  57058. }),
  57059. globals.PackageHandler);
  57060. smalltalk.addMethod(
  57061. smalltalk.method({
  57062. selector: "chunkExporter",
  57063. protocol: 'factory',
  57064. fn: function (){
  57065. var self=this;
  57066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57067. return smalltalk.withContext(function($ctx1) {
  57068. //>>excludeEnd("ctx");
  57069. var $1;
  57070. $1=_st(self._chunkExporterClass())._new();
  57071. return $1;
  57072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57073. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},globals.PackageHandler)});
  57074. //>>excludeEnd("ctx");
  57075. },
  57076. //>>excludeStart("ide", pragmas.excludeIdeData);
  57077. args: [],
  57078. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  57079. referencedClasses: [],
  57080. //>>excludeEnd("ide");
  57081. messageSends: ["new", "chunkExporterClass"]
  57082. }),
  57083. globals.PackageHandler);
  57084. smalltalk.addMethod(
  57085. smalltalk.method({
  57086. selector: "chunkExporterClass",
  57087. protocol: 'accessing',
  57088. fn: function (){
  57089. var self=this;
  57090. function $ChunkExporter(){return globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  57091. return $ChunkExporter();
  57092. },
  57093. //>>excludeStart("ide", pragmas.excludeIdeData);
  57094. args: [],
  57095. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  57096. referencedClasses: ["ChunkExporter"],
  57097. //>>excludeEnd("ide");
  57098. messageSends: []
  57099. }),
  57100. globals.PackageHandler);
  57101. smalltalk.addMethod(
  57102. smalltalk.method({
  57103. selector: "commit:",
  57104. protocol: 'committing',
  57105. fn: function (aPackage){
  57106. var self=this;
  57107. function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  57108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57109. return smalltalk.withContext(function($ctx1) {
  57110. //>>excludeEnd("ctx");
  57111. var $1,$2,$3,$4;
  57112. self._commit_onSuccess_onError_(aPackage,(function(){
  57113. }),(function(error){
  57114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57115. return smalltalk.withContext(function($ctx2) {
  57116. //>>excludeEnd("ctx");
  57117. $1=_st($PackageCommitError())._new();
  57118. $2=$1;
  57119. $3=_st("Commiting failed with reason: \x22".__comma(_st(error)._responseText())).__comma("\x22");
  57120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57121. $ctx2.sendIdx[","]=1;
  57122. //>>excludeEnd("ctx");
  57123. _st($2)._messageText_($3);
  57124. $4=_st($1)._signal();
  57125. return $4;
  57126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57127. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57128. //>>excludeEnd("ctx");
  57129. }));
  57130. return self;
  57131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57132. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},globals.PackageHandler)});
  57133. //>>excludeEnd("ctx");
  57134. },
  57135. //>>excludeStart("ide", pragmas.excludeIdeData);
  57136. args: ["aPackage"],
  57137. source: "commit: aPackage\x0a\x09self \x0a\x09\x09commit: aPackage\x0a\x09\x09onSuccess: []\x0a\x09\x09onError: [ :error |\x0a\x09\x09\x09PackageCommitError new\x0a\x09\x09\x09\x09messageText: 'Commiting failed with reason: \x22' , (error responseText) , '\x22';\x0a\x09\x09\x09\x09signal ]",
  57138. referencedClasses: ["PackageCommitError"],
  57139. //>>excludeEnd("ide");
  57140. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  57141. }),
  57142. globals.PackageHandler);
  57143. smalltalk.addMethod(
  57144. smalltalk.method({
  57145. selector: "commit:onSuccess:onError:",
  57146. protocol: 'committing',
  57147. fn: function (aPackage,aBlock,anotherBlock){
  57148. var self=this;
  57149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57150. return smalltalk.withContext(function($ctx1) {
  57151. //>>excludeEnd("ctx");
  57152. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  57153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57154. return smalltalk.withContext(function($ctx2) {
  57155. //>>excludeEnd("ctx");
  57156. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  57157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57158. return smalltalk.withContext(function($ctx3) {
  57159. //>>excludeEnd("ctx");
  57160. _st(aPackage)._beClean();
  57161. return _st(aBlock)._value();
  57162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57163. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57164. //>>excludeEnd("ctx");
  57165. }),anotherBlock);
  57166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57168. //>>excludeEnd("ctx");
  57169. }),anotherBlock);
  57170. return self;
  57171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57172. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)});
  57173. //>>excludeEnd("ctx");
  57174. },
  57175. //>>excludeStart("ide", pragmas.excludeIdeData);
  57176. args: ["aPackage", "aBlock", "anotherBlock"],
  57177. source: "commit: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09commitJsFileFor: aPackage \x0a\x09\x09onSuccess: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09commitStFileFor: aPackage \x0a\x09\x09\x09\x09onSuccess: [ aPackage beClean. aBlock value ]\x0a\x09\x09\x09\x09onError: anotherBlock ] \x0a\x09\x09onError: anotherBlock",
  57178. referencedClasses: [],
  57179. //>>excludeEnd("ide");
  57180. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  57181. }),
  57182. globals.PackageHandler);
  57183. smalltalk.addMethod(
  57184. smalltalk.method({
  57185. selector: "commitJsFileFor:onSuccess:onError:",
  57186. protocol: 'committing',
  57187. fn: function (aPackage,aBlock,anotherBlock){
  57188. var self=this;
  57189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57190. return smalltalk.withContext(function($ctx1) {
  57191. //>>excludeEnd("ctx");
  57192. var $2,$1;
  57193. $2=_st(_st(self._commitPathJsFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  57194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57195. $ctx1.sendIdx[","]=2;
  57196. //>>excludeEnd("ctx");
  57197. $1=_st($2).__comma(".js");
  57198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57199. $ctx1.sendIdx[","]=1;
  57200. //>>excludeEnd("ctx");
  57201. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  57202. return self;
  57203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57204. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)});
  57205. //>>excludeEnd("ctx");
  57206. },
  57207. //>>excludeStart("ide", pragmas.excludeIdeData);
  57208. args: ["aPackage", "aBlock", "anotherBlock"],
  57209. source: "commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  57210. referencedClasses: [],
  57211. //>>excludeEnd("ide");
  57212. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  57213. }),
  57214. globals.PackageHandler);
  57215. smalltalk.addMethod(
  57216. smalltalk.method({
  57217. selector: "commitPathJsFor:",
  57218. protocol: 'accessing',
  57219. fn: function (aPackage){
  57220. var self=this;
  57221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57222. return smalltalk.withContext(function($ctx1) {
  57223. //>>excludeEnd("ctx");
  57224. self._subclassResponsibility();
  57225. return self;
  57226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57227. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.PackageHandler)});
  57228. //>>excludeEnd("ctx");
  57229. },
  57230. //>>excludeStart("ide", pragmas.excludeIdeData);
  57231. args: ["aPackage"],
  57232. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  57233. referencedClasses: [],
  57234. //>>excludeEnd("ide");
  57235. messageSends: ["subclassResponsibility"]
  57236. }),
  57237. globals.PackageHandler);
  57238. smalltalk.addMethod(
  57239. smalltalk.method({
  57240. selector: "commitPathStFor:",
  57241. protocol: 'accessing',
  57242. fn: function (aPackage){
  57243. var self=this;
  57244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57245. return smalltalk.withContext(function($ctx1) {
  57246. //>>excludeEnd("ctx");
  57247. self._subclassResponsibility();
  57248. return self;
  57249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57250. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},globals.PackageHandler)});
  57251. //>>excludeEnd("ctx");
  57252. },
  57253. //>>excludeStart("ide", pragmas.excludeIdeData);
  57254. args: ["aPackage"],
  57255. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  57256. referencedClasses: [],
  57257. //>>excludeEnd("ide");
  57258. messageSends: ["subclassResponsibility"]
  57259. }),
  57260. globals.PackageHandler);
  57261. smalltalk.addMethod(
  57262. smalltalk.method({
  57263. selector: "commitStFileFor:onSuccess:onError:",
  57264. protocol: 'committing',
  57265. fn: function (aPackage,aBlock,anotherBlock){
  57266. var self=this;
  57267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57268. return smalltalk.withContext(function($ctx1) {
  57269. //>>excludeEnd("ctx");
  57270. var $2,$1;
  57271. $2=_st(_st(self._commitPathStFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  57272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57273. $ctx1.sendIdx[","]=2;
  57274. //>>excludeEnd("ctx");
  57275. $1=_st($2).__comma(".st");
  57276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57277. $ctx1.sendIdx[","]=1;
  57278. //>>excludeEnd("ctx");
  57279. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  57280. return self;
  57281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57282. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)});
  57283. //>>excludeEnd("ctx");
  57284. },
  57285. //>>excludeStart("ide", pragmas.excludeIdeData);
  57286. args: ["aPackage", "aBlock", "anotherBlock"],
  57287. source: "commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  57288. referencedClasses: [],
  57289. //>>excludeEnd("ide");
  57290. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  57291. }),
  57292. globals.PackageHandler);
  57293. smalltalk.addMethod(
  57294. smalltalk.method({
  57295. selector: "contentsFor:",
  57296. protocol: 'accessing',
  57297. fn: function (aPackage){
  57298. var self=this;
  57299. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  57300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57301. return smalltalk.withContext(function($ctx1) {
  57302. //>>excludeEnd("ctx");
  57303. var $1;
  57304. $1=_st($String())._streamContents_((function(str){
  57305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57306. return smalltalk.withContext(function($ctx2) {
  57307. //>>excludeEnd("ctx");
  57308. return _st(self._exporter())._exportPackage_on_(aPackage,str);
  57309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57310. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  57311. //>>excludeEnd("ctx");
  57312. }));
  57313. return $1;
  57314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57315. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},globals.PackageHandler)});
  57316. //>>excludeEnd("ctx");
  57317. },
  57318. //>>excludeStart("ide", pragmas.excludeIdeData);
  57319. args: ["aPackage"],
  57320. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  57321. referencedClasses: ["String"],
  57322. //>>excludeEnd("ide");
  57323. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  57324. }),
  57325. globals.PackageHandler);
  57326. smalltalk.addMethod(
  57327. smalltalk.method({
  57328. selector: "exporter",
  57329. protocol: 'factory',
  57330. fn: function (){
  57331. var self=this;
  57332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57333. return smalltalk.withContext(function($ctx1) {
  57334. //>>excludeEnd("ctx");
  57335. var $1;
  57336. $1=_st(self._exporterClass())._new();
  57337. return $1;
  57338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57339. }, function($ctx1) {$ctx1.fill(self,"exporter",{},globals.PackageHandler)});
  57340. //>>excludeEnd("ctx");
  57341. },
  57342. //>>excludeStart("ide", pragmas.excludeIdeData);
  57343. args: [],
  57344. source: "exporter\x0a\x09^ self exporterClass new",
  57345. referencedClasses: [],
  57346. //>>excludeEnd("ide");
  57347. messageSends: ["new", "exporterClass"]
  57348. }),
  57349. globals.PackageHandler);
  57350. smalltalk.addMethod(
  57351. smalltalk.method({
  57352. selector: "exporterClass",
  57353. protocol: 'accessing',
  57354. fn: function (){
  57355. var self=this;
  57356. function $Exporter(){return globals.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  57357. return $Exporter();
  57358. },
  57359. //>>excludeStart("ide", pragmas.excludeIdeData);
  57360. args: [],
  57361. source: "exporterClass\x0a\x09^ Exporter",
  57362. referencedClasses: ["Exporter"],
  57363. //>>excludeEnd("ide");
  57364. messageSends: []
  57365. }),
  57366. globals.PackageHandler);
  57367. smalltalk.addMethod(
  57368. smalltalk.method({
  57369. selector: "load:",
  57370. protocol: 'loading',
  57371. fn: function (aPackage){
  57372. var self=this;
  57373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57374. return smalltalk.withContext(function($ctx1) {
  57375. //>>excludeEnd("ctx");
  57376. self._subclassResponsibility();
  57377. return self;
  57378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57379. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.PackageHandler)});
  57380. //>>excludeEnd("ctx");
  57381. },
  57382. //>>excludeStart("ide", pragmas.excludeIdeData);
  57383. args: ["aPackage"],
  57384. source: "load: aPackage\x0a\x09self subclassResponsibility",
  57385. referencedClasses: [],
  57386. //>>excludeEnd("ide");
  57387. messageSends: ["subclassResponsibility"]
  57388. }),
  57389. globals.PackageHandler);
  57390. smalltalk.addMethod(
  57391. smalltalk.method({
  57392. selector: "onCommitError:",
  57393. protocol: 'error handling',
  57394. fn: function (anError){
  57395. var self=this;
  57396. function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  57397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57398. return smalltalk.withContext(function($ctx1) {
  57399. //>>excludeEnd("ctx");
  57400. var $1,$2,$3,$4;
  57401. $1=_st($PackageCommitError())._new();
  57402. $2=$1;
  57403. $3=_st("Commiting failed with reason: \x22".__comma(_st(anError)._responseText())).__comma("\x22");
  57404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57405. $ctx1.sendIdx[","]=1;
  57406. //>>excludeEnd("ctx");
  57407. _st($2)._messageText_($3);
  57408. $4=_st($1)._signal();
  57409. return self;
  57410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57411. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},globals.PackageHandler)});
  57412. //>>excludeEnd("ctx");
  57413. },
  57414. //>>excludeStart("ide", pragmas.excludeIdeData);
  57415. args: ["anError"],
  57416. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  57417. referencedClasses: ["PackageCommitError"],
  57418. //>>excludeEnd("ide");
  57419. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  57420. }),
  57421. globals.PackageHandler);
  57422. smalltalk.addClass('AmdPackageHandler', globals.PackageHandler, [], 'Kernel-ImportExport');
  57423. //>>excludeStart("ide", pragmas.excludeIdeData);
  57424. globals.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  57425. //>>excludeEnd("ide");
  57426. smalltalk.addMethod(
  57427. smalltalk.method({
  57428. selector: "commitPathJsFor:",
  57429. protocol: 'accessing',
  57430. fn: function (aPackage){
  57431. var self=this;
  57432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57433. return smalltalk.withContext(function($ctx1) {
  57434. //>>excludeEnd("ctx");
  57435. var $1;
  57436. $1=self._toUrl_(self._namespaceFor_(aPackage));
  57437. return $1;
  57438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57439. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.AmdPackageHandler)});
  57440. //>>excludeEnd("ctx");
  57441. },
  57442. //>>excludeStart("ide", pragmas.excludeIdeData);
  57443. args: ["aPackage"],
  57444. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  57445. referencedClasses: [],
  57446. //>>excludeEnd("ide");
  57447. messageSends: ["toUrl:", "namespaceFor:"]
  57448. }),
  57449. globals.AmdPackageHandler);
  57450. smalltalk.addMethod(
  57451. smalltalk.method({
  57452. selector: "commitPathStFor:",
  57453. protocol: 'accessing',
  57454. fn: function (aPackage){
  57455. var self=this;
  57456. var path,pathWithout;
  57457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57458. return smalltalk.withContext(function($ctx1) {
  57459. //>>excludeEnd("ctx");
  57460. var $1,$3,$2;
  57461. $1=_st(self._namespaceFor_(aPackage)).__comma("/_source");
  57462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57463. $ctx1.sendIdx[","]=1;
  57464. //>>excludeEnd("ctx");
  57465. path=self._toUrl_($1);
  57466. pathWithout=self._commitPathJsFor_(aPackage);
  57467. $3=_st(path).__eq(_st(pathWithout).__comma("/_source"));
  57468. if(smalltalk.assert($3)){
  57469. $2=pathWithout;
  57470. } else {
  57471. $2=path;
  57472. };
  57473. return $2;
  57474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57475. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},globals.AmdPackageHandler)});
  57476. //>>excludeEnd("ctx");
  57477. },
  57478. //>>excludeStart("ide", pragmas.excludeIdeData);
  57479. args: ["aPackage"],
  57480. source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]",
  57481. referencedClasses: [],
  57482. //>>excludeEnd("ide");
  57483. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  57484. }),
  57485. globals.AmdPackageHandler);
  57486. smalltalk.addMethod(
  57487. smalltalk.method({
  57488. selector: "exporterClass",
  57489. protocol: 'accessing',
  57490. fn: function (){
  57491. var self=this;
  57492. function $AmdExporter(){return globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  57493. return $AmdExporter();
  57494. },
  57495. //>>excludeStart("ide", pragmas.excludeIdeData);
  57496. args: [],
  57497. source: "exporterClass\x0a\x09^ AmdExporter",
  57498. referencedClasses: ["AmdExporter"],
  57499. //>>excludeEnd("ide");
  57500. messageSends: []
  57501. }),
  57502. globals.AmdPackageHandler);
  57503. smalltalk.addMethod(
  57504. smalltalk.method({
  57505. selector: "load:",
  57506. protocol: 'loading',
  57507. fn: function (aPackage){
  57508. var self=this;
  57509. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  57510. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  57511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57512. return smalltalk.withContext(function($ctx1) {
  57513. //>>excludeEnd("ctx");
  57514. var $1,$3,$2,$receiver;
  57515. $1=_st($Smalltalk())._amdRequire();
  57516. if(($receiver = $1) == null || $receiver.isNil){
  57517. self._error_("AMD loader not present");
  57518. } else {
  57519. var require;
  57520. require=$receiver;
  57521. $3=_st(_st(self._namespaceFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  57522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57523. $ctx1.sendIdx[","]=1;
  57524. //>>excludeEnd("ctx");
  57525. $2=_st($Array())._with_($3);
  57526. _st(require)._value_($2);
  57527. };
  57528. return self;
  57529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57530. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.AmdPackageHandler)});
  57531. //>>excludeEnd("ctx");
  57532. },
  57533. //>>excludeStart("ide", pragmas.excludeIdeData);
  57534. args: ["aPackage"],
  57535. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  57536. referencedClasses: ["Smalltalk", "Array"],
  57537. //>>excludeEnd("ide");
  57538. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  57539. }),
  57540. globals.AmdPackageHandler);
  57541. smalltalk.addMethod(
  57542. smalltalk.method({
  57543. selector: "namespaceFor:",
  57544. protocol: 'committing',
  57545. fn: function (aPackage){
  57546. var self=this;
  57547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57548. return smalltalk.withContext(function($ctx1) {
  57549. //>>excludeEnd("ctx");
  57550. var $1;
  57551. $1=_st(_st(aPackage)._transport())._namespace();
  57552. return $1;
  57553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57554. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},globals.AmdPackageHandler)});
  57555. //>>excludeEnd("ctx");
  57556. },
  57557. //>>excludeStart("ide", pragmas.excludeIdeData);
  57558. args: ["aPackage"],
  57559. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  57560. referencedClasses: [],
  57561. //>>excludeEnd("ide");
  57562. messageSends: ["namespace", "transport"]
  57563. }),
  57564. globals.AmdPackageHandler);
  57565. smalltalk.addMethod(
  57566. smalltalk.method({
  57567. selector: "toUrl:",
  57568. protocol: 'private',
  57569. fn: function (aString){
  57570. var self=this;
  57571. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  57572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57573. return smalltalk.withContext(function($ctx1) {
  57574. //>>excludeEnd("ctx");
  57575. var $2,$1,$receiver;
  57576. $2=_st($Smalltalk())._amdRequire();
  57577. if(($receiver = $2) == null || $receiver.isNil){
  57578. $1=self._error_("AMD loader not present");
  57579. } else {
  57580. var require;
  57581. require=$receiver;
  57582. $1=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  57583. };
  57584. return $1;
  57585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57586. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},globals.AmdPackageHandler)});
  57587. //>>excludeEnd("ctx");
  57588. },
  57589. //>>excludeStart("ide", pragmas.excludeIdeData);
  57590. args: ["aString"],
  57591. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  57592. referencedClasses: ["Smalltalk"],
  57593. //>>excludeEnd("ide");
  57594. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  57595. }),
  57596. globals.AmdPackageHandler);
  57597. smalltalk.addMethod(
  57598. smalltalk.method({
  57599. selector: "defaultNamespace",
  57600. protocol: 'commit paths',
  57601. fn: function (){
  57602. var self=this;
  57603. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  57604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57605. return smalltalk.withContext(function($ctx1) {
  57606. //>>excludeEnd("ctx");
  57607. var $1;
  57608. $1=_st($Smalltalk())._defaultAmdNamespace();
  57609. return $1;
  57610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57611. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageHandler.klass)});
  57612. //>>excludeEnd("ctx");
  57613. },
  57614. //>>excludeStart("ide", pragmas.excludeIdeData);
  57615. args: [],
  57616. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  57617. referencedClasses: ["Smalltalk"],
  57618. //>>excludeEnd("ide");
  57619. messageSends: ["defaultAmdNamespace"]
  57620. }),
  57621. globals.AmdPackageHandler.klass);
  57622. smalltalk.addMethod(
  57623. smalltalk.method({
  57624. selector: "defaultNamespace:",
  57625. protocol: 'commit paths',
  57626. fn: function (aString){
  57627. var self=this;
  57628. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  57629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57630. return smalltalk.withContext(function($ctx1) {
  57631. //>>excludeEnd("ctx");
  57632. _st($Smalltalk())._defaultAmdNamespace_(aString);
  57633. return self;
  57634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57635. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},globals.AmdPackageHandler.klass)});
  57636. //>>excludeEnd("ctx");
  57637. },
  57638. //>>excludeStart("ide", pragmas.excludeIdeData);
  57639. args: ["aString"],
  57640. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  57641. referencedClasses: ["Smalltalk"],
  57642. //>>excludeEnd("ide");
  57643. messageSends: ["defaultAmdNamespace:"]
  57644. }),
  57645. globals.AmdPackageHandler.klass);
  57646. smalltalk.addClass('PackageTransport', globals.Object, ['package'], 'Kernel-ImportExport');
  57647. //>>excludeStart("ide", pragmas.excludeIdeData);
  57648. globals.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated.";
  57649. //>>excludeEnd("ide");
  57650. smalltalk.addMethod(
  57651. smalltalk.method({
  57652. selector: "asJSON",
  57653. protocol: 'converting',
  57654. fn: function (){
  57655. var self=this;
  57656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57657. return smalltalk.withContext(function($ctx1) {
  57658. //>>excludeEnd("ctx");
  57659. var $1;
  57660. $1=globals.HashedCollection._newFromPairs_(["type",self._type()]);
  57661. return $1;
  57662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57663. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.PackageTransport)});
  57664. //>>excludeEnd("ctx");
  57665. },
  57666. //>>excludeStart("ide", pragmas.excludeIdeData);
  57667. args: [],
  57668. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  57669. referencedClasses: [],
  57670. //>>excludeEnd("ide");
  57671. messageSends: ["type"]
  57672. }),
  57673. globals.PackageTransport);
  57674. smalltalk.addMethod(
  57675. smalltalk.method({
  57676. selector: "commit",
  57677. protocol: 'committing',
  57678. fn: function (){
  57679. var self=this;
  57680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57681. return smalltalk.withContext(function($ctx1) {
  57682. //>>excludeEnd("ctx");
  57683. _st(self._commitHandler())._commit_(self._package());
  57684. return self;
  57685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57686. }, function($ctx1) {$ctx1.fill(self,"commit",{},globals.PackageTransport)});
  57687. //>>excludeEnd("ctx");
  57688. },
  57689. //>>excludeStart("ide", pragmas.excludeIdeData);
  57690. args: [],
  57691. source: "commit\x0a\x09self commitHandler commit: self package",
  57692. referencedClasses: [],
  57693. //>>excludeEnd("ide");
  57694. messageSends: ["commit:", "commitHandler", "package"]
  57695. }),
  57696. globals.PackageTransport);
  57697. smalltalk.addMethod(
  57698. smalltalk.method({
  57699. selector: "commitHandler",
  57700. protocol: 'factory',
  57701. fn: function (){
  57702. var self=this;
  57703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57704. return smalltalk.withContext(function($ctx1) {
  57705. //>>excludeEnd("ctx");
  57706. var $1;
  57707. $1=_st(self._commitHandlerClass())._new();
  57708. return $1;
  57709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57710. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},globals.PackageTransport)});
  57711. //>>excludeEnd("ctx");
  57712. },
  57713. //>>excludeStart("ide", pragmas.excludeIdeData);
  57714. args: [],
  57715. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  57716. referencedClasses: [],
  57717. //>>excludeEnd("ide");
  57718. messageSends: ["new", "commitHandlerClass"]
  57719. }),
  57720. globals.PackageTransport);
  57721. smalltalk.addMethod(
  57722. smalltalk.method({
  57723. selector: "commitHandlerClass",
  57724. protocol: 'accessing',
  57725. fn: function (){
  57726. var self=this;
  57727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57728. return smalltalk.withContext(function($ctx1) {
  57729. //>>excludeEnd("ctx");
  57730. self._subclassResponsibility();
  57731. return self;
  57732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57733. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},globals.PackageTransport)});
  57734. //>>excludeEnd("ctx");
  57735. },
  57736. //>>excludeStart("ide", pragmas.excludeIdeData);
  57737. args: [],
  57738. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  57739. referencedClasses: [],
  57740. //>>excludeEnd("ide");
  57741. messageSends: ["subclassResponsibility"]
  57742. }),
  57743. globals.PackageTransport);
  57744. smalltalk.addMethod(
  57745. smalltalk.method({
  57746. selector: "commitOnSuccess:onError:",
  57747. protocol: 'committing',
  57748. fn: function (aBlock,anotherBlock){
  57749. var self=this;
  57750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57751. return smalltalk.withContext(function($ctx1) {
  57752. //>>excludeEnd("ctx");
  57753. _st(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  57754. return self;
  57755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57756. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageTransport)});
  57757. //>>excludeEnd("ctx");
  57758. },
  57759. //>>excludeStart("ide", pragmas.excludeIdeData);
  57760. args: ["aBlock", "anotherBlock"],
  57761. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  57762. referencedClasses: [],
  57763. //>>excludeEnd("ide");
  57764. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  57765. }),
  57766. globals.PackageTransport);
  57767. smalltalk.addMethod(
  57768. smalltalk.method({
  57769. selector: "definition",
  57770. protocol: 'accessing',
  57771. fn: function (){
  57772. var self=this;
  57773. return "";
  57774. },
  57775. //>>excludeStart("ide", pragmas.excludeIdeData);
  57776. args: [],
  57777. source: "definition\x0a\x09^ ''",
  57778. referencedClasses: [],
  57779. //>>excludeEnd("ide");
  57780. messageSends: []
  57781. }),
  57782. globals.PackageTransport);
  57783. smalltalk.addMethod(
  57784. smalltalk.method({
  57785. selector: "load",
  57786. protocol: 'loading',
  57787. fn: function (){
  57788. var self=this;
  57789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57790. return smalltalk.withContext(function($ctx1) {
  57791. //>>excludeEnd("ctx");
  57792. _st(self._commitHandler())._load_(self._package());
  57793. return self;
  57794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57795. }, function($ctx1) {$ctx1.fill(self,"load",{},globals.PackageTransport)});
  57796. //>>excludeEnd("ctx");
  57797. },
  57798. //>>excludeStart("ide", pragmas.excludeIdeData);
  57799. args: [],
  57800. source: "load\x0a\x09self commitHandler load: self package",
  57801. referencedClasses: [],
  57802. //>>excludeEnd("ide");
  57803. messageSends: ["load:", "commitHandler", "package"]
  57804. }),
  57805. globals.PackageTransport);
  57806. smalltalk.addMethod(
  57807. smalltalk.method({
  57808. selector: "package",
  57809. protocol: 'accessing',
  57810. fn: function (){
  57811. var self=this;
  57812. var $1;
  57813. $1=self["@package"];
  57814. return $1;
  57815. },
  57816. //>>excludeStart("ide", pragmas.excludeIdeData);
  57817. args: [],
  57818. source: "package\x0a\x09^ package",
  57819. referencedClasses: [],
  57820. //>>excludeEnd("ide");
  57821. messageSends: []
  57822. }),
  57823. globals.PackageTransport);
  57824. smalltalk.addMethod(
  57825. smalltalk.method({
  57826. selector: "package:",
  57827. protocol: 'accessing',
  57828. fn: function (aPackage){
  57829. var self=this;
  57830. self["@package"]=aPackage;
  57831. return self;
  57832. },
  57833. //>>excludeStart("ide", pragmas.excludeIdeData);
  57834. args: ["aPackage"],
  57835. source: "package: aPackage\x0a\x09package := aPackage",
  57836. referencedClasses: [],
  57837. //>>excludeEnd("ide");
  57838. messageSends: []
  57839. }),
  57840. globals.PackageTransport);
  57841. smalltalk.addMethod(
  57842. smalltalk.method({
  57843. selector: "setupFromJson:",
  57844. protocol: 'initialization',
  57845. fn: function (anObject){
  57846. var self=this;
  57847. return self;
  57848. },
  57849. //>>excludeStart("ide", pragmas.excludeIdeData);
  57850. args: ["anObject"],
  57851. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  57852. referencedClasses: [],
  57853. //>>excludeEnd("ide");
  57854. messageSends: []
  57855. }),
  57856. globals.PackageTransport);
  57857. smalltalk.addMethod(
  57858. smalltalk.method({
  57859. selector: "type",
  57860. protocol: 'accessing',
  57861. fn: function (){
  57862. var self=this;
  57863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57864. return smalltalk.withContext(function($ctx1) {
  57865. //>>excludeEnd("ctx");
  57866. var $1;
  57867. $1=_st(self._class())._type();
  57868. return $1;
  57869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57870. }, function($ctx1) {$ctx1.fill(self,"type",{},globals.PackageTransport)});
  57871. //>>excludeEnd("ctx");
  57872. },
  57873. //>>excludeStart("ide", pragmas.excludeIdeData);
  57874. args: [],
  57875. source: "type\x0a\x09^ self class type",
  57876. referencedClasses: [],
  57877. //>>excludeEnd("ide");
  57878. messageSends: ["type", "class"]
  57879. }),
  57880. globals.PackageTransport);
  57881. globals.PackageTransport.klass.iVarNames = ['registry'];
  57882. smalltalk.addMethod(
  57883. smalltalk.method({
  57884. selector: "classRegisteredFor:",
  57885. protocol: 'accessing',
  57886. fn: function (aString){
  57887. var self=this;
  57888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57889. return smalltalk.withContext(function($ctx1) {
  57890. //>>excludeEnd("ctx");
  57891. var $1;
  57892. $1=_st(self["@registry"])._at_(aString);
  57893. return $1;
  57894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57895. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},globals.PackageTransport.klass)});
  57896. //>>excludeEnd("ctx");
  57897. },
  57898. //>>excludeStart("ide", pragmas.excludeIdeData);
  57899. args: ["aString"],
  57900. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  57901. referencedClasses: [],
  57902. //>>excludeEnd("ide");
  57903. messageSends: ["at:"]
  57904. }),
  57905. globals.PackageTransport.klass);
  57906. smalltalk.addMethod(
  57907. smalltalk.method({
  57908. selector: "defaultType",
  57909. protocol: 'accessing',
  57910. fn: function (){
  57911. var self=this;
  57912. function $AmdPackageTransport(){return globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  57913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57914. return smalltalk.withContext(function($ctx1) {
  57915. //>>excludeEnd("ctx");
  57916. var $1;
  57917. $1=_st($AmdPackageTransport())._type();
  57918. return $1;
  57919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57920. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},globals.PackageTransport.klass)});
  57921. //>>excludeEnd("ctx");
  57922. },
  57923. //>>excludeStart("ide", pragmas.excludeIdeData);
  57924. args: [],
  57925. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  57926. referencedClasses: ["AmdPackageTransport"],
  57927. //>>excludeEnd("ide");
  57928. messageSends: ["type"]
  57929. }),
  57930. globals.PackageTransport.klass);
  57931. smalltalk.addMethod(
  57932. smalltalk.method({
  57933. selector: "for:",
  57934. protocol: 'instance creation',
  57935. fn: function (aString){
  57936. var self=this;
  57937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57938. return smalltalk.withContext(function($ctx1) {
  57939. //>>excludeEnd("ctx");
  57940. var $1;
  57941. $1=_st(self._classRegisteredFor_(aString))._new();
  57942. return $1;
  57943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57944. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},globals.PackageTransport.klass)});
  57945. //>>excludeEnd("ctx");
  57946. },
  57947. //>>excludeStart("ide", pragmas.excludeIdeData);
  57948. args: ["aString"],
  57949. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  57950. referencedClasses: [],
  57951. //>>excludeEnd("ide");
  57952. messageSends: ["new", "classRegisteredFor:"]
  57953. }),
  57954. globals.PackageTransport.klass);
  57955. smalltalk.addMethod(
  57956. smalltalk.method({
  57957. selector: "fromJson:",
  57958. protocol: 'instance creation',
  57959. fn: function (anObject){
  57960. var self=this;
  57961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57962. return smalltalk.withContext(function($ctx1) {
  57963. //>>excludeEnd("ctx");
  57964. var $1,$3,$4,$2,$receiver;
  57965. if(($receiver = anObject) == null || $receiver.isNil){
  57966. $1=self._for_(self._defaultType());
  57967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57968. $ctx1.sendIdx["for:"]=1;
  57969. //>>excludeEnd("ctx");
  57970. return $1;
  57971. } else {
  57972. anObject;
  57973. };
  57974. $3=self._for_(_st(anObject)._type());
  57975. _st($3)._setupFromJson_(anObject);
  57976. $4=_st($3)._yourself();
  57977. $2=$4;
  57978. return $2;
  57979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57980. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},globals.PackageTransport.klass)});
  57981. //>>excludeEnd("ctx");
  57982. },
  57983. //>>excludeStart("ide", pragmas.excludeIdeData);
  57984. args: ["anObject"],
  57985. source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself",
  57986. referencedClasses: [],
  57987. //>>excludeEnd("ide");
  57988. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  57989. }),
  57990. globals.PackageTransport.klass);
  57991. smalltalk.addMethod(
  57992. smalltalk.method({
  57993. selector: "initialize",
  57994. protocol: 'initialization',
  57995. fn: function (){
  57996. var self=this;
  57997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57998. return smalltalk.withContext(function($ctx1) {
  57999. //>>excludeEnd("ctx");
  58000. (
  58001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58002. $ctx1.supercall = true,
  58003. //>>excludeEnd("ctx");
  58004. globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
  58005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58006. $ctx1.supercall = false;
  58007. //>>excludeEnd("ctx");;
  58008. self["@registry"]=globals.HashedCollection._newFromPairs_([]);
  58009. self._register();
  58010. return self;
  58011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58012. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.PackageTransport.klass)});
  58013. //>>excludeEnd("ctx");
  58014. },
  58015. //>>excludeStart("ide", pragmas.excludeIdeData);
  58016. args: [],
  58017. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.\x0a\x09self register",
  58018. referencedClasses: [],
  58019. //>>excludeEnd("ide");
  58020. messageSends: ["initialize", "register"]
  58021. }),
  58022. globals.PackageTransport.klass);
  58023. smalltalk.addMethod(
  58024. smalltalk.method({
  58025. selector: "register",
  58026. protocol: 'registration',
  58027. fn: function (){
  58028. var self=this;
  58029. function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  58030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58031. return smalltalk.withContext(function($ctx1) {
  58032. //>>excludeEnd("ctx");
  58033. _st($PackageTransport())._register_(self);
  58034. return self;
  58035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58036. }, function($ctx1) {$ctx1.fill(self,"register",{},globals.PackageTransport.klass)});
  58037. //>>excludeEnd("ctx");
  58038. },
  58039. //>>excludeStart("ide", pragmas.excludeIdeData);
  58040. args: [],
  58041. source: "register\x0a\x09PackageTransport register: self",
  58042. referencedClasses: ["PackageTransport"],
  58043. //>>excludeEnd("ide");
  58044. messageSends: ["register:"]
  58045. }),
  58046. globals.PackageTransport.klass);
  58047. smalltalk.addMethod(
  58048. smalltalk.method({
  58049. selector: "register:",
  58050. protocol: 'registration',
  58051. fn: function (aClass){
  58052. var self=this;
  58053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58054. return smalltalk.withContext(function($ctx1) {
  58055. //>>excludeEnd("ctx");
  58056. var $1,$receiver;
  58057. $1=_st(aClass)._type();
  58058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58059. $ctx1.sendIdx["type"]=1;
  58060. //>>excludeEnd("ctx");
  58061. if(($receiver = $1) == null || $receiver.isNil){
  58062. $1;
  58063. } else {
  58064. _st(self["@registry"])._at_put_(_st(aClass)._type(),aClass);
  58065. };
  58066. return self;
  58067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58068. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},globals.PackageTransport.klass)});
  58069. //>>excludeEnd("ctx");
  58070. },
  58071. //>>excludeStart("ide", pragmas.excludeIdeData);
  58072. args: ["aClass"],
  58073. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  58074. referencedClasses: [],
  58075. //>>excludeEnd("ide");
  58076. messageSends: ["ifNotNil:", "type", "at:put:"]
  58077. }),
  58078. globals.PackageTransport.klass);
  58079. smalltalk.addMethod(
  58080. smalltalk.method({
  58081. selector: "type",
  58082. protocol: 'accessing',
  58083. fn: function (){
  58084. var self=this;
  58085. return nil;
  58086. },
  58087. //>>excludeStart("ide", pragmas.excludeIdeData);
  58088. args: [],
  58089. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  58090. referencedClasses: [],
  58091. //>>excludeEnd("ide");
  58092. messageSends: []
  58093. }),
  58094. globals.PackageTransport.klass);
  58095. smalltalk.addClass('AmdPackageTransport', globals.PackageTransport, ['namespace'], 'Kernel-ImportExport');
  58096. //>>excludeStart("ide", pragmas.excludeIdeData);
  58097. globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  58098. //>>excludeEnd("ide");
  58099. smalltalk.addMethod(
  58100. smalltalk.method({
  58101. selector: "asJSON",
  58102. protocol: 'converting',
  58103. fn: function (){
  58104. var self=this;
  58105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58106. return smalltalk.withContext(function($ctx1) {
  58107. //>>excludeEnd("ctx");
  58108. var $2,$3,$1;
  58109. $2=(
  58110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58111. $ctx1.supercall = true,
  58112. //>>excludeEnd("ctx");
  58113. globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply(_st(self), []));
  58114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58115. $ctx1.supercall = false;
  58116. //>>excludeEnd("ctx");;
  58117. _st($2)._at_put_("amdNamespace",self._namespace());
  58118. $3=_st($2)._yourself();
  58119. $1=$3;
  58120. return $1;
  58121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58122. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.AmdPackageTransport)});
  58123. //>>excludeEnd("ctx");
  58124. },
  58125. //>>excludeStart("ide", pragmas.excludeIdeData);
  58126. args: [],
  58127. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  58128. referencedClasses: [],
  58129. //>>excludeEnd("ide");
  58130. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  58131. }),
  58132. globals.AmdPackageTransport);
  58133. smalltalk.addMethod(
  58134. smalltalk.method({
  58135. selector: "commitHandlerClass",
  58136. protocol: 'accessing',
  58137. fn: function (){
  58138. var self=this;
  58139. function $AmdPackageHandler(){return globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  58140. return $AmdPackageHandler();
  58141. },
  58142. //>>excludeStart("ide", pragmas.excludeIdeData);
  58143. args: [],
  58144. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  58145. referencedClasses: ["AmdPackageHandler"],
  58146. //>>excludeEnd("ide");
  58147. messageSends: []
  58148. }),
  58149. globals.AmdPackageTransport);
  58150. smalltalk.addMethod(
  58151. smalltalk.method({
  58152. selector: "defaultNamespace",
  58153. protocol: 'defaults',
  58154. fn: function (){
  58155. var self=this;
  58156. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  58157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58158. return smalltalk.withContext(function($ctx1) {
  58159. //>>excludeEnd("ctx");
  58160. var $1;
  58161. $1=_st($Smalltalk())._defaultAmdNamespace();
  58162. return $1;
  58163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58164. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageTransport)});
  58165. //>>excludeEnd("ctx");
  58166. },
  58167. //>>excludeStart("ide", pragmas.excludeIdeData);
  58168. args: [],
  58169. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  58170. referencedClasses: ["Smalltalk"],
  58171. //>>excludeEnd("ide");
  58172. messageSends: ["defaultAmdNamespace"]
  58173. }),
  58174. globals.AmdPackageTransport);
  58175. smalltalk.addMethod(
  58176. smalltalk.method({
  58177. selector: "definition",
  58178. protocol: 'accessing',
  58179. fn: function (){
  58180. var self=this;
  58181. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  58182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58183. return smalltalk.withContext(function($ctx1) {
  58184. //>>excludeEnd("ctx");
  58185. var $3,$2,$1;
  58186. $1=_st($String())._streamContents_((function(stream){
  58187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58188. return smalltalk.withContext(function($ctx2) {
  58189. //>>excludeEnd("ctx");
  58190. _st(stream)._nextPutAll_(_st(self._class())._name());
  58191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58192. $ctx2.sendIdx["nextPutAll:"]=1;
  58193. //>>excludeEnd("ctx");
  58194. _st(stream)._nextPutAll_(" namespace: ");
  58195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58196. $ctx2.sendIdx["nextPutAll:"]=2;
  58197. //>>excludeEnd("ctx");
  58198. $3=_st("'".__comma(self._namespace())).__comma("'");
  58199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58200. $ctx2.sendIdx[","]=1;
  58201. //>>excludeEnd("ctx");
  58202. $2=_st(stream)._nextPutAll_($3);
  58203. return $2;
  58204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58205. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  58206. //>>excludeEnd("ctx");
  58207. }));
  58208. return $1;
  58209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58210. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.AmdPackageTransport)});
  58211. //>>excludeEnd("ctx");
  58212. },
  58213. //>>excludeStart("ide", pragmas.excludeIdeData);
  58214. args: [],
  58215. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]",
  58216. referencedClasses: ["String"],
  58217. //>>excludeEnd("ide");
  58218. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  58219. }),
  58220. globals.AmdPackageTransport);
  58221. smalltalk.addMethod(
  58222. smalltalk.method({
  58223. selector: "namespace",
  58224. protocol: 'accessing',
  58225. fn: function (){
  58226. var self=this;
  58227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58228. return smalltalk.withContext(function($ctx1) {
  58229. //>>excludeEnd("ctx");
  58230. var $2,$1,$receiver;
  58231. $2=self["@namespace"];
  58232. if(($receiver = $2) == null || $receiver.isNil){
  58233. $1=self._defaultNamespace();
  58234. } else {
  58235. $1=$2;
  58236. };
  58237. return $1;
  58238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58239. }, function($ctx1) {$ctx1.fill(self,"namespace",{},globals.AmdPackageTransport)});
  58240. //>>excludeEnd("ctx");
  58241. },
  58242. //>>excludeStart("ide", pragmas.excludeIdeData);
  58243. args: [],
  58244. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  58245. referencedClasses: [],
  58246. //>>excludeEnd("ide");
  58247. messageSends: ["ifNil:", "defaultNamespace"]
  58248. }),
  58249. globals.AmdPackageTransport);
  58250. smalltalk.addMethod(
  58251. smalltalk.method({
  58252. selector: "namespace:",
  58253. protocol: 'accessing',
  58254. fn: function (aString){
  58255. var self=this;
  58256. self["@namespace"]=aString;
  58257. return self;
  58258. },
  58259. //>>excludeStart("ide", pragmas.excludeIdeData);
  58260. args: ["aString"],
  58261. source: "namespace: aString\x0a\x09namespace := aString",
  58262. referencedClasses: [],
  58263. //>>excludeEnd("ide");
  58264. messageSends: []
  58265. }),
  58266. globals.AmdPackageTransport);
  58267. smalltalk.addMethod(
  58268. smalltalk.method({
  58269. selector: "printOn:",
  58270. protocol: 'printing',
  58271. fn: function (aStream){
  58272. var self=this;
  58273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58274. return smalltalk.withContext(function($ctx1) {
  58275. //>>excludeEnd("ctx");
  58276. var $1;
  58277. (
  58278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58279. $ctx1.supercall = true,
  58280. //>>excludeEnd("ctx");
  58281. globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  58282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58283. $ctx1.supercall = false;
  58284. //>>excludeEnd("ctx");;
  58285. _st(aStream)._nextPutAll_(" (AMD Namespace: ");
  58286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58287. $ctx1.sendIdx["nextPutAll:"]=1;
  58288. //>>excludeEnd("ctx");
  58289. _st(aStream)._nextPutAll_(self._namespace());
  58290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58291. $ctx1.sendIdx["nextPutAll:"]=2;
  58292. //>>excludeEnd("ctx");
  58293. $1=_st(aStream)._nextPutAll_(")");
  58294. return self;
  58295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58296. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AmdPackageTransport)});
  58297. //>>excludeEnd("ctx");
  58298. },
  58299. //>>excludeStart("ide", pragmas.excludeIdeData);
  58300. args: ["aStream"],
  58301. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  58302. referencedClasses: [],
  58303. //>>excludeEnd("ide");
  58304. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  58305. }),
  58306. globals.AmdPackageTransport);
  58307. smalltalk.addMethod(
  58308. smalltalk.method({
  58309. selector: "setPath:",
  58310. protocol: 'actions',
  58311. fn: function (aString){
  58312. var self=this;
  58313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58314. return smalltalk.withContext(function($ctx1) {
  58315. //>>excludeEnd("ctx");
  58316. _st(_st(require)._basicAt_("config"))._value_(globals.HashedCollection._newFromPairs_(["paths",globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  58317. return self;
  58318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58319. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},globals.AmdPackageTransport)});
  58320. //>>excludeEnd("ctx");
  58321. },
  58322. //>>excludeStart("ide", pragmas.excludeIdeData);
  58323. args: ["aString"],
  58324. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  58325. referencedClasses: [],
  58326. //>>excludeEnd("ide");
  58327. messageSends: ["value:", "basicAt:", "namespace"]
  58328. }),
  58329. globals.AmdPackageTransport);
  58330. smalltalk.addMethod(
  58331. smalltalk.method({
  58332. selector: "setupFromJson:",
  58333. protocol: 'initialization',
  58334. fn: function (anObject){
  58335. var self=this;
  58336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58337. return smalltalk.withContext(function($ctx1) {
  58338. //>>excludeEnd("ctx");
  58339. self._namespace_(_st(anObject)._at_("amdNamespace"));
  58340. return self;
  58341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58342. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},globals.AmdPackageTransport)});
  58343. //>>excludeEnd("ctx");
  58344. },
  58345. //>>excludeStart("ide", pragmas.excludeIdeData);
  58346. args: ["anObject"],
  58347. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  58348. referencedClasses: [],
  58349. //>>excludeEnd("ide");
  58350. messageSends: ["namespace:", "at:"]
  58351. }),
  58352. globals.AmdPackageTransport);
  58353. smalltalk.addMethod(
  58354. smalltalk.method({
  58355. selector: "namespace:",
  58356. protocol: 'instance creation',
  58357. fn: function (aString){
  58358. var self=this;
  58359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58360. return smalltalk.withContext(function($ctx1) {
  58361. //>>excludeEnd("ctx");
  58362. var $2,$3,$1;
  58363. $2=self._new();
  58364. _st($2)._namespace_(aString);
  58365. $3=_st($2)._yourself();
  58366. $1=$3;
  58367. return $1;
  58368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58369. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},globals.AmdPackageTransport.klass)});
  58370. //>>excludeEnd("ctx");
  58371. },
  58372. //>>excludeStart("ide", pragmas.excludeIdeData);
  58373. args: ["aString"],
  58374. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  58375. referencedClasses: [],
  58376. //>>excludeEnd("ide");
  58377. messageSends: ["namespace:", "new", "yourself"]
  58378. }),
  58379. globals.AmdPackageTransport.klass);
  58380. smalltalk.addMethod(
  58381. smalltalk.method({
  58382. selector: "type",
  58383. protocol: 'accessing',
  58384. fn: function (){
  58385. var self=this;
  58386. return "amd";
  58387. },
  58388. //>>excludeStart("ide", pragmas.excludeIdeData);
  58389. args: [],
  58390. source: "type\x0a\x09^ 'amd'",
  58391. referencedClasses: [],
  58392. //>>excludeEnd("ide");
  58393. messageSends: []
  58394. }),
  58395. globals.AmdPackageTransport.klass);
  58396. smalltalk.addMethod(
  58397. smalltalk.method({
  58398. selector: "commit",
  58399. protocol: '*Kernel-ImportExport',
  58400. fn: function (){
  58401. var self=this;
  58402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58403. return smalltalk.withContext(function($ctx1) {
  58404. //>>excludeEnd("ctx");
  58405. var $1;
  58406. $1=_st(self._transport())._commit();
  58407. return $1;
  58408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58409. }, function($ctx1) {$ctx1.fill(self,"commit",{},globals.Package)});
  58410. //>>excludeEnd("ctx");
  58411. },
  58412. //>>excludeStart("ide", pragmas.excludeIdeData);
  58413. args: [],
  58414. source: "commit\x0a\x09^ self transport commit",
  58415. referencedClasses: [],
  58416. //>>excludeEnd("ide");
  58417. messageSends: ["commit", "transport"]
  58418. }),
  58419. globals.Package);
  58420. smalltalk.addMethod(
  58421. smalltalk.method({
  58422. selector: "load",
  58423. protocol: '*Kernel-ImportExport',
  58424. fn: function (){
  58425. var self=this;
  58426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58427. return smalltalk.withContext(function($ctx1) {
  58428. //>>excludeEnd("ctx");
  58429. var $1;
  58430. $1=_st(self._transport())._load();
  58431. return $1;
  58432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58433. }, function($ctx1) {$ctx1.fill(self,"load",{},globals.Package)});
  58434. //>>excludeEnd("ctx");
  58435. },
  58436. //>>excludeStart("ide", pragmas.excludeIdeData);
  58437. args: [],
  58438. source: "load\x0a\x09^ self transport load",
  58439. referencedClasses: [],
  58440. //>>excludeEnd("ide");
  58441. messageSends: ["load", "transport"]
  58442. }),
  58443. globals.Package);
  58444. smalltalk.addMethod(
  58445. smalltalk.method({
  58446. selector: "loadFromNamespace:",
  58447. protocol: '*Kernel-ImportExport',
  58448. fn: function (aString){
  58449. var self=this;
  58450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58451. return smalltalk.withContext(function($ctx1) {
  58452. //>>excludeEnd("ctx");
  58453. var $2,$3,$1;
  58454. $2=self._transport();
  58455. _st($2)._namespace_(aString);
  58456. $3=_st($2)._load();
  58457. $1=$3;
  58458. return $1;
  58459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58460. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},globals.Package)});
  58461. //>>excludeEnd("ctx");
  58462. },
  58463. //>>excludeStart("ide", pragmas.excludeIdeData);
  58464. args: ["aString"],
  58465. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  58466. referencedClasses: [],
  58467. //>>excludeEnd("ide");
  58468. messageSends: ["namespace:", "transport", "load"]
  58469. }),
  58470. globals.Package);
  58471. smalltalk.addMethod(
  58472. smalltalk.method({
  58473. selector: "load:",
  58474. protocol: '*Kernel-ImportExport',
  58475. fn: function (aPackageName){
  58476. var self=this;
  58477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58478. return smalltalk.withContext(function($ctx1) {
  58479. //>>excludeEnd("ctx");
  58480. _st(self._named_(aPackageName))._load();
  58481. return self;
  58482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58483. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},globals.Package.klass)});
  58484. //>>excludeEnd("ctx");
  58485. },
  58486. //>>excludeStart("ide", pragmas.excludeIdeData);
  58487. args: ["aPackageName"],
  58488. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  58489. referencedClasses: [],
  58490. //>>excludeEnd("ide");
  58491. messageSends: ["load", "named:"]
  58492. }),
  58493. globals.Package.klass);
  58494. smalltalk.addMethod(
  58495. smalltalk.method({
  58496. selector: "load:fromNamespace:",
  58497. protocol: '*Kernel-ImportExport',
  58498. fn: function (aPackageName,aString){
  58499. var self=this;
  58500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58501. return smalltalk.withContext(function($ctx1) {
  58502. //>>excludeEnd("ctx");
  58503. _st(self._named_(aPackageName))._loadFromNamespace_(aString);
  58504. return self;
  58505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58506. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},globals.Package.klass)});
  58507. //>>excludeEnd("ctx");
  58508. },
  58509. //>>excludeStart("ide", pragmas.excludeIdeData);
  58510. args: ["aPackageName", "aString"],
  58511. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  58512. referencedClasses: [],
  58513. //>>excludeEnd("ide");
  58514. messageSends: ["loadFromNamespace:", "named:"]
  58515. }),
  58516. globals.Package.klass);
  58517. });
  58518. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  58519. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  58520. smalltalk.addPackage('Kernel-Tests');
  58521. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  58522. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  58523. smalltalk.addMethod(
  58524. smalltalk.method({
  58525. selector: "testAddExtensionMethod",
  58526. protocol: 'tests',
  58527. fn: function (){
  58528. var self=this;
  58529. var method,dirty;
  58530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58531. return smalltalk.withContext(function($ctx1) {
  58532. //>>excludeEnd("ctx");
  58533. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  58534. $2=self._class();
  58535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58536. $ctx1.sendIdx["class"]=1;
  58537. //>>excludeEnd("ctx");
  58538. $1=_st($2)._package();
  58539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58540. $ctx1.sendIdx["package"]=1;
  58541. //>>excludeEnd("ctx");
  58542. dirty=_st($1)._isDirty();
  58543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58544. $ctx1.sendIdx["isDirty"]=1;
  58545. //>>excludeEnd("ctx");
  58546. $4=self._class();
  58547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58548. $ctx1.sendIdx["class"]=2;
  58549. //>>excludeEnd("ctx");
  58550. $3=_st($4)._package();
  58551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58552. $ctx1.sendIdx["package"]=2;
  58553. //>>excludeEnd("ctx");
  58554. _st($3)._beClean();
  58555. $5=self._class();
  58556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58557. $ctx1.sendIdx["class"]=3;
  58558. //>>excludeEnd("ctx");
  58559. method=_st($5)._compile_protocol_("doNothing","**not-a-package");
  58560. $8=self._class();
  58561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58562. $ctx1.sendIdx["class"]=4;
  58563. //>>excludeEnd("ctx");
  58564. $7=_st($8)._package();
  58565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58566. $ctx1.sendIdx["package"]=3;
  58567. //>>excludeEnd("ctx");
  58568. $6=_st($7)._isDirty();
  58569. self._deny_($6);
  58570. $9=self._class();
  58571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58572. $ctx1.sendIdx["class"]=5;
  58573. //>>excludeEnd("ctx");
  58574. _st($9)._removeCompiledMethod_(method);
  58575. $10=dirty;
  58576. if(smalltalk.assert($10)){
  58577. _st(_st(self._class())._package())._beDirty();
  58578. };
  58579. return self;
  58580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58581. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},globals.AnnouncementSubscriptionTest)});
  58582. //>>excludeEnd("ctx");
  58583. },
  58584. //>>excludeStart("ide", pragmas.excludeIdeData);
  58585. args: [],
  58586. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  58587. referencedClasses: [],
  58588. //>>excludeEnd("ide");
  58589. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  58590. }),
  58591. globals.AnnouncementSubscriptionTest);
  58592. smalltalk.addMethod(
  58593. smalltalk.method({
  58594. selector: "testHandlesAnnouncement",
  58595. protocol: 'tests',
  58596. fn: function (){
  58597. var self=this;
  58598. var subscription,announcementClass1,announcementClass2,classBuilder;
  58599. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  58600. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58601. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  58602. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  58603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58604. return smalltalk.withContext(function($ctx1) {
  58605. //>>excludeEnd("ctx");
  58606. var $1,$2;
  58607. classBuilder=_st($ClassBuilder())._new();
  58608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58609. $ctx1.sendIdx["new"]=1;
  58610. //>>excludeEnd("ctx");
  58611. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  58612. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  58613. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  58614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58615. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  58616. //>>excludeEnd("ctx");
  58617. self._assert_equals_($1,true);
  58618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58619. $ctx1.sendIdx["assert:equals:"]=1;
  58620. //>>excludeEnd("ctx");
  58621. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  58622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58623. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  58624. //>>excludeEnd("ctx");
  58625. self._assert_equals_($2,true);
  58626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58627. $ctx1.sendIdx["assert:equals:"]=2;
  58628. //>>excludeEnd("ctx");
  58629. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  58630. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  58631. return self;
  58632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58633. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)});
  58634. //>>excludeEnd("ctx");
  58635. },
  58636. //>>excludeStart("ide", pragmas.excludeIdeData);
  58637. args: [],
  58638. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  58639. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  58640. //>>excludeEnd("ide");
  58641. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  58642. }),
  58643. globals.AnnouncementSubscriptionTest);
  58644. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  58645. smalltalk.addMethod(
  58646. smalltalk.method({
  58647. selector: "testOnDo",
  58648. protocol: 'tests',
  58649. fn: function (){
  58650. var self=this;
  58651. var counter,announcer;
  58652. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  58653. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58655. return smalltalk.withContext(function($ctx1) {
  58656. //>>excludeEnd("ctx");
  58657. var $1,$2;
  58658. counter=(0);
  58659. announcer=_st($Announcer())._new();
  58660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58661. $ctx1.sendIdx["new"]=1;
  58662. //>>excludeEnd("ctx");
  58663. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  58664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58665. return smalltalk.withContext(function($ctx2) {
  58666. //>>excludeEnd("ctx");
  58667. counter=_st(counter).__plus((1));
  58668. return counter;
  58669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58671. //>>excludeEnd("ctx");
  58672. }));
  58673. $1=announcer;
  58674. $2=_st($SystemAnnouncement())._new();
  58675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58676. $ctx1.sendIdx["new"]=2;
  58677. //>>excludeEnd("ctx");
  58678. _st($1)._announce_($2);
  58679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58680. $ctx1.sendIdx["announce:"]=1;
  58681. //>>excludeEnd("ctx");
  58682. self._assert_equals_(counter,(1));
  58683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58684. $ctx1.sendIdx["assert:equals:"]=1;
  58685. //>>excludeEnd("ctx");
  58686. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  58687. self._assert_equals_(counter,(2));
  58688. return self;
  58689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58690. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)});
  58691. //>>excludeEnd("ctx");
  58692. },
  58693. //>>excludeStart("ide", pragmas.excludeIdeData);
  58694. args: [],
  58695. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  58696. referencedClasses: ["Announcer", "SystemAnnouncement"],
  58697. //>>excludeEnd("ide");
  58698. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  58699. }),
  58700. globals.AnnouncerTest);
  58701. smalltalk.addMethod(
  58702. smalltalk.method({
  58703. selector: "testOnDoFor",
  58704. protocol: 'tests',
  58705. fn: function (){
  58706. var self=this;
  58707. var counter,announcer;
  58708. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  58709. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58711. return smalltalk.withContext(function($ctx1) {
  58712. //>>excludeEnd("ctx");
  58713. var $1,$2,$3,$4;
  58714. counter=(0);
  58715. announcer=_st($Announcer())._new();
  58716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58717. $ctx1.sendIdx["new"]=1;
  58718. //>>excludeEnd("ctx");
  58719. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  58720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58721. return smalltalk.withContext(function($ctx2) {
  58722. //>>excludeEnd("ctx");
  58723. counter=_st(counter).__plus((1));
  58724. return counter;
  58725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58727. //>>excludeEnd("ctx");
  58728. }),self);
  58729. $1=announcer;
  58730. $2=_st($SystemAnnouncement())._new();
  58731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58732. $ctx1.sendIdx["new"]=2;
  58733. //>>excludeEnd("ctx");
  58734. _st($1)._announce_($2);
  58735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58736. $ctx1.sendIdx["announce:"]=1;
  58737. //>>excludeEnd("ctx");
  58738. self._assert_equals_(counter,(1));
  58739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58740. $ctx1.sendIdx["assert:equals:"]=1;
  58741. //>>excludeEnd("ctx");
  58742. $3=announcer;
  58743. $4=_st($SystemAnnouncement())._new();
  58744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58745. $ctx1.sendIdx["new"]=3;
  58746. //>>excludeEnd("ctx");
  58747. _st($3)._announce_($4);
  58748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58749. $ctx1.sendIdx["announce:"]=2;
  58750. //>>excludeEnd("ctx");
  58751. self._assert_equals_(counter,(2));
  58752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58753. $ctx1.sendIdx["assert:equals:"]=2;
  58754. //>>excludeEnd("ctx");
  58755. _st(announcer)._unsubscribe_(self);
  58756. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  58757. self._assert_equals_(counter,(2));
  58758. return self;
  58759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58760. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)});
  58761. //>>excludeEnd("ctx");
  58762. },
  58763. //>>excludeStart("ide", pragmas.excludeIdeData);
  58764. args: [],
  58765. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  58766. referencedClasses: ["Announcer", "SystemAnnouncement"],
  58767. //>>excludeEnd("ide");
  58768. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  58769. }),
  58770. globals.AnnouncerTest);
  58771. smalltalk.addMethod(
  58772. smalltalk.method({
  58773. selector: "testOnDoOnce",
  58774. protocol: 'tests',
  58775. fn: function (){
  58776. var self=this;
  58777. var counter,announcer;
  58778. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  58779. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58781. return smalltalk.withContext(function($ctx1) {
  58782. //>>excludeEnd("ctx");
  58783. var $1,$2;
  58784. counter=(0);
  58785. announcer=_st($Announcer())._new();
  58786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58787. $ctx1.sendIdx["new"]=1;
  58788. //>>excludeEnd("ctx");
  58789. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  58790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58791. return smalltalk.withContext(function($ctx2) {
  58792. //>>excludeEnd("ctx");
  58793. counter=_st(counter).__plus((1));
  58794. return counter;
  58795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58797. //>>excludeEnd("ctx");
  58798. }));
  58799. $1=announcer;
  58800. $2=_st($SystemAnnouncement())._new();
  58801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58802. $ctx1.sendIdx["new"]=2;
  58803. //>>excludeEnd("ctx");
  58804. _st($1)._announce_($2);
  58805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58806. $ctx1.sendIdx["announce:"]=1;
  58807. //>>excludeEnd("ctx");
  58808. self._assert_equals_(counter,(1));
  58809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58810. $ctx1.sendIdx["assert:equals:"]=1;
  58811. //>>excludeEnd("ctx");
  58812. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  58813. self._assert_equals_(counter,(1));
  58814. return self;
  58815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58816. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)});
  58817. //>>excludeEnd("ctx");
  58818. },
  58819. //>>excludeStart("ide", pragmas.excludeIdeData);
  58820. args: [],
  58821. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  58822. referencedClasses: ["Announcer", "SystemAnnouncement"],
  58823. //>>excludeEnd("ide");
  58824. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  58825. }),
  58826. globals.AnnouncerTest);
  58827. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  58828. smalltalk.addMethod(
  58829. smalltalk.method({
  58830. selector: "testCanClearInterval",
  58831. protocol: 'tests',
  58832. fn: function (){
  58833. var self=this;
  58834. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  58835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58836. return smalltalk.withContext(function($ctx1) {
  58837. //>>excludeEnd("ctx");
  58838. self._shouldnt_raise_((function(){
  58839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58840. return smalltalk.withContext(function($ctx2) {
  58841. //>>excludeEnd("ctx");
  58842. return _st(_st((function(){
  58843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58844. return smalltalk.withContext(function($ctx3) {
  58845. //>>excludeEnd("ctx");
  58846. return _st(_st($Error())._new())._signal();
  58847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58848. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58849. //>>excludeEnd("ctx");
  58850. }))._valueWithInterval_((0)))._clearInterval();
  58851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58853. //>>excludeEnd("ctx");
  58854. }),$Error());
  58855. return self;
  58856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58857. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)});
  58858. //>>excludeEnd("ctx");
  58859. },
  58860. //>>excludeStart("ide", pragmas.excludeIdeData);
  58861. args: [],
  58862. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  58863. referencedClasses: ["Error"],
  58864. //>>excludeEnd("ide");
  58865. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  58866. }),
  58867. globals.BlockClosureTest);
  58868. smalltalk.addMethod(
  58869. smalltalk.method({
  58870. selector: "testCanClearTimeout",
  58871. protocol: 'tests',
  58872. fn: function (){
  58873. var self=this;
  58874. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  58875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58876. return smalltalk.withContext(function($ctx1) {
  58877. //>>excludeEnd("ctx");
  58878. self._shouldnt_raise_((function(){
  58879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58880. return smalltalk.withContext(function($ctx2) {
  58881. //>>excludeEnd("ctx");
  58882. return _st(_st((function(){
  58883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58884. return smalltalk.withContext(function($ctx3) {
  58885. //>>excludeEnd("ctx");
  58886. return _st(_st($Error())._new())._signal();
  58887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58888. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58889. //>>excludeEnd("ctx");
  58890. }))._valueWithTimeout_((0)))._clearTimeout();
  58891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58893. //>>excludeEnd("ctx");
  58894. }),$Error());
  58895. return self;
  58896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58897. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)});
  58898. //>>excludeEnd("ctx");
  58899. },
  58900. //>>excludeStart("ide", pragmas.excludeIdeData);
  58901. args: [],
  58902. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  58903. referencedClasses: ["Error"],
  58904. //>>excludeEnd("ide");
  58905. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  58906. }),
  58907. globals.BlockClosureTest);
  58908. smalltalk.addMethod(
  58909. smalltalk.method({
  58910. selector: "testCompiledSource",
  58911. protocol: 'tests',
  58912. fn: function (){
  58913. var self=this;
  58914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58915. return smalltalk.withContext(function($ctx1) {
  58916. //>>excludeEnd("ctx");
  58917. self._assert_(_st(_st((function(){
  58918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58919. return smalltalk.withContext(function($ctx2) {
  58920. //>>excludeEnd("ctx");
  58921. return (1).__plus((1));
  58922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58924. //>>excludeEnd("ctx");
  58925. }))._compiledSource())._includesSubString_("function"));
  58926. return self;
  58927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58928. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)});
  58929. //>>excludeEnd("ctx");
  58930. },
  58931. //>>excludeStart("ide", pragmas.excludeIdeData);
  58932. args: [],
  58933. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  58934. referencedClasses: [],
  58935. //>>excludeEnd("ide");
  58936. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  58937. }),
  58938. globals.BlockClosureTest);
  58939. smalltalk.addMethod(
  58940. smalltalk.method({
  58941. selector: "testCurrySelf",
  58942. protocol: 'tests',
  58943. fn: function (){
  58944. var self=this;
  58945. var curriedMethod,array;
  58946. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  58947. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  58948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58949. return smalltalk.withContext(function($ctx1) {
  58950. //>>excludeEnd("ctx");
  58951. curriedMethod=_st(_st((function(selfarg,x){
  58952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58953. return smalltalk.withContext(function($ctx2) {
  58954. //>>excludeEnd("ctx");
  58955. return _st(selfarg)._at_(x);
  58956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58957. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  58958. //>>excludeEnd("ctx");
  58959. }))._currySelf())._asCompiledMethod_("foo:");
  58960. array=[(3), (1), (4)];
  58961. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  58962. _st((function(){
  58963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58964. return smalltalk.withContext(function($ctx2) {
  58965. //>>excludeEnd("ctx");
  58966. return self._assert_equals_(_st(array)._foo_((2)),(1));
  58967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58969. //>>excludeEnd("ctx");
  58970. }))._ensure_((function(){
  58971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58972. return smalltalk.withContext(function($ctx2) {
  58973. //>>excludeEnd("ctx");
  58974. return _st($Array())._removeCompiledMethod_(curriedMethod);
  58975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58977. //>>excludeEnd("ctx");
  58978. }));
  58979. return self;
  58980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58981. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)});
  58982. //>>excludeEnd("ctx");
  58983. },
  58984. //>>excludeStart("ide", pragmas.excludeIdeData);
  58985. args: [],
  58986. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  58987. referencedClasses: ["ClassBuilder", "Array"],
  58988. //>>excludeEnd("ide");
  58989. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  58990. }),
  58991. globals.BlockClosureTest);
  58992. smalltalk.addMethod(
  58993. smalltalk.method({
  58994. selector: "testEnsure",
  58995. protocol: 'tests',
  58996. fn: function (){
  58997. var self=this;
  58998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58999. return smalltalk.withContext(function($ctx1) {
  59000. //>>excludeEnd("ctx");
  59001. self._assert_equals_(_st((function(){
  59002. return (3);
  59003. }))._ensure_((function(){
  59004. return (4);
  59005. })),(3));
  59006. return self;
  59007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59008. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)});
  59009. //>>excludeEnd("ctx");
  59010. },
  59011. //>>excludeStart("ide", pragmas.excludeIdeData);
  59012. args: [],
  59013. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  59014. referencedClasses: [],
  59015. //>>excludeEnd("ide");
  59016. messageSends: ["assert:equals:", "ensure:"]
  59017. }),
  59018. globals.BlockClosureTest);
  59019. smalltalk.addMethod(
  59020. smalltalk.method({
  59021. selector: "testEnsureRaises",
  59022. protocol: 'tests',
  59023. fn: function (){
  59024. var self=this;
  59025. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  59026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59027. return smalltalk.withContext(function($ctx1) {
  59028. //>>excludeEnd("ctx");
  59029. self._should_raise_((function(){
  59030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59031. return smalltalk.withContext(function($ctx2) {
  59032. //>>excludeEnd("ctx");
  59033. return _st((function(){
  59034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59035. return smalltalk.withContext(function($ctx3) {
  59036. //>>excludeEnd("ctx");
  59037. return _st(_st($Error())._new())._signal();
  59038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59039. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59040. //>>excludeEnd("ctx");
  59041. }))._ensure_((function(){
  59042. return true;
  59043. }));
  59044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59046. //>>excludeEnd("ctx");
  59047. }),$Error());
  59048. return self;
  59049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59050. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)});
  59051. //>>excludeEnd("ctx");
  59052. },
  59053. //>>excludeStart("ide", pragmas.excludeIdeData);
  59054. args: [],
  59055. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  59056. referencedClasses: ["Error"],
  59057. //>>excludeEnd("ide");
  59058. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  59059. }),
  59060. globals.BlockClosureTest);
  59061. smalltalk.addMethod(
  59062. smalltalk.method({
  59063. selector: "testExceptionSemantics",
  59064. protocol: 'tests',
  59065. fn: function (){
  59066. var self=this;
  59067. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  59068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59069. return smalltalk.withContext(function($ctx1) {
  59070. //>>excludeEnd("ctx");
  59071. self._timeout_((100));
  59072. _st(self._async_((function(){
  59073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59074. return smalltalk.withContext(function($ctx2) {
  59075. //>>excludeEnd("ctx");
  59076. return _st((function(){
  59077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59078. return smalltalk.withContext(function($ctx3) {
  59079. //>>excludeEnd("ctx");
  59080. self._assert_(true);
  59081. _st($Error())._signal();
  59082. self._deny_(true);
  59083. return self._finished();
  59084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59085. $ctx3.sendIdx["finished"]=1;
  59086. //>>excludeEnd("ctx");
  59087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59088. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59089. //>>excludeEnd("ctx");
  59090. }))._on_do_($Error(),(function(ex){
  59091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59092. return smalltalk.withContext(function($ctx3) {
  59093. //>>excludeEnd("ctx");
  59094. return self._finished();
  59095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59096. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  59097. //>>excludeEnd("ctx");
  59098. }));
  59099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59101. //>>excludeEnd("ctx");
  59102. })))._valueWithTimeout_((0));
  59103. return self;
  59104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59105. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)});
  59106. //>>excludeEnd("ctx");
  59107. },
  59108. //>>excludeStart("ide", pragmas.excludeIdeData);
  59109. args: [],
  59110. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  59111. referencedClasses: ["Error"],
  59112. //>>excludeEnd("ide");
  59113. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  59114. }),
  59115. globals.BlockClosureTest);
  59116. smalltalk.addMethod(
  59117. smalltalk.method({
  59118. selector: "testNewWithValues",
  59119. protocol: 'tests',
  59120. fn: function (){
  59121. var self=this;
  59122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59123. return smalltalk.withContext(function($ctx1) {
  59124. //>>excludeEnd("ctx");
  59125. function TestConstructor(arg1, arg2, arg3) {}
  59126. TestConstructor.prototype.name = 'theTestPrototype';
  59127. var wrappedConstructor = _st(TestConstructor);
  59128. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  59129. self._assert_(result instanceof TestConstructor);
  59130. self._assert_equals_(result.name, 'theTestPrototype');
  59131. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  59132. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  59133. return self;
  59134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59135. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)});
  59136. //>>excludeEnd("ctx");
  59137. },
  59138. //>>excludeStart("ide", pragmas.excludeIdeData);
  59139. args: [],
  59140. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  59141. referencedClasses: [],
  59142. //>>excludeEnd("ide");
  59143. messageSends: []
  59144. }),
  59145. globals.BlockClosureTest);
  59146. smalltalk.addMethod(
  59147. smalltalk.method({
  59148. selector: "testNumArgs",
  59149. protocol: 'tests',
  59150. fn: function (){
  59151. var self=this;
  59152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59153. return smalltalk.withContext(function($ctx1) {
  59154. //>>excludeEnd("ctx");
  59155. var $1;
  59156. $1=_st((function(){
  59157. }))._numArgs();
  59158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59159. $ctx1.sendIdx["numArgs"]=1;
  59160. //>>excludeEnd("ctx");
  59161. self._assert_equals_($1,(0));
  59162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59163. $ctx1.sendIdx["assert:equals:"]=1;
  59164. //>>excludeEnd("ctx");
  59165. self._assert_equals_(_st((function(a,b){
  59166. }))._numArgs(),(2));
  59167. return self;
  59168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59169. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)});
  59170. //>>excludeEnd("ctx");
  59171. },
  59172. //>>excludeStart("ide", pragmas.excludeIdeData);
  59173. args: [],
  59174. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  59175. referencedClasses: [],
  59176. //>>excludeEnd("ide");
  59177. messageSends: ["assert:equals:", "numArgs"]
  59178. }),
  59179. globals.BlockClosureTest);
  59180. smalltalk.addMethod(
  59181. smalltalk.method({
  59182. selector: "testOnDo",
  59183. protocol: 'tests',
  59184. fn: function (){
  59185. var self=this;
  59186. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  59187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59188. return smalltalk.withContext(function($ctx1) {
  59189. //>>excludeEnd("ctx");
  59190. self._assert_(_st((function(){
  59191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59192. return smalltalk.withContext(function($ctx2) {
  59193. //>>excludeEnd("ctx");
  59194. return _st(_st($Error())._new())._signal();
  59195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59197. //>>excludeEnd("ctx");
  59198. }))._on_do_($Error(),(function(ex){
  59199. return true;
  59200. })));
  59201. return self;
  59202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59203. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)});
  59204. //>>excludeEnd("ctx");
  59205. },
  59206. //>>excludeStart("ide", pragmas.excludeIdeData);
  59207. args: [],
  59208. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  59209. referencedClasses: ["Error"],
  59210. //>>excludeEnd("ide");
  59211. messageSends: ["assert:", "on:do:", "signal", "new"]
  59212. }),
  59213. globals.BlockClosureTest);
  59214. smalltalk.addMethod(
  59215. smalltalk.method({
  59216. selector: "testValue",
  59217. protocol: 'tests',
  59218. fn: function (){
  59219. var self=this;
  59220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59221. return smalltalk.withContext(function($ctx1) {
  59222. //>>excludeEnd("ctx");
  59223. var $1;
  59224. $1=_st((function(){
  59225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59226. return smalltalk.withContext(function($ctx2) {
  59227. //>>excludeEnd("ctx");
  59228. return (1).__plus((1));
  59229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59230. $ctx2.sendIdx["+"]=1;
  59231. //>>excludeEnd("ctx");
  59232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59234. //>>excludeEnd("ctx");
  59235. }))._value();
  59236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59237. $ctx1.sendIdx["value"]=1;
  59238. //>>excludeEnd("ctx");
  59239. self._assert_equals_($1,(2));
  59240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59241. $ctx1.sendIdx["assert:equals:"]=1;
  59242. //>>excludeEnd("ctx");
  59243. self._assert_equals_(_st((function(x){
  59244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59245. return smalltalk.withContext(function($ctx2) {
  59246. //>>excludeEnd("ctx");
  59247. return _st(x).__plus((1));
  59248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59249. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  59250. //>>excludeEnd("ctx");
  59251. }))._value_((2)),(3));
  59252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59253. $ctx1.sendIdx["assert:equals:"]=2;
  59254. //>>excludeEnd("ctx");
  59255. self._assert_equals_(_st((function(x,y){
  59256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59257. return smalltalk.withContext(function($ctx2) {
  59258. //>>excludeEnd("ctx");
  59259. return _st(x).__star(y);
  59260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59261. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  59262. //>>excludeEnd("ctx");
  59263. }))._value_value_((2),(4)),(8));
  59264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59265. $ctx1.sendIdx["assert:equals:"]=3;
  59266. //>>excludeEnd("ctx");
  59267. self._assert_equals_(_st((function(a,b,c){
  59268. return (1);
  59269. }))._value(),(1));
  59270. return self;
  59271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59272. }, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)});
  59273. //>>excludeEnd("ctx");
  59274. },
  59275. //>>excludeStart("ide", pragmas.excludeIdeData);
  59276. args: [],
  59277. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  59278. referencedClasses: [],
  59279. //>>excludeEnd("ide");
  59280. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  59281. }),
  59282. globals.BlockClosureTest);
  59283. smalltalk.addMethod(
  59284. smalltalk.method({
  59285. selector: "testValueWithPossibleArguments",
  59286. protocol: 'tests',
  59287. fn: function (){
  59288. var self=this;
  59289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59290. return smalltalk.withContext(function($ctx1) {
  59291. //>>excludeEnd("ctx");
  59292. var $1,$2;
  59293. $1=_st((function(){
  59294. return (1);
  59295. }))._valueWithPossibleArguments_([(3), (4)]);
  59296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59297. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  59298. //>>excludeEnd("ctx");
  59299. self._assert_equals_($1,(1));
  59300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59301. $ctx1.sendIdx["assert:equals:"]=1;
  59302. //>>excludeEnd("ctx");
  59303. $2=_st((function(a){
  59304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59305. return smalltalk.withContext(function($ctx2) {
  59306. //>>excludeEnd("ctx");
  59307. return _st(a).__plus((4));
  59308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59309. $ctx2.sendIdx["+"]=1;
  59310. //>>excludeEnd("ctx");
  59311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59312. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59313. //>>excludeEnd("ctx");
  59314. }))._valueWithPossibleArguments_([(3), (4)]);
  59315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59316. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  59317. //>>excludeEnd("ctx");
  59318. self._assert_equals_($2,(7));
  59319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59320. $ctx1.sendIdx["assert:equals:"]=2;
  59321. //>>excludeEnd("ctx");
  59322. self._assert_equals_(_st((function(a,b){
  59323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59324. return smalltalk.withContext(function($ctx2) {
  59325. //>>excludeEnd("ctx");
  59326. return _st(a).__plus(b);
  59327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59328. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  59329. //>>excludeEnd("ctx");
  59330. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  59331. return self;
  59332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59333. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)});
  59334. //>>excludeEnd("ctx");
  59335. },
  59336. //>>excludeStart("ide", pragmas.excludeIdeData);
  59337. args: [],
  59338. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  59339. referencedClasses: [],
  59340. //>>excludeEnd("ide");
  59341. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  59342. }),
  59343. globals.BlockClosureTest);
  59344. smalltalk.addMethod(
  59345. smalltalk.method({
  59346. selector: "testWhileFalse",
  59347. protocol: 'tests',
  59348. fn: function (){
  59349. var self=this;
  59350. var i;
  59351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59352. return smalltalk.withContext(function($ctx1) {
  59353. //>>excludeEnd("ctx");
  59354. i=(0);
  59355. _st((function(){
  59356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59357. return smalltalk.withContext(function($ctx2) {
  59358. //>>excludeEnd("ctx");
  59359. return _st(i).__gt((5));
  59360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59361. $ctx2.sendIdx[">"]=1;
  59362. //>>excludeEnd("ctx");
  59363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59365. //>>excludeEnd("ctx");
  59366. }))._whileFalse_((function(){
  59367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59368. return smalltalk.withContext(function($ctx2) {
  59369. //>>excludeEnd("ctx");
  59370. i=_st(i).__plus((1));
  59371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59372. $ctx2.sendIdx["+"]=1;
  59373. //>>excludeEnd("ctx");
  59374. return i;
  59375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59377. //>>excludeEnd("ctx");
  59378. }));
  59379. self._assert_equals_(i,(6));
  59380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59381. $ctx1.sendIdx["assert:equals:"]=1;
  59382. //>>excludeEnd("ctx");
  59383. i=(0);
  59384. _st((function(){
  59385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59386. return smalltalk.withContext(function($ctx2) {
  59387. //>>excludeEnd("ctx");
  59388. i=_st(i).__plus((1));
  59389. i;
  59390. return _st(i).__gt((5));
  59391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59393. //>>excludeEnd("ctx");
  59394. }))._whileFalse();
  59395. self._assert_equals_(i,(6));
  59396. return self;
  59397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59398. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)});
  59399. //>>excludeEnd("ctx");
  59400. },
  59401. //>>excludeStart("ide", pragmas.excludeIdeData);
  59402. args: [],
  59403. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  59404. referencedClasses: [],
  59405. //>>excludeEnd("ide");
  59406. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  59407. }),
  59408. globals.BlockClosureTest);
  59409. smalltalk.addMethod(
  59410. smalltalk.method({
  59411. selector: "testWhileTrue",
  59412. protocol: 'tests',
  59413. fn: function (){
  59414. var self=this;
  59415. var i;
  59416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59417. return smalltalk.withContext(function($ctx1) {
  59418. //>>excludeEnd("ctx");
  59419. i=(0);
  59420. _st((function(){
  59421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59422. return smalltalk.withContext(function($ctx2) {
  59423. //>>excludeEnd("ctx");
  59424. return _st(i).__lt((5));
  59425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59426. $ctx2.sendIdx["<"]=1;
  59427. //>>excludeEnd("ctx");
  59428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59430. //>>excludeEnd("ctx");
  59431. }))._whileTrue_((function(){
  59432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59433. return smalltalk.withContext(function($ctx2) {
  59434. //>>excludeEnd("ctx");
  59435. i=_st(i).__plus((1));
  59436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59437. $ctx2.sendIdx["+"]=1;
  59438. //>>excludeEnd("ctx");
  59439. return i;
  59440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59442. //>>excludeEnd("ctx");
  59443. }));
  59444. self._assert_equals_(i,(5));
  59445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59446. $ctx1.sendIdx["assert:equals:"]=1;
  59447. //>>excludeEnd("ctx");
  59448. i=(0);
  59449. _st((function(){
  59450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59451. return smalltalk.withContext(function($ctx2) {
  59452. //>>excludeEnd("ctx");
  59453. i=_st(i).__plus((1));
  59454. i;
  59455. return _st(i).__lt((5));
  59456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59458. //>>excludeEnd("ctx");
  59459. }))._whileTrue();
  59460. self._assert_equals_(i,(5));
  59461. return self;
  59462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59463. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)});
  59464. //>>excludeEnd("ctx");
  59465. },
  59466. //>>excludeStart("ide", pragmas.excludeIdeData);
  59467. args: [],
  59468. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  59469. referencedClasses: [],
  59470. //>>excludeEnd("ide");
  59471. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  59472. }),
  59473. globals.BlockClosureTest);
  59474. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  59475. smalltalk.addMethod(
  59476. smalltalk.method({
  59477. selector: "testEquality",
  59478. protocol: 'tests',
  59479. fn: function (){
  59480. var self=this;
  59481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59482. return smalltalk.withContext(function($ctx1) {
  59483. //>>excludeEnd("ctx");
  59484. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  59485. $1=(0).__eq(false);
  59486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59487. $ctx1.sendIdx["="]=1;
  59488. //>>excludeEnd("ctx");
  59489. self._deny_($1);
  59490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59491. $ctx1.sendIdx["deny:"]=1;
  59492. //>>excludeEnd("ctx");
  59493. $2=false.__eq((0));
  59494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59495. $ctx1.sendIdx["="]=2;
  59496. //>>excludeEnd("ctx");
  59497. self._deny_($2);
  59498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59499. $ctx1.sendIdx["deny:"]=2;
  59500. //>>excludeEnd("ctx");
  59501. $3="".__eq(false);
  59502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59503. $ctx1.sendIdx["="]=3;
  59504. //>>excludeEnd("ctx");
  59505. self._deny_($3);
  59506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59507. $ctx1.sendIdx["deny:"]=3;
  59508. //>>excludeEnd("ctx");
  59509. $4=false.__eq("");
  59510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59511. $ctx1.sendIdx["="]=4;
  59512. //>>excludeEnd("ctx");
  59513. self._deny_($4);
  59514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59515. $ctx1.sendIdx["deny:"]=4;
  59516. //>>excludeEnd("ctx");
  59517. $5=true.__eq(true);
  59518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59519. $ctx1.sendIdx["="]=5;
  59520. //>>excludeEnd("ctx");
  59521. self._assert_($5);
  59522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59523. $ctx1.sendIdx["assert:"]=1;
  59524. //>>excludeEnd("ctx");
  59525. $6=false.__eq(true);
  59526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59527. $ctx1.sendIdx["="]=6;
  59528. //>>excludeEnd("ctx");
  59529. self._deny_($6);
  59530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59531. $ctx1.sendIdx["deny:"]=5;
  59532. //>>excludeEnd("ctx");
  59533. $7=true.__eq(false);
  59534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59535. $ctx1.sendIdx["="]=7;
  59536. //>>excludeEnd("ctx");
  59537. self._deny_($7);
  59538. $8=false.__eq(false);
  59539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59540. $ctx1.sendIdx["="]=8;
  59541. //>>excludeEnd("ctx");
  59542. self._assert_($8);
  59543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59544. $ctx1.sendIdx["assert:"]=2;
  59545. //>>excludeEnd("ctx");
  59546. $10=true._yourself();
  59547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59548. $ctx1.sendIdx["yourself"]=1;
  59549. //>>excludeEnd("ctx");
  59550. $9=_st($10).__eq(true);
  59551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59552. $ctx1.sendIdx["="]=9;
  59553. //>>excludeEnd("ctx");
  59554. self._assert_($9);
  59555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59556. $ctx1.sendIdx["assert:"]=3;
  59557. //>>excludeEnd("ctx");
  59558. $12=true._yourself();
  59559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59560. $ctx1.sendIdx["yourself"]=2;
  59561. //>>excludeEnd("ctx");
  59562. $11=_st($12).__eq(true._yourself());
  59563. self._assert_($11);
  59564. return self;
  59565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59566. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)});
  59567. //>>excludeEnd("ctx");
  59568. },
  59569. //>>excludeStart("ide", pragmas.excludeIdeData);
  59570. args: [],
  59571. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  59572. referencedClasses: [],
  59573. //>>excludeEnd("ide");
  59574. messageSends: ["deny:", "=", "assert:", "yourself"]
  59575. }),
  59576. globals.BooleanTest);
  59577. smalltalk.addMethod(
  59578. smalltalk.method({
  59579. selector: "testIdentity",
  59580. protocol: 'tests',
  59581. fn: function (){
  59582. var self=this;
  59583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59584. return smalltalk.withContext(function($ctx1) {
  59585. //>>excludeEnd("ctx");
  59586. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  59587. $1=(0).__eq_eq(false);
  59588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59589. $ctx1.sendIdx["=="]=1;
  59590. //>>excludeEnd("ctx");
  59591. self._deny_($1);
  59592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59593. $ctx1.sendIdx["deny:"]=1;
  59594. //>>excludeEnd("ctx");
  59595. $2=false.__eq_eq((0));
  59596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59597. $ctx1.sendIdx["=="]=2;
  59598. //>>excludeEnd("ctx");
  59599. self._deny_($2);
  59600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59601. $ctx1.sendIdx["deny:"]=2;
  59602. //>>excludeEnd("ctx");
  59603. $3="".__eq_eq(false);
  59604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59605. $ctx1.sendIdx["=="]=3;
  59606. //>>excludeEnd("ctx");
  59607. self._deny_($3);
  59608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59609. $ctx1.sendIdx["deny:"]=3;
  59610. //>>excludeEnd("ctx");
  59611. $4=false.__eq_eq("");
  59612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59613. $ctx1.sendIdx["=="]=4;
  59614. //>>excludeEnd("ctx");
  59615. self._deny_($4);
  59616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59617. $ctx1.sendIdx["deny:"]=4;
  59618. //>>excludeEnd("ctx");
  59619. $5=true.__eq_eq(true);
  59620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59621. $ctx1.sendIdx["=="]=5;
  59622. //>>excludeEnd("ctx");
  59623. self._assert_($5);
  59624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59625. $ctx1.sendIdx["assert:"]=1;
  59626. //>>excludeEnd("ctx");
  59627. $6=false.__eq_eq(true);
  59628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59629. $ctx1.sendIdx["=="]=6;
  59630. //>>excludeEnd("ctx");
  59631. self._deny_($6);
  59632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59633. $ctx1.sendIdx["deny:"]=5;
  59634. //>>excludeEnd("ctx");
  59635. $7=true.__eq_eq(false);
  59636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59637. $ctx1.sendIdx["=="]=7;
  59638. //>>excludeEnd("ctx");
  59639. self._deny_($7);
  59640. $8=false.__eq_eq(false);
  59641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59642. $ctx1.sendIdx["=="]=8;
  59643. //>>excludeEnd("ctx");
  59644. self._assert_($8);
  59645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59646. $ctx1.sendIdx["assert:"]=2;
  59647. //>>excludeEnd("ctx");
  59648. $10=true._yourself();
  59649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59650. $ctx1.sendIdx["yourself"]=1;
  59651. //>>excludeEnd("ctx");
  59652. $9=_st($10).__eq_eq(true);
  59653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59654. $ctx1.sendIdx["=="]=9;
  59655. //>>excludeEnd("ctx");
  59656. self._assert_($9);
  59657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59658. $ctx1.sendIdx["assert:"]=3;
  59659. //>>excludeEnd("ctx");
  59660. $12=true._yourself();
  59661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59662. $ctx1.sendIdx["yourself"]=2;
  59663. //>>excludeEnd("ctx");
  59664. $11=_st($12).__eq_eq(true._yourself());
  59665. self._assert_($11);
  59666. return self;
  59667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59668. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)});
  59669. //>>excludeEnd("ctx");
  59670. },
  59671. //>>excludeStart("ide", pragmas.excludeIdeData);
  59672. args: [],
  59673. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  59674. referencedClasses: [],
  59675. //>>excludeEnd("ide");
  59676. messageSends: ["deny:", "==", "assert:", "yourself"]
  59677. }),
  59678. globals.BooleanTest);
  59679. smalltalk.addMethod(
  59680. smalltalk.method({
  59681. selector: "testIfTrueIfFalse",
  59682. protocol: 'tests',
  59683. fn: function (){
  59684. var self=this;
  59685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59686. return smalltalk.withContext(function($ctx1) {
  59687. //>>excludeEnd("ctx");
  59688. var $1,$2,$3,$4,$5,$6,$7,$8;
  59689. if(smalltalk.assert(true)){
  59690. $1="alternative block";
  59691. };
  59692. self._assert_equals_($1,"alternative block");
  59693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59694. $ctx1.sendIdx["assert:equals:"]=1;
  59695. //>>excludeEnd("ctx");
  59696. if(! smalltalk.assert(true)){
  59697. $2="alternative block";
  59698. };
  59699. self._assert_equals_($2,nil);
  59700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59701. $ctx1.sendIdx["assert:equals:"]=2;
  59702. //>>excludeEnd("ctx");
  59703. if(smalltalk.assert(false)){
  59704. $3="alternative block";
  59705. };
  59706. self._assert_equals_($3,nil);
  59707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59708. $ctx1.sendIdx["assert:equals:"]=3;
  59709. //>>excludeEnd("ctx");
  59710. if(! smalltalk.assert(false)){
  59711. $4="alternative block";
  59712. };
  59713. self._assert_equals_($4,"alternative block");
  59714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59715. $ctx1.sendIdx["assert:equals:"]=4;
  59716. //>>excludeEnd("ctx");
  59717. if(smalltalk.assert(false)){
  59718. $5="alternative block";
  59719. } else {
  59720. $5="alternative block2";
  59721. };
  59722. self._assert_equals_($5,"alternative block2");
  59723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59724. $ctx1.sendIdx["assert:equals:"]=5;
  59725. //>>excludeEnd("ctx");
  59726. if(smalltalk.assert(false)){
  59727. $6="alternative block2";
  59728. } else {
  59729. $6="alternative block";
  59730. };
  59731. self._assert_equals_($6,"alternative block");
  59732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59733. $ctx1.sendIdx["assert:equals:"]=6;
  59734. //>>excludeEnd("ctx");
  59735. if(smalltalk.assert(true)){
  59736. $7="alternative block";
  59737. } else {
  59738. $7="alternative block2";
  59739. };
  59740. self._assert_equals_($7,"alternative block");
  59741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59742. $ctx1.sendIdx["assert:equals:"]=7;
  59743. //>>excludeEnd("ctx");
  59744. if(smalltalk.assert(true)){
  59745. $8="alternative block2";
  59746. } else {
  59747. $8="alternative block";
  59748. };
  59749. self._assert_equals_($8,"alternative block2");
  59750. return self;
  59751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59752. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)});
  59753. //>>excludeEnd("ctx");
  59754. },
  59755. //>>excludeStart("ide", pragmas.excludeIdeData);
  59756. args: [],
  59757. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  59758. referencedClasses: [],
  59759. //>>excludeEnd("ide");
  59760. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  59761. }),
  59762. globals.BooleanTest);
  59763. smalltalk.addMethod(
  59764. smalltalk.method({
  59765. selector: "testIfTrueIfFalseWithBoxing",
  59766. protocol: 'tests',
  59767. fn: function (){
  59768. var self=this;
  59769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59770. return smalltalk.withContext(function($ctx1) {
  59771. //>>excludeEnd("ctx");
  59772. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  59773. $2=true._yourself();
  59774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59775. $ctx1.sendIdx["yourself"]=1;
  59776. //>>excludeEnd("ctx");
  59777. if(smalltalk.assert($2)){
  59778. $1="alternative block";
  59779. };
  59780. self._assert_equals_($1,"alternative block");
  59781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59782. $ctx1.sendIdx["assert:equals:"]=1;
  59783. //>>excludeEnd("ctx");
  59784. $4=true._yourself();
  59785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59786. $ctx1.sendIdx["yourself"]=2;
  59787. //>>excludeEnd("ctx");
  59788. if(! smalltalk.assert($4)){
  59789. $3="alternative block";
  59790. };
  59791. self._assert_equals_($3,nil);
  59792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59793. $ctx1.sendIdx["assert:equals:"]=2;
  59794. //>>excludeEnd("ctx");
  59795. $6=false._yourself();
  59796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59797. $ctx1.sendIdx["yourself"]=3;
  59798. //>>excludeEnd("ctx");
  59799. if(smalltalk.assert($6)){
  59800. $5="alternative block";
  59801. };
  59802. self._assert_equals_($5,nil);
  59803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59804. $ctx1.sendIdx["assert:equals:"]=3;
  59805. //>>excludeEnd("ctx");
  59806. $8=false._yourself();
  59807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59808. $ctx1.sendIdx["yourself"]=4;
  59809. //>>excludeEnd("ctx");
  59810. if(! smalltalk.assert($8)){
  59811. $7="alternative block";
  59812. };
  59813. self._assert_equals_($7,"alternative block");
  59814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59815. $ctx1.sendIdx["assert:equals:"]=4;
  59816. //>>excludeEnd("ctx");
  59817. $10=false._yourself();
  59818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59819. $ctx1.sendIdx["yourself"]=5;
  59820. //>>excludeEnd("ctx");
  59821. if(smalltalk.assert($10)){
  59822. $9="alternative block";
  59823. } else {
  59824. $9="alternative block2";
  59825. };
  59826. self._assert_equals_($9,"alternative block2");
  59827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59828. $ctx1.sendIdx["assert:equals:"]=5;
  59829. //>>excludeEnd("ctx");
  59830. $12=false._yourself();
  59831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59832. $ctx1.sendIdx["yourself"]=6;
  59833. //>>excludeEnd("ctx");
  59834. if(smalltalk.assert($12)){
  59835. $11="alternative block2";
  59836. } else {
  59837. $11="alternative block";
  59838. };
  59839. self._assert_equals_($11,"alternative block");
  59840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59841. $ctx1.sendIdx["assert:equals:"]=6;
  59842. //>>excludeEnd("ctx");
  59843. $14=true._yourself();
  59844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59845. $ctx1.sendIdx["yourself"]=7;
  59846. //>>excludeEnd("ctx");
  59847. if(smalltalk.assert($14)){
  59848. $13="alternative block";
  59849. } else {
  59850. $13="alternative block2";
  59851. };
  59852. self._assert_equals_($13,"alternative block");
  59853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59854. $ctx1.sendIdx["assert:equals:"]=7;
  59855. //>>excludeEnd("ctx");
  59856. $16=true._yourself();
  59857. if(smalltalk.assert($16)){
  59858. $15="alternative block2";
  59859. } else {
  59860. $15="alternative block";
  59861. };
  59862. self._assert_equals_($15,"alternative block2");
  59863. return self;
  59864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59865. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)});
  59866. //>>excludeEnd("ctx");
  59867. },
  59868. //>>excludeStart("ide", pragmas.excludeIdeData);
  59869. args: [],
  59870. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  59871. referencedClasses: [],
  59872. //>>excludeEnd("ide");
  59873. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  59874. }),
  59875. globals.BooleanTest);
  59876. smalltalk.addMethod(
  59877. smalltalk.method({
  59878. selector: "testLogic",
  59879. protocol: 'tests',
  59880. fn: function (){
  59881. var self=this;
  59882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59883. return smalltalk.withContext(function($ctx1) {
  59884. //>>excludeEnd("ctx");
  59885. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  59886. $1=true.__and(true);
  59887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59888. $ctx1.sendIdx["&"]=1;
  59889. //>>excludeEnd("ctx");
  59890. self._assert_($1);
  59891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59892. $ctx1.sendIdx["assert:"]=1;
  59893. //>>excludeEnd("ctx");
  59894. $2=true.__and(false);
  59895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59896. $ctx1.sendIdx["&"]=2;
  59897. //>>excludeEnd("ctx");
  59898. self._deny_($2);
  59899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59900. $ctx1.sendIdx["deny:"]=1;
  59901. //>>excludeEnd("ctx");
  59902. $3=false.__and(true);
  59903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59904. $ctx1.sendIdx["&"]=3;
  59905. //>>excludeEnd("ctx");
  59906. self._deny_($3);
  59907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59908. $ctx1.sendIdx["deny:"]=2;
  59909. //>>excludeEnd("ctx");
  59910. $5=false.__and(false);
  59911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59912. $ctx1.sendIdx["&"]=4;
  59913. //>>excludeEnd("ctx");
  59914. $4=self._deny_($5);
  59915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59916. $ctx1.sendIdx["deny:"]=3;
  59917. //>>excludeEnd("ctx");
  59918. $6=true.__or(true);
  59919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59920. $ctx1.sendIdx["|"]=1;
  59921. //>>excludeEnd("ctx");
  59922. self._assert_($6);
  59923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59924. $ctx1.sendIdx["assert:"]=2;
  59925. //>>excludeEnd("ctx");
  59926. $7=true.__or(false);
  59927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59928. $ctx1.sendIdx["|"]=2;
  59929. //>>excludeEnd("ctx");
  59930. self._assert_($7);
  59931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59932. $ctx1.sendIdx["assert:"]=3;
  59933. //>>excludeEnd("ctx");
  59934. $8=false.__or(true);
  59935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59936. $ctx1.sendIdx["|"]=3;
  59937. //>>excludeEnd("ctx");
  59938. self._assert_($8);
  59939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59940. $ctx1.sendIdx["assert:"]=4;
  59941. //>>excludeEnd("ctx");
  59942. $10=false.__or(false);
  59943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59944. $ctx1.sendIdx["|"]=4;
  59945. //>>excludeEnd("ctx");
  59946. $9=self._deny_($10);
  59947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59948. $ctx1.sendIdx["deny:"]=4;
  59949. //>>excludeEnd("ctx");
  59950. $12=(1).__gt((0));
  59951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59952. $ctx1.sendIdx[">"]=1;
  59953. //>>excludeEnd("ctx");
  59954. $11=true.__and($12);
  59955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59956. $ctx1.sendIdx["&"]=5;
  59957. //>>excludeEnd("ctx");
  59958. self._assert_($11);
  59959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59960. $ctx1.sendIdx["assert:"]=5;
  59961. //>>excludeEnd("ctx");
  59962. $14=(1).__gt((0));
  59963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59964. $ctx1.sendIdx[">"]=2;
  59965. //>>excludeEnd("ctx");
  59966. $13=_st($14).__and(false);
  59967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59968. $ctx1.sendIdx["&"]=6;
  59969. //>>excludeEnd("ctx");
  59970. self._deny_($13);
  59971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59972. $ctx1.sendIdx["deny:"]=5;
  59973. //>>excludeEnd("ctx");
  59974. $17=(1).__gt((0));
  59975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59976. $ctx1.sendIdx[">"]=3;
  59977. //>>excludeEnd("ctx");
  59978. $18=(1).__gt((2));
  59979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59980. $ctx1.sendIdx[">"]=4;
  59981. //>>excludeEnd("ctx");
  59982. $16=_st($17).__and($18);
  59983. $15=self._deny_($16);
  59984. $20=(1).__gt((0));
  59985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59986. $ctx1.sendIdx[">"]=5;
  59987. //>>excludeEnd("ctx");
  59988. $19=false.__or($20);
  59989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59990. $ctx1.sendIdx["|"]=5;
  59991. //>>excludeEnd("ctx");
  59992. self._assert_($19);
  59993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59994. $ctx1.sendIdx["assert:"]=6;
  59995. //>>excludeEnd("ctx");
  59996. $22=(1).__gt((0));
  59997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59998. $ctx1.sendIdx[">"]=6;
  59999. //>>excludeEnd("ctx");
  60000. $21=_st($22).__or(false);
  60001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60002. $ctx1.sendIdx["|"]=6;
  60003. //>>excludeEnd("ctx");
  60004. self._assert_($21);
  60005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60006. $ctx1.sendIdx["assert:"]=7;
  60007. //>>excludeEnd("ctx");
  60008. $25=(1).__gt((0));
  60009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60010. $ctx1.sendIdx[">"]=7;
  60011. //>>excludeEnd("ctx");
  60012. $24=_st($25).__or((1).__gt((2)));
  60013. $23=self._assert_($24);
  60014. return self;
  60015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60016. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)});
  60017. //>>excludeEnd("ctx");
  60018. },
  60019. //>>excludeStart("ide", pragmas.excludeIdeData);
  60020. args: [],
  60021. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  60022. referencedClasses: [],
  60023. //>>excludeEnd("ide");
  60024. messageSends: ["assert:", "&", "deny:", "|", ">"]
  60025. }),
  60026. globals.BooleanTest);
  60027. smalltalk.addMethod(
  60028. smalltalk.method({
  60029. selector: "testLogicKeywords",
  60030. protocol: 'tests',
  60031. fn: function (){
  60032. var self=this;
  60033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60034. return smalltalk.withContext(function($ctx1) {
  60035. //>>excludeEnd("ctx");
  60036. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  60037. $1=true._and_((function(){
  60038. return true;
  60039. }));
  60040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60041. $ctx1.sendIdx["and:"]=1;
  60042. //>>excludeEnd("ctx");
  60043. self._assert_($1);
  60044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60045. $ctx1.sendIdx["assert:"]=1;
  60046. //>>excludeEnd("ctx");
  60047. $2=true._and_((function(){
  60048. return false;
  60049. }));
  60050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60051. $ctx1.sendIdx["and:"]=2;
  60052. //>>excludeEnd("ctx");
  60053. self._deny_($2);
  60054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60055. $ctx1.sendIdx["deny:"]=1;
  60056. //>>excludeEnd("ctx");
  60057. $3=false._and_((function(){
  60058. return true;
  60059. }));
  60060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60061. $ctx1.sendIdx["and:"]=3;
  60062. //>>excludeEnd("ctx");
  60063. self._deny_($3);
  60064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60065. $ctx1.sendIdx["deny:"]=2;
  60066. //>>excludeEnd("ctx");
  60067. $5=false._and_((function(){
  60068. return false;
  60069. }));
  60070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60071. $ctx1.sendIdx["and:"]=4;
  60072. //>>excludeEnd("ctx");
  60073. $4=self._deny_($5);
  60074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60075. $ctx1.sendIdx["deny:"]=3;
  60076. //>>excludeEnd("ctx");
  60077. $6=true._or_((function(){
  60078. return true;
  60079. }));
  60080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60081. $ctx1.sendIdx["or:"]=1;
  60082. //>>excludeEnd("ctx");
  60083. self._assert_($6);
  60084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60085. $ctx1.sendIdx["assert:"]=2;
  60086. //>>excludeEnd("ctx");
  60087. $7=true._or_((function(){
  60088. return false;
  60089. }));
  60090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60091. $ctx1.sendIdx["or:"]=2;
  60092. //>>excludeEnd("ctx");
  60093. self._assert_($7);
  60094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60095. $ctx1.sendIdx["assert:"]=3;
  60096. //>>excludeEnd("ctx");
  60097. $8=false._or_((function(){
  60098. return true;
  60099. }));
  60100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60101. $ctx1.sendIdx["or:"]=3;
  60102. //>>excludeEnd("ctx");
  60103. self._assert_($8);
  60104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60105. $ctx1.sendIdx["assert:"]=4;
  60106. //>>excludeEnd("ctx");
  60107. $10=false._or_((function(){
  60108. return false;
  60109. }));
  60110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60111. $ctx1.sendIdx["or:"]=4;
  60112. //>>excludeEnd("ctx");
  60113. $9=self._deny_($10);
  60114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60115. $ctx1.sendIdx["deny:"]=4;
  60116. //>>excludeEnd("ctx");
  60117. $11=true._and_((function(){
  60118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60119. return smalltalk.withContext(function($ctx2) {
  60120. //>>excludeEnd("ctx");
  60121. return (1).__gt((0));
  60122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60123. $ctx2.sendIdx[">"]=1;
  60124. //>>excludeEnd("ctx");
  60125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  60127. //>>excludeEnd("ctx");
  60128. }));
  60129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60130. $ctx1.sendIdx["and:"]=5;
  60131. //>>excludeEnd("ctx");
  60132. self._assert_($11);
  60133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60134. $ctx1.sendIdx["assert:"]=5;
  60135. //>>excludeEnd("ctx");
  60136. $13=(1).__gt((0));
  60137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60138. $ctx1.sendIdx[">"]=2;
  60139. //>>excludeEnd("ctx");
  60140. $12=_st($13)._and_((function(){
  60141. return false;
  60142. }));
  60143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60144. $ctx1.sendIdx["and:"]=6;
  60145. //>>excludeEnd("ctx");
  60146. self._deny_($12);
  60147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60148. $ctx1.sendIdx["deny:"]=5;
  60149. //>>excludeEnd("ctx");
  60150. $16=(1).__gt((0));
  60151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60152. $ctx1.sendIdx[">"]=3;
  60153. //>>excludeEnd("ctx");
  60154. $15=_st($16)._and_((function(){
  60155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60156. return smalltalk.withContext(function($ctx2) {
  60157. //>>excludeEnd("ctx");
  60158. return (1).__gt((2));
  60159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60160. $ctx2.sendIdx[">"]=4;
  60161. //>>excludeEnd("ctx");
  60162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  60164. //>>excludeEnd("ctx");
  60165. }));
  60166. $14=self._deny_($15);
  60167. $17=false._or_((function(){
  60168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60169. return smalltalk.withContext(function($ctx2) {
  60170. //>>excludeEnd("ctx");
  60171. return (1).__gt((0));
  60172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60173. $ctx2.sendIdx[">"]=5;
  60174. //>>excludeEnd("ctx");
  60175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  60177. //>>excludeEnd("ctx");
  60178. }));
  60179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60180. $ctx1.sendIdx["or:"]=5;
  60181. //>>excludeEnd("ctx");
  60182. self._assert_($17);
  60183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60184. $ctx1.sendIdx["assert:"]=6;
  60185. //>>excludeEnd("ctx");
  60186. $19=(1).__gt((0));
  60187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60188. $ctx1.sendIdx[">"]=6;
  60189. //>>excludeEnd("ctx");
  60190. $18=_st($19)._or_((function(){
  60191. return false;
  60192. }));
  60193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60194. $ctx1.sendIdx["or:"]=6;
  60195. //>>excludeEnd("ctx");
  60196. self._assert_($18);
  60197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60198. $ctx1.sendIdx["assert:"]=7;
  60199. //>>excludeEnd("ctx");
  60200. $22=(1).__gt((0));
  60201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60202. $ctx1.sendIdx[">"]=7;
  60203. //>>excludeEnd("ctx");
  60204. $21=_st($22)._or_((function(){
  60205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60206. return smalltalk.withContext(function($ctx2) {
  60207. //>>excludeEnd("ctx");
  60208. return (1).__gt((2));
  60209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  60211. //>>excludeEnd("ctx");
  60212. }));
  60213. $20=self._assert_($21);
  60214. return self;
  60215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60216. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)});
  60217. //>>excludeEnd("ctx");
  60218. },
  60219. //>>excludeStart("ide", pragmas.excludeIdeData);
  60220. args: [],
  60221. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  60222. referencedClasses: [],
  60223. //>>excludeEnd("ide");
  60224. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  60225. }),
  60226. globals.BooleanTest);
  60227. smalltalk.addMethod(
  60228. smalltalk.method({
  60229. selector: "testNonBooleanError",
  60230. protocol: 'tests',
  60231. fn: function (){
  60232. var self=this;
  60233. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  60234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60235. return smalltalk.withContext(function($ctx1) {
  60236. //>>excludeEnd("ctx");
  60237. self._should_raise_((function(){
  60238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60239. return smalltalk.withContext(function($ctx2) {
  60240. //>>excludeEnd("ctx");
  60241. if(smalltalk.assert("")){
  60242. } else {
  60243. };
  60244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60246. //>>excludeEnd("ctx");
  60247. }),$NonBooleanReceiver());
  60248. return self;
  60249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60250. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)});
  60251. //>>excludeEnd("ctx");
  60252. },
  60253. //>>excludeStart("ide", pragmas.excludeIdeData);
  60254. args: [],
  60255. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  60256. referencedClasses: ["NonBooleanReceiver"],
  60257. //>>excludeEnd("ide");
  60258. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  60259. }),
  60260. globals.BooleanTest);
  60261. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  60262. smalltalk.addMethod(
  60263. smalltalk.method({
  60264. selector: "setUp",
  60265. protocol: 'running',
  60266. fn: function (){
  60267. var self=this;
  60268. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  60269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60270. return smalltalk.withContext(function($ctx1) {
  60271. //>>excludeEnd("ctx");
  60272. self["@builder"]=_st($ClassBuilder())._new();
  60273. return self;
  60274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60275. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)});
  60276. //>>excludeEnd("ctx");
  60277. },
  60278. //>>excludeStart("ide", pragmas.excludeIdeData);
  60279. args: [],
  60280. source: "setUp\x0a\x09builder := ClassBuilder new",
  60281. referencedClasses: ["ClassBuilder"],
  60282. //>>excludeEnd("ide");
  60283. messageSends: ["new"]
  60284. }),
  60285. globals.ClassBuilderTest);
  60286. smalltalk.addMethod(
  60287. smalltalk.method({
  60288. selector: "tearDown",
  60289. protocol: 'running',
  60290. fn: function (){
  60291. var self=this;
  60292. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60294. return smalltalk.withContext(function($ctx1) {
  60295. //>>excludeEnd("ctx");
  60296. var $1,$receiver;
  60297. $1=self["@theClass"];
  60298. if(($receiver = $1) == null || $receiver.isNil){
  60299. $1;
  60300. } else {
  60301. _st($Smalltalk())._removeClass_(self["@theClass"]);
  60302. self["@theClass"]=nil;
  60303. self["@theClass"];
  60304. };
  60305. return self;
  60306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60307. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)});
  60308. //>>excludeEnd("ctx");
  60309. },
  60310. //>>excludeStart("ide", pragmas.excludeIdeData);
  60311. args: [],
  60312. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  60313. referencedClasses: ["Smalltalk"],
  60314. //>>excludeEnd("ide");
  60315. messageSends: ["ifNotNil:", "removeClass:"]
  60316. }),
  60317. globals.ClassBuilderTest);
  60318. smalltalk.addMethod(
  60319. smalltalk.method({
  60320. selector: "testClassCopy",
  60321. protocol: 'tests',
  60322. fn: function (){
  60323. var self=this;
  60324. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  60325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60326. return smalltalk.withContext(function($ctx1) {
  60327. //>>excludeEnd("ctx");
  60328. var $2,$1,$4,$3,$6,$5,$8,$7;
  60329. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  60330. $2=_st(self["@theClass"])._superclass();
  60331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60332. $ctx1.sendIdx["superclass"]=1;
  60333. //>>excludeEnd("ctx");
  60334. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  60335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60336. $ctx1.sendIdx["=="]=1;
  60337. //>>excludeEnd("ctx");
  60338. self._assert_($1);
  60339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60340. $ctx1.sendIdx["assert:"]=1;
  60341. //>>excludeEnd("ctx");
  60342. $4=_st(self["@theClass"])._instanceVariableNames();
  60343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60344. $ctx1.sendIdx["instanceVariableNames"]=1;
  60345. //>>excludeEnd("ctx");
  60346. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  60347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60348. $ctx1.sendIdx["=="]=2;
  60349. //>>excludeEnd("ctx");
  60350. self._assert_($3);
  60351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60352. $ctx1.sendIdx["assert:"]=2;
  60353. //>>excludeEnd("ctx");
  60354. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  60355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60356. $ctx1.sendIdx["assert:equals:"]=1;
  60357. //>>excludeEnd("ctx");
  60358. $6=_st(self["@theClass"])._package();
  60359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60360. $ctx1.sendIdx["package"]=1;
  60361. //>>excludeEnd("ctx");
  60362. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  60363. self._assert_($5);
  60364. $8=_st(self["@theClass"])._methodDictionary();
  60365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60366. $ctx1.sendIdx["methodDictionary"]=1;
  60367. //>>excludeEnd("ctx");
  60368. $7=_st($8)._keys();
  60369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60370. $ctx1.sendIdx["keys"]=1;
  60371. //>>excludeEnd("ctx");
  60372. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  60373. return self;
  60374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60375. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)});
  60376. //>>excludeEnd("ctx");
  60377. },
  60378. //>>excludeStart("ide", pragmas.excludeIdeData);
  60379. args: [],
  60380. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  60381. referencedClasses: ["ObjectMock"],
  60382. //>>excludeEnd("ide");
  60383. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  60384. }),
  60385. globals.ClassBuilderTest);
  60386. smalltalk.addMethod(
  60387. smalltalk.method({
  60388. selector: "testClassMigration",
  60389. protocol: 'tests',
  60390. fn: function (){
  60391. var self=this;
  60392. var instance,oldClass;
  60393. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  60394. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60395. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  60396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60397. return smalltalk.withContext(function($ctx1) {
  60398. //>>excludeEnd("ctx");
  60399. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  60400. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  60401. $2=_st($Smalltalk())._globals();
  60402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60403. $ctx1.sendIdx["globals"]=1;
  60404. //>>excludeEnd("ctx");
  60405. $1=_st($2)._at_("ObjectMock2");
  60406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60407. $ctx1.sendIdx["at:"]=1;
  60408. //>>excludeEnd("ctx");
  60409. instance=_st($1)._new();
  60410. $4=_st($Smalltalk())._globals();
  60411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60412. $ctx1.sendIdx["globals"]=2;
  60413. //>>excludeEnd("ctx");
  60414. $3=_st($4)._at_("ObjectMock2");
  60415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60416. $ctx1.sendIdx["at:"]=2;
  60417. //>>excludeEnd("ctx");
  60418. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  60419. $5=_st(oldClass).__eq_eq($ObjectMock2());
  60420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60421. $ctx1.sendIdx["=="]=1;
  60422. //>>excludeEnd("ctx");
  60423. self._deny_($5);
  60424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60425. $ctx1.sendIdx["deny:"]=1;
  60426. //>>excludeEnd("ctx");
  60427. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  60428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60429. $ctx1.sendIdx["=="]=2;
  60430. //>>excludeEnd("ctx");
  60431. self._assert_($6);
  60432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60433. $ctx1.sendIdx["assert:"]=1;
  60434. //>>excludeEnd("ctx");
  60435. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  60436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60437. $ctx1.sendIdx["assert:"]=2;
  60438. //>>excludeEnd("ctx");
  60439. $7=_st($ObjectMock2())._selectors();
  60440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60441. $ctx1.sendIdx["selectors"]=1;
  60442. //>>excludeEnd("ctx");
  60443. self._assert_equals_($7,_st(oldClass)._selectors());
  60444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60445. $ctx1.sendIdx["assert:equals:"]=1;
  60446. //>>excludeEnd("ctx");
  60447. $8=_st($ObjectMock2())._comment();
  60448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60449. $ctx1.sendIdx["comment"]=1;
  60450. //>>excludeEnd("ctx");
  60451. self._assert_equals_($8,_st(oldClass)._comment());
  60452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60453. $ctx1.sendIdx["assert:equals:"]=2;
  60454. //>>excludeEnd("ctx");
  60455. $9=_st(_st($ObjectMock2())._package())._name();
  60456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60457. $ctx1.sendIdx["name"]=1;
  60458. //>>excludeEnd("ctx");
  60459. self._assert_equals_($9,"Kernel-Tests");
  60460. $11=_st(instance)._class();
  60461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60462. $ctx1.sendIdx["class"]=1;
  60463. //>>excludeEnd("ctx");
  60464. $10=_st($11).__eq_eq($ObjectMock2());
  60465. self._deny_($10);
  60466. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  60467. _st($Smalltalk())._removeClass_($ObjectMock2());
  60468. return self;
  60469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60470. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)});
  60471. //>>excludeEnd("ctx");
  60472. },
  60473. //>>excludeStart("ide", pragmas.excludeIdeData);
  60474. args: [],
  60475. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  60476. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  60477. //>>excludeEnd("ide");
  60478. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  60479. }),
  60480. globals.ClassBuilderTest);
  60481. smalltalk.addMethod(
  60482. smalltalk.method({
  60483. selector: "testClassMigrationWithClassInstanceVariables",
  60484. protocol: 'tests',
  60485. fn: function (){
  60486. var self=this;
  60487. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  60488. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  60489. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60491. return smalltalk.withContext(function($ctx1) {
  60492. //>>excludeEnd("ctx");
  60493. var $1;
  60494. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  60495. $1=_st($ObjectMock2())._class();
  60496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60497. $ctx1.sendIdx["class"]=1;
  60498. //>>excludeEnd("ctx");
  60499. _st($1)._instanceVariableNames_("foo bar");
  60500. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  60501. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  60502. _st($Smalltalk())._removeClass_($ObjectMock2());
  60503. return self;
  60504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60505. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)});
  60506. //>>excludeEnd("ctx");
  60507. },
  60508. //>>excludeStart("ide", pragmas.excludeIdeData);
  60509. args: [],
  60510. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  60511. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  60512. //>>excludeEnd("ide");
  60513. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  60514. }),
  60515. globals.ClassBuilderTest);
  60516. smalltalk.addMethod(
  60517. smalltalk.method({
  60518. selector: "testClassMigrationWithSubclasses",
  60519. protocol: 'tests',
  60520. fn: function (){
  60521. var self=this;
  60522. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  60523. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  60524. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  60525. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60526. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  60527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60528. return smalltalk.withContext(function($ctx1) {
  60529. //>>excludeEnd("ctx");
  60530. var $2,$1,$4,$3;
  60531. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  60532. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  60533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60534. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  60535. //>>excludeEnd("ctx");
  60536. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  60537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60538. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  60539. //>>excludeEnd("ctx");
  60540. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  60541. $2=_st($ObjectMock())._subclasses();
  60542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60543. $ctx1.sendIdx["subclasses"]=1;
  60544. //>>excludeEnd("ctx");
  60545. $1=_st($2)._includes_($ObjectMock2());
  60546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60547. $ctx1.sendIdx["includes:"]=1;
  60548. //>>excludeEnd("ctx");
  60549. self._assert_($1);
  60550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60551. $ctx1.sendIdx["assert:"]=1;
  60552. //>>excludeEnd("ctx");
  60553. $4=_st($ObjectMock2())._subclasses();
  60554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60555. $ctx1.sendIdx["subclasses"]=2;
  60556. //>>excludeEnd("ctx");
  60557. $3=_st($4)._includes_($ObjectMock3());
  60558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60559. $ctx1.sendIdx["includes:"]=2;
  60560. //>>excludeEnd("ctx");
  60561. self._assert_($3);
  60562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60563. $ctx1.sendIdx["assert:"]=2;
  60564. //>>excludeEnd("ctx");
  60565. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  60566. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  60567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60568. return smalltalk.withContext(function($ctx2) {
  60569. //>>excludeEnd("ctx");
  60570. return _st($Smalltalk())._removeClass_(each);
  60571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60573. //>>excludeEnd("ctx");
  60574. }));
  60575. return self;
  60576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60577. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)});
  60578. //>>excludeEnd("ctx");
  60579. },
  60580. //>>excludeStart("ide", pragmas.excludeIdeData);
  60581. args: [],
  60582. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]",
  60583. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  60584. //>>excludeEnd("ide");
  60585. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  60586. }),
  60587. globals.ClassBuilderTest);
  60588. smalltalk.addMethod(
  60589. smalltalk.method({
  60590. selector: "testInstanceVariableNames",
  60591. protocol: 'tests',
  60592. fn: function (){
  60593. var self=this;
  60594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60595. return smalltalk.withContext(function($ctx1) {
  60596. //>>excludeEnd("ctx");
  60597. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  60598. return self;
  60599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60600. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)});
  60601. //>>excludeEnd("ctx");
  60602. },
  60603. //>>excludeStart("ide", pragmas.excludeIdeData);
  60604. args: [],
  60605. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  60606. referencedClasses: [],
  60607. //>>excludeEnd("ide");
  60608. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  60609. }),
  60610. globals.ClassBuilderTest);
  60611. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  60612. smalltalk.addMethod(
  60613. smalltalk.method({
  60614. selector: "assertSameContents:as:",
  60615. protocol: 'convenience',
  60616. fn: function (aCollection,anotherCollection){
  60617. var self=this;
  60618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60619. return smalltalk.withContext(function($ctx1) {
  60620. //>>excludeEnd("ctx");
  60621. var $2,$1,$4,$3;
  60622. $2=_st(aCollection)._size();
  60623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60624. $ctx1.sendIdx["size"]=1;
  60625. //>>excludeEnd("ctx");
  60626. $1=_st($2).__eq(_st(anotherCollection)._size());
  60627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60628. $ctx1.sendIdx["="]=1;
  60629. //>>excludeEnd("ctx");
  60630. self._assert_($1);
  60631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60632. $ctx1.sendIdx["assert:"]=1;
  60633. //>>excludeEnd("ctx");
  60634. _st(aCollection)._do_((function(each){
  60635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60636. return smalltalk.withContext(function($ctx2) {
  60637. //>>excludeEnd("ctx");
  60638. $4=_st(aCollection)._occurrencesOf_(each);
  60639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60640. $ctx2.sendIdx["occurrencesOf:"]=1;
  60641. //>>excludeEnd("ctx");
  60642. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  60643. return self._assert_($3);
  60644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60646. //>>excludeEnd("ctx");
  60647. }));
  60648. return self;
  60649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60650. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)});
  60651. //>>excludeEnd("ctx");
  60652. },
  60653. //>>excludeStart("ide", pragmas.excludeIdeData);
  60654. args: ["aCollection", "anotherCollection"],
  60655. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  60656. referencedClasses: [],
  60657. //>>excludeEnd("ide");
  60658. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  60659. }),
  60660. globals.CollectionTest);
  60661. smalltalk.addMethod(
  60662. smalltalk.method({
  60663. selector: "collection",
  60664. protocol: 'fixture',
  60665. fn: function (){
  60666. var self=this;
  60667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60668. return smalltalk.withContext(function($ctx1) {
  60669. //>>excludeEnd("ctx");
  60670. self._subclassResponsibility();
  60671. return self;
  60672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60673. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)});
  60674. //>>excludeEnd("ctx");
  60675. },
  60676. //>>excludeStart("ide", pragmas.excludeIdeData);
  60677. args: [],
  60678. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  60679. referencedClasses: [],
  60680. //>>excludeEnd("ide");
  60681. messageSends: ["subclassResponsibility"]
  60682. }),
  60683. globals.CollectionTest);
  60684. smalltalk.addMethod(
  60685. smalltalk.method({
  60686. selector: "collectionClass",
  60687. protocol: 'fixture',
  60688. fn: function (){
  60689. var self=this;
  60690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60691. return smalltalk.withContext(function($ctx1) {
  60692. //>>excludeEnd("ctx");
  60693. var $1;
  60694. $1=_st(self._class())._collectionClass();
  60695. return $1;
  60696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60697. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)});
  60698. //>>excludeEnd("ctx");
  60699. },
  60700. //>>excludeStart("ide", pragmas.excludeIdeData);
  60701. args: [],
  60702. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  60703. referencedClasses: [],
  60704. //>>excludeEnd("ide");
  60705. messageSends: ["collectionClass", "class"]
  60706. }),
  60707. globals.CollectionTest);
  60708. smalltalk.addMethod(
  60709. smalltalk.method({
  60710. selector: "collectionOfPrintStrings",
  60711. protocol: 'fixture',
  60712. fn: function (){
  60713. var self=this;
  60714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60715. return smalltalk.withContext(function($ctx1) {
  60716. //>>excludeEnd("ctx");
  60717. self._subclassResponsibility();
  60718. return self;
  60719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60720. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)});
  60721. //>>excludeEnd("ctx");
  60722. },
  60723. //>>excludeStart("ide", pragmas.excludeIdeData);
  60724. args: [],
  60725. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  60726. referencedClasses: [],
  60727. //>>excludeEnd("ide");
  60728. messageSends: ["subclassResponsibility"]
  60729. }),
  60730. globals.CollectionTest);
  60731. smalltalk.addMethod(
  60732. smalltalk.method({
  60733. selector: "collectionSize",
  60734. protocol: 'fixture',
  60735. fn: function (){
  60736. var self=this;
  60737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60738. return smalltalk.withContext(function($ctx1) {
  60739. //>>excludeEnd("ctx");
  60740. self._subclassResponsibility();
  60741. return self;
  60742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60743. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)});
  60744. //>>excludeEnd("ctx");
  60745. },
  60746. //>>excludeStart("ide", pragmas.excludeIdeData);
  60747. args: [],
  60748. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  60749. referencedClasses: [],
  60750. //>>excludeEnd("ide");
  60751. messageSends: ["subclassResponsibility"]
  60752. }),
  60753. globals.CollectionTest);
  60754. smalltalk.addMethod(
  60755. smalltalk.method({
  60756. selector: "collectionWithDuplicates",
  60757. protocol: 'fixture',
  60758. fn: function (){
  60759. var self=this;
  60760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60761. return smalltalk.withContext(function($ctx1) {
  60762. //>>excludeEnd("ctx");
  60763. self._subclassResponsibility();
  60764. return self;
  60765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60766. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)});
  60767. //>>excludeEnd("ctx");
  60768. },
  60769. //>>excludeStart("ide", pragmas.excludeIdeData);
  60770. args: [],
  60771. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  60772. referencedClasses: [],
  60773. //>>excludeEnd("ide");
  60774. messageSends: ["subclassResponsibility"]
  60775. }),
  60776. globals.CollectionTest);
  60777. smalltalk.addMethod(
  60778. smalltalk.method({
  60779. selector: "collectionWithNewValue",
  60780. protocol: 'fixture',
  60781. fn: function (){
  60782. var self=this;
  60783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60784. return smalltalk.withContext(function($ctx1) {
  60785. //>>excludeEnd("ctx");
  60786. self._subclassResponsibility();
  60787. return self;
  60788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60789. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)});
  60790. //>>excludeEnd("ctx");
  60791. },
  60792. //>>excludeStart("ide", pragmas.excludeIdeData);
  60793. args: [],
  60794. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  60795. referencedClasses: [],
  60796. //>>excludeEnd("ide");
  60797. messageSends: ["subclassResponsibility"]
  60798. }),
  60799. globals.CollectionTest);
  60800. smalltalk.addMethod(
  60801. smalltalk.method({
  60802. selector: "isCollectionReadOnly",
  60803. protocol: 'testing',
  60804. fn: function (){
  60805. var self=this;
  60806. return false;
  60807. },
  60808. //>>excludeStart("ide", pragmas.excludeIdeData);
  60809. args: [],
  60810. source: "isCollectionReadOnly\x0a\x09^ false",
  60811. referencedClasses: [],
  60812. //>>excludeEnd("ide");
  60813. messageSends: []
  60814. }),
  60815. globals.CollectionTest);
  60816. smalltalk.addMethod(
  60817. smalltalk.method({
  60818. selector: "sampleNewValue",
  60819. protocol: 'fixture',
  60820. fn: function (){
  60821. var self=this;
  60822. return "N";
  60823. },
  60824. //>>excludeStart("ide", pragmas.excludeIdeData);
  60825. args: [],
  60826. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  60827. referencedClasses: [],
  60828. //>>excludeEnd("ide");
  60829. messageSends: []
  60830. }),
  60831. globals.CollectionTest);
  60832. smalltalk.addMethod(
  60833. smalltalk.method({
  60834. selector: "sampleNewValueAsCollection",
  60835. protocol: 'fixture',
  60836. fn: function (){
  60837. var self=this;
  60838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60839. return smalltalk.withContext(function($ctx1) {
  60840. //>>excludeEnd("ctx");
  60841. var $1;
  60842. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  60843. return $1;
  60844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60845. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)});
  60846. //>>excludeEnd("ctx");
  60847. },
  60848. //>>excludeStart("ide", pragmas.excludeIdeData);
  60849. args: [],
  60850. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  60851. referencedClasses: [],
  60852. //>>excludeEnd("ide");
  60853. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  60854. }),
  60855. globals.CollectionTest);
  60856. smalltalk.addMethod(
  60857. smalltalk.method({
  60858. selector: "testAddAll",
  60859. protocol: 'tests',
  60860. fn: function (){
  60861. var self=this;
  60862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60863. return smalltalk.withContext(function($ctx1) {
  60864. //>>excludeEnd("ctx");
  60865. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  60866. $2=self._collection();
  60867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60868. $ctx1.sendIdx["collection"]=1;
  60869. //>>excludeEnd("ctx");
  60870. $3=$2;
  60871. $5=self._collectionClass();
  60872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60873. $ctx1.sendIdx["collectionClass"]=1;
  60874. //>>excludeEnd("ctx");
  60875. $4=_st($5)._new();
  60876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60877. $ctx1.sendIdx["new"]=1;
  60878. //>>excludeEnd("ctx");
  60879. _st($3)._addAll_($4);
  60880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60881. $ctx1.sendIdx["addAll:"]=1;
  60882. //>>excludeEnd("ctx");
  60883. $6=_st($2)._yourself();
  60884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60885. $ctx1.sendIdx["yourself"]=1;
  60886. //>>excludeEnd("ctx");
  60887. $1=$6;
  60888. $7=self._collection();
  60889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60890. $ctx1.sendIdx["collection"]=2;
  60891. //>>excludeEnd("ctx");
  60892. self._assert_equals_($1,$7);
  60893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60894. $ctx1.sendIdx["assert:equals:"]=1;
  60895. //>>excludeEnd("ctx");
  60896. $10=self._collectionClass();
  60897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60898. $ctx1.sendIdx["collectionClass"]=2;
  60899. //>>excludeEnd("ctx");
  60900. $9=_st($10)._new();
  60901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60902. $ctx1.sendIdx["new"]=2;
  60903. //>>excludeEnd("ctx");
  60904. $11=$9;
  60905. $12=self._collection();
  60906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60907. $ctx1.sendIdx["collection"]=3;
  60908. //>>excludeEnd("ctx");
  60909. _st($11)._addAll_($12);
  60910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60911. $ctx1.sendIdx["addAll:"]=2;
  60912. //>>excludeEnd("ctx");
  60913. $13=_st($9)._yourself();
  60914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60915. $ctx1.sendIdx["yourself"]=2;
  60916. //>>excludeEnd("ctx");
  60917. $8=$13;
  60918. $14=self._collection();
  60919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60920. $ctx1.sendIdx["collection"]=4;
  60921. //>>excludeEnd("ctx");
  60922. self._assert_equals_($8,$14);
  60923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60924. $ctx1.sendIdx["assert:equals:"]=2;
  60925. //>>excludeEnd("ctx");
  60926. $17=self._collectionClass();
  60927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60928. $ctx1.sendIdx["collectionClass"]=3;
  60929. //>>excludeEnd("ctx");
  60930. $16=_st($17)._new();
  60931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60932. $ctx1.sendIdx["new"]=3;
  60933. //>>excludeEnd("ctx");
  60934. $18=$16;
  60935. $20=self._collectionClass();
  60936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60937. $ctx1.sendIdx["collectionClass"]=4;
  60938. //>>excludeEnd("ctx");
  60939. $19=_st($20)._new();
  60940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60941. $ctx1.sendIdx["new"]=4;
  60942. //>>excludeEnd("ctx");
  60943. _st($18)._addAll_($19);
  60944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60945. $ctx1.sendIdx["addAll:"]=3;
  60946. //>>excludeEnd("ctx");
  60947. $21=_st($16)._yourself();
  60948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60949. $ctx1.sendIdx["yourself"]=3;
  60950. //>>excludeEnd("ctx");
  60951. $15=$21;
  60952. self._assert_equals_($15,_st(self._collectionClass())._new());
  60953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60954. $ctx1.sendIdx["assert:equals:"]=3;
  60955. //>>excludeEnd("ctx");
  60956. $23=self._collection();
  60957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60958. $ctx1.sendIdx["collection"]=5;
  60959. //>>excludeEnd("ctx");
  60960. $24=$23;
  60961. $25=self._sampleNewValueAsCollection();
  60962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60963. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  60964. //>>excludeEnd("ctx");
  60965. _st($24)._addAll_($25);
  60966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60967. $ctx1.sendIdx["addAll:"]=4;
  60968. //>>excludeEnd("ctx");
  60969. $26=_st($23)._yourself();
  60970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60971. $ctx1.sendIdx["yourself"]=4;
  60972. //>>excludeEnd("ctx");
  60973. $22=$26;
  60974. $27=self._collectionWithNewValue();
  60975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60976. $ctx1.sendIdx["collectionWithNewValue"]=1;
  60977. //>>excludeEnd("ctx");
  60978. self._assert_equals_($22,$27);
  60979. $28=self._sampleNewValueAsCollection();
  60980. _st($28)._addAll_(self._collection());
  60981. $29=_st($28)._yourself();
  60982. self._assertSameContents_as_($29,self._collectionWithNewValue());
  60983. return self;
  60984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60985. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)});
  60986. //>>excludeEnd("ctx");
  60987. },
  60988. //>>excludeStart("ide", pragmas.excludeIdeData);
  60989. args: [],
  60990. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  60991. referencedClasses: [],
  60992. //>>excludeEnd("ide");
  60993. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  60994. }),
  60995. globals.CollectionTest);
  60996. smalltalk.addMethod(
  60997. smalltalk.method({
  60998. selector: "testAllSatisfy",
  60999. protocol: 'tests',
  61000. fn: function (){
  61001. var self=this;
  61002. var collection,anyOne;
  61003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61004. return smalltalk.withContext(function($ctx1) {
  61005. //>>excludeEnd("ctx");
  61006. var $1;
  61007. collection=self._collection();
  61008. anyOne=_st(collection)._anyOne();
  61009. $1=_st(collection)._allSatisfy_((function(each){
  61010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61011. return smalltalk.withContext(function($ctx2) {
  61012. //>>excludeEnd("ctx");
  61013. return _st(collection)._includes_(each);
  61014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61016. //>>excludeEnd("ctx");
  61017. }));
  61018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61019. $ctx1.sendIdx["allSatisfy:"]=1;
  61020. //>>excludeEnd("ctx");
  61021. self._assert_($1);
  61022. self._deny_(_st(collection)._allSatisfy_((function(each){
  61023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61024. return smalltalk.withContext(function($ctx2) {
  61025. //>>excludeEnd("ctx");
  61026. return _st(each).__tild_eq(anyOne);
  61027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61028. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61029. //>>excludeEnd("ctx");
  61030. })));
  61031. return self;
  61032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61033. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)});
  61034. //>>excludeEnd("ctx");
  61035. },
  61036. //>>excludeStart("ide", pragmas.excludeIdeData);
  61037. args: [],
  61038. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  61039. referencedClasses: [],
  61040. //>>excludeEnd("ide");
  61041. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  61042. }),
  61043. globals.CollectionTest);
  61044. smalltalk.addMethod(
  61045. smalltalk.method({
  61046. selector: "testAnyOne",
  61047. protocol: 'tests',
  61048. fn: function (){
  61049. var self=this;
  61050. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  61051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61052. return smalltalk.withContext(function($ctx1) {
  61053. //>>excludeEnd("ctx");
  61054. var $2,$1;
  61055. self._should_raise_((function(){
  61056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61057. return smalltalk.withContext(function($ctx2) {
  61058. //>>excludeEnd("ctx");
  61059. return _st(_st(self._collectionClass())._new())._anyOne();
  61060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61061. $ctx2.sendIdx["anyOne"]=1;
  61062. //>>excludeEnd("ctx");
  61063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61065. //>>excludeEnd("ctx");
  61066. }),$Error());
  61067. $2=self._collection();
  61068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61069. $ctx1.sendIdx["collection"]=1;
  61070. //>>excludeEnd("ctx");
  61071. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  61072. self._assert_($1);
  61073. return self;
  61074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61075. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)});
  61076. //>>excludeEnd("ctx");
  61077. },
  61078. //>>excludeStart("ide", pragmas.excludeIdeData);
  61079. args: [],
  61080. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  61081. referencedClasses: ["Error"],
  61082. //>>excludeEnd("ide");
  61083. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  61084. }),
  61085. globals.CollectionTest);
  61086. smalltalk.addMethod(
  61087. smalltalk.method({
  61088. selector: "testAnySatisfy",
  61089. protocol: 'tests',
  61090. fn: function (){
  61091. var self=this;
  61092. var anyOne;
  61093. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  61094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61095. return smalltalk.withContext(function($ctx1) {
  61096. //>>excludeEnd("ctx");
  61097. var $1,$3,$2;
  61098. $1=self._collection();
  61099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61100. $ctx1.sendIdx["collection"]=1;
  61101. //>>excludeEnd("ctx");
  61102. anyOne=_st($1)._anyOne();
  61103. $3=self._collection();
  61104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61105. $ctx1.sendIdx["collection"]=2;
  61106. //>>excludeEnd("ctx");
  61107. $2=_st($3)._anySatisfy_((function(each){
  61108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61109. return smalltalk.withContext(function($ctx2) {
  61110. //>>excludeEnd("ctx");
  61111. return _st(each).__eq(anyOne);
  61112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61113. $ctx2.sendIdx["="]=1;
  61114. //>>excludeEnd("ctx");
  61115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61117. //>>excludeEnd("ctx");
  61118. }));
  61119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61120. $ctx1.sendIdx["anySatisfy:"]=1;
  61121. //>>excludeEnd("ctx");
  61122. self._assert_($2);
  61123. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  61124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61125. return smalltalk.withContext(function($ctx2) {
  61126. //>>excludeEnd("ctx");
  61127. return _st(each).__eq(_st($Object())._new());
  61128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61129. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61130. //>>excludeEnd("ctx");
  61131. })));
  61132. return self;
  61133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61134. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)});
  61135. //>>excludeEnd("ctx");
  61136. },
  61137. //>>excludeStart("ide", pragmas.excludeIdeData);
  61138. args: [],
  61139. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  61140. referencedClasses: ["Object"],
  61141. //>>excludeEnd("ide");
  61142. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  61143. }),
  61144. globals.CollectionTest);
  61145. smalltalk.addMethod(
  61146. smalltalk.method({
  61147. selector: "testAsArray",
  61148. protocol: 'tests',
  61149. fn: function (){
  61150. var self=this;
  61151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61152. return smalltalk.withContext(function($ctx1) {
  61153. //>>excludeEnd("ctx");
  61154. var $1;
  61155. $1=self._collection();
  61156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61157. $ctx1.sendIdx["collection"]=1;
  61158. //>>excludeEnd("ctx");
  61159. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  61160. return self;
  61161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61162. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)});
  61163. //>>excludeEnd("ctx");
  61164. },
  61165. //>>excludeStart("ide", pragmas.excludeIdeData);
  61166. args: [],
  61167. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  61168. referencedClasses: [],
  61169. //>>excludeEnd("ide");
  61170. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  61171. }),
  61172. globals.CollectionTest);
  61173. smalltalk.addMethod(
  61174. smalltalk.method({
  61175. selector: "testAsOrderedCollection",
  61176. protocol: 'tests',
  61177. fn: function (){
  61178. var self=this;
  61179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61180. return smalltalk.withContext(function($ctx1) {
  61181. //>>excludeEnd("ctx");
  61182. var $1;
  61183. $1=self._collection();
  61184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61185. $ctx1.sendIdx["collection"]=1;
  61186. //>>excludeEnd("ctx");
  61187. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  61188. return self;
  61189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61190. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)});
  61191. //>>excludeEnd("ctx");
  61192. },
  61193. //>>excludeStart("ide", pragmas.excludeIdeData);
  61194. args: [],
  61195. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  61196. referencedClasses: [],
  61197. //>>excludeEnd("ide");
  61198. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  61199. }),
  61200. globals.CollectionTest);
  61201. smalltalk.addMethod(
  61202. smalltalk.method({
  61203. selector: "testAsSet",
  61204. protocol: 'tests',
  61205. fn: function (){
  61206. var self=this;
  61207. var c,set;
  61208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61209. return smalltalk.withContext(function($ctx1) {
  61210. //>>excludeEnd("ctx");
  61211. c=self._collectionWithDuplicates();
  61212. set=_st(c)._asSet();
  61213. self._assert_equals_(_st(set)._size(),(5));
  61214. _st(c)._do_((function(each){
  61215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61216. return smalltalk.withContext(function($ctx2) {
  61217. //>>excludeEnd("ctx");
  61218. return self._assert_(_st(set)._includes_(each));
  61219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61221. //>>excludeEnd("ctx");
  61222. }));
  61223. return self;
  61224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61225. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)});
  61226. //>>excludeEnd("ctx");
  61227. },
  61228. //>>excludeStart("ide", pragmas.excludeIdeData);
  61229. args: [],
  61230. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  61231. referencedClasses: [],
  61232. //>>excludeEnd("ide");
  61233. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  61234. }),
  61235. globals.CollectionTest);
  61236. smalltalk.addMethod(
  61237. smalltalk.method({
  61238. selector: "testCollect",
  61239. protocol: 'tests',
  61240. fn: function (){
  61241. var self=this;
  61242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61243. return smalltalk.withContext(function($ctx1) {
  61244. //>>excludeEnd("ctx");
  61245. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  61246. $2=self._collection();
  61247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61248. $ctx1.sendIdx["collection"]=1;
  61249. //>>excludeEnd("ctx");
  61250. $1=_st($2)._collect_((function(each){
  61251. return each;
  61252. }));
  61253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61254. $ctx1.sendIdx["collect:"]=1;
  61255. //>>excludeEnd("ctx");
  61256. $3=self._collection();
  61257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61258. $ctx1.sendIdx["collection"]=2;
  61259. //>>excludeEnd("ctx");
  61260. self._assert_equals_($1,$3);
  61261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61262. $ctx1.sendIdx["assert:equals:"]=1;
  61263. //>>excludeEnd("ctx");
  61264. $5=self._collectionWithNewValue();
  61265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61266. $ctx1.sendIdx["collectionWithNewValue"]=1;
  61267. //>>excludeEnd("ctx");
  61268. $4=_st($5)._collect_((function(each){
  61269. return each;
  61270. }));
  61271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61272. $ctx1.sendIdx["collect:"]=2;
  61273. //>>excludeEnd("ctx");
  61274. self._assert_equals_($4,self._collectionWithNewValue());
  61275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61276. $ctx1.sendIdx["assert:equals:"]=2;
  61277. //>>excludeEnd("ctx");
  61278. $8=self._collectionClass();
  61279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61280. $ctx1.sendIdx["collectionClass"]=1;
  61281. //>>excludeEnd("ctx");
  61282. $7=_st($8)._new();
  61283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61284. $ctx1.sendIdx["new"]=1;
  61285. //>>excludeEnd("ctx");
  61286. $6=_st($7)._collect_((function(each){
  61287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61288. return smalltalk.withContext(function($ctx2) {
  61289. //>>excludeEnd("ctx");
  61290. return _st(each)._printString();
  61291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61292. $ctx2.sendIdx["printString"]=1;
  61293. //>>excludeEnd("ctx");
  61294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61296. //>>excludeEnd("ctx");
  61297. }));
  61298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61299. $ctx1.sendIdx["collect:"]=3;
  61300. //>>excludeEnd("ctx");
  61301. self._assert_equals_($6,_st(self._collectionClass())._new());
  61302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61303. $ctx1.sendIdx["assert:equals:"]=3;
  61304. //>>excludeEnd("ctx");
  61305. $11=self._collection();
  61306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61307. $ctx1.sendIdx["collection"]=3;
  61308. //>>excludeEnd("ctx");
  61309. $10=_st($11)._collect_((function(){
  61310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61311. return smalltalk.withContext(function($ctx2) {
  61312. //>>excludeEnd("ctx");
  61313. return self._sampleNewValue();
  61314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61315. $ctx2.sendIdx["sampleNewValue"]=1;
  61316. //>>excludeEnd("ctx");
  61317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  61319. //>>excludeEnd("ctx");
  61320. }));
  61321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61322. $ctx1.sendIdx["collect:"]=4;
  61323. //>>excludeEnd("ctx");
  61324. $9=_st($10)._detect_((function(){
  61325. return true;
  61326. }));
  61327. self._assert_equals_($9,self._sampleNewValue());
  61328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61329. $ctx1.sendIdx["assert:equals:"]=4;
  61330. //>>excludeEnd("ctx");
  61331. self._assert_equals_(_st(self._collection())._collect_((function(each){
  61332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61333. return smalltalk.withContext(function($ctx2) {
  61334. //>>excludeEnd("ctx");
  61335. return _st(each)._printString();
  61336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61337. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  61338. //>>excludeEnd("ctx");
  61339. })),self._collectionOfPrintStrings());
  61340. return self;
  61341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61342. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)});
  61343. //>>excludeEnd("ctx");
  61344. },
  61345. //>>excludeStart("ide", pragmas.excludeIdeData);
  61346. args: [],
  61347. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  61348. referencedClasses: [],
  61349. //>>excludeEnd("ide");
  61350. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  61351. }),
  61352. globals.CollectionTest);
  61353. smalltalk.addMethod(
  61354. smalltalk.method({
  61355. selector: "testComma",
  61356. protocol: 'tests',
  61357. fn: function (){
  61358. var self=this;
  61359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61360. return smalltalk.withContext(function($ctx1) {
  61361. //>>excludeEnd("ctx");
  61362. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  61363. $2=self._collection();
  61364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61365. $ctx1.sendIdx["collection"]=1;
  61366. //>>excludeEnd("ctx");
  61367. $4=self._collectionClass();
  61368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61369. $ctx1.sendIdx["collectionClass"]=1;
  61370. //>>excludeEnd("ctx");
  61371. $3=_st($4)._new();
  61372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61373. $ctx1.sendIdx["new"]=1;
  61374. //>>excludeEnd("ctx");
  61375. $1=_st($2).__comma($3);
  61376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61377. $ctx1.sendIdx[","]=1;
  61378. //>>excludeEnd("ctx");
  61379. $5=self._collection();
  61380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61381. $ctx1.sendIdx["collection"]=2;
  61382. //>>excludeEnd("ctx");
  61383. self._assert_equals_($1,$5);
  61384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61385. $ctx1.sendIdx["assert:equals:"]=1;
  61386. //>>excludeEnd("ctx");
  61387. $8=self._collectionClass();
  61388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61389. $ctx1.sendIdx["collectionClass"]=2;
  61390. //>>excludeEnd("ctx");
  61391. $7=_st($8)._new();
  61392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61393. $ctx1.sendIdx["new"]=2;
  61394. //>>excludeEnd("ctx");
  61395. $9=self._collection();
  61396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61397. $ctx1.sendIdx["collection"]=3;
  61398. //>>excludeEnd("ctx");
  61399. $6=_st($7).__comma($9);
  61400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61401. $ctx1.sendIdx[","]=2;
  61402. //>>excludeEnd("ctx");
  61403. $10=self._collection();
  61404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61405. $ctx1.sendIdx["collection"]=4;
  61406. //>>excludeEnd("ctx");
  61407. self._assert_equals_($6,$10);
  61408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61409. $ctx1.sendIdx["assert:equals:"]=2;
  61410. //>>excludeEnd("ctx");
  61411. $13=self._collectionClass();
  61412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61413. $ctx1.sendIdx["collectionClass"]=3;
  61414. //>>excludeEnd("ctx");
  61415. $12=_st($13)._new();
  61416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61417. $ctx1.sendIdx["new"]=3;
  61418. //>>excludeEnd("ctx");
  61419. $15=self._collectionClass();
  61420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61421. $ctx1.sendIdx["collectionClass"]=4;
  61422. //>>excludeEnd("ctx");
  61423. $14=_st($15)._new();
  61424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61425. $ctx1.sendIdx["new"]=4;
  61426. //>>excludeEnd("ctx");
  61427. $11=_st($12).__comma($14);
  61428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61429. $ctx1.sendIdx[","]=3;
  61430. //>>excludeEnd("ctx");
  61431. self._assert_equals_($11,_st(self._collectionClass())._new());
  61432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61433. $ctx1.sendIdx["assert:equals:"]=3;
  61434. //>>excludeEnd("ctx");
  61435. $17=self._collection();
  61436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61437. $ctx1.sendIdx["collection"]=5;
  61438. //>>excludeEnd("ctx");
  61439. $18=self._sampleNewValueAsCollection();
  61440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61441. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  61442. //>>excludeEnd("ctx");
  61443. $16=_st($17).__comma($18);
  61444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61445. $ctx1.sendIdx[","]=4;
  61446. //>>excludeEnd("ctx");
  61447. $19=self._collectionWithNewValue();
  61448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61449. $ctx1.sendIdx["collectionWithNewValue"]=1;
  61450. //>>excludeEnd("ctx");
  61451. self._assert_equals_($16,$19);
  61452. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  61453. return self;
  61454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61455. }, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)});
  61456. //>>excludeEnd("ctx");
  61457. },
  61458. //>>excludeStart("ide", pragmas.excludeIdeData);
  61459. args: [],
  61460. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  61461. referencedClasses: [],
  61462. //>>excludeEnd("ide");
  61463. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  61464. }),
  61465. globals.CollectionTest);
  61466. smalltalk.addMethod(
  61467. smalltalk.method({
  61468. selector: "testDetect",
  61469. protocol: 'tests',
  61470. fn: function (){
  61471. var self=this;
  61472. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  61473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61474. return smalltalk.withContext(function($ctx1) {
  61475. //>>excludeEnd("ctx");
  61476. var $1,$2,$3,$4,$6,$5,$7;
  61477. self._shouldnt_raise_((function(){
  61478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61479. return smalltalk.withContext(function($ctx2) {
  61480. //>>excludeEnd("ctx");
  61481. $1=self._collection();
  61482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61483. $ctx2.sendIdx["collection"]=1;
  61484. //>>excludeEnd("ctx");
  61485. return _st($1)._detect_((function(){
  61486. return true;
  61487. }));
  61488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61489. $ctx2.sendIdx["detect:"]=1;
  61490. //>>excludeEnd("ctx");
  61491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61493. //>>excludeEnd("ctx");
  61494. }),$Error());
  61495. self._should_raise_((function(){
  61496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61497. return smalltalk.withContext(function($ctx2) {
  61498. //>>excludeEnd("ctx");
  61499. $2=self._collection();
  61500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61501. $ctx2.sendIdx["collection"]=2;
  61502. //>>excludeEnd("ctx");
  61503. return _st($2)._detect_((function(){
  61504. return false;
  61505. }));
  61506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61507. $ctx2.sendIdx["detect:"]=2;
  61508. //>>excludeEnd("ctx");
  61509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61511. //>>excludeEnd("ctx");
  61512. }),$Error());
  61513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61514. $ctx1.sendIdx["should:raise:"]=1;
  61515. //>>excludeEnd("ctx");
  61516. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  61517. return true;
  61518. }));
  61519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61520. $ctx1.sendIdx["detect:"]=3;
  61521. //>>excludeEnd("ctx");
  61522. $4=self._sampleNewValue();
  61523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61524. $ctx1.sendIdx["sampleNewValue"]=1;
  61525. //>>excludeEnd("ctx");
  61526. self._assert_equals_($3,$4);
  61527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61528. $ctx1.sendIdx["assert:equals:"]=1;
  61529. //>>excludeEnd("ctx");
  61530. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  61531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61532. return smalltalk.withContext(function($ctx2) {
  61533. //>>excludeEnd("ctx");
  61534. $6=self._sampleNewValue();
  61535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61536. $ctx2.sendIdx["sampleNewValue"]=2;
  61537. //>>excludeEnd("ctx");
  61538. return _st(each).__eq($6);
  61539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61540. $ctx2.sendIdx["="]=1;
  61541. //>>excludeEnd("ctx");
  61542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61543. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  61544. //>>excludeEnd("ctx");
  61545. }));
  61546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61547. $ctx1.sendIdx["detect:"]=4;
  61548. //>>excludeEnd("ctx");
  61549. $7=self._sampleNewValue();
  61550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61551. $ctx1.sendIdx["sampleNewValue"]=3;
  61552. //>>excludeEnd("ctx");
  61553. self._assert_equals_($5,$7);
  61554. self._should_raise_((function(){
  61555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61556. return smalltalk.withContext(function($ctx2) {
  61557. //>>excludeEnd("ctx");
  61558. return _st(self._collection())._detect_((function(each){
  61559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61560. return smalltalk.withContext(function($ctx3) {
  61561. //>>excludeEnd("ctx");
  61562. return _st(each).__eq(self._sampleNewValue());
  61563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61564. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  61565. //>>excludeEnd("ctx");
  61566. }));
  61567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  61569. //>>excludeEnd("ctx");
  61570. }),$Error());
  61571. return self;
  61572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61573. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)});
  61574. //>>excludeEnd("ctx");
  61575. },
  61576. //>>excludeStart("ide", pragmas.excludeIdeData);
  61577. args: [],
  61578. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  61579. referencedClasses: ["Error"],
  61580. //>>excludeEnd("ide");
  61581. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  61582. }),
  61583. globals.CollectionTest);
  61584. smalltalk.addMethod(
  61585. smalltalk.method({
  61586. selector: "testDetectIfNone",
  61587. protocol: 'tests',
  61588. fn: function (){
  61589. var self=this;
  61590. var sentinel;
  61591. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  61592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61593. return smalltalk.withContext(function($ctx1) {
  61594. //>>excludeEnd("ctx");
  61595. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  61596. sentinel=_st($Object())._new();
  61597. $3=self._collection();
  61598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61599. $ctx1.sendIdx["collection"]=1;
  61600. //>>excludeEnd("ctx");
  61601. $2=_st($3)._detect_ifNone_((function(){
  61602. return true;
  61603. }),(function(){
  61604. return sentinel;
  61605. }));
  61606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61607. $ctx1.sendIdx["detect:ifNone:"]=1;
  61608. //>>excludeEnd("ctx");
  61609. $1=_st($2).__tild_eq(sentinel);
  61610. self._assert_($1);
  61611. $5=self._collection();
  61612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61613. $ctx1.sendIdx["collection"]=2;
  61614. //>>excludeEnd("ctx");
  61615. $4=_st($5)._detect_ifNone_((function(){
  61616. return false;
  61617. }),(function(){
  61618. return sentinel;
  61619. }));
  61620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61621. $ctx1.sendIdx["detect:ifNone:"]=2;
  61622. //>>excludeEnd("ctx");
  61623. self._assert_equals_($4,sentinel);
  61624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61625. $ctx1.sendIdx["assert:equals:"]=1;
  61626. //>>excludeEnd("ctx");
  61627. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  61628. return true;
  61629. }),(function(){
  61630. return sentinel;
  61631. }));
  61632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61633. $ctx1.sendIdx["detect:ifNone:"]=3;
  61634. //>>excludeEnd("ctx");
  61635. $7=self._sampleNewValue();
  61636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61637. $ctx1.sendIdx["sampleNewValue"]=1;
  61638. //>>excludeEnd("ctx");
  61639. self._assert_equals_($6,$7);
  61640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61641. $ctx1.sendIdx["assert:equals:"]=2;
  61642. //>>excludeEnd("ctx");
  61643. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  61644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61645. return smalltalk.withContext(function($ctx2) {
  61646. //>>excludeEnd("ctx");
  61647. $9=self._sampleNewValue();
  61648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61649. $ctx2.sendIdx["sampleNewValue"]=2;
  61650. //>>excludeEnd("ctx");
  61651. return _st(each).__eq($9);
  61652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61653. $ctx2.sendIdx["="]=1;
  61654. //>>excludeEnd("ctx");
  61655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61656. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  61657. //>>excludeEnd("ctx");
  61658. }),(function(){
  61659. return sentinel;
  61660. }));
  61661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61662. $ctx1.sendIdx["detect:ifNone:"]=4;
  61663. //>>excludeEnd("ctx");
  61664. $10=self._sampleNewValue();
  61665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61666. $ctx1.sendIdx["sampleNewValue"]=3;
  61667. //>>excludeEnd("ctx");
  61668. self._assert_equals_($8,$10);
  61669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61670. $ctx1.sendIdx["assert:equals:"]=3;
  61671. //>>excludeEnd("ctx");
  61672. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  61673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61674. return smalltalk.withContext(function($ctx2) {
  61675. //>>excludeEnd("ctx");
  61676. return _st(each).__eq(self._sampleNewValue());
  61677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  61679. //>>excludeEnd("ctx");
  61680. }),(function(){
  61681. return sentinel;
  61682. })),sentinel);
  61683. return self;
  61684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61685. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)});
  61686. //>>excludeEnd("ctx");
  61687. },
  61688. //>>excludeStart("ide", pragmas.excludeIdeData);
  61689. args: [],
  61690. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  61691. referencedClasses: ["Object"],
  61692. //>>excludeEnd("ide");
  61693. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  61694. }),
  61695. globals.CollectionTest);
  61696. smalltalk.addMethod(
  61697. smalltalk.method({
  61698. selector: "testDo",
  61699. protocol: 'tests',
  61700. fn: function (){
  61701. var self=this;
  61702. var newCollection;
  61703. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  61704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61705. return smalltalk.withContext(function($ctx1) {
  61706. //>>excludeEnd("ctx");
  61707. var $1,$2;
  61708. newCollection=_st($OrderedCollection())._new();
  61709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61710. $ctx1.sendIdx["new"]=1;
  61711. //>>excludeEnd("ctx");
  61712. $1=self._collection();
  61713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61714. $ctx1.sendIdx["collection"]=1;
  61715. //>>excludeEnd("ctx");
  61716. _st($1)._do_((function(each){
  61717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61718. return smalltalk.withContext(function($ctx2) {
  61719. //>>excludeEnd("ctx");
  61720. return _st(newCollection)._add_(each);
  61721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61722. $ctx2.sendIdx["add:"]=1;
  61723. //>>excludeEnd("ctx");
  61724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61726. //>>excludeEnd("ctx");
  61727. }));
  61728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61729. $ctx1.sendIdx["do:"]=1;
  61730. //>>excludeEnd("ctx");
  61731. self._assertSameContents_as_(self._collection(),newCollection);
  61732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61733. $ctx1.sendIdx["assertSameContents:as:"]=1;
  61734. //>>excludeEnd("ctx");
  61735. newCollection=_st($OrderedCollection())._new();
  61736. $2=self._collectionWithDuplicates();
  61737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61738. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  61739. //>>excludeEnd("ctx");
  61740. _st($2)._do_((function(each){
  61741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61742. return smalltalk.withContext(function($ctx2) {
  61743. //>>excludeEnd("ctx");
  61744. return _st(newCollection)._add_(each);
  61745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61747. //>>excludeEnd("ctx");
  61748. }));
  61749. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  61750. return self;
  61751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61752. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)});
  61753. //>>excludeEnd("ctx");
  61754. },
  61755. //>>excludeStart("ide", pragmas.excludeIdeData);
  61756. args: [],
  61757. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  61758. referencedClasses: ["OrderedCollection"],
  61759. //>>excludeEnd("ide");
  61760. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  61761. }),
  61762. globals.CollectionTest);
  61763. smalltalk.addMethod(
  61764. smalltalk.method({
  61765. selector: "testIfEmptyFamily",
  61766. protocol: 'tests',
  61767. fn: function (){
  61768. var self=this;
  61769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61770. return smalltalk.withContext(function($ctx1) {
  61771. //>>excludeEnd("ctx");
  61772. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  61773. $3=self._collectionClass();
  61774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61775. $ctx1.sendIdx["collectionClass"]=1;
  61776. //>>excludeEnd("ctx");
  61777. $2=_st($3)._new();
  61778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61779. $ctx1.sendIdx["new"]=1;
  61780. //>>excludeEnd("ctx");
  61781. $1=_st($2)._ifEmpty_((function(){
  61782. return (42);
  61783. }));
  61784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61785. $ctx1.sendIdx["ifEmpty:"]=1;
  61786. //>>excludeEnd("ctx");
  61787. self._assert_equals_($1,(42));
  61788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61789. $ctx1.sendIdx["assert:equals:"]=1;
  61790. //>>excludeEnd("ctx");
  61791. $5=self._collection();
  61792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61793. $ctx1.sendIdx["collection"]=1;
  61794. //>>excludeEnd("ctx");
  61795. $4=_st($5)._ifEmpty_((function(){
  61796. return (42);
  61797. }));
  61798. $6=self._collection();
  61799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61800. $ctx1.sendIdx["collection"]=2;
  61801. //>>excludeEnd("ctx");
  61802. self._assert_equals_($4,$6);
  61803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61804. $ctx1.sendIdx["assert:equals:"]=2;
  61805. //>>excludeEnd("ctx");
  61806. $9=self._collectionClass();
  61807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61808. $ctx1.sendIdx["collectionClass"]=2;
  61809. //>>excludeEnd("ctx");
  61810. $8=_st($9)._new();
  61811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61812. $ctx1.sendIdx["new"]=2;
  61813. //>>excludeEnd("ctx");
  61814. $7=_st($8)._ifNotEmpty_((function(){
  61815. return (42);
  61816. }));
  61817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61818. $ctx1.sendIdx["ifNotEmpty:"]=1;
  61819. //>>excludeEnd("ctx");
  61820. $11=self._collectionClass();
  61821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61822. $ctx1.sendIdx["collectionClass"]=3;
  61823. //>>excludeEnd("ctx");
  61824. $10=_st($11)._new();
  61825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61826. $ctx1.sendIdx["new"]=3;
  61827. //>>excludeEnd("ctx");
  61828. self._assert_equals_($7,$10);
  61829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61830. $ctx1.sendIdx["assert:equals:"]=3;
  61831. //>>excludeEnd("ctx");
  61832. $13=self._collection();
  61833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61834. $ctx1.sendIdx["collection"]=3;
  61835. //>>excludeEnd("ctx");
  61836. $12=_st($13)._ifNotEmpty_((function(){
  61837. return (42);
  61838. }));
  61839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61840. $ctx1.sendIdx["ifNotEmpty:"]=2;
  61841. //>>excludeEnd("ctx");
  61842. self._assert_equals_($12,(42));
  61843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61844. $ctx1.sendIdx["assert:equals:"]=4;
  61845. //>>excludeEnd("ctx");
  61846. $15=self._collection();
  61847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61848. $ctx1.sendIdx["collection"]=4;
  61849. //>>excludeEnd("ctx");
  61850. $14=_st($15)._ifNotEmpty_((function(col){
  61851. return col;
  61852. }));
  61853. $16=self._collection();
  61854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61855. $ctx1.sendIdx["collection"]=5;
  61856. //>>excludeEnd("ctx");
  61857. self._assert_equals_($14,$16);
  61858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61859. $ctx1.sendIdx["assert:equals:"]=5;
  61860. //>>excludeEnd("ctx");
  61861. $19=self._collectionClass();
  61862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61863. $ctx1.sendIdx["collectionClass"]=4;
  61864. //>>excludeEnd("ctx");
  61865. $18=_st($19)._new();
  61866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61867. $ctx1.sendIdx["new"]=4;
  61868. //>>excludeEnd("ctx");
  61869. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  61870. return (42);
  61871. }),(function(){
  61872. return (999);
  61873. }));
  61874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61875. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  61876. //>>excludeEnd("ctx");
  61877. self._assert_equals_($17,(42));
  61878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61879. $ctx1.sendIdx["assert:equals:"]=6;
  61880. //>>excludeEnd("ctx");
  61881. $21=self._collection();
  61882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61883. $ctx1.sendIdx["collection"]=6;
  61884. //>>excludeEnd("ctx");
  61885. $20=_st($21)._ifEmpty_ifNotEmpty_((function(){
  61886. return (42);
  61887. }),(function(){
  61888. return (999);
  61889. }));
  61890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61891. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  61892. //>>excludeEnd("ctx");
  61893. self._assert_equals_($20,(999));
  61894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61895. $ctx1.sendIdx["assert:equals:"]=7;
  61896. //>>excludeEnd("ctx");
  61897. $23=self._collection();
  61898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61899. $ctx1.sendIdx["collection"]=7;
  61900. //>>excludeEnd("ctx");
  61901. $22=_st($23)._ifEmpty_ifNotEmpty_((function(){
  61902. return (42);
  61903. }),(function(col){
  61904. return col;
  61905. }));
  61906. $24=self._collection();
  61907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61908. $ctx1.sendIdx["collection"]=8;
  61909. //>>excludeEnd("ctx");
  61910. self._assert_equals_($22,$24);
  61911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61912. $ctx1.sendIdx["assert:equals:"]=8;
  61913. //>>excludeEnd("ctx");
  61914. $25=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  61915. return (42);
  61916. }),(function(){
  61917. return (999);
  61918. }));
  61919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61920. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  61921. //>>excludeEnd("ctx");
  61922. self._assert_equals_($25,(999));
  61923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61924. $ctx1.sendIdx["assert:equals:"]=9;
  61925. //>>excludeEnd("ctx");
  61926. $27=self._collection();
  61927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61928. $ctx1.sendIdx["collection"]=9;
  61929. //>>excludeEnd("ctx");
  61930. $26=_st($27)._ifNotEmpty_ifEmpty_((function(){
  61931. return (42);
  61932. }),(function(){
  61933. return (999);
  61934. }));
  61935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61936. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  61937. //>>excludeEnd("ctx");
  61938. self._assert_equals_($26,(42));
  61939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61940. $ctx1.sendIdx["assert:equals:"]=10;
  61941. //>>excludeEnd("ctx");
  61942. $29=self._collection();
  61943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61944. $ctx1.sendIdx["collection"]=10;
  61945. //>>excludeEnd("ctx");
  61946. $28=_st($29)._ifNotEmpty_ifEmpty_((function(col){
  61947. return col;
  61948. }),(function(){
  61949. return (999);
  61950. }));
  61951. self._assert_equals_($28,self._collection());
  61952. return self;
  61953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61954. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)});
  61955. //>>excludeEnd("ctx");
  61956. },
  61957. //>>excludeStart("ide", pragmas.excludeIdeData);
  61958. args: [],
  61959. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.",
  61960. referencedClasses: [],
  61961. //>>excludeEnd("ide");
  61962. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  61963. }),
  61964. globals.CollectionTest);
  61965. smalltalk.addMethod(
  61966. smalltalk.method({
  61967. selector: "testIsEmpty",
  61968. protocol: 'tests',
  61969. fn: function (){
  61970. var self=this;
  61971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61972. return smalltalk.withContext(function($ctx1) {
  61973. //>>excludeEnd("ctx");
  61974. var $1;
  61975. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  61976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61977. $ctx1.sendIdx["isEmpty"]=1;
  61978. //>>excludeEnd("ctx");
  61979. self._assert_($1);
  61980. self._deny_(_st(self._collection())._isEmpty());
  61981. return self;
  61982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61983. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)});
  61984. //>>excludeEnd("ctx");
  61985. },
  61986. //>>excludeStart("ide", pragmas.excludeIdeData);
  61987. args: [],
  61988. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  61989. referencedClasses: [],
  61990. //>>excludeEnd("ide");
  61991. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  61992. }),
  61993. globals.CollectionTest);
  61994. smalltalk.addMethod(
  61995. smalltalk.method({
  61996. selector: "testNoneSatisfy",
  61997. protocol: 'tests',
  61998. fn: function (){
  61999. var self=this;
  62000. var anyOne;
  62001. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  62002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62003. return smalltalk.withContext(function($ctx1) {
  62004. //>>excludeEnd("ctx");
  62005. var $1,$3,$2;
  62006. $1=self._collection();
  62007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62008. $ctx1.sendIdx["collection"]=1;
  62009. //>>excludeEnd("ctx");
  62010. anyOne=_st($1)._anyOne();
  62011. $3=self._collection();
  62012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62013. $ctx1.sendIdx["collection"]=2;
  62014. //>>excludeEnd("ctx");
  62015. $2=_st($3)._noneSatisfy_((function(each){
  62016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62017. return smalltalk.withContext(function($ctx2) {
  62018. //>>excludeEnd("ctx");
  62019. return _st(each).__eq(anyOne);
  62020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62021. $ctx2.sendIdx["="]=1;
  62022. //>>excludeEnd("ctx");
  62023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62025. //>>excludeEnd("ctx");
  62026. }));
  62027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62028. $ctx1.sendIdx["noneSatisfy:"]=1;
  62029. //>>excludeEnd("ctx");
  62030. self._deny_($2);
  62031. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  62032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62033. return smalltalk.withContext(function($ctx2) {
  62034. //>>excludeEnd("ctx");
  62035. return _st(each).__eq(_st($Object())._new());
  62036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62037. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62038. //>>excludeEnd("ctx");
  62039. })));
  62040. return self;
  62041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62042. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)});
  62043. //>>excludeEnd("ctx");
  62044. },
  62045. //>>excludeStart("ide", pragmas.excludeIdeData);
  62046. args: [],
  62047. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  62048. referencedClasses: ["Object"],
  62049. //>>excludeEnd("ide");
  62050. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  62051. }),
  62052. globals.CollectionTest);
  62053. smalltalk.addMethod(
  62054. smalltalk.method({
  62055. selector: "testRemoveAll",
  62056. protocol: 'tests',
  62057. fn: function (){
  62058. var self=this;
  62059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62060. return smalltalk.withContext(function($ctx1) {
  62061. //>>excludeEnd("ctx");
  62062. var $1,$2;
  62063. $1=self._collection();
  62064. _st($1)._removeAll();
  62065. $2=_st($1)._yourself();
  62066. self._assert_equals_($2,_st(self._collectionClass())._new());
  62067. return self;
  62068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62069. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)});
  62070. //>>excludeEnd("ctx");
  62071. },
  62072. //>>excludeStart("ide", pragmas.excludeIdeData);
  62073. args: [],
  62074. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  62075. referencedClasses: [],
  62076. //>>excludeEnd("ide");
  62077. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  62078. }),
  62079. globals.CollectionTest);
  62080. smalltalk.addMethod(
  62081. smalltalk.method({
  62082. selector: "testSelect",
  62083. protocol: 'tests',
  62084. fn: function (){
  62085. var self=this;
  62086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62087. return smalltalk.withContext(function($ctx1) {
  62088. //>>excludeEnd("ctx");
  62089. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  62090. $2=self._collection();
  62091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62092. $ctx1.sendIdx["collection"]=1;
  62093. //>>excludeEnd("ctx");
  62094. $1=_st($2)._select_((function(){
  62095. return false;
  62096. }));
  62097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62098. $ctx1.sendIdx["select:"]=1;
  62099. //>>excludeEnd("ctx");
  62100. $4=self._collectionClass();
  62101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62102. $ctx1.sendIdx["collectionClass"]=1;
  62103. //>>excludeEnd("ctx");
  62104. $3=_st($4)._new();
  62105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62106. $ctx1.sendIdx["new"]=1;
  62107. //>>excludeEnd("ctx");
  62108. self._assert_equals_($1,$3);
  62109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62110. $ctx1.sendIdx["assert:equals:"]=1;
  62111. //>>excludeEnd("ctx");
  62112. $6=self._collection();
  62113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62114. $ctx1.sendIdx["collection"]=2;
  62115. //>>excludeEnd("ctx");
  62116. $5=_st($6)._select_((function(){
  62117. return true;
  62118. }));
  62119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62120. $ctx1.sendIdx["select:"]=2;
  62121. //>>excludeEnd("ctx");
  62122. $7=self._collection();
  62123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62124. $ctx1.sendIdx["collection"]=3;
  62125. //>>excludeEnd("ctx");
  62126. self._assert_equals_($5,$7);
  62127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62128. $ctx1.sendIdx["assert:equals:"]=2;
  62129. //>>excludeEnd("ctx");
  62130. $9=self._collectionWithNewValue();
  62131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62132. $ctx1.sendIdx["collectionWithNewValue"]=1;
  62133. //>>excludeEnd("ctx");
  62134. $8=_st($9)._select_((function(each){
  62135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62136. return smalltalk.withContext(function($ctx2) {
  62137. //>>excludeEnd("ctx");
  62138. $10=self._sampleNewValue();
  62139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62140. $ctx2.sendIdx["sampleNewValue"]=1;
  62141. //>>excludeEnd("ctx");
  62142. return _st(each).__eq($10);
  62143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62144. $ctx2.sendIdx["="]=1;
  62145. //>>excludeEnd("ctx");
  62146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62147. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  62148. //>>excludeEnd("ctx");
  62149. }));
  62150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62151. $ctx1.sendIdx["select:"]=3;
  62152. //>>excludeEnd("ctx");
  62153. self._assert_equals_($8,self._sampleNewValueAsCollection());
  62154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62155. $ctx1.sendIdx["assert:equals:"]=3;
  62156. //>>excludeEnd("ctx");
  62157. $12=self._collectionWithNewValue();
  62158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62159. $ctx1.sendIdx["collectionWithNewValue"]=2;
  62160. //>>excludeEnd("ctx");
  62161. $11=_st($12)._select_((function(each){
  62162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62163. return smalltalk.withContext(function($ctx2) {
  62164. //>>excludeEnd("ctx");
  62165. $13=self._sampleNewValue();
  62166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62167. $ctx2.sendIdx["sampleNewValue"]=2;
  62168. //>>excludeEnd("ctx");
  62169. return _st(each).__tild_eq($13);
  62170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62171. $ctx2.sendIdx["~="]=1;
  62172. //>>excludeEnd("ctx");
  62173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  62175. //>>excludeEnd("ctx");
  62176. }));
  62177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62178. $ctx1.sendIdx["select:"]=4;
  62179. //>>excludeEnd("ctx");
  62180. $14=self._collection();
  62181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62182. $ctx1.sendIdx["collection"]=4;
  62183. //>>excludeEnd("ctx");
  62184. self._assert_equals_($11,$14);
  62185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62186. $ctx1.sendIdx["assert:equals:"]=4;
  62187. //>>excludeEnd("ctx");
  62188. $16=self._collection();
  62189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62190. $ctx1.sendIdx["collection"]=5;
  62191. //>>excludeEnd("ctx");
  62192. $15=_st($16)._select_((function(each){
  62193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62194. return smalltalk.withContext(function($ctx2) {
  62195. //>>excludeEnd("ctx");
  62196. $17=self._sampleNewValue();
  62197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62198. $ctx2.sendIdx["sampleNewValue"]=3;
  62199. //>>excludeEnd("ctx");
  62200. return _st(each).__eq($17);
  62201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  62203. //>>excludeEnd("ctx");
  62204. }));
  62205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62206. $ctx1.sendIdx["select:"]=5;
  62207. //>>excludeEnd("ctx");
  62208. self._assert_equals_($15,_st(self._collectionClass())._new());
  62209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62210. $ctx1.sendIdx["assert:equals:"]=5;
  62211. //>>excludeEnd("ctx");
  62212. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  62213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62214. return smalltalk.withContext(function($ctx2) {
  62215. //>>excludeEnd("ctx");
  62216. return _st(each).__tild_eq(self._sampleNewValue());
  62217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  62219. //>>excludeEnd("ctx");
  62220. })),self._collection());
  62221. return self;
  62222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62223. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)});
  62224. //>>excludeEnd("ctx");
  62225. },
  62226. //>>excludeStart("ide", pragmas.excludeIdeData);
  62227. args: [],
  62228. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  62229. referencedClasses: [],
  62230. //>>excludeEnd("ide");
  62231. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  62232. }),
  62233. globals.CollectionTest);
  62234. smalltalk.addMethod(
  62235. smalltalk.method({
  62236. selector: "testSize",
  62237. protocol: 'tests',
  62238. fn: function (){
  62239. var self=this;
  62240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62241. return smalltalk.withContext(function($ctx1) {
  62242. //>>excludeEnd("ctx");
  62243. var $1,$2;
  62244. $1=_st(_st(self._collectionClass())._new())._size();
  62245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62246. $ctx1.sendIdx["size"]=1;
  62247. //>>excludeEnd("ctx");
  62248. self._assert_equals_($1,(0));
  62249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62250. $ctx1.sendIdx["assert:equals:"]=1;
  62251. //>>excludeEnd("ctx");
  62252. $2=_st(self._sampleNewValueAsCollection())._size();
  62253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62254. $ctx1.sendIdx["size"]=2;
  62255. //>>excludeEnd("ctx");
  62256. self._assert_equals_($2,(1));
  62257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62258. $ctx1.sendIdx["assert:equals:"]=2;
  62259. //>>excludeEnd("ctx");
  62260. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  62261. return self;
  62262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62263. }, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)});
  62264. //>>excludeEnd("ctx");
  62265. },
  62266. //>>excludeStart("ide", pragmas.excludeIdeData);
  62267. args: [],
  62268. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  62269. referencedClasses: [],
  62270. //>>excludeEnd("ide");
  62271. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  62272. }),
  62273. globals.CollectionTest);
  62274. smalltalk.addMethod(
  62275. smalltalk.method({
  62276. selector: "collectionClass",
  62277. protocol: 'fixture',
  62278. fn: function (){
  62279. var self=this;
  62280. return nil;
  62281. },
  62282. //>>excludeStart("ide", pragmas.excludeIdeData);
  62283. args: [],
  62284. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  62285. referencedClasses: [],
  62286. //>>excludeEnd("ide");
  62287. messageSends: []
  62288. }),
  62289. globals.CollectionTest.klass);
  62290. smalltalk.addMethod(
  62291. smalltalk.method({
  62292. selector: "isAbstract",
  62293. protocol: 'testing',
  62294. fn: function (){
  62295. var self=this;
  62296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62297. return smalltalk.withContext(function($ctx1) {
  62298. //>>excludeEnd("ctx");
  62299. var $1;
  62300. $1=_st(self._collectionClass())._isNil();
  62301. return $1;
  62302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62303. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)});
  62304. //>>excludeEnd("ctx");
  62305. },
  62306. //>>excludeStart("ide", pragmas.excludeIdeData);
  62307. args: [],
  62308. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  62309. referencedClasses: [],
  62310. //>>excludeEnd("ide");
  62311. messageSends: ["isNil", "collectionClass"]
  62312. }),
  62313. globals.CollectionTest.klass);
  62314. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  62315. smalltalk.addMethod(
  62316. smalltalk.method({
  62317. selector: "collectionWithNewValue",
  62318. protocol: 'fixture',
  62319. fn: function (){
  62320. var self=this;
  62321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62322. return smalltalk.withContext(function($ctx1) {
  62323. //>>excludeEnd("ctx");
  62324. self._subclassResponsibility();
  62325. return self;
  62326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62327. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)});
  62328. //>>excludeEnd("ctx");
  62329. },
  62330. //>>excludeStart("ide", pragmas.excludeIdeData);
  62331. args: [],
  62332. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  62333. referencedClasses: [],
  62334. //>>excludeEnd("ide");
  62335. messageSends: ["subclassResponsibility"]
  62336. }),
  62337. globals.IndexableCollectionTest);
  62338. smalltalk.addMethod(
  62339. smalltalk.method({
  62340. selector: "sampleNewIndex",
  62341. protocol: 'fixture',
  62342. fn: function (){
  62343. var self=this;
  62344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62345. return smalltalk.withContext(function($ctx1) {
  62346. //>>excludeEnd("ctx");
  62347. self._subclassResponsibility();
  62348. return self;
  62349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62350. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)});
  62351. //>>excludeEnd("ctx");
  62352. },
  62353. //>>excludeStart("ide", pragmas.excludeIdeData);
  62354. args: [],
  62355. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  62356. referencedClasses: [],
  62357. //>>excludeEnd("ide");
  62358. messageSends: ["subclassResponsibility"]
  62359. }),
  62360. globals.IndexableCollectionTest);
  62361. smalltalk.addMethod(
  62362. smalltalk.method({
  62363. selector: "sampleNonIndexesDo:",
  62364. protocol: 'fixture',
  62365. fn: function (aBlock){
  62366. var self=this;
  62367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62368. return smalltalk.withContext(function($ctx1) {
  62369. //>>excludeEnd("ctx");
  62370. self._subclassResponsibility();
  62371. return self;
  62372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62373. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)});
  62374. //>>excludeEnd("ctx");
  62375. },
  62376. //>>excludeStart("ide", pragmas.excludeIdeData);
  62377. args: ["aBlock"],
  62378. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  62379. referencedClasses: [],
  62380. //>>excludeEnd("ide");
  62381. messageSends: ["subclassResponsibility"]
  62382. }),
  62383. globals.IndexableCollectionTest);
  62384. smalltalk.addMethod(
  62385. smalltalk.method({
  62386. selector: "samplesDo:",
  62387. protocol: 'fixture',
  62388. fn: function (aBlock){
  62389. var self=this;
  62390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62391. return smalltalk.withContext(function($ctx1) {
  62392. //>>excludeEnd("ctx");
  62393. self._subclassResponsibility();
  62394. return self;
  62395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62396. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)});
  62397. //>>excludeEnd("ctx");
  62398. },
  62399. //>>excludeStart("ide", pragmas.excludeIdeData);
  62400. args: ["aBlock"],
  62401. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  62402. referencedClasses: [],
  62403. //>>excludeEnd("ide");
  62404. messageSends: ["subclassResponsibility"]
  62405. }),
  62406. globals.IndexableCollectionTest);
  62407. smalltalk.addMethod(
  62408. smalltalk.method({
  62409. selector: "testAt",
  62410. protocol: 'tests',
  62411. fn: function (){
  62412. var self=this;
  62413. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  62414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62415. return smalltalk.withContext(function($ctx1) {
  62416. //>>excludeEnd("ctx");
  62417. var $1;
  62418. self._nonIndexesDo_((function(each){
  62419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62420. return smalltalk.withContext(function($ctx2) {
  62421. //>>excludeEnd("ctx");
  62422. return self._should_raise_((function(){
  62423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62424. return smalltalk.withContext(function($ctx3) {
  62425. //>>excludeEnd("ctx");
  62426. $1=self._collection();
  62427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62428. $ctx3.sendIdx["collection"]=1;
  62429. //>>excludeEnd("ctx");
  62430. return _st($1)._at_(each);
  62431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62432. $ctx3.sendIdx["at:"]=1;
  62433. //>>excludeEnd("ctx");
  62434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62435. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  62436. //>>excludeEnd("ctx");
  62437. }),$Error());
  62438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62440. //>>excludeEnd("ctx");
  62441. }));
  62442. self._samplesDo_((function(index,value){
  62443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62444. return smalltalk.withContext(function($ctx2) {
  62445. //>>excludeEnd("ctx");
  62446. return self._assert_equals_(_st(self._collection())._at_(index),value);
  62447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62448. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  62449. //>>excludeEnd("ctx");
  62450. }));
  62451. return self;
  62452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62453. }, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)});
  62454. //>>excludeEnd("ctx");
  62455. },
  62456. //>>excludeStart("ide", pragmas.excludeIdeData);
  62457. args: [],
  62458. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  62459. referencedClasses: ["Error"],
  62460. //>>excludeEnd("ide");
  62461. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  62462. }),
  62463. globals.IndexableCollectionTest);
  62464. smalltalk.addMethod(
  62465. smalltalk.method({
  62466. selector: "testAtIfAbsent",
  62467. protocol: 'tests',
  62468. fn: function (){
  62469. var self=this;
  62470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62471. return smalltalk.withContext(function($ctx1) {
  62472. //>>excludeEnd("ctx");
  62473. var $2,$1,$3;
  62474. self._nonIndexesDo_((function(each){
  62475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62476. return smalltalk.withContext(function($ctx2) {
  62477. //>>excludeEnd("ctx");
  62478. $2=self._collection();
  62479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62480. $ctx2.sendIdx["collection"]=1;
  62481. //>>excludeEnd("ctx");
  62482. $1=_st($2)._at_ifAbsent_(each,(function(){
  62483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62484. return smalltalk.withContext(function($ctx3) {
  62485. //>>excludeEnd("ctx");
  62486. return self._sampleNewValue();
  62487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62488. $ctx3.sendIdx["sampleNewValue"]=1;
  62489. //>>excludeEnd("ctx");
  62490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62491. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  62492. //>>excludeEnd("ctx");
  62493. }));
  62494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62495. $ctx2.sendIdx["at:ifAbsent:"]=1;
  62496. //>>excludeEnd("ctx");
  62497. $3=self._sampleNewValue();
  62498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62499. $ctx2.sendIdx["sampleNewValue"]=2;
  62500. //>>excludeEnd("ctx");
  62501. return self._assert_equals_($1,$3);
  62502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62503. $ctx2.sendIdx["assert:equals:"]=1;
  62504. //>>excludeEnd("ctx");
  62505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62507. //>>excludeEnd("ctx");
  62508. }));
  62509. self._samplesDo_((function(index,value){
  62510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62511. return smalltalk.withContext(function($ctx2) {
  62512. //>>excludeEnd("ctx");
  62513. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  62514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62515. return smalltalk.withContext(function($ctx3) {
  62516. //>>excludeEnd("ctx");
  62517. return self._sampleNewValue();
  62518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62519. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  62520. //>>excludeEnd("ctx");
  62521. })),value);
  62522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62523. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  62524. //>>excludeEnd("ctx");
  62525. }));
  62526. return self;
  62527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62528. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)});
  62529. //>>excludeEnd("ctx");
  62530. },
  62531. //>>excludeStart("ide", pragmas.excludeIdeData);
  62532. args: [],
  62533. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  62534. referencedClasses: [],
  62535. //>>excludeEnd("ide");
  62536. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  62537. }),
  62538. globals.IndexableCollectionTest);
  62539. smalltalk.addMethod(
  62540. smalltalk.method({
  62541. selector: "testAtIfAbsentPut",
  62542. protocol: 'tests',
  62543. fn: function (){
  62544. var self=this;
  62545. var newCollection;
  62546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62547. return smalltalk.withContext(function($ctx1) {
  62548. //>>excludeEnd("ctx");
  62549. var $1;
  62550. newCollection=self._collection();
  62551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62552. $ctx1.sendIdx["collection"]=1;
  62553. //>>excludeEnd("ctx");
  62554. self._samplesDo_((function(index,value){
  62555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62556. return smalltalk.withContext(function($ctx2) {
  62557. //>>excludeEnd("ctx");
  62558. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  62559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62560. return smalltalk.withContext(function($ctx3) {
  62561. //>>excludeEnd("ctx");
  62562. return self._sampleNewValue();
  62563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62564. $ctx3.sendIdx["sampleNewValue"]=1;
  62565. //>>excludeEnd("ctx");
  62566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62567. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  62568. //>>excludeEnd("ctx");
  62569. }));
  62570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62571. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  62572. //>>excludeEnd("ctx");
  62573. return self._assert_equals_($1,value);
  62574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62575. $ctx2.sendIdx["assert:equals:"]=1;
  62576. //>>excludeEnd("ctx");
  62577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62578. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  62579. //>>excludeEnd("ctx");
  62580. }));
  62581. self._assert_equals_(newCollection,self._collection());
  62582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62583. $ctx1.sendIdx["assert:equals:"]=2;
  62584. //>>excludeEnd("ctx");
  62585. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  62586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62587. return smalltalk.withContext(function($ctx2) {
  62588. //>>excludeEnd("ctx");
  62589. return self._sampleNewValue();
  62590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62591. $ctx2.sendIdx["sampleNewValue"]=2;
  62592. //>>excludeEnd("ctx");
  62593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62595. //>>excludeEnd("ctx");
  62596. })),self._sampleNewValue());
  62597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62598. $ctx1.sendIdx["assert:equals:"]=3;
  62599. //>>excludeEnd("ctx");
  62600. self._assert_equals_(newCollection,self._collectionWithNewValue());
  62601. return self;
  62602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62603. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)});
  62604. //>>excludeEnd("ctx");
  62605. },
  62606. //>>excludeStart("ide", pragmas.excludeIdeData);
  62607. args: [],
  62608. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  62609. referencedClasses: [],
  62610. //>>excludeEnd("ide");
  62611. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  62612. }),
  62613. globals.IndexableCollectionTest);
  62614. smalltalk.addMethod(
  62615. smalltalk.method({
  62616. selector: "testAtIfPresent",
  62617. protocol: 'tests',
  62618. fn: function (){
  62619. var self=this;
  62620. var visited,sentinel;
  62621. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  62622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62623. return smalltalk.withContext(function($ctx1) {
  62624. //>>excludeEnd("ctx");
  62625. var $2,$1,$4,$3;
  62626. sentinel=_st($Object())._new();
  62627. self._nonIndexesDo_((function(each){
  62628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62629. return smalltalk.withContext(function($ctx2) {
  62630. //>>excludeEnd("ctx");
  62631. visited=nil;
  62632. visited;
  62633. $2=self._collection();
  62634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62635. $ctx2.sendIdx["collection"]=1;
  62636. //>>excludeEnd("ctx");
  62637. $1=_st($2)._at_ifPresent_(each,(function(value1){
  62638. visited=value1;
  62639. visited;
  62640. return sentinel;
  62641. }));
  62642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62643. $ctx2.sendIdx["at:ifPresent:"]=1;
  62644. //>>excludeEnd("ctx");
  62645. self._assert_equals_($1,nil);
  62646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62647. $ctx2.sendIdx["assert:equals:"]=1;
  62648. //>>excludeEnd("ctx");
  62649. return self._assert_(_st(visited)._isNil());
  62650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62651. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62652. //>>excludeEnd("ctx");
  62653. }));
  62654. self._samplesDo_((function(index,value){
  62655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62656. return smalltalk.withContext(function($ctx2) {
  62657. //>>excludeEnd("ctx");
  62658. visited=nil;
  62659. visited;
  62660. $4=self._collection();
  62661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62662. $ctx2.sendIdx["collection"]=2;
  62663. //>>excludeEnd("ctx");
  62664. $3=_st($4)._at_ifPresent_(index,(function(value2){
  62665. visited=value2;
  62666. visited;
  62667. return sentinel;
  62668. }));
  62669. self._assert_equals_($3,sentinel);
  62670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62671. $ctx2.sendIdx["assert:equals:"]=2;
  62672. //>>excludeEnd("ctx");
  62673. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  62674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62675. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  62676. //>>excludeEnd("ctx");
  62677. }));
  62678. return self;
  62679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62680. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)});
  62681. //>>excludeEnd("ctx");
  62682. },
  62683. //>>excludeStart("ide", pragmas.excludeIdeData);
  62684. args: [],
  62685. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  62686. referencedClasses: ["Object"],
  62687. //>>excludeEnd("ide");
  62688. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  62689. }),
  62690. globals.IndexableCollectionTest);
  62691. smalltalk.addMethod(
  62692. smalltalk.method({
  62693. selector: "testAtIfPresentIfAbsent",
  62694. protocol: 'tests',
  62695. fn: function (){
  62696. var self=this;
  62697. var visited,sentinel;
  62698. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  62699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62700. return smalltalk.withContext(function($ctx1) {
  62701. //>>excludeEnd("ctx");
  62702. var $2,$1,$3,$5,$4;
  62703. sentinel=_st($Object())._new();
  62704. self._nonIndexesDo_((function(each){
  62705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62706. return smalltalk.withContext(function($ctx2) {
  62707. //>>excludeEnd("ctx");
  62708. visited=nil;
  62709. visited;
  62710. $2=self._collection();
  62711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62712. $ctx2.sendIdx["collection"]=1;
  62713. //>>excludeEnd("ctx");
  62714. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  62715. visited=value1;
  62716. visited;
  62717. return sentinel;
  62718. }),(function(){
  62719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62720. return smalltalk.withContext(function($ctx3) {
  62721. //>>excludeEnd("ctx");
  62722. return self._sampleNewValue();
  62723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62724. $ctx3.sendIdx["sampleNewValue"]=1;
  62725. //>>excludeEnd("ctx");
  62726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62727. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  62728. //>>excludeEnd("ctx");
  62729. }));
  62730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62731. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  62732. //>>excludeEnd("ctx");
  62733. $3=self._sampleNewValue();
  62734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62735. $ctx2.sendIdx["sampleNewValue"]=2;
  62736. //>>excludeEnd("ctx");
  62737. self._assert_equals_($1,$3);
  62738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62739. $ctx2.sendIdx["assert:equals:"]=1;
  62740. //>>excludeEnd("ctx");
  62741. return self._assert_(_st(visited)._isNil());
  62742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62743. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62744. //>>excludeEnd("ctx");
  62745. }));
  62746. self._samplesDo_((function(index,value){
  62747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62748. return smalltalk.withContext(function($ctx2) {
  62749. //>>excludeEnd("ctx");
  62750. visited=nil;
  62751. visited;
  62752. $5=self._collection();
  62753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62754. $ctx2.sendIdx["collection"]=2;
  62755. //>>excludeEnd("ctx");
  62756. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  62757. visited=value2;
  62758. visited;
  62759. return sentinel;
  62760. }),(function(){
  62761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62762. return smalltalk.withContext(function($ctx3) {
  62763. //>>excludeEnd("ctx");
  62764. return self._sampleNewValue();
  62765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62766. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  62767. //>>excludeEnd("ctx");
  62768. }));
  62769. self._assert_equals_($4,sentinel);
  62770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62771. $ctx2.sendIdx["assert:equals:"]=2;
  62772. //>>excludeEnd("ctx");
  62773. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  62774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62775. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  62776. //>>excludeEnd("ctx");
  62777. }));
  62778. return self;
  62779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62780. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)});
  62781. //>>excludeEnd("ctx");
  62782. },
  62783. //>>excludeStart("ide", pragmas.excludeIdeData);
  62784. args: [],
  62785. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  62786. referencedClasses: ["Object"],
  62787. //>>excludeEnd("ide");
  62788. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  62789. }),
  62790. globals.IndexableCollectionTest);
  62791. smalltalk.addMethod(
  62792. smalltalk.method({
  62793. selector: "testAtPut",
  62794. protocol: 'tests',
  62795. fn: function (){
  62796. var self=this;
  62797. var newCollection;
  62798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62799. return smalltalk.withContext(function($ctx1) {
  62800. //>>excludeEnd("ctx");
  62801. newCollection=self._collection();
  62802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62803. $ctx1.sendIdx["collection"]=1;
  62804. //>>excludeEnd("ctx");
  62805. self._samplesDo_((function(index,value){
  62806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62807. return smalltalk.withContext(function($ctx2) {
  62808. //>>excludeEnd("ctx");
  62809. return _st(newCollection)._at_put_(index,value);
  62810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62811. $ctx2.sendIdx["at:put:"]=1;
  62812. //>>excludeEnd("ctx");
  62813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62814. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  62815. //>>excludeEnd("ctx");
  62816. }));
  62817. self._assert_equals_(newCollection,self._collection());
  62818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62819. $ctx1.sendIdx["assert:equals:"]=1;
  62820. //>>excludeEnd("ctx");
  62821. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  62822. self._assert_equals_(newCollection,self._collectionWithNewValue());
  62823. return self;
  62824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62825. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)});
  62826. //>>excludeEnd("ctx");
  62827. },
  62828. //>>excludeStart("ide", pragmas.excludeIdeData);
  62829. args: [],
  62830. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  62831. referencedClasses: [],
  62832. //>>excludeEnd("ide");
  62833. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  62834. }),
  62835. globals.IndexableCollectionTest);
  62836. smalltalk.addMethod(
  62837. smalltalk.method({
  62838. selector: "testEquality",
  62839. protocol: 'tests',
  62840. fn: function (){
  62841. var self=this;
  62842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62843. return smalltalk.withContext(function($ctx1) {
  62844. //>>excludeEnd("ctx");
  62845. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  62846. $2=self._collectionClass();
  62847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62848. $ctx1.sendIdx["collectionClass"]=1;
  62849. //>>excludeEnd("ctx");
  62850. $1=_st($2)._new();
  62851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62852. $ctx1.sendIdx["new"]=1;
  62853. //>>excludeEnd("ctx");
  62854. $4=self._collectionClass();
  62855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62856. $ctx1.sendIdx["collectionClass"]=2;
  62857. //>>excludeEnd("ctx");
  62858. $3=_st($4)._new();
  62859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62860. $ctx1.sendIdx["new"]=2;
  62861. //>>excludeEnd("ctx");
  62862. self._assert_equals_($1,$3);
  62863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62864. $ctx1.sendIdx["assert:equals:"]=1;
  62865. //>>excludeEnd("ctx");
  62866. $5=self._collection();
  62867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62868. $ctx1.sendIdx["collection"]=1;
  62869. //>>excludeEnd("ctx");
  62870. $6=self._collection();
  62871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62872. $ctx1.sendIdx["collection"]=2;
  62873. //>>excludeEnd("ctx");
  62874. self._assert_equals_($5,$6);
  62875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62876. $ctx1.sendIdx["assert:equals:"]=2;
  62877. //>>excludeEnd("ctx");
  62878. $7=self._collectionWithNewValue();
  62879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62880. $ctx1.sendIdx["collectionWithNewValue"]=1;
  62881. //>>excludeEnd("ctx");
  62882. self._assert_equals_($7,self._collectionWithNewValue());
  62883. $10=self._collectionClass();
  62884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62885. $ctx1.sendIdx["collectionClass"]=3;
  62886. //>>excludeEnd("ctx");
  62887. $9=_st($10)._new();
  62888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62889. $ctx1.sendIdx["new"]=3;
  62890. //>>excludeEnd("ctx");
  62891. $11=self._collection();
  62892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62893. $ctx1.sendIdx["collection"]=3;
  62894. //>>excludeEnd("ctx");
  62895. $8=_st($9).__eq($11);
  62896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62897. $ctx1.sendIdx["="]=1;
  62898. //>>excludeEnd("ctx");
  62899. self._deny_($8);
  62900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62901. $ctx1.sendIdx["deny:"]=1;
  62902. //>>excludeEnd("ctx");
  62903. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  62904. return self;
  62905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62906. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)});
  62907. //>>excludeEnd("ctx");
  62908. },
  62909. //>>excludeStart("ide", pragmas.excludeIdeData);
  62910. args: [],
  62911. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  62912. referencedClasses: [],
  62913. //>>excludeEnd("ide");
  62914. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  62915. }),
  62916. globals.IndexableCollectionTest);
  62917. smalltalk.addMethod(
  62918. smalltalk.method({
  62919. selector: "testIndexOf",
  62920. protocol: 'tests',
  62921. fn: function (){
  62922. var self=this;
  62923. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  62924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62925. return smalltalk.withContext(function($ctx1) {
  62926. //>>excludeEnd("ctx");
  62927. var $1;
  62928. self._should_raise_((function(){
  62929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62930. return smalltalk.withContext(function($ctx2) {
  62931. //>>excludeEnd("ctx");
  62932. $1=self._collection();
  62933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62934. $ctx2.sendIdx["collection"]=1;
  62935. //>>excludeEnd("ctx");
  62936. return _st($1)._indexOf_(self._sampleNewValue());
  62937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62938. $ctx2.sendIdx["indexOf:"]=1;
  62939. //>>excludeEnd("ctx");
  62940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62942. //>>excludeEnd("ctx");
  62943. }),$Error());
  62944. self._samplesDo_((function(index,value){
  62945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62946. return smalltalk.withContext(function($ctx2) {
  62947. //>>excludeEnd("ctx");
  62948. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  62949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62950. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  62951. //>>excludeEnd("ctx");
  62952. }));
  62953. return self;
  62954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62955. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)});
  62956. //>>excludeEnd("ctx");
  62957. },
  62958. //>>excludeStart("ide", pragmas.excludeIdeData);
  62959. args: [],
  62960. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  62961. referencedClasses: ["Error"],
  62962. //>>excludeEnd("ide");
  62963. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  62964. }),
  62965. globals.IndexableCollectionTest);
  62966. smalltalk.addMethod(
  62967. smalltalk.method({
  62968. selector: "testIndexOfWithNull",
  62969. protocol: 'tests',
  62970. fn: function (){
  62971. var self=this;
  62972. var jsNull;
  62973. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  62974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62975. return smalltalk.withContext(function($ctx1) {
  62976. //>>excludeEnd("ctx");
  62977. var $1,$2;
  62978. jsNull=_st($JSON())._parse_("null");
  62979. self._samplesDo_((function(index,value){
  62980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62981. return smalltalk.withContext(function($ctx2) {
  62982. //>>excludeEnd("ctx");
  62983. $1=self._collection();
  62984. _st($1)._at_put_(index,jsNull);
  62985. $2=_st($1)._indexOf_(jsNull);
  62986. return self._assert_equals_($2,index);
  62987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62988. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  62989. //>>excludeEnd("ctx");
  62990. }));
  62991. return self;
  62992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62993. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)});
  62994. //>>excludeEnd("ctx");
  62995. },
  62996. //>>excludeStart("ide", pragmas.excludeIdeData);
  62997. args: [],
  62998. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  62999. referencedClasses: ["JSON"],
  63000. //>>excludeEnd("ide");
  63001. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  63002. }),
  63003. globals.IndexableCollectionTest);
  63004. smalltalk.addMethod(
  63005. smalltalk.method({
  63006. selector: "testWithIndexDo",
  63007. protocol: 'tests',
  63008. fn: function (){
  63009. var self=this;
  63010. var collection;
  63011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63012. return smalltalk.withContext(function($ctx1) {
  63013. //>>excludeEnd("ctx");
  63014. collection=self._collection();
  63015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63016. $ctx1.sendIdx["collection"]=1;
  63017. //>>excludeEnd("ctx");
  63018. _st(self._collection())._withIndexDo_((function(each,index){
  63019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63020. return smalltalk.withContext(function($ctx2) {
  63021. //>>excludeEnd("ctx");
  63022. return self._assert_equals_(_st(collection)._at_(index),each);
  63023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63024. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  63025. //>>excludeEnd("ctx");
  63026. }));
  63027. return self;
  63028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63029. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)});
  63030. //>>excludeEnd("ctx");
  63031. },
  63032. //>>excludeStart("ide", pragmas.excludeIdeData);
  63033. args: [],
  63034. source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]",
  63035. referencedClasses: [],
  63036. //>>excludeEnd("ide");
  63037. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  63038. }),
  63039. globals.IndexableCollectionTest);
  63040. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  63041. smalltalk.addMethod(
  63042. smalltalk.method({
  63043. selector: "collectionKeys",
  63044. protocol: 'fixture',
  63045. fn: function (){
  63046. var self=this;
  63047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63048. return smalltalk.withContext(function($ctx1) {
  63049. //>>excludeEnd("ctx");
  63050. self._subclassResponsibility();
  63051. return self;
  63052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63053. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)});
  63054. //>>excludeEnd("ctx");
  63055. },
  63056. //>>excludeStart("ide", pragmas.excludeIdeData);
  63057. args: [],
  63058. source: "collectionKeys\x0a\x09self subclassResponsibility",
  63059. referencedClasses: [],
  63060. //>>excludeEnd("ide");
  63061. messageSends: ["subclassResponsibility"]
  63062. }),
  63063. globals.AssociativeCollectionTest);
  63064. smalltalk.addMethod(
  63065. smalltalk.method({
  63066. selector: "collectionValues",
  63067. protocol: 'fixture',
  63068. fn: function (){
  63069. var self=this;
  63070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63071. return smalltalk.withContext(function($ctx1) {
  63072. //>>excludeEnd("ctx");
  63073. self._subclassResponsibility();
  63074. return self;
  63075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63076. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)});
  63077. //>>excludeEnd("ctx");
  63078. },
  63079. //>>excludeStart("ide", pragmas.excludeIdeData);
  63080. args: [],
  63081. source: "collectionValues\x0a\x09self subclassResponsibility",
  63082. referencedClasses: [],
  63083. //>>excludeEnd("ide");
  63084. messageSends: ["subclassResponsibility"]
  63085. }),
  63086. globals.AssociativeCollectionTest);
  63087. smalltalk.addMethod(
  63088. smalltalk.method({
  63089. selector: "nonIndexesDo:",
  63090. protocol: 'fixture',
  63091. fn: function (aBlock){
  63092. var self=this;
  63093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63094. return smalltalk.withContext(function($ctx1) {
  63095. //>>excludeEnd("ctx");
  63096. _st(aBlock)._value_((5));
  63097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63098. $ctx1.sendIdx["value:"]=1;
  63099. //>>excludeEnd("ctx");
  63100. _st(aBlock)._value_("z");
  63101. return self;
  63102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63103. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)});
  63104. //>>excludeEnd("ctx");
  63105. },
  63106. //>>excludeStart("ide", pragmas.excludeIdeData);
  63107. args: ["aBlock"],
  63108. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  63109. referencedClasses: [],
  63110. //>>excludeEnd("ide");
  63111. messageSends: ["value:"]
  63112. }),
  63113. globals.AssociativeCollectionTest);
  63114. smalltalk.addMethod(
  63115. smalltalk.method({
  63116. selector: "sampleNewIndex",
  63117. protocol: 'fixture',
  63118. fn: function (){
  63119. var self=this;
  63120. return "new";
  63121. },
  63122. //>>excludeStart("ide", pragmas.excludeIdeData);
  63123. args: [],
  63124. source: "sampleNewIndex\x0a\x09^ 'new'",
  63125. referencedClasses: [],
  63126. //>>excludeEnd("ide");
  63127. messageSends: []
  63128. }),
  63129. globals.AssociativeCollectionTest);
  63130. smalltalk.addMethod(
  63131. smalltalk.method({
  63132. selector: "samplesDo:",
  63133. protocol: 'fixture',
  63134. fn: function (aBlock){
  63135. var self=this;
  63136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63137. return smalltalk.withContext(function($ctx1) {
  63138. //>>excludeEnd("ctx");
  63139. _st(aBlock)._value_value_("a",(2));
  63140. return self;
  63141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63142. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)});
  63143. //>>excludeEnd("ctx");
  63144. },
  63145. //>>excludeStart("ide", pragmas.excludeIdeData);
  63146. args: ["aBlock"],
  63147. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  63148. referencedClasses: [],
  63149. //>>excludeEnd("ide");
  63150. messageSends: ["value:value:"]
  63151. }),
  63152. globals.AssociativeCollectionTest);
  63153. smalltalk.addMethod(
  63154. smalltalk.method({
  63155. selector: "testAddAll",
  63156. protocol: 'tests',
  63157. fn: function (){
  63158. var self=this;
  63159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63160. return smalltalk.withContext(function($ctx1) {
  63161. //>>excludeEnd("ctx");
  63162. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  63163. (
  63164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63165. $ctx1.supercall = true,
  63166. //>>excludeEnd("ctx");
  63167. globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  63168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63169. $ctx1.supercall = false;
  63170. //>>excludeEnd("ctx");;
  63171. $2=self._collection();
  63172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63173. $ctx1.sendIdx["collection"]=1;
  63174. //>>excludeEnd("ctx");
  63175. $3=$2;
  63176. $4=self._collection();
  63177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63178. $ctx1.sendIdx["collection"]=2;
  63179. //>>excludeEnd("ctx");
  63180. _st($3)._addAll_($4);
  63181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63182. $ctx1.sendIdx["addAll:"]=1;
  63183. //>>excludeEnd("ctx");
  63184. $5=_st($2)._yourself();
  63185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63186. $ctx1.sendIdx["yourself"]=1;
  63187. //>>excludeEnd("ctx");
  63188. $1=$5;
  63189. $6=self._collection();
  63190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63191. $ctx1.sendIdx["collection"]=3;
  63192. //>>excludeEnd("ctx");
  63193. self._assert_equals_($1,$6);
  63194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63195. $ctx1.sendIdx["assert:equals:"]=1;
  63196. //>>excludeEnd("ctx");
  63197. $8=self._collection();
  63198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63199. $ctx1.sendIdx["collection"]=4;
  63200. //>>excludeEnd("ctx");
  63201. $9=$8;
  63202. $10=self._collectionWithNewValue();
  63203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63204. $ctx1.sendIdx["collectionWithNewValue"]=1;
  63205. //>>excludeEnd("ctx");
  63206. _st($9)._addAll_($10);
  63207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63208. $ctx1.sendIdx["addAll:"]=2;
  63209. //>>excludeEnd("ctx");
  63210. $11=_st($8)._yourself();
  63211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63212. $ctx1.sendIdx["yourself"]=2;
  63213. //>>excludeEnd("ctx");
  63214. $7=$11;
  63215. $12=self._collectionWithNewValue();
  63216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63217. $ctx1.sendIdx["collectionWithNewValue"]=2;
  63218. //>>excludeEnd("ctx");
  63219. self._assert_equals_($7,$12);
  63220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63221. $ctx1.sendIdx["assert:equals:"]=2;
  63222. //>>excludeEnd("ctx");
  63223. $14=self._collectionWithNewValue();
  63224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63225. $ctx1.sendIdx["collectionWithNewValue"]=3;
  63226. //>>excludeEnd("ctx");
  63227. _st($14)._addAll_(self._collection());
  63228. $15=_st($14)._yourself();
  63229. $13=$15;
  63230. self._assert_equals_($13,self._collectionWithNewValue());
  63231. return self;
  63232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63233. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)});
  63234. //>>excludeEnd("ctx");
  63235. },
  63236. //>>excludeStart("ide", pragmas.excludeIdeData);
  63237. args: [],
  63238. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  63239. referencedClasses: [],
  63240. //>>excludeEnd("ide");
  63241. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  63242. }),
  63243. globals.AssociativeCollectionTest);
  63244. smalltalk.addMethod(
  63245. smalltalk.method({
  63246. selector: "testAsDictionary",
  63247. protocol: 'tests',
  63248. fn: function (){
  63249. var self=this;
  63250. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63252. return smalltalk.withContext(function($ctx1) {
  63253. //>>excludeEnd("ctx");
  63254. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  63255. return self;
  63256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63257. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)});
  63258. //>>excludeEnd("ctx");
  63259. },
  63260. //>>excludeStart("ide", pragmas.excludeIdeData);
  63261. args: [],
  63262. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  63263. referencedClasses: ["Dictionary"],
  63264. //>>excludeEnd("ide");
  63265. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  63266. }),
  63267. globals.AssociativeCollectionTest);
  63268. smalltalk.addMethod(
  63269. smalltalk.method({
  63270. selector: "testAsHashedCollection",
  63271. protocol: 'tests',
  63272. fn: function (){
  63273. var self=this;
  63274. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  63275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63276. return smalltalk.withContext(function($ctx1) {
  63277. //>>excludeEnd("ctx");
  63278. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  63279. return self;
  63280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63281. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)});
  63282. //>>excludeEnd("ctx");
  63283. },
  63284. //>>excludeStart("ide", pragmas.excludeIdeData);
  63285. args: [],
  63286. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  63287. referencedClasses: ["HashedCollection"],
  63288. //>>excludeEnd("ide");
  63289. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  63290. }),
  63291. globals.AssociativeCollectionTest);
  63292. smalltalk.addMethod(
  63293. smalltalk.method({
  63294. selector: "testComma",
  63295. protocol: 'tests',
  63296. fn: function (){
  63297. var self=this;
  63298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63299. return smalltalk.withContext(function($ctx1) {
  63300. //>>excludeEnd("ctx");
  63301. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  63302. (
  63303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63304. $ctx1.supercall = true,
  63305. //>>excludeEnd("ctx");
  63306. globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  63307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63308. $ctx1.supercall = false;
  63309. //>>excludeEnd("ctx");;
  63310. $2=self._collection();
  63311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63312. $ctx1.sendIdx["collection"]=1;
  63313. //>>excludeEnd("ctx");
  63314. $3=self._collection();
  63315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63316. $ctx1.sendIdx["collection"]=2;
  63317. //>>excludeEnd("ctx");
  63318. $1=_st($2).__comma($3);
  63319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63320. $ctx1.sendIdx[","]=1;
  63321. //>>excludeEnd("ctx");
  63322. $4=self._collection();
  63323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63324. $ctx1.sendIdx["collection"]=3;
  63325. //>>excludeEnd("ctx");
  63326. self._assert_equals_($1,$4);
  63327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63328. $ctx1.sendIdx["assert:equals:"]=1;
  63329. //>>excludeEnd("ctx");
  63330. $6=self._collection();
  63331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63332. $ctx1.sendIdx["collection"]=4;
  63333. //>>excludeEnd("ctx");
  63334. $7=self._collectionWithNewValue();
  63335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63336. $ctx1.sendIdx["collectionWithNewValue"]=1;
  63337. //>>excludeEnd("ctx");
  63338. $5=_st($6).__comma($7);
  63339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63340. $ctx1.sendIdx[","]=2;
  63341. //>>excludeEnd("ctx");
  63342. $8=self._collectionWithNewValue();
  63343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63344. $ctx1.sendIdx["collectionWithNewValue"]=2;
  63345. //>>excludeEnd("ctx");
  63346. self._assert_equals_($5,$8);
  63347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63348. $ctx1.sendIdx["assert:equals:"]=2;
  63349. //>>excludeEnd("ctx");
  63350. $10=self._collectionWithNewValue();
  63351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63352. $ctx1.sendIdx["collectionWithNewValue"]=3;
  63353. //>>excludeEnd("ctx");
  63354. $9=_st($10).__comma(self._collection());
  63355. self._assert_equals_($9,self._collectionWithNewValue());
  63356. return self;
  63357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63358. }, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)});
  63359. //>>excludeEnd("ctx");
  63360. },
  63361. //>>excludeStart("ide", pragmas.excludeIdeData);
  63362. args: [],
  63363. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  63364. referencedClasses: [],
  63365. //>>excludeEnd("ide");
  63366. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  63367. }),
  63368. globals.AssociativeCollectionTest);
  63369. smalltalk.addMethod(
  63370. smalltalk.method({
  63371. selector: "testFrom",
  63372. protocol: 'tests',
  63373. fn: function (){
  63374. var self=this;
  63375. var associations;
  63376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63377. return smalltalk.withContext(function($ctx1) {
  63378. //>>excludeEnd("ctx");
  63379. var $1;
  63380. $1="a".__minus_gt((1));
  63381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63382. $ctx1.sendIdx["->"]=1;
  63383. //>>excludeEnd("ctx");
  63384. associations=[$1,"b".__minus_gt((2))];
  63385. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  63386. return self;
  63387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63388. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)});
  63389. //>>excludeEnd("ctx");
  63390. },
  63391. //>>excludeStart("ide", pragmas.excludeIdeData);
  63392. args: [],
  63393. source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  63394. referencedClasses: [],
  63395. //>>excludeEnd("ide");
  63396. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  63397. }),
  63398. globals.AssociativeCollectionTest);
  63399. smalltalk.addMethod(
  63400. smalltalk.method({
  63401. selector: "testKeys",
  63402. protocol: 'tests',
  63403. fn: function (){
  63404. var self=this;
  63405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63406. return smalltalk.withContext(function($ctx1) {
  63407. //>>excludeEnd("ctx");
  63408. var $2,$1,$3,$4;
  63409. $2=_st(_st(self._collectionClass())._new())._keys();
  63410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63411. $ctx1.sendIdx["keys"]=1;
  63412. //>>excludeEnd("ctx");
  63413. $1=_st($2)._isEmpty();
  63414. self._assert_($1);
  63415. $3=_st(self._collection())._keys();
  63416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63417. $ctx1.sendIdx["keys"]=2;
  63418. //>>excludeEnd("ctx");
  63419. $4=self._collectionKeys();
  63420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63421. $ctx1.sendIdx["collectionKeys"]=1;
  63422. //>>excludeEnd("ctx");
  63423. self._assertSameContents_as_($3,$4);
  63424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63425. $ctx1.sendIdx["assertSameContents:as:"]=1;
  63426. //>>excludeEnd("ctx");
  63427. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  63428. return self;
  63429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63430. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)});
  63431. //>>excludeEnd("ctx");
  63432. },
  63433. //>>excludeStart("ide", pragmas.excludeIdeData);
  63434. args: [],
  63435. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  63436. referencedClasses: [],
  63437. //>>excludeEnd("ide");
  63438. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  63439. }),
  63440. globals.AssociativeCollectionTest);
  63441. smalltalk.addMethod(
  63442. smalltalk.method({
  63443. selector: "testNewFromPairs",
  63444. protocol: 'tests',
  63445. fn: function (){
  63446. var self=this;
  63447. var flattenedAssociations;
  63448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63449. return smalltalk.withContext(function($ctx1) {
  63450. //>>excludeEnd("ctx");
  63451. flattenedAssociations=["a",(1),"b",(2)];
  63452. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  63453. return self;
  63454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63455. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)});
  63456. //>>excludeEnd("ctx");
  63457. },
  63458. //>>excludeStart("ide", pragmas.excludeIdeData);
  63459. args: [],
  63460. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  63461. referencedClasses: [],
  63462. //>>excludeEnd("ide");
  63463. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  63464. }),
  63465. globals.AssociativeCollectionTest);
  63466. smalltalk.addMethod(
  63467. smalltalk.method({
  63468. selector: "testPrintString",
  63469. protocol: 'tests',
  63470. fn: function (){
  63471. var self=this;
  63472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63473. return smalltalk.withContext(function($ctx1) {
  63474. //>>excludeEnd("ctx");
  63475. var $3,$2,$4,$1,$5;
  63476. $3=self._collectionClass();
  63477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63478. $ctx1.sendIdx["collectionClass"]=1;
  63479. //>>excludeEnd("ctx");
  63480. $2=_st($3)._new();
  63481. _st($2)._at_put_("firstname","James");
  63482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63483. $ctx1.sendIdx["at:put:"]=1;
  63484. //>>excludeEnd("ctx");
  63485. _st($2)._at_put_("lastname","Bond");
  63486. $4=_st($2)._printString();
  63487. $1=$4;
  63488. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  63489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63490. $ctx1.sendIdx[","]=1;
  63491. //>>excludeEnd("ctx");
  63492. self._assert_equals_($1,$5);
  63493. return self;
  63494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63495. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)});
  63496. //>>excludeEnd("ctx");
  63497. },
  63498. //>>excludeStart("ide", pragmas.excludeIdeData);
  63499. args: [],
  63500. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  63501. referencedClasses: [],
  63502. //>>excludeEnd("ide");
  63503. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  63504. }),
  63505. globals.AssociativeCollectionTest);
  63506. smalltalk.addMethod(
  63507. smalltalk.method({
  63508. selector: "testRemoveKey",
  63509. protocol: 'tests',
  63510. fn: function (){
  63511. var self=this;
  63512. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  63513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63514. return smalltalk.withContext(function($ctx1) {
  63515. //>>excludeEnd("ctx");
  63516. var $1,$2,$3,$5,$6,$4,$7,$8;
  63517. self._nonIndexesDo_((function(each){
  63518. var collection;
  63519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63520. return smalltalk.withContext(function($ctx2) {
  63521. //>>excludeEnd("ctx");
  63522. collection=self._collection();
  63523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63524. $ctx2.sendIdx["collection"]=1;
  63525. //>>excludeEnd("ctx");
  63526. collection;
  63527. self._should_raise_((function(){
  63528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63529. return smalltalk.withContext(function($ctx3) {
  63530. //>>excludeEnd("ctx");
  63531. return _st(collection)._removeKey_(each);
  63532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63533. $ctx3.sendIdx["removeKey:"]=1;
  63534. //>>excludeEnd("ctx");
  63535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63536. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63537. //>>excludeEnd("ctx");
  63538. }),$Error());
  63539. $1=collection;
  63540. $2=self._collection();
  63541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63542. $ctx2.sendIdx["collection"]=2;
  63543. //>>excludeEnd("ctx");
  63544. return self._assert_equals_($1,$2);
  63545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63546. $ctx2.sendIdx["assert:equals:"]=1;
  63547. //>>excludeEnd("ctx");
  63548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63549. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  63550. //>>excludeEnd("ctx");
  63551. }));
  63552. self._samplesDo_((function(index,value){
  63553. var collection;
  63554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63555. return smalltalk.withContext(function($ctx2) {
  63556. //>>excludeEnd("ctx");
  63557. collection=self._collection();
  63558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63559. $ctx2.sendIdx["collection"]=3;
  63560. //>>excludeEnd("ctx");
  63561. collection;
  63562. $3=_st(collection)._removeKey_(index);
  63563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63564. $ctx2.sendIdx["removeKey:"]=2;
  63565. //>>excludeEnd("ctx");
  63566. self._assert_equals_($3,value);
  63567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63568. $ctx2.sendIdx["assert:equals:"]=2;
  63569. //>>excludeEnd("ctx");
  63570. $5=collection;
  63571. $6=self._collection();
  63572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63573. $ctx2.sendIdx["collection"]=4;
  63574. //>>excludeEnd("ctx");
  63575. $4=_st($5).__eq($6);
  63576. return self._deny_($4);
  63577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63578. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  63579. //>>excludeEnd("ctx");
  63580. }));
  63581. $7=self._collectionWithNewValue();
  63582. _st($7)._removeKey_(self._sampleNewIndex());
  63583. $8=_st($7)._yourself();
  63584. self._assert_equals_($8,self._collection());
  63585. return self;
  63586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63587. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)});
  63588. //>>excludeEnd("ctx");
  63589. },
  63590. //>>excludeStart("ide", pragmas.excludeIdeData);
  63591. args: [],
  63592. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  63593. referencedClasses: ["Error"],
  63594. //>>excludeEnd("ide");
  63595. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  63596. }),
  63597. globals.AssociativeCollectionTest);
  63598. smalltalk.addMethod(
  63599. smalltalk.method({
  63600. selector: "testRemoveKeyIfAbsent",
  63601. protocol: 'tests',
  63602. fn: function (){
  63603. var self=this;
  63604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63605. return smalltalk.withContext(function($ctx1) {
  63606. //>>excludeEnd("ctx");
  63607. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  63608. self._nonIndexesDo_((function(each){
  63609. var collection;
  63610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63611. return smalltalk.withContext(function($ctx2) {
  63612. //>>excludeEnd("ctx");
  63613. collection=self._collection();
  63614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63615. $ctx2.sendIdx["collection"]=1;
  63616. //>>excludeEnd("ctx");
  63617. collection;
  63618. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  63619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63620. return smalltalk.withContext(function($ctx3) {
  63621. //>>excludeEnd("ctx");
  63622. return self._sampleNewValue();
  63623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63624. $ctx3.sendIdx["sampleNewValue"]=1;
  63625. //>>excludeEnd("ctx");
  63626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63627. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63628. //>>excludeEnd("ctx");
  63629. }));
  63630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63631. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  63632. //>>excludeEnd("ctx");
  63633. $2=self._sampleNewValue();
  63634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63635. $ctx2.sendIdx["sampleNewValue"]=2;
  63636. //>>excludeEnd("ctx");
  63637. self._assert_equals_($1,$2);
  63638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63639. $ctx2.sendIdx["assert:equals:"]=1;
  63640. //>>excludeEnd("ctx");
  63641. $3=collection;
  63642. $4=self._collection();
  63643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63644. $ctx2.sendIdx["collection"]=2;
  63645. //>>excludeEnd("ctx");
  63646. return self._assert_equals_($3,$4);
  63647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63648. $ctx2.sendIdx["assert:equals:"]=2;
  63649. //>>excludeEnd("ctx");
  63650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63651. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  63652. //>>excludeEnd("ctx");
  63653. }));
  63654. self._samplesDo_((function(index,value){
  63655. var collection;
  63656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63657. return smalltalk.withContext(function($ctx2) {
  63658. //>>excludeEnd("ctx");
  63659. collection=self._collection();
  63660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63661. $ctx2.sendIdx["collection"]=3;
  63662. //>>excludeEnd("ctx");
  63663. collection;
  63664. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  63665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63666. return smalltalk.withContext(function($ctx3) {
  63667. //>>excludeEnd("ctx");
  63668. return self._sampleNewValue();
  63669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63670. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  63671. //>>excludeEnd("ctx");
  63672. }));
  63673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63674. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  63675. //>>excludeEnd("ctx");
  63676. self._assert_equals_($5,value);
  63677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63678. $ctx2.sendIdx["assert:equals:"]=3;
  63679. //>>excludeEnd("ctx");
  63680. $7=collection;
  63681. $8=self._collection();
  63682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63683. $ctx2.sendIdx["collection"]=4;
  63684. //>>excludeEnd("ctx");
  63685. $6=_st($7).__eq($8);
  63686. return self._deny_($6);
  63687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63688. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  63689. //>>excludeEnd("ctx");
  63690. }));
  63691. $9=self._collectionWithNewValue();
  63692. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  63693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63694. return smalltalk.withContext(function($ctx2) {
  63695. //>>excludeEnd("ctx");
  63696. return self._assert_(false);
  63697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63699. //>>excludeEnd("ctx");
  63700. }));
  63701. $10=_st($9)._yourself();
  63702. self._assert_equals_($10,self._collection());
  63703. return self;
  63704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63705. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)});
  63706. //>>excludeEnd("ctx");
  63707. },
  63708. //>>excludeStart("ide", pragmas.excludeIdeData);
  63709. args: [],
  63710. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  63711. referencedClasses: [],
  63712. //>>excludeEnd("ide");
  63713. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  63714. }),
  63715. globals.AssociativeCollectionTest);
  63716. smalltalk.addMethod(
  63717. smalltalk.method({
  63718. selector: "testValues",
  63719. protocol: 'tests',
  63720. fn: function (){
  63721. var self=this;
  63722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63723. return smalltalk.withContext(function($ctx1) {
  63724. //>>excludeEnd("ctx");
  63725. var $2,$1,$3,$4;
  63726. $2=_st(_st(self._collectionClass())._new())._values();
  63727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63728. $ctx1.sendIdx["values"]=1;
  63729. //>>excludeEnd("ctx");
  63730. $1=_st($2)._isEmpty();
  63731. self._assert_($1);
  63732. $3=_st(self._collection())._values();
  63733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63734. $ctx1.sendIdx["values"]=2;
  63735. //>>excludeEnd("ctx");
  63736. $4=self._collectionValues();
  63737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63738. $ctx1.sendIdx["collectionValues"]=1;
  63739. //>>excludeEnd("ctx");
  63740. self._assertSameContents_as_($3,$4);
  63741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63742. $ctx1.sendIdx["assertSameContents:as:"]=1;
  63743. //>>excludeEnd("ctx");
  63744. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  63745. return self;
  63746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63747. }, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)});
  63748. //>>excludeEnd("ctx");
  63749. },
  63750. //>>excludeStart("ide", pragmas.excludeIdeData);
  63751. args: [],
  63752. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  63753. referencedClasses: [],
  63754. //>>excludeEnd("ide");
  63755. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  63756. }),
  63757. globals.AssociativeCollectionTest);
  63758. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  63759. smalltalk.addMethod(
  63760. smalltalk.method({
  63761. selector: "collection",
  63762. protocol: 'fixture',
  63763. fn: function (){
  63764. var self=this;
  63765. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63767. return smalltalk.withContext(function($ctx1) {
  63768. //>>excludeEnd("ctx");
  63769. var $2,$3,$1;
  63770. $2=_st($Dictionary())._new();
  63771. _st($2)._at_put_((1),(1));
  63772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63773. $ctx1.sendIdx["at:put:"]=1;
  63774. //>>excludeEnd("ctx");
  63775. _st($2)._at_put_("a",(2));
  63776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63777. $ctx1.sendIdx["at:put:"]=2;
  63778. //>>excludeEnd("ctx");
  63779. _st($2)._at_put_(true,(3));
  63780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63781. $ctx1.sendIdx["at:put:"]=3;
  63782. //>>excludeEnd("ctx");
  63783. _st($2)._at_put_((1).__at((3)),(-4));
  63784. $3=_st($2)._yourself();
  63785. $1=$3;
  63786. return $1;
  63787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63788. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)});
  63789. //>>excludeEnd("ctx");
  63790. },
  63791. //>>excludeStart("ide", pragmas.excludeIdeData);
  63792. args: [],
  63793. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09yourself",
  63794. referencedClasses: ["Dictionary"],
  63795. //>>excludeEnd("ide");
  63796. messageSends: ["at:put:", "new", "@", "yourself"]
  63797. }),
  63798. globals.DictionaryTest);
  63799. smalltalk.addMethod(
  63800. smalltalk.method({
  63801. selector: "collectionKeys",
  63802. protocol: 'fixture',
  63803. fn: function (){
  63804. var self=this;
  63805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63806. return smalltalk.withContext(function($ctx1) {
  63807. //>>excludeEnd("ctx");
  63808. var $1;
  63809. $1=[(1),"a",true,(1).__at((3))];
  63810. return $1;
  63811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63812. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)});
  63813. //>>excludeEnd("ctx");
  63814. },
  63815. //>>excludeStart("ide", pragmas.excludeIdeData);
  63816. args: [],
  63817. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  63818. referencedClasses: [],
  63819. //>>excludeEnd("ide");
  63820. messageSends: ["@"]
  63821. }),
  63822. globals.DictionaryTest);
  63823. smalltalk.addMethod(
  63824. smalltalk.method({
  63825. selector: "collectionOfPrintStrings",
  63826. protocol: 'fixture',
  63827. fn: function (){
  63828. var self=this;
  63829. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63831. return smalltalk.withContext(function($ctx1) {
  63832. //>>excludeEnd("ctx");
  63833. var $2,$3,$1;
  63834. $2=_st($Dictionary())._new();
  63835. _st($2)._at_put_((1),"1");
  63836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63837. $ctx1.sendIdx["at:put:"]=1;
  63838. //>>excludeEnd("ctx");
  63839. _st($2)._at_put_("a","2");
  63840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63841. $ctx1.sendIdx["at:put:"]=2;
  63842. //>>excludeEnd("ctx");
  63843. _st($2)._at_put_(true,"3");
  63844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63845. $ctx1.sendIdx["at:put:"]=3;
  63846. //>>excludeEnd("ctx");
  63847. _st($2)._at_put_((1).__at((3)),"-4");
  63848. $3=_st($2)._yourself();
  63849. $1=$3;
  63850. return $1;
  63851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63852. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)});
  63853. //>>excludeEnd("ctx");
  63854. },
  63855. //>>excludeStart("ide", pragmas.excludeIdeData);
  63856. args: [],
  63857. source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09yourself",
  63858. referencedClasses: ["Dictionary"],
  63859. //>>excludeEnd("ide");
  63860. messageSends: ["at:put:", "new", "@", "yourself"]
  63861. }),
  63862. globals.DictionaryTest);
  63863. smalltalk.addMethod(
  63864. smalltalk.method({
  63865. selector: "collectionSize",
  63866. protocol: 'fixture',
  63867. fn: function (){
  63868. var self=this;
  63869. return (4);
  63870. },
  63871. //>>excludeStart("ide", pragmas.excludeIdeData);
  63872. args: [],
  63873. source: "collectionSize\x0a\x09^ 4",
  63874. referencedClasses: [],
  63875. //>>excludeEnd("ide");
  63876. messageSends: []
  63877. }),
  63878. globals.DictionaryTest);
  63879. smalltalk.addMethod(
  63880. smalltalk.method({
  63881. selector: "collectionValues",
  63882. protocol: 'fixture',
  63883. fn: function (){
  63884. var self=this;
  63885. var $1;
  63886. $1=[(1),(2),(3),(-4)];
  63887. return $1;
  63888. },
  63889. //>>excludeStart("ide", pragmas.excludeIdeData);
  63890. args: [],
  63891. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  63892. referencedClasses: [],
  63893. //>>excludeEnd("ide");
  63894. messageSends: []
  63895. }),
  63896. globals.DictionaryTest);
  63897. smalltalk.addMethod(
  63898. smalltalk.method({
  63899. selector: "collectionWithDuplicates",
  63900. protocol: 'fixture',
  63901. fn: function (){
  63902. var self=this;
  63903. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63905. return smalltalk.withContext(function($ctx1) {
  63906. //>>excludeEnd("ctx");
  63907. var $2,$3,$1;
  63908. $2=_st($Dictionary())._new();
  63909. _st($2)._at_put_((1),(1));
  63910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63911. $ctx1.sendIdx["at:put:"]=1;
  63912. //>>excludeEnd("ctx");
  63913. _st($2)._at_put_("a",(2));
  63914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63915. $ctx1.sendIdx["at:put:"]=2;
  63916. //>>excludeEnd("ctx");
  63917. _st($2)._at_put_(true,(3));
  63918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63919. $ctx1.sendIdx["at:put:"]=3;
  63920. //>>excludeEnd("ctx");
  63921. _st($2)._at_put_((4),(-4));
  63922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63923. $ctx1.sendIdx["at:put:"]=4;
  63924. //>>excludeEnd("ctx");
  63925. _st($2)._at_put_("b",(1));
  63926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63927. $ctx1.sendIdx["at:put:"]=5;
  63928. //>>excludeEnd("ctx");
  63929. _st($2)._at_put_((3),(3));
  63930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63931. $ctx1.sendIdx["at:put:"]=6;
  63932. //>>excludeEnd("ctx");
  63933. _st($2)._at_put_(false,(12));
  63934. $3=_st($2)._yourself();
  63935. $1=$3;
  63936. return $1;
  63937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63938. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)});
  63939. //>>excludeEnd("ctx");
  63940. },
  63941. //>>excludeStart("ide", pragmas.excludeIdeData);
  63942. args: [],
  63943. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  63944. referencedClasses: ["Dictionary"],
  63945. //>>excludeEnd("ide");
  63946. messageSends: ["at:put:", "new", "yourself"]
  63947. }),
  63948. globals.DictionaryTest);
  63949. smalltalk.addMethod(
  63950. smalltalk.method({
  63951. selector: "collectionWithNewValue",
  63952. protocol: 'fixture',
  63953. fn: function (){
  63954. var self=this;
  63955. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63957. return smalltalk.withContext(function($ctx1) {
  63958. //>>excludeEnd("ctx");
  63959. var $2,$3,$1;
  63960. $2=_st($Dictionary())._new();
  63961. _st($2)._at_put_((1),(1));
  63962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63963. $ctx1.sendIdx["at:put:"]=1;
  63964. //>>excludeEnd("ctx");
  63965. _st($2)._at_put_("a",(2));
  63966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63967. $ctx1.sendIdx["at:put:"]=2;
  63968. //>>excludeEnd("ctx");
  63969. _st($2)._at_put_(true,(3));
  63970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63971. $ctx1.sendIdx["at:put:"]=3;
  63972. //>>excludeEnd("ctx");
  63973. _st($2)._at_put_((1).__at((3)),(-4));
  63974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63975. $ctx1.sendIdx["at:put:"]=4;
  63976. //>>excludeEnd("ctx");
  63977. _st($2)._at_put_("new","N");
  63978. $3=_st($2)._yourself();
  63979. $1=$3;
  63980. return $1;
  63981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63982. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)});
  63983. //>>excludeEnd("ctx");
  63984. },
  63985. //>>excludeStart("ide", pragmas.excludeIdeData);
  63986. args: [],
  63987. source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  63988. referencedClasses: ["Dictionary"],
  63989. //>>excludeEnd("ide");
  63990. messageSends: ["at:put:", "new", "@", "yourself"]
  63991. }),
  63992. globals.DictionaryTest);
  63993. smalltalk.addMethod(
  63994. smalltalk.method({
  63995. selector: "sampleNewValueAsCollection",
  63996. protocol: 'fixture',
  63997. fn: function (){
  63998. var self=this;
  63999. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  64000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64001. return smalltalk.withContext(function($ctx1) {
  64002. //>>excludeEnd("ctx");
  64003. var $2,$3,$1;
  64004. $2=_st($Dictionary())._new();
  64005. _st($2)._at_put_("new","N");
  64006. $3=_st($2)._yourself();
  64007. $1=$3;
  64008. return $1;
  64009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64010. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)});
  64011. //>>excludeEnd("ctx");
  64012. },
  64013. //>>excludeStart("ide", pragmas.excludeIdeData);
  64014. args: [],
  64015. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  64016. referencedClasses: ["Dictionary"],
  64017. //>>excludeEnd("ide");
  64018. messageSends: ["at:put:", "new", "yourself"]
  64019. }),
  64020. globals.DictionaryTest);
  64021. smalltalk.addMethod(
  64022. smalltalk.method({
  64023. selector: "samplesDo:",
  64024. protocol: 'fixture',
  64025. fn: function (aBlock){
  64026. var self=this;
  64027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64028. return smalltalk.withContext(function($ctx1) {
  64029. //>>excludeEnd("ctx");
  64030. (
  64031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64032. $ctx1.supercall = true,
  64033. //>>excludeEnd("ctx");
  64034. globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  64035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64036. $ctx1.supercall = false;
  64037. //>>excludeEnd("ctx");;
  64038. _st(aBlock)._value_value_(true,(3));
  64039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64040. $ctx1.sendIdx["value:value:"]=1;
  64041. //>>excludeEnd("ctx");
  64042. _st(aBlock)._value_value_((1).__at((3)),(-4));
  64043. return self;
  64044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64045. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)});
  64046. //>>excludeEnd("ctx");
  64047. },
  64048. //>>excludeStart("ide", pragmas.excludeIdeData);
  64049. args: ["aBlock"],
  64050. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  64051. referencedClasses: [],
  64052. //>>excludeEnd("ide");
  64053. messageSends: ["samplesDo:", "value:value:", "@"]
  64054. }),
  64055. globals.DictionaryTest);
  64056. smalltalk.addMethod(
  64057. smalltalk.method({
  64058. selector: "testAccessing",
  64059. protocol: 'tests',
  64060. fn: function (){
  64061. var self=this;
  64062. var d;
  64063. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  64064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64065. return smalltalk.withContext(function($ctx1) {
  64066. //>>excludeEnd("ctx");
  64067. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  64068. d=_st($Dictionary())._new();
  64069. _st(d)._at_put_("hello","world");
  64070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64071. $ctx1.sendIdx["at:put:"]=1;
  64072. //>>excludeEnd("ctx");
  64073. $1=_st(d)._at_("hello");
  64074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64075. $ctx1.sendIdx["at:"]=1;
  64076. //>>excludeEnd("ctx");
  64077. self._assert_equals_($1,"world");
  64078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64079. $ctx1.sendIdx["assert:equals:"]=1;
  64080. //>>excludeEnd("ctx");
  64081. $2=_st(d)._at_ifAbsent_("hello",(function(){
  64082. return nil;
  64083. }));
  64084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64085. $ctx1.sendIdx["at:ifAbsent:"]=1;
  64086. //>>excludeEnd("ctx");
  64087. self._assert_equals_($2,"world");
  64088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64089. $ctx1.sendIdx["assert:equals:"]=2;
  64090. //>>excludeEnd("ctx");
  64091. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  64092. return nil;
  64093. }))).__eq("world"));
  64094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64095. $ctx1.sendIdx["deny:"]=1;
  64096. //>>excludeEnd("ctx");
  64097. $3=_st(d)._includesKey_("hello");
  64098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64099. $ctx1.sendIdx["includesKey:"]=1;
  64100. //>>excludeEnd("ctx");
  64101. self._assert_($3);
  64102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64103. $ctx1.sendIdx["assert:"]=1;
  64104. //>>excludeEnd("ctx");
  64105. $4=_st(d)._includesKey_("foo");
  64106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64107. $ctx1.sendIdx["includesKey:"]=2;
  64108. //>>excludeEnd("ctx");
  64109. self._deny_($4);
  64110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64111. $ctx1.sendIdx["deny:"]=2;
  64112. //>>excludeEnd("ctx");
  64113. _st(d)._at_put_((1),(2));
  64114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64115. $ctx1.sendIdx["at:put:"]=2;
  64116. //>>excludeEnd("ctx");
  64117. $5=_st(d)._at_((1));
  64118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64119. $ctx1.sendIdx["at:"]=2;
  64120. //>>excludeEnd("ctx");
  64121. self._assert_equals_($5,(2));
  64122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64123. $ctx1.sendIdx["assert:equals:"]=3;
  64124. //>>excludeEnd("ctx");
  64125. $6=d;
  64126. $7=(1).__at((3));
  64127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64128. $ctx1.sendIdx["@"]=1;
  64129. //>>excludeEnd("ctx");
  64130. _st($6)._at_put_($7,(3));
  64131. $9=d;
  64132. $10=(1).__at((3));
  64133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64134. $ctx1.sendIdx["@"]=2;
  64135. //>>excludeEnd("ctx");
  64136. $8=_st($9)._at_($10);
  64137. self._assert_equals_($8,(3));
  64138. $12=d;
  64139. $13=(1).__at((3));
  64140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64141. $ctx1.sendIdx["@"]=3;
  64142. //>>excludeEnd("ctx");
  64143. $11=_st($12)._includesKey_($13);
  64144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64145. $ctx1.sendIdx["includesKey:"]=3;
  64146. //>>excludeEnd("ctx");
  64147. self._assert_($11);
  64148. self._deny_(_st(d)._includesKey_((3).__at((1))));
  64149. return self;
  64150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64151. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)});
  64152. //>>excludeEnd("ctx");
  64153. },
  64154. //>>excludeStart("ide", pragmas.excludeIdeData);
  64155. args: [],
  64156. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [ nil ]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [ nil ]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)",
  64157. referencedClasses: ["Dictionary"],
  64158. //>>excludeEnd("ide");
  64159. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  64160. }),
  64161. globals.DictionaryTest);
  64162. smalltalk.addMethod(
  64163. smalltalk.method({
  64164. selector: "testDynamicDictionaries",
  64165. protocol: 'tests',
  64166. fn: function (){
  64167. var self=this;
  64168. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  64169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64170. return smalltalk.withContext(function($ctx1) {
  64171. //>>excludeEnd("ctx");
  64172. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  64173. return self;
  64174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64175. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)});
  64176. //>>excludeEnd("ctx");
  64177. },
  64178. //>>excludeStart("ide", pragmas.excludeIdeData);
  64179. args: [],
  64180. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  64181. referencedClasses: ["Dictionary"],
  64182. //>>excludeEnd("ide");
  64183. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  64184. }),
  64185. globals.DictionaryTest);
  64186. smalltalk.addMethod(
  64187. smalltalk.method({
  64188. selector: "collectionClass",
  64189. protocol: 'fixture',
  64190. fn: function (){
  64191. var self=this;
  64192. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  64193. return $Dictionary();
  64194. },
  64195. //>>excludeStart("ide", pragmas.excludeIdeData);
  64196. args: [],
  64197. source: "collectionClass\x0a\x09^ Dictionary",
  64198. referencedClasses: ["Dictionary"],
  64199. //>>excludeEnd("ide");
  64200. messageSends: []
  64201. }),
  64202. globals.DictionaryTest.klass);
  64203. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  64204. smalltalk.addMethod(
  64205. smalltalk.method({
  64206. selector: "collection",
  64207. protocol: 'fixture',
  64208. fn: function (){
  64209. var self=this;
  64210. var $1;
  64211. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  64212. return $1;
  64213. },
  64214. //>>excludeStart("ide", pragmas.excludeIdeData);
  64215. args: [],
  64216. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  64217. referencedClasses: [],
  64218. //>>excludeEnd("ide");
  64219. messageSends: []
  64220. }),
  64221. globals.HashedCollectionTest);
  64222. smalltalk.addMethod(
  64223. smalltalk.method({
  64224. selector: "collectionKeys",
  64225. protocol: 'fixture',
  64226. fn: function (){
  64227. var self=this;
  64228. var $1;
  64229. $1=["b","a","c","d"];
  64230. return $1;
  64231. },
  64232. //>>excludeStart("ide", pragmas.excludeIdeData);
  64233. args: [],
  64234. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  64235. referencedClasses: [],
  64236. //>>excludeEnd("ide");
  64237. messageSends: []
  64238. }),
  64239. globals.HashedCollectionTest);
  64240. smalltalk.addMethod(
  64241. smalltalk.method({
  64242. selector: "collectionOfPrintStrings",
  64243. protocol: 'fixture',
  64244. fn: function (){
  64245. var self=this;
  64246. var $1;
  64247. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  64248. return $1;
  64249. },
  64250. //>>excludeStart("ide", pragmas.excludeIdeData);
  64251. args: [],
  64252. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  64253. referencedClasses: [],
  64254. //>>excludeEnd("ide");
  64255. messageSends: []
  64256. }),
  64257. globals.HashedCollectionTest);
  64258. smalltalk.addMethod(
  64259. smalltalk.method({
  64260. selector: "collectionSize",
  64261. protocol: 'fixture',
  64262. fn: function (){
  64263. var self=this;
  64264. return (4);
  64265. },
  64266. //>>excludeStart("ide", pragmas.excludeIdeData);
  64267. args: [],
  64268. source: "collectionSize\x0a\x09^ 4",
  64269. referencedClasses: [],
  64270. //>>excludeEnd("ide");
  64271. messageSends: []
  64272. }),
  64273. globals.HashedCollectionTest);
  64274. smalltalk.addMethod(
  64275. smalltalk.method({
  64276. selector: "collectionValues",
  64277. protocol: 'fixture',
  64278. fn: function (){
  64279. var self=this;
  64280. var $1;
  64281. $1=[(1),(2),(3),(-4)];
  64282. return $1;
  64283. },
  64284. //>>excludeStart("ide", pragmas.excludeIdeData);
  64285. args: [],
  64286. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  64287. referencedClasses: [],
  64288. //>>excludeEnd("ide");
  64289. messageSends: []
  64290. }),
  64291. globals.HashedCollectionTest);
  64292. smalltalk.addMethod(
  64293. smalltalk.method({
  64294. selector: "collectionWithDuplicates",
  64295. protocol: 'fixture',
  64296. fn: function (){
  64297. var self=this;
  64298. var $1;
  64299. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  64300. return $1;
  64301. },
  64302. //>>excludeStart("ide", pragmas.excludeIdeData);
  64303. args: [],
  64304. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  64305. referencedClasses: [],
  64306. //>>excludeEnd("ide");
  64307. messageSends: []
  64308. }),
  64309. globals.HashedCollectionTest);
  64310. smalltalk.addMethod(
  64311. smalltalk.method({
  64312. selector: "collectionWithNewValue",
  64313. protocol: 'fixture',
  64314. fn: function (){
  64315. var self=this;
  64316. var $1;
  64317. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  64318. return $1;
  64319. },
  64320. //>>excludeStart("ide", pragmas.excludeIdeData);
  64321. args: [],
  64322. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  64323. referencedClasses: [],
  64324. //>>excludeEnd("ide");
  64325. messageSends: []
  64326. }),
  64327. globals.HashedCollectionTest);
  64328. smalltalk.addMethod(
  64329. smalltalk.method({
  64330. selector: "sampleNewValueAsCollection",
  64331. protocol: 'fixture',
  64332. fn: function (){
  64333. var self=this;
  64334. var $1;
  64335. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  64336. return $1;
  64337. },
  64338. //>>excludeStart("ide", pragmas.excludeIdeData);
  64339. args: [],
  64340. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  64341. referencedClasses: [],
  64342. //>>excludeEnd("ide");
  64343. messageSends: []
  64344. }),
  64345. globals.HashedCollectionTest);
  64346. smalltalk.addMethod(
  64347. smalltalk.method({
  64348. selector: "testDynamicDictionaries",
  64349. protocol: 'tests',
  64350. fn: function (){
  64351. var self=this;
  64352. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  64353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64354. return smalltalk.withContext(function($ctx1) {
  64355. //>>excludeEnd("ctx");
  64356. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  64357. return self;
  64358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64359. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)});
  64360. //>>excludeEnd("ctx");
  64361. },
  64362. //>>excludeStart("ide", pragmas.excludeIdeData);
  64363. args: [],
  64364. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  64365. referencedClasses: ["HashedCollection"],
  64366. //>>excludeEnd("ide");
  64367. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  64368. }),
  64369. globals.HashedCollectionTest);
  64370. smalltalk.addMethod(
  64371. smalltalk.method({
  64372. selector: "collectionClass",
  64373. protocol: 'fixture',
  64374. fn: function (){
  64375. var self=this;
  64376. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  64377. return $HashedCollection();
  64378. },
  64379. //>>excludeStart("ide", pragmas.excludeIdeData);
  64380. args: [],
  64381. source: "collectionClass\x0a\x09^ HashedCollection",
  64382. referencedClasses: ["HashedCollection"],
  64383. //>>excludeEnd("ide");
  64384. messageSends: []
  64385. }),
  64386. globals.HashedCollectionTest.klass);
  64387. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  64388. smalltalk.addMethod(
  64389. smalltalk.method({
  64390. selector: "collectionFirst",
  64391. protocol: 'fixture',
  64392. fn: function (){
  64393. var self=this;
  64394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64395. return smalltalk.withContext(function($ctx1) {
  64396. //>>excludeEnd("ctx");
  64397. self._subclassResponsibility();
  64398. return self;
  64399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64400. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)});
  64401. //>>excludeEnd("ctx");
  64402. },
  64403. //>>excludeStart("ide", pragmas.excludeIdeData);
  64404. args: [],
  64405. source: "collectionFirst\x0a\x09self subclassResponsibility",
  64406. referencedClasses: [],
  64407. //>>excludeEnd("ide");
  64408. messageSends: ["subclassResponsibility"]
  64409. }),
  64410. globals.SequenceableCollectionTest);
  64411. smalltalk.addMethod(
  64412. smalltalk.method({
  64413. selector: "collectionFirstTwo",
  64414. protocol: 'fixture',
  64415. fn: function (){
  64416. var self=this;
  64417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64418. return smalltalk.withContext(function($ctx1) {
  64419. //>>excludeEnd("ctx");
  64420. self._subclassResponsibility();
  64421. return self;
  64422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64423. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)});
  64424. //>>excludeEnd("ctx");
  64425. },
  64426. //>>excludeStart("ide", pragmas.excludeIdeData);
  64427. args: [],
  64428. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  64429. referencedClasses: [],
  64430. //>>excludeEnd("ide");
  64431. messageSends: ["subclassResponsibility"]
  64432. }),
  64433. globals.SequenceableCollectionTest);
  64434. smalltalk.addMethod(
  64435. smalltalk.method({
  64436. selector: "collectionLast",
  64437. protocol: 'fixture',
  64438. fn: function (){
  64439. var self=this;
  64440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64441. return smalltalk.withContext(function($ctx1) {
  64442. //>>excludeEnd("ctx");
  64443. self._subclassResponsibility();
  64444. return self;
  64445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64446. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)});
  64447. //>>excludeEnd("ctx");
  64448. },
  64449. //>>excludeStart("ide", pragmas.excludeIdeData);
  64450. args: [],
  64451. source: "collectionLast\x0a\x09self subclassResponsibility",
  64452. referencedClasses: [],
  64453. //>>excludeEnd("ide");
  64454. messageSends: ["subclassResponsibility"]
  64455. }),
  64456. globals.SequenceableCollectionTest);
  64457. smalltalk.addMethod(
  64458. smalltalk.method({
  64459. selector: "collectionLastTwo",
  64460. protocol: 'fixture',
  64461. fn: function (){
  64462. var self=this;
  64463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64464. return smalltalk.withContext(function($ctx1) {
  64465. //>>excludeEnd("ctx");
  64466. self._subclassResponsibility();
  64467. return self;
  64468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64469. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)});
  64470. //>>excludeEnd("ctx");
  64471. },
  64472. //>>excludeStart("ide", pragmas.excludeIdeData);
  64473. args: [],
  64474. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  64475. referencedClasses: [],
  64476. //>>excludeEnd("ide");
  64477. messageSends: ["subclassResponsibility"]
  64478. }),
  64479. globals.SequenceableCollectionTest);
  64480. smalltalk.addMethod(
  64481. smalltalk.method({
  64482. selector: "nonIndexesDo:",
  64483. protocol: 'fixture',
  64484. fn: function (aBlock){
  64485. var self=this;
  64486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64487. return smalltalk.withContext(function($ctx1) {
  64488. //>>excludeEnd("ctx");
  64489. _st(aBlock)._value_((0));
  64490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64491. $ctx1.sendIdx["value:"]=1;
  64492. //>>excludeEnd("ctx");
  64493. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  64494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64495. $ctx1.sendIdx["value:"]=2;
  64496. //>>excludeEnd("ctx");
  64497. _st(aBlock)._value_("z");
  64498. return self;
  64499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64500. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)});
  64501. //>>excludeEnd("ctx");
  64502. },
  64503. //>>excludeStart("ide", pragmas.excludeIdeData);
  64504. args: ["aBlock"],
  64505. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  64506. referencedClasses: [],
  64507. //>>excludeEnd("ide");
  64508. messageSends: ["value:", "+", "collectionSize"]
  64509. }),
  64510. globals.SequenceableCollectionTest);
  64511. smalltalk.addMethod(
  64512. smalltalk.method({
  64513. selector: "samplesDo:",
  64514. protocol: 'fixture',
  64515. fn: function (aBlock){
  64516. var self=this;
  64517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64518. return smalltalk.withContext(function($ctx1) {
  64519. //>>excludeEnd("ctx");
  64520. _st(aBlock)._value_value_((1),self._collectionFirst());
  64521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64522. $ctx1.sendIdx["value:value:"]=1;
  64523. //>>excludeEnd("ctx");
  64524. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  64525. return self;
  64526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64527. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)});
  64528. //>>excludeEnd("ctx");
  64529. },
  64530. //>>excludeStart("ide", pragmas.excludeIdeData);
  64531. args: ["aBlock"],
  64532. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  64533. referencedClasses: [],
  64534. //>>excludeEnd("ide");
  64535. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  64536. }),
  64537. globals.SequenceableCollectionTest);
  64538. smalltalk.addMethod(
  64539. smalltalk.method({
  64540. selector: "testBeginsWith",
  64541. protocol: 'tests',
  64542. fn: function (){
  64543. var self=this;
  64544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64545. return smalltalk.withContext(function($ctx1) {
  64546. //>>excludeEnd("ctx");
  64547. var $2,$1,$4,$5,$3,$7,$6;
  64548. $2=self._collection();
  64549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64550. $ctx1.sendIdx["collection"]=1;
  64551. //>>excludeEnd("ctx");
  64552. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  64553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64554. $ctx1.sendIdx["beginsWith:"]=1;
  64555. //>>excludeEnd("ctx");
  64556. self._assert_($1);
  64557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64558. $ctx1.sendIdx["assert:"]=1;
  64559. //>>excludeEnd("ctx");
  64560. $4=self._collection();
  64561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64562. $ctx1.sendIdx["collection"]=2;
  64563. //>>excludeEnd("ctx");
  64564. $5=self._collection();
  64565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64566. $ctx1.sendIdx["collection"]=3;
  64567. //>>excludeEnd("ctx");
  64568. $3=_st($4)._beginsWith_($5);
  64569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64570. $ctx1.sendIdx["beginsWith:"]=2;
  64571. //>>excludeEnd("ctx");
  64572. self._assert_($3);
  64573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64574. $ctx1.sendIdx["assert:"]=2;
  64575. //>>excludeEnd("ctx");
  64576. $7=self._collection();
  64577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64578. $ctx1.sendIdx["collection"]=4;
  64579. //>>excludeEnd("ctx");
  64580. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  64581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64582. $ctx1.sendIdx["beginsWith:"]=3;
  64583. //>>excludeEnd("ctx");
  64584. self._assert_($6);
  64585. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  64586. return self;
  64587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64588. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)});
  64589. //>>excludeEnd("ctx");
  64590. },
  64591. //>>excludeStart("ide", pragmas.excludeIdeData);
  64592. args: [],
  64593. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  64594. referencedClasses: [],
  64595. //>>excludeEnd("ide");
  64596. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  64597. }),
  64598. globals.SequenceableCollectionTest);
  64599. smalltalk.addMethod(
  64600. smalltalk.method({
  64601. selector: "testEndsWith",
  64602. protocol: 'tests',
  64603. fn: function (){
  64604. var self=this;
  64605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64606. return smalltalk.withContext(function($ctx1) {
  64607. //>>excludeEnd("ctx");
  64608. var $2,$1,$4,$5,$3,$7,$6;
  64609. $2=self._collection();
  64610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64611. $ctx1.sendIdx["collection"]=1;
  64612. //>>excludeEnd("ctx");
  64613. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  64614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64615. $ctx1.sendIdx["endsWith:"]=1;
  64616. //>>excludeEnd("ctx");
  64617. self._assert_($1);
  64618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64619. $ctx1.sendIdx["assert:"]=1;
  64620. //>>excludeEnd("ctx");
  64621. $4=self._collection();
  64622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64623. $ctx1.sendIdx["collection"]=2;
  64624. //>>excludeEnd("ctx");
  64625. $5=self._collection();
  64626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64627. $ctx1.sendIdx["collection"]=3;
  64628. //>>excludeEnd("ctx");
  64629. $3=_st($4)._endsWith_($5);
  64630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64631. $ctx1.sendIdx["endsWith:"]=2;
  64632. //>>excludeEnd("ctx");
  64633. self._assert_($3);
  64634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64635. $ctx1.sendIdx["assert:"]=2;
  64636. //>>excludeEnd("ctx");
  64637. $7=self._collection();
  64638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64639. $ctx1.sendIdx["collection"]=4;
  64640. //>>excludeEnd("ctx");
  64641. $6=_st($7)._endsWith_(self._collectionLastTwo());
  64642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64643. $ctx1.sendIdx["endsWith:"]=3;
  64644. //>>excludeEnd("ctx");
  64645. self._assert_($6);
  64646. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  64647. return self;
  64648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64649. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)});
  64650. //>>excludeEnd("ctx");
  64651. },
  64652. //>>excludeStart("ide", pragmas.excludeIdeData);
  64653. args: [],
  64654. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  64655. referencedClasses: [],
  64656. //>>excludeEnd("ide");
  64657. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  64658. }),
  64659. globals.SequenceableCollectionTest);
  64660. smalltalk.addMethod(
  64661. smalltalk.method({
  64662. selector: "testFirst",
  64663. protocol: 'tests',
  64664. fn: function (){
  64665. var self=this;
  64666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64667. return smalltalk.withContext(function($ctx1) {
  64668. //>>excludeEnd("ctx");
  64669. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  64670. return self;
  64671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64672. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)});
  64673. //>>excludeEnd("ctx");
  64674. },
  64675. //>>excludeStart("ide", pragmas.excludeIdeData);
  64676. args: [],
  64677. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  64678. referencedClasses: [],
  64679. //>>excludeEnd("ide");
  64680. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  64681. }),
  64682. globals.SequenceableCollectionTest);
  64683. smalltalk.addMethod(
  64684. smalltalk.method({
  64685. selector: "testFirstN",
  64686. protocol: 'tests',
  64687. fn: function (){
  64688. var self=this;
  64689. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  64690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64691. return smalltalk.withContext(function($ctx1) {
  64692. //>>excludeEnd("ctx");
  64693. var $2,$1,$4,$3,$6,$5,$7;
  64694. $2=self._collection();
  64695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64696. $ctx1.sendIdx["collection"]=1;
  64697. //>>excludeEnd("ctx");
  64698. $1=_st($2)._first_((2));
  64699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64700. $ctx1.sendIdx["first:"]=1;
  64701. //>>excludeEnd("ctx");
  64702. self._assert_equals_($1,self._collectionFirstTwo());
  64703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64704. $ctx1.sendIdx["assert:equals:"]=1;
  64705. //>>excludeEnd("ctx");
  64706. $4=self._collection();
  64707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64708. $ctx1.sendIdx["collection"]=2;
  64709. //>>excludeEnd("ctx");
  64710. $3=_st($4)._first_((0));
  64711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64712. $ctx1.sendIdx["first:"]=2;
  64713. //>>excludeEnd("ctx");
  64714. self._assert_equals_($3,_st(self._collectionClass())._new());
  64715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64716. $ctx1.sendIdx["assert:equals:"]=2;
  64717. //>>excludeEnd("ctx");
  64718. $6=self._collection();
  64719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64720. $ctx1.sendIdx["collection"]=3;
  64721. //>>excludeEnd("ctx");
  64722. $5=_st($6)._first_(self._collectionSize());
  64723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64724. $ctx1.sendIdx["first:"]=3;
  64725. //>>excludeEnd("ctx");
  64726. $7=self._collection();
  64727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64728. $ctx1.sendIdx["collection"]=4;
  64729. //>>excludeEnd("ctx");
  64730. self._assert_equals_($5,$7);
  64731. self._should_raise_((function(){
  64732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64733. return smalltalk.withContext(function($ctx2) {
  64734. //>>excludeEnd("ctx");
  64735. return _st(self._collection())._first_((33));
  64736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64738. //>>excludeEnd("ctx");
  64739. }),$Error());
  64740. return self;
  64741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64742. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)});
  64743. //>>excludeEnd("ctx");
  64744. },
  64745. //>>excludeStart("ide", pragmas.excludeIdeData);
  64746. args: [],
  64747. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  64748. referencedClasses: ["Error"],
  64749. //>>excludeEnd("ide");
  64750. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  64751. }),
  64752. globals.SequenceableCollectionTest);
  64753. smalltalk.addMethod(
  64754. smalltalk.method({
  64755. selector: "testFourth",
  64756. protocol: 'tests',
  64757. fn: function (){
  64758. var self=this;
  64759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64760. return smalltalk.withContext(function($ctx1) {
  64761. //>>excludeEnd("ctx");
  64762. var $2,$1;
  64763. $2=self._collection();
  64764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64765. $ctx1.sendIdx["collection"]=1;
  64766. //>>excludeEnd("ctx");
  64767. $1=_st($2)._fourth();
  64768. self._assert_equals_($1,_st(self._collection())._at_((4)));
  64769. return self;
  64770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64771. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)});
  64772. //>>excludeEnd("ctx");
  64773. },
  64774. //>>excludeStart("ide", pragmas.excludeIdeData);
  64775. args: [],
  64776. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  64777. referencedClasses: [],
  64778. //>>excludeEnd("ide");
  64779. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  64780. }),
  64781. globals.SequenceableCollectionTest);
  64782. smalltalk.addMethod(
  64783. smalltalk.method({
  64784. selector: "testIndexOfStartingAt",
  64785. protocol: 'tests',
  64786. fn: function (){
  64787. var self=this;
  64788. var jsNull;
  64789. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  64790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64791. return smalltalk.withContext(function($ctx1) {
  64792. //>>excludeEnd("ctx");
  64793. var $2,$1,$4,$3;
  64794. jsNull=_st($JSON())._parse_("null");
  64795. self._samplesDo_((function(index,value){
  64796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64797. return smalltalk.withContext(function($ctx2) {
  64798. //>>excludeEnd("ctx");
  64799. $2=self._collection();
  64800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64801. $ctx2.sendIdx["collection"]=1;
  64802. //>>excludeEnd("ctx");
  64803. $1=_st($2)._indexOf_startingAt_(value,(1));
  64804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64805. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  64806. //>>excludeEnd("ctx");
  64807. self._assert_equals_($1,index);
  64808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64809. $ctx2.sendIdx["assert:equals:"]=1;
  64810. //>>excludeEnd("ctx");
  64811. $4=self._collection();
  64812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64813. $ctx2.sendIdx["collection"]=2;
  64814. //>>excludeEnd("ctx");
  64815. $3=_st($4)._indexOf_startingAt_(value,index);
  64816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64817. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  64818. //>>excludeEnd("ctx");
  64819. self._assert_equals_($3,index);
  64820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64821. $ctx2.sendIdx["assert:equals:"]=2;
  64822. //>>excludeEnd("ctx");
  64823. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  64824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64825. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  64826. //>>excludeEnd("ctx");
  64827. }));
  64828. return self;
  64829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64830. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)});
  64831. //>>excludeEnd("ctx");
  64832. },
  64833. //>>excludeStart("ide", pragmas.excludeIdeData);
  64834. args: [],
  64835. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  64836. referencedClasses: ["JSON"],
  64837. //>>excludeEnd("ide");
  64838. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  64839. }),
  64840. globals.SequenceableCollectionTest);
  64841. smalltalk.addMethod(
  64842. smalltalk.method({
  64843. selector: "testIndexOfStartingAtWithNull",
  64844. protocol: 'tests',
  64845. fn: function (){
  64846. var self=this;
  64847. var jsNull;
  64848. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  64849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64850. return smalltalk.withContext(function($ctx1) {
  64851. //>>excludeEnd("ctx");
  64852. var $1,$2;
  64853. jsNull=_st($JSON())._parse_("null");
  64854. self._samplesDo_((function(index,value){
  64855. var collection;
  64856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64857. return smalltalk.withContext(function($ctx2) {
  64858. //>>excludeEnd("ctx");
  64859. collection=self._collection();
  64860. collection;
  64861. _st(collection)._at_put_(index,jsNull);
  64862. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  64863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64864. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  64865. //>>excludeEnd("ctx");
  64866. self._assert_equals_($1,index);
  64867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64868. $ctx2.sendIdx["assert:equals:"]=1;
  64869. //>>excludeEnd("ctx");
  64870. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  64871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64872. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  64873. //>>excludeEnd("ctx");
  64874. self._assert_equals_($2,index);
  64875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64876. $ctx2.sendIdx["assert:equals:"]=2;
  64877. //>>excludeEnd("ctx");
  64878. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  64879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64880. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  64881. //>>excludeEnd("ctx");
  64882. }));
  64883. return self;
  64884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64885. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)});
  64886. //>>excludeEnd("ctx");
  64887. },
  64888. //>>excludeStart("ide", pragmas.excludeIdeData);
  64889. args: [],
  64890. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  64891. referencedClasses: ["JSON"],
  64892. //>>excludeEnd("ide");
  64893. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  64894. }),
  64895. globals.SequenceableCollectionTest);
  64896. smalltalk.addMethod(
  64897. smalltalk.method({
  64898. selector: "testLast",
  64899. protocol: 'tests',
  64900. fn: function (){
  64901. var self=this;
  64902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64903. return smalltalk.withContext(function($ctx1) {
  64904. //>>excludeEnd("ctx");
  64905. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  64906. return self;
  64907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64908. }, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)});
  64909. //>>excludeEnd("ctx");
  64910. },
  64911. //>>excludeStart("ide", pragmas.excludeIdeData);
  64912. args: [],
  64913. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  64914. referencedClasses: [],
  64915. //>>excludeEnd("ide");
  64916. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  64917. }),
  64918. globals.SequenceableCollectionTest);
  64919. smalltalk.addMethod(
  64920. smalltalk.method({
  64921. selector: "testLastN",
  64922. protocol: 'tests',
  64923. fn: function (){
  64924. var self=this;
  64925. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  64926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64927. return smalltalk.withContext(function($ctx1) {
  64928. //>>excludeEnd("ctx");
  64929. var $2,$1,$4,$3,$6,$5,$7;
  64930. $2=self._collection();
  64931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64932. $ctx1.sendIdx["collection"]=1;
  64933. //>>excludeEnd("ctx");
  64934. $1=_st($2)._last_((2));
  64935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64936. $ctx1.sendIdx["last:"]=1;
  64937. //>>excludeEnd("ctx");
  64938. self._assert_equals_($1,self._collectionLastTwo());
  64939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64940. $ctx1.sendIdx["assert:equals:"]=1;
  64941. //>>excludeEnd("ctx");
  64942. $4=self._collection();
  64943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64944. $ctx1.sendIdx["collection"]=2;
  64945. //>>excludeEnd("ctx");
  64946. $3=_st($4)._last_((0));
  64947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64948. $ctx1.sendIdx["last:"]=2;
  64949. //>>excludeEnd("ctx");
  64950. self._assert_equals_($3,_st(self._collectionClass())._new());
  64951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64952. $ctx1.sendIdx["assert:equals:"]=2;
  64953. //>>excludeEnd("ctx");
  64954. $6=self._collection();
  64955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64956. $ctx1.sendIdx["collection"]=3;
  64957. //>>excludeEnd("ctx");
  64958. $5=_st($6)._last_(self._collectionSize());
  64959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64960. $ctx1.sendIdx["last:"]=3;
  64961. //>>excludeEnd("ctx");
  64962. $7=self._collection();
  64963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64964. $ctx1.sendIdx["collection"]=4;
  64965. //>>excludeEnd("ctx");
  64966. self._assert_equals_($5,$7);
  64967. self._should_raise_((function(){
  64968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64969. return smalltalk.withContext(function($ctx2) {
  64970. //>>excludeEnd("ctx");
  64971. return _st(self._collection())._last_((33));
  64972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64974. //>>excludeEnd("ctx");
  64975. }),$Error());
  64976. return self;
  64977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64978. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)});
  64979. //>>excludeEnd("ctx");
  64980. },
  64981. //>>excludeStart("ide", pragmas.excludeIdeData);
  64982. args: [],
  64983. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  64984. referencedClasses: ["Error"],
  64985. //>>excludeEnd("ide");
  64986. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  64987. }),
  64988. globals.SequenceableCollectionTest);
  64989. smalltalk.addMethod(
  64990. smalltalk.method({
  64991. selector: "testSecond",
  64992. protocol: 'tests',
  64993. fn: function (){
  64994. var self=this;
  64995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64996. return smalltalk.withContext(function($ctx1) {
  64997. //>>excludeEnd("ctx");
  64998. var $2,$1;
  64999. $2=self._collection();
  65000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65001. $ctx1.sendIdx["collection"]=1;
  65002. //>>excludeEnd("ctx");
  65003. $1=_st($2)._second();
  65004. self._assert_equals_($1,_st(self._collection())._at_((2)));
  65005. return self;
  65006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65007. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)});
  65008. //>>excludeEnd("ctx");
  65009. },
  65010. //>>excludeStart("ide", pragmas.excludeIdeData);
  65011. args: [],
  65012. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  65013. referencedClasses: [],
  65014. //>>excludeEnd("ide");
  65015. messageSends: ["assert:equals:", "second", "collection", "at:"]
  65016. }),
  65017. globals.SequenceableCollectionTest);
  65018. smalltalk.addMethod(
  65019. smalltalk.method({
  65020. selector: "testThird",
  65021. protocol: 'tests',
  65022. fn: function (){
  65023. var self=this;
  65024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65025. return smalltalk.withContext(function($ctx1) {
  65026. //>>excludeEnd("ctx");
  65027. var $2,$1;
  65028. $2=self._collection();
  65029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65030. $ctx1.sendIdx["collection"]=1;
  65031. //>>excludeEnd("ctx");
  65032. $1=_st($2)._third();
  65033. self._assert_equals_($1,_st(self._collection())._at_((3)));
  65034. return self;
  65035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65036. }, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)});
  65037. //>>excludeEnd("ctx");
  65038. },
  65039. //>>excludeStart("ide", pragmas.excludeIdeData);
  65040. args: [],
  65041. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  65042. referencedClasses: [],
  65043. //>>excludeEnd("ide");
  65044. messageSends: ["assert:equals:", "third", "collection", "at:"]
  65045. }),
  65046. globals.SequenceableCollectionTest);
  65047. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  65048. smalltalk.addMethod(
  65049. smalltalk.method({
  65050. selector: "collection",
  65051. protocol: 'fixture',
  65052. fn: function (){
  65053. var self=this;
  65054. var $1;
  65055. $1=[(1), (2), (3), (-4)];
  65056. return $1;
  65057. },
  65058. //>>excludeStart("ide", pragmas.excludeIdeData);
  65059. args: [],
  65060. source: "collection\x0a\x09^ #(1 2 3 -4)",
  65061. referencedClasses: [],
  65062. //>>excludeEnd("ide");
  65063. messageSends: []
  65064. }),
  65065. globals.ArrayTest);
  65066. smalltalk.addMethod(
  65067. smalltalk.method({
  65068. selector: "collectionFirst",
  65069. protocol: 'fixture',
  65070. fn: function (){
  65071. var self=this;
  65072. return (1);
  65073. },
  65074. //>>excludeStart("ide", pragmas.excludeIdeData);
  65075. args: [],
  65076. source: "collectionFirst\x0a\x09^ 1",
  65077. referencedClasses: [],
  65078. //>>excludeEnd("ide");
  65079. messageSends: []
  65080. }),
  65081. globals.ArrayTest);
  65082. smalltalk.addMethod(
  65083. smalltalk.method({
  65084. selector: "collectionFirstTwo",
  65085. protocol: 'fixture',
  65086. fn: function (){
  65087. var self=this;
  65088. var $1;
  65089. $1=[(1), (2)];
  65090. return $1;
  65091. },
  65092. //>>excludeStart("ide", pragmas.excludeIdeData);
  65093. args: [],
  65094. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  65095. referencedClasses: [],
  65096. //>>excludeEnd("ide");
  65097. messageSends: []
  65098. }),
  65099. globals.ArrayTest);
  65100. smalltalk.addMethod(
  65101. smalltalk.method({
  65102. selector: "collectionLast",
  65103. protocol: 'fixture',
  65104. fn: function (){
  65105. var self=this;
  65106. return (-4);
  65107. },
  65108. //>>excludeStart("ide", pragmas.excludeIdeData);
  65109. args: [],
  65110. source: "collectionLast\x0a\x09^ -4",
  65111. referencedClasses: [],
  65112. //>>excludeEnd("ide");
  65113. messageSends: []
  65114. }),
  65115. globals.ArrayTest);
  65116. smalltalk.addMethod(
  65117. smalltalk.method({
  65118. selector: "collectionLastTwo",
  65119. protocol: 'fixture',
  65120. fn: function (){
  65121. var self=this;
  65122. var $1;
  65123. $1=[(3), (-4)];
  65124. return $1;
  65125. },
  65126. //>>excludeStart("ide", pragmas.excludeIdeData);
  65127. args: [],
  65128. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  65129. referencedClasses: [],
  65130. //>>excludeEnd("ide");
  65131. messageSends: []
  65132. }),
  65133. globals.ArrayTest);
  65134. smalltalk.addMethod(
  65135. smalltalk.method({
  65136. selector: "collectionOfPrintStrings",
  65137. protocol: 'fixture',
  65138. fn: function (){
  65139. var self=this;
  65140. var $1;
  65141. $1=["1", "2", "3", "-4"];
  65142. return $1;
  65143. },
  65144. //>>excludeStart("ide", pragmas.excludeIdeData);
  65145. args: [],
  65146. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  65147. referencedClasses: [],
  65148. //>>excludeEnd("ide");
  65149. messageSends: []
  65150. }),
  65151. globals.ArrayTest);
  65152. smalltalk.addMethod(
  65153. smalltalk.method({
  65154. selector: "collectionSize",
  65155. protocol: 'fixture',
  65156. fn: function (){
  65157. var self=this;
  65158. return (4);
  65159. },
  65160. //>>excludeStart("ide", pragmas.excludeIdeData);
  65161. args: [],
  65162. source: "collectionSize\x0a\x09^ 4",
  65163. referencedClasses: [],
  65164. //>>excludeEnd("ide");
  65165. messageSends: []
  65166. }),
  65167. globals.ArrayTest);
  65168. smalltalk.addMethod(
  65169. smalltalk.method({
  65170. selector: "collectionWithDuplicates",
  65171. protocol: 'fixture',
  65172. fn: function (){
  65173. var self=this;
  65174. var $1;
  65175. $1=["a", "b", "c", (1), (2), (1), "a"];
  65176. return $1;
  65177. },
  65178. //>>excludeStart("ide", pragmas.excludeIdeData);
  65179. args: [],
  65180. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  65181. referencedClasses: [],
  65182. //>>excludeEnd("ide");
  65183. messageSends: []
  65184. }),
  65185. globals.ArrayTest);
  65186. smalltalk.addMethod(
  65187. smalltalk.method({
  65188. selector: "collectionWithNewValue",
  65189. protocol: 'fixture',
  65190. fn: function (){
  65191. var self=this;
  65192. var $1;
  65193. $1=[(1), (2), (3), (-4), "N"];
  65194. return $1;
  65195. },
  65196. //>>excludeStart("ide", pragmas.excludeIdeData);
  65197. args: [],
  65198. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  65199. referencedClasses: [],
  65200. //>>excludeEnd("ide");
  65201. messageSends: []
  65202. }),
  65203. globals.ArrayTest);
  65204. smalltalk.addMethod(
  65205. smalltalk.method({
  65206. selector: "sampleNewIndex",
  65207. protocol: 'fixture',
  65208. fn: function (){
  65209. var self=this;
  65210. return (5);
  65211. },
  65212. //>>excludeStart("ide", pragmas.excludeIdeData);
  65213. args: [],
  65214. source: "sampleNewIndex\x0a\x09^ 5",
  65215. referencedClasses: [],
  65216. //>>excludeEnd("ide");
  65217. messageSends: []
  65218. }),
  65219. globals.ArrayTest);
  65220. smalltalk.addMethod(
  65221. smalltalk.method({
  65222. selector: "samplesDo:",
  65223. protocol: 'fixture',
  65224. fn: function (aBlock){
  65225. var self=this;
  65226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65227. return smalltalk.withContext(function($ctx1) {
  65228. //>>excludeEnd("ctx");
  65229. (
  65230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65231. $ctx1.supercall = true,
  65232. //>>excludeEnd("ctx");
  65233. globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  65234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65235. $ctx1.supercall = false;
  65236. //>>excludeEnd("ctx");;
  65237. _st(aBlock)._value_value_((3),(3));
  65238. return self;
  65239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65240. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)});
  65241. //>>excludeEnd("ctx");
  65242. },
  65243. //>>excludeStart("ide", pragmas.excludeIdeData);
  65244. args: ["aBlock"],
  65245. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  65246. referencedClasses: [],
  65247. //>>excludeEnd("ide");
  65248. messageSends: ["samplesDo:", "value:value:"]
  65249. }),
  65250. globals.ArrayTest);
  65251. smalltalk.addMethod(
  65252. smalltalk.method({
  65253. selector: "testAdd",
  65254. protocol: 'tests',
  65255. fn: function (){
  65256. var self=this;
  65257. var array;
  65258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65259. return smalltalk.withContext(function($ctx1) {
  65260. //>>excludeEnd("ctx");
  65261. array=self._collection();
  65262. _st(array)._add_((6));
  65263. self._assert_equals_(_st(array)._last(),(6));
  65264. return self;
  65265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65266. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)});
  65267. //>>excludeEnd("ctx");
  65268. },
  65269. //>>excludeStart("ide", pragmas.excludeIdeData);
  65270. args: [],
  65271. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  65272. referencedClasses: [],
  65273. //>>excludeEnd("ide");
  65274. messageSends: ["collection", "add:", "assert:equals:", "last"]
  65275. }),
  65276. globals.ArrayTest);
  65277. smalltalk.addMethod(
  65278. smalltalk.method({
  65279. selector: "testAddFirst",
  65280. protocol: 'tests',
  65281. fn: function (){
  65282. var self=this;
  65283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65284. return smalltalk.withContext(function($ctx1) {
  65285. //>>excludeEnd("ctx");
  65286. var $1,$2;
  65287. $1=self._collection();
  65288. _st($1)._addFirst_((0));
  65289. $2=_st($1)._yourself();
  65290. self._assert_equals_(_st($2)._first(),(0));
  65291. return self;
  65292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65293. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)});
  65294. //>>excludeEnd("ctx");
  65295. },
  65296. //>>excludeStart("ide", pragmas.excludeIdeData);
  65297. args: [],
  65298. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  65299. referencedClasses: [],
  65300. //>>excludeEnd("ide");
  65301. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  65302. }),
  65303. globals.ArrayTest);
  65304. smalltalk.addMethod(
  65305. smalltalk.method({
  65306. selector: "testPrintString",
  65307. protocol: 'tests',
  65308. fn: function (){
  65309. var self=this;
  65310. var array;
  65311. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  65312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65313. return smalltalk.withContext(function($ctx1) {
  65314. //>>excludeEnd("ctx");
  65315. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  65316. array=_st($Array())._new();
  65317. $1=_st(array)._printString();
  65318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65319. $ctx1.sendIdx["printString"]=1;
  65320. //>>excludeEnd("ctx");
  65321. self._assert_equals_($1,"an Array ()");
  65322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65323. $ctx1.sendIdx["assert:equals:"]=1;
  65324. //>>excludeEnd("ctx");
  65325. $2=array;
  65326. _st($2)._add_((1));
  65327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65328. $ctx1.sendIdx["add:"]=1;
  65329. //>>excludeEnd("ctx");
  65330. $3=_st($2)._add_((3));
  65331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65332. $ctx1.sendIdx["add:"]=2;
  65333. //>>excludeEnd("ctx");
  65334. $4=_st(array)._printString();
  65335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65336. $ctx1.sendIdx["printString"]=2;
  65337. //>>excludeEnd("ctx");
  65338. self._assert_equals_($4,"an Array (1 3)");
  65339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65340. $ctx1.sendIdx["assert:equals:"]=2;
  65341. //>>excludeEnd("ctx");
  65342. _st(array)._add_("foo");
  65343. $5=_st(array)._printString();
  65344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65345. $ctx1.sendIdx["printString"]=3;
  65346. //>>excludeEnd("ctx");
  65347. self._assert_equals_($5,"an Array (1 3 'foo')");
  65348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65349. $ctx1.sendIdx["assert:equals:"]=3;
  65350. //>>excludeEnd("ctx");
  65351. $6=array;
  65352. _st($6)._remove_((1));
  65353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65354. $ctx1.sendIdx["remove:"]=1;
  65355. //>>excludeEnd("ctx");
  65356. $7=_st($6)._remove_((3));
  65357. $8=_st(array)._printString();
  65358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65359. $ctx1.sendIdx["printString"]=4;
  65360. //>>excludeEnd("ctx");
  65361. self._assert_equals_($8,"an Array ('foo')");
  65362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65363. $ctx1.sendIdx["assert:equals:"]=4;
  65364. //>>excludeEnd("ctx");
  65365. _st(array)._addLast_((3));
  65366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65367. $ctx1.sendIdx["addLast:"]=1;
  65368. //>>excludeEnd("ctx");
  65369. $9=_st(array)._printString();
  65370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65371. $ctx1.sendIdx["printString"]=5;
  65372. //>>excludeEnd("ctx");
  65373. self._assert_equals_($9,"an Array ('foo' 3)");
  65374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65375. $ctx1.sendIdx["assert:equals:"]=5;
  65376. //>>excludeEnd("ctx");
  65377. _st(array)._addLast_((3));
  65378. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  65379. return self;
  65380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65381. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)});
  65382. //>>excludeEnd("ctx");
  65383. },
  65384. //>>excludeStart("ide", pragmas.excludeIdeData);
  65385. args: [],
  65386. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.",
  65387. referencedClasses: ["Array"],
  65388. //>>excludeEnd("ide");
  65389. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  65390. }),
  65391. globals.ArrayTest);
  65392. smalltalk.addMethod(
  65393. smalltalk.method({
  65394. selector: "testRemove",
  65395. protocol: 'tests',
  65396. fn: function (){
  65397. var self=this;
  65398. var array;
  65399. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  65400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65401. return smalltalk.withContext(function($ctx1) {
  65402. //>>excludeEnd("ctx");
  65403. array=[(1), (2), (3), (4), (5)];
  65404. _st(array)._remove_((3));
  65405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65406. $ctx1.sendIdx["remove:"]=1;
  65407. //>>excludeEnd("ctx");
  65408. self._assert_equals_(array,[(1), (2), (4), (5)]);
  65409. self._should_raise_((function(){
  65410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65411. return smalltalk.withContext(function($ctx2) {
  65412. //>>excludeEnd("ctx");
  65413. return _st(array)._remove_((3));
  65414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65416. //>>excludeEnd("ctx");
  65417. }),$Error());
  65418. return self;
  65419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65420. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)});
  65421. //>>excludeEnd("ctx");
  65422. },
  65423. //>>excludeStart("ide", pragmas.excludeIdeData);
  65424. args: [],
  65425. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  65426. referencedClasses: ["Error"],
  65427. //>>excludeEnd("ide");
  65428. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  65429. }),
  65430. globals.ArrayTest);
  65431. smalltalk.addMethod(
  65432. smalltalk.method({
  65433. selector: "testRemoveFromTo",
  65434. protocol: 'tests',
  65435. fn: function (){
  65436. var self=this;
  65437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65438. return smalltalk.withContext(function($ctx1) {
  65439. //>>excludeEnd("ctx");
  65440. var $1,$2;
  65441. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  65442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65443. $ctx1.sendIdx["removeFrom:to:"]=1;
  65444. //>>excludeEnd("ctx");
  65445. self._assert_equals_($1,[(4)]);
  65446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65447. $ctx1.sendIdx["assert:equals:"]=1;
  65448. //>>excludeEnd("ctx");
  65449. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  65450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65451. $ctx1.sendIdx["removeFrom:to:"]=2;
  65452. //>>excludeEnd("ctx");
  65453. self._assert_equals_($2,[(1), (4)]);
  65454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65455. $ctx1.sendIdx["assert:equals:"]=2;
  65456. //>>excludeEnd("ctx");
  65457. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  65458. return self;
  65459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65460. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)});
  65461. //>>excludeEnd("ctx");
  65462. },
  65463. //>>excludeStart("ide", pragmas.excludeIdeData);
  65464. args: [],
  65465. source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)",
  65466. referencedClasses: [],
  65467. //>>excludeEnd("ide");
  65468. messageSends: ["assert:equals:", "removeFrom:to:"]
  65469. }),
  65470. globals.ArrayTest);
  65471. smalltalk.addMethod(
  65472. smalltalk.method({
  65473. selector: "testRemoveIndex",
  65474. protocol: 'tests',
  65475. fn: function (){
  65476. var self=this;
  65477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65478. return smalltalk.withContext(function($ctx1) {
  65479. //>>excludeEnd("ctx");
  65480. var $1,$2;
  65481. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  65482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65483. $ctx1.sendIdx["removeIndex:"]=1;
  65484. //>>excludeEnd("ctx");
  65485. self._assert_equals_($1,[(1), (3), (4)]);
  65486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65487. $ctx1.sendIdx["assert:equals:"]=1;
  65488. //>>excludeEnd("ctx");
  65489. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  65490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65491. $ctx1.sendIdx["removeIndex:"]=2;
  65492. //>>excludeEnd("ctx");
  65493. self._assert_equals_($2,[(2), (3), (4)]);
  65494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65495. $ctx1.sendIdx["assert:equals:"]=2;
  65496. //>>excludeEnd("ctx");
  65497. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  65498. return self;
  65499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65500. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)});
  65501. //>>excludeEnd("ctx");
  65502. },
  65503. //>>excludeStart("ide", pragmas.excludeIdeData);
  65504. args: [],
  65505. source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()",
  65506. referencedClasses: [],
  65507. //>>excludeEnd("ide");
  65508. messageSends: ["assert:equals:", "removeIndex:"]
  65509. }),
  65510. globals.ArrayTest);
  65511. smalltalk.addMethod(
  65512. smalltalk.method({
  65513. selector: "testRemoveLast",
  65514. protocol: 'tests',
  65515. fn: function (){
  65516. var self=this;
  65517. var array;
  65518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65519. return smalltalk.withContext(function($ctx1) {
  65520. //>>excludeEnd("ctx");
  65521. array=[(1), (2)];
  65522. _st(array)._removeLast();
  65523. self._assert_equals_(_st(array)._last(),(1));
  65524. return self;
  65525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65526. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)});
  65527. //>>excludeEnd("ctx");
  65528. },
  65529. //>>excludeStart("ide", pragmas.excludeIdeData);
  65530. args: [],
  65531. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  65532. referencedClasses: [],
  65533. //>>excludeEnd("ide");
  65534. messageSends: ["removeLast", "assert:equals:", "last"]
  65535. }),
  65536. globals.ArrayTest);
  65537. smalltalk.addMethod(
  65538. smalltalk.method({
  65539. selector: "testReversed",
  65540. protocol: 'tests',
  65541. fn: function (){
  65542. var self=this;
  65543. var array;
  65544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65545. return smalltalk.withContext(function($ctx1) {
  65546. //>>excludeEnd("ctx");
  65547. array=[(5), (4), (3), (2), (1)];
  65548. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  65549. return self;
  65550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65551. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)});
  65552. //>>excludeEnd("ctx");
  65553. },
  65554. //>>excludeStart("ide", pragmas.excludeIdeData);
  65555. args: [],
  65556. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  65557. referencedClasses: [],
  65558. //>>excludeEnd("ide");
  65559. messageSends: ["assert:equals:", "reversed"]
  65560. }),
  65561. globals.ArrayTest);
  65562. smalltalk.addMethod(
  65563. smalltalk.method({
  65564. selector: "testSort",
  65565. protocol: 'tests',
  65566. fn: function (){
  65567. var self=this;
  65568. var array;
  65569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65570. return smalltalk.withContext(function($ctx1) {
  65571. //>>excludeEnd("ctx");
  65572. array=[(10), (1), (5)];
  65573. _st(array)._sort();
  65574. self._assert_equals_(array,[(1), (5), (10)]);
  65575. return self;
  65576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65577. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)});
  65578. //>>excludeEnd("ctx");
  65579. },
  65580. //>>excludeStart("ide", pragmas.excludeIdeData);
  65581. args: [],
  65582. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  65583. referencedClasses: [],
  65584. //>>excludeEnd("ide");
  65585. messageSends: ["sort", "assert:equals:"]
  65586. }),
  65587. globals.ArrayTest);
  65588. smalltalk.addMethod(
  65589. smalltalk.method({
  65590. selector: "collectionClass",
  65591. protocol: 'fixture',
  65592. fn: function (){
  65593. var self=this;
  65594. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  65595. return $Array();
  65596. },
  65597. //>>excludeStart("ide", pragmas.excludeIdeData);
  65598. args: [],
  65599. source: "collectionClass\x0a\x09^ Array",
  65600. referencedClasses: ["Array"],
  65601. //>>excludeEnd("ide");
  65602. messageSends: []
  65603. }),
  65604. globals.ArrayTest.klass);
  65605. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  65606. smalltalk.addMethod(
  65607. smalltalk.method({
  65608. selector: "collection",
  65609. protocol: 'fixture',
  65610. fn: function (){
  65611. var self=this;
  65612. return "helLo";
  65613. },
  65614. //>>excludeStart("ide", pragmas.excludeIdeData);
  65615. args: [],
  65616. source: "collection\x0a\x09^ 'helLo'",
  65617. referencedClasses: [],
  65618. //>>excludeEnd("ide");
  65619. messageSends: []
  65620. }),
  65621. globals.StringTest);
  65622. smalltalk.addMethod(
  65623. smalltalk.method({
  65624. selector: "collectionFirst",
  65625. protocol: 'fixture',
  65626. fn: function (){
  65627. var self=this;
  65628. return "h";
  65629. },
  65630. //>>excludeStart("ide", pragmas.excludeIdeData);
  65631. args: [],
  65632. source: "collectionFirst\x0a\x09^ 'h'",
  65633. referencedClasses: [],
  65634. //>>excludeEnd("ide");
  65635. messageSends: []
  65636. }),
  65637. globals.StringTest);
  65638. smalltalk.addMethod(
  65639. smalltalk.method({
  65640. selector: "collectionFirstTwo",
  65641. protocol: 'fixture',
  65642. fn: function (){
  65643. var self=this;
  65644. return "he";
  65645. },
  65646. //>>excludeStart("ide", pragmas.excludeIdeData);
  65647. args: [],
  65648. source: "collectionFirstTwo\x0a\x09^ 'he'",
  65649. referencedClasses: [],
  65650. //>>excludeEnd("ide");
  65651. messageSends: []
  65652. }),
  65653. globals.StringTest);
  65654. smalltalk.addMethod(
  65655. smalltalk.method({
  65656. selector: "collectionLast",
  65657. protocol: 'fixture',
  65658. fn: function (){
  65659. var self=this;
  65660. return "o";
  65661. },
  65662. //>>excludeStart("ide", pragmas.excludeIdeData);
  65663. args: [],
  65664. source: "collectionLast\x0a\x09^ 'o'",
  65665. referencedClasses: [],
  65666. //>>excludeEnd("ide");
  65667. messageSends: []
  65668. }),
  65669. globals.StringTest);
  65670. smalltalk.addMethod(
  65671. smalltalk.method({
  65672. selector: "collectionLastTwo",
  65673. protocol: 'fixture',
  65674. fn: function (){
  65675. var self=this;
  65676. return "Lo";
  65677. },
  65678. //>>excludeStart("ide", pragmas.excludeIdeData);
  65679. args: [],
  65680. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  65681. referencedClasses: [],
  65682. //>>excludeEnd("ide");
  65683. messageSends: []
  65684. }),
  65685. globals.StringTest);
  65686. smalltalk.addMethod(
  65687. smalltalk.method({
  65688. selector: "collectionOfPrintStrings",
  65689. protocol: 'fixture',
  65690. fn: function (){
  65691. var self=this;
  65692. return "'h''e''l''L''o'";
  65693. },
  65694. //>>excludeStart("ide", pragmas.excludeIdeData);
  65695. args: [],
  65696. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  65697. referencedClasses: [],
  65698. //>>excludeEnd("ide");
  65699. messageSends: []
  65700. }),
  65701. globals.StringTest);
  65702. smalltalk.addMethod(
  65703. smalltalk.method({
  65704. selector: "collectionSize",
  65705. protocol: 'fixture',
  65706. fn: function (){
  65707. var self=this;
  65708. return (5);
  65709. },
  65710. //>>excludeStart("ide", pragmas.excludeIdeData);
  65711. args: [],
  65712. source: "collectionSize\x0a\x09^ 5",
  65713. referencedClasses: [],
  65714. //>>excludeEnd("ide");
  65715. messageSends: []
  65716. }),
  65717. globals.StringTest);
  65718. smalltalk.addMethod(
  65719. smalltalk.method({
  65720. selector: "collectionWithDuplicates",
  65721. protocol: 'fixture',
  65722. fn: function (){
  65723. var self=this;
  65724. return "abbaerte";
  65725. },
  65726. //>>excludeStart("ide", pragmas.excludeIdeData);
  65727. args: [],
  65728. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  65729. referencedClasses: [],
  65730. //>>excludeEnd("ide");
  65731. messageSends: []
  65732. }),
  65733. globals.StringTest);
  65734. smalltalk.addMethod(
  65735. smalltalk.method({
  65736. selector: "collectionWithNewValue",
  65737. protocol: 'fixture',
  65738. fn: function (){
  65739. var self=this;
  65740. return "helLoN";
  65741. },
  65742. //>>excludeStart("ide", pragmas.excludeIdeData);
  65743. args: [],
  65744. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  65745. referencedClasses: [],
  65746. //>>excludeEnd("ide");
  65747. messageSends: []
  65748. }),
  65749. globals.StringTest);
  65750. smalltalk.addMethod(
  65751. smalltalk.method({
  65752. selector: "sampleNewValueAsCollection",
  65753. protocol: 'fixture',
  65754. fn: function (){
  65755. var self=this;
  65756. return "N";
  65757. },
  65758. //>>excludeStart("ide", pragmas.excludeIdeData);
  65759. args: [],
  65760. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  65761. referencedClasses: [],
  65762. //>>excludeEnd("ide");
  65763. messageSends: []
  65764. }),
  65765. globals.StringTest);
  65766. smalltalk.addMethod(
  65767. smalltalk.method({
  65768. selector: "samplesDo:",
  65769. protocol: 'fixture',
  65770. fn: function (aBlock){
  65771. var self=this;
  65772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65773. return smalltalk.withContext(function($ctx1) {
  65774. //>>excludeEnd("ctx");
  65775. (
  65776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65777. $ctx1.supercall = true,
  65778. //>>excludeEnd("ctx");
  65779. globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  65780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65781. $ctx1.supercall = false;
  65782. //>>excludeEnd("ctx");;
  65783. _st(aBlock)._value_value_((3),"l");
  65784. return self;
  65785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65786. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)});
  65787. //>>excludeEnd("ctx");
  65788. },
  65789. //>>excludeStart("ide", pragmas.excludeIdeData);
  65790. args: ["aBlock"],
  65791. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  65792. referencedClasses: [],
  65793. //>>excludeEnd("ide");
  65794. messageSends: ["samplesDo:", "value:value:"]
  65795. }),
  65796. globals.StringTest);
  65797. smalltalk.addMethod(
  65798. smalltalk.method({
  65799. selector: "testAddAll",
  65800. protocol: 'tests',
  65801. fn: function (){
  65802. var self=this;
  65803. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  65804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65805. return smalltalk.withContext(function($ctx1) {
  65806. //>>excludeEnd("ctx");
  65807. var $1;
  65808. self._should_raise_((function(){
  65809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65810. return smalltalk.withContext(function($ctx2) {
  65811. //>>excludeEnd("ctx");
  65812. $1=self._collection();
  65813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65814. $ctx2.sendIdx["collection"]=1;
  65815. //>>excludeEnd("ctx");
  65816. return _st($1)._addAll_(self._collection());
  65817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65819. //>>excludeEnd("ctx");
  65820. }),$Error());
  65821. return self;
  65822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65823. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)});
  65824. //>>excludeEnd("ctx");
  65825. },
  65826. //>>excludeStart("ide", pragmas.excludeIdeData);
  65827. args: [],
  65828. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  65829. referencedClasses: ["Error"],
  65830. //>>excludeEnd("ide");
  65831. messageSends: ["should:raise:", "addAll:", "collection"]
  65832. }),
  65833. globals.StringTest);
  65834. smalltalk.addMethod(
  65835. smalltalk.method({
  65836. selector: "testAddRemove",
  65837. protocol: 'tests',
  65838. fn: function (){
  65839. var self=this;
  65840. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  65841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65842. return smalltalk.withContext(function($ctx1) {
  65843. //>>excludeEnd("ctx");
  65844. self._should_raise_((function(){
  65845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65846. return smalltalk.withContext(function($ctx2) {
  65847. //>>excludeEnd("ctx");
  65848. return "hello"._add_("a");
  65849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65851. //>>excludeEnd("ctx");
  65852. }),$Error());
  65853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65854. $ctx1.sendIdx["should:raise:"]=1;
  65855. //>>excludeEnd("ctx");
  65856. self._should_raise_((function(){
  65857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65858. return smalltalk.withContext(function($ctx2) {
  65859. //>>excludeEnd("ctx");
  65860. return "hello"._remove_("h");
  65861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65863. //>>excludeEnd("ctx");
  65864. }),$Error());
  65865. return self;
  65866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65867. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)});
  65868. //>>excludeEnd("ctx");
  65869. },
  65870. //>>excludeStart("ide", pragmas.excludeIdeData);
  65871. args: [],
  65872. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  65873. referencedClasses: ["Error"],
  65874. //>>excludeEnd("ide");
  65875. messageSends: ["should:raise:", "add:", "remove:"]
  65876. }),
  65877. globals.StringTest);
  65878. smalltalk.addMethod(
  65879. smalltalk.method({
  65880. selector: "testAsArray",
  65881. protocol: 'tests',
  65882. fn: function (){
  65883. var self=this;
  65884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65885. return smalltalk.withContext(function($ctx1) {
  65886. //>>excludeEnd("ctx");
  65887. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  65888. return self;
  65889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65890. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)});
  65891. //>>excludeEnd("ctx");
  65892. },
  65893. //>>excludeStart("ide", pragmas.excludeIdeData);
  65894. args: [],
  65895. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  65896. referencedClasses: [],
  65897. //>>excludeEnd("ide");
  65898. messageSends: ["assert:equals:", "asArray"]
  65899. }),
  65900. globals.StringTest);
  65901. smalltalk.addMethod(
  65902. smalltalk.method({
  65903. selector: "testAsLowerCase",
  65904. protocol: 'tests',
  65905. fn: function (){
  65906. var self=this;
  65907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65908. return smalltalk.withContext(function($ctx1) {
  65909. //>>excludeEnd("ctx");
  65910. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  65911. return self;
  65912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65913. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)});
  65914. //>>excludeEnd("ctx");
  65915. },
  65916. //>>excludeStart("ide", pragmas.excludeIdeData);
  65917. args: [],
  65918. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  65919. referencedClasses: [],
  65920. //>>excludeEnd("ide");
  65921. messageSends: ["assert:equals:", "asLowercase"]
  65922. }),
  65923. globals.StringTest);
  65924. smalltalk.addMethod(
  65925. smalltalk.method({
  65926. selector: "testAsNumber",
  65927. protocol: 'tests',
  65928. fn: function (){
  65929. var self=this;
  65930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65931. return smalltalk.withContext(function($ctx1) {
  65932. //>>excludeEnd("ctx");
  65933. var $1,$2;
  65934. $1="3"._asNumber();
  65935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65936. $ctx1.sendIdx["asNumber"]=1;
  65937. //>>excludeEnd("ctx");
  65938. self._assert_equals_($1,(3));
  65939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65940. $ctx1.sendIdx["assert:equals:"]=1;
  65941. //>>excludeEnd("ctx");
  65942. $2="-3"._asNumber();
  65943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65944. $ctx1.sendIdx["asNumber"]=2;
  65945. //>>excludeEnd("ctx");
  65946. self._assert_equals_($2,(-3));
  65947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65948. $ctx1.sendIdx["assert:equals:"]=2;
  65949. //>>excludeEnd("ctx");
  65950. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  65951. return self;
  65952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65953. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)});
  65954. //>>excludeEnd("ctx");
  65955. },
  65956. //>>excludeStart("ide", pragmas.excludeIdeData);
  65957. args: [],
  65958. source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.",
  65959. referencedClasses: [],
  65960. //>>excludeEnd("ide");
  65961. messageSends: ["assert:equals:", "asNumber"]
  65962. }),
  65963. globals.StringTest);
  65964. smalltalk.addMethod(
  65965. smalltalk.method({
  65966. selector: "testAsUpperCase",
  65967. protocol: 'tests',
  65968. fn: function (){
  65969. var self=this;
  65970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65971. return smalltalk.withContext(function($ctx1) {
  65972. //>>excludeEnd("ctx");
  65973. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  65974. return self;
  65975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65976. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)});
  65977. //>>excludeEnd("ctx");
  65978. },
  65979. //>>excludeStart("ide", pragmas.excludeIdeData);
  65980. args: [],
  65981. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  65982. referencedClasses: [],
  65983. //>>excludeEnd("ide");
  65984. messageSends: ["assert:equals:", "asUppercase"]
  65985. }),
  65986. globals.StringTest);
  65987. smalltalk.addMethod(
  65988. smalltalk.method({
  65989. selector: "testAsciiValue",
  65990. protocol: 'tests',
  65991. fn: function (){
  65992. var self=this;
  65993. var characterA,characterU;
  65994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65995. return smalltalk.withContext(function($ctx1) {
  65996. //>>excludeEnd("ctx");
  65997. var $1;
  65998. characterA="A";
  65999. characterU="U";
  66000. $1=_st(characterA)._asciiValue();
  66001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66002. $ctx1.sendIdx["asciiValue"]=1;
  66003. //>>excludeEnd("ctx");
  66004. self._assert_equals_($1,(65));
  66005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66006. $ctx1.sendIdx["assert:equals:"]=1;
  66007. //>>excludeEnd("ctx");
  66008. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  66009. return self;
  66010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66011. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)});
  66012. //>>excludeEnd("ctx");
  66013. },
  66014. //>>excludeStart("ide", pragmas.excludeIdeData);
  66015. args: [],
  66016. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  66017. referencedClasses: [],
  66018. //>>excludeEnd("ide");
  66019. messageSends: ["assert:equals:", "asciiValue"]
  66020. }),
  66021. globals.StringTest);
  66022. smalltalk.addMethod(
  66023. smalltalk.method({
  66024. selector: "testAtIfAbsentPut",
  66025. protocol: 'tests',
  66026. fn: function (){
  66027. var self=this;
  66028. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  66029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66030. return smalltalk.withContext(function($ctx1) {
  66031. //>>excludeEnd("ctx");
  66032. self._should_raise_((function(){
  66033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66034. return smalltalk.withContext(function($ctx2) {
  66035. //>>excludeEnd("ctx");
  66036. return "hello"._at_ifAbsentPut_((6),(function(){
  66037. return "a";
  66038. }));
  66039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  66041. //>>excludeEnd("ctx");
  66042. }),$Error());
  66043. return self;
  66044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66045. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)});
  66046. //>>excludeEnd("ctx");
  66047. },
  66048. //>>excludeStart("ide", pragmas.excludeIdeData);
  66049. args: [],
  66050. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  66051. referencedClasses: ["Error"],
  66052. //>>excludeEnd("ide");
  66053. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  66054. }),
  66055. globals.StringTest);
  66056. smalltalk.addMethod(
  66057. smalltalk.method({
  66058. selector: "testAtPut",
  66059. protocol: 'tests',
  66060. fn: function (){
  66061. var self=this;
  66062. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  66063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66064. return smalltalk.withContext(function($ctx1) {
  66065. //>>excludeEnd("ctx");
  66066. self._should_raise_((function(){
  66067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66068. return smalltalk.withContext(function($ctx2) {
  66069. //>>excludeEnd("ctx");
  66070. return "hello"._at_put_((1),"a");
  66071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  66073. //>>excludeEnd("ctx");
  66074. }),$Error());
  66075. return self;
  66076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66077. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)});
  66078. //>>excludeEnd("ctx");
  66079. },
  66080. //>>excludeStart("ide", pragmas.excludeIdeData);
  66081. args: [],
  66082. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  66083. referencedClasses: ["Error"],
  66084. //>>excludeEnd("ide");
  66085. messageSends: ["should:raise:", "at:put:"]
  66086. }),
  66087. globals.StringTest);
  66088. smalltalk.addMethod(
  66089. smalltalk.method({
  66090. selector: "testCapitalized",
  66091. protocol: 'tests',
  66092. fn: function (){
  66093. var self=this;
  66094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66095. return smalltalk.withContext(function($ctx1) {
  66096. //>>excludeEnd("ctx");
  66097. var $1,$2,$3;
  66098. $1="test"._capitalized();
  66099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66100. $ctx1.sendIdx["capitalized"]=1;
  66101. //>>excludeEnd("ctx");
  66102. self._assert_equals_($1,"Test");
  66103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66104. $ctx1.sendIdx["assert:equals:"]=1;
  66105. //>>excludeEnd("ctx");
  66106. $2="Test"._capitalized();
  66107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66108. $ctx1.sendIdx["capitalized"]=2;
  66109. //>>excludeEnd("ctx");
  66110. self._assert_equals_($2,"Test");
  66111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66112. $ctx1.sendIdx["assert:equals:"]=2;
  66113. //>>excludeEnd("ctx");
  66114. self._assert_equals_(""._capitalized(),"");
  66115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66116. $ctx1.sendIdx["assert:equals:"]=3;
  66117. //>>excludeEnd("ctx");
  66118. $3="Test"._isCapitalized();
  66119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66120. $ctx1.sendIdx["isCapitalized"]=1;
  66121. //>>excludeEnd("ctx");
  66122. self._assert_equals_($3,true);
  66123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66124. $ctx1.sendIdx["assert:equals:"]=4;
  66125. //>>excludeEnd("ctx");
  66126. self._assert_equals_("test"._isCapitalized(),false);
  66127. return self;
  66128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66129. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)});
  66130. //>>excludeEnd("ctx");
  66131. },
  66132. //>>excludeStart("ide", pragmas.excludeIdeData);
  66133. args: [],
  66134. source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.",
  66135. referencedClasses: [],
  66136. //>>excludeEnd("ide");
  66137. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  66138. }),
  66139. globals.StringTest);
  66140. smalltalk.addMethod(
  66141. smalltalk.method({
  66142. selector: "testCharCodeAt",
  66143. protocol: 'tests',
  66144. fn: function (){
  66145. var self=this;
  66146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66147. return smalltalk.withContext(function($ctx1) {
  66148. //>>excludeEnd("ctx");
  66149. var $1,$2,$3,$4,$5;
  66150. $1="jackie"._charCodeAt_((1));
  66151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66152. $ctx1.sendIdx["charCodeAt:"]=1;
  66153. //>>excludeEnd("ctx");
  66154. self._assert_equals_($1,(106));
  66155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66156. $ctx1.sendIdx["assert:equals:"]=1;
  66157. //>>excludeEnd("ctx");
  66158. $2="jackie"._charCodeAt_((2));
  66159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66160. $ctx1.sendIdx["charCodeAt:"]=2;
  66161. //>>excludeEnd("ctx");
  66162. self._assert_equals_($2,(97));
  66163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66164. $ctx1.sendIdx["assert:equals:"]=2;
  66165. //>>excludeEnd("ctx");
  66166. $3="jackie"._charCodeAt_((3));
  66167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66168. $ctx1.sendIdx["charCodeAt:"]=3;
  66169. //>>excludeEnd("ctx");
  66170. self._assert_equals_($3,(99));
  66171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66172. $ctx1.sendIdx["assert:equals:"]=3;
  66173. //>>excludeEnd("ctx");
  66174. $4="jackie"._charCodeAt_((4));
  66175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66176. $ctx1.sendIdx["charCodeAt:"]=4;
  66177. //>>excludeEnd("ctx");
  66178. self._assert_equals_($4,(107));
  66179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66180. $ctx1.sendIdx["assert:equals:"]=4;
  66181. //>>excludeEnd("ctx");
  66182. $5="jackie"._charCodeAt_((5));
  66183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66184. $ctx1.sendIdx["charCodeAt:"]=5;
  66185. //>>excludeEnd("ctx");
  66186. self._assert_equals_($5,(105));
  66187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66188. $ctx1.sendIdx["assert:equals:"]=5;
  66189. //>>excludeEnd("ctx");
  66190. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  66191. return self;
  66192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66193. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)});
  66194. //>>excludeEnd("ctx");
  66195. },
  66196. //>>excludeStart("ide", pragmas.excludeIdeData);
  66197. args: [],
  66198. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  66199. referencedClasses: [],
  66200. //>>excludeEnd("ide");
  66201. messageSends: ["assert:equals:", "charCodeAt:"]
  66202. }),
  66203. globals.StringTest);
  66204. smalltalk.addMethod(
  66205. smalltalk.method({
  66206. selector: "testCopyFromTo",
  66207. protocol: 'tests',
  66208. fn: function (){
  66209. var self=this;
  66210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66211. return smalltalk.withContext(function($ctx1) {
  66212. //>>excludeEnd("ctx");
  66213. var $1;
  66214. $1="jackie"._copyFrom_to_((1),(3));
  66215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66216. $ctx1.sendIdx["copyFrom:to:"]=1;
  66217. //>>excludeEnd("ctx");
  66218. self._assert_equals_($1,"jac");
  66219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66220. $ctx1.sendIdx["assert:equals:"]=1;
  66221. //>>excludeEnd("ctx");
  66222. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  66223. return self;
  66224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66225. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)});
  66226. //>>excludeEnd("ctx");
  66227. },
  66228. //>>excludeStart("ide", pragmas.excludeIdeData);
  66229. args: [],
  66230. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  66231. referencedClasses: [],
  66232. //>>excludeEnd("ide");
  66233. messageSends: ["assert:equals:", "copyFrom:to:"]
  66234. }),
  66235. globals.StringTest);
  66236. smalltalk.addMethod(
  66237. smalltalk.method({
  66238. selector: "testCopyWithoutAll",
  66239. protocol: 'tests',
  66240. fn: function (){
  66241. var self=this;
  66242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66243. return smalltalk.withContext(function($ctx1) {
  66244. //>>excludeEnd("ctx");
  66245. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  66246. return self;
  66247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66248. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)});
  66249. //>>excludeEnd("ctx");
  66250. },
  66251. //>>excludeStart("ide", pragmas.excludeIdeData);
  66252. args: [],
  66253. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  66254. referencedClasses: [],
  66255. //>>excludeEnd("ide");
  66256. messageSends: ["assert:equals:", "copyWithoutAll:"]
  66257. }),
  66258. globals.StringTest);
  66259. smalltalk.addMethod(
  66260. smalltalk.method({
  66261. selector: "testEquality",
  66262. protocol: 'tests',
  66263. fn: function (){
  66264. var self=this;
  66265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66266. return smalltalk.withContext(function($ctx1) {
  66267. //>>excludeEnd("ctx");
  66268. var $1,$2,$3;
  66269. self._assert_equals_("hello","hello");
  66270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66271. $ctx1.sendIdx["assert:equals:"]=1;
  66272. //>>excludeEnd("ctx");
  66273. $1="hello".__eq("world");
  66274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66275. $ctx1.sendIdx["="]=1;
  66276. //>>excludeEnd("ctx");
  66277. self._deny_($1);
  66278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66279. $ctx1.sendIdx["deny:"]=1;
  66280. //>>excludeEnd("ctx");
  66281. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  66282. })));
  66283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66284. $ctx1.sendIdx["="]=2;
  66285. //>>excludeEnd("ctx");
  66286. self._deny_($2);
  66287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66288. $ctx1.sendIdx["deny:"]=2;
  66289. //>>excludeEnd("ctx");
  66290. $3="hello"._yourself();
  66291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66292. $ctx1.sendIdx["yourself"]=1;
  66293. //>>excludeEnd("ctx");
  66294. self._assert_equals_("hello",$3);
  66295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66296. $ctx1.sendIdx["assert:equals:"]=2;
  66297. //>>excludeEnd("ctx");
  66298. self._assert_equals_("hello"._yourself(),"hello");
  66299. self._deny_("".__eq((0)));
  66300. return self;
  66301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66302. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)});
  66303. //>>excludeEnd("ctx");
  66304. },
  66305. //>>excludeStart("ide", pragmas.excludeIdeData);
  66306. args: [],
  66307. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  66308. referencedClasses: [],
  66309. //>>excludeEnd("ide");
  66310. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  66311. }),
  66312. globals.StringTest);
  66313. smalltalk.addMethod(
  66314. smalltalk.method({
  66315. selector: "testIdentity",
  66316. protocol: 'tests',
  66317. fn: function (){
  66318. var self=this;
  66319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66320. return smalltalk.withContext(function($ctx1) {
  66321. //>>excludeEnd("ctx");
  66322. var $1,$2,$4,$3,$5;
  66323. $1="hello".__eq_eq("hello");
  66324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66325. $ctx1.sendIdx["=="]=1;
  66326. //>>excludeEnd("ctx");
  66327. self._assert_($1);
  66328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66329. $ctx1.sendIdx["assert:"]=1;
  66330. //>>excludeEnd("ctx");
  66331. $2="hello".__eq_eq("world");
  66332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66333. $ctx1.sendIdx["=="]=2;
  66334. //>>excludeEnd("ctx");
  66335. self._deny_($2);
  66336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66337. $ctx1.sendIdx["deny:"]=1;
  66338. //>>excludeEnd("ctx");
  66339. $4="hello"._yourself();
  66340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66341. $ctx1.sendIdx["yourself"]=1;
  66342. //>>excludeEnd("ctx");
  66343. $3="hello".__eq_eq($4);
  66344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66345. $ctx1.sendIdx["=="]=3;
  66346. //>>excludeEnd("ctx");
  66347. self._assert_($3);
  66348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66349. $ctx1.sendIdx["assert:"]=2;
  66350. //>>excludeEnd("ctx");
  66351. $5=_st("hello"._yourself()).__eq_eq("hello");
  66352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66353. $ctx1.sendIdx["=="]=4;
  66354. //>>excludeEnd("ctx");
  66355. self._assert_($5);
  66356. self._deny_("".__eq_eq((0)));
  66357. return self;
  66358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66359. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)});
  66360. //>>excludeEnd("ctx");
  66361. },
  66362. //>>excludeStart("ide", pragmas.excludeIdeData);
  66363. args: [],
  66364. source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
  66365. referencedClasses: [],
  66366. //>>excludeEnd("ide");
  66367. messageSends: ["assert:", "==", "deny:", "yourself"]
  66368. }),
  66369. globals.StringTest);
  66370. smalltalk.addMethod(
  66371. smalltalk.method({
  66372. selector: "testIdentityHash",
  66373. protocol: 'tests',
  66374. fn: function (){
  66375. var self=this;
  66376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66377. return smalltalk.withContext(function($ctx1) {
  66378. //>>excludeEnd("ctx");
  66379. var $1,$2,$4,$3;
  66380. $1="foo"._identityHash();
  66381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66382. $ctx1.sendIdx["identityHash"]=1;
  66383. //>>excludeEnd("ctx");
  66384. $2="foo"._identityHash();
  66385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66386. $ctx1.sendIdx["identityHash"]=2;
  66387. //>>excludeEnd("ctx");
  66388. self._assert_equals_($1,$2);
  66389. $4="foo"._identityHash();
  66390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66391. $ctx1.sendIdx["identityHash"]=3;
  66392. //>>excludeEnd("ctx");
  66393. $3=_st($4).__eq("bar"._identityHash());
  66394. self._deny_($3);
  66395. return self;
  66396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66397. }, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)});
  66398. //>>excludeEnd("ctx");
  66399. },
  66400. //>>excludeStart("ide", pragmas.excludeIdeData);
  66401. args: [],
  66402. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  66403. referencedClasses: [],
  66404. //>>excludeEnd("ide");
  66405. messageSends: ["assert:equals:", "identityHash", "deny:", "="]
  66406. }),
  66407. globals.StringTest);
  66408. smalltalk.addMethod(
  66409. smalltalk.method({
  66410. selector: "testIncludesSubString",
  66411. protocol: 'tests',
  66412. fn: function (){
  66413. var self=this;
  66414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66415. return smalltalk.withContext(function($ctx1) {
  66416. //>>excludeEnd("ctx");
  66417. var $1;
  66418. $1="amber"._includesSubString_("ber");
  66419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66420. $ctx1.sendIdx["includesSubString:"]=1;
  66421. //>>excludeEnd("ctx");
  66422. self._assert_($1);
  66423. self._deny_("amber"._includesSubString_("zork"));
  66424. return self;
  66425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66426. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)});
  66427. //>>excludeEnd("ctx");
  66428. },
  66429. //>>excludeStart("ide", pragmas.excludeIdeData);
  66430. args: [],
  66431. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  66432. referencedClasses: [],
  66433. //>>excludeEnd("ide");
  66434. messageSends: ["assert:", "includesSubString:", "deny:"]
  66435. }),
  66436. globals.StringTest);
  66437. smalltalk.addMethod(
  66438. smalltalk.method({
  66439. selector: "testIndexOfStartingAtWithNull",
  66440. protocol: 'tests',
  66441. fn: function (){
  66442. var self=this;
  66443. return self;
  66444. },
  66445. //>>excludeStart("ide", pragmas.excludeIdeData);
  66446. args: [],
  66447. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  66448. referencedClasses: [],
  66449. //>>excludeEnd("ide");
  66450. messageSends: []
  66451. }),
  66452. globals.StringTest);
  66453. smalltalk.addMethod(
  66454. smalltalk.method({
  66455. selector: "testIndexOfWithNull",
  66456. protocol: 'tests',
  66457. fn: function (){
  66458. var self=this;
  66459. return self;
  66460. },
  66461. //>>excludeStart("ide", pragmas.excludeIdeData);
  66462. args: [],
  66463. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  66464. referencedClasses: [],
  66465. //>>excludeEnd("ide");
  66466. messageSends: []
  66467. }),
  66468. globals.StringTest);
  66469. smalltalk.addMethod(
  66470. smalltalk.method({
  66471. selector: "testIsVowel",
  66472. protocol: 'tests',
  66473. fn: function (){
  66474. var self=this;
  66475. var vowel,consonant;
  66476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66477. return smalltalk.withContext(function($ctx1) {
  66478. //>>excludeEnd("ctx");
  66479. var $1;
  66480. vowel="u";
  66481. consonant="z";
  66482. $1=_st(vowel)._isVowel();
  66483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66484. $ctx1.sendIdx["isVowel"]=1;
  66485. //>>excludeEnd("ctx");
  66486. self._assert_equals_($1,true);
  66487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66488. $ctx1.sendIdx["assert:equals:"]=1;
  66489. //>>excludeEnd("ctx");
  66490. self._assert_equals_(_st(consonant)._isVowel(),false);
  66491. return self;
  66492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66493. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)});
  66494. //>>excludeEnd("ctx");
  66495. },
  66496. //>>excludeStart("ide", pragmas.excludeIdeData);
  66497. args: [],
  66498. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  66499. referencedClasses: [],
  66500. //>>excludeEnd("ide");
  66501. messageSends: ["assert:equals:", "isVowel"]
  66502. }),
  66503. globals.StringTest);
  66504. smalltalk.addMethod(
  66505. smalltalk.method({
  66506. selector: "testJoin",
  66507. protocol: 'tests',
  66508. fn: function (){
  66509. var self=this;
  66510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66511. return smalltalk.withContext(function($ctx1) {
  66512. //>>excludeEnd("ctx");
  66513. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  66514. return self;
  66515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66516. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)});
  66517. //>>excludeEnd("ctx");
  66518. },
  66519. //>>excludeStart("ide", pragmas.excludeIdeData);
  66520. args: [],
  66521. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  66522. referencedClasses: [],
  66523. //>>excludeEnd("ide");
  66524. messageSends: ["assert:equals:", "join:"]
  66525. }),
  66526. globals.StringTest);
  66527. smalltalk.addMethod(
  66528. smalltalk.method({
  66529. selector: "testRemoveAll",
  66530. protocol: 'tests',
  66531. fn: function (){
  66532. var self=this;
  66533. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  66534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66535. return smalltalk.withContext(function($ctx1) {
  66536. //>>excludeEnd("ctx");
  66537. self._should_raise_((function(){
  66538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66539. return smalltalk.withContext(function($ctx2) {
  66540. //>>excludeEnd("ctx");
  66541. return _st(self._collection())._removeAll();
  66542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  66544. //>>excludeEnd("ctx");
  66545. }),$Error());
  66546. return self;
  66547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66548. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)});
  66549. //>>excludeEnd("ctx");
  66550. },
  66551. //>>excludeStart("ide", pragmas.excludeIdeData);
  66552. args: [],
  66553. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  66554. referencedClasses: ["Error"],
  66555. //>>excludeEnd("ide");
  66556. messageSends: ["should:raise:", "removeAll", "collection"]
  66557. }),
  66558. globals.StringTest);
  66559. smalltalk.addMethod(
  66560. smalltalk.method({
  66561. selector: "testReversed",
  66562. protocol: 'tests',
  66563. fn: function (){
  66564. var self=this;
  66565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66566. return smalltalk.withContext(function($ctx1) {
  66567. //>>excludeEnd("ctx");
  66568. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  66569. return self;
  66570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66571. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)});
  66572. //>>excludeEnd("ctx");
  66573. },
  66574. //>>excludeStart("ide", pragmas.excludeIdeData);
  66575. args: [],
  66576. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  66577. referencedClasses: [],
  66578. //>>excludeEnd("ide");
  66579. messageSends: ["assert:equals:", "reversed"]
  66580. }),
  66581. globals.StringTest);
  66582. smalltalk.addMethod(
  66583. smalltalk.method({
  66584. selector: "testStreamContents",
  66585. protocol: 'tests',
  66586. fn: function (){
  66587. var self=this;
  66588. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  66589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66590. return smalltalk.withContext(function($ctx1) {
  66591. //>>excludeEnd("ctx");
  66592. var $1;
  66593. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  66594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66595. return smalltalk.withContext(function($ctx2) {
  66596. //>>excludeEnd("ctx");
  66597. _st(aStream)._nextPutAll_("hello");
  66598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66599. $ctx2.sendIdx["nextPutAll:"]=1;
  66600. //>>excludeEnd("ctx");
  66601. _st(aStream)._space();
  66602. $1=_st(aStream)._nextPutAll_("world");
  66603. return $1;
  66604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66605. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  66606. //>>excludeEnd("ctx");
  66607. })),"hello world");
  66608. return self;
  66609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66610. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)});
  66611. //>>excludeEnd("ctx");
  66612. },
  66613. //>>excludeStart("ide", pragmas.excludeIdeData);
  66614. args: [],
  66615. source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'",
  66616. referencedClasses: ["String"],
  66617. //>>excludeEnd("ide");
  66618. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  66619. }),
  66620. globals.StringTest);
  66621. smalltalk.addMethod(
  66622. smalltalk.method({
  66623. selector: "testSubStrings",
  66624. protocol: 'tests',
  66625. fn: function (){
  66626. var self=this;
  66627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66628. return smalltalk.withContext(function($ctx1) {
  66629. //>>excludeEnd("ctx");
  66630. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  66631. return self;
  66632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66633. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)});
  66634. //>>excludeEnd("ctx");
  66635. },
  66636. //>>excludeStart("ide", pragmas.excludeIdeData);
  66637. args: [],
  66638. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  66639. referencedClasses: [],
  66640. //>>excludeEnd("ide");
  66641. messageSends: ["assert:equals:", "subStrings:"]
  66642. }),
  66643. globals.StringTest);
  66644. smalltalk.addMethod(
  66645. smalltalk.method({
  66646. selector: "testTrim",
  66647. protocol: 'tests',
  66648. fn: function (){
  66649. var self=this;
  66650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66651. return smalltalk.withContext(function($ctx1) {
  66652. //>>excludeEnd("ctx");
  66653. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  66654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66655. $ctx1.sendIdx["assert:equals:"]=1;
  66656. //>>excludeEnd("ctx");
  66657. self._assert_equals_("jackie "._trimRight(),"jackie");
  66658. return self;
  66659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66660. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)});
  66661. //>>excludeEnd("ctx");
  66662. },
  66663. //>>excludeStart("ide", pragmas.excludeIdeData);
  66664. args: [],
  66665. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  66666. referencedClasses: [],
  66667. //>>excludeEnd("ide");
  66668. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  66669. }),
  66670. globals.StringTest);
  66671. smalltalk.addMethod(
  66672. smalltalk.method({
  66673. selector: "testValue",
  66674. protocol: 'tests',
  66675. fn: function (){
  66676. var self=this;
  66677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66678. return smalltalk.withContext(function($ctx1) {
  66679. //>>excludeEnd("ctx");
  66680. self._assert_equals_("asString"._value_((1)),"1");
  66681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66682. $ctx1.sendIdx["assert:equals:"]=1;
  66683. //>>excludeEnd("ctx");
  66684. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  66685. return self;
  66686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66687. }, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)});
  66688. //>>excludeEnd("ctx");
  66689. },
  66690. //>>excludeStart("ide", pragmas.excludeIdeData);
  66691. args: [],
  66692. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  66693. referencedClasses: [],
  66694. //>>excludeEnd("ide");
  66695. messageSends: ["assert:equals:", "value:", "collect:"]
  66696. }),
  66697. globals.StringTest);
  66698. smalltalk.addMethod(
  66699. smalltalk.method({
  66700. selector: "collectionClass",
  66701. protocol: 'fixture',
  66702. fn: function (){
  66703. var self=this;
  66704. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  66705. return $String();
  66706. },
  66707. //>>excludeStart("ide", pragmas.excludeIdeData);
  66708. args: [],
  66709. source: "collectionClass\x0a\x09^ String",
  66710. referencedClasses: ["String"],
  66711. //>>excludeEnd("ide");
  66712. messageSends: []
  66713. }),
  66714. globals.StringTest.klass);
  66715. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  66716. smalltalk.addMethod(
  66717. smalltalk.method({
  66718. selector: "collection",
  66719. protocol: 'fixture',
  66720. fn: function (){
  66721. var self=this;
  66722. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  66723. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  66724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66725. return smalltalk.withContext(function($ctx1) {
  66726. //>>excludeEnd("ctx");
  66727. var $2,$3,$1;
  66728. $2=_st($Set())._new();
  66729. _st($2)._add_($Smalltalk());
  66730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66731. $ctx1.sendIdx["add:"]=1;
  66732. //>>excludeEnd("ctx");
  66733. _st($2)._add_(nil);
  66734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66735. $ctx1.sendIdx["add:"]=2;
  66736. //>>excludeEnd("ctx");
  66737. _st($2)._add_((3).__at((3)));
  66738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66739. $ctx1.sendIdx["add:"]=3;
  66740. //>>excludeEnd("ctx");
  66741. _st($2)._add_(false);
  66742. $3=_st($2)._yourself();
  66743. $1=$3;
  66744. return $1;
  66745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66746. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)});
  66747. //>>excludeEnd("ctx");
  66748. },
  66749. //>>excludeStart("ide", pragmas.excludeIdeData);
  66750. args: [],
  66751. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  66752. referencedClasses: ["Set", "Smalltalk"],
  66753. //>>excludeEnd("ide");
  66754. messageSends: ["add:", "new", "@", "yourself"]
  66755. }),
  66756. globals.SetTest);
  66757. smalltalk.addMethod(
  66758. smalltalk.method({
  66759. selector: "collectionOfPrintStrings",
  66760. protocol: 'fixture',
  66761. fn: function (){
  66762. var self=this;
  66763. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  66764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66765. return smalltalk.withContext(function($ctx1) {
  66766. //>>excludeEnd("ctx");
  66767. var $2,$3,$1;
  66768. $2=_st($Set())._new();
  66769. _st($2)._add_("a SmalltalkImage");
  66770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66771. $ctx1.sendIdx["add:"]=1;
  66772. //>>excludeEnd("ctx");
  66773. _st($2)._add_("nil");
  66774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66775. $ctx1.sendIdx["add:"]=2;
  66776. //>>excludeEnd("ctx");
  66777. _st($2)._add_("3@3");
  66778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66779. $ctx1.sendIdx["add:"]=3;
  66780. //>>excludeEnd("ctx");
  66781. _st($2)._add_("false");
  66782. $3=_st($2)._yourself();
  66783. $1=$3;
  66784. return $1;
  66785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66786. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)});
  66787. //>>excludeEnd("ctx");
  66788. },
  66789. //>>excludeStart("ide", pragmas.excludeIdeData);
  66790. args: [],
  66791. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  66792. referencedClasses: ["Set"],
  66793. //>>excludeEnd("ide");
  66794. messageSends: ["add:", "new", "yourself"]
  66795. }),
  66796. globals.SetTest);
  66797. smalltalk.addMethod(
  66798. smalltalk.method({
  66799. selector: "collectionSize",
  66800. protocol: 'fixture',
  66801. fn: function (){
  66802. var self=this;
  66803. return (4);
  66804. },
  66805. //>>excludeStart("ide", pragmas.excludeIdeData);
  66806. args: [],
  66807. source: "collectionSize\x0a\x09^ 4",
  66808. referencedClasses: [],
  66809. //>>excludeEnd("ide");
  66810. messageSends: []
  66811. }),
  66812. globals.SetTest);
  66813. smalltalk.addMethod(
  66814. smalltalk.method({
  66815. selector: "collectionWithDuplicates",
  66816. protocol: 'fixture',
  66817. fn: function (){
  66818. var self=this;
  66819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66820. return smalltalk.withContext(function($ctx1) {
  66821. //>>excludeEnd("ctx");
  66822. var $2,$3,$1;
  66823. $2=self._collection();
  66824. _st($2)._add_((0));
  66825. $3=_st($2)._yourself();
  66826. $1=$3;
  66827. return $1;
  66828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66829. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)});
  66830. //>>excludeEnd("ctx");
  66831. },
  66832. //>>excludeStart("ide", pragmas.excludeIdeData);
  66833. args: [],
  66834. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  66835. referencedClasses: [],
  66836. //>>excludeEnd("ide");
  66837. messageSends: ["add:", "collection", "yourself"]
  66838. }),
  66839. globals.SetTest);
  66840. smalltalk.addMethod(
  66841. smalltalk.method({
  66842. selector: "collectionWithNewValue",
  66843. protocol: 'fixture',
  66844. fn: function (){
  66845. var self=this;
  66846. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  66847. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  66848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66849. return smalltalk.withContext(function($ctx1) {
  66850. //>>excludeEnd("ctx");
  66851. var $2,$3,$1;
  66852. $2=_st($Set())._new();
  66853. _st($2)._add_($Smalltalk());
  66854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66855. $ctx1.sendIdx["add:"]=1;
  66856. //>>excludeEnd("ctx");
  66857. _st($2)._add_(nil);
  66858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66859. $ctx1.sendIdx["add:"]=2;
  66860. //>>excludeEnd("ctx");
  66861. _st($2)._add_((3).__at((3)));
  66862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66863. $ctx1.sendIdx["add:"]=3;
  66864. //>>excludeEnd("ctx");
  66865. _st($2)._add_("N");
  66866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66867. $ctx1.sendIdx["add:"]=4;
  66868. //>>excludeEnd("ctx");
  66869. _st($2)._add_(false);
  66870. $3=_st($2)._yourself();
  66871. $1=$3;
  66872. return $1;
  66873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66874. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)});
  66875. //>>excludeEnd("ctx");
  66876. },
  66877. //>>excludeStart("ide", pragmas.excludeIdeData);
  66878. args: [],
  66879. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  66880. referencedClasses: ["Set", "Smalltalk"],
  66881. //>>excludeEnd("ide");
  66882. messageSends: ["add:", "new", "@", "yourself"]
  66883. }),
  66884. globals.SetTest);
  66885. smalltalk.addMethod(
  66886. smalltalk.method({
  66887. selector: "testAddAll",
  66888. protocol: 'tests',
  66889. fn: function (){
  66890. var self=this;
  66891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66892. return smalltalk.withContext(function($ctx1) {
  66893. //>>excludeEnd("ctx");
  66894. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  66895. (
  66896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66897. $ctx1.supercall = true,
  66898. //>>excludeEnd("ctx");
  66899. globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  66900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66901. $ctx1.supercall = false;
  66902. //>>excludeEnd("ctx");;
  66903. $2=self._collection();
  66904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66905. $ctx1.sendIdx["collection"]=1;
  66906. //>>excludeEnd("ctx");
  66907. $3=$2;
  66908. $4=self._collection();
  66909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66910. $ctx1.sendIdx["collection"]=2;
  66911. //>>excludeEnd("ctx");
  66912. _st($3)._addAll_($4);
  66913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66914. $ctx1.sendIdx["addAll:"]=1;
  66915. //>>excludeEnd("ctx");
  66916. $5=_st($2)._yourself();
  66917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66918. $ctx1.sendIdx["yourself"]=1;
  66919. //>>excludeEnd("ctx");
  66920. $1=$5;
  66921. $6=self._collection();
  66922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66923. $ctx1.sendIdx["collection"]=3;
  66924. //>>excludeEnd("ctx");
  66925. self._assert_equals_($1,$6);
  66926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66927. $ctx1.sendIdx["assert:equals:"]=1;
  66928. //>>excludeEnd("ctx");
  66929. $8=self._collection();
  66930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66931. $ctx1.sendIdx["collection"]=4;
  66932. //>>excludeEnd("ctx");
  66933. $9=$8;
  66934. $10=self._collectionWithNewValue();
  66935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66936. $ctx1.sendIdx["collectionWithNewValue"]=1;
  66937. //>>excludeEnd("ctx");
  66938. _st($9)._addAll_($10);
  66939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66940. $ctx1.sendIdx["addAll:"]=2;
  66941. //>>excludeEnd("ctx");
  66942. $11=_st($8)._yourself();
  66943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66944. $ctx1.sendIdx["yourself"]=2;
  66945. //>>excludeEnd("ctx");
  66946. $7=$11;
  66947. $12=self._collectionWithNewValue();
  66948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66949. $ctx1.sendIdx["collectionWithNewValue"]=2;
  66950. //>>excludeEnd("ctx");
  66951. self._assert_equals_($7,$12);
  66952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66953. $ctx1.sendIdx["assert:equals:"]=2;
  66954. //>>excludeEnd("ctx");
  66955. $14=self._collectionWithNewValue();
  66956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66957. $ctx1.sendIdx["collectionWithNewValue"]=3;
  66958. //>>excludeEnd("ctx");
  66959. _st($14)._addAll_(self._collection());
  66960. $15=_st($14)._yourself();
  66961. $13=$15;
  66962. self._assert_equals_($13,self._collectionWithNewValue());
  66963. return self;
  66964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66965. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)});
  66966. //>>excludeEnd("ctx");
  66967. },
  66968. //>>excludeStart("ide", pragmas.excludeIdeData);
  66969. args: [],
  66970. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  66971. referencedClasses: [],
  66972. //>>excludeEnd("ide");
  66973. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  66974. }),
  66975. globals.SetTest);
  66976. smalltalk.addMethod(
  66977. smalltalk.method({
  66978. selector: "testAddRemove",
  66979. protocol: 'tests',
  66980. fn: function (){
  66981. var self=this;
  66982. var set;
  66983. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  66984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66985. return smalltalk.withContext(function($ctx1) {
  66986. //>>excludeEnd("ctx");
  66987. var $1,$2;
  66988. set=_st($Set())._new();
  66989. self._assert_(_st(set)._isEmpty());
  66990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66991. $ctx1.sendIdx["assert:"]=1;
  66992. //>>excludeEnd("ctx");
  66993. _st(set)._add_((3));
  66994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66995. $ctx1.sendIdx["add:"]=1;
  66996. //>>excludeEnd("ctx");
  66997. $1=_st(set)._includes_((3));
  66998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66999. $ctx1.sendIdx["includes:"]=1;
  67000. //>>excludeEnd("ctx");
  67001. self._assert_($1);
  67002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67003. $ctx1.sendIdx["assert:"]=2;
  67004. //>>excludeEnd("ctx");
  67005. _st(set)._add_((5));
  67006. $2=_st(set)._includes_((5));
  67007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67008. $ctx1.sendIdx["includes:"]=2;
  67009. //>>excludeEnd("ctx");
  67010. self._assert_($2);
  67011. _st(set)._remove_((3));
  67012. self._deny_(_st(set)._includes_((3)));
  67013. return self;
  67014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67015. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)});
  67016. //>>excludeEnd("ctx");
  67017. },
  67018. //>>excludeStart("ide", pragmas.excludeIdeData);
  67019. args: [],
  67020. source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)",
  67021. referencedClasses: ["Set"],
  67022. //>>excludeEnd("ide");
  67023. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  67024. }),
  67025. globals.SetTest);
  67026. smalltalk.addMethod(
  67027. smalltalk.method({
  67028. selector: "testAt",
  67029. protocol: 'tests',
  67030. fn: function (){
  67031. var self=this;
  67032. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  67033. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  67034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67035. return smalltalk.withContext(function($ctx1) {
  67036. //>>excludeEnd("ctx");
  67037. self._should_raise_((function(){
  67038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67039. return smalltalk.withContext(function($ctx2) {
  67040. //>>excludeEnd("ctx");
  67041. return _st(_st($Set())._new())._at_put_((1),(2));
  67042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67044. //>>excludeEnd("ctx");
  67045. }),$Error());
  67046. return self;
  67047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67048. }, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)});
  67049. //>>excludeEnd("ctx");
  67050. },
  67051. //>>excludeStart("ide", pragmas.excludeIdeData);
  67052. args: [],
  67053. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  67054. referencedClasses: ["Set", "Error"],
  67055. //>>excludeEnd("ide");
  67056. messageSends: ["should:raise:", "at:put:", "new"]
  67057. }),
  67058. globals.SetTest);
  67059. smalltalk.addMethod(
  67060. smalltalk.method({
  67061. selector: "testCollect",
  67062. protocol: 'tests',
  67063. fn: function (){
  67064. var self=this;
  67065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67066. return smalltalk.withContext(function($ctx1) {
  67067. //>>excludeEnd("ctx");
  67068. var $2,$1;
  67069. (
  67070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67071. $ctx1.supercall = true,
  67072. //>>excludeEnd("ctx");
  67073. globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  67074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67075. $ctx1.supercall = false;
  67076. //>>excludeEnd("ctx");;
  67077. $2=[(5), (6), (8)]._asSet();
  67078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67079. $ctx1.sendIdx["asSet"]=1;
  67080. //>>excludeEnd("ctx");
  67081. $1=_st($2)._collect_((function(x){
  67082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67083. return smalltalk.withContext(function($ctx2) {
  67084. //>>excludeEnd("ctx");
  67085. return _st(x).__backslash_backslash((3));
  67086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67087. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  67088. //>>excludeEnd("ctx");
  67089. }));
  67090. self._assert_equals_($1,[(0), (2)]._asSet());
  67091. return self;
  67092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67093. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)});
  67094. //>>excludeEnd("ctx");
  67095. },
  67096. //>>excludeStart("ide", pragmas.excludeIdeData);
  67097. args: [],
  67098. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  67099. referencedClasses: [],
  67100. //>>excludeEnd("ide");
  67101. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  67102. }),
  67103. globals.SetTest);
  67104. smalltalk.addMethod(
  67105. smalltalk.method({
  67106. selector: "testComma",
  67107. protocol: 'tests',
  67108. fn: function (){
  67109. var self=this;
  67110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67111. return smalltalk.withContext(function($ctx1) {
  67112. //>>excludeEnd("ctx");
  67113. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  67114. (
  67115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67116. $ctx1.supercall = true,
  67117. //>>excludeEnd("ctx");
  67118. globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  67119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67120. $ctx1.supercall = false;
  67121. //>>excludeEnd("ctx");;
  67122. $2=self._collection();
  67123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67124. $ctx1.sendIdx["collection"]=1;
  67125. //>>excludeEnd("ctx");
  67126. $3=self._collection();
  67127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67128. $ctx1.sendIdx["collection"]=2;
  67129. //>>excludeEnd("ctx");
  67130. $1=_st($2).__comma($3);
  67131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67132. $ctx1.sendIdx[","]=1;
  67133. //>>excludeEnd("ctx");
  67134. $4=self._collection();
  67135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67136. $ctx1.sendIdx["collection"]=3;
  67137. //>>excludeEnd("ctx");
  67138. self._assert_equals_($1,$4);
  67139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67140. $ctx1.sendIdx["assert:equals:"]=1;
  67141. //>>excludeEnd("ctx");
  67142. $6=self._collection();
  67143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67144. $ctx1.sendIdx["collection"]=4;
  67145. //>>excludeEnd("ctx");
  67146. $7=self._collectionWithNewValue();
  67147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67148. $ctx1.sendIdx["collectionWithNewValue"]=1;
  67149. //>>excludeEnd("ctx");
  67150. $5=_st($6).__comma($7);
  67151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67152. $ctx1.sendIdx[","]=2;
  67153. //>>excludeEnd("ctx");
  67154. $8=self._collectionWithNewValue();
  67155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67156. $ctx1.sendIdx["collectionWithNewValue"]=2;
  67157. //>>excludeEnd("ctx");
  67158. self._assert_equals_($5,$8);
  67159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67160. $ctx1.sendIdx["assert:equals:"]=2;
  67161. //>>excludeEnd("ctx");
  67162. $10=self._collectionWithNewValue();
  67163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67164. $ctx1.sendIdx["collectionWithNewValue"]=3;
  67165. //>>excludeEnd("ctx");
  67166. $9=_st($10).__comma(self._collection());
  67167. self._assert_equals_($9,self._collectionWithNewValue());
  67168. return self;
  67169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67170. }, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)});
  67171. //>>excludeEnd("ctx");
  67172. },
  67173. //>>excludeStart("ide", pragmas.excludeIdeData);
  67174. args: [],
  67175. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  67176. referencedClasses: [],
  67177. //>>excludeEnd("ide");
  67178. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  67179. }),
  67180. globals.SetTest);
  67181. smalltalk.addMethod(
  67182. smalltalk.method({
  67183. selector: "testComparing",
  67184. protocol: 'tests',
  67185. fn: function (){
  67186. var self=this;
  67187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67188. return smalltalk.withContext(function($ctx1) {
  67189. //>>excludeEnd("ctx");
  67190. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  67191. $1=[(0), (2)]._asSet();
  67192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67193. $ctx1.sendIdx["asSet"]=1;
  67194. //>>excludeEnd("ctx");
  67195. $2=[(0), (2)]._asSet();
  67196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67197. $ctx1.sendIdx["asSet"]=2;
  67198. //>>excludeEnd("ctx");
  67199. self._assert_equals_($1,$2);
  67200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67201. $ctx1.sendIdx["assert:equals:"]=1;
  67202. //>>excludeEnd("ctx");
  67203. $3=[(2), (0)]._asSet();
  67204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67205. $ctx1.sendIdx["asSet"]=3;
  67206. //>>excludeEnd("ctx");
  67207. $4=[(0), (2)]._asSet();
  67208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67209. $ctx1.sendIdx["asSet"]=4;
  67210. //>>excludeEnd("ctx");
  67211. self._assert_equals_($3,$4);
  67212. $6=[(0), (2), (3)]._asSet();
  67213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67214. $ctx1.sendIdx["asSet"]=5;
  67215. //>>excludeEnd("ctx");
  67216. $7=[(0), (2)]._asSet();
  67217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67218. $ctx1.sendIdx["asSet"]=6;
  67219. //>>excludeEnd("ctx");
  67220. $5=_st($6).__eq($7);
  67221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67222. $ctx1.sendIdx["="]=1;
  67223. //>>excludeEnd("ctx");
  67224. self._deny_($5);
  67225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67226. $ctx1.sendIdx["deny:"]=1;
  67227. //>>excludeEnd("ctx");
  67228. $9=[(1), (2)]._asSet();
  67229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67230. $ctx1.sendIdx["asSet"]=7;
  67231. //>>excludeEnd("ctx");
  67232. $8=_st($9).__eq([(0), (2)]._asSet());
  67233. self._deny_($8);
  67234. return self;
  67235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67236. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)});
  67237. //>>excludeEnd("ctx");
  67238. },
  67239. //>>excludeStart("ide", pragmas.excludeIdeData);
  67240. args: [],
  67241. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet",
  67242. referencedClasses: [],
  67243. //>>excludeEnd("ide");
  67244. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  67245. }),
  67246. globals.SetTest);
  67247. smalltalk.addMethod(
  67248. smalltalk.method({
  67249. selector: "testPrintString",
  67250. protocol: 'tests',
  67251. fn: function (){
  67252. var self=this;
  67253. var set;
  67254. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  67255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67256. return smalltalk.withContext(function($ctx1) {
  67257. //>>excludeEnd("ctx");
  67258. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  67259. set=_st($Set())._new();
  67260. $1=_st(set)._printString();
  67261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67262. $ctx1.sendIdx["printString"]=1;
  67263. //>>excludeEnd("ctx");
  67264. self._assert_equals_($1,"a Set ()");
  67265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67266. $ctx1.sendIdx["assert:equals:"]=1;
  67267. //>>excludeEnd("ctx");
  67268. $2=set;
  67269. _st($2)._add_((1));
  67270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67271. $ctx1.sendIdx["add:"]=1;
  67272. //>>excludeEnd("ctx");
  67273. $3=_st($2)._add_((3));
  67274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67275. $ctx1.sendIdx["add:"]=2;
  67276. //>>excludeEnd("ctx");
  67277. $4=_st(set)._printString();
  67278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67279. $ctx1.sendIdx["printString"]=2;
  67280. //>>excludeEnd("ctx");
  67281. self._assert_equals_($4,"a Set (1 3)");
  67282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67283. $ctx1.sendIdx["assert:equals:"]=2;
  67284. //>>excludeEnd("ctx");
  67285. _st(set)._add_("foo");
  67286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67287. $ctx1.sendIdx["add:"]=3;
  67288. //>>excludeEnd("ctx");
  67289. $5=_st(set)._printString();
  67290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67291. $ctx1.sendIdx["printString"]=3;
  67292. //>>excludeEnd("ctx");
  67293. self._assert_equals_($5,"a Set (1 3 'foo')");
  67294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67295. $ctx1.sendIdx["assert:equals:"]=3;
  67296. //>>excludeEnd("ctx");
  67297. $6=set;
  67298. _st($6)._remove_((1));
  67299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67300. $ctx1.sendIdx["remove:"]=1;
  67301. //>>excludeEnd("ctx");
  67302. $7=_st($6)._remove_((3));
  67303. $8=_st(set)._printString();
  67304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67305. $ctx1.sendIdx["printString"]=4;
  67306. //>>excludeEnd("ctx");
  67307. self._assert_equals_($8,"a Set ('foo')");
  67308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67309. $ctx1.sendIdx["assert:equals:"]=4;
  67310. //>>excludeEnd("ctx");
  67311. _st(set)._add_((3));
  67312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67313. $ctx1.sendIdx["add:"]=4;
  67314. //>>excludeEnd("ctx");
  67315. $9=_st(set)._printString();
  67316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67317. $ctx1.sendIdx["printString"]=5;
  67318. //>>excludeEnd("ctx");
  67319. self._assert_equals_($9,"a Set (3 'foo')");
  67320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67321. $ctx1.sendIdx["assert:equals:"]=5;
  67322. //>>excludeEnd("ctx");
  67323. _st(set)._add_((3));
  67324. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  67325. return self;
  67326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67327. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)});
  67328. //>>excludeEnd("ctx");
  67329. },
  67330. //>>excludeStart("ide", pragmas.excludeIdeData);
  67331. args: [],
  67332. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  67333. referencedClasses: ["Set"],
  67334. //>>excludeEnd("ide");
  67335. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  67336. }),
  67337. globals.SetTest);
  67338. smalltalk.addMethod(
  67339. smalltalk.method({
  67340. selector: "testUnboxedObjects",
  67341. protocol: 'tests',
  67342. fn: function (){
  67343. var self=this;
  67344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67345. return smalltalk.withContext(function($ctx1) {
  67346. //>>excludeEnd("ctx");
  67347. var $4,$3,$2,$1;
  67348. $4="foo"._yourself();
  67349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67350. $ctx1.sendIdx["yourself"]=1;
  67351. //>>excludeEnd("ctx");
  67352. $3=[$4,"foo"._yourself()];
  67353. $2=_st($3)._asSet();
  67354. $1=_st($2)._asArray();
  67355. self._assert_equals_($1,["foo"]);
  67356. return self;
  67357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67358. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)});
  67359. //>>excludeEnd("ctx");
  67360. },
  67361. //>>excludeStart("ide", pragmas.excludeIdeData);
  67362. args: [],
  67363. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  67364. referencedClasses: [],
  67365. //>>excludeEnd("ide");
  67366. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  67367. }),
  67368. globals.SetTest);
  67369. smalltalk.addMethod(
  67370. smalltalk.method({
  67371. selector: "testUnicity",
  67372. protocol: 'tests',
  67373. fn: function (){
  67374. var self=this;
  67375. var set;
  67376. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  67377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67378. return smalltalk.withContext(function($ctx1) {
  67379. //>>excludeEnd("ctx");
  67380. var $1;
  67381. set=_st($Set())._new();
  67382. _st(set)._add_((21));
  67383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67384. $ctx1.sendIdx["add:"]=1;
  67385. //>>excludeEnd("ctx");
  67386. _st(set)._add_("hello");
  67387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67388. $ctx1.sendIdx["add:"]=2;
  67389. //>>excludeEnd("ctx");
  67390. _st(set)._add_((21));
  67391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67392. $ctx1.sendIdx["add:"]=3;
  67393. //>>excludeEnd("ctx");
  67394. $1=_st(set)._size();
  67395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67396. $ctx1.sendIdx["size"]=1;
  67397. //>>excludeEnd("ctx");
  67398. self._assert_equals_($1,(2));
  67399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67400. $ctx1.sendIdx["assert:equals:"]=1;
  67401. //>>excludeEnd("ctx");
  67402. _st(set)._add_("hello");
  67403. self._assert_equals_(_st(set)._size(),(2));
  67404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67405. $ctx1.sendIdx["assert:equals:"]=2;
  67406. //>>excludeEnd("ctx");
  67407. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  67408. return self;
  67409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67410. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)});
  67411. //>>excludeEnd("ctx");
  67412. },
  67413. //>>excludeStart("ide", pragmas.excludeIdeData);
  67414. args: [],
  67415. source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  67416. referencedClasses: ["Set"],
  67417. //>>excludeEnd("ide");
  67418. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  67419. }),
  67420. globals.SetTest);
  67421. smalltalk.addMethod(
  67422. smalltalk.method({
  67423. selector: "collectionClass",
  67424. protocol: 'fixture',
  67425. fn: function (){
  67426. var self=this;
  67427. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  67428. return $Set();
  67429. },
  67430. //>>excludeStart("ide", pragmas.excludeIdeData);
  67431. args: [],
  67432. source: "collectionClass\x0a\x09^ Set",
  67433. referencedClasses: ["Set"],
  67434. //>>excludeEnd("ide");
  67435. messageSends: []
  67436. }),
  67437. globals.SetTest.klass);
  67438. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  67439. smalltalk.addMethod(
  67440. smalltalk.method({
  67441. selector: "testShow",
  67442. protocol: 'tests',
  67443. fn: function (){
  67444. var self=this;
  67445. var originalTranscript;
  67446. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  67447. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  67448. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  67449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67450. return smalltalk.withContext(function($ctx1) {
  67451. //>>excludeEnd("ctx");
  67452. originalTranscript=_st($Transcript())._current();
  67453. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  67454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67455. $ctx1.sendIdx["register:"]=1;
  67456. //>>excludeEnd("ctx");
  67457. self._shouldnt_raise_((function(){
  67458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67459. return smalltalk.withContext(function($ctx2) {
  67460. //>>excludeEnd("ctx");
  67461. return _st($Transcript())._show_("Hello console!");
  67462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67463. $ctx2.sendIdx["show:"]=1;
  67464. //>>excludeEnd("ctx");
  67465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67467. //>>excludeEnd("ctx");
  67468. }),$Error());
  67469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67470. $ctx1.sendIdx["shouldnt:raise:"]=1;
  67471. //>>excludeEnd("ctx");
  67472. self._shouldnt_raise_((function(){
  67473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67474. return smalltalk.withContext(function($ctx2) {
  67475. //>>excludeEnd("ctx");
  67476. return _st($Transcript())._show_(console);
  67477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67479. //>>excludeEnd("ctx");
  67480. }),$Error());
  67481. _st($Transcript())._register_(originalTranscript);
  67482. return self;
  67483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67484. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)});
  67485. //>>excludeEnd("ctx");
  67486. },
  67487. //>>excludeStart("ide", pragmas.excludeIdeData);
  67488. args: [],
  67489. source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
  67490. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  67491. //>>excludeEnd("ide");
  67492. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  67493. }),
  67494. globals.ConsoleTranscriptTest);
  67495. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  67496. smalltalk.addMethod(
  67497. smalltalk.method({
  67498. selector: "jsNull",
  67499. protocol: 'accessing',
  67500. fn: function (){
  67501. var self=this;
  67502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67503. return smalltalk.withContext(function($ctx1) {
  67504. //>>excludeEnd("ctx");
  67505. return null;
  67506. return self;
  67507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67508. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},globals.JSObjectProxyTest)});
  67509. //>>excludeEnd("ctx");
  67510. },
  67511. //>>excludeStart("ide", pragmas.excludeIdeData);
  67512. args: [],
  67513. source: "jsNull\x0a\x09<return null>",
  67514. referencedClasses: [],
  67515. //>>excludeEnd("ide");
  67516. messageSends: []
  67517. }),
  67518. globals.JSObjectProxyTest);
  67519. smalltalk.addMethod(
  67520. smalltalk.method({
  67521. selector: "jsObject",
  67522. protocol: 'accessing',
  67523. fn: function (){
  67524. var self=this;
  67525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67526. return smalltalk.withContext(function($ctx1) {
  67527. //>>excludeEnd("ctx");
  67528. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  67529. return self;
  67530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67531. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)});
  67532. //>>excludeEnd("ctx");
  67533. },
  67534. //>>excludeStart("ide", pragmas.excludeIdeData);
  67535. args: [],
  67536. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  67537. referencedClasses: [],
  67538. //>>excludeEnd("ide");
  67539. messageSends: []
  67540. }),
  67541. globals.JSObjectProxyTest);
  67542. smalltalk.addMethod(
  67543. smalltalk.method({
  67544. selector: "jsUndefined",
  67545. protocol: 'accessing',
  67546. fn: function (){
  67547. var self=this;
  67548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67549. return smalltalk.withContext(function($ctx1) {
  67550. //>>excludeEnd("ctx");
  67551. return;
  67552. return self;
  67553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67554. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},globals.JSObjectProxyTest)});
  67555. //>>excludeEnd("ctx");
  67556. },
  67557. //>>excludeStart("ide", pragmas.excludeIdeData);
  67558. args: [],
  67559. source: "jsUndefined\x0a\x09<return>",
  67560. referencedClasses: [],
  67561. //>>excludeEnd("ide");
  67562. messageSends: []
  67563. }),
  67564. globals.JSObjectProxyTest);
  67565. smalltalk.addMethod(
  67566. smalltalk.method({
  67567. selector: "testAtIfAbsent",
  67568. protocol: 'tests',
  67569. fn: function (){
  67570. var self=this;
  67571. var testObject;
  67572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67573. return smalltalk.withContext(function($ctx1) {
  67574. //>>excludeEnd("ctx");
  67575. var $1,$2,$3;
  67576. testObject=self._jsObject();
  67577. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  67578. return "Property does not exist";
  67579. }));
  67580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67581. $ctx1.sendIdx["at:ifAbsent:"]=1;
  67582. //>>excludeEnd("ctx");
  67583. self._assert_equals_($1,"Property does not exist");
  67584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67585. $ctx1.sendIdx["assert:equals:"]=1;
  67586. //>>excludeEnd("ctx");
  67587. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  67588. return "Property does not exist";
  67589. }));
  67590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67591. $ctx1.sendIdx["at:ifAbsent:"]=2;
  67592. //>>excludeEnd("ctx");
  67593. self._assert_equals_($2,nil);
  67594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67595. $ctx1.sendIdx["assert:equals:"]=2;
  67596. //>>excludeEnd("ctx");
  67597. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  67598. return "Property does not exist";
  67599. }));
  67600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67601. $ctx1.sendIdx["at:ifAbsent:"]=3;
  67602. //>>excludeEnd("ctx");
  67603. self._assert_equals_($3,(1));
  67604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67605. $ctx1.sendIdx["assert:equals:"]=3;
  67606. //>>excludeEnd("ctx");
  67607. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  67608. return "Property does not exist";
  67609. })),nil);
  67610. return self;
  67611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67612. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)});
  67613. //>>excludeEnd("ctx");
  67614. },
  67615. //>>excludeStart("ide", pragmas.excludeIdeData);
  67616. args: [],
  67617. source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: [ 'Property does not exist' ]) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: [ 'Property does not exist' ]) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: [ 'Property does not exist' ]) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: [ 'Property does not exist' ]) equals: nil.",
  67618. referencedClasses: [],
  67619. //>>excludeEnd("ide");
  67620. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  67621. }),
  67622. globals.JSObjectProxyTest);
  67623. smalltalk.addMethod(
  67624. smalltalk.method({
  67625. selector: "testAtIfPresent",
  67626. protocol: 'tests',
  67627. fn: function (){
  67628. var self=this;
  67629. var testObject;
  67630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67631. return smalltalk.withContext(function($ctx1) {
  67632. //>>excludeEnd("ctx");
  67633. var $2,$1,$4,$3,$6,$5;
  67634. testObject=self._jsObject();
  67635. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  67636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67637. return smalltalk.withContext(function($ctx2) {
  67638. //>>excludeEnd("ctx");
  67639. $2=_st(x)._asString();
  67640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67641. $ctx2.sendIdx["asString"]=1;
  67642. //>>excludeEnd("ctx");
  67643. return "hello ".__comma($2);
  67644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67645. $ctx2.sendIdx[","]=1;
  67646. //>>excludeEnd("ctx");
  67647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67648. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  67649. //>>excludeEnd("ctx");
  67650. }));
  67651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67652. $ctx1.sendIdx["at:ifPresent:"]=1;
  67653. //>>excludeEnd("ctx");
  67654. self._assert_equals_($1,nil);
  67655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67656. $ctx1.sendIdx["assert:equals:"]=1;
  67657. //>>excludeEnd("ctx");
  67658. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  67659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67660. return smalltalk.withContext(function($ctx2) {
  67661. //>>excludeEnd("ctx");
  67662. $4=_st(x)._asString();
  67663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67664. $ctx2.sendIdx["asString"]=2;
  67665. //>>excludeEnd("ctx");
  67666. return "hello ".__comma($4);
  67667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67668. $ctx2.sendIdx[","]=2;
  67669. //>>excludeEnd("ctx");
  67670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67671. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  67672. //>>excludeEnd("ctx");
  67673. }));
  67674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67675. $ctx1.sendIdx["at:ifPresent:"]=2;
  67676. //>>excludeEnd("ctx");
  67677. self._assert_equals_($3,"hello nil");
  67678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67679. $ctx1.sendIdx["assert:equals:"]=2;
  67680. //>>excludeEnd("ctx");
  67681. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  67682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67683. return smalltalk.withContext(function($ctx2) {
  67684. //>>excludeEnd("ctx");
  67685. $6=_st(x)._asString();
  67686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67687. $ctx2.sendIdx["asString"]=3;
  67688. //>>excludeEnd("ctx");
  67689. return "hello ".__comma($6);
  67690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67691. $ctx2.sendIdx[","]=3;
  67692. //>>excludeEnd("ctx");
  67693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67694. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  67695. //>>excludeEnd("ctx");
  67696. }));
  67697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67698. $ctx1.sendIdx["at:ifPresent:"]=3;
  67699. //>>excludeEnd("ctx");
  67700. self._assert_equals_($5,"hello 1");
  67701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67702. $ctx1.sendIdx["assert:equals:"]=3;
  67703. //>>excludeEnd("ctx");
  67704. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  67705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67706. return smalltalk.withContext(function($ctx2) {
  67707. //>>excludeEnd("ctx");
  67708. return "hello ".__comma(_st(x)._asString());
  67709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67710. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  67711. //>>excludeEnd("ctx");
  67712. })),"hello nil");
  67713. return self;
  67714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67715. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)});
  67716. //>>excludeEnd("ctx");
  67717. },
  67718. //>>excludeStart("ide", pragmas.excludeIdeData);
  67719. args: [],
  67720. source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.",
  67721. referencedClasses: [],
  67722. //>>excludeEnd("ide");
  67723. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  67724. }),
  67725. globals.JSObjectProxyTest);
  67726. smalltalk.addMethod(
  67727. smalltalk.method({
  67728. selector: "testAtIfPresentIfAbsent",
  67729. protocol: 'tests',
  67730. fn: function (){
  67731. var self=this;
  67732. var testObject;
  67733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67734. return smalltalk.withContext(function($ctx1) {
  67735. //>>excludeEnd("ctx");
  67736. var $2,$1,$4,$3,$6,$5;
  67737. testObject=self._jsObject();
  67738. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  67739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67740. return smalltalk.withContext(function($ctx2) {
  67741. //>>excludeEnd("ctx");
  67742. $2=_st(x)._asString();
  67743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67744. $ctx2.sendIdx["asString"]=1;
  67745. //>>excludeEnd("ctx");
  67746. return "hello ".__comma($2);
  67747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67748. $ctx2.sendIdx[","]=1;
  67749. //>>excludeEnd("ctx");
  67750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67751. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  67752. //>>excludeEnd("ctx");
  67753. }),(function(){
  67754. return "not present";
  67755. }));
  67756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67757. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  67758. //>>excludeEnd("ctx");
  67759. self._assert_equals_($1,"not present");
  67760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67761. $ctx1.sendIdx["assert:equals:"]=1;
  67762. //>>excludeEnd("ctx");
  67763. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  67764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67765. return smalltalk.withContext(function($ctx2) {
  67766. //>>excludeEnd("ctx");
  67767. $4=_st(x)._asString();
  67768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67769. $ctx2.sendIdx["asString"]=2;
  67770. //>>excludeEnd("ctx");
  67771. return "hello ".__comma($4);
  67772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67773. $ctx2.sendIdx[","]=2;
  67774. //>>excludeEnd("ctx");
  67775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67776. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  67777. //>>excludeEnd("ctx");
  67778. }),(function(){
  67779. return "not present";
  67780. }));
  67781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67782. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  67783. //>>excludeEnd("ctx");
  67784. self._assert_equals_($3,"hello nil");
  67785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67786. $ctx1.sendIdx["assert:equals:"]=2;
  67787. //>>excludeEnd("ctx");
  67788. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  67789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67790. return smalltalk.withContext(function($ctx2) {
  67791. //>>excludeEnd("ctx");
  67792. $6=_st(x)._asString();
  67793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67794. $ctx2.sendIdx["asString"]=3;
  67795. //>>excludeEnd("ctx");
  67796. return "hello ".__comma($6);
  67797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67798. $ctx2.sendIdx[","]=3;
  67799. //>>excludeEnd("ctx");
  67800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67801. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  67802. //>>excludeEnd("ctx");
  67803. }),(function(){
  67804. return "not present";
  67805. }));
  67806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67807. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  67808. //>>excludeEnd("ctx");
  67809. self._assert_equals_($5,"hello 1");
  67810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67811. $ctx1.sendIdx["assert:equals:"]=3;
  67812. //>>excludeEnd("ctx");
  67813. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  67814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67815. return smalltalk.withContext(function($ctx2) {
  67816. //>>excludeEnd("ctx");
  67817. return "hello ".__comma(_st(x)._asString());
  67818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67819. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  67820. //>>excludeEnd("ctx");
  67821. }),(function(){
  67822. return "not present";
  67823. })),"hello nil");
  67824. return self;
  67825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67826. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)});
  67827. //>>excludeEnd("ctx");
  67828. },
  67829. //>>excludeStart("ide", pragmas.excludeIdeData);
  67830. args: [],
  67831. source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.",
  67832. referencedClasses: [],
  67833. //>>excludeEnd("ide");
  67834. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  67835. }),
  67836. globals.JSObjectProxyTest);
  67837. smalltalk.addMethod(
  67838. smalltalk.method({
  67839. selector: "testAtPut",
  67840. protocol: 'tests',
  67841. fn: function (){
  67842. var self=this;
  67843. var testObject;
  67844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67845. return smalltalk.withContext(function($ctx1) {
  67846. //>>excludeEnd("ctx");
  67847. var $2,$1;
  67848. testObject=self._jsObject();
  67849. $2=_st(testObject)._at_("abc");
  67850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67851. $ctx1.sendIdx["at:"]=1;
  67852. //>>excludeEnd("ctx");
  67853. $1=_st($2).__tild_eq("xyz");
  67854. self._assert_($1);
  67855. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  67856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67857. $ctx1.sendIdx["assert:equals:"]=1;
  67858. //>>excludeEnd("ctx");
  67859. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  67860. return self;
  67861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67862. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)});
  67863. //>>excludeEnd("ctx");
  67864. },
  67865. //>>excludeStart("ide", pragmas.excludeIdeData);
  67866. args: [],
  67867. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  67868. referencedClasses: [],
  67869. //>>excludeEnd("ide");
  67870. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  67871. }),
  67872. globals.JSObjectProxyTest);
  67873. smalltalk.addMethod(
  67874. smalltalk.method({
  67875. selector: "testComparison",
  67876. protocol: 'tests',
  67877. fn: function (){
  67878. var self=this;
  67879. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  67880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67881. return smalltalk.withContext(function($ctx1) {
  67882. //>>excludeEnd("ctx");
  67883. var $1,$2;
  67884. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  67885. $1=_st(console).__eq(console);
  67886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67887. $ctx1.sendIdx["="]=1;
  67888. //>>excludeEnd("ctx");
  67889. self._assert_($1);
  67890. $2=_st(console).__eq(_st($Object())._new());
  67891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67892. $ctx1.sendIdx["="]=2;
  67893. //>>excludeEnd("ctx");
  67894. self._deny_($2);
  67895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67896. $ctx1.sendIdx["deny:"]=1;
  67897. //>>excludeEnd("ctx");
  67898. self._deny_(_st(console).__eq(self._jsObject()));
  67899. return self;
  67900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67901. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)});
  67902. //>>excludeEnd("ctx");
  67903. },
  67904. //>>excludeStart("ide", pragmas.excludeIdeData);
  67905. args: [],
  67906. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  67907. referencedClasses: ["Object"],
  67908. //>>excludeEnd("ide");
  67909. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  67910. }),
  67911. globals.JSObjectProxyTest);
  67912. smalltalk.addMethod(
  67913. smalltalk.method({
  67914. selector: "testDNU",
  67915. protocol: 'tests',
  67916. fn: function (){
  67917. var self=this;
  67918. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  67919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67920. return smalltalk.withContext(function($ctx1) {
  67921. //>>excludeEnd("ctx");
  67922. self._should_raise_((function(){
  67923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67924. return smalltalk.withContext(function($ctx2) {
  67925. //>>excludeEnd("ctx");
  67926. return _st(self._jsObject())._foo();
  67927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67929. //>>excludeEnd("ctx");
  67930. }),$MessageNotUnderstood());
  67931. return self;
  67932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67933. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)});
  67934. //>>excludeEnd("ctx");
  67935. },
  67936. //>>excludeStart("ide", pragmas.excludeIdeData);
  67937. args: [],
  67938. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  67939. referencedClasses: ["MessageNotUnderstood"],
  67940. //>>excludeEnd("ide");
  67941. messageSends: ["should:raise:", "foo", "jsObject"]
  67942. }),
  67943. globals.JSObjectProxyTest);
  67944. smalltalk.addMethod(
  67945. smalltalk.method({
  67946. selector: "testDNURegression1057",
  67947. protocol: 'tests',
  67948. fn: function (){
  67949. var self=this;
  67950. var jsObject;
  67951. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  67952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67953. return smalltalk.withContext(function($ctx1) {
  67954. //>>excludeEnd("ctx");
  67955. var $1;
  67956. jsObject=[];
  67957. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  67958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67959. $ctx1.sendIdx["basicAt:put:"]=1;
  67960. //>>excludeEnd("ctx");
  67961. _st(jsObject)._basicAt_put_("foo",(3));
  67962. self._shouldnt_raise_((function(){
  67963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67964. return smalltalk.withContext(function($ctx2) {
  67965. //>>excludeEnd("ctx");
  67966. return _st(jsObject)._foo();
  67967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67968. $ctx2.sendIdx["foo"]=1;
  67969. //>>excludeEnd("ctx");
  67970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67972. //>>excludeEnd("ctx");
  67973. }),$Error());
  67974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67975. $ctx1.sendIdx["shouldnt:raise:"]=1;
  67976. //>>excludeEnd("ctx");
  67977. $1=_st(jsObject)._foo();
  67978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67979. $ctx1.sendIdx["foo"]=2;
  67980. //>>excludeEnd("ctx");
  67981. self._assert_equals_($1,(3));
  67982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67983. $ctx1.sendIdx["assert:equals:"]=1;
  67984. //>>excludeEnd("ctx");
  67985. self._shouldnt_raise_((function(){
  67986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67987. return smalltalk.withContext(function($ctx2) {
  67988. //>>excludeEnd("ctx");
  67989. return _st(jsObject)._foo_((4));
  67990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67992. //>>excludeEnd("ctx");
  67993. }),$Error());
  67994. self._assert_equals_(_st(jsObject)._foo(),(4));
  67995. return self;
  67996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67997. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},globals.JSObjectProxyTest)});
  67998. //>>excludeEnd("ctx");
  67999. },
  68000. //>>excludeStart("ide", pragmas.excludeIdeData);
  68001. args: [],
  68002. source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4",
  68003. referencedClasses: ["Error"],
  68004. //>>excludeEnd("ide");
  68005. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  68006. }),
  68007. globals.JSObjectProxyTest);
  68008. smalltalk.addMethod(
  68009. smalltalk.method({
  68010. selector: "testDNURegression1059",
  68011. protocol: 'tests',
  68012. fn: function (){
  68013. var self=this;
  68014. var jsObject;
  68015. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  68016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68017. return smalltalk.withContext(function($ctx1) {
  68018. //>>excludeEnd("ctx");
  68019. jsObject=[];
  68020. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  68021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68022. $ctx1.sendIdx["basicAt:put:"]=1;
  68023. //>>excludeEnd("ctx");
  68024. _st(jsObject)._basicAt_put_("x",(3));
  68025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68026. $ctx1.sendIdx["basicAt:put:"]=2;
  68027. //>>excludeEnd("ctx");
  68028. _st(jsObject)._basicAt_put_("x:",(function(){
  68029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68030. return smalltalk.withContext(function($ctx2) {
  68031. //>>excludeEnd("ctx");
  68032. return self._error();
  68033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68035. //>>excludeEnd("ctx");
  68036. }));
  68037. self._shouldnt_raise_((function(){
  68038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68039. return smalltalk.withContext(function($ctx2) {
  68040. //>>excludeEnd("ctx");
  68041. return _st(jsObject)._x_((4));
  68042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  68044. //>>excludeEnd("ctx");
  68045. }),$Error());
  68046. self._assert_equals_(_st(jsObject)._x(),(4));
  68047. return self;
  68048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68049. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},globals.JSObjectProxyTest)});
  68050. //>>excludeEnd("ctx");
  68051. },
  68052. //>>excludeStart("ide", pragmas.excludeIdeData);
  68053. args: [],
  68054. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4",
  68055. referencedClasses: ["Error"],
  68056. //>>excludeEnd("ide");
  68057. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  68058. }),
  68059. globals.JSObjectProxyTest);
  68060. smalltalk.addMethod(
  68061. smalltalk.method({
  68062. selector: "testDNURegression1062",
  68063. protocol: 'tests',
  68064. fn: function (){
  68065. var self=this;
  68066. var jsObject,stored;
  68067. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  68068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68069. return smalltalk.withContext(function($ctx1) {
  68070. //>>excludeEnd("ctx");
  68071. jsObject=[];
  68072. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  68073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68074. $ctx1.sendIdx["basicAt:put:"]=1;
  68075. //>>excludeEnd("ctx");
  68076. _st(jsObject)._basicAt_put_("x",(function(v){
  68077. stored=v;
  68078. return stored;
  68079. }));
  68080. self._shouldnt_raise_((function(){
  68081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68082. return smalltalk.withContext(function($ctx2) {
  68083. //>>excludeEnd("ctx");
  68084. return _st(jsObject)._x_((4));
  68085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  68087. //>>excludeEnd("ctx");
  68088. }),$Error());
  68089. self._assert_equals_(stored,(4));
  68090. return self;
  68091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68092. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},globals.JSObjectProxyTest)});
  68093. //>>excludeEnd("ctx");
  68094. },
  68095. //>>excludeStart("ide", pragmas.excludeIdeData);
  68096. args: [],
  68097. source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4",
  68098. referencedClasses: ["Error"],
  68099. //>>excludeEnd("ide");
  68100. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  68101. }),
  68102. globals.JSObjectProxyTest);
  68103. smalltalk.addMethod(
  68104. smalltalk.method({
  68105. selector: "testMessageSend",
  68106. protocol: 'tests',
  68107. fn: function (){
  68108. var self=this;
  68109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68110. return smalltalk.withContext(function($ctx1) {
  68111. //>>excludeEnd("ctx");
  68112. var $2,$1,$4,$3;
  68113. $2=self._jsObject();
  68114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68115. $ctx1.sendIdx["jsObject"]=1;
  68116. //>>excludeEnd("ctx");
  68117. $1=_st($2)._a();
  68118. self._assert_equals_($1,(1));
  68119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68120. $ctx1.sendIdx["assert:equals:"]=1;
  68121. //>>excludeEnd("ctx");
  68122. $4=self._jsObject();
  68123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68124. $ctx1.sendIdx["jsObject"]=2;
  68125. //>>excludeEnd("ctx");
  68126. $3=_st($4)._b();
  68127. self._assert_equals_($3,(2));
  68128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68129. $ctx1.sendIdx["assert:equals:"]=2;
  68130. //>>excludeEnd("ctx");
  68131. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  68132. return self;
  68133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68134. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)});
  68135. //>>excludeEnd("ctx");
  68136. },
  68137. //>>excludeStart("ide", pragmas.excludeIdeData);
  68138. args: [],
  68139. source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3",
  68140. referencedClasses: [],
  68141. //>>excludeEnd("ide");
  68142. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  68143. }),
  68144. globals.JSObjectProxyTest);
  68145. smalltalk.addMethod(
  68146. smalltalk.method({
  68147. selector: "testMethodWithArguments",
  68148. protocol: 'tests',
  68149. fn: function (){
  68150. var self=this;
  68151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68152. return smalltalk.withContext(function($ctx1) {
  68153. //>>excludeEnd("ctx");
  68154. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  68155. return self;
  68156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68157. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)});
  68158. //>>excludeEnd("ctx");
  68159. },
  68160. //>>excludeStart("ide", pragmas.excludeIdeData);
  68161. args: [],
  68162. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  68163. referencedClasses: [],
  68164. //>>excludeEnd("ide");
  68165. messageSends: ["assert:equals:", "c:", "jsObject"]
  68166. }),
  68167. globals.JSObjectProxyTest);
  68168. smalltalk.addMethod(
  68169. smalltalk.method({
  68170. selector: "testPrinting",
  68171. protocol: 'tests',
  68172. fn: function (){
  68173. var self=this;
  68174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68175. return smalltalk.withContext(function($ctx1) {
  68176. //>>excludeEnd("ctx");
  68177. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  68178. return self;
  68179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68180. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)});
  68181. //>>excludeEnd("ctx");
  68182. },
  68183. //>>excludeStart("ide", pragmas.excludeIdeData);
  68184. args: [],
  68185. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  68186. referencedClasses: [],
  68187. //>>excludeEnd("ide");
  68188. messageSends: ["assert:equals:", "printString", "jsObject"]
  68189. }),
  68190. globals.JSObjectProxyTest);
  68191. smalltalk.addMethod(
  68192. smalltalk.method({
  68193. selector: "testPropertyThatReturnsEmptyString",
  68194. protocol: 'tests',
  68195. fn: function (){
  68196. var self=this;
  68197. var object;
  68198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68199. return smalltalk.withContext(function($ctx1) {
  68200. //>>excludeEnd("ctx");
  68201. var $1;
  68202. object=self._jsObject();
  68203. $1=_st(object)._d();
  68204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68205. $ctx1.sendIdx["d"]=1;
  68206. //>>excludeEnd("ctx");
  68207. self._assert_equals_($1,"");
  68208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68209. $ctx1.sendIdx["assert:equals:"]=1;
  68210. //>>excludeEnd("ctx");
  68211. _st(object)._d_("hello");
  68212. self._assert_equals_(_st(object)._d(),"hello");
  68213. return self;
  68214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68215. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)});
  68216. //>>excludeEnd("ctx");
  68217. },
  68218. //>>excludeStart("ide", pragmas.excludeIdeData);
  68219. args: [],
  68220. source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'",
  68221. referencedClasses: [],
  68222. //>>excludeEnd("ide");
  68223. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  68224. }),
  68225. globals.JSObjectProxyTest);
  68226. smalltalk.addMethod(
  68227. smalltalk.method({
  68228. selector: "testPropertyThatReturnsUndefined",
  68229. protocol: 'tests',
  68230. fn: function (){
  68231. var self=this;
  68232. var object;
  68233. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  68234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68235. return smalltalk.withContext(function($ctx1) {
  68236. //>>excludeEnd("ctx");
  68237. object=self._jsObject();
  68238. self._shouldnt_raise_((function(){
  68239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68240. return smalltalk.withContext(function($ctx2) {
  68241. //>>excludeEnd("ctx");
  68242. return _st(object)._e();
  68243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68244. $ctx2.sendIdx["e"]=1;
  68245. //>>excludeEnd("ctx");
  68246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68248. //>>excludeEnd("ctx");
  68249. }),$MessageNotUnderstood());
  68250. self._assert_(_st(_st(object)._e())._isNil());
  68251. return self;
  68252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68253. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)});
  68254. //>>excludeEnd("ctx");
  68255. },
  68256. //>>excludeStart("ide", pragmas.excludeIdeData);
  68257. args: [],
  68258. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  68259. referencedClasses: ["MessageNotUnderstood"],
  68260. //>>excludeEnd("ide");
  68261. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  68262. }),
  68263. globals.JSObjectProxyTest);
  68264. smalltalk.addMethod(
  68265. smalltalk.method({
  68266. selector: "testSetPropertyWithFalsyValue",
  68267. protocol: 'tests',
  68268. fn: function (){
  68269. var self=this;
  68270. var jsObject;
  68271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68272. return smalltalk.withContext(function($ctx1) {
  68273. //>>excludeEnd("ctx");
  68274. var $1,$2,$3,$4,$5;
  68275. jsObject=self._jsObject();
  68276. $1=_st(jsObject)._a();
  68277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68278. $ctx1.sendIdx["a"]=1;
  68279. //>>excludeEnd("ctx");
  68280. self._assert_equals_($1,(1));
  68281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68282. $ctx1.sendIdx["assert:equals:"]=1;
  68283. //>>excludeEnd("ctx");
  68284. _st(jsObject)._a_(self._jsNull());
  68285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68286. $ctx1.sendIdx["a:"]=1;
  68287. //>>excludeEnd("ctx");
  68288. $2=_st(jsObject)._a();
  68289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68290. $ctx1.sendIdx["a"]=2;
  68291. //>>excludeEnd("ctx");
  68292. self._assert_equals_($2,nil);
  68293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68294. $ctx1.sendIdx["assert:equals:"]=2;
  68295. //>>excludeEnd("ctx");
  68296. _st(jsObject)._a_((0));
  68297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68298. $ctx1.sendIdx["a:"]=2;
  68299. //>>excludeEnd("ctx");
  68300. $3=_st(jsObject)._a();
  68301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68302. $ctx1.sendIdx["a"]=3;
  68303. //>>excludeEnd("ctx");
  68304. self._assert_equals_($3,(0));
  68305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68306. $ctx1.sendIdx["assert:equals:"]=3;
  68307. //>>excludeEnd("ctx");
  68308. _st(jsObject)._a_(self._jsUndefined());
  68309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68310. $ctx1.sendIdx["a:"]=3;
  68311. //>>excludeEnd("ctx");
  68312. $4=_st(jsObject)._a();
  68313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68314. $ctx1.sendIdx["a"]=4;
  68315. //>>excludeEnd("ctx");
  68316. self._assert_equals_($4,nil);
  68317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68318. $ctx1.sendIdx["assert:equals:"]=4;
  68319. //>>excludeEnd("ctx");
  68320. _st(jsObject)._a_("");
  68321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68322. $ctx1.sendIdx["a:"]=4;
  68323. //>>excludeEnd("ctx");
  68324. $5=_st(jsObject)._a();
  68325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68326. $ctx1.sendIdx["a"]=5;
  68327. //>>excludeEnd("ctx");
  68328. self._assert_equals_($5,"");
  68329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68330. $ctx1.sendIdx["assert:equals:"]=5;
  68331. //>>excludeEnd("ctx");
  68332. _st(jsObject)._a_(false);
  68333. self._assert_equals_(_st(jsObject)._a(),false);
  68334. return self;
  68335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68336. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},globals.JSObjectProxyTest)});
  68337. //>>excludeEnd("ctx");
  68338. },
  68339. //>>excludeStart("ide", pragmas.excludeIdeData);
  68340. args: [],
  68341. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  68342. referencedClasses: [],
  68343. //>>excludeEnd("ide");
  68344. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  68345. }),
  68346. globals.JSObjectProxyTest);
  68347. smalltalk.addMethod(
  68348. smalltalk.method({
  68349. selector: "testValue",
  68350. protocol: 'tests',
  68351. fn: function (){
  68352. var self=this;
  68353. var testObject;
  68354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68355. return smalltalk.withContext(function($ctx1) {
  68356. //>>excludeEnd("ctx");
  68357. testObject=self._jsObject();
  68358. _st(testObject)._at_put_("value","aValue");
  68359. self._assert_equals_(_st(testObject)._value(),"aValue");
  68360. return self;
  68361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68362. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)});
  68363. //>>excludeEnd("ctx");
  68364. },
  68365. //>>excludeStart("ide", pragmas.excludeIdeData);
  68366. args: [],
  68367. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  68368. referencedClasses: [],
  68369. //>>excludeEnd("ide");
  68370. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  68371. }),
  68372. globals.JSObjectProxyTest);
  68373. smalltalk.addMethod(
  68374. smalltalk.method({
  68375. selector: "testYourself",
  68376. protocol: 'tests',
  68377. fn: function (){
  68378. var self=this;
  68379. var object;
  68380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68381. return smalltalk.withContext(function($ctx1) {
  68382. //>>excludeEnd("ctx");
  68383. var $1,$2;
  68384. $1=self._jsObject();
  68385. _st($1)._d_("test");
  68386. $2=_st($1)._yourself();
  68387. object=$2;
  68388. self._assert_equals_(_st(object)._d(),"test");
  68389. return self;
  68390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68391. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)});
  68392. //>>excludeEnd("ctx");
  68393. },
  68394. //>>excludeStart("ide", pragmas.excludeIdeData);
  68395. args: [],
  68396. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  68397. referencedClasses: [],
  68398. //>>excludeEnd("ide");
  68399. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  68400. }),
  68401. globals.JSObjectProxyTest);
  68402. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  68403. smalltalk.addMethod(
  68404. smalltalk.method({
  68405. selector: "testCatchingException",
  68406. protocol: 'tests',
  68407. fn: function (){
  68408. var self=this;
  68409. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  68410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68411. return smalltalk.withContext(function($ctx1) {
  68412. //>>excludeEnd("ctx");
  68413. _st((function(){
  68414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68415. return smalltalk.withContext(function($ctx2) {
  68416. //>>excludeEnd("ctx");
  68417. return self._throwException();
  68418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68420. //>>excludeEnd("ctx");
  68421. }))._on_do_($Error(),(function(error){
  68422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68423. return smalltalk.withContext(function($ctx2) {
  68424. //>>excludeEnd("ctx");
  68425. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  68426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68427. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  68428. //>>excludeEnd("ctx");
  68429. }));
  68430. return self;
  68431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68432. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)});
  68433. //>>excludeEnd("ctx");
  68434. },
  68435. //>>excludeStart("ide", pragmas.excludeIdeData);
  68436. args: [],
  68437. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  68438. referencedClasses: ["Error"],
  68439. //>>excludeEnd("ide");
  68440. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  68441. }),
  68442. globals.JavaScriptExceptionTest);
  68443. smalltalk.addMethod(
  68444. smalltalk.method({
  68445. selector: "testRaisingException",
  68446. protocol: 'tests',
  68447. fn: function (){
  68448. var self=this;
  68449. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  68450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68451. return smalltalk.withContext(function($ctx1) {
  68452. //>>excludeEnd("ctx");
  68453. self._should_raise_((function(){
  68454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68455. return smalltalk.withContext(function($ctx2) {
  68456. //>>excludeEnd("ctx");
  68457. return self._throwException();
  68458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68460. //>>excludeEnd("ctx");
  68461. }),$JavaScriptException());
  68462. return self;
  68463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68464. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)});
  68465. //>>excludeEnd("ctx");
  68466. },
  68467. //>>excludeStart("ide", pragmas.excludeIdeData);
  68468. args: [],
  68469. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  68470. referencedClasses: ["JavaScriptException"],
  68471. //>>excludeEnd("ide");
  68472. messageSends: ["should:raise:", "throwException"]
  68473. }),
  68474. globals.JavaScriptExceptionTest);
  68475. smalltalk.addMethod(
  68476. smalltalk.method({
  68477. selector: "throwException",
  68478. protocol: 'helpers',
  68479. fn: function (){
  68480. var self=this;
  68481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68482. return smalltalk.withContext(function($ctx1) {
  68483. //>>excludeEnd("ctx");
  68484. throw 'test';
  68485. return self;
  68486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68487. }, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)});
  68488. //>>excludeEnd("ctx");
  68489. },
  68490. //>>excludeStart("ide", pragmas.excludeIdeData);
  68491. args: [],
  68492. source: "throwException\x0a\x09<throw 'test'>",
  68493. referencedClasses: [],
  68494. //>>excludeEnd("ide");
  68495. messageSends: []
  68496. }),
  68497. globals.JavaScriptExceptionTest);
  68498. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  68499. smalltalk.addMethod(
  68500. smalltalk.method({
  68501. selector: "testValue",
  68502. protocol: 'tests',
  68503. fn: function (){
  68504. var self=this;
  68505. var messageSend;
  68506. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  68507. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  68508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68509. return smalltalk.withContext(function($ctx1) {
  68510. //>>excludeEnd("ctx");
  68511. var $1,$2;
  68512. $1=_st($MessageSend())._new();
  68513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68514. $ctx1.sendIdx["new"]=1;
  68515. //>>excludeEnd("ctx");
  68516. _st($1)._receiver_(_st($Object())._new());
  68517. _st($1)._selector_("asString");
  68518. $2=_st($1)._yourself();
  68519. messageSend=$2;
  68520. self._assert_equals_(_st(messageSend)._value(),"an Object");
  68521. return self;
  68522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68523. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)});
  68524. //>>excludeEnd("ctx");
  68525. },
  68526. //>>excludeStart("ide", pragmas.excludeIdeData);
  68527. args: [],
  68528. source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'",
  68529. referencedClasses: ["MessageSend", "Object"],
  68530. //>>excludeEnd("ide");
  68531. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  68532. }),
  68533. globals.MessageSendTest);
  68534. smalltalk.addMethod(
  68535. smalltalk.method({
  68536. selector: "testValueWithArguments",
  68537. protocol: 'tests',
  68538. fn: function (){
  68539. var self=this;
  68540. var messageSend;
  68541. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  68542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68543. return smalltalk.withContext(function($ctx1) {
  68544. //>>excludeEnd("ctx");
  68545. var $1,$2;
  68546. $1=_st($MessageSend())._new();
  68547. _st($1)._receiver_((2));
  68548. _st($1)._selector_("+");
  68549. $2=_st($1)._yourself();
  68550. messageSend=$2;
  68551. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  68552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68553. $ctx1.sendIdx["assert:equals:"]=1;
  68554. //>>excludeEnd("ctx");
  68555. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  68556. return self;
  68557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68558. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)});
  68559. //>>excludeEnd("ctx");
  68560. },
  68561. //>>excludeStart("ide", pragmas.excludeIdeData);
  68562. args: [],
  68563. source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6",
  68564. referencedClasses: ["MessageSend"],
  68565. //>>excludeEnd("ide");
  68566. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  68567. }),
  68568. globals.MessageSendTest);
  68569. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  68570. smalltalk.addMethod(
  68571. smalltalk.method({
  68572. selector: "codeGeneratorClass",
  68573. protocol: 'accessing',
  68574. fn: function (){
  68575. var self=this;
  68576. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  68577. return $CodeGenerator();
  68578. },
  68579. //>>excludeStart("ide", pragmas.excludeIdeData);
  68580. args: [],
  68581. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  68582. referencedClasses: ["CodeGenerator"],
  68583. //>>excludeEnd("ide");
  68584. messageSends: []
  68585. }),
  68586. globals.MethodInheritanceTest);
  68587. smalltalk.addMethod(
  68588. smalltalk.method({
  68589. selector: "compiler",
  68590. protocol: 'factory',
  68591. fn: function (){
  68592. var self=this;
  68593. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  68594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68595. return smalltalk.withContext(function($ctx1) {
  68596. //>>excludeEnd("ctx");
  68597. var $2,$3,$1;
  68598. $2=_st($Compiler())._new();
  68599. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  68600. $3=_st($2)._yourself();
  68601. $1=$3;
  68602. return $1;
  68603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68604. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)});
  68605. //>>excludeEnd("ctx");
  68606. },
  68607. //>>excludeStart("ide", pragmas.excludeIdeData);
  68608. args: [],
  68609. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  68610. referencedClasses: ["Compiler"],
  68611. //>>excludeEnd("ide");
  68612. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  68613. }),
  68614. globals.MethodInheritanceTest);
  68615. smalltalk.addMethod(
  68616. smalltalk.method({
  68617. selector: "deinstallBottom",
  68618. protocol: 'testing',
  68619. fn: function (){
  68620. var self=this;
  68621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68622. return smalltalk.withContext(function($ctx1) {
  68623. //>>excludeEnd("ctx");
  68624. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  68625. return self;
  68626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68627. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)});
  68628. //>>excludeEnd("ctx");
  68629. },
  68630. //>>excludeStart("ide", pragmas.excludeIdeData);
  68631. args: [],
  68632. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  68633. referencedClasses: [],
  68634. //>>excludeEnd("ide");
  68635. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  68636. }),
  68637. globals.MethodInheritanceTest);
  68638. smalltalk.addMethod(
  68639. smalltalk.method({
  68640. selector: "deinstallMiddle",
  68641. protocol: 'testing',
  68642. fn: function (){
  68643. var self=this;
  68644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68645. return smalltalk.withContext(function($ctx1) {
  68646. //>>excludeEnd("ctx");
  68647. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  68648. return self;
  68649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68650. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)});
  68651. //>>excludeEnd("ctx");
  68652. },
  68653. //>>excludeStart("ide", pragmas.excludeIdeData);
  68654. args: [],
  68655. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  68656. referencedClasses: [],
  68657. //>>excludeEnd("ide");
  68658. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  68659. }),
  68660. globals.MethodInheritanceTest);
  68661. smalltalk.addMethod(
  68662. smalltalk.method({
  68663. selector: "deinstallTop",
  68664. protocol: 'testing',
  68665. fn: function (){
  68666. var self=this;
  68667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68668. return smalltalk.withContext(function($ctx1) {
  68669. //>>excludeEnd("ctx");
  68670. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  68671. return self;
  68672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68673. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)});
  68674. //>>excludeEnd("ctx");
  68675. },
  68676. //>>excludeStart("ide", pragmas.excludeIdeData);
  68677. args: [],
  68678. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  68679. referencedClasses: [],
  68680. //>>excludeEnd("ide");
  68681. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  68682. }),
  68683. globals.MethodInheritanceTest);
  68684. smalltalk.addMethod(
  68685. smalltalk.method({
  68686. selector: "installBottom:",
  68687. protocol: 'testing',
  68688. fn: function (aString){
  68689. var self=this;
  68690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68691. return smalltalk.withContext(function($ctx1) {
  68692. //>>excludeEnd("ctx");
  68693. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  68694. return self;
  68695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68696. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)});
  68697. //>>excludeEnd("ctx");
  68698. },
  68699. //>>excludeStart("ide", pragmas.excludeIdeData);
  68700. args: ["aString"],
  68701. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  68702. referencedClasses: [],
  68703. //>>excludeEnd("ide");
  68704. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  68705. }),
  68706. globals.MethodInheritanceTest);
  68707. smalltalk.addMethod(
  68708. smalltalk.method({
  68709. selector: "installMiddle:",
  68710. protocol: 'testing',
  68711. fn: function (aString){
  68712. var self=this;
  68713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68714. return smalltalk.withContext(function($ctx1) {
  68715. //>>excludeEnd("ctx");
  68716. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  68717. return self;
  68718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68719. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)});
  68720. //>>excludeEnd("ctx");
  68721. },
  68722. //>>excludeStart("ide", pragmas.excludeIdeData);
  68723. args: ["aString"],
  68724. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  68725. referencedClasses: [],
  68726. //>>excludeEnd("ide");
  68727. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  68728. }),
  68729. globals.MethodInheritanceTest);
  68730. smalltalk.addMethod(
  68731. smalltalk.method({
  68732. selector: "installTop:",
  68733. protocol: 'testing',
  68734. fn: function (aString){
  68735. var self=this;
  68736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68737. return smalltalk.withContext(function($ctx1) {
  68738. //>>excludeEnd("ctx");
  68739. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  68740. return self;
  68741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68742. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)});
  68743. //>>excludeEnd("ctx");
  68744. },
  68745. //>>excludeStart("ide", pragmas.excludeIdeData);
  68746. args: ["aString"],
  68747. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  68748. referencedClasses: [],
  68749. //>>excludeEnd("ide");
  68750. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  68751. }),
  68752. globals.MethodInheritanceTest);
  68753. smalltalk.addMethod(
  68754. smalltalk.method({
  68755. selector: "setUp",
  68756. protocol: 'initialization',
  68757. fn: function (){
  68758. var self=this;
  68759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68760. return smalltalk.withContext(function($ctx1) {
  68761. //>>excludeEnd("ctx");
  68762. self["@receiverTop"]=_st(self._targetClassTop())._new();
  68763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68764. $ctx1.sendIdx["new"]=1;
  68765. //>>excludeEnd("ctx");
  68766. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  68767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68768. $ctx1.sendIdx["new"]=2;
  68769. //>>excludeEnd("ctx");
  68770. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  68771. self["@method"]=nil;
  68772. self["@performBlock"]=(function(){
  68773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68774. return smalltalk.withContext(function($ctx2) {
  68775. //>>excludeEnd("ctx");
  68776. return self._error_("performBlock not initialized");
  68777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68779. //>>excludeEnd("ctx");
  68780. });
  68781. return self;
  68782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68783. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)});
  68784. //>>excludeEnd("ctx");
  68785. },
  68786. //>>excludeStart("ide", pragmas.excludeIdeData);
  68787. args: [],
  68788. source: "setUp\x0a\x09receiverTop := self targetClassTop new.\x0a\x09receiverMiddle := self targetClassMiddle new.\x0a\x09receiverBottom := self targetClassBottom new.\x0a\x09method := nil.\x0a\x09performBlock := [ self error: 'performBlock not initialized' ]",
  68789. referencedClasses: [],
  68790. //>>excludeEnd("ide");
  68791. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  68792. }),
  68793. globals.MethodInheritanceTest);
  68794. smalltalk.addMethod(
  68795. smalltalk.method({
  68796. selector: "shouldMNU",
  68797. protocol: 'testing',
  68798. fn: function (){
  68799. var self=this;
  68800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68801. return smalltalk.withContext(function($ctx1) {
  68802. //>>excludeEnd("ctx");
  68803. self._shouldMNUTop();
  68804. self._shouldMNUMiddle();
  68805. self._shouldMNUBottom();
  68806. return self;
  68807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68808. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)});
  68809. //>>excludeEnd("ctx");
  68810. },
  68811. //>>excludeStart("ide", pragmas.excludeIdeData);
  68812. args: [],
  68813. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  68814. referencedClasses: [],
  68815. //>>excludeEnd("ide");
  68816. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  68817. }),
  68818. globals.MethodInheritanceTest);
  68819. smalltalk.addMethod(
  68820. smalltalk.method({
  68821. selector: "shouldMNUBottom",
  68822. protocol: 'testing',
  68823. fn: function (){
  68824. var self=this;
  68825. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  68826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68827. return smalltalk.withContext(function($ctx1) {
  68828. //>>excludeEnd("ctx");
  68829. self._should_raise_((function(){
  68830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68831. return smalltalk.withContext(function($ctx2) {
  68832. //>>excludeEnd("ctx");
  68833. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  68834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68836. //>>excludeEnd("ctx");
  68837. }),$MessageNotUnderstood());
  68838. return self;
  68839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68840. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)});
  68841. //>>excludeEnd("ctx");
  68842. },
  68843. //>>excludeStart("ide", pragmas.excludeIdeData);
  68844. args: [],
  68845. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  68846. referencedClasses: ["MessageNotUnderstood"],
  68847. //>>excludeEnd("ide");
  68848. messageSends: ["should:raise:", "value:"]
  68849. }),
  68850. globals.MethodInheritanceTest);
  68851. smalltalk.addMethod(
  68852. smalltalk.method({
  68853. selector: "shouldMNUMiddle",
  68854. protocol: 'testing',
  68855. fn: function (){
  68856. var self=this;
  68857. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  68858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68859. return smalltalk.withContext(function($ctx1) {
  68860. //>>excludeEnd("ctx");
  68861. self._should_raise_((function(){
  68862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68863. return smalltalk.withContext(function($ctx2) {
  68864. //>>excludeEnd("ctx");
  68865. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  68866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68868. //>>excludeEnd("ctx");
  68869. }),$MessageNotUnderstood());
  68870. return self;
  68871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68872. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)});
  68873. //>>excludeEnd("ctx");
  68874. },
  68875. //>>excludeStart("ide", pragmas.excludeIdeData);
  68876. args: [],
  68877. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  68878. referencedClasses: ["MessageNotUnderstood"],
  68879. //>>excludeEnd("ide");
  68880. messageSends: ["should:raise:", "value:"]
  68881. }),
  68882. globals.MethodInheritanceTest);
  68883. smalltalk.addMethod(
  68884. smalltalk.method({
  68885. selector: "shouldMNUTop",
  68886. protocol: 'testing',
  68887. fn: function (){
  68888. var self=this;
  68889. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  68890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68891. return smalltalk.withContext(function($ctx1) {
  68892. //>>excludeEnd("ctx");
  68893. self._should_raise_((function(){
  68894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68895. return smalltalk.withContext(function($ctx2) {
  68896. //>>excludeEnd("ctx");
  68897. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  68898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68900. //>>excludeEnd("ctx");
  68901. }),$MessageNotUnderstood());
  68902. return self;
  68903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68904. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)});
  68905. //>>excludeEnd("ctx");
  68906. },
  68907. //>>excludeStart("ide", pragmas.excludeIdeData);
  68908. args: [],
  68909. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  68910. referencedClasses: ["MessageNotUnderstood"],
  68911. //>>excludeEnd("ide");
  68912. messageSends: ["should:raise:", "value:"]
  68913. }),
  68914. globals.MethodInheritanceTest);
  68915. smalltalk.addMethod(
  68916. smalltalk.method({
  68917. selector: "shouldReturn:",
  68918. protocol: 'testing',
  68919. fn: function (anObject){
  68920. var self=this;
  68921. var result;
  68922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68923. return smalltalk.withContext(function($ctx1) {
  68924. //>>excludeEnd("ctx");
  68925. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  68926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68927. $ctx1.sendIdx["value:"]=1;
  68928. //>>excludeEnd("ctx");
  68929. self._assert_equals_(["top",anObject],["top",result]);
  68930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68931. $ctx1.sendIdx["assert:equals:"]=1;
  68932. //>>excludeEnd("ctx");
  68933. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  68934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68935. $ctx1.sendIdx["value:"]=2;
  68936. //>>excludeEnd("ctx");
  68937. self._assert_equals_(["middle",anObject],["middle",result]);
  68938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68939. $ctx1.sendIdx["assert:equals:"]=2;
  68940. //>>excludeEnd("ctx");
  68941. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  68942. self._assert_equals_(["bottom",anObject],["bottom",result]);
  68943. return self;
  68944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68945. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)});
  68946. //>>excludeEnd("ctx");
  68947. },
  68948. //>>excludeStart("ide", pragmas.excludeIdeData);
  68949. args: ["anObject"],
  68950. source: "shouldReturn: anObject\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject } equals: { 'bottom'. result }",
  68951. referencedClasses: [],
  68952. //>>excludeEnd("ide");
  68953. messageSends: ["value:", "assert:equals:"]
  68954. }),
  68955. globals.MethodInheritanceTest);
  68956. smalltalk.addMethod(
  68957. smalltalk.method({
  68958. selector: "shouldReturn:and:and:",
  68959. protocol: 'testing',
  68960. fn: function (anObject,anObject2,anObject3){
  68961. var self=this;
  68962. var result;
  68963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68964. return smalltalk.withContext(function($ctx1) {
  68965. //>>excludeEnd("ctx");
  68966. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  68967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68968. $ctx1.sendIdx["value:"]=1;
  68969. //>>excludeEnd("ctx");
  68970. self._assert_equals_(["top",anObject],["top",result]);
  68971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68972. $ctx1.sendIdx["assert:equals:"]=1;
  68973. //>>excludeEnd("ctx");
  68974. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  68975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68976. $ctx1.sendIdx["value:"]=2;
  68977. //>>excludeEnd("ctx");
  68978. self._assert_equals_(["middle",anObject2],["middle",result]);
  68979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68980. $ctx1.sendIdx["assert:equals:"]=2;
  68981. //>>excludeEnd("ctx");
  68982. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  68983. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  68984. return self;
  68985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68986. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)});
  68987. //>>excludeEnd("ctx");
  68988. },
  68989. //>>excludeStart("ide", pragmas.excludeIdeData);
  68990. args: ["anObject", "anObject2", "anObject3"],
  68991. source: "shouldReturn: anObject and: anObject2 and: anObject3\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject2 } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject3 } equals: { 'bottom'. result }",
  68992. referencedClasses: [],
  68993. //>>excludeEnd("ide");
  68994. messageSends: ["value:", "assert:equals:"]
  68995. }),
  68996. globals.MethodInheritanceTest);
  68997. smalltalk.addMethod(
  68998. smalltalk.method({
  68999. selector: "targetClassBottom",
  69000. protocol: 'accessing',
  69001. fn: function (){
  69002. var self=this;
  69003. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  69004. return $JavaScriptException();
  69005. },
  69006. //>>excludeStart("ide", pragmas.excludeIdeData);
  69007. args: [],
  69008. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  69009. referencedClasses: ["JavaScriptException"],
  69010. //>>excludeEnd("ide");
  69011. messageSends: []
  69012. }),
  69013. globals.MethodInheritanceTest);
  69014. smalltalk.addMethod(
  69015. smalltalk.method({
  69016. selector: "targetClassMiddle",
  69017. protocol: 'accessing',
  69018. fn: function (){
  69019. var self=this;
  69020. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  69021. return $Error();
  69022. },
  69023. //>>excludeStart("ide", pragmas.excludeIdeData);
  69024. args: [],
  69025. source: "targetClassMiddle\x0a\x09^ Error",
  69026. referencedClasses: ["Error"],
  69027. //>>excludeEnd("ide");
  69028. messageSends: []
  69029. }),
  69030. globals.MethodInheritanceTest);
  69031. smalltalk.addMethod(
  69032. smalltalk.method({
  69033. selector: "targetClassTop",
  69034. protocol: 'accessing',
  69035. fn: function (){
  69036. var self=this;
  69037. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  69038. return $Object();
  69039. },
  69040. //>>excludeStart("ide", pragmas.excludeIdeData);
  69041. args: [],
  69042. source: "targetClassTop\x0a\x09^ Object",
  69043. referencedClasses: ["Object"],
  69044. //>>excludeEnd("ide");
  69045. messageSends: []
  69046. }),
  69047. globals.MethodInheritanceTest);
  69048. smalltalk.addMethod(
  69049. smalltalk.method({
  69050. selector: "tearDown",
  69051. protocol: 'initialization',
  69052. fn: function (){
  69053. var self=this;
  69054. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  69055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69056. return smalltalk.withContext(function($ctx1) {
  69057. //>>excludeEnd("ctx");
  69058. _st((function(){
  69059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69060. return smalltalk.withContext(function($ctx2) {
  69061. //>>excludeEnd("ctx");
  69062. return self._deinstallTop();
  69063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  69065. //>>excludeEnd("ctx");
  69066. }))._on_do_($Error(),(function(){
  69067. }));
  69068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69069. $ctx1.sendIdx["on:do:"]=1;
  69070. //>>excludeEnd("ctx");
  69071. _st((function(){
  69072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69073. return smalltalk.withContext(function($ctx2) {
  69074. //>>excludeEnd("ctx");
  69075. return self._deinstallMiddle();
  69076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  69078. //>>excludeEnd("ctx");
  69079. }))._on_do_($Error(),(function(){
  69080. }));
  69081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69082. $ctx1.sendIdx["on:do:"]=2;
  69083. //>>excludeEnd("ctx");
  69084. _st((function(){
  69085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69086. return smalltalk.withContext(function($ctx2) {
  69087. //>>excludeEnd("ctx");
  69088. return self._deinstallBottom();
  69089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  69091. //>>excludeEnd("ctx");
  69092. }))._on_do_($Error(),(function(){
  69093. }));
  69094. return self;
  69095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69096. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)});
  69097. //>>excludeEnd("ctx");
  69098. },
  69099. //>>excludeStart("ide", pragmas.excludeIdeData);
  69100. args: [],
  69101. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  69102. referencedClasses: ["Error"],
  69103. //>>excludeEnd("ide");
  69104. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  69105. }),
  69106. globals.MethodInheritanceTest);
  69107. smalltalk.addMethod(
  69108. smalltalk.method({
  69109. selector: "testMNU11",
  69110. protocol: 'tests',
  69111. fn: function (){
  69112. var self=this;
  69113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69114. return smalltalk.withContext(function($ctx1) {
  69115. //>>excludeEnd("ctx");
  69116. self["@performBlock"]=(function(x){
  69117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69118. return smalltalk.withContext(function($ctx2) {
  69119. //>>excludeEnd("ctx");
  69120. return _st(x)._foo();
  69121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69122. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  69123. //>>excludeEnd("ctx");
  69124. });
  69125. self._shouldMNU();
  69126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69127. $ctx1.sendIdx["shouldMNU"]=1;
  69128. //>>excludeEnd("ctx");
  69129. self._installTop_("foo ^ false");
  69130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69131. $ctx1.sendIdx["installTop:"]=1;
  69132. //>>excludeEnd("ctx");
  69133. self._installTop_("foo ^ true");
  69134. self._deinstallTop();
  69135. self._shouldMNU();
  69136. return self;
  69137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69138. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)});
  69139. //>>excludeEnd("ctx");
  69140. },
  69141. //>>excludeStart("ide", pragmas.excludeIdeData);
  69142. args: [],
  69143. source: "testMNU11\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self deinstallTop.\x0a\x09self shouldMNU",
  69144. referencedClasses: [],
  69145. //>>excludeEnd("ide");
  69146. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  69147. }),
  69148. globals.MethodInheritanceTest);
  69149. smalltalk.addMethod(
  69150. smalltalk.method({
  69151. selector: "testMNU22",
  69152. protocol: 'tests',
  69153. fn: function (){
  69154. var self=this;
  69155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69156. return smalltalk.withContext(function($ctx1) {
  69157. //>>excludeEnd("ctx");
  69158. self["@performBlock"]=(function(x){
  69159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69160. return smalltalk.withContext(function($ctx2) {
  69161. //>>excludeEnd("ctx");
  69162. return _st(x)._foo();
  69163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69164. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  69165. //>>excludeEnd("ctx");
  69166. });
  69167. self._shouldMNU();
  69168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69169. $ctx1.sendIdx["shouldMNU"]=1;
  69170. //>>excludeEnd("ctx");
  69171. self._installMiddle_("foo ^ false");
  69172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69173. $ctx1.sendIdx["installMiddle:"]=1;
  69174. //>>excludeEnd("ctx");
  69175. self._installMiddle_("foo ^ true");
  69176. self._deinstallMiddle();
  69177. self._shouldMNU();
  69178. return self;
  69179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69180. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)});
  69181. //>>excludeEnd("ctx");
  69182. },
  69183. //>>excludeStart("ide", pragmas.excludeIdeData);
  69184. args: [],
  69185. source: "testMNU22\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installMiddle: 'foo ^ false'.\x0a\x09self installMiddle: 'foo ^ true'.\x0a\x09self deinstallMiddle.\x0a\x09self shouldMNU",
  69186. referencedClasses: [],
  69187. //>>excludeEnd("ide");
  69188. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  69189. }),
  69190. globals.MethodInheritanceTest);
  69191. smalltalk.addMethod(
  69192. smalltalk.method({
  69193. selector: "testReturns1",
  69194. protocol: 'tests',
  69195. fn: function (){
  69196. var self=this;
  69197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69198. return smalltalk.withContext(function($ctx1) {
  69199. //>>excludeEnd("ctx");
  69200. self["@performBlock"]=(function(x){
  69201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69202. return smalltalk.withContext(function($ctx2) {
  69203. //>>excludeEnd("ctx");
  69204. return _st(x)._foo();
  69205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69206. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  69207. //>>excludeEnd("ctx");
  69208. });
  69209. self._installTop_("foo ^ false");
  69210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69211. $ctx1.sendIdx["installTop:"]=1;
  69212. //>>excludeEnd("ctx");
  69213. self._shouldReturn_(false);
  69214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69215. $ctx1.sendIdx["shouldReturn:"]=1;
  69216. //>>excludeEnd("ctx");
  69217. self._installTop_("foo ^ true");
  69218. self._shouldReturn_(true);
  69219. return self;
  69220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69221. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)});
  69222. //>>excludeEnd("ctx");
  69223. },
  69224. //>>excludeStart("ide", pragmas.excludeIdeData);
  69225. args: [],
  69226. source: "testReturns1\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self shouldReturn: false.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self shouldReturn: true",
  69227. referencedClasses: [],
  69228. //>>excludeEnd("ide");
  69229. messageSends: ["foo", "installTop:", "shouldReturn:"]
  69230. }),
  69231. globals.MethodInheritanceTest);
  69232. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  69233. smalltalk.addMethod(
  69234. smalltalk.method({
  69235. selector: "testAbs",
  69236. protocol: 'tests',
  69237. fn: function (){
  69238. var self=this;
  69239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69240. return smalltalk.withContext(function($ctx1) {
  69241. //>>excludeEnd("ctx");
  69242. var $1;
  69243. $1=(4)._abs();
  69244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69245. $ctx1.sendIdx["abs"]=1;
  69246. //>>excludeEnd("ctx");
  69247. self._assert_equals_($1,(4));
  69248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69249. $ctx1.sendIdx["assert:equals:"]=1;
  69250. //>>excludeEnd("ctx");
  69251. self._assert_equals_((-4)._abs(),(4));
  69252. return self;
  69253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69254. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)});
  69255. //>>excludeEnd("ctx");
  69256. },
  69257. //>>excludeStart("ide", pragmas.excludeIdeData);
  69258. args: [],
  69259. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  69260. referencedClasses: [],
  69261. //>>excludeEnd("ide");
  69262. messageSends: ["assert:equals:", "abs"]
  69263. }),
  69264. globals.NumberTest);
  69265. smalltalk.addMethod(
  69266. smalltalk.method({
  69267. selector: "testArithmetic",
  69268. protocol: 'tests',
  69269. fn: function (){
  69270. var self=this;
  69271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69272. return smalltalk.withContext(function($ctx1) {
  69273. //>>excludeEnd("ctx");
  69274. var $1,$2,$3,$5,$4;
  69275. $1=(1.5).__plus((1));
  69276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69277. $ctx1.sendIdx["+"]=1;
  69278. //>>excludeEnd("ctx");
  69279. self._assert_equals_($1,(2.5));
  69280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69281. $ctx1.sendIdx["assert:equals:"]=1;
  69282. //>>excludeEnd("ctx");
  69283. $2=(2).__minus((1));
  69284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69285. $ctx1.sendIdx["-"]=1;
  69286. //>>excludeEnd("ctx");
  69287. self._assert_equals_($2,(1));
  69288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69289. $ctx1.sendIdx["assert:equals:"]=2;
  69290. //>>excludeEnd("ctx");
  69291. self._assert_equals_((-2).__minus((1)),(-3));
  69292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69293. $ctx1.sendIdx["assert:equals:"]=3;
  69294. //>>excludeEnd("ctx");
  69295. self._assert_equals_((12).__slash((2)),(6));
  69296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69297. $ctx1.sendIdx["assert:equals:"]=4;
  69298. //>>excludeEnd("ctx");
  69299. $3=(3).__star((4));
  69300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69301. $ctx1.sendIdx["*"]=1;
  69302. //>>excludeEnd("ctx");
  69303. self._assert_equals_($3,(12));
  69304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69305. $ctx1.sendIdx["assert:equals:"]=5;
  69306. //>>excludeEnd("ctx");
  69307. self._assert_equals_((7).__slash_slash((2)),(3));
  69308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69309. $ctx1.sendIdx["assert:equals:"]=6;
  69310. //>>excludeEnd("ctx");
  69311. self._assert_equals_((7).__backslash_backslash((2)),(1));
  69312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69313. $ctx1.sendIdx["assert:equals:"]=7;
  69314. //>>excludeEnd("ctx");
  69315. $5=(1).__plus((2));
  69316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69317. $ctx1.sendIdx["+"]=2;
  69318. //>>excludeEnd("ctx");
  69319. $4=_st($5).__star((3));
  69320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69321. $ctx1.sendIdx["*"]=2;
  69322. //>>excludeEnd("ctx");
  69323. self._assert_equals_($4,(9));
  69324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69325. $ctx1.sendIdx["assert:equals:"]=8;
  69326. //>>excludeEnd("ctx");
  69327. self._assert_equals_((1).__plus((2).__star((3))),(7));
  69328. return self;
  69329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69330. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)});
  69331. //>>excludeEnd("ctx");
  69332. },
  69333. //>>excludeStart("ide", pragmas.excludeIdeData);
  69334. args: [],
  69335. source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if\x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  69336. referencedClasses: [],
  69337. //>>excludeEnd("ide");
  69338. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  69339. }),
  69340. globals.NumberTest);
  69341. smalltalk.addMethod(
  69342. smalltalk.method({
  69343. selector: "testAsNumber",
  69344. protocol: 'tests',
  69345. fn: function (){
  69346. var self=this;
  69347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69348. return smalltalk.withContext(function($ctx1) {
  69349. //>>excludeEnd("ctx");
  69350. self._assert_equals_((3)._asNumber(),(3));
  69351. return self;
  69352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69353. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)});
  69354. //>>excludeEnd("ctx");
  69355. },
  69356. //>>excludeStart("ide", pragmas.excludeIdeData);
  69357. args: [],
  69358. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  69359. referencedClasses: [],
  69360. //>>excludeEnd("ide");
  69361. messageSends: ["assert:equals:", "asNumber"]
  69362. }),
  69363. globals.NumberTest);
  69364. smalltalk.addMethod(
  69365. smalltalk.method({
  69366. selector: "testCeiling",
  69367. protocol: 'tests',
  69368. fn: function (){
  69369. var self=this;
  69370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69371. return smalltalk.withContext(function($ctx1) {
  69372. //>>excludeEnd("ctx");
  69373. var $1,$2;
  69374. $1=(1.2)._ceiling();
  69375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69376. $ctx1.sendIdx["ceiling"]=1;
  69377. //>>excludeEnd("ctx");
  69378. self._assert_equals_($1,(2));
  69379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69380. $ctx1.sendIdx["assert:equals:"]=1;
  69381. //>>excludeEnd("ctx");
  69382. $2=(-1.2)._ceiling();
  69383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69384. $ctx1.sendIdx["ceiling"]=2;
  69385. //>>excludeEnd("ctx");
  69386. self._assert_equals_($2,(-1));
  69387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69388. $ctx1.sendIdx["assert:equals:"]=2;
  69389. //>>excludeEnd("ctx");
  69390. self._assert_equals_((1)._ceiling(),(1));
  69391. return self;
  69392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69393. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)});
  69394. //>>excludeEnd("ctx");
  69395. },
  69396. //>>excludeStart("ide", pragmas.excludeIdeData);
  69397. args: [],
  69398. source: "testCeiling\x0a\x09self assert: 1.2 ceiling equals: 2.\x0a\x09self assert: -1.2 ceiling equals: -1.\x0a\x09self assert: 1.0 ceiling equals: 1.",
  69399. referencedClasses: [],
  69400. //>>excludeEnd("ide");
  69401. messageSends: ["assert:equals:", "ceiling"]
  69402. }),
  69403. globals.NumberTest);
  69404. smalltalk.addMethod(
  69405. smalltalk.method({
  69406. selector: "testComparison",
  69407. protocol: 'tests',
  69408. fn: function (){
  69409. var self=this;
  69410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69411. return smalltalk.withContext(function($ctx1) {
  69412. //>>excludeEnd("ctx");
  69413. var $1,$2,$3,$4;
  69414. $1=(3).__gt((2));
  69415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69416. $ctx1.sendIdx[">"]=1;
  69417. //>>excludeEnd("ctx");
  69418. self._assert_($1);
  69419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69420. $ctx1.sendIdx["assert:"]=1;
  69421. //>>excludeEnd("ctx");
  69422. $2=(2).__lt((3));
  69423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69424. $ctx1.sendIdx["<"]=1;
  69425. //>>excludeEnd("ctx");
  69426. self._assert_($2);
  69427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69428. $ctx1.sendIdx["assert:"]=2;
  69429. //>>excludeEnd("ctx");
  69430. self._deny_((3).__lt((2)));
  69431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69432. $ctx1.sendIdx["deny:"]=1;
  69433. //>>excludeEnd("ctx");
  69434. self._deny_((2).__gt((3)));
  69435. $3=(3).__gt_eq((3));
  69436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69437. $ctx1.sendIdx[">="]=1;
  69438. //>>excludeEnd("ctx");
  69439. self._assert_($3);
  69440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69441. $ctx1.sendIdx["assert:"]=3;
  69442. //>>excludeEnd("ctx");
  69443. self._assert_((3.1).__gt_eq((3)));
  69444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69445. $ctx1.sendIdx["assert:"]=4;
  69446. //>>excludeEnd("ctx");
  69447. $4=(3).__lt_eq((3));
  69448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69449. $ctx1.sendIdx["<="]=1;
  69450. //>>excludeEnd("ctx");
  69451. self._assert_($4);
  69452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69453. $ctx1.sendIdx["assert:"]=5;
  69454. //>>excludeEnd("ctx");
  69455. self._assert_((3).__lt_eq((3.1)));
  69456. return self;
  69457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69458. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)});
  69459. //>>excludeEnd("ctx");
  69460. },
  69461. //>>excludeStart("ide", pragmas.excludeIdeData);
  69462. args: [],
  69463. source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1",
  69464. referencedClasses: [],
  69465. //>>excludeEnd("ide");
  69466. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  69467. }),
  69468. globals.NumberTest);
  69469. smalltalk.addMethod(
  69470. smalltalk.method({
  69471. selector: "testCopying",
  69472. protocol: 'tests',
  69473. fn: function (){
  69474. var self=this;
  69475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69476. return smalltalk.withContext(function($ctx1) {
  69477. //>>excludeEnd("ctx");
  69478. var $1;
  69479. $1=_st((1)._copy()).__eq_eq((1));
  69480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69481. $ctx1.sendIdx["=="]=1;
  69482. //>>excludeEnd("ctx");
  69483. self._assert_($1);
  69484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69485. $ctx1.sendIdx["assert:"]=1;
  69486. //>>excludeEnd("ctx");
  69487. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  69488. return self;
  69489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69490. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)});
  69491. //>>excludeEnd("ctx");
  69492. },
  69493. //>>excludeStart("ide", pragmas.excludeIdeData);
  69494. args: [],
  69495. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  69496. referencedClasses: [],
  69497. //>>excludeEnd("ide");
  69498. messageSends: ["assert:", "==", "copy", "deepCopy"]
  69499. }),
  69500. globals.NumberTest);
  69501. smalltalk.addMethod(
  69502. smalltalk.method({
  69503. selector: "testEquality",
  69504. protocol: 'tests',
  69505. fn: function (){
  69506. var self=this;
  69507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69508. return smalltalk.withContext(function($ctx1) {
  69509. //>>excludeEnd("ctx");
  69510. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  69511. $1=(1).__eq((1));
  69512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69513. $ctx1.sendIdx["="]=1;
  69514. //>>excludeEnd("ctx");
  69515. self._assert_($1);
  69516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69517. $ctx1.sendIdx["assert:"]=1;
  69518. //>>excludeEnd("ctx");
  69519. $2=(0).__eq((0));
  69520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69521. $ctx1.sendIdx["="]=2;
  69522. //>>excludeEnd("ctx");
  69523. self._assert_($2);
  69524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69525. $ctx1.sendIdx["assert:"]=2;
  69526. //>>excludeEnd("ctx");
  69527. $3=(1).__eq((0));
  69528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69529. $ctx1.sendIdx["="]=3;
  69530. //>>excludeEnd("ctx");
  69531. self._deny_($3);
  69532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69533. $ctx1.sendIdx["deny:"]=1;
  69534. //>>excludeEnd("ctx");
  69535. $5=(1)._yourself();
  69536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69537. $ctx1.sendIdx["yourself"]=1;
  69538. //>>excludeEnd("ctx");
  69539. $4=_st($5).__eq((1));
  69540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69541. $ctx1.sendIdx["="]=4;
  69542. //>>excludeEnd("ctx");
  69543. self._assert_($4);
  69544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69545. $ctx1.sendIdx["assert:"]=3;
  69546. //>>excludeEnd("ctx");
  69547. $7=(1)._yourself();
  69548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69549. $ctx1.sendIdx["yourself"]=2;
  69550. //>>excludeEnd("ctx");
  69551. $6=(1).__eq($7);
  69552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69553. $ctx1.sendIdx["="]=5;
  69554. //>>excludeEnd("ctx");
  69555. self._assert_($6);
  69556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69557. $ctx1.sendIdx["assert:"]=4;
  69558. //>>excludeEnd("ctx");
  69559. $9=(1)._yourself();
  69560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69561. $ctx1.sendIdx["yourself"]=3;
  69562. //>>excludeEnd("ctx");
  69563. $8=_st($9).__eq((1)._yourself());
  69564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69565. $ctx1.sendIdx["="]=6;
  69566. //>>excludeEnd("ctx");
  69567. self._assert_($8);
  69568. $10=(0).__eq(false);
  69569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69570. $ctx1.sendIdx["="]=7;
  69571. //>>excludeEnd("ctx");
  69572. self._deny_($10);
  69573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69574. $ctx1.sendIdx["deny:"]=2;
  69575. //>>excludeEnd("ctx");
  69576. $11=false.__eq((0));
  69577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69578. $ctx1.sendIdx["="]=8;
  69579. //>>excludeEnd("ctx");
  69580. self._deny_($11);
  69581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69582. $ctx1.sendIdx["deny:"]=3;
  69583. //>>excludeEnd("ctx");
  69584. $12="".__eq((0));
  69585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69586. $ctx1.sendIdx["="]=9;
  69587. //>>excludeEnd("ctx");
  69588. self._deny_($12);
  69589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69590. $ctx1.sendIdx["deny:"]=4;
  69591. //>>excludeEnd("ctx");
  69592. self._deny_((0).__eq(""));
  69593. return self;
  69594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69595. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)});
  69596. //>>excludeEnd("ctx");
  69597. },
  69598. //>>excludeStart("ide", pragmas.excludeIdeData);
  69599. args: [],
  69600. source: "testEquality\x0a\x09self assert: (1 = 1).\x0a\x09self assert: (0 = 0).\x0a\x09self deny: (1 = 0).\x0a\x0a\x09self assert: (1 yourself = 1).\x0a\x09self assert: (1 = 1 yourself).\x0a\x09self assert: (1 yourself = 1 yourself).\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''",
  69601. referencedClasses: [],
  69602. //>>excludeEnd("ide");
  69603. messageSends: ["assert:", "=", "deny:", "yourself"]
  69604. }),
  69605. globals.NumberTest);
  69606. smalltalk.addMethod(
  69607. smalltalk.method({
  69608. selector: "testFloor",
  69609. protocol: 'tests',
  69610. fn: function (){
  69611. var self=this;
  69612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69613. return smalltalk.withContext(function($ctx1) {
  69614. //>>excludeEnd("ctx");
  69615. var $1,$2;
  69616. $1=(1.2)._floor();
  69617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69618. $ctx1.sendIdx["floor"]=1;
  69619. //>>excludeEnd("ctx");
  69620. self._assert_equals_($1,(1));
  69621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69622. $ctx1.sendIdx["assert:equals:"]=1;
  69623. //>>excludeEnd("ctx");
  69624. $2=(-1.2)._floor();
  69625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69626. $ctx1.sendIdx["floor"]=2;
  69627. //>>excludeEnd("ctx");
  69628. self._assert_equals_($2,(-2));
  69629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69630. $ctx1.sendIdx["assert:equals:"]=2;
  69631. //>>excludeEnd("ctx");
  69632. self._assert_equals_((1)._floor(),(1));
  69633. return self;
  69634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69635. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)});
  69636. //>>excludeEnd("ctx");
  69637. },
  69638. //>>excludeStart("ide", pragmas.excludeIdeData);
  69639. args: [],
  69640. source: "testFloor\x0a\x09self assert: 1.2 floor equals: 1.\x0a\x09self assert: -1.2 floor equals: -2.\x0a\x09self assert: 1.0 floor equals: 1.",
  69641. referencedClasses: [],
  69642. //>>excludeEnd("ide");
  69643. messageSends: ["assert:equals:", "floor"]
  69644. }),
  69645. globals.NumberTest);
  69646. smalltalk.addMethod(
  69647. smalltalk.method({
  69648. selector: "testHexNumbers",
  69649. protocol: 'tests',
  69650. fn: function (){
  69651. var self=this;
  69652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69653. return smalltalk.withContext(function($ctx1) {
  69654. //>>excludeEnd("ctx");
  69655. var $1,$2,$3,$4,$5;
  69656. self._assert_equals_((9),(9));
  69657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69658. $ctx1.sendIdx["assert:equals:"]=1;
  69659. //>>excludeEnd("ctx");
  69660. $1=(10)._truncated();
  69661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69662. $ctx1.sendIdx["truncated"]=1;
  69663. //>>excludeEnd("ctx");
  69664. self._assert_equals_($1,(10));
  69665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69666. $ctx1.sendIdx["assert:equals:"]=2;
  69667. //>>excludeEnd("ctx");
  69668. $2=(11)._truncated();
  69669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69670. $ctx1.sendIdx["truncated"]=2;
  69671. //>>excludeEnd("ctx");
  69672. self._assert_equals_($2,(11));
  69673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69674. $ctx1.sendIdx["assert:equals:"]=3;
  69675. //>>excludeEnd("ctx");
  69676. $3=(12)._truncated();
  69677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69678. $ctx1.sendIdx["truncated"]=3;
  69679. //>>excludeEnd("ctx");
  69680. self._assert_equals_($3,(12));
  69681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69682. $ctx1.sendIdx["assert:equals:"]=4;
  69683. //>>excludeEnd("ctx");
  69684. $4=(13)._truncated();
  69685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69686. $ctx1.sendIdx["truncated"]=4;
  69687. //>>excludeEnd("ctx");
  69688. self._assert_equals_($4,(13));
  69689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69690. $ctx1.sendIdx["assert:equals:"]=5;
  69691. //>>excludeEnd("ctx");
  69692. $5=(14)._truncated();
  69693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69694. $ctx1.sendIdx["truncated"]=5;
  69695. //>>excludeEnd("ctx");
  69696. self._assert_equals_($5,(14));
  69697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69698. $ctx1.sendIdx["assert:equals:"]=6;
  69699. //>>excludeEnd("ctx");
  69700. self._assert_equals_((15)._truncated(),(15));
  69701. return self;
  69702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69703. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)});
  69704. //>>excludeEnd("ctx");
  69705. },
  69706. //>>excludeStart("ide", pragmas.excludeIdeData);
  69707. args: [],
  69708. source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15",
  69709. referencedClasses: [],
  69710. //>>excludeEnd("ide");
  69711. messageSends: ["assert:equals:", "truncated"]
  69712. }),
  69713. globals.NumberTest);
  69714. smalltalk.addMethod(
  69715. smalltalk.method({
  69716. selector: "testIdentity",
  69717. protocol: 'tests',
  69718. fn: function (){
  69719. var self=this;
  69720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69721. return smalltalk.withContext(function($ctx1) {
  69722. //>>excludeEnd("ctx");
  69723. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  69724. $1=(1).__eq_eq((1));
  69725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69726. $ctx1.sendIdx["=="]=1;
  69727. //>>excludeEnd("ctx");
  69728. self._assert_($1);
  69729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69730. $ctx1.sendIdx["assert:"]=1;
  69731. //>>excludeEnd("ctx");
  69732. $2=(0).__eq_eq((0));
  69733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69734. $ctx1.sendIdx["=="]=2;
  69735. //>>excludeEnd("ctx");
  69736. self._assert_($2);
  69737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69738. $ctx1.sendIdx["assert:"]=2;
  69739. //>>excludeEnd("ctx");
  69740. $3=(1).__eq_eq((0));
  69741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69742. $ctx1.sendIdx["=="]=3;
  69743. //>>excludeEnd("ctx");
  69744. self._deny_($3);
  69745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69746. $ctx1.sendIdx["deny:"]=1;
  69747. //>>excludeEnd("ctx");
  69748. $5=(1)._yourself();
  69749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69750. $ctx1.sendIdx["yourself"]=1;
  69751. //>>excludeEnd("ctx");
  69752. $4=_st($5).__eq_eq((1));
  69753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69754. $ctx1.sendIdx["=="]=4;
  69755. //>>excludeEnd("ctx");
  69756. self._assert_($4);
  69757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69758. $ctx1.sendIdx["assert:"]=3;
  69759. //>>excludeEnd("ctx");
  69760. $7=(1)._yourself();
  69761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69762. $ctx1.sendIdx["yourself"]=2;
  69763. //>>excludeEnd("ctx");
  69764. $6=(1).__eq_eq($7);
  69765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69766. $ctx1.sendIdx["=="]=5;
  69767. //>>excludeEnd("ctx");
  69768. self._assert_($6);
  69769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69770. $ctx1.sendIdx["assert:"]=4;
  69771. //>>excludeEnd("ctx");
  69772. $9=(1)._yourself();
  69773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69774. $ctx1.sendIdx["yourself"]=3;
  69775. //>>excludeEnd("ctx");
  69776. $8=_st($9).__eq_eq((1)._yourself());
  69777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69778. $ctx1.sendIdx["=="]=6;
  69779. //>>excludeEnd("ctx");
  69780. self._assert_($8);
  69781. self._deny_((1).__eq_eq((2)));
  69782. return self;
  69783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69784. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)});
  69785. //>>excludeEnd("ctx");
  69786. },
  69787. //>>excludeStart("ide", pragmas.excludeIdeData);
  69788. args: [],
  69789. source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2",
  69790. referencedClasses: [],
  69791. //>>excludeEnd("ide");
  69792. messageSends: ["assert:", "==", "deny:", "yourself"]
  69793. }),
  69794. globals.NumberTest);
  69795. smalltalk.addMethod(
  69796. smalltalk.method({
  69797. selector: "testInvalidHexNumbers",
  69798. protocol: 'tests',
  69799. fn: function (){
  69800. var self=this;
  69801. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  69802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69803. return smalltalk.withContext(function($ctx1) {
  69804. //>>excludeEnd("ctx");
  69805. self._should_raise_((function(){
  69806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69807. return smalltalk.withContext(function($ctx2) {
  69808. //>>excludeEnd("ctx");
  69809. return (16)._rG();
  69810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  69812. //>>excludeEnd("ctx");
  69813. }),$MessageNotUnderstood());
  69814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69815. $ctx1.sendIdx["should:raise:"]=1;
  69816. //>>excludeEnd("ctx");
  69817. self._should_raise_((function(){
  69818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69819. return smalltalk.withContext(function($ctx2) {
  69820. //>>excludeEnd("ctx");
  69821. return (16)._rg();
  69822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  69824. //>>excludeEnd("ctx");
  69825. }),$MessageNotUnderstood());
  69826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69827. $ctx1.sendIdx["should:raise:"]=2;
  69828. //>>excludeEnd("ctx");
  69829. self._should_raise_((function(){
  69830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69831. return smalltalk.withContext(function($ctx2) {
  69832. //>>excludeEnd("ctx");
  69833. return (16)._rH();
  69834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  69836. //>>excludeEnd("ctx");
  69837. }),$MessageNotUnderstood());
  69838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69839. $ctx1.sendIdx["should:raise:"]=3;
  69840. //>>excludeEnd("ctx");
  69841. self._should_raise_((function(){
  69842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69843. return smalltalk.withContext(function($ctx2) {
  69844. //>>excludeEnd("ctx");
  69845. return (16)._rh();
  69846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  69848. //>>excludeEnd("ctx");
  69849. }),$MessageNotUnderstood());
  69850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69851. $ctx1.sendIdx["should:raise:"]=4;
  69852. //>>excludeEnd("ctx");
  69853. self._should_raise_((function(){
  69854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69855. return smalltalk.withContext(function($ctx2) {
  69856. //>>excludeEnd("ctx");
  69857. return (16)._rI();
  69858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  69860. //>>excludeEnd("ctx");
  69861. }),$MessageNotUnderstood());
  69862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69863. $ctx1.sendIdx["should:raise:"]=5;
  69864. //>>excludeEnd("ctx");
  69865. self._should_raise_((function(){
  69866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69867. return smalltalk.withContext(function($ctx2) {
  69868. //>>excludeEnd("ctx");
  69869. return (16)._ri();
  69870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  69872. //>>excludeEnd("ctx");
  69873. }),$MessageNotUnderstood());
  69874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69875. $ctx1.sendIdx["should:raise:"]=6;
  69876. //>>excludeEnd("ctx");
  69877. self._should_raise_((function(){
  69878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69879. return smalltalk.withContext(function($ctx2) {
  69880. //>>excludeEnd("ctx");
  69881. return (16)._rJ();
  69882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  69884. //>>excludeEnd("ctx");
  69885. }),$MessageNotUnderstood());
  69886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69887. $ctx1.sendIdx["should:raise:"]=7;
  69888. //>>excludeEnd("ctx");
  69889. self._should_raise_((function(){
  69890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69891. return smalltalk.withContext(function($ctx2) {
  69892. //>>excludeEnd("ctx");
  69893. return (16)._rj();
  69894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  69896. //>>excludeEnd("ctx");
  69897. }),$MessageNotUnderstood());
  69898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69899. $ctx1.sendIdx["should:raise:"]=8;
  69900. //>>excludeEnd("ctx");
  69901. self._should_raise_((function(){
  69902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69903. return smalltalk.withContext(function($ctx2) {
  69904. //>>excludeEnd("ctx");
  69905. return (16)._rK();
  69906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  69908. //>>excludeEnd("ctx");
  69909. }),$MessageNotUnderstood());
  69910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69911. $ctx1.sendIdx["should:raise:"]=9;
  69912. //>>excludeEnd("ctx");
  69913. self._should_raise_((function(){
  69914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69915. return smalltalk.withContext(function($ctx2) {
  69916. //>>excludeEnd("ctx");
  69917. return (16)._rk();
  69918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  69920. //>>excludeEnd("ctx");
  69921. }),$MessageNotUnderstood());
  69922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69923. $ctx1.sendIdx["should:raise:"]=10;
  69924. //>>excludeEnd("ctx");
  69925. self._should_raise_((function(){
  69926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69927. return smalltalk.withContext(function($ctx2) {
  69928. //>>excludeEnd("ctx");
  69929. return (16)._rL();
  69930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  69932. //>>excludeEnd("ctx");
  69933. }),$MessageNotUnderstood());
  69934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69935. $ctx1.sendIdx["should:raise:"]=11;
  69936. //>>excludeEnd("ctx");
  69937. self._should_raise_((function(){
  69938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69939. return smalltalk.withContext(function($ctx2) {
  69940. //>>excludeEnd("ctx");
  69941. return (16)._rl();
  69942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  69944. //>>excludeEnd("ctx");
  69945. }),$MessageNotUnderstood());
  69946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69947. $ctx1.sendIdx["should:raise:"]=12;
  69948. //>>excludeEnd("ctx");
  69949. self._should_raise_((function(){
  69950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69951. return smalltalk.withContext(function($ctx2) {
  69952. //>>excludeEnd("ctx");
  69953. return (16)._rM();
  69954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  69956. //>>excludeEnd("ctx");
  69957. }),$MessageNotUnderstood());
  69958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69959. $ctx1.sendIdx["should:raise:"]=13;
  69960. //>>excludeEnd("ctx");
  69961. self._should_raise_((function(){
  69962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69963. return smalltalk.withContext(function($ctx2) {
  69964. //>>excludeEnd("ctx");
  69965. return (16)._rm();
  69966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  69968. //>>excludeEnd("ctx");
  69969. }),$MessageNotUnderstood());
  69970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69971. $ctx1.sendIdx["should:raise:"]=14;
  69972. //>>excludeEnd("ctx");
  69973. self._should_raise_((function(){
  69974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69975. return smalltalk.withContext(function($ctx2) {
  69976. //>>excludeEnd("ctx");
  69977. return (16)._rN();
  69978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  69980. //>>excludeEnd("ctx");
  69981. }),$MessageNotUnderstood());
  69982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69983. $ctx1.sendIdx["should:raise:"]=15;
  69984. //>>excludeEnd("ctx");
  69985. self._should_raise_((function(){
  69986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69987. return smalltalk.withContext(function($ctx2) {
  69988. //>>excludeEnd("ctx");
  69989. return (16)._rn();
  69990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  69992. //>>excludeEnd("ctx");
  69993. }),$MessageNotUnderstood());
  69994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69995. $ctx1.sendIdx["should:raise:"]=16;
  69996. //>>excludeEnd("ctx");
  69997. self._should_raise_((function(){
  69998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69999. return smalltalk.withContext(function($ctx2) {
  70000. //>>excludeEnd("ctx");
  70001. return (16)._rO();
  70002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  70004. //>>excludeEnd("ctx");
  70005. }),$MessageNotUnderstood());
  70006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70007. $ctx1.sendIdx["should:raise:"]=17;
  70008. //>>excludeEnd("ctx");
  70009. self._should_raise_((function(){
  70010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70011. return smalltalk.withContext(function($ctx2) {
  70012. //>>excludeEnd("ctx");
  70013. return (16)._ro();
  70014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  70016. //>>excludeEnd("ctx");
  70017. }),$MessageNotUnderstood());
  70018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70019. $ctx1.sendIdx["should:raise:"]=18;
  70020. //>>excludeEnd("ctx");
  70021. self._should_raise_((function(){
  70022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70023. return smalltalk.withContext(function($ctx2) {
  70024. //>>excludeEnd("ctx");
  70025. return (16)._rP();
  70026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  70028. //>>excludeEnd("ctx");
  70029. }),$MessageNotUnderstood());
  70030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70031. $ctx1.sendIdx["should:raise:"]=19;
  70032. //>>excludeEnd("ctx");
  70033. self._should_raise_((function(){
  70034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70035. return smalltalk.withContext(function($ctx2) {
  70036. //>>excludeEnd("ctx");
  70037. return (16)._rp();
  70038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  70040. //>>excludeEnd("ctx");
  70041. }),$MessageNotUnderstood());
  70042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70043. $ctx1.sendIdx["should:raise:"]=20;
  70044. //>>excludeEnd("ctx");
  70045. self._should_raise_((function(){
  70046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70047. return smalltalk.withContext(function($ctx2) {
  70048. //>>excludeEnd("ctx");
  70049. return (16)._rQ();
  70050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  70052. //>>excludeEnd("ctx");
  70053. }),$MessageNotUnderstood());
  70054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70055. $ctx1.sendIdx["should:raise:"]=21;
  70056. //>>excludeEnd("ctx");
  70057. self._should_raise_((function(){
  70058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70059. return smalltalk.withContext(function($ctx2) {
  70060. //>>excludeEnd("ctx");
  70061. return (16)._rq();
  70062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  70064. //>>excludeEnd("ctx");
  70065. }),$MessageNotUnderstood());
  70066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70067. $ctx1.sendIdx["should:raise:"]=22;
  70068. //>>excludeEnd("ctx");
  70069. self._should_raise_((function(){
  70070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70071. return smalltalk.withContext(function($ctx2) {
  70072. //>>excludeEnd("ctx");
  70073. return (16)._rR();
  70074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  70076. //>>excludeEnd("ctx");
  70077. }),$MessageNotUnderstood());
  70078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70079. $ctx1.sendIdx["should:raise:"]=23;
  70080. //>>excludeEnd("ctx");
  70081. self._should_raise_((function(){
  70082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70083. return smalltalk.withContext(function($ctx2) {
  70084. //>>excludeEnd("ctx");
  70085. return (16)._rr();
  70086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  70088. //>>excludeEnd("ctx");
  70089. }),$MessageNotUnderstood());
  70090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70091. $ctx1.sendIdx["should:raise:"]=24;
  70092. //>>excludeEnd("ctx");
  70093. self._should_raise_((function(){
  70094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70095. return smalltalk.withContext(function($ctx2) {
  70096. //>>excludeEnd("ctx");
  70097. return (16)._rS();
  70098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  70100. //>>excludeEnd("ctx");
  70101. }),$MessageNotUnderstood());
  70102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70103. $ctx1.sendIdx["should:raise:"]=25;
  70104. //>>excludeEnd("ctx");
  70105. self._should_raise_((function(){
  70106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70107. return smalltalk.withContext(function($ctx2) {
  70108. //>>excludeEnd("ctx");
  70109. return (16)._rs();
  70110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  70112. //>>excludeEnd("ctx");
  70113. }),$MessageNotUnderstood());
  70114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70115. $ctx1.sendIdx["should:raise:"]=26;
  70116. //>>excludeEnd("ctx");
  70117. self._should_raise_((function(){
  70118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70119. return smalltalk.withContext(function($ctx2) {
  70120. //>>excludeEnd("ctx");
  70121. return (16)._rT();
  70122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  70124. //>>excludeEnd("ctx");
  70125. }),$MessageNotUnderstood());
  70126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70127. $ctx1.sendIdx["should:raise:"]=27;
  70128. //>>excludeEnd("ctx");
  70129. self._should_raise_((function(){
  70130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70131. return smalltalk.withContext(function($ctx2) {
  70132. //>>excludeEnd("ctx");
  70133. return (16)._rt();
  70134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  70136. //>>excludeEnd("ctx");
  70137. }),$MessageNotUnderstood());
  70138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70139. $ctx1.sendIdx["should:raise:"]=28;
  70140. //>>excludeEnd("ctx");
  70141. self._should_raise_((function(){
  70142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70143. return smalltalk.withContext(function($ctx2) {
  70144. //>>excludeEnd("ctx");
  70145. return (16)._rU();
  70146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  70148. //>>excludeEnd("ctx");
  70149. }),$MessageNotUnderstood());
  70150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70151. $ctx1.sendIdx["should:raise:"]=29;
  70152. //>>excludeEnd("ctx");
  70153. self._should_raise_((function(){
  70154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70155. return smalltalk.withContext(function($ctx2) {
  70156. //>>excludeEnd("ctx");
  70157. return (16)._ru();
  70158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  70160. //>>excludeEnd("ctx");
  70161. }),$MessageNotUnderstood());
  70162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70163. $ctx1.sendIdx["should:raise:"]=30;
  70164. //>>excludeEnd("ctx");
  70165. self._should_raise_((function(){
  70166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70167. return smalltalk.withContext(function($ctx2) {
  70168. //>>excludeEnd("ctx");
  70169. return (16)._rV();
  70170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  70172. //>>excludeEnd("ctx");
  70173. }),$MessageNotUnderstood());
  70174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70175. $ctx1.sendIdx["should:raise:"]=31;
  70176. //>>excludeEnd("ctx");
  70177. self._should_raise_((function(){
  70178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70179. return smalltalk.withContext(function($ctx2) {
  70180. //>>excludeEnd("ctx");
  70181. return (16)._rv();
  70182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  70184. //>>excludeEnd("ctx");
  70185. }),$MessageNotUnderstood());
  70186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70187. $ctx1.sendIdx["should:raise:"]=32;
  70188. //>>excludeEnd("ctx");
  70189. self._should_raise_((function(){
  70190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70191. return smalltalk.withContext(function($ctx2) {
  70192. //>>excludeEnd("ctx");
  70193. return (16)._rW();
  70194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  70196. //>>excludeEnd("ctx");
  70197. }),$MessageNotUnderstood());
  70198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70199. $ctx1.sendIdx["should:raise:"]=33;
  70200. //>>excludeEnd("ctx");
  70201. self._should_raise_((function(){
  70202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70203. return smalltalk.withContext(function($ctx2) {
  70204. //>>excludeEnd("ctx");
  70205. return (16)._rw();
  70206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  70208. //>>excludeEnd("ctx");
  70209. }),$MessageNotUnderstood());
  70210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70211. $ctx1.sendIdx["should:raise:"]=34;
  70212. //>>excludeEnd("ctx");
  70213. self._should_raise_((function(){
  70214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70215. return smalltalk.withContext(function($ctx2) {
  70216. //>>excludeEnd("ctx");
  70217. return (16)._rX();
  70218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  70220. //>>excludeEnd("ctx");
  70221. }),$MessageNotUnderstood());
  70222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70223. $ctx1.sendIdx["should:raise:"]=35;
  70224. //>>excludeEnd("ctx");
  70225. self._should_raise_((function(){
  70226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70227. return smalltalk.withContext(function($ctx2) {
  70228. //>>excludeEnd("ctx");
  70229. return (16)._rx();
  70230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  70232. //>>excludeEnd("ctx");
  70233. }),$MessageNotUnderstood());
  70234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70235. $ctx1.sendIdx["should:raise:"]=36;
  70236. //>>excludeEnd("ctx");
  70237. self._should_raise_((function(){
  70238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70239. return smalltalk.withContext(function($ctx2) {
  70240. //>>excludeEnd("ctx");
  70241. return (16)._rY();
  70242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  70244. //>>excludeEnd("ctx");
  70245. }),$MessageNotUnderstood());
  70246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70247. $ctx1.sendIdx["should:raise:"]=37;
  70248. //>>excludeEnd("ctx");
  70249. self._should_raise_((function(){
  70250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70251. return smalltalk.withContext(function($ctx2) {
  70252. //>>excludeEnd("ctx");
  70253. return (16)._ry();
  70254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  70256. //>>excludeEnd("ctx");
  70257. }),$MessageNotUnderstood());
  70258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70259. $ctx1.sendIdx["should:raise:"]=38;
  70260. //>>excludeEnd("ctx");
  70261. self._should_raise_((function(){
  70262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70263. return smalltalk.withContext(function($ctx2) {
  70264. //>>excludeEnd("ctx");
  70265. return (16)._rZ();
  70266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  70268. //>>excludeEnd("ctx");
  70269. }),$MessageNotUnderstood());
  70270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70271. $ctx1.sendIdx["should:raise:"]=39;
  70272. //>>excludeEnd("ctx");
  70273. self._should_raise_((function(){
  70274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70275. return smalltalk.withContext(function($ctx2) {
  70276. //>>excludeEnd("ctx");
  70277. return (16)._rz();
  70278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  70280. //>>excludeEnd("ctx");
  70281. }),$MessageNotUnderstood());
  70282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70283. $ctx1.sendIdx["should:raise:"]=40;
  70284. //>>excludeEnd("ctx");
  70285. self._should_raise_((function(){
  70286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70287. return smalltalk.withContext(function($ctx2) {
  70288. //>>excludeEnd("ctx");
  70289. return (11259375)._Z();
  70290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  70292. //>>excludeEnd("ctx");
  70293. }),$MessageNotUnderstood());
  70294. return self;
  70295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70296. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)});
  70297. //>>excludeEnd("ctx");
  70298. },
  70299. //>>excludeStart("ide", pragmas.excludeIdeData);
  70300. args: [],
  70301. source: "testInvalidHexNumbers\x0a\x0a\x09self should: [ 16rG ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rg ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rH ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rh ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rI ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ri ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rJ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rj ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rK ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rk ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rL ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rl ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rM ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rm ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rN ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rn ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rO ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ro ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rP ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rp ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rQ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rq ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rR ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rr ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rS ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rs ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rT ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rt ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rU ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ru ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rV ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rv ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rW ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rw ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rX ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rx ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rY ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ry ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rZ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rz ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rABcdEfZ ] raise: MessageNotUnderstood.",
  70302. referencedClasses: ["MessageNotUnderstood"],
  70303. //>>excludeEnd("ide");
  70304. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"]
  70305. }),
  70306. globals.NumberTest);
  70307. smalltalk.addMethod(
  70308. smalltalk.method({
  70309. selector: "testLog",
  70310. protocol: 'tests',
  70311. fn: function (){
  70312. var self=this;
  70313. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  70314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70315. return smalltalk.withContext(function($ctx1) {
  70316. //>>excludeEnd("ctx");
  70317. self._assert_equals_((10000)._log(),(4));
  70318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70319. $ctx1.sendIdx["assert:equals:"]=1;
  70320. //>>excludeEnd("ctx");
  70321. self._assert_equals_((512)._log_((2)),(9));
  70322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70323. $ctx1.sendIdx["assert:equals:"]=2;
  70324. //>>excludeEnd("ctx");
  70325. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  70326. return self;
  70327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70328. }, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)});
  70329. //>>excludeEnd("ctx");
  70330. },
  70331. //>>excludeStart("ide", pragmas.excludeIdeData);
  70332. args: [],
  70333. source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.",
  70334. referencedClasses: ["Number"],
  70335. //>>excludeEnd("ide");
  70336. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  70337. }),
  70338. globals.NumberTest);
  70339. smalltalk.addMethod(
  70340. smalltalk.method({
  70341. selector: "testMinMax",
  70342. protocol: 'tests',
  70343. fn: function (){
  70344. var self=this;
  70345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70346. return smalltalk.withContext(function($ctx1) {
  70347. //>>excludeEnd("ctx");
  70348. self._assert_equals_((2)._max_((5)),(5));
  70349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70350. $ctx1.sendIdx["assert:equals:"]=1;
  70351. //>>excludeEnd("ctx");
  70352. self._assert_equals_((2)._min_((5)),(2));
  70353. return self;
  70354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70355. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)});
  70356. //>>excludeEnd("ctx");
  70357. },
  70358. //>>excludeStart("ide", pragmas.excludeIdeData);
  70359. args: [],
  70360. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  70361. referencedClasses: [],
  70362. //>>excludeEnd("ide");
  70363. messageSends: ["assert:equals:", "max:", "min:"]
  70364. }),
  70365. globals.NumberTest);
  70366. smalltalk.addMethod(
  70367. smalltalk.method({
  70368. selector: "testNegated",
  70369. protocol: 'tests',
  70370. fn: function (){
  70371. var self=this;
  70372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70373. return smalltalk.withContext(function($ctx1) {
  70374. //>>excludeEnd("ctx");
  70375. var $1;
  70376. $1=(3)._negated();
  70377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70378. $ctx1.sendIdx["negated"]=1;
  70379. //>>excludeEnd("ctx");
  70380. self._assert_equals_($1,(-3));
  70381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70382. $ctx1.sendIdx["assert:equals:"]=1;
  70383. //>>excludeEnd("ctx");
  70384. self._assert_equals_((-3)._negated(),(3));
  70385. return self;
  70386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70387. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)});
  70388. //>>excludeEnd("ctx");
  70389. },
  70390. //>>excludeStart("ide", pragmas.excludeIdeData);
  70391. args: [],
  70392. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  70393. referencedClasses: [],
  70394. //>>excludeEnd("ide");
  70395. messageSends: ["assert:equals:", "negated"]
  70396. }),
  70397. globals.NumberTest);
  70398. smalltalk.addMethod(
  70399. smalltalk.method({
  70400. selector: "testPrintShowingDecimalPlaces",
  70401. protocol: 'tests',
  70402. fn: function (){
  70403. var self=this;
  70404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70405. return smalltalk.withContext(function($ctx1) {
  70406. //>>excludeEnd("ctx");
  70407. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  70408. $1=(23)._printShowingDecimalPlaces_((2));
  70409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70410. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  70411. //>>excludeEnd("ctx");
  70412. self._assert_equals_($1,"23.00");
  70413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70414. $ctx1.sendIdx["assert:equals:"]=1;
  70415. //>>excludeEnd("ctx");
  70416. $2=(23.5698)._printShowingDecimalPlaces_((2));
  70417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70418. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  70419. //>>excludeEnd("ctx");
  70420. self._assert_equals_($2,"23.57");
  70421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70422. $ctx1.sendIdx["assert:equals:"]=2;
  70423. //>>excludeEnd("ctx");
  70424. $4=(234.567)._negated();
  70425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70426. $ctx1.sendIdx["negated"]=1;
  70427. //>>excludeEnd("ctx");
  70428. $3=_st($4)._printShowingDecimalPlaces_((5));
  70429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70430. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  70431. //>>excludeEnd("ctx");
  70432. self._assert_equals_($3,"-234.56700");
  70433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70434. $ctx1.sendIdx["assert:equals:"]=3;
  70435. //>>excludeEnd("ctx");
  70436. $5=(23.4567)._printShowingDecimalPlaces_((0));
  70437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70438. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  70439. //>>excludeEnd("ctx");
  70440. self._assert_equals_($5,"23");
  70441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70442. $ctx1.sendIdx["assert:equals:"]=4;
  70443. //>>excludeEnd("ctx");
  70444. $6=(23.5567)._printShowingDecimalPlaces_((0));
  70445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70446. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  70447. //>>excludeEnd("ctx");
  70448. self._assert_equals_($6,"24");
  70449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70450. $ctx1.sendIdx["assert:equals:"]=5;
  70451. //>>excludeEnd("ctx");
  70452. $8=(23.4567)._negated();
  70453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70454. $ctx1.sendIdx["negated"]=2;
  70455. //>>excludeEnd("ctx");
  70456. $7=_st($8)._printShowingDecimalPlaces_((0));
  70457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70458. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  70459. //>>excludeEnd("ctx");
  70460. self._assert_equals_($7,"-23");
  70461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70462. $ctx1.sendIdx["assert:equals:"]=6;
  70463. //>>excludeEnd("ctx");
  70464. $10=(23.5567)._negated();
  70465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70466. $ctx1.sendIdx["negated"]=3;
  70467. //>>excludeEnd("ctx");
  70468. $9=_st($10)._printShowingDecimalPlaces_((0));
  70469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70470. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  70471. //>>excludeEnd("ctx");
  70472. self._assert_equals_($9,"-24");
  70473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70474. $ctx1.sendIdx["assert:equals:"]=7;
  70475. //>>excludeEnd("ctx");
  70476. $11=(100000000)._printShowingDecimalPlaces_((1));
  70477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70478. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  70479. //>>excludeEnd("ctx");
  70480. self._assert_equals_($11,"100000000.0");
  70481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70482. $ctx1.sendIdx["assert:equals:"]=8;
  70483. //>>excludeEnd("ctx");
  70484. $12=(0.98)._printShowingDecimalPlaces_((5));
  70485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70486. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  70487. //>>excludeEnd("ctx");
  70488. self._assert_equals_($12,"0.98000");
  70489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70490. $ctx1.sendIdx["assert:equals:"]=9;
  70491. //>>excludeEnd("ctx");
  70492. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  70493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70494. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  70495. //>>excludeEnd("ctx");
  70496. self._assert_equals_($13,"-0.98");
  70497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70498. $ctx1.sendIdx["assert:equals:"]=10;
  70499. //>>excludeEnd("ctx");
  70500. $14=(2.567)._printShowingDecimalPlaces_((2));
  70501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70502. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  70503. //>>excludeEnd("ctx");
  70504. self._assert_equals_($14,"2.57");
  70505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70506. $ctx1.sendIdx["assert:equals:"]=11;
  70507. //>>excludeEnd("ctx");
  70508. $15=(-2.567)._printShowingDecimalPlaces_((2));
  70509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70510. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  70511. //>>excludeEnd("ctx");
  70512. self._assert_equals_($15,"-2.57");
  70513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70514. $ctx1.sendIdx["assert:equals:"]=12;
  70515. //>>excludeEnd("ctx");
  70516. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  70517. return self;
  70518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70519. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)});
  70520. //>>excludeEnd("ctx");
  70521. },
  70522. //>>excludeStart("ide", pragmas.excludeIdeData);
  70523. args: [],
  70524. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.",
  70525. referencedClasses: [],
  70526. //>>excludeEnd("ide");
  70527. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  70528. }),
  70529. globals.NumberTest);
  70530. smalltalk.addMethod(
  70531. smalltalk.method({
  70532. selector: "testRaisedTo",
  70533. protocol: 'tests',
  70534. fn: function (){
  70535. var self=this;
  70536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70537. return smalltalk.withContext(function($ctx1) {
  70538. //>>excludeEnd("ctx");
  70539. var $1,$2,$3;
  70540. $1=(2)._raisedTo_((4));
  70541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70542. $ctx1.sendIdx["raisedTo:"]=1;
  70543. //>>excludeEnd("ctx");
  70544. self._assert_equals_($1,(16));
  70545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70546. $ctx1.sendIdx["assert:equals:"]=1;
  70547. //>>excludeEnd("ctx");
  70548. $2=(2)._raisedTo_((0));
  70549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70550. $ctx1.sendIdx["raisedTo:"]=2;
  70551. //>>excludeEnd("ctx");
  70552. self._assert_equals_($2,(1));
  70553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70554. $ctx1.sendIdx["assert:equals:"]=2;
  70555. //>>excludeEnd("ctx");
  70556. $3=(2)._raisedTo_((-3));
  70557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70558. $ctx1.sendIdx["raisedTo:"]=3;
  70559. //>>excludeEnd("ctx");
  70560. self._assert_equals_($3,(0.125));
  70561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70562. $ctx1.sendIdx["assert:equals:"]=3;
  70563. //>>excludeEnd("ctx");
  70564. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  70565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70566. $ctx1.sendIdx["assert:equals:"]=4;
  70567. //>>excludeEnd("ctx");
  70568. self._assert_equals_((2).__star_star((4)),(16));
  70569. return self;
  70570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70571. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)});
  70572. //>>excludeEnd("ctx");
  70573. },
  70574. //>>excludeStart("ide", pragmas.excludeIdeData);
  70575. args: [],
  70576. source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.",
  70577. referencedClasses: [],
  70578. //>>excludeEnd("ide");
  70579. messageSends: ["assert:equals:", "raisedTo:", "**"]
  70580. }),
  70581. globals.NumberTest);
  70582. smalltalk.addMethod(
  70583. smalltalk.method({
  70584. selector: "testRounded",
  70585. protocol: 'tests',
  70586. fn: function (){
  70587. var self=this;
  70588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70589. return smalltalk.withContext(function($ctx1) {
  70590. //>>excludeEnd("ctx");
  70591. var $1,$2;
  70592. $1=(3)._rounded();
  70593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70594. $ctx1.sendIdx["rounded"]=1;
  70595. //>>excludeEnd("ctx");
  70596. self._assert_equals_($1,(3));
  70597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70598. $ctx1.sendIdx["assert:equals:"]=1;
  70599. //>>excludeEnd("ctx");
  70600. $2=(3.212)._rounded();
  70601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70602. $ctx1.sendIdx["rounded"]=2;
  70603. //>>excludeEnd("ctx");
  70604. self._assert_equals_($2,(3));
  70605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70606. $ctx1.sendIdx["assert:equals:"]=2;
  70607. //>>excludeEnd("ctx");
  70608. self._assert_equals_((3.51)._rounded(),(4));
  70609. return self;
  70610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70611. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)});
  70612. //>>excludeEnd("ctx");
  70613. },
  70614. //>>excludeStart("ide", pragmas.excludeIdeData);
  70615. args: [],
  70616. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4",
  70617. referencedClasses: [],
  70618. //>>excludeEnd("ide");
  70619. messageSends: ["assert:equals:", "rounded"]
  70620. }),
  70621. globals.NumberTest);
  70622. smalltalk.addMethod(
  70623. smalltalk.method({
  70624. selector: "testSign",
  70625. protocol: 'tests',
  70626. fn: function (){
  70627. var self=this;
  70628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70629. return smalltalk.withContext(function($ctx1) {
  70630. //>>excludeEnd("ctx");
  70631. var $1,$2;
  70632. $1=(5)._sign();
  70633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70634. $ctx1.sendIdx["sign"]=1;
  70635. //>>excludeEnd("ctx");
  70636. self._assert_equals_($1,(1));
  70637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70638. $ctx1.sendIdx["assert:equals:"]=1;
  70639. //>>excludeEnd("ctx");
  70640. $2=(0)._sign();
  70641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70642. $ctx1.sendIdx["sign"]=2;
  70643. //>>excludeEnd("ctx");
  70644. self._assert_equals_($2,(0));
  70645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70646. $ctx1.sendIdx["assert:equals:"]=2;
  70647. //>>excludeEnd("ctx");
  70648. self._assert_equals_((-1.4)._sign(),(-1));
  70649. return self;
  70650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70651. }, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)});
  70652. //>>excludeEnd("ctx");
  70653. },
  70654. //>>excludeStart("ide", pragmas.excludeIdeData);
  70655. args: [],
  70656. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  70657. referencedClasses: [],
  70658. //>>excludeEnd("ide");
  70659. messageSends: ["assert:equals:", "sign"]
  70660. }),
  70661. globals.NumberTest);
  70662. smalltalk.addMethod(
  70663. smalltalk.method({
  70664. selector: "testSqrt",
  70665. protocol: 'tests',
  70666. fn: function (){
  70667. var self=this;
  70668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70669. return smalltalk.withContext(function($ctx1) {
  70670. //>>excludeEnd("ctx");
  70671. var $1;
  70672. $1=(4)._sqrt();
  70673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70674. $ctx1.sendIdx["sqrt"]=1;
  70675. //>>excludeEnd("ctx");
  70676. self._assert_equals_($1,(2));
  70677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70678. $ctx1.sendIdx["assert:equals:"]=1;
  70679. //>>excludeEnd("ctx");
  70680. self._assert_equals_((16)._sqrt(),(4));
  70681. return self;
  70682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70683. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)});
  70684. //>>excludeEnd("ctx");
  70685. },
  70686. //>>excludeStart("ide", pragmas.excludeIdeData);
  70687. args: [],
  70688. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  70689. referencedClasses: [],
  70690. //>>excludeEnd("ide");
  70691. messageSends: ["assert:equals:", "sqrt"]
  70692. }),
  70693. globals.NumberTest);
  70694. smalltalk.addMethod(
  70695. smalltalk.method({
  70696. selector: "testSquared",
  70697. protocol: 'tests',
  70698. fn: function (){
  70699. var self=this;
  70700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70701. return smalltalk.withContext(function($ctx1) {
  70702. //>>excludeEnd("ctx");
  70703. self._assert_equals_((4)._squared(),(16));
  70704. return self;
  70705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70706. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)});
  70707. //>>excludeEnd("ctx");
  70708. },
  70709. //>>excludeStart("ide", pragmas.excludeIdeData);
  70710. args: [],
  70711. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  70712. referencedClasses: [],
  70713. //>>excludeEnd("ide");
  70714. messageSends: ["assert:equals:", "squared"]
  70715. }),
  70716. globals.NumberTest);
  70717. smalltalk.addMethod(
  70718. smalltalk.method({
  70719. selector: "testTimesRepeat",
  70720. protocol: 'tests',
  70721. fn: function (){
  70722. var self=this;
  70723. var i;
  70724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70725. return smalltalk.withContext(function($ctx1) {
  70726. //>>excludeEnd("ctx");
  70727. i=(0);
  70728. (0)._timesRepeat_((function(){
  70729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70730. return smalltalk.withContext(function($ctx2) {
  70731. //>>excludeEnd("ctx");
  70732. i=_st(i).__plus((1));
  70733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70734. $ctx2.sendIdx["+"]=1;
  70735. //>>excludeEnd("ctx");
  70736. return i;
  70737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  70739. //>>excludeEnd("ctx");
  70740. }));
  70741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70742. $ctx1.sendIdx["timesRepeat:"]=1;
  70743. //>>excludeEnd("ctx");
  70744. self._assert_equals_(i,(0));
  70745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70746. $ctx1.sendIdx["assert:equals:"]=1;
  70747. //>>excludeEnd("ctx");
  70748. (5)._timesRepeat_((function(){
  70749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70750. return smalltalk.withContext(function($ctx2) {
  70751. //>>excludeEnd("ctx");
  70752. i=_st(i).__plus((1));
  70753. return i;
  70754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  70756. //>>excludeEnd("ctx");
  70757. }));
  70758. self._assert_equals_(i,(5));
  70759. return self;
  70760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70761. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)});
  70762. //>>excludeEnd("ctx");
  70763. },
  70764. //>>excludeStart("ide", pragmas.excludeIdeData);
  70765. args: [],
  70766. source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 5",
  70767. referencedClasses: [],
  70768. //>>excludeEnd("ide");
  70769. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  70770. }),
  70771. globals.NumberTest);
  70772. smalltalk.addMethod(
  70773. smalltalk.method({
  70774. selector: "testTo",
  70775. protocol: 'tests',
  70776. fn: function (){
  70777. var self=this;
  70778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70779. return smalltalk.withContext(function($ctx1) {
  70780. //>>excludeEnd("ctx");
  70781. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  70782. return self;
  70783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70784. }, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)});
  70785. //>>excludeEnd("ctx");
  70786. },
  70787. //>>excludeStart("ide", pragmas.excludeIdeData);
  70788. args: [],
  70789. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  70790. referencedClasses: [],
  70791. //>>excludeEnd("ide");
  70792. messageSends: ["assert:equals:", "to:"]
  70793. }),
  70794. globals.NumberTest);
  70795. smalltalk.addMethod(
  70796. smalltalk.method({
  70797. selector: "testToBy",
  70798. protocol: 'tests',
  70799. fn: function (){
  70800. var self=this;
  70801. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  70802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70803. return smalltalk.withContext(function($ctx1) {
  70804. //>>excludeEnd("ctx");
  70805. var $1;
  70806. $1=(0)._to_by_((6),(2));
  70807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70808. $ctx1.sendIdx["to:by:"]=1;
  70809. //>>excludeEnd("ctx");
  70810. self._assert_equals_($1,[(0), (2), (4), (6)]);
  70811. self._should_raise_((function(){
  70812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70813. return smalltalk.withContext(function($ctx2) {
  70814. //>>excludeEnd("ctx");
  70815. return (1)._to_by_((4),(0));
  70816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  70818. //>>excludeEnd("ctx");
  70819. }),$Error());
  70820. return self;
  70821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70822. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)});
  70823. //>>excludeEnd("ctx");
  70824. },
  70825. //>>excludeStart("ide", pragmas.excludeIdeData);
  70826. args: [],
  70827. source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [ 1 to: 4 by: 0 ] raise: Error",
  70828. referencedClasses: ["Error"],
  70829. //>>excludeEnd("ide");
  70830. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  70831. }),
  70832. globals.NumberTest);
  70833. smalltalk.addMethod(
  70834. smalltalk.method({
  70835. selector: "testTrigonometry",
  70836. protocol: 'tests',
  70837. fn: function (){
  70838. var self=this;
  70839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70840. return smalltalk.withContext(function($ctx1) {
  70841. //>>excludeEnd("ctx");
  70842. self._assert_equals_((0)._cos(),(1));
  70843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70844. $ctx1.sendIdx["assert:equals:"]=1;
  70845. //>>excludeEnd("ctx");
  70846. self._assert_equals_((0)._sin(),(0));
  70847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70848. $ctx1.sendIdx["assert:equals:"]=2;
  70849. //>>excludeEnd("ctx");
  70850. self._assert_equals_((0)._tan(),(0));
  70851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70852. $ctx1.sendIdx["assert:equals:"]=3;
  70853. //>>excludeEnd("ctx");
  70854. self._assert_equals_((1)._arcCos(),(0));
  70855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70856. $ctx1.sendIdx["assert:equals:"]=4;
  70857. //>>excludeEnd("ctx");
  70858. self._assert_equals_((0)._arcSin(),(0));
  70859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70860. $ctx1.sendIdx["assert:equals:"]=5;
  70861. //>>excludeEnd("ctx");
  70862. self._assert_equals_((0)._arcTan(),(0));
  70863. return self;
  70864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70865. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)});
  70866. //>>excludeEnd("ctx");
  70867. },
  70868. //>>excludeStart("ide", pragmas.excludeIdeData);
  70869. args: [],
  70870. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.",
  70871. referencedClasses: [],
  70872. //>>excludeEnd("ide");
  70873. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  70874. }),
  70875. globals.NumberTest);
  70876. smalltalk.addMethod(
  70877. smalltalk.method({
  70878. selector: "testTruncated",
  70879. protocol: 'tests',
  70880. fn: function (){
  70881. var self=this;
  70882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70883. return smalltalk.withContext(function($ctx1) {
  70884. //>>excludeEnd("ctx");
  70885. var $1,$2;
  70886. $1=(3)._truncated();
  70887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70888. $ctx1.sendIdx["truncated"]=1;
  70889. //>>excludeEnd("ctx");
  70890. self._assert_equals_($1,(3));
  70891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70892. $ctx1.sendIdx["assert:equals:"]=1;
  70893. //>>excludeEnd("ctx");
  70894. $2=(3.212)._truncated();
  70895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70896. $ctx1.sendIdx["truncated"]=2;
  70897. //>>excludeEnd("ctx");
  70898. self._assert_equals_($2,(3));
  70899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70900. $ctx1.sendIdx["assert:equals:"]=2;
  70901. //>>excludeEnd("ctx");
  70902. self._assert_equals_((3.51)._truncated(),(3));
  70903. return self;
  70904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70905. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)});
  70906. //>>excludeEnd("ctx");
  70907. },
  70908. //>>excludeStart("ide", pragmas.excludeIdeData);
  70909. args: [],
  70910. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3",
  70911. referencedClasses: [],
  70912. //>>excludeEnd("ide");
  70913. messageSends: ["assert:equals:", "truncated"]
  70914. }),
  70915. globals.NumberTest);
  70916. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  70917. //>>excludeStart("ide", pragmas.excludeIdeData);
  70918. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  70919. //>>excludeEnd("ide");
  70920. smalltalk.addMethod(
  70921. smalltalk.method({
  70922. selector: "foo",
  70923. protocol: 'not yet classified',
  70924. fn: function (){
  70925. var self=this;
  70926. var $1;
  70927. $1=self["@foo"];
  70928. return $1;
  70929. },
  70930. //>>excludeStart("ide", pragmas.excludeIdeData);
  70931. args: [],
  70932. source: "foo\x0a\x09^ foo",
  70933. referencedClasses: [],
  70934. //>>excludeEnd("ide");
  70935. messageSends: []
  70936. }),
  70937. globals.ObjectMock);
  70938. smalltalk.addMethod(
  70939. smalltalk.method({
  70940. selector: "foo:",
  70941. protocol: 'not yet classified',
  70942. fn: function (anObject){
  70943. var self=this;
  70944. self["@foo"]=anObject;
  70945. return self;
  70946. },
  70947. //>>excludeStart("ide", pragmas.excludeIdeData);
  70948. args: ["anObject"],
  70949. source: "foo: anObject\x0a\x09foo := anObject",
  70950. referencedClasses: [],
  70951. //>>excludeEnd("ide");
  70952. messageSends: []
  70953. }),
  70954. globals.ObjectMock);
  70955. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  70956. smalltalk.addMethod(
  70957. smalltalk.method({
  70958. selector: "notDefined",
  70959. protocol: 'tests',
  70960. fn: function (){
  70961. var self=this;
  70962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70963. return smalltalk.withContext(function($ctx1) {
  70964. //>>excludeEnd("ctx");
  70965. return void 0;;
  70966. return self;
  70967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70968. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)});
  70969. //>>excludeEnd("ctx");
  70970. },
  70971. //>>excludeStart("ide", pragmas.excludeIdeData);
  70972. args: [],
  70973. source: "notDefined\x0a\x09<return void 0;>",
  70974. referencedClasses: [],
  70975. //>>excludeEnd("ide");
  70976. messageSends: []
  70977. }),
  70978. globals.ObjectTest);
  70979. smalltalk.addMethod(
  70980. smalltalk.method({
  70981. selector: "testBasicAccess",
  70982. protocol: 'tests',
  70983. fn: function (){
  70984. var self=this;
  70985. var o;
  70986. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  70987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70988. return smalltalk.withContext(function($ctx1) {
  70989. //>>excludeEnd("ctx");
  70990. var $1;
  70991. o=_st($Object())._new();
  70992. _st(o)._basicAt_put_("a",(1));
  70993. $1=_st(o)._basicAt_("a");
  70994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70995. $ctx1.sendIdx["basicAt:"]=1;
  70996. //>>excludeEnd("ctx");
  70997. self._assert_equals_($1,(1));
  70998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70999. $ctx1.sendIdx["assert:equals:"]=1;
  71000. //>>excludeEnd("ctx");
  71001. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  71002. return self;
  71003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71004. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)});
  71005. //>>excludeEnd("ctx");
  71006. },
  71007. //>>excludeStart("ide", pragmas.excludeIdeData);
  71008. args: [],
  71009. source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil",
  71010. referencedClasses: ["Object"],
  71011. //>>excludeEnd("ide");
  71012. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  71013. }),
  71014. globals.ObjectTest);
  71015. smalltalk.addMethod(
  71016. smalltalk.method({
  71017. selector: "testBasicPerform",
  71018. protocol: 'tests',
  71019. fn: function (){
  71020. var self=this;
  71021. var o;
  71022. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71024. return smalltalk.withContext(function($ctx1) {
  71025. //>>excludeEnd("ctx");
  71026. o=_st($Object())._new();
  71027. _st(o)._basicAt_put_("func",(function(){
  71028. return "hello";
  71029. }));
  71030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71031. $ctx1.sendIdx["basicAt:put:"]=1;
  71032. //>>excludeEnd("ctx");
  71033. _st(o)._basicAt_put_("func2",(function(a){
  71034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71035. return smalltalk.withContext(function($ctx2) {
  71036. //>>excludeEnd("ctx");
  71037. return _st(a).__plus((1));
  71038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71039. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  71040. //>>excludeEnd("ctx");
  71041. }));
  71042. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  71043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71044. $ctx1.sendIdx["assert:equals:"]=1;
  71045. //>>excludeEnd("ctx");
  71046. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  71047. return self;
  71048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71049. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)});
  71050. //>>excludeEnd("ctx");
  71051. },
  71052. //>>excludeStart("ide", pragmas.excludeIdeData);
  71053. args: [],
  71054. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: [ 'hello' ].\x0a\x09o basicAt: 'func2' put: [ :a | a + 1 ].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  71055. referencedClasses: ["Object"],
  71056. //>>excludeEnd("ide");
  71057. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  71058. }),
  71059. globals.ObjectTest);
  71060. smalltalk.addMethod(
  71061. smalltalk.method({
  71062. selector: "testDNU",
  71063. protocol: 'tests',
  71064. fn: function (){
  71065. var self=this;
  71066. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71067. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  71068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71069. return smalltalk.withContext(function($ctx1) {
  71070. //>>excludeEnd("ctx");
  71071. self._should_raise_((function(){
  71072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71073. return smalltalk.withContext(function($ctx2) {
  71074. //>>excludeEnd("ctx");
  71075. return _st(_st($Object())._new())._foo();
  71076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  71078. //>>excludeEnd("ctx");
  71079. }),$MessageNotUnderstood());
  71080. return self;
  71081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71082. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)});
  71083. //>>excludeEnd("ctx");
  71084. },
  71085. //>>excludeStart("ide", pragmas.excludeIdeData);
  71086. args: [],
  71087. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  71088. referencedClasses: ["Object", "MessageNotUnderstood"],
  71089. //>>excludeEnd("ide");
  71090. messageSends: ["should:raise:", "foo", "new"]
  71091. }),
  71092. globals.ObjectTest);
  71093. smalltalk.addMethod(
  71094. smalltalk.method({
  71095. selector: "testEquality",
  71096. protocol: 'tests',
  71097. fn: function (){
  71098. var self=this;
  71099. var o;
  71100. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71102. return smalltalk.withContext(function($ctx1) {
  71103. //>>excludeEnd("ctx");
  71104. var $1,$2,$4,$3;
  71105. o=_st($Object())._new();
  71106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71107. $ctx1.sendIdx["new"]=1;
  71108. //>>excludeEnd("ctx");
  71109. $1=_st(o).__eq(_st($Object())._new());
  71110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71111. $ctx1.sendIdx["="]=1;
  71112. //>>excludeEnd("ctx");
  71113. self._deny_($1);
  71114. $2=_st(o).__eq(o);
  71115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71116. $ctx1.sendIdx["="]=2;
  71117. //>>excludeEnd("ctx");
  71118. self._assert_($2);
  71119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71120. $ctx1.sendIdx["assert:"]=1;
  71121. //>>excludeEnd("ctx");
  71122. $4=_st(o)._yourself();
  71123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71124. $ctx1.sendIdx["yourself"]=1;
  71125. //>>excludeEnd("ctx");
  71126. $3=_st($4).__eq(o);
  71127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71128. $ctx1.sendIdx["="]=3;
  71129. //>>excludeEnd("ctx");
  71130. self._assert_($3);
  71131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71132. $ctx1.sendIdx["assert:"]=2;
  71133. //>>excludeEnd("ctx");
  71134. self._assert_(_st(o).__eq(_st(o)._yourself()));
  71135. return self;
  71136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71137. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)});
  71138. //>>excludeEnd("ctx");
  71139. },
  71140. //>>excludeStart("ide", pragmas.excludeIdeData);
  71141. args: [],
  71142. source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: (o = o).\x0a\x09self assert: (o yourself = o).\x0a\x09self assert: (o = o yourself)",
  71143. referencedClasses: ["Object"],
  71144. //>>excludeEnd("ide");
  71145. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  71146. }),
  71147. globals.ObjectTest);
  71148. smalltalk.addMethod(
  71149. smalltalk.method({
  71150. selector: "testHalt",
  71151. protocol: 'tests',
  71152. fn: function (){
  71153. var self=this;
  71154. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71155. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  71156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71157. return smalltalk.withContext(function($ctx1) {
  71158. //>>excludeEnd("ctx");
  71159. self._should_raise_((function(){
  71160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71161. return smalltalk.withContext(function($ctx2) {
  71162. //>>excludeEnd("ctx");
  71163. return _st(_st($Object())._new())._halt();
  71164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  71166. //>>excludeEnd("ctx");
  71167. }),$Error());
  71168. return self;
  71169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71170. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)});
  71171. //>>excludeEnd("ctx");
  71172. },
  71173. //>>excludeStart("ide", pragmas.excludeIdeData);
  71174. args: [],
  71175. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  71176. referencedClasses: ["Object", "Error"],
  71177. //>>excludeEnd("ide");
  71178. messageSends: ["should:raise:", "halt", "new"]
  71179. }),
  71180. globals.ObjectTest);
  71181. smalltalk.addMethod(
  71182. smalltalk.method({
  71183. selector: "testIdentity",
  71184. protocol: 'tests',
  71185. fn: function (){
  71186. var self=this;
  71187. var o;
  71188. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71190. return smalltalk.withContext(function($ctx1) {
  71191. //>>excludeEnd("ctx");
  71192. var $1,$2,$4,$3;
  71193. o=_st($Object())._new();
  71194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71195. $ctx1.sendIdx["new"]=1;
  71196. //>>excludeEnd("ctx");
  71197. $1=_st(o).__eq_eq(_st($Object())._new());
  71198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71199. $ctx1.sendIdx["=="]=1;
  71200. //>>excludeEnd("ctx");
  71201. self._deny_($1);
  71202. $2=_st(o).__eq_eq(o);
  71203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71204. $ctx1.sendIdx["=="]=2;
  71205. //>>excludeEnd("ctx");
  71206. self._assert_($2);
  71207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71208. $ctx1.sendIdx["assert:"]=1;
  71209. //>>excludeEnd("ctx");
  71210. $4=_st(o)._yourself();
  71211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71212. $ctx1.sendIdx["yourself"]=1;
  71213. //>>excludeEnd("ctx");
  71214. $3=_st($4).__eq_eq(o);
  71215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71216. $ctx1.sendIdx["=="]=3;
  71217. //>>excludeEnd("ctx");
  71218. self._assert_($3);
  71219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71220. $ctx1.sendIdx["assert:"]=2;
  71221. //>>excludeEnd("ctx");
  71222. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  71223. return self;
  71224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71225. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)});
  71226. //>>excludeEnd("ctx");
  71227. },
  71228. //>>excludeStart("ide", pragmas.excludeIdeData);
  71229. args: [],
  71230. source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself",
  71231. referencedClasses: ["Object"],
  71232. //>>excludeEnd("ide");
  71233. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  71234. }),
  71235. globals.ObjectTest);
  71236. smalltalk.addMethod(
  71237. smalltalk.method({
  71238. selector: "testIfNil",
  71239. protocol: 'tests',
  71240. fn: function (){
  71241. var self=this;
  71242. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71244. return smalltalk.withContext(function($ctx1) {
  71245. //>>excludeEnd("ctx");
  71246. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  71247. $2=_st($Object())._new();
  71248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71249. $ctx1.sendIdx["new"]=1;
  71250. //>>excludeEnd("ctx");
  71251. $1=_st($2)._isNil();
  71252. self._deny_($1);
  71253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71254. $ctx1.sendIdx["deny:"]=1;
  71255. //>>excludeEnd("ctx");
  71256. $5=_st($Object())._new();
  71257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71258. $ctx1.sendIdx["new"]=2;
  71259. //>>excludeEnd("ctx");
  71260. if(($receiver = $5) == null || $receiver.isNil){
  71261. $4=true;
  71262. } else {
  71263. $4=$5;
  71264. };
  71265. $3=_st($4).__eq(true);
  71266. self._deny_($3);
  71267. $7=_st($Object())._new();
  71268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71269. $ctx1.sendIdx["new"]=3;
  71270. //>>excludeEnd("ctx");
  71271. if(($receiver = $7) == null || $receiver.isNil){
  71272. $6=$7;
  71273. } else {
  71274. $6=true;
  71275. };
  71276. self._assert_equals_($6,true);
  71277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71278. $ctx1.sendIdx["assert:equals:"]=1;
  71279. //>>excludeEnd("ctx");
  71280. $9=_st($Object())._new();
  71281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71282. $ctx1.sendIdx["new"]=4;
  71283. //>>excludeEnd("ctx");
  71284. if(($receiver = $9) == null || $receiver.isNil){
  71285. $8=false;
  71286. } else {
  71287. $8=true;
  71288. };
  71289. self._assert_equals_($8,true);
  71290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71291. $ctx1.sendIdx["assert:equals:"]=2;
  71292. //>>excludeEnd("ctx");
  71293. $11=_st($Object())._new();
  71294. if(($receiver = $11) == null || $receiver.isNil){
  71295. $10=false;
  71296. } else {
  71297. $10=true;
  71298. };
  71299. self._assert_equals_($10,true);
  71300. return self;
  71301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71302. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)});
  71303. //>>excludeEnd("ctx");
  71304. },
  71305. //>>excludeStart("ide", pragmas.excludeIdeData);
  71306. args: [],
  71307. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [ true ]) = true.\x0a\x09self assert: (Object new ifNotNil: [ true ]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [ false ] ifNotNil: [ true ]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [ true ] ifNil: [ false ]) equals: true",
  71308. referencedClasses: ["Object"],
  71309. //>>excludeEnd("ide");
  71310. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  71311. }),
  71312. globals.ObjectTest);
  71313. smalltalk.addMethod(
  71314. smalltalk.method({
  71315. selector: "testInstVars",
  71316. protocol: 'tests',
  71317. fn: function (){
  71318. var self=this;
  71319. var o;
  71320. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  71321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71322. return smalltalk.withContext(function($ctx1) {
  71323. //>>excludeEnd("ctx");
  71324. var $1,$2;
  71325. o=_st($ObjectMock())._new();
  71326. $1=_st(o)._instVarAt_("foo");
  71327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71328. $ctx1.sendIdx["instVarAt:"]=1;
  71329. //>>excludeEnd("ctx");
  71330. self._assert_equals_($1,nil);
  71331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71332. $ctx1.sendIdx["assert:equals:"]=1;
  71333. //>>excludeEnd("ctx");
  71334. _st(o)._instVarAt_put_("foo",(1));
  71335. $2=_st(o)._instVarAt_("foo");
  71336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71337. $ctx1.sendIdx["instVarAt:"]=2;
  71338. //>>excludeEnd("ctx");
  71339. self._assert_equals_($2,(1));
  71340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71341. $ctx1.sendIdx["assert:equals:"]=2;
  71342. //>>excludeEnd("ctx");
  71343. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  71344. return self;
  71345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71346. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)});
  71347. //>>excludeEnd("ctx");
  71348. },
  71349. //>>excludeStart("ide", pragmas.excludeIdeData);
  71350. args: [],
  71351. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1",
  71352. referencedClasses: ["ObjectMock"],
  71353. //>>excludeEnd("ide");
  71354. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  71355. }),
  71356. globals.ObjectTest);
  71357. smalltalk.addMethod(
  71358. smalltalk.method({
  71359. selector: "testNilUndefined",
  71360. protocol: 'tests',
  71361. fn: function (){
  71362. var self=this;
  71363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71364. return smalltalk.withContext(function($ctx1) {
  71365. //>>excludeEnd("ctx");
  71366. self._assert_equals_(self._notDefined(),nil);
  71367. return self;
  71368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71369. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)});
  71370. //>>excludeEnd("ctx");
  71371. },
  71372. //>>excludeStart("ide", pragmas.excludeIdeData);
  71373. args: [],
  71374. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  71375. referencedClasses: [],
  71376. //>>excludeEnd("ide");
  71377. messageSends: ["assert:equals:", "notDefined"]
  71378. }),
  71379. globals.ObjectTest);
  71380. smalltalk.addMethod(
  71381. smalltalk.method({
  71382. selector: "testYourself",
  71383. protocol: 'tests',
  71384. fn: function (){
  71385. var self=this;
  71386. var o;
  71387. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  71388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71389. return smalltalk.withContext(function($ctx1) {
  71390. //>>excludeEnd("ctx");
  71391. o=_st($ObjectMock())._new();
  71392. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  71393. return self;
  71394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71395. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)});
  71396. //>>excludeEnd("ctx");
  71397. },
  71398. //>>excludeStart("ide", pragmas.excludeIdeData);
  71399. args: [],
  71400. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  71401. referencedClasses: ["ObjectMock"],
  71402. //>>excludeEnd("ide");
  71403. messageSends: ["new", "assert:", "==", "yourself"]
  71404. }),
  71405. globals.ObjectTest);
  71406. smalltalk.addMethod(
  71407. smalltalk.method({
  71408. selector: "testidentityHash",
  71409. protocol: 'tests',
  71410. fn: function (){
  71411. var self=this;
  71412. var o1,o2;
  71413. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71415. return smalltalk.withContext(function($ctx1) {
  71416. //>>excludeEnd("ctx");
  71417. var $2,$3,$1,$5,$4;
  71418. o1=_st($Object())._new();
  71419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71420. $ctx1.sendIdx["new"]=1;
  71421. //>>excludeEnd("ctx");
  71422. o2=_st($Object())._new();
  71423. $2=_st(o1)._identityHash();
  71424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71425. $ctx1.sendIdx["identityHash"]=1;
  71426. //>>excludeEnd("ctx");
  71427. $3=_st(o1)._identityHash();
  71428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71429. $ctx1.sendIdx["identityHash"]=2;
  71430. //>>excludeEnd("ctx");
  71431. $1=_st($2).__eq_eq($3);
  71432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71433. $ctx1.sendIdx["=="]=1;
  71434. //>>excludeEnd("ctx");
  71435. self._assert_($1);
  71436. $5=_st(o1)._identityHash();
  71437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71438. $ctx1.sendIdx["identityHash"]=3;
  71439. //>>excludeEnd("ctx");
  71440. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  71441. self._deny_($4);
  71442. return self;
  71443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71444. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)});
  71445. //>>excludeEnd("ctx");
  71446. },
  71447. //>>excludeStart("ide", pragmas.excludeIdeData);
  71448. args: [],
  71449. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  71450. referencedClasses: ["Object"],
  71451. //>>excludeEnd("ide");
  71452. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  71453. }),
  71454. globals.ObjectTest);
  71455. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  71456. smalltalk.addMethod(
  71457. smalltalk.method({
  71458. selector: "testAccessing",
  71459. protocol: 'tests',
  71460. fn: function (){
  71461. var self=this;
  71462. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  71463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71464. return smalltalk.withContext(function($ctx1) {
  71465. //>>excludeEnd("ctx");
  71466. var $2,$1,$3,$6,$5,$4;
  71467. $2=_st($Point())._x_y_((3),(4));
  71468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71469. $ctx1.sendIdx["x:y:"]=1;
  71470. //>>excludeEnd("ctx");
  71471. $1=_st($2)._x();
  71472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71473. $ctx1.sendIdx["x"]=1;
  71474. //>>excludeEnd("ctx");
  71475. self._assert_equals_($1,(3));
  71476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71477. $ctx1.sendIdx["assert:equals:"]=1;
  71478. //>>excludeEnd("ctx");
  71479. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  71480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71481. $ctx1.sendIdx["y"]=1;
  71482. //>>excludeEnd("ctx");
  71483. self._assert_equals_($3,(4));
  71484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71485. $ctx1.sendIdx["assert:equals:"]=2;
  71486. //>>excludeEnd("ctx");
  71487. $6=_st($Point())._new();
  71488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71489. $ctx1.sendIdx["new"]=1;
  71490. //>>excludeEnd("ctx");
  71491. $5=_st($6)._x_((3));
  71492. $4=_st($5)._x();
  71493. self._assert_equals_($4,(3));
  71494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71495. $ctx1.sendIdx["assert:equals:"]=3;
  71496. //>>excludeEnd("ctx");
  71497. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  71498. return self;
  71499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71500. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)});
  71501. //>>excludeEnd("ctx");
  71502. },
  71503. //>>excludeStart("ide", pragmas.excludeIdeData);
  71504. args: [],
  71505. source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4",
  71506. referencedClasses: ["Point"],
  71507. //>>excludeEnd("ide");
  71508. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  71509. }),
  71510. globals.PointTest);
  71511. smalltalk.addMethod(
  71512. smalltalk.method({
  71513. selector: "testArithmetic",
  71514. protocol: 'tests',
  71515. fn: function (){
  71516. var self=this;
  71517. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  71518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71519. return smalltalk.withContext(function($ctx1) {
  71520. //>>excludeEnd("ctx");
  71521. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  71522. $2=(3).__at((4));
  71523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71524. $ctx1.sendIdx["@"]=1;
  71525. //>>excludeEnd("ctx");
  71526. $3=(3).__at((4));
  71527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71528. $ctx1.sendIdx["@"]=2;
  71529. //>>excludeEnd("ctx");
  71530. $1=_st($2).__star($3);
  71531. $4=_st($Point())._x_y_((9),(16));
  71532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71533. $ctx1.sendIdx["x:y:"]=1;
  71534. //>>excludeEnd("ctx");
  71535. self._assert_equals_($1,$4);
  71536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71537. $ctx1.sendIdx["assert:equals:"]=1;
  71538. //>>excludeEnd("ctx");
  71539. $6=(3).__at((4));
  71540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71541. $ctx1.sendIdx["@"]=3;
  71542. //>>excludeEnd("ctx");
  71543. $7=(3).__at((4));
  71544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71545. $ctx1.sendIdx["@"]=4;
  71546. //>>excludeEnd("ctx");
  71547. $5=_st($6).__plus($7);
  71548. $8=_st($Point())._x_y_((6),(8));
  71549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71550. $ctx1.sendIdx["x:y:"]=2;
  71551. //>>excludeEnd("ctx");
  71552. self._assert_equals_($5,$8);
  71553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71554. $ctx1.sendIdx["assert:equals:"]=2;
  71555. //>>excludeEnd("ctx");
  71556. $10=(3).__at((4));
  71557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71558. $ctx1.sendIdx["@"]=5;
  71559. //>>excludeEnd("ctx");
  71560. $11=(3).__at((4));
  71561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71562. $ctx1.sendIdx["@"]=6;
  71563. //>>excludeEnd("ctx");
  71564. $9=_st($10).__minus($11);
  71565. $12=_st($Point())._x_y_((0),(0));
  71566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71567. $ctx1.sendIdx["x:y:"]=3;
  71568. //>>excludeEnd("ctx");
  71569. self._assert_equals_($9,$12);
  71570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71571. $ctx1.sendIdx["assert:equals:"]=3;
  71572. //>>excludeEnd("ctx");
  71573. $14=(6).__at((8));
  71574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71575. $ctx1.sendIdx["@"]=7;
  71576. //>>excludeEnd("ctx");
  71577. $13=_st($14).__slash((3).__at((4)));
  71578. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  71579. return self;
  71580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71581. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)});
  71582. //>>excludeEnd("ctx");
  71583. },
  71584. //>>excludeStart("ide", pragmas.excludeIdeData);
  71585. args: [],
  71586. source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)",
  71587. referencedClasses: ["Point"],
  71588. //>>excludeEnd("ide");
  71589. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  71590. }),
  71591. globals.PointTest);
  71592. smalltalk.addMethod(
  71593. smalltalk.method({
  71594. selector: "testAt",
  71595. protocol: 'tests',
  71596. fn: function (){
  71597. var self=this;
  71598. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  71599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71600. return smalltalk.withContext(function($ctx1) {
  71601. //>>excludeEnd("ctx");
  71602. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  71603. return self;
  71604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71605. }, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)});
  71606. //>>excludeEnd("ctx");
  71607. },
  71608. //>>excludeStart("ide", pragmas.excludeIdeData);
  71609. args: [],
  71610. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  71611. referencedClasses: ["Point"],
  71612. //>>excludeEnd("ide");
  71613. messageSends: ["assert:equals:", "@", "x:y:"]
  71614. }),
  71615. globals.PointTest);
  71616. smalltalk.addMethod(
  71617. smalltalk.method({
  71618. selector: "testComparison",
  71619. protocol: 'tests',
  71620. fn: function (){
  71621. var self=this;
  71622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71623. return smalltalk.withContext(function($ctx1) {
  71624. //>>excludeEnd("ctx");
  71625. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  71626. $2=(3).__at((4));
  71627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71628. $ctx1.sendIdx["@"]=1;
  71629. //>>excludeEnd("ctx");
  71630. $3=(4).__at((5));
  71631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71632. $ctx1.sendIdx["@"]=2;
  71633. //>>excludeEnd("ctx");
  71634. $1=_st($2).__lt($3);
  71635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71636. $ctx1.sendIdx["<"]=1;
  71637. //>>excludeEnd("ctx");
  71638. self._assert_($1);
  71639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71640. $ctx1.sendIdx["assert:"]=1;
  71641. //>>excludeEnd("ctx");
  71642. $5=(3).__at((4));
  71643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71644. $ctx1.sendIdx["@"]=3;
  71645. //>>excludeEnd("ctx");
  71646. $6=(4).__at((4));
  71647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71648. $ctx1.sendIdx["@"]=4;
  71649. //>>excludeEnd("ctx");
  71650. $4=_st($5).__lt($6);
  71651. self._deny_($4);
  71652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71653. $ctx1.sendIdx["deny:"]=1;
  71654. //>>excludeEnd("ctx");
  71655. $8=(4).__at((5));
  71656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71657. $ctx1.sendIdx["@"]=5;
  71658. //>>excludeEnd("ctx");
  71659. $9=(4).__at((5));
  71660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71661. $ctx1.sendIdx["@"]=6;
  71662. //>>excludeEnd("ctx");
  71663. $7=_st($8).__lt_eq($9);
  71664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71665. $ctx1.sendIdx["<="]=1;
  71666. //>>excludeEnd("ctx");
  71667. self._assert_($7);
  71668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71669. $ctx1.sendIdx["assert:"]=2;
  71670. //>>excludeEnd("ctx");
  71671. $11=(4).__at((5));
  71672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71673. $ctx1.sendIdx["@"]=7;
  71674. //>>excludeEnd("ctx");
  71675. $12=(3).__at((5));
  71676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71677. $ctx1.sendIdx["@"]=8;
  71678. //>>excludeEnd("ctx");
  71679. $10=_st($11).__lt_eq($12);
  71680. self._deny_($10);
  71681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71682. $ctx1.sendIdx["deny:"]=2;
  71683. //>>excludeEnd("ctx");
  71684. $14=(5).__at((6));
  71685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71686. $ctx1.sendIdx["@"]=9;
  71687. //>>excludeEnd("ctx");
  71688. $15=(4).__at((5));
  71689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71690. $ctx1.sendIdx["@"]=10;
  71691. //>>excludeEnd("ctx");
  71692. $13=_st($14).__gt($15);
  71693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71694. $ctx1.sendIdx[">"]=1;
  71695. //>>excludeEnd("ctx");
  71696. self._assert_($13);
  71697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71698. $ctx1.sendIdx["assert:"]=3;
  71699. //>>excludeEnd("ctx");
  71700. $17=(5).__at((6));
  71701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71702. $ctx1.sendIdx["@"]=11;
  71703. //>>excludeEnd("ctx");
  71704. $18=(6).__at((6));
  71705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71706. $ctx1.sendIdx["@"]=12;
  71707. //>>excludeEnd("ctx");
  71708. $16=_st($17).__gt($18);
  71709. self._deny_($16);
  71710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71711. $ctx1.sendIdx["deny:"]=3;
  71712. //>>excludeEnd("ctx");
  71713. $20=(4).__at((5));
  71714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71715. $ctx1.sendIdx["@"]=13;
  71716. //>>excludeEnd("ctx");
  71717. $21=(4).__at((5));
  71718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71719. $ctx1.sendIdx["@"]=14;
  71720. //>>excludeEnd("ctx");
  71721. $19=_st($20).__gt_eq($21);
  71722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71723. $ctx1.sendIdx[">="]=1;
  71724. //>>excludeEnd("ctx");
  71725. self._assert_($19);
  71726. $23=(4).__at((5));
  71727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71728. $ctx1.sendIdx["@"]=15;
  71729. //>>excludeEnd("ctx");
  71730. $22=_st($23).__gt_eq((5).__at((5)));
  71731. self._deny_($22);
  71732. return self;
  71733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71734. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)});
  71735. //>>excludeEnd("ctx");
  71736. },
  71737. //>>excludeStart("ide", pragmas.excludeIdeData);
  71738. args: [],
  71739. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  71740. referencedClasses: [],
  71741. //>>excludeEnd("ide");
  71742. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  71743. }),
  71744. globals.PointTest);
  71745. smalltalk.addMethod(
  71746. smalltalk.method({
  71747. selector: "testEgality",
  71748. protocol: 'tests',
  71749. fn: function (){
  71750. var self=this;
  71751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71752. return smalltalk.withContext(function($ctx1) {
  71753. //>>excludeEnd("ctx");
  71754. var $2,$3,$1,$5,$4;
  71755. $2=(3).__at((4));
  71756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71757. $ctx1.sendIdx["@"]=1;
  71758. //>>excludeEnd("ctx");
  71759. $3=(3).__at((4));
  71760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71761. $ctx1.sendIdx["@"]=2;
  71762. //>>excludeEnd("ctx");
  71763. $1=_st($2).__eq($3);
  71764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71765. $ctx1.sendIdx["="]=1;
  71766. //>>excludeEnd("ctx");
  71767. self._assert_($1);
  71768. $5=(3).__at((5));
  71769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71770. $ctx1.sendIdx["@"]=3;
  71771. //>>excludeEnd("ctx");
  71772. $4=_st($5).__eq((3).__at((6)));
  71773. self._deny_($4);
  71774. return self;
  71775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71776. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)});
  71777. //>>excludeEnd("ctx");
  71778. },
  71779. //>>excludeStart("ide", pragmas.excludeIdeData);
  71780. args: [],
  71781. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  71782. referencedClasses: [],
  71783. //>>excludeEnd("ide");
  71784. messageSends: ["assert:", "=", "@", "deny:"]
  71785. }),
  71786. globals.PointTest);
  71787. smalltalk.addMethod(
  71788. smalltalk.method({
  71789. selector: "testNew",
  71790. protocol: 'tests',
  71791. fn: function (){
  71792. var self=this;
  71793. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  71794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71795. return smalltalk.withContext(function($ctx1) {
  71796. //>>excludeEnd("ctx");
  71797. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  71798. $3=_st($Point())._new();
  71799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71800. $ctx1.sendIdx["new"]=1;
  71801. //>>excludeEnd("ctx");
  71802. $2=_st($3)._x_((3));
  71803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71804. $ctx1.sendIdx["x:"]=1;
  71805. //>>excludeEnd("ctx");
  71806. $1=_st($2)._y();
  71807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71808. $ctx1.sendIdx["y"]=1;
  71809. //>>excludeEnd("ctx");
  71810. self._assert_equals_($1,nil);
  71811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71812. $ctx1.sendIdx["assert:equals:"]=1;
  71813. //>>excludeEnd("ctx");
  71814. $7=_st($Point())._new();
  71815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71816. $ctx1.sendIdx["new"]=2;
  71817. //>>excludeEnd("ctx");
  71818. $6=_st($7)._x_((3));
  71819. $5=_st($6)._x();
  71820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71821. $ctx1.sendIdx["x"]=1;
  71822. //>>excludeEnd("ctx");
  71823. $4=_st($5).__eq((0));
  71824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71825. $ctx1.sendIdx["="]=1;
  71826. //>>excludeEnd("ctx");
  71827. self._deny_($4);
  71828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71829. $ctx1.sendIdx["deny:"]=1;
  71830. //>>excludeEnd("ctx");
  71831. $10=_st($Point())._new();
  71832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71833. $ctx1.sendIdx["new"]=3;
  71834. //>>excludeEnd("ctx");
  71835. $9=_st($10)._y_((4));
  71836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71837. $ctx1.sendIdx["y:"]=1;
  71838. //>>excludeEnd("ctx");
  71839. $8=_st($9)._x();
  71840. self._assert_equals_($8,nil);
  71841. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  71842. return self;
  71843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71844. }, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)});
  71845. //>>excludeEnd("ctx");
  71846. },
  71847. //>>excludeStart("ide", pragmas.excludeIdeData);
  71848. args: [],
  71849. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  71850. referencedClasses: ["Point"],
  71851. //>>excludeEnd("ide");
  71852. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  71853. }),
  71854. globals.PointTest);
  71855. smalltalk.addMethod(
  71856. smalltalk.method({
  71857. selector: "testTranslateBy",
  71858. protocol: 'tests',
  71859. fn: function (){
  71860. var self=this;
  71861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71862. return smalltalk.withContext(function($ctx1) {
  71863. //>>excludeEnd("ctx");
  71864. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  71865. $2=(3).__at((3));
  71866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71867. $ctx1.sendIdx["@"]=1;
  71868. //>>excludeEnd("ctx");
  71869. $3=(0).__at((1));
  71870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71871. $ctx1.sendIdx["@"]=2;
  71872. //>>excludeEnd("ctx");
  71873. $1=_st($2)._translateBy_($3);
  71874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71875. $ctx1.sendIdx["translateBy:"]=1;
  71876. //>>excludeEnd("ctx");
  71877. $4=(3).__at((4));
  71878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71879. $ctx1.sendIdx["@"]=3;
  71880. //>>excludeEnd("ctx");
  71881. self._assert_equals_($1,$4);
  71882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71883. $ctx1.sendIdx["assert:equals:"]=1;
  71884. //>>excludeEnd("ctx");
  71885. $6=(3).__at((3));
  71886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71887. $ctx1.sendIdx["@"]=4;
  71888. //>>excludeEnd("ctx");
  71889. $8=(1)._negated();
  71890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71891. $ctx1.sendIdx["negated"]=1;
  71892. //>>excludeEnd("ctx");
  71893. $7=(0).__at($8);
  71894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71895. $ctx1.sendIdx["@"]=5;
  71896. //>>excludeEnd("ctx");
  71897. $5=_st($6)._translateBy_($7);
  71898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71899. $ctx1.sendIdx["translateBy:"]=2;
  71900. //>>excludeEnd("ctx");
  71901. $9=(3).__at((2));
  71902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71903. $ctx1.sendIdx["@"]=6;
  71904. //>>excludeEnd("ctx");
  71905. self._assert_equals_($5,$9);
  71906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71907. $ctx1.sendIdx["assert:equals:"]=2;
  71908. //>>excludeEnd("ctx");
  71909. $11=(3).__at((3));
  71910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71911. $ctx1.sendIdx["@"]=7;
  71912. //>>excludeEnd("ctx");
  71913. $12=(2).__at((3));
  71914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71915. $ctx1.sendIdx["@"]=8;
  71916. //>>excludeEnd("ctx");
  71917. $10=_st($11)._translateBy_($12);
  71918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71919. $ctx1.sendIdx["translateBy:"]=3;
  71920. //>>excludeEnd("ctx");
  71921. $13=(5).__at((6));
  71922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71923. $ctx1.sendIdx["@"]=9;
  71924. //>>excludeEnd("ctx");
  71925. self._assert_equals_($10,$13);
  71926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71927. $ctx1.sendIdx["assert:equals:"]=3;
  71928. //>>excludeEnd("ctx");
  71929. $15=(3).__at((3));
  71930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71931. $ctx1.sendIdx["@"]=10;
  71932. //>>excludeEnd("ctx");
  71933. $16=_st((3)._negated()).__at((0));
  71934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71935. $ctx1.sendIdx["@"]=11;
  71936. //>>excludeEnd("ctx");
  71937. $14=_st($15)._translateBy_($16);
  71938. self._assert_equals_($14,(0).__at((3)));
  71939. return self;
  71940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71941. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)});
  71942. //>>excludeEnd("ctx");
  71943. },
  71944. //>>excludeStart("ide", pragmas.excludeIdeData);
  71945. args: [],
  71946. source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.",
  71947. referencedClasses: [],
  71948. //>>excludeEnd("ide");
  71949. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  71950. }),
  71951. globals.PointTest);
  71952. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  71953. smalltalk.addMethod(
  71954. smalltalk.method({
  71955. selector: "testNextIfAbsent",
  71956. protocol: 'tests',
  71957. fn: function (){
  71958. var self=this;
  71959. var queue;
  71960. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  71961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71962. return smalltalk.withContext(function($ctx1) {
  71963. //>>excludeEnd("ctx");
  71964. var $2,$1;
  71965. queue=_st($Queue())._new();
  71966. _st(queue)._nextPut_("index1");
  71967. $2=_st(queue)._nextIfAbsent_("empty");
  71968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71969. $ctx1.sendIdx["nextIfAbsent:"]=1;
  71970. //>>excludeEnd("ctx");
  71971. $1=_st($2).__eq("index1");
  71972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71973. $ctx1.sendIdx["="]=1;
  71974. //>>excludeEnd("ctx");
  71975. self._assert_($1);
  71976. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  71977. return self;
  71978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71979. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)});
  71980. //>>excludeEnd("ctx");
  71981. },
  71982. //>>excludeStart("ide", pragmas.excludeIdeData);
  71983. args: [],
  71984. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  71985. referencedClasses: ["Queue"],
  71986. //>>excludeEnd("ide");
  71987. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  71988. }),
  71989. globals.QueueTest);
  71990. smalltalk.addMethod(
  71991. smalltalk.method({
  71992. selector: "testQueueNext",
  71993. protocol: 'tests',
  71994. fn: function (){
  71995. var self=this;
  71996. var queue;
  71997. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  71998. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  71999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72000. return smalltalk.withContext(function($ctx1) {
  72001. //>>excludeEnd("ctx");
  72002. var $1,$2,$4,$3,$6,$5;
  72003. queue=_st($Queue())._new();
  72004. $1=queue;
  72005. _st($1)._nextPut_("index1");
  72006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72007. $ctx1.sendIdx["nextPut:"]=1;
  72008. //>>excludeEnd("ctx");
  72009. $2=_st($1)._nextPut_("index2");
  72010. $4=_st(queue)._next();
  72011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72012. $ctx1.sendIdx["next"]=1;
  72013. //>>excludeEnd("ctx");
  72014. $3=_st($4).__eq("index1");
  72015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72016. $ctx1.sendIdx["="]=1;
  72017. //>>excludeEnd("ctx");
  72018. self._assert_($3);
  72019. $6=_st(queue)._next();
  72020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72021. $ctx1.sendIdx["next"]=2;
  72022. //>>excludeEnd("ctx");
  72023. $5=_st($6).__eq("index");
  72024. self._deny_($5);
  72025. self._should_raise_((function(){
  72026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72027. return smalltalk.withContext(function($ctx2) {
  72028. //>>excludeEnd("ctx");
  72029. return _st(queue)._next();
  72030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  72032. //>>excludeEnd("ctx");
  72033. }),$Error());
  72034. return self;
  72035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72036. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)});
  72037. //>>excludeEnd("ctx");
  72038. },
  72039. //>>excludeStart("ide", pragmas.excludeIdeData);
  72040. args: [],
  72041. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  72042. referencedClasses: ["Queue", "Error"],
  72043. //>>excludeEnd("ide");
  72044. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  72045. }),
  72046. globals.QueueTest);
  72047. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  72048. smalltalk.addMethod(
  72049. smalltalk.method({
  72050. selector: "testAtRandomNumber",
  72051. protocol: 'tests',
  72052. fn: function (){
  72053. var self=this;
  72054. var val;
  72055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72056. return smalltalk.withContext(function($ctx1) {
  72057. //>>excludeEnd("ctx");
  72058. (100)._timesRepeat_((function(){
  72059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72060. return smalltalk.withContext(function($ctx2) {
  72061. //>>excludeEnd("ctx");
  72062. val=(10)._atRandom();
  72063. val;
  72064. self._assert_(_st(val).__gt((0)));
  72065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72066. $ctx2.sendIdx["assert:"]=1;
  72067. //>>excludeEnd("ctx");
  72068. return self._assert_(_st(val).__lt((11)));
  72069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  72071. //>>excludeEnd("ctx");
  72072. }));
  72073. return self;
  72074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72075. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)});
  72076. //>>excludeEnd("ctx");
  72077. },
  72078. //>>excludeStart("ide", pragmas.excludeIdeData);
  72079. args: [],
  72080. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  72081. referencedClasses: [],
  72082. //>>excludeEnd("ide");
  72083. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  72084. }),
  72085. globals.RandomTest);
  72086. smalltalk.addMethod(
  72087. smalltalk.method({
  72088. selector: "testAtRandomSequenceableCollection",
  72089. protocol: 'tests',
  72090. fn: function (){
  72091. var self=this;
  72092. var val;
  72093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72094. return smalltalk.withContext(function($ctx1) {
  72095. //>>excludeEnd("ctx");
  72096. var $3,$4,$2,$1;
  72097. (100)._timesRepeat_((function(){
  72098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72099. return smalltalk.withContext(function($ctx2) {
  72100. //>>excludeEnd("ctx");
  72101. val="abc"._atRandom();
  72102. val;
  72103. $3=_st(val).__eq("a");
  72104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72105. $ctx2.sendIdx["="]=1;
  72106. //>>excludeEnd("ctx");
  72107. $4=_st(val).__eq("b");
  72108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72109. $ctx2.sendIdx["="]=2;
  72110. //>>excludeEnd("ctx");
  72111. $2=_st($3).__or($4);
  72112. $1=_st($2).__or(_st(val).__eq("c"));
  72113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72114. $ctx2.sendIdx["|"]=1;
  72115. //>>excludeEnd("ctx");
  72116. return self._assert_($1);
  72117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  72119. //>>excludeEnd("ctx");
  72120. }));
  72121. return self;
  72122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72123. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)});
  72124. //>>excludeEnd("ctx");
  72125. },
  72126. //>>excludeStart("ide", pragmas.excludeIdeData);
  72127. args: [],
  72128. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  72129. referencedClasses: [],
  72130. //>>excludeEnd("ide");
  72131. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  72132. }),
  72133. globals.RandomTest);
  72134. smalltalk.addMethod(
  72135. smalltalk.method({
  72136. selector: "textNext",
  72137. protocol: 'tests',
  72138. fn: function (){
  72139. var self=this;
  72140. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  72141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72142. return smalltalk.withContext(function($ctx1) {
  72143. //>>excludeEnd("ctx");
  72144. var $1;
  72145. (10000)._timesRepeat_((function(){
  72146. var current,next;
  72147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72148. return smalltalk.withContext(function($ctx2) {
  72149. //>>excludeEnd("ctx");
  72150. next=_st(_st($Random())._new())._next();
  72151. next;
  72152. self._assert_(_st(next).__gt_eq((0)));
  72153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72154. $ctx2.sendIdx["assert:"]=1;
  72155. //>>excludeEnd("ctx");
  72156. self._assert_(_st(next).__lt((1)));
  72157. $1=_st(current).__eq(next);
  72158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72159. $ctx2.sendIdx["="]=1;
  72160. //>>excludeEnd("ctx");
  72161. self._deny_($1);
  72162. return _st(next).__eq(current);
  72163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72164. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  72165. //>>excludeEnd("ctx");
  72166. }));
  72167. return self;
  72168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72169. }, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)});
  72170. //>>excludeEnd("ctx");
  72171. },
  72172. //>>excludeStart("ide", pragmas.excludeIdeData);
  72173. args: [],
  72174. source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next |\x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current ]",
  72175. referencedClasses: ["Random"],
  72176. //>>excludeEnd("ide");
  72177. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  72178. }),
  72179. globals.RandomTest);
  72180. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  72181. smalltalk.addMethod(
  72182. smalltalk.method({
  72183. selector: "collectionClass",
  72184. protocol: 'accessing',
  72185. fn: function (){
  72186. var self=this;
  72187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72188. return smalltalk.withContext(function($ctx1) {
  72189. //>>excludeEnd("ctx");
  72190. var $1;
  72191. $1=_st(self._class())._collectionClass();
  72192. return $1;
  72193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72194. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)});
  72195. //>>excludeEnd("ctx");
  72196. },
  72197. //>>excludeStart("ide", pragmas.excludeIdeData);
  72198. args: [],
  72199. source: "collectionClass\x0a\x09^ self class collectionClass",
  72200. referencedClasses: [],
  72201. //>>excludeEnd("ide");
  72202. messageSends: ["collectionClass", "class"]
  72203. }),
  72204. globals.StreamTest);
  72205. smalltalk.addMethod(
  72206. smalltalk.method({
  72207. selector: "newCollection",
  72208. protocol: 'accessing',
  72209. fn: function (){
  72210. var self=this;
  72211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72212. return smalltalk.withContext(function($ctx1) {
  72213. //>>excludeEnd("ctx");
  72214. var $1;
  72215. $1=_st(self._collectionClass())._new();
  72216. return $1;
  72217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72218. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)});
  72219. //>>excludeEnd("ctx");
  72220. },
  72221. //>>excludeStart("ide", pragmas.excludeIdeData);
  72222. args: [],
  72223. source: "newCollection\x0a\x09^ self collectionClass new",
  72224. referencedClasses: [],
  72225. //>>excludeEnd("ide");
  72226. messageSends: ["new", "collectionClass"]
  72227. }),
  72228. globals.StreamTest);
  72229. smalltalk.addMethod(
  72230. smalltalk.method({
  72231. selector: "newStream",
  72232. protocol: 'accessing',
  72233. fn: function (){
  72234. var self=this;
  72235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72236. return smalltalk.withContext(function($ctx1) {
  72237. //>>excludeEnd("ctx");
  72238. var $1;
  72239. $1=_st(_st(self._collectionClass())._new())._stream();
  72240. return $1;
  72241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72242. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)});
  72243. //>>excludeEnd("ctx");
  72244. },
  72245. //>>excludeStart("ide", pragmas.excludeIdeData);
  72246. args: [],
  72247. source: "newStream\x0a\x09^ self collectionClass new stream",
  72248. referencedClasses: [],
  72249. //>>excludeEnd("ide");
  72250. messageSends: ["stream", "new", "collectionClass"]
  72251. }),
  72252. globals.StreamTest);
  72253. smalltalk.addMethod(
  72254. smalltalk.method({
  72255. selector: "testAtStartAtEnd",
  72256. protocol: 'tests',
  72257. fn: function (){
  72258. var self=this;
  72259. var stream;
  72260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72261. return smalltalk.withContext(function($ctx1) {
  72262. //>>excludeEnd("ctx");
  72263. var $1,$2,$3,$4;
  72264. stream=self._newStream();
  72265. $1=_st(stream)._atStart();
  72266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72267. $ctx1.sendIdx["atStart"]=1;
  72268. //>>excludeEnd("ctx");
  72269. self._assert_($1);
  72270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72271. $ctx1.sendIdx["assert:"]=1;
  72272. //>>excludeEnd("ctx");
  72273. $2=_st(stream)._atEnd();
  72274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72275. $ctx1.sendIdx["atEnd"]=1;
  72276. //>>excludeEnd("ctx");
  72277. self._assert_($2);
  72278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72279. $ctx1.sendIdx["assert:"]=2;
  72280. //>>excludeEnd("ctx");
  72281. _st(stream)._nextPutAll_(self._newCollection());
  72282. $3=_st(stream)._atEnd();
  72283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72284. $ctx1.sendIdx["atEnd"]=2;
  72285. //>>excludeEnd("ctx");
  72286. self._assert_($3);
  72287. $4=_st(stream)._atStart();
  72288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72289. $ctx1.sendIdx["atStart"]=2;
  72290. //>>excludeEnd("ctx");
  72291. self._deny_($4);
  72292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72293. $ctx1.sendIdx["deny:"]=1;
  72294. //>>excludeEnd("ctx");
  72295. _st(stream)._position_((1));
  72296. self._deny_(_st(stream)._atEnd());
  72297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72298. $ctx1.sendIdx["deny:"]=2;
  72299. //>>excludeEnd("ctx");
  72300. self._deny_(_st(stream)._atStart());
  72301. return self;
  72302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72303. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)});
  72304. //>>excludeEnd("ctx");
  72305. },
  72306. //>>excludeStart("ide", pragmas.excludeIdeData);
  72307. args: [],
  72308. source: "testAtStartAtEnd\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream atStart.\x0a\x09self assert: stream atEnd.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self assert: stream atEnd.\x0a\x09self deny: stream atStart.\x0a\x09\x0a\x09stream position: 1.\x0a\x09self deny: stream atEnd.\x0a\x09self deny: stream atStart",
  72309. referencedClasses: [],
  72310. //>>excludeEnd("ide");
  72311. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  72312. }),
  72313. globals.StreamTest);
  72314. smalltalk.addMethod(
  72315. smalltalk.method({
  72316. selector: "testContents",
  72317. protocol: 'tests',
  72318. fn: function (){
  72319. var self=this;
  72320. var stream;
  72321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72322. return smalltalk.withContext(function($ctx1) {
  72323. //>>excludeEnd("ctx");
  72324. var $1,$2;
  72325. stream=self._newStream();
  72326. $1=stream;
  72327. $2=self._newCollection();
  72328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72329. $ctx1.sendIdx["newCollection"]=1;
  72330. //>>excludeEnd("ctx");
  72331. _st($1)._nextPutAll_($2);
  72332. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  72333. return self;
  72334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72335. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)});
  72336. //>>excludeEnd("ctx");
  72337. },
  72338. //>>excludeStart("ide", pragmas.excludeIdeData);
  72339. args: [],
  72340. source: "testContents\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: self newCollection.\x0a\x09\x0a\x09self assert: stream contents equals: self newCollection",
  72341. referencedClasses: [],
  72342. //>>excludeEnd("ide");
  72343. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  72344. }),
  72345. globals.StreamTest);
  72346. smalltalk.addMethod(
  72347. smalltalk.method({
  72348. selector: "testIsEmpty",
  72349. protocol: 'tests',
  72350. fn: function (){
  72351. var self=this;
  72352. var stream;
  72353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72354. return smalltalk.withContext(function($ctx1) {
  72355. //>>excludeEnd("ctx");
  72356. var $1;
  72357. stream=self._newStream();
  72358. $1=_st(stream)._isEmpty();
  72359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72360. $ctx1.sendIdx["isEmpty"]=1;
  72361. //>>excludeEnd("ctx");
  72362. self._assert_($1);
  72363. _st(stream)._nextPutAll_(self._newCollection());
  72364. self._deny_(_st(stream)._isEmpty());
  72365. return self;
  72366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72367. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)});
  72368. //>>excludeEnd("ctx");
  72369. },
  72370. //>>excludeStart("ide", pragmas.excludeIdeData);
  72371. args: [],
  72372. source: "testIsEmpty\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream isEmpty.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self deny: stream isEmpty",
  72373. referencedClasses: [],
  72374. //>>excludeEnd("ide");
  72375. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  72376. }),
  72377. globals.StreamTest);
  72378. smalltalk.addMethod(
  72379. smalltalk.method({
  72380. selector: "testPosition",
  72381. protocol: 'tests',
  72382. fn: function (){
  72383. var self=this;
  72384. var collection,stream;
  72385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72386. return smalltalk.withContext(function($ctx1) {
  72387. //>>excludeEnd("ctx");
  72388. var $1,$2,$3;
  72389. collection=self._newCollection();
  72390. stream=self._newStream();
  72391. _st(stream)._nextPutAll_(collection);
  72392. $1=_st(stream)._position();
  72393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72394. $ctx1.sendIdx["position"]=1;
  72395. //>>excludeEnd("ctx");
  72396. self._assert_equals_($1,_st(collection)._size());
  72397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72398. $ctx1.sendIdx["assert:equals:"]=1;
  72399. //>>excludeEnd("ctx");
  72400. _st(stream)._position_((0));
  72401. $2=_st(stream)._position();
  72402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72403. $ctx1.sendIdx["position"]=2;
  72404. //>>excludeEnd("ctx");
  72405. self._assert_equals_($2,(0));
  72406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72407. $ctx1.sendIdx["assert:equals:"]=2;
  72408. //>>excludeEnd("ctx");
  72409. _st(stream)._next();
  72410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72411. $ctx1.sendIdx["next"]=1;
  72412. //>>excludeEnd("ctx");
  72413. $3=_st(stream)._position();
  72414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72415. $ctx1.sendIdx["position"]=3;
  72416. //>>excludeEnd("ctx");
  72417. self._assert_equals_($3,(1));
  72418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72419. $ctx1.sendIdx["assert:equals:"]=3;
  72420. //>>excludeEnd("ctx");
  72421. _st(stream)._next();
  72422. self._assert_equals_(_st(stream)._position(),(2));
  72423. return self;
  72424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72425. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)});
  72426. //>>excludeEnd("ctx");
  72427. },
  72428. //>>excludeStart("ide", pragmas.excludeIdeData);
  72429. args: [],
  72430. source: "testPosition\x0a\x09| collection stream |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream position equals: collection size.\x0a\x09\x0a\x09stream position: 0.\x0a\x09self assert: stream position equals: 0.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 1.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 2",
  72431. referencedClasses: [],
  72432. //>>excludeEnd("ide");
  72433. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  72434. }),
  72435. globals.StreamTest);
  72436. smalltalk.addMethod(
  72437. smalltalk.method({
  72438. selector: "testReading",
  72439. protocol: 'tests',
  72440. fn: function (){
  72441. var self=this;
  72442. var stream,collection;
  72443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72444. return smalltalk.withContext(function($ctx1) {
  72445. //>>excludeEnd("ctx");
  72446. var $1,$2,$3;
  72447. collection=self._newCollection();
  72448. stream=self._newStream();
  72449. $1=stream;
  72450. _st($1)._nextPutAll_(collection);
  72451. $2=_st($1)._position_((0));
  72452. _st(collection)._do_((function(each){
  72453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72454. return smalltalk.withContext(function($ctx2) {
  72455. //>>excludeEnd("ctx");
  72456. $3=_st(stream)._next();
  72457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72458. $ctx2.sendIdx["next"]=1;
  72459. //>>excludeEnd("ctx");
  72460. return self._assert_equals_($3,each);
  72461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72462. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  72463. //>>excludeEnd("ctx");
  72464. }));
  72465. self._assert_(_st(_st(stream)._next())._isNil());
  72466. return self;
  72467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72468. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)});
  72469. //>>excludeEnd("ctx");
  72470. },
  72471. //>>excludeStart("ide", pragmas.excludeIdeData);
  72472. args: [],
  72473. source: "testReading\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream \x0a\x09\x09nextPutAll: collection;\x0a\x09\x09position: 0.\x0a\x09\x0a\x09collection do: [ :each |\x0a\x09\x09self assert: stream next equals: each ].\x0a\x09\x09\x0a\x09self assert: stream next isNil",
  72474. referencedClasses: [],
  72475. //>>excludeEnd("ide");
  72476. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  72477. }),
  72478. globals.StreamTest);
  72479. smalltalk.addMethod(
  72480. smalltalk.method({
  72481. selector: "testStreamContents",
  72482. protocol: 'tests',
  72483. fn: function (){
  72484. var self=this;
  72485. return self;
  72486. },
  72487. //>>excludeStart("ide", pragmas.excludeIdeData);
  72488. args: [],
  72489. source: "testStreamContents",
  72490. referencedClasses: [],
  72491. //>>excludeEnd("ide");
  72492. messageSends: []
  72493. }),
  72494. globals.StreamTest);
  72495. smalltalk.addMethod(
  72496. smalltalk.method({
  72497. selector: "testWrite",
  72498. protocol: 'tests',
  72499. fn: function (){
  72500. var self=this;
  72501. var stream,collection;
  72502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72503. return smalltalk.withContext(function($ctx1) {
  72504. //>>excludeEnd("ctx");
  72505. collection=self._newCollection();
  72506. stream=self._newStream();
  72507. _st(collection)._do_((function(each){
  72508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72509. return smalltalk.withContext(function($ctx2) {
  72510. //>>excludeEnd("ctx");
  72511. return _st(stream).__lt_lt(each);
  72512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72513. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  72514. //>>excludeEnd("ctx");
  72515. }));
  72516. self._assert_equals_(_st(stream)._contents(),collection);
  72517. return self;
  72518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72519. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)});
  72520. //>>excludeEnd("ctx");
  72521. },
  72522. //>>excludeStart("ide", pragmas.excludeIdeData);
  72523. args: [],
  72524. source: "testWrite\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream << each ].\x0a\x09self assert: stream contents equals: collection",
  72525. referencedClasses: [],
  72526. //>>excludeEnd("ide");
  72527. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  72528. }),
  72529. globals.StreamTest);
  72530. smalltalk.addMethod(
  72531. smalltalk.method({
  72532. selector: "testWriting",
  72533. protocol: 'tests',
  72534. fn: function (){
  72535. var self=this;
  72536. var stream,collection;
  72537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72538. return smalltalk.withContext(function($ctx1) {
  72539. //>>excludeEnd("ctx");
  72540. var $1;
  72541. collection=self._newCollection();
  72542. stream=self._newStream();
  72543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72544. $ctx1.sendIdx["newStream"]=1;
  72545. //>>excludeEnd("ctx");
  72546. _st(collection)._do_((function(each){
  72547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72548. return smalltalk.withContext(function($ctx2) {
  72549. //>>excludeEnd("ctx");
  72550. return _st(stream)._nextPut_(each);
  72551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  72553. //>>excludeEnd("ctx");
  72554. }));
  72555. $1=_st(stream)._contents();
  72556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72557. $ctx1.sendIdx["contents"]=1;
  72558. //>>excludeEnd("ctx");
  72559. self._assert_equals_($1,collection);
  72560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72561. $ctx1.sendIdx["assert:equals:"]=1;
  72562. //>>excludeEnd("ctx");
  72563. stream=self._newStream();
  72564. _st(stream)._nextPutAll_(collection);
  72565. self._assert_equals_(_st(stream)._contents(),collection);
  72566. return self;
  72567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72568. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)});
  72569. //>>excludeEnd("ctx");
  72570. },
  72571. //>>excludeStart("ide", pragmas.excludeIdeData);
  72572. args: [],
  72573. source: "testWriting\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream nextPut: each ].\x0a\x09self assert: stream contents equals: collection.\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream contents equals: collection",
  72574. referencedClasses: [],
  72575. //>>excludeEnd("ide");
  72576. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  72577. }),
  72578. globals.StreamTest);
  72579. smalltalk.addMethod(
  72580. smalltalk.method({
  72581. selector: "collectionClass",
  72582. protocol: 'accessing',
  72583. fn: function (){
  72584. var self=this;
  72585. return nil;
  72586. },
  72587. //>>excludeStart("ide", pragmas.excludeIdeData);
  72588. args: [],
  72589. source: "collectionClass\x0a\x09^ nil",
  72590. referencedClasses: [],
  72591. //>>excludeEnd("ide");
  72592. messageSends: []
  72593. }),
  72594. globals.StreamTest.klass);
  72595. smalltalk.addMethod(
  72596. smalltalk.method({
  72597. selector: "isAbstract",
  72598. protocol: 'testing',
  72599. fn: function (){
  72600. var self=this;
  72601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72602. return smalltalk.withContext(function($ctx1) {
  72603. //>>excludeEnd("ctx");
  72604. var $1;
  72605. $1=_st(self._collectionClass())._isNil();
  72606. return $1;
  72607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72608. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)});
  72609. //>>excludeEnd("ctx");
  72610. },
  72611. //>>excludeStart("ide", pragmas.excludeIdeData);
  72612. args: [],
  72613. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  72614. referencedClasses: [],
  72615. //>>excludeEnd("ide");
  72616. messageSends: ["isNil", "collectionClass"]
  72617. }),
  72618. globals.StreamTest.klass);
  72619. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  72620. smalltalk.addMethod(
  72621. smalltalk.method({
  72622. selector: "newCollection",
  72623. protocol: 'accessing',
  72624. fn: function (){
  72625. var self=this;
  72626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72627. return smalltalk.withContext(function($ctx1) {
  72628. //>>excludeEnd("ctx");
  72629. var $1;
  72630. $1=[true,(1),(3).__at((4)),"foo"];
  72631. return $1;
  72632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72633. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)});
  72634. //>>excludeEnd("ctx");
  72635. },
  72636. //>>excludeStart("ide", pragmas.excludeIdeData);
  72637. args: [],
  72638. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  72639. referencedClasses: [],
  72640. //>>excludeEnd("ide");
  72641. messageSends: ["@"]
  72642. }),
  72643. globals.ArrayStreamTest);
  72644. smalltalk.addMethod(
  72645. smalltalk.method({
  72646. selector: "collectionClass",
  72647. protocol: 'accessing',
  72648. fn: function (){
  72649. var self=this;
  72650. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  72651. return $Array();
  72652. },
  72653. //>>excludeStart("ide", pragmas.excludeIdeData);
  72654. args: [],
  72655. source: "collectionClass\x0a\x09^ Array",
  72656. referencedClasses: ["Array"],
  72657. //>>excludeEnd("ide");
  72658. messageSends: []
  72659. }),
  72660. globals.ArrayStreamTest.klass);
  72661. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  72662. smalltalk.addMethod(
  72663. smalltalk.method({
  72664. selector: "newCollection",
  72665. protocol: 'accessing',
  72666. fn: function (){
  72667. var self=this;
  72668. return "hello world";
  72669. },
  72670. //>>excludeStart("ide", pragmas.excludeIdeData);
  72671. args: [],
  72672. source: "newCollection\x0a\x09^ 'hello world'",
  72673. referencedClasses: [],
  72674. //>>excludeEnd("ide");
  72675. messageSends: []
  72676. }),
  72677. globals.StringStreamTest);
  72678. smalltalk.addMethod(
  72679. smalltalk.method({
  72680. selector: "collectionClass",
  72681. protocol: 'accessing',
  72682. fn: function (){
  72683. var self=this;
  72684. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  72685. return $String();
  72686. },
  72687. //>>excludeStart("ide", pragmas.excludeIdeData);
  72688. args: [],
  72689. source: "collectionClass\x0a\x09^ String",
  72690. referencedClasses: ["String"],
  72691. //>>excludeEnd("ide");
  72692. messageSends: []
  72693. }),
  72694. globals.StringStreamTest.klass);
  72695. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  72696. smalltalk.addMethod(
  72697. smalltalk.method({
  72698. selector: "testCopying",
  72699. protocol: 'tests',
  72700. fn: function (){
  72701. var self=this;
  72702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72703. return smalltalk.withContext(function($ctx1) {
  72704. //>>excludeEnd("ctx");
  72705. self._assert_equals_(nil._copy(),nil);
  72706. return self;
  72707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72708. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)});
  72709. //>>excludeEnd("ctx");
  72710. },
  72711. //>>excludeStart("ide", pragmas.excludeIdeData);
  72712. args: [],
  72713. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  72714. referencedClasses: [],
  72715. //>>excludeEnd("ide");
  72716. messageSends: ["assert:equals:", "copy"]
  72717. }),
  72718. globals.UndefinedTest);
  72719. smalltalk.addMethod(
  72720. smalltalk.method({
  72721. selector: "testDeepCopy",
  72722. protocol: 'tests',
  72723. fn: function (){
  72724. var self=this;
  72725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72726. return smalltalk.withContext(function($ctx1) {
  72727. //>>excludeEnd("ctx");
  72728. self._assert_(_st(nil._deepCopy()).__eq(nil));
  72729. return self;
  72730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72731. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)});
  72732. //>>excludeEnd("ctx");
  72733. },
  72734. //>>excludeStart("ide", pragmas.excludeIdeData);
  72735. args: [],
  72736. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  72737. referencedClasses: [],
  72738. //>>excludeEnd("ide");
  72739. messageSends: ["assert:", "=", "deepCopy"]
  72740. }),
  72741. globals.UndefinedTest);
  72742. smalltalk.addMethod(
  72743. smalltalk.method({
  72744. selector: "testIfNil",
  72745. protocol: 'tests',
  72746. fn: function (){
  72747. var self=this;
  72748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72749. return smalltalk.withContext(function($ctx1) {
  72750. //>>excludeEnd("ctx");
  72751. var $1,$3,$2,$4,$6,$5,$receiver;
  72752. if(($receiver = nil) == null || $receiver.isNil){
  72753. $1=true;
  72754. } else {
  72755. $1=nil;
  72756. };
  72757. self._assert_equals_($1,true);
  72758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72759. $ctx1.sendIdx["assert:equals:"]=1;
  72760. //>>excludeEnd("ctx");
  72761. if(($receiver = nil) == null || $receiver.isNil){
  72762. $3=nil;
  72763. } else {
  72764. $3=true;
  72765. };
  72766. $2=_st($3).__eq(true);
  72767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72768. $ctx1.sendIdx["="]=1;
  72769. //>>excludeEnd("ctx");
  72770. self._deny_($2);
  72771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72772. $ctx1.sendIdx["deny:"]=1;
  72773. //>>excludeEnd("ctx");
  72774. if(($receiver = nil) == null || $receiver.isNil){
  72775. $4=true;
  72776. } else {
  72777. $4=false;
  72778. };
  72779. self._assert_equals_($4,true);
  72780. if(($receiver = nil) == null || $receiver.isNil){
  72781. $6=false;
  72782. } else {
  72783. $6=true;
  72784. };
  72785. $5=_st($6).__eq(true);
  72786. self._deny_($5);
  72787. return self;
  72788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72789. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)});
  72790. //>>excludeEnd("ctx");
  72791. },
  72792. //>>excludeStart("ide", pragmas.excludeIdeData);
  72793. args: [],
  72794. source: "testIfNil\x0a\x09self assert: (nil ifNil: [ true ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ]) = true.\x0a\x09self assert: (nil ifNil: [ true ] ifNotNil: [ false ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ] ifNil: [ false ]) = true",
  72795. referencedClasses: [],
  72796. //>>excludeEnd("ide");
  72797. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  72798. }),
  72799. globals.UndefinedTest);
  72800. smalltalk.addMethod(
  72801. smalltalk.method({
  72802. selector: "testIsNil",
  72803. protocol: 'tests',
  72804. fn: function (){
  72805. var self=this;
  72806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72807. return smalltalk.withContext(function($ctx1) {
  72808. //>>excludeEnd("ctx");
  72809. self._assert_(nil._isNil());
  72810. self._deny_(nil._notNil());
  72811. return self;
  72812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72813. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)});
  72814. //>>excludeEnd("ctx");
  72815. },
  72816. //>>excludeStart("ide", pragmas.excludeIdeData);
  72817. args: [],
  72818. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  72819. referencedClasses: [],
  72820. //>>excludeEnd("ide");
  72821. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  72822. }),
  72823. globals.UndefinedTest);
  72824. });
  72825. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  72826. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  72827. smalltalk.addPackage('Compiler-Tests');
  72828. smalltalk.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  72829. smalltalk.addClass('ASTParsingTest', globals.TestCase, [], 'Compiler-Tests');
  72830. smalltalk.addMethod(
  72831. smalltalk.method({
  72832. selector: "analyze:forClass:",
  72833. protocol: 'convenience',
  72834. fn: function (aNode,aClass){
  72835. var self=this;
  72836. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  72837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72838. return smalltalk.withContext(function($ctx1) {
  72839. //>>excludeEnd("ctx");
  72840. _st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  72841. return aNode;
  72842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72843. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.ASTParsingTest)});
  72844. //>>excludeEnd("ctx");
  72845. },
  72846. //>>excludeStart("ide", pragmas.excludeIdeData);
  72847. args: ["aNode", "aClass"],
  72848. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  72849. referencedClasses: ["SemanticAnalyzer"],
  72850. //>>excludeEnd("ide");
  72851. messageSends: ["visit:", "on:"]
  72852. }),
  72853. globals.ASTParsingTest);
  72854. smalltalk.addMethod(
  72855. smalltalk.method({
  72856. selector: "parse:",
  72857. protocol: 'parsing',
  72858. fn: function (aString){
  72859. var self=this;
  72860. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  72861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72862. return smalltalk.withContext(function($ctx1) {
  72863. //>>excludeEnd("ctx");
  72864. var $1;
  72865. $1=_st($Smalltalk())._parse_(aString);
  72866. return $1;
  72867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72868. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.ASTParsingTest)});
  72869. //>>excludeEnd("ctx");
  72870. },
  72871. //>>excludeStart("ide", pragmas.excludeIdeData);
  72872. args: ["aString"],
  72873. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  72874. referencedClasses: ["Smalltalk"],
  72875. //>>excludeEnd("ide");
  72876. messageSends: ["parse:"]
  72877. }),
  72878. globals.ASTParsingTest);
  72879. smalltalk.addMethod(
  72880. smalltalk.method({
  72881. selector: "parse:forClass:",
  72882. protocol: 'parsing',
  72883. fn: function (aString,aClass){
  72884. var self=this;
  72885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72886. return smalltalk.withContext(function($ctx1) {
  72887. //>>excludeEnd("ctx");
  72888. var $1;
  72889. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  72890. return $1;
  72891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72892. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.ASTParsingTest)});
  72893. //>>excludeEnd("ctx");
  72894. },
  72895. //>>excludeStart("ide", pragmas.excludeIdeData);
  72896. args: ["aString", "aClass"],
  72897. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  72898. referencedClasses: [],
  72899. //>>excludeEnd("ide");
  72900. messageSends: ["analyze:forClass:", "parse:"]
  72901. }),
  72902. globals.ASTParsingTest);
  72903. smalltalk.addClass('ASTPCNodeVisitorTest', globals.ASTParsingTest, [], 'Compiler-Tests');
  72904. smalltalk.addMethod(
  72905. smalltalk.method({
  72906. selector: "astPCNodeVisitor",
  72907. protocol: 'factory',
  72908. fn: function (){
  72909. var self=this;
  72910. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  72911. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  72912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72913. return smalltalk.withContext(function($ctx1) {
  72914. //>>excludeEnd("ctx");
  72915. var $2,$3,$4,$5,$1;
  72916. $2=_st($ASTPCNodeVisitor())._new();
  72917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72918. $ctx1.sendIdx["new"]=1;
  72919. //>>excludeEnd("ctx");
  72920. $3=$2;
  72921. $4=_st(_st($AIContext())._new())._yourself();
  72922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72923. $ctx1.sendIdx["yourself"]=1;
  72924. //>>excludeEnd("ctx");
  72925. _st($3)._context_($4);
  72926. $5=_st($2)._yourself();
  72927. $1=$5;
  72928. return $1;
  72929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72930. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},globals.ASTPCNodeVisitorTest)});
  72931. //>>excludeEnd("ctx");
  72932. },
  72933. //>>excludeStart("ide", pragmas.excludeIdeData);
  72934. args: [],
  72935. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  72936. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  72937. //>>excludeEnd("ide");
  72938. messageSends: ["context:", "new", "yourself"]
  72939. }),
  72940. globals.ASTPCNodeVisitorTest);
  72941. smalltalk.addMethod(
  72942. smalltalk.method({
  72943. selector: "astPCNodeVisitorForSelector:",
  72944. protocol: 'factory',
  72945. fn: function (aString){
  72946. var self=this;
  72947. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  72948. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  72949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72950. return smalltalk.withContext(function($ctx1) {
  72951. //>>excludeEnd("ctx");
  72952. var $2,$3,$4,$5,$1;
  72953. $2=_st($ASTPCNodeVisitor())._new();
  72954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72955. $ctx1.sendIdx["new"]=1;
  72956. //>>excludeEnd("ctx");
  72957. _st($2)._selector_(aString);
  72958. $3=$2;
  72959. $4=_st(_st($AIContext())._new())._yourself();
  72960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72961. $ctx1.sendIdx["yourself"]=1;
  72962. //>>excludeEnd("ctx");
  72963. _st($3)._context_($4);
  72964. $5=_st($2)._yourself();
  72965. $1=$5;
  72966. return $1;
  72967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72968. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},globals.ASTPCNodeVisitorTest)});
  72969. //>>excludeEnd("ctx");
  72970. },
  72971. //>>excludeStart("ide", pragmas.excludeIdeData);
  72972. args: ["aString"],
  72973. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  72974. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  72975. //>>excludeEnd("ide");
  72976. messageSends: ["selector:", "new", "context:", "yourself"]
  72977. }),
  72978. globals.ASTPCNodeVisitorTest);
  72979. smalltalk.addMethod(
  72980. smalltalk.method({
  72981. selector: "testJSStatementNode",
  72982. protocol: 'tests',
  72983. fn: function (){
  72984. var self=this;
  72985. var ast,visitor;
  72986. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  72987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72988. return smalltalk.withContext(function($ctx1) {
  72989. //>>excludeEnd("ctx");
  72990. var $1,$2;
  72991. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  72992. $1=self._astPCNodeVisitor();
  72993. _st($1)._visit_(ast);
  72994. $2=_st($1)._currentNode();
  72995. self._assert_(_st($2)._isJSStatementNode());
  72996. return self;
  72997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72998. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)});
  72999. //>>excludeEnd("ctx");
  73000. },
  73001. //>>excludeStart("ide", pragmas.excludeIdeData);
  73002. args: [],
  73003. source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  73004. referencedClasses: ["Object"],
  73005. //>>excludeEnd("ide");
  73006. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  73007. }),
  73008. globals.ASTPCNodeVisitorTest);
  73009. smalltalk.addMethod(
  73010. smalltalk.method({
  73011. selector: "testMessageSend",
  73012. protocol: 'tests',
  73013. fn: function (){
  73014. var self=this;
  73015. var ast;
  73016. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73018. return smalltalk.withContext(function($ctx1) {
  73019. //>>excludeEnd("ctx");
  73020. var $1,$2;
  73021. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  73022. $1=self._astPCNodeVisitorForSelector_("yourself");
  73023. _st($1)._visit_(ast);
  73024. $2=_st($1)._currentNode();
  73025. self._assert_equals_(_st($2)._selector(),"yourself");
  73026. return self;
  73027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73028. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)});
  73029. //>>excludeEnd("ctx");
  73030. },
  73031. //>>excludeStart("ide", pragmas.excludeIdeData);
  73032. args: [],
  73033. source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  73034. referencedClasses: ["Object"],
  73035. //>>excludeEnd("ide");
  73036. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  73037. }),
  73038. globals.ASTPCNodeVisitorTest);
  73039. smalltalk.addMethod(
  73040. smalltalk.method({
  73041. selector: "testMessageSendWithBlocks",
  73042. protocol: 'tests',
  73043. fn: function (){
  73044. var self=this;
  73045. var ast;
  73046. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73048. return smalltalk.withContext(function($ctx1) {
  73049. //>>excludeEnd("ctx");
  73050. var $1,$2;
  73051. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  73052. $1=self._astPCNodeVisitorForSelector_("yourself");
  73053. _st($1)._visit_(ast);
  73054. $2=_st($1)._currentNode();
  73055. self._assert_equals_(_st($2)._selector(),"yourself");
  73056. return self;
  73057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73058. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},globals.ASTPCNodeVisitorTest)});
  73059. //>>excludeEnd("ctx");
  73060. },
  73061. //>>excludeStart("ide", pragmas.excludeIdeData);
  73062. args: [],
  73063. source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  73064. referencedClasses: ["Object"],
  73065. //>>excludeEnd("ide");
  73066. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  73067. }),
  73068. globals.ASTPCNodeVisitorTest);
  73069. smalltalk.addMethod(
  73070. smalltalk.method({
  73071. selector: "testMessageSendWithInlining",
  73072. protocol: 'tests',
  73073. fn: function (){
  73074. var self=this;
  73075. var ast;
  73076. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73078. return smalltalk.withContext(function($ctx1) {
  73079. //>>excludeEnd("ctx");
  73080. var $3,$4,$2,$1,$5,$6;
  73081. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  73082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73083. $ctx1.sendIdx["parse:forClass:"]=1;
  73084. //>>excludeEnd("ctx");
  73085. $3=self._astPCNodeVisitorForSelector_("yourself");
  73086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73087. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  73088. //>>excludeEnd("ctx");
  73089. _st($3)._visit_(ast);
  73090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73091. $ctx1.sendIdx["visit:"]=1;
  73092. //>>excludeEnd("ctx");
  73093. $4=_st($3)._currentNode();
  73094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73095. $ctx1.sendIdx["currentNode"]=1;
  73096. //>>excludeEnd("ctx");
  73097. $2=$4;
  73098. $1=_st($2)._selector();
  73099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73100. $ctx1.sendIdx["selector"]=1;
  73101. //>>excludeEnd("ctx");
  73102. self._assert_equals_($1,"yourself");
  73103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73104. $ctx1.sendIdx["assert:equals:"]=1;
  73105. //>>excludeEnd("ctx");
  73106. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  73107. $5=self._astPCNodeVisitorForSelector_("asBoolean");
  73108. _st($5)._visit_(ast);
  73109. $6=_st($5)._currentNode();
  73110. self._assert_equals_(_st($6)._selector(),"asBoolean");
  73111. return self;
  73112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73113. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},globals.ASTPCNodeVisitorTest)});
  73114. //>>excludeEnd("ctx");
  73115. },
  73116. //>>excludeStart("ide", pragmas.excludeIdeData);
  73117. args: [],
  73118. source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
  73119. referencedClasses: ["Object"],
  73120. //>>excludeEnd("ide");
  73121. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  73122. }),
  73123. globals.ASTPCNodeVisitorTest);
  73124. smalltalk.addMethod(
  73125. smalltalk.method({
  73126. selector: "testNoMessageSend",
  73127. protocol: 'tests',
  73128. fn: function (){
  73129. var self=this;
  73130. var ast;
  73131. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73133. return smalltalk.withContext(function($ctx1) {
  73134. //>>excludeEnd("ctx");
  73135. var $1,$2;
  73136. ast=self._parse_forClass_("foo ^ self",$Object());
  73137. $1=self._astPCNodeVisitor();
  73138. _st($1)._visit_(ast);
  73139. $2=_st($1)._currentNode();
  73140. self._assert_(_st($2)._isNil());
  73141. return self;
  73142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73143. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)});
  73144. //>>excludeEnd("ctx");
  73145. },
  73146. //>>excludeStart("ide", pragmas.excludeIdeData);
  73147. args: [],
  73148. source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil",
  73149. referencedClasses: ["Object"],
  73150. //>>excludeEnd("ide");
  73151. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  73152. }),
  73153. globals.ASTPCNodeVisitorTest);
  73154. smalltalk.addMethod(
  73155. smalltalk.method({
  73156. selector: "testPC",
  73157. protocol: 'tests',
  73158. fn: function (){
  73159. var self=this;
  73160. var ast,visitor;
  73161. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73163. return smalltalk.withContext(function($ctx1) {
  73164. //>>excludeEnd("ctx");
  73165. var $1,$2;
  73166. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  73167. $1=self._astPCNodeVisitor();
  73168. _st($1)._visit_(ast);
  73169. $2=_st($1)._currentNode();
  73170. self._assert_(_st($2)._isJSStatementNode());
  73171. return self;
  73172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73173. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)});
  73174. //>>excludeEnd("ctx");
  73175. },
  73176. //>>excludeStart("ide", pragmas.excludeIdeData);
  73177. args: [],
  73178. source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <console.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  73179. referencedClasses: ["Object"],
  73180. //>>excludeEnd("ide");
  73181. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  73182. }),
  73183. globals.ASTPCNodeVisitorTest);
  73184. smalltalk.addClass('ASTPositionTest', globals.ASTParsingTest, [], 'Compiler-Tests');
  73185. smalltalk.addMethod(
  73186. smalltalk.method({
  73187. selector: "testNodeAtPosition",
  73188. protocol: 'tests',
  73189. fn: function (){
  73190. var self=this;
  73191. var node;
  73192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73193. return smalltalk.withContext(function($ctx1) {
  73194. //>>excludeEnd("ctx");
  73195. var $3,$4,$2,$1,$7,$8,$6,$5;
  73196. node=self._parse_("yourself\x0a\x09^ self");
  73197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73198. $ctx1.sendIdx["parse:"]=1;
  73199. //>>excludeEnd("ctx");
  73200. $3=node;
  73201. $4=(2).__at((4));
  73202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73203. $ctx1.sendIdx["@"]=1;
  73204. //>>excludeEnd("ctx");
  73205. $2=_st($3)._navigationNodeAt_ifAbsent_($4,(function(){
  73206. return nil;
  73207. }));
  73208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73209. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  73210. //>>excludeEnd("ctx");
  73211. $1=_st($2)._source();
  73212. self._assert_equals_($1,"self");
  73213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73214. $ctx1.sendIdx["assert:equals:"]=1;
  73215. //>>excludeEnd("ctx");
  73216. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  73217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73218. $ctx1.sendIdx["parse:"]=2;
  73219. //>>excludeEnd("ctx");
  73220. $7=node;
  73221. $8=(2).__at((7));
  73222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73223. $ctx1.sendIdx["@"]=2;
  73224. //>>excludeEnd("ctx");
  73225. $6=_st($7)._navigationNodeAt_ifAbsent_($8,(function(){
  73226. return nil;
  73227. }));
  73228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73229. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  73230. //>>excludeEnd("ctx");
  73231. $5=_st($6)._selector();
  73232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73233. $ctx1.sendIdx["selector"]=1;
  73234. //>>excludeEnd("ctx");
  73235. self._assert_equals_($5,"ifTrue:");
  73236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73237. $ctx1.sendIdx["assert:equals:"]=2;
  73238. //>>excludeEnd("ctx");
  73239. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  73240. self._assert_equals_(_st(_st(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  73241. return nil;
  73242. })))._selector(),"foo");
  73243. return self;
  73244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73245. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},globals.ASTPositionTest)});
  73246. //>>excludeEnd("ctx");
  73247. },
  73248. //>>excludeStart("ide", pragmas.excludeIdeData);
  73249. args: [],
  73250. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  73251. referencedClasses: [],
  73252. //>>excludeEnd("ide");
  73253. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  73254. }),
  73255. globals.ASTPositionTest);
  73256. smalltalk.addClass('CodeGeneratorTest', globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  73257. smalltalk.addMethod(
  73258. smalltalk.method({
  73259. selector: "codeGeneratorClass",
  73260. protocol: 'accessing',
  73261. fn: function (){
  73262. var self=this;
  73263. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  73264. return $CodeGenerator();
  73265. },
  73266. //>>excludeStart("ide", pragmas.excludeIdeData);
  73267. args: [],
  73268. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  73269. referencedClasses: ["CodeGenerator"],
  73270. //>>excludeEnd("ide");
  73271. messageSends: []
  73272. }),
  73273. globals.CodeGeneratorTest);
  73274. smalltalk.addMethod(
  73275. smalltalk.method({
  73276. selector: "compiler",
  73277. protocol: 'factory',
  73278. fn: function (){
  73279. var self=this;
  73280. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  73281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73282. return smalltalk.withContext(function($ctx1) {
  73283. //>>excludeEnd("ctx");
  73284. var $2,$3,$1;
  73285. $2=_st($Compiler())._new();
  73286. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  73287. $3=_st($2)._yourself();
  73288. $1=$3;
  73289. return $1;
  73290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73291. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.CodeGeneratorTest)});
  73292. //>>excludeEnd("ctx");
  73293. },
  73294. //>>excludeStart("ide", pragmas.excludeIdeData);
  73295. args: [],
  73296. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  73297. referencedClasses: ["Compiler"],
  73298. //>>excludeEnd("ide");
  73299. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  73300. }),
  73301. globals.CodeGeneratorTest);
  73302. smalltalk.addMethod(
  73303. smalltalk.method({
  73304. selector: "setUp",
  73305. protocol: 'initialization',
  73306. fn: function (){
  73307. var self=this;
  73308. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  73309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73310. return smalltalk.withContext(function($ctx1) {
  73311. //>>excludeEnd("ctx");
  73312. self["@receiver"]=_st($DoIt())._new();
  73313. return self;
  73314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73315. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.CodeGeneratorTest)});
  73316. //>>excludeEnd("ctx");
  73317. },
  73318. //>>excludeStart("ide", pragmas.excludeIdeData);
  73319. args: [],
  73320. source: "setUp\x0a\x09receiver := DoIt new",
  73321. referencedClasses: ["DoIt"],
  73322. //>>excludeEnd("ide");
  73323. messageSends: ["new"]
  73324. }),
  73325. globals.CodeGeneratorTest);
  73326. smalltalk.addMethod(
  73327. smalltalk.method({
  73328. selector: "should:receiver:return:",
  73329. protocol: 'testing',
  73330. fn: function (aString,anObject,aResult){
  73331. var self=this;
  73332. var method,result;
  73333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73334. return smalltalk.withContext(function($ctx1) {
  73335. //>>excludeEnd("ctx");
  73336. var $1,$2;
  73337. self["@receiver"]=anObject;
  73338. $1=self._compiler();
  73339. $2=_st(anObject)._class();
  73340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73341. $ctx1.sendIdx["class"]=1;
  73342. //>>excludeEnd("ctx");
  73343. method=_st($1)._install_forClass_protocol_(aString,$2,"tests");
  73344. result=_st(self["@receiver"])._perform_(_st(method)._selector());
  73345. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  73346. self._assert_equals_(aResult,result);
  73347. return self;
  73348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73349. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},globals.CodeGeneratorTest)});
  73350. //>>excludeEnd("ctx");
  73351. },
  73352. //>>excludeStart("ide", pragmas.excludeIdeData);
  73353. args: ["aString", "anObject", "aResult"],
  73354. source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  73355. referencedClasses: [],
  73356. //>>excludeEnd("ide");
  73357. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  73358. }),
  73359. globals.CodeGeneratorTest);
  73360. smalltalk.addMethod(
  73361. smalltalk.method({
  73362. selector: "should:return:",
  73363. protocol: 'testing',
  73364. fn: function (aString,anObject){
  73365. var self=this;
  73366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73367. return smalltalk.withContext(function($ctx1) {
  73368. //>>excludeEnd("ctx");
  73369. var $1;
  73370. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  73371. return $1;
  73372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73373. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.CodeGeneratorTest)});
  73374. //>>excludeEnd("ctx");
  73375. },
  73376. //>>excludeStart("ide", pragmas.excludeIdeData);
  73377. args: ["aString", "anObject"],
  73378. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  73379. referencedClasses: [],
  73380. //>>excludeEnd("ide");
  73381. messageSends: ["should:receiver:return:"]
  73382. }),
  73383. globals.CodeGeneratorTest);
  73384. smalltalk.addMethod(
  73385. smalltalk.method({
  73386. selector: "tearDown",
  73387. protocol: 'initialization',
  73388. fn: function (){
  73389. var self=this;
  73390. return self;
  73391. },
  73392. //>>excludeStart("ide", pragmas.excludeIdeData);
  73393. args: [],
  73394. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  73395. referencedClasses: [],
  73396. //>>excludeEnd("ide");
  73397. messageSends: []
  73398. }),
  73399. globals.CodeGeneratorTest);
  73400. smalltalk.addMethod(
  73401. smalltalk.method({
  73402. selector: "testAssignment",
  73403. protocol: 'tests',
  73404. fn: function (){
  73405. var self=this;
  73406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73407. return smalltalk.withContext(function($ctx1) {
  73408. //>>excludeEnd("ctx");
  73409. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  73410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73411. $ctx1.sendIdx["should:return:"]=1;
  73412. //>>excludeEnd("ctx");
  73413. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  73414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73415. $ctx1.sendIdx["should:return:"]=2;
  73416. //>>excludeEnd("ctx");
  73417. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  73418. return self;
  73419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73420. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},globals.CodeGeneratorTest)});
  73421. //>>excludeEnd("ctx");
  73422. },
  73423. //>>excludeStart("ide", pragmas.excludeIdeData);
  73424. args: [],
  73425. source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1",
  73426. referencedClasses: [],
  73427. //>>excludeEnd("ide");
  73428. messageSends: ["should:return:"]
  73429. }),
  73430. globals.CodeGeneratorTest);
  73431. smalltalk.addMethod(
  73432. smalltalk.method({
  73433. selector: "testBackslashSelectors",
  73434. protocol: 'tests',
  73435. fn: function (){
  73436. var self=this;
  73437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73438. return smalltalk.withContext(function($ctx1) {
  73439. //>>excludeEnd("ctx");
  73440. self._should_return_("\x5c arg ^ 4",(4));
  73441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73442. $ctx1.sendIdx["should:return:"]=1;
  73443. //>>excludeEnd("ctx");
  73444. self._should_return_("\x5c\x5c arg ^ 42",(42));
  73445. return self;
  73446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73447. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},globals.CodeGeneratorTest)});
  73448. //>>excludeEnd("ctx");
  73449. },
  73450. //>>excludeStart("ide", pragmas.excludeIdeData);
  73451. args: [],
  73452. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  73453. referencedClasses: [],
  73454. //>>excludeEnd("ide");
  73455. messageSends: ["should:return:"]
  73456. }),
  73457. globals.CodeGeneratorTest);
  73458. smalltalk.addMethod(
  73459. smalltalk.method({
  73460. selector: "testBlockReturn",
  73461. protocol: 'tests',
  73462. fn: function (){
  73463. var self=this;
  73464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73465. return smalltalk.withContext(function($ctx1) {
  73466. //>>excludeEnd("ctx");
  73467. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  73468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73469. $ctx1.sendIdx["should:return:"]=1;
  73470. //>>excludeEnd("ctx");
  73471. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  73472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73473. $ctx1.sendIdx["should:return:"]=2;
  73474. //>>excludeEnd("ctx");
  73475. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  73476. return self;
  73477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73478. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},globals.CodeGeneratorTest)});
  73479. //>>excludeEnd("ctx");
  73480. },
  73481. //>>excludeStart("ide", pragmas.excludeIdeData);
  73482. args: [],
  73483. source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
  73484. referencedClasses: [],
  73485. //>>excludeEnd("ide");
  73486. messageSends: ["should:return:"]
  73487. }),
  73488. globals.CodeGeneratorTest);
  73489. smalltalk.addMethod(
  73490. smalltalk.method({
  73491. selector: "testCascades",
  73492. protocol: 'tests',
  73493. fn: function (){
  73494. var self=this;
  73495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73496. return smalltalk.withContext(function($ctx1) {
  73497. //>>excludeEnd("ctx");
  73498. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  73499. return self;
  73500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73501. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},globals.CodeGeneratorTest)});
  73502. //>>excludeEnd("ctx");
  73503. },
  73504. //>>excludeStart("ide", pragmas.excludeIdeData);
  73505. args: [],
  73506. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  73507. referencedClasses: [],
  73508. //>>excludeEnd("ide");
  73509. messageSends: ["should:return:"]
  73510. }),
  73511. globals.CodeGeneratorTest);
  73512. smalltalk.addMethod(
  73513. smalltalk.method({
  73514. selector: "testCascadesWithInlining",
  73515. protocol: 'tests',
  73516. fn: function (){
  73517. var self=this;
  73518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73519. return smalltalk.withContext(function($ctx1) {
  73520. //>>excludeEnd("ctx");
  73521. self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  73522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73523. $ctx1.sendIdx["should:return:"]=1;
  73524. //>>excludeEnd("ctx");
  73525. self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  73526. return self;
  73527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73528. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},globals.CodeGeneratorTest)});
  73529. //>>excludeEnd("ctx");
  73530. },
  73531. //>>excludeStart("ide", pragmas.excludeIdeData);
  73532. args: [],
  73533. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  73534. referencedClasses: [],
  73535. //>>excludeEnd("ide");
  73536. messageSends: ["should:return:"]
  73537. }),
  73538. globals.CodeGeneratorTest);
  73539. smalltalk.addMethod(
  73540. smalltalk.method({
  73541. selector: "testDynamicArrayElementsOrdered",
  73542. protocol: 'tests',
  73543. fn: function (){
  73544. var self=this;
  73545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73546. return smalltalk.withContext(function($ctx1) {
  73547. //>>excludeEnd("ctx");
  73548. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  73549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73550. $ctx1.sendIdx["should:return:"]=1;
  73551. //>>excludeEnd("ctx");
  73552. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  73553. return self;
  73554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73555. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},globals.CodeGeneratorTest)});
  73556. //>>excludeEnd("ctx");
  73557. },
  73558. //>>excludeStart("ide", pragmas.excludeIdeData);
  73559. args: [],
  73560. source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).",
  73561. referencedClasses: [],
  73562. //>>excludeEnd("ide");
  73563. messageSends: ["should:return:"]
  73564. }),
  73565. globals.CodeGeneratorTest);
  73566. smalltalk.addMethod(
  73567. smalltalk.method({
  73568. selector: "testDynamicDictionaryElementsOrdered",
  73569. protocol: 'tests',
  73570. fn: function (){
  73571. var self=this;
  73572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73573. return smalltalk.withContext(function($ctx1) {
  73574. //>>excludeEnd("ctx");
  73575. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  73576. return self;
  73577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73578. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},globals.CodeGeneratorTest)});
  73579. //>>excludeEnd("ctx");
  73580. },
  73581. //>>excludeStart("ide", pragmas.excludeIdeData);
  73582. args: [],
  73583. source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  73584. referencedClasses: [],
  73585. //>>excludeEnd("ide");
  73586. messageSends: ["should:return:"]
  73587. }),
  73588. globals.CodeGeneratorTest);
  73589. smalltalk.addMethod(
  73590. smalltalk.method({
  73591. selector: "testDynamicDictionaryWithMoreArrows",
  73592. protocol: 'tests',
  73593. fn: function (){
  73594. var self=this;
  73595. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  73596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73597. return smalltalk.withContext(function($ctx1) {
  73598. //>>excludeEnd("ctx");
  73599. var $2,$1;
  73600. $2=_st((1).__minus_gt((2))).__minus_gt((3));
  73601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73602. $ctx1.sendIdx["->"]=1;
  73603. //>>excludeEnd("ctx");
  73604. $1=_st($HashedCollection())._with_($2);
  73605. self._should_return_("foo ^ #{1->2->3}",$1);
  73606. return self;
  73607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73608. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},globals.CodeGeneratorTest)});
  73609. //>>excludeEnd("ctx");
  73610. },
  73611. //>>excludeStart("ide", pragmas.excludeIdeData);
  73612. args: [],
  73613. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  73614. referencedClasses: ["HashedCollection"],
  73615. //>>excludeEnd("ide");
  73616. messageSends: ["should:return:", "with:", "->"]
  73617. }),
  73618. globals.CodeGeneratorTest);
  73619. smalltalk.addMethod(
  73620. smalltalk.method({
  73621. selector: "testGlobalVar",
  73622. protocol: 'tests',
  73623. fn: function (){
  73624. var self=this;
  73625. function $BlockClosure(){return globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  73626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73627. return smalltalk.withContext(function($ctx1) {
  73628. //>>excludeEnd("ctx");
  73629. self._should_return_("foo ^ eval class",$BlockClosure());
  73630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73631. $ctx1.sendIdx["should:return:"]=1;
  73632. //>>excludeEnd("ctx");
  73633. self._should_return_("foo ^ Math cos: 0",(1));
  73634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73635. $ctx1.sendIdx["should:return:"]=2;
  73636. //>>excludeEnd("ctx");
  73637. self._should_return_("foo ^ NonExistingVar",nil);
  73638. return self;
  73639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73640. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},globals.CodeGeneratorTest)});
  73641. //>>excludeEnd("ctx");
  73642. },
  73643. //>>excludeStart("ide", pragmas.excludeIdeData);
  73644. args: [],
  73645. source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil",
  73646. referencedClasses: ["BlockClosure"],
  73647. //>>excludeEnd("ide");
  73648. messageSends: ["should:return:"]
  73649. }),
  73650. globals.CodeGeneratorTest);
  73651. smalltalk.addMethod(
  73652. smalltalk.method({
  73653. selector: "testInnerTemporalDependentElementsOrdered",
  73654. protocol: 'tests',
  73655. fn: function (){
  73656. var self=this;
  73657. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  73658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73659. return smalltalk.withContext(function($ctx1) {
  73660. //>>excludeEnd("ctx");
  73661. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  73662. $2="foo".__minus_gt($Array());
  73663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73664. $ctx1.sendIdx["->"]=1;
  73665. //>>excludeEnd("ctx");
  73666. $3="bar".__minus_gt((2));
  73667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73668. $ctx1.sendIdx["->"]=2;
  73669. //>>excludeEnd("ctx");
  73670. $1=[$2,$3];
  73671. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  73672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73673. $ctx1.sendIdx["should:return:"]=1;
  73674. //>>excludeEnd("ctx");
  73675. $5="foo".__minus_gt($Array());
  73676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73677. $ctx1.sendIdx["->"]=3;
  73678. //>>excludeEnd("ctx");
  73679. $6="bar".__minus_gt((2));
  73680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73681. $ctx1.sendIdx["->"]=4;
  73682. //>>excludeEnd("ctx");
  73683. $4=[$5,$6];
  73684. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  73685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73686. $ctx1.sendIdx["should:return:"]=2;
  73687. //>>excludeEnd("ctx");
  73688. $8="foo".__minus_gt((1));
  73689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73690. $ctx1.sendIdx["->"]=5;
  73691. //>>excludeEnd("ctx");
  73692. $9="bar".__minus_gt((2));
  73693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73694. $ctx1.sendIdx["->"]=6;
  73695. //>>excludeEnd("ctx");
  73696. $7=[$8,$9];
  73697. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  73698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73699. $ctx1.sendIdx["should:return:"]=3;
  73700. //>>excludeEnd("ctx");
  73701. $11="foo".__minus_gt((1));
  73702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73703. $ctx1.sendIdx["->"]=7;
  73704. //>>excludeEnd("ctx");
  73705. $10=[$11,"bar".__minus_gt((2))];
  73706. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  73707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73708. $ctx1.sendIdx["should:return:"]=4;
  73709. //>>excludeEnd("ctx");
  73710. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  73711. return self;
  73712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73713. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},globals.CodeGeneratorTest)});
  73714. //>>excludeEnd("ctx");
  73715. },
  73716. //>>excludeStart("ide", pragmas.excludeIdeData);
  73717. args: [],
  73718. source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  73719. referencedClasses: ["Array"],
  73720. //>>excludeEnd("ide");
  73721. messageSends: ["should:return:", "->"]
  73722. }),
  73723. globals.CodeGeneratorTest);
  73724. smalltalk.addMethod(
  73725. smalltalk.method({
  73726. selector: "testJSStatement",
  73727. protocol: 'tests',
  73728. fn: function (){
  73729. var self=this;
  73730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73731. return smalltalk.withContext(function($ctx1) {
  73732. //>>excludeEnd("ctx");
  73733. self._should_return_("foo <return 2+3>",(5));
  73734. return self;
  73735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73736. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},globals.CodeGeneratorTest)});
  73737. //>>excludeEnd("ctx");
  73738. },
  73739. //>>excludeStart("ide", pragmas.excludeIdeData);
  73740. args: [],
  73741. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  73742. referencedClasses: [],
  73743. //>>excludeEnd("ide");
  73744. messageSends: ["should:return:"]
  73745. }),
  73746. globals.CodeGeneratorTest);
  73747. smalltalk.addMethod(
  73748. smalltalk.method({
  73749. selector: "testLexicalScope",
  73750. protocol: 'tests',
  73751. fn: function (){
  73752. var self=this;
  73753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73754. return smalltalk.withContext(function($ctx1) {
  73755. //>>excludeEnd("ctx");
  73756. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  73757. return self;
  73758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73759. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},globals.CodeGeneratorTest)});
  73760. //>>excludeEnd("ctx");
  73761. },
  73762. //>>excludeStart("ide", pragmas.excludeIdeData);
  73763. args: [],
  73764. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  73765. referencedClasses: [],
  73766. //>>excludeEnd("ide");
  73767. messageSends: ["should:return:"]
  73768. }),
  73769. globals.CodeGeneratorTest);
  73770. smalltalk.addMethod(
  73771. smalltalk.method({
  73772. selector: "testLiterals",
  73773. protocol: 'tests',
  73774. fn: function (){
  73775. var self=this;
  73776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73777. return smalltalk.withContext(function($ctx1) {
  73778. //>>excludeEnd("ctx");
  73779. self._should_return_("foo ^ 1",(1));
  73780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73781. $ctx1.sendIdx["should:return:"]=1;
  73782. //>>excludeEnd("ctx");
  73783. self._should_return_("foo ^ 'hello'","hello");
  73784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73785. $ctx1.sendIdx["should:return:"]=2;
  73786. //>>excludeEnd("ctx");
  73787. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  73788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73789. $ctx1.sendIdx["should:return:"]=3;
  73790. //>>excludeEnd("ctx");
  73791. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  73792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73793. $ctx1.sendIdx["should:return:"]=4;
  73794. //>>excludeEnd("ctx");
  73795. self._should_return_("foo ^ true",true);
  73796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73797. $ctx1.sendIdx["should:return:"]=5;
  73798. //>>excludeEnd("ctx");
  73799. self._should_return_("foo ^ false",false);
  73800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73801. $ctx1.sendIdx["should:return:"]=6;
  73802. //>>excludeEnd("ctx");
  73803. self._should_return_("foo ^ #{1->2. 3->4}",globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  73804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73805. $ctx1.sendIdx["should:return:"]=7;
  73806. //>>excludeEnd("ctx");
  73807. self._should_return_("foo ^ #hello","hello");
  73808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73809. $ctx1.sendIdx["should:return:"]=8;
  73810. //>>excludeEnd("ctx");
  73811. self._should_return_("foo ^ $h","h");
  73812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73813. $ctx1.sendIdx["should:return:"]=9;
  73814. //>>excludeEnd("ctx");
  73815. self._should_return_("foo ^ -123.456",(-123.456));
  73816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73817. $ctx1.sendIdx["should:return:"]=10;
  73818. //>>excludeEnd("ctx");
  73819. self._should_return_("foo ^ -2.5e4",(-25000));
  73820. return self;
  73821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73822. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},globals.CodeGeneratorTest)});
  73823. //>>excludeEnd("ctx");
  73824. },
  73825. //>>excludeStart("ide", pragmas.excludeIdeData);
  73826. args: [],
  73827. source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ $h' return: 'h'.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.",
  73828. referencedClasses: [],
  73829. //>>excludeEnd("ide");
  73830. messageSends: ["should:return:"]
  73831. }),
  73832. globals.CodeGeneratorTest);
  73833. smalltalk.addMethod(
  73834. smalltalk.method({
  73835. selector: "testLocalReturn",
  73836. protocol: 'tests',
  73837. fn: function (){
  73838. var self=this;
  73839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73840. return smalltalk.withContext(function($ctx1) {
  73841. //>>excludeEnd("ctx");
  73842. self._should_return_("foo ^ 1",(1));
  73843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73844. $ctx1.sendIdx["should:return:"]=1;
  73845. //>>excludeEnd("ctx");
  73846. self._should_return_("foo ^ 1 + 1",(2));
  73847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73848. $ctx1.sendIdx["should:return:"]=2;
  73849. //>>excludeEnd("ctx");
  73850. self._should_return_("foo ",self["@receiver"]);
  73851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73852. $ctx1.sendIdx["should:return:"]=3;
  73853. //>>excludeEnd("ctx");
  73854. self._should_return_("foo self asString",self["@receiver"]);
  73855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73856. $ctx1.sendIdx["should:return:"]=4;
  73857. //>>excludeEnd("ctx");
  73858. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  73859. return self;
  73860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73861. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},globals.CodeGeneratorTest)});
  73862. //>>excludeEnd("ctx");
  73863. },
  73864. //>>excludeStart("ide", pragmas.excludeIdeData);
  73865. args: [],
  73866. source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
  73867. referencedClasses: [],
  73868. //>>excludeEnd("ide");
  73869. messageSends: ["should:return:"]
  73870. }),
  73871. globals.CodeGeneratorTest);
  73872. smalltalk.addMethod(
  73873. smalltalk.method({
  73874. selector: "testMessageSends",
  73875. protocol: 'tests',
  73876. fn: function (){
  73877. var self=this;
  73878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73879. return smalltalk.withContext(function($ctx1) {
  73880. //>>excludeEnd("ctx");
  73881. self._should_return_("foo ^ 1 asString","1");
  73882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73883. $ctx1.sendIdx["should:return:"]=1;
  73884. //>>excludeEnd("ctx");
  73885. self._should_return_("foo ^ 1 + 1",(2));
  73886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73887. $ctx1.sendIdx["should:return:"]=2;
  73888. //>>excludeEnd("ctx");
  73889. self._should_return_("foo ^ 1 + 2 * 3",(9));
  73890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73891. $ctx1.sendIdx["should:return:"]=3;
  73892. //>>excludeEnd("ctx");
  73893. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  73894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73895. $ctx1.sendIdx["should:return:"]=4;
  73896. //>>excludeEnd("ctx");
  73897. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  73898. return self;
  73899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73900. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},globals.CodeGeneratorTest)});
  73901. //>>excludeEnd("ctx");
  73902. },
  73903. //>>excludeStart("ide", pragmas.excludeIdeData);
  73904. args: [],
  73905. source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
  73906. referencedClasses: [],
  73907. //>>excludeEnd("ide");
  73908. messageSends: ["should:return:"]
  73909. }),
  73910. globals.CodeGeneratorTest);
  73911. smalltalk.addMethod(
  73912. smalltalk.method({
  73913. selector: "testMultipleSequences",
  73914. protocol: 'tests',
  73915. fn: function (){
  73916. var self=this;
  73917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73918. return smalltalk.withContext(function($ctx1) {
  73919. //>>excludeEnd("ctx");
  73920. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  73921. return self;
  73922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73923. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},globals.CodeGeneratorTest)});
  73924. //>>excludeEnd("ctx");
  73925. },
  73926. //>>excludeStart("ide", pragmas.excludeIdeData);
  73927. args: [],
  73928. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  73929. referencedClasses: [],
  73930. //>>excludeEnd("ide");
  73931. messageSends: ["should:return:"]
  73932. }),
  73933. globals.CodeGeneratorTest);
  73934. smalltalk.addMethod(
  73935. smalltalk.method({
  73936. selector: "testMutableLiterals",
  73937. protocol: 'tests',
  73938. fn: function (){
  73939. var self=this;
  73940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73941. return smalltalk.withContext(function($ctx1) {
  73942. //>>excludeEnd("ctx");
  73943. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  73944. return self;
  73945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73946. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},globals.CodeGeneratorTest)});
  73947. //>>excludeEnd("ctx");
  73948. },
  73949. //>>excludeStart("ide", pragmas.excludeIdeData);
  73950. args: [],
  73951. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://github.com/amber-smalltalk/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  73952. referencedClasses: [],
  73953. //>>excludeEnd("ide");
  73954. messageSends: ["should:return:"]
  73955. }),
  73956. globals.CodeGeneratorTest);
  73957. smalltalk.addMethod(
  73958. smalltalk.method({
  73959. selector: "testNestedIfTrue",
  73960. protocol: 'tests',
  73961. fn: function (){
  73962. var self=this;
  73963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73964. return smalltalk.withContext(function($ctx1) {
  73965. //>>excludeEnd("ctx");
  73966. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  73967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73968. $ctx1.sendIdx["should:return:"]=1;
  73969. //>>excludeEnd("ctx");
  73970. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  73971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73972. $ctx1.sendIdx["should:return:"]=2;
  73973. //>>excludeEnd("ctx");
  73974. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  73975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73976. $ctx1.sendIdx["should:return:"]=3;
  73977. //>>excludeEnd("ctx");
  73978. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  73979. return self;
  73980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73981. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},globals.CodeGeneratorTest)});
  73982. //>>excludeEnd("ctx");
  73983. },
  73984. //>>excludeStart("ide", pragmas.excludeIdeData);
  73985. args: [],
  73986. source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
  73987. referencedClasses: [],
  73988. //>>excludeEnd("ide");
  73989. messageSends: ["should:return:"]
  73990. }),
  73991. globals.CodeGeneratorTest);
  73992. smalltalk.addMethod(
  73993. smalltalk.method({
  73994. selector: "testNestedSends",
  73995. protocol: 'tests',
  73996. fn: function (){
  73997. var self=this;
  73998. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  73999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74000. return smalltalk.withContext(function($ctx1) {
  74001. //>>excludeEnd("ctx");
  74002. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",_st(_st($Point())._x_y_((2).__at((3)),(4)))._asString());
  74003. return self;
  74004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74005. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},globals.CodeGeneratorTest)});
  74006. //>>excludeEnd("ctx");
  74007. },
  74008. //>>excludeStart("ide", pragmas.excludeIdeData);
  74009. args: [],
  74010. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  74011. referencedClasses: ["Point"],
  74012. //>>excludeEnd("ide");
  74013. messageSends: ["should:return:", "asString", "x:y:", "@"]
  74014. }),
  74015. globals.CodeGeneratorTest);
  74016. smalltalk.addMethod(
  74017. smalltalk.method({
  74018. selector: "testNonLocalReturn",
  74019. protocol: 'tests',
  74020. fn: function (){
  74021. var self=this;
  74022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74023. return smalltalk.withContext(function($ctx1) {
  74024. //>>excludeEnd("ctx");
  74025. self._should_return_("foo [ ^ 1 ] value",(1));
  74026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74027. $ctx1.sendIdx["should:return:"]=1;
  74028. //>>excludeEnd("ctx");
  74029. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  74030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74031. $ctx1.sendIdx["should:return:"]=2;
  74032. //>>excludeEnd("ctx");
  74033. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  74034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74035. $ctx1.sendIdx["should:return:"]=3;
  74036. //>>excludeEnd("ctx");
  74037. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  74038. return self;
  74039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74040. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},globals.CodeGeneratorTest)});
  74041. //>>excludeEnd("ctx");
  74042. },
  74043. //>>excludeStart("ide", pragmas.excludeIdeData);
  74044. args: [],
  74045. source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
  74046. referencedClasses: [],
  74047. //>>excludeEnd("ide");
  74048. messageSends: ["should:return:"]
  74049. }),
  74050. globals.CodeGeneratorTest);
  74051. smalltalk.addMethod(
  74052. smalltalk.method({
  74053. selector: "testPascalCaseGlobal",
  74054. protocol: 'tests',
  74055. fn: function (){
  74056. var self=this;
  74057. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  74058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74059. return smalltalk.withContext(function($ctx1) {
  74060. //>>excludeEnd("ctx");
  74061. self._should_return_("foo ^Object",_st(_st($Smalltalk())._globals())._at_("Object"));
  74062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74063. $ctx1.sendIdx["should:return:"]=1;
  74064. //>>excludeEnd("ctx");
  74065. self._should_return_("foo ^NonExistent",nil);
  74066. return self;
  74067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74068. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},globals.CodeGeneratorTest)});
  74069. //>>excludeEnd("ctx");
  74070. },
  74071. //>>excludeStart("ide", pragmas.excludeIdeData);
  74072. args: [],
  74073. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  74074. referencedClasses: ["Smalltalk"],
  74075. //>>excludeEnd("ide");
  74076. messageSends: ["should:return:", "at:", "globals"]
  74077. }),
  74078. globals.CodeGeneratorTest);
  74079. smalltalk.addMethod(
  74080. smalltalk.method({
  74081. selector: "testSendReceiverAndArgumentsOrdered",
  74082. protocol: 'tests',
  74083. fn: function (){
  74084. var self=this;
  74085. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  74086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74087. return smalltalk.withContext(function($ctx1) {
  74088. //>>excludeEnd("ctx");
  74089. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  74090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74091. $ctx1.sendIdx["should:return:"]=1;
  74092. //>>excludeEnd("ctx");
  74093. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  74094. return self;
  74095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74096. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},globals.CodeGeneratorTest)});
  74097. //>>excludeEnd("ctx");
  74098. },
  74099. //>>excludeStart("ide", pragmas.excludeIdeData);
  74100. args: [],
  74101. source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.",
  74102. referencedClasses: ["Array"],
  74103. //>>excludeEnd("ide");
  74104. messageSends: ["should:return:"]
  74105. }),
  74106. globals.CodeGeneratorTest);
  74107. smalltalk.addMethod(
  74108. smalltalk.method({
  74109. selector: "testSuperSend",
  74110. protocol: 'tests',
  74111. fn: function (){
  74112. var self=this;
  74113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74114. return smalltalk.withContext(function($ctx1) {
  74115. //>>excludeEnd("ctx");
  74116. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  74117. return self;
  74118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74119. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},globals.CodeGeneratorTest)});
  74120. //>>excludeEnd("ctx");
  74121. },
  74122. //>>excludeStart("ide", pragmas.excludeIdeData);
  74123. args: [],
  74124. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  74125. referencedClasses: [],
  74126. //>>excludeEnd("ide");
  74127. messageSends: ["should:receiver:return:"]
  74128. }),
  74129. globals.CodeGeneratorTest);
  74130. smalltalk.addMethod(
  74131. smalltalk.method({
  74132. selector: "testTempVariables",
  74133. protocol: 'tests',
  74134. fn: function (){
  74135. var self=this;
  74136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74137. return smalltalk.withContext(function($ctx1) {
  74138. //>>excludeEnd("ctx");
  74139. self._should_return_("foo | a | ^ a",nil);
  74140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74141. $ctx1.sendIdx["should:return:"]=1;
  74142. //>>excludeEnd("ctx");
  74143. self._should_return_("foo | AVariable | ^ AVariable",nil);
  74144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74145. $ctx1.sendIdx["should:return:"]=2;
  74146. //>>excludeEnd("ctx");
  74147. self._should_return_("foo | a b c | ^ c",nil);
  74148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74149. $ctx1.sendIdx["should:return:"]=3;
  74150. //>>excludeEnd("ctx");
  74151. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  74152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74153. $ctx1.sendIdx["should:return:"]=4;
  74154. //>>excludeEnd("ctx");
  74155. self._should_return_("foo | a | a:= 1. ^ a",(1));
  74156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74157. $ctx1.sendIdx["should:return:"]=5;
  74158. //>>excludeEnd("ctx");
  74159. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  74160. return self;
  74161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74162. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},globals.CodeGeneratorTest)});
  74163. //>>excludeEnd("ctx");
  74164. },
  74165. //>>excludeStart("ide", pragmas.excludeIdeData);
  74166. args: [],
  74167. source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.",
  74168. referencedClasses: [],
  74169. //>>excludeEnd("ide");
  74170. messageSends: ["should:return:"]
  74171. }),
  74172. globals.CodeGeneratorTest);
  74173. smalltalk.addMethod(
  74174. smalltalk.method({
  74175. selector: "testThisContext",
  74176. protocol: 'tests',
  74177. fn: function (){
  74178. var self=this;
  74179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74180. return smalltalk.withContext(function($ctx1) {
  74181. //>>excludeEnd("ctx");
  74182. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  74183. return self;
  74184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74185. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},globals.CodeGeneratorTest)});
  74186. //>>excludeEnd("ctx");
  74187. },
  74188. //>>excludeStart("ide", pragmas.excludeIdeData);
  74189. args: [],
  74190. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  74191. referencedClasses: [],
  74192. //>>excludeEnd("ide");
  74193. messageSends: ["should:return:"]
  74194. }),
  74195. globals.CodeGeneratorTest);
  74196. smalltalk.addMethod(
  74197. smalltalk.method({
  74198. selector: "testifFalse",
  74199. protocol: 'tests',
  74200. fn: function (){
  74201. var self=this;
  74202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74203. return smalltalk.withContext(function($ctx1) {
  74204. //>>excludeEnd("ctx");
  74205. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  74206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74207. $ctx1.sendIdx["should:return:"]=1;
  74208. //>>excludeEnd("ctx");
  74209. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  74210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74211. $ctx1.sendIdx["should:return:"]=2;
  74212. //>>excludeEnd("ctx");
  74213. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  74214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74215. $ctx1.sendIdx["should:return:"]=3;
  74216. //>>excludeEnd("ctx");
  74217. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  74218. return self;
  74219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74220. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},globals.CodeGeneratorTest)});
  74221. //>>excludeEnd("ctx");
  74222. },
  74223. //>>excludeStart("ide", pragmas.excludeIdeData);
  74224. args: [],
  74225. source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
  74226. referencedClasses: [],
  74227. //>>excludeEnd("ide");
  74228. messageSends: ["should:return:"]
  74229. }),
  74230. globals.CodeGeneratorTest);
  74231. smalltalk.addMethod(
  74232. smalltalk.method({
  74233. selector: "testifFalseIfTrue",
  74234. protocol: 'tests',
  74235. fn: function (){
  74236. var self=this;
  74237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74238. return smalltalk.withContext(function($ctx1) {
  74239. //>>excludeEnd("ctx");
  74240. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  74241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74242. $ctx1.sendIdx["should:return:"]=1;
  74243. //>>excludeEnd("ctx");
  74244. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  74245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74246. $ctx1.sendIdx["should:return:"]=2;
  74247. //>>excludeEnd("ctx");
  74248. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  74249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74250. $ctx1.sendIdx["should:return:"]=3;
  74251. //>>excludeEnd("ctx");
  74252. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  74253. return self;
  74254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74255. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},globals.CodeGeneratorTest)});
  74256. //>>excludeEnd("ctx");
  74257. },
  74258. //>>excludeStart("ide", pragmas.excludeIdeData);
  74259. args: [],
  74260. source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
  74261. referencedClasses: [],
  74262. //>>excludeEnd("ide");
  74263. messageSends: ["should:return:"]
  74264. }),
  74265. globals.CodeGeneratorTest);
  74266. smalltalk.addMethod(
  74267. smalltalk.method({
  74268. selector: "testifNil",
  74269. protocol: 'tests',
  74270. fn: function (){
  74271. var self=this;
  74272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74273. return smalltalk.withContext(function($ctx1) {
  74274. //>>excludeEnd("ctx");
  74275. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  74276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74277. $ctx1.sendIdx["should:return:"]=1;
  74278. //>>excludeEnd("ctx");
  74279. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  74280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74281. $ctx1.sendIdx["should:return:"]=2;
  74282. //>>excludeEnd("ctx");
  74283. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  74284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74285. $ctx1.sendIdx["should:return:"]=3;
  74286. //>>excludeEnd("ctx");
  74287. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  74288. return self;
  74289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74290. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},globals.CodeGeneratorTest)});
  74291. //>>excludeEnd("ctx");
  74292. },
  74293. //>>excludeStart("ide", pragmas.excludeIdeData);
  74294. args: [],
  74295. source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
  74296. referencedClasses: [],
  74297. //>>excludeEnd("ide");
  74298. messageSends: ["should:return:"]
  74299. }),
  74300. globals.CodeGeneratorTest);
  74301. smalltalk.addMethod(
  74302. smalltalk.method({
  74303. selector: "testifNilIfNotNil",
  74304. protocol: 'tests',
  74305. fn: function (){
  74306. var self=this;
  74307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74308. return smalltalk.withContext(function($ctx1) {
  74309. //>>excludeEnd("ctx");
  74310. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  74311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74312. $ctx1.sendIdx["should:return:"]=1;
  74313. //>>excludeEnd("ctx");
  74314. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  74315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74316. $ctx1.sendIdx["should:return:"]=2;
  74317. //>>excludeEnd("ctx");
  74318. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  74319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74320. $ctx1.sendIdx["should:return:"]=3;
  74321. //>>excludeEnd("ctx");
  74322. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  74323. return self;
  74324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74325. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},globals.CodeGeneratorTest)});
  74326. //>>excludeEnd("ctx");
  74327. },
  74328. //>>excludeStart("ide", pragmas.excludeIdeData);
  74329. args: [],
  74330. source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
  74331. referencedClasses: [],
  74332. //>>excludeEnd("ide");
  74333. messageSends: ["should:return:"]
  74334. }),
  74335. globals.CodeGeneratorTest);
  74336. smalltalk.addMethod(
  74337. smalltalk.method({
  74338. selector: "testifNotNil",
  74339. protocol: 'tests',
  74340. fn: function (){
  74341. var self=this;
  74342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74343. return smalltalk.withContext(function($ctx1) {
  74344. //>>excludeEnd("ctx");
  74345. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  74346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74347. $ctx1.sendIdx["should:return:"]=1;
  74348. //>>excludeEnd("ctx");
  74349. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  74350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74351. $ctx1.sendIdx["should:return:"]=2;
  74352. //>>excludeEnd("ctx");
  74353. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  74354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74355. $ctx1.sendIdx["should:return:"]=3;
  74356. //>>excludeEnd("ctx");
  74357. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  74358. return self;
  74359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74360. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},globals.CodeGeneratorTest)});
  74361. //>>excludeEnd("ctx");
  74362. },
  74363. //>>excludeStart("ide", pragmas.excludeIdeData);
  74364. args: [],
  74365. source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
  74366. referencedClasses: [],
  74367. //>>excludeEnd("ide");
  74368. messageSends: ["should:return:"]
  74369. }),
  74370. globals.CodeGeneratorTest);
  74371. smalltalk.addMethod(
  74372. smalltalk.method({
  74373. selector: "testifNotNilWithArgument",
  74374. protocol: 'tests',
  74375. fn: function (){
  74376. var self=this;
  74377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74378. return smalltalk.withContext(function($ctx1) {
  74379. //>>excludeEnd("ctx");
  74380. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  74381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74382. $ctx1.sendIdx["should:return:"]=1;
  74383. //>>excludeEnd("ctx");
  74384. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  74385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74386. $ctx1.sendIdx["should:return:"]=2;
  74387. //>>excludeEnd("ctx");
  74388. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  74389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74390. $ctx1.sendIdx["should:return:"]=3;
  74391. //>>excludeEnd("ctx");
  74392. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  74393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74394. $ctx1.sendIdx["should:return:"]=4;
  74395. //>>excludeEnd("ctx");
  74396. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  74397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74398. $ctx1.sendIdx["should:return:"]=5;
  74399. //>>excludeEnd("ctx");
  74400. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  74401. return self;
  74402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74403. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},globals.CodeGeneratorTest)});
  74404. //>>excludeEnd("ctx");
  74405. },
  74406. //>>excludeStart("ide", pragmas.excludeIdeData);
  74407. args: [],
  74408. source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5",
  74409. referencedClasses: [],
  74410. //>>excludeEnd("ide");
  74411. messageSends: ["should:return:"]
  74412. }),
  74413. globals.CodeGeneratorTest);
  74414. smalltalk.addMethod(
  74415. smalltalk.method({
  74416. selector: "testifTrue",
  74417. protocol: 'tests',
  74418. fn: function (){
  74419. var self=this;
  74420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74421. return smalltalk.withContext(function($ctx1) {
  74422. //>>excludeEnd("ctx");
  74423. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  74424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74425. $ctx1.sendIdx["should:return:"]=1;
  74426. //>>excludeEnd("ctx");
  74427. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  74428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74429. $ctx1.sendIdx["should:return:"]=2;
  74430. //>>excludeEnd("ctx");
  74431. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  74432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74433. $ctx1.sendIdx["should:return:"]=3;
  74434. //>>excludeEnd("ctx");
  74435. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  74436. return self;
  74437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74438. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},globals.CodeGeneratorTest)});
  74439. //>>excludeEnd("ctx");
  74440. },
  74441. //>>excludeStart("ide", pragmas.excludeIdeData);
  74442. args: [],
  74443. source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
  74444. referencedClasses: [],
  74445. //>>excludeEnd("ide");
  74446. messageSends: ["should:return:"]
  74447. }),
  74448. globals.CodeGeneratorTest);
  74449. smalltalk.addMethod(
  74450. smalltalk.method({
  74451. selector: "testifTrueIfFalse",
  74452. protocol: 'tests',
  74453. fn: function (){
  74454. var self=this;
  74455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74456. return smalltalk.withContext(function($ctx1) {
  74457. //>>excludeEnd("ctx");
  74458. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  74459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74460. $ctx1.sendIdx["should:return:"]=1;
  74461. //>>excludeEnd("ctx");
  74462. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  74463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74464. $ctx1.sendIdx["should:return:"]=2;
  74465. //>>excludeEnd("ctx");
  74466. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  74467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74468. $ctx1.sendIdx["should:return:"]=3;
  74469. //>>excludeEnd("ctx");
  74470. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  74471. return self;
  74472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74473. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},globals.CodeGeneratorTest)});
  74474. //>>excludeEnd("ctx");
  74475. },
  74476. //>>excludeStart("ide", pragmas.excludeIdeData);
  74477. args: [],
  74478. source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
  74479. referencedClasses: [],
  74480. //>>excludeEnd("ide");
  74481. messageSends: ["should:return:"]
  74482. }),
  74483. globals.CodeGeneratorTest);
  74484. smalltalk.addClass('ASTInterpreterTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
  74485. smalltalk.addMethod(
  74486. smalltalk.method({
  74487. selector: "analyze:forClass:",
  74488. protocol: 'parsing',
  74489. fn: function (aNode,aClass){
  74490. var self=this;
  74491. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  74492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74493. return smalltalk.withContext(function($ctx1) {
  74494. //>>excludeEnd("ctx");
  74495. _st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  74496. return aNode;
  74497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74498. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.ASTInterpreterTest)});
  74499. //>>excludeEnd("ctx");
  74500. },
  74501. //>>excludeStart("ide", pragmas.excludeIdeData);
  74502. args: ["aNode", "aClass"],
  74503. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  74504. referencedClasses: ["SemanticAnalyzer"],
  74505. //>>excludeEnd("ide");
  74506. messageSends: ["visit:", "on:"]
  74507. }),
  74508. globals.ASTInterpreterTest);
  74509. smalltalk.addMethod(
  74510. smalltalk.method({
  74511. selector: "interpret:receiver:withArguments:",
  74512. protocol: 'private',
  74513. fn: function (aString,anObject,aDictionary){
  74514. var self=this;
  74515. var ctx,ast,interpreter;
  74516. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  74517. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  74518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74519. return smalltalk.withContext(function($ctx1) {
  74520. //>>excludeEnd("ctx");
  74521. var $1,$2,$3,$5,$6,$4,$receiver;
  74522. interpreter=_st($ASTInterpreter())._new();
  74523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74524. $ctx1.sendIdx["new"]=1;
  74525. //>>excludeEnd("ctx");
  74526. ast=self._parse_forClass_(aString,_st(anObject)._class());
  74527. $1=_st($AIContext())._new();
  74528. _st($1)._receiver_(anObject);
  74529. _st($1)._interpreter_(interpreter);
  74530. $2=_st($1)._yourself();
  74531. ctx=$2;
  74532. $3=_st(ast)._sequenceNode();
  74533. if(($receiver = $3) == null || $receiver.isNil){
  74534. $3;
  74535. } else {
  74536. var sequence;
  74537. sequence=$receiver;
  74538. _st(_st(sequence)._temps())._do_((function(each){
  74539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74540. return smalltalk.withContext(function($ctx2) {
  74541. //>>excludeEnd("ctx");
  74542. return _st(ctx)._defineLocal_(each);
  74543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  74545. //>>excludeEnd("ctx");
  74546. }));
  74547. };
  74548. _st(aDictionary)._keysAndValuesDo_((function(key,value){
  74549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74550. return smalltalk.withContext(function($ctx2) {
  74551. //>>excludeEnd("ctx");
  74552. return _st(ctx)._localAt_put_(key,value);
  74553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74554. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  74555. //>>excludeEnd("ctx");
  74556. }));
  74557. $5=interpreter;
  74558. _st($5)._context_(ctx);
  74559. _st($5)._interpret_(_st(ast)._nextChild());
  74560. _st($5)._proceed();
  74561. $6=_st($5)._result();
  74562. $4=$6;
  74563. return $4;
  74564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74565. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},globals.ASTInterpreterTest)});
  74566. //>>excludeEnd("ctx");
  74567. },
  74568. //>>excludeStart("ide", pragmas.excludeIdeData);
  74569. args: ["aString", "anObject", "aDictionary"],
  74570. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09interpret: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  74571. referencedClasses: ["ASTInterpreter", "AIContext"],
  74572. //>>excludeEnd("ide");
  74573. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"]
  74574. }),
  74575. globals.ASTInterpreterTest);
  74576. smalltalk.addMethod(
  74577. smalltalk.method({
  74578. selector: "parse:",
  74579. protocol: 'parsing',
  74580. fn: function (aString){
  74581. var self=this;
  74582. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  74583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74584. return smalltalk.withContext(function($ctx1) {
  74585. //>>excludeEnd("ctx");
  74586. var $1;
  74587. $1=_st($Smalltalk())._parse_(aString);
  74588. return $1;
  74589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74590. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.ASTInterpreterTest)});
  74591. //>>excludeEnd("ctx");
  74592. },
  74593. //>>excludeStart("ide", pragmas.excludeIdeData);
  74594. args: ["aString"],
  74595. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  74596. referencedClasses: ["Smalltalk"],
  74597. //>>excludeEnd("ide");
  74598. messageSends: ["parse:"]
  74599. }),
  74600. globals.ASTInterpreterTest);
  74601. smalltalk.addMethod(
  74602. smalltalk.method({
  74603. selector: "parse:forClass:",
  74604. protocol: 'parsing',
  74605. fn: function (aString,aClass){
  74606. var self=this;
  74607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74608. return smalltalk.withContext(function($ctx1) {
  74609. //>>excludeEnd("ctx");
  74610. var $1;
  74611. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  74612. return $1;
  74613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74614. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.ASTInterpreterTest)});
  74615. //>>excludeEnd("ctx");
  74616. },
  74617. //>>excludeStart("ide", pragmas.excludeIdeData);
  74618. args: ["aString", "aClass"],
  74619. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  74620. referencedClasses: [],
  74621. //>>excludeEnd("ide");
  74622. messageSends: ["analyze:forClass:", "parse:"]
  74623. }),
  74624. globals.ASTInterpreterTest);
  74625. smalltalk.addMethod(
  74626. smalltalk.method({
  74627. selector: "should:receiver:return:",
  74628. protocol: 'testing',
  74629. fn: function (aString,anObject,aResult){
  74630. var self=this;
  74631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74632. return smalltalk.withContext(function($ctx1) {
  74633. //>>excludeEnd("ctx");
  74634. var $1;
  74635. self["@receiver"]=anObject;
  74636. $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],globals.HashedCollection._newFromPairs_([])),aResult);
  74637. return $1;
  74638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74639. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},globals.ASTInterpreterTest)});
  74640. //>>excludeEnd("ctx");
  74641. },
  74642. //>>excludeStart("ide", pragmas.excludeIdeData);
  74643. args: ["aString", "anObject", "aResult"],
  74644. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult",
  74645. referencedClasses: [],
  74646. //>>excludeEnd("ide");
  74647. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  74648. }),
  74649. globals.ASTInterpreterTest);
  74650. smalltalk.addMethod(
  74651. smalltalk.method({
  74652. selector: "should:return:",
  74653. protocol: 'testing',
  74654. fn: function (aString,anObject){
  74655. var self=this;
  74656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74657. return smalltalk.withContext(function($ctx1) {
  74658. //>>excludeEnd("ctx");
  74659. var $1;
  74660. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  74661. return $1;
  74662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74663. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.ASTInterpreterTest)});
  74664. //>>excludeEnd("ctx");
  74665. },
  74666. //>>excludeStart("ide", pragmas.excludeIdeData);
  74667. args: ["aString", "anObject"],
  74668. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
  74669. referencedClasses: [],
  74670. //>>excludeEnd("ide");
  74671. messageSends: ["should:receiver:return:"]
  74672. }),
  74673. globals.ASTInterpreterTest);
  74674. smalltalk.addClass('ASTDebuggerTest', globals.ASTInterpreterTest, [], 'Compiler-Tests');
  74675. smalltalk.addMethod(
  74676. smalltalk.method({
  74677. selector: "interpret:receiver:withArguments:",
  74678. protocol: 'private',
  74679. fn: function (aString,anObject,aDictionary){
  74680. var self=this;
  74681. var ctx,ast,debugger_;
  74682. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  74683. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  74684. function $ASTDebugger(){return globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  74685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74686. return smalltalk.withContext(function($ctx1) {
  74687. //>>excludeEnd("ctx");
  74688. var $1,$2,$3,$4,$6,$7,$5,$receiver;
  74689. $1=_st($AIContext())._new();
  74690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74691. $ctx1.sendIdx["new"]=1;
  74692. //>>excludeEnd("ctx");
  74693. _st($1)._receiver_(anObject);
  74694. _st($1)._interpreter_(_st($ASTInterpreter())._new());
  74695. $2=_st($1)._yourself();
  74696. ctx=$2;
  74697. ast=self._parse_forClass_(aString,_st(anObject)._class());
  74698. $3=_st(ast)._sequenceNode();
  74699. if(($receiver = $3) == null || $receiver.isNil){
  74700. $3;
  74701. } else {
  74702. var sequence;
  74703. sequence=$receiver;
  74704. _st(_st(sequence)._temps())._do_((function(each){
  74705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74706. return smalltalk.withContext(function($ctx2) {
  74707. //>>excludeEnd("ctx");
  74708. return _st(ctx)._defineLocal_(each);
  74709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  74711. //>>excludeEnd("ctx");
  74712. }));
  74713. };
  74714. _st(aDictionary)._keysAndValuesDo_((function(key,value){
  74715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74716. return smalltalk.withContext(function($ctx2) {
  74717. //>>excludeEnd("ctx");
  74718. return _st(ctx)._localAt_put_(key,value);
  74719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74720. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  74721. //>>excludeEnd("ctx");
  74722. }));
  74723. $4=_st(ctx)._interpreter();
  74724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74725. $ctx1.sendIdx["interpreter"]=1;
  74726. //>>excludeEnd("ctx");
  74727. _st($4)._context_(ctx);
  74728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74729. $ctx1.sendIdx["context:"]=1;
  74730. //>>excludeEnd("ctx");
  74731. _st(_st(ctx)._interpreter())._node_(_st(ast)._nextChild());
  74732. debugger_=_st($ASTDebugger())._context_(ctx);
  74733. $6=debugger_;
  74734. _st($6)._proceed();
  74735. $7=_st($6)._result();
  74736. $5=$7;
  74737. return $5;
  74738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74739. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},globals.ASTDebuggerTest)});
  74740. //>>excludeEnd("ctx");
  74741. },
  74742. //>>excludeStart("ide", pragmas.excludeIdeData);
  74743. args: ["aString", "anObject", "aDictionary"],
  74744. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast nextChild.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  74745. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  74746. //>>excludeEnd("ide");
  74747. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"]
  74748. }),
  74749. globals.ASTDebuggerTest);
  74750. smalltalk.addClass('InliningCodeGeneratorTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
  74751. smalltalk.addMethod(
  74752. smalltalk.method({
  74753. selector: "codeGeneratorClass",
  74754. protocol: 'accessing',
  74755. fn: function (){
  74756. var self=this;
  74757. function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  74758. return $InliningCodeGenerator();
  74759. },
  74760. //>>excludeStart("ide", pragmas.excludeIdeData);
  74761. args: [],
  74762. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  74763. referencedClasses: ["InliningCodeGenerator"],
  74764. //>>excludeEnd("ide");
  74765. messageSends: []
  74766. }),
  74767. globals.InliningCodeGeneratorTest);
  74768. smalltalk.addClass('ScopeVarTest', globals.TestCase, [], 'Compiler-Tests');
  74769. smalltalk.addMethod(
  74770. smalltalk.method({
  74771. selector: "testClassRefVar",
  74772. protocol: 'tests',
  74773. fn: function (){
  74774. var self=this;
  74775. var node;
  74776. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74777. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  74778. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74780. return smalltalk.withContext(function($ctx1) {
  74781. //>>excludeEnd("ctx");
  74782. var $1,$2,$3,$4;
  74783. $1=_st($VariableNode())._new();
  74784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74785. $ctx1.sendIdx["new"]=1;
  74786. //>>excludeEnd("ctx");
  74787. _st($1)._value_("Object");
  74788. $2=_st($1)._yourself();
  74789. node=$2;
  74790. $3=_st($SemanticAnalyzer())._new();
  74791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74792. $ctx1.sendIdx["new"]=2;
  74793. //>>excludeEnd("ctx");
  74794. _st($3)._pushScope_(_st($MethodLexicalScope())._new());
  74795. $4=_st($3)._visit_(node);
  74796. self._assert_(_st(_st(node)._binding())._isClassRefVar());
  74797. return self;
  74798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74799. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},globals.ScopeVarTest)});
  74800. //>>excludeEnd("ctx");
  74801. },
  74802. //>>excludeStart("ide", pragmas.excludeIdeData);
  74803. args: [],
  74804. source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar",
  74805. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  74806. //>>excludeEnd("ide");
  74807. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  74808. }),
  74809. globals.ScopeVarTest);
  74810. smalltalk.addMethod(
  74811. smalltalk.method({
  74812. selector: "testInstanceVar",
  74813. protocol: 'tests',
  74814. fn: function (){
  74815. var self=this;
  74816. var node,scope;
  74817. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74818. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74820. return smalltalk.withContext(function($ctx1) {
  74821. //>>excludeEnd("ctx");
  74822. var $1,$2;
  74823. $1=_st($VariableNode())._new();
  74824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74825. $ctx1.sendIdx["new"]=1;
  74826. //>>excludeEnd("ctx");
  74827. _st($1)._value_("bzzz");
  74828. $2=_st($1)._yourself();
  74829. node=$2;
  74830. scope=_st($MethodLexicalScope())._new();
  74831. _st(scope)._addIVar_("bzzz");
  74832. self._assert_(_st(_st(scope)._bindingFor_(node))._isInstanceVar());
  74833. return self;
  74834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74835. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},globals.ScopeVarTest)});
  74836. //>>excludeEnd("ctx");
  74837. },
  74838. //>>excludeStart("ide", pragmas.excludeIdeData);
  74839. args: [],
  74840. source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
  74841. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  74842. //>>excludeEnd("ide");
  74843. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  74844. }),
  74845. globals.ScopeVarTest);
  74846. smalltalk.addMethod(
  74847. smalltalk.method({
  74848. selector: "testPseudoVar",
  74849. protocol: 'tests',
  74850. fn: function (){
  74851. var self=this;
  74852. var node,pseudoVars;
  74853. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74854. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74856. return smalltalk.withContext(function($ctx1) {
  74857. //>>excludeEnd("ctx");
  74858. var $1,$2;
  74859. pseudoVars=["self", "super", "true", "false", "nil"];
  74860. _st(pseudoVars)._do_((function(each){
  74861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74862. return smalltalk.withContext(function($ctx2) {
  74863. //>>excludeEnd("ctx");
  74864. $1=_st($VariableNode())._new();
  74865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74866. $ctx2.sendIdx["new"]=1;
  74867. //>>excludeEnd("ctx");
  74868. _st($1)._value_(each);
  74869. $2=_st($1)._yourself();
  74870. node=$2;
  74871. node;
  74872. return self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  74873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74874. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  74875. //>>excludeEnd("ctx");
  74876. }));
  74877. return self;
  74878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74879. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},globals.ScopeVarTest)});
  74880. //>>excludeEnd("ctx");
  74881. },
  74882. //>>excludeStart("ide", pragmas.excludeIdeData);
  74883. args: [],
  74884. source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar ]",
  74885. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  74886. //>>excludeEnd("ide");
  74887. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  74888. }),
  74889. globals.ScopeVarTest);
  74890. smalltalk.addMethod(
  74891. smalltalk.method({
  74892. selector: "testTempVar",
  74893. protocol: 'tests',
  74894. fn: function (){
  74895. var self=this;
  74896. var node,scope;
  74897. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74898. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74900. return smalltalk.withContext(function($ctx1) {
  74901. //>>excludeEnd("ctx");
  74902. var $1,$2;
  74903. $1=_st($VariableNode())._new();
  74904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74905. $ctx1.sendIdx["new"]=1;
  74906. //>>excludeEnd("ctx");
  74907. _st($1)._value_("bzzz");
  74908. $2=_st($1)._yourself();
  74909. node=$2;
  74910. scope=_st($MethodLexicalScope())._new();
  74911. _st(scope)._addTemp_("bzzz");
  74912. self._assert_(_st(_st(scope)._bindingFor_(node))._isTempVar());
  74913. return self;
  74914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74915. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},globals.ScopeVarTest)});
  74916. //>>excludeEnd("ctx");
  74917. },
  74918. //>>excludeStart("ide", pragmas.excludeIdeData);
  74919. args: [],
  74920. source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
  74921. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  74922. //>>excludeEnd("ide");
  74923. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  74924. }),
  74925. globals.ScopeVarTest);
  74926. smalltalk.addMethod(
  74927. smalltalk.method({
  74928. selector: "testUnknownVar",
  74929. protocol: 'tests',
  74930. fn: function (){
  74931. var self=this;
  74932. var node;
  74933. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74934. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74936. return smalltalk.withContext(function($ctx1) {
  74937. //>>excludeEnd("ctx");
  74938. var $1,$2;
  74939. $1=_st($VariableNode())._new();
  74940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74941. $ctx1.sendIdx["new"]=1;
  74942. //>>excludeEnd("ctx");
  74943. _st($1)._value_("bzzz");
  74944. $2=_st($1)._yourself();
  74945. node=$2;
  74946. self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  74947. return self;
  74948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74949. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},globals.ScopeVarTest)});
  74950. //>>excludeEnd("ctx");
  74951. },
  74952. //>>excludeStart("ide", pragmas.excludeIdeData);
  74953. args: [],
  74954. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  74955. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  74956. //>>excludeEnd("ide");
  74957. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  74958. }),
  74959. globals.ScopeVarTest);
  74960. smalltalk.addClass('SemanticAnalyzerTest', globals.TestCase, ['analyzer'], 'Compiler-Tests');
  74961. smalltalk.addMethod(
  74962. smalltalk.method({
  74963. selector: "setUp",
  74964. protocol: 'running',
  74965. fn: function (){
  74966. var self=this;
  74967. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  74968. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  74969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74970. return smalltalk.withContext(function($ctx1) {
  74971. //>>excludeEnd("ctx");
  74972. self["@analyzer"]=_st($SemanticAnalyzer())._on_($Object());
  74973. return self;
  74974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74975. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.SemanticAnalyzerTest)});
  74976. //>>excludeEnd("ctx");
  74977. },
  74978. //>>excludeStart("ide", pragmas.excludeIdeData);
  74979. args: [],
  74980. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  74981. referencedClasses: ["SemanticAnalyzer", "Object"],
  74982. //>>excludeEnd("ide");
  74983. messageSends: ["on:"]
  74984. }),
  74985. globals.SemanticAnalyzerTest);
  74986. smalltalk.addMethod(
  74987. smalltalk.method({
  74988. selector: "testAssignment",
  74989. protocol: 'tests',
  74990. fn: function (){
  74991. var self=this;
  74992. var src,ast;
  74993. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  74994. function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  74995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74996. return smalltalk.withContext(function($ctx1) {
  74997. //>>excludeEnd("ctx");
  74998. src="foo self := 1";
  74999. ast=_st($Smalltalk())._parse_(src);
  75000. self._should_raise_((function(){
  75001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75002. return smalltalk.withContext(function($ctx2) {
  75003. //>>excludeEnd("ctx");
  75004. return _st(self["@analyzer"])._visit_(ast);
  75005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75007. //>>excludeEnd("ctx");
  75008. }),$InvalidAssignmentError());
  75009. return self;
  75010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75011. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75012. //>>excludeEnd("ctx");
  75013. },
  75014. //>>excludeStart("ide", pragmas.excludeIdeData);
  75015. args: [],
  75016. source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
  75017. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  75018. //>>excludeEnd("ide");
  75019. messageSends: ["parse:", "should:raise:", "visit:"]
  75020. }),
  75021. globals.SemanticAnalyzerTest);
  75022. smalltalk.addMethod(
  75023. smalltalk.method({
  75024. selector: "testNonLocalReturn",
  75025. protocol: 'tests',
  75026. fn: function (){
  75027. var self=this;
  75028. var src,ast;
  75029. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75031. return smalltalk.withContext(function($ctx1) {
  75032. //>>excludeEnd("ctx");
  75033. src="foo | a | a + 1. ^ a";
  75034. ast=_st($Smalltalk())._parse_(src);
  75035. _st(self["@analyzer"])._visit_(ast);
  75036. self._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
  75037. return self;
  75038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75039. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75040. //>>excludeEnd("ctx");
  75041. },
  75042. //>>excludeStart("ide", pragmas.excludeIdeData);
  75043. args: [],
  75044. source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
  75045. referencedClasses: ["Smalltalk"],
  75046. //>>excludeEnd("ide");
  75047. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  75048. }),
  75049. globals.SemanticAnalyzerTest);
  75050. smalltalk.addMethod(
  75051. smalltalk.method({
  75052. selector: "testNonLocalReturn2",
  75053. protocol: 'tests',
  75054. fn: function (){
  75055. var self=this;
  75056. var src,ast;
  75057. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75059. return smalltalk.withContext(function($ctx1) {
  75060. //>>excludeEnd("ctx");
  75061. src="foo | a | a + 1. [ [ ^ a] ]";
  75062. ast=_st($Smalltalk())._parse_(src);
  75063. _st(self["@analyzer"])._visit_(ast);
  75064. self._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
  75065. return self;
  75066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75067. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75068. //>>excludeEnd("ctx");
  75069. },
  75070. //>>excludeStart("ide", pragmas.excludeIdeData);
  75071. args: [],
  75072. source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
  75073. referencedClasses: ["Smalltalk"],
  75074. //>>excludeEnd("ide");
  75075. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  75076. }),
  75077. globals.SemanticAnalyzerTest);
  75078. smalltalk.addMethod(
  75079. smalltalk.method({
  75080. selector: "testScope",
  75081. protocol: 'tests',
  75082. fn: function (){
  75083. var self=this;
  75084. var src,ast;
  75085. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75087. return smalltalk.withContext(function($ctx1) {
  75088. //>>excludeEnd("ctx");
  75089. var $4,$3,$2,$1;
  75090. src="foo | a | a + 1. [ | b | b := a ]";
  75091. ast=_st($Smalltalk())._parse_(src);
  75092. _st(self["@analyzer"])._visit_(ast);
  75093. $4=_st(_st(_st(ast)._nodes())._first())._nodes();
  75094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75095. $ctx1.sendIdx["nodes"]=1;
  75096. //>>excludeEnd("ctx");
  75097. $3=_st($4)._last();
  75098. $2=_st($3)._scope();
  75099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75100. $ctx1.sendIdx["scope"]=1;
  75101. //>>excludeEnd("ctx");
  75102. $1=_st($2).__eq_eq(_st(ast)._scope());
  75103. self._deny_($1);
  75104. return self;
  75105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75106. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75107. //>>excludeEnd("ctx");
  75108. },
  75109. //>>excludeStart("ide", pragmas.excludeIdeData);
  75110. args: [],
  75111. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.",
  75112. referencedClasses: ["Smalltalk"],
  75113. //>>excludeEnd("ide");
  75114. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  75115. }),
  75116. globals.SemanticAnalyzerTest);
  75117. smalltalk.addMethod(
  75118. smalltalk.method({
  75119. selector: "testScope2",
  75120. protocol: 'tests',
  75121. fn: function (){
  75122. var self=this;
  75123. var src,ast;
  75124. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75126. return smalltalk.withContext(function($ctx1) {
  75127. //>>excludeEnd("ctx");
  75128. var $8,$7,$6,$5,$4,$3,$2,$1;
  75129. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  75130. ast=_st($Smalltalk())._parse_(src);
  75131. _st(self["@analyzer"])._visit_(ast);
  75132. $8=_st(_st(_st(ast)._nodes())._first())._nodes();
  75133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75134. $ctx1.sendIdx["nodes"]=3;
  75135. //>>excludeEnd("ctx");
  75136. $7=_st($8)._last();
  75137. $6=_st($7)._nodes();
  75138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75139. $ctx1.sendIdx["nodes"]=2;
  75140. //>>excludeEnd("ctx");
  75141. $5=_st($6)._first();
  75142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75143. $ctx1.sendIdx["first"]=2;
  75144. //>>excludeEnd("ctx");
  75145. $4=_st($5)._nodes();
  75146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75147. $ctx1.sendIdx["nodes"]=1;
  75148. //>>excludeEnd("ctx");
  75149. $3=_st($4)._first();
  75150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75151. $ctx1.sendIdx["first"]=1;
  75152. //>>excludeEnd("ctx");
  75153. $2=_st($3)._scope();
  75154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75155. $ctx1.sendIdx["scope"]=1;
  75156. //>>excludeEnd("ctx");
  75157. $1=_st($2).__eq_eq(_st(ast)._scope());
  75158. self._deny_($1);
  75159. return self;
  75160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75161. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75162. //>>excludeEnd("ctx");
  75163. },
  75164. //>>excludeStart("ide", pragmas.excludeIdeData);
  75165. args: [],
  75166. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.",
  75167. referencedClasses: ["Smalltalk"],
  75168. //>>excludeEnd("ide");
  75169. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  75170. }),
  75171. globals.SemanticAnalyzerTest);
  75172. smalltalk.addMethod(
  75173. smalltalk.method({
  75174. selector: "testScopeLevel",
  75175. protocol: 'tests',
  75176. fn: function (){
  75177. var self=this;
  75178. var src,ast;
  75179. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75181. return smalltalk.withContext(function($ctx1) {
  75182. //>>excludeEnd("ctx");
  75183. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  75184. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  75185. ast=_st($Smalltalk())._parse_(src);
  75186. _st(self["@analyzer"])._visit_(ast);
  75187. $2=_st(ast)._scope();
  75188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75189. $ctx1.sendIdx["scope"]=1;
  75190. //>>excludeEnd("ctx");
  75191. $1=_st($2)._scopeLevel();
  75192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75193. $ctx1.sendIdx["scopeLevel"]=1;
  75194. //>>excludeEnd("ctx");
  75195. self._assert_equals_($1,(1));
  75196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75197. $ctx1.sendIdx["assert:equals:"]=1;
  75198. //>>excludeEnd("ctx");
  75199. $10=_st(_st(_st(ast)._nodes())._first())._nodes();
  75200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75201. $ctx1.sendIdx["nodes"]=3;
  75202. //>>excludeEnd("ctx");
  75203. $9=_st($10)._last();
  75204. $8=_st($9)._nodes();
  75205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75206. $ctx1.sendIdx["nodes"]=2;
  75207. //>>excludeEnd("ctx");
  75208. $7=_st($8)._first();
  75209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75210. $ctx1.sendIdx["first"]=2;
  75211. //>>excludeEnd("ctx");
  75212. $6=_st($7)._nodes();
  75213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75214. $ctx1.sendIdx["nodes"]=1;
  75215. //>>excludeEnd("ctx");
  75216. $5=_st($6)._first();
  75217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75218. $ctx1.sendIdx["first"]=1;
  75219. //>>excludeEnd("ctx");
  75220. $4=_st($5)._scope();
  75221. $3=_st($4)._scopeLevel();
  75222. self._assert_equals_($3,(3));
  75223. return self;
  75224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75225. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75226. //>>excludeEnd("ctx");
  75227. },
  75228. //>>excludeStart("ide", pragmas.excludeIdeData);
  75229. args: [],
  75230. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
  75231. referencedClasses: ["Smalltalk"],
  75232. //>>excludeEnd("ide");
  75233. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  75234. }),
  75235. globals.SemanticAnalyzerTest);
  75236. smalltalk.addMethod(
  75237. smalltalk.method({
  75238. selector: "testUnknownVariables",
  75239. protocol: 'tests',
  75240. fn: function (){
  75241. var self=this;
  75242. var src,ast;
  75243. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75244. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  75245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75246. return smalltalk.withContext(function($ctx1) {
  75247. //>>excludeEnd("ctx");
  75248. src="foo | a | b + a";
  75249. ast=_st($Smalltalk())._parse_(src);
  75250. self._should_raise_((function(){
  75251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75252. return smalltalk.withContext(function($ctx2) {
  75253. //>>excludeEnd("ctx");
  75254. return _st(self["@analyzer"])._visit_(ast);
  75255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75257. //>>excludeEnd("ctx");
  75258. }),$UnknownVariableError());
  75259. return self;
  75260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75261. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75262. //>>excludeEnd("ctx");
  75263. },
  75264. //>>excludeStart("ide", pragmas.excludeIdeData);
  75265. args: [],
  75266. source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  75267. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  75268. //>>excludeEnd("ide");
  75269. messageSends: ["parse:", "should:raise:", "visit:"]
  75270. }),
  75271. globals.SemanticAnalyzerTest);
  75272. smalltalk.addMethod(
  75273. smalltalk.method({
  75274. selector: "testUnknownVariablesWithScope",
  75275. protocol: 'tests',
  75276. fn: function (){
  75277. var self=this;
  75278. var src,ast;
  75279. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75280. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  75281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75282. return smalltalk.withContext(function($ctx1) {
  75283. //>>excludeEnd("ctx");
  75284. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  75285. ast=_st($Smalltalk())._parse_(src);
  75286. self._should_raise_((function(){
  75287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75288. return smalltalk.withContext(function($ctx2) {
  75289. //>>excludeEnd("ctx");
  75290. return _st(self["@analyzer"])._visit_(ast);
  75291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75293. //>>excludeEnd("ctx");
  75294. }),$UnknownVariableError());
  75295. return self;
  75296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75297. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75298. //>>excludeEnd("ctx");
  75299. },
  75300. //>>excludeStart("ide", pragmas.excludeIdeData);
  75301. args: [],
  75302. source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  75303. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  75304. //>>excludeEnd("ide");
  75305. messageSends: ["parse:", "should:raise:", "visit:"]
  75306. }),
  75307. globals.SemanticAnalyzerTest);
  75308. smalltalk.addMethod(
  75309. smalltalk.method({
  75310. selector: "testVariableShadowing",
  75311. protocol: 'tests',
  75312. fn: function (){
  75313. var self=this;
  75314. var src,ast;
  75315. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75317. return smalltalk.withContext(function($ctx1) {
  75318. //>>excludeEnd("ctx");
  75319. src="foo | a | a + 1";
  75320. ast=_st($Smalltalk())._parse_(src);
  75321. _st(self["@analyzer"])._visit_(ast);
  75322. return self;
  75323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75324. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75325. //>>excludeEnd("ctx");
  75326. },
  75327. //>>excludeStart("ide", pragmas.excludeIdeData);
  75328. args: [],
  75329. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  75330. referencedClasses: ["Smalltalk"],
  75331. //>>excludeEnd("ide");
  75332. messageSends: ["parse:", "visit:"]
  75333. }),
  75334. globals.SemanticAnalyzerTest);
  75335. smalltalk.addMethod(
  75336. smalltalk.method({
  75337. selector: "testVariableShadowing2",
  75338. protocol: 'tests',
  75339. fn: function (){
  75340. var self=this;
  75341. var src,ast;
  75342. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75343. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  75344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75345. return smalltalk.withContext(function($ctx1) {
  75346. //>>excludeEnd("ctx");
  75347. src="foo | a | a + 1. [ | a | a := 2 ]";
  75348. ast=_st($Smalltalk())._parse_(src);
  75349. self._should_raise_((function(){
  75350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75351. return smalltalk.withContext(function($ctx2) {
  75352. //>>excludeEnd("ctx");
  75353. return _st(self["@analyzer"])._visit_(ast);
  75354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75356. //>>excludeEnd("ctx");
  75357. }),$ShadowingVariableError());
  75358. return self;
  75359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75360. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75361. //>>excludeEnd("ctx");
  75362. },
  75363. //>>excludeStart("ide", pragmas.excludeIdeData);
  75364. args: [],
  75365. source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  75366. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  75367. //>>excludeEnd("ide");
  75368. messageSends: ["parse:", "should:raise:", "visit:"]
  75369. }),
  75370. globals.SemanticAnalyzerTest);
  75371. smalltalk.addMethod(
  75372. smalltalk.method({
  75373. selector: "testVariableShadowing3",
  75374. protocol: 'tests',
  75375. fn: function (){
  75376. var self=this;
  75377. var src,ast;
  75378. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75380. return smalltalk.withContext(function($ctx1) {
  75381. //>>excludeEnd("ctx");
  75382. src="foo | a | a + 1. [ | b | b := 2 ]";
  75383. ast=_st($Smalltalk())._parse_(src);
  75384. _st(self["@analyzer"])._visit_(ast);
  75385. return self;
  75386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75387. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75388. //>>excludeEnd("ctx");
  75389. },
  75390. //>>excludeStart("ide", pragmas.excludeIdeData);
  75391. args: [],
  75392. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  75393. referencedClasses: ["Smalltalk"],
  75394. //>>excludeEnd("ide");
  75395. messageSends: ["parse:", "visit:"]
  75396. }),
  75397. globals.SemanticAnalyzerTest);
  75398. smalltalk.addMethod(
  75399. smalltalk.method({
  75400. selector: "testVariableShadowing4",
  75401. protocol: 'tests',
  75402. fn: function (){
  75403. var self=this;
  75404. var src,ast;
  75405. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75407. return smalltalk.withContext(function($ctx1) {
  75408. //>>excludeEnd("ctx");
  75409. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  75410. ast=_st($Smalltalk())._parse_(src);
  75411. _st(self["@analyzer"])._visit_(ast);
  75412. return self;
  75413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75414. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75415. //>>excludeEnd("ctx");
  75416. },
  75417. //>>excludeStart("ide", pragmas.excludeIdeData);
  75418. args: [],
  75419. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  75420. referencedClasses: ["Smalltalk"],
  75421. //>>excludeEnd("ide");
  75422. messageSends: ["parse:", "visit:"]
  75423. }),
  75424. globals.SemanticAnalyzerTest);
  75425. smalltalk.addMethod(
  75426. smalltalk.method({
  75427. selector: "testVariableShadowing5",
  75428. protocol: 'tests',
  75429. fn: function (){
  75430. var self=this;
  75431. var src,ast;
  75432. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75433. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  75434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75435. return smalltalk.withContext(function($ctx1) {
  75436. //>>excludeEnd("ctx");
  75437. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  75438. ast=_st($Smalltalk())._parse_(src);
  75439. self._should_raise_((function(){
  75440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75441. return smalltalk.withContext(function($ctx2) {
  75442. //>>excludeEnd("ctx");
  75443. return _st(self["@analyzer"])._visit_(ast);
  75444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75446. //>>excludeEnd("ctx");
  75447. }),$ShadowingVariableError());
  75448. return self;
  75449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75450. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75451. //>>excludeEnd("ctx");
  75452. },
  75453. //>>excludeStart("ide", pragmas.excludeIdeData);
  75454. args: [],
  75455. source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  75456. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  75457. //>>excludeEnd("ide");
  75458. messageSends: ["parse:", "should:raise:", "visit:"]
  75459. }),
  75460. globals.SemanticAnalyzerTest);
  75461. smalltalk.addMethod(
  75462. smalltalk.method({
  75463. selector: "testVariablesLookup",
  75464. protocol: 'tests',
  75465. fn: function (){
  75466. var self=this;
  75467. var src,ast;
  75468. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75470. return smalltalk.withContext(function($ctx1) {
  75471. //>>excludeEnd("ctx");
  75472. var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28;
  75473. src="foo | a | a + 1. [ | b | b := a ]";
  75474. ast=_st($Smalltalk())._parse_(src);
  75475. _st(self["@analyzer"])._visit_(ast);
  75476. $7=_st(ast)._nodes();
  75477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75478. $ctx1.sendIdx["nodes"]=2;
  75479. //>>excludeEnd("ctx");
  75480. $6=_st($7)._first();
  75481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75482. $ctx1.sendIdx["first"]=2;
  75483. //>>excludeEnd("ctx");
  75484. $5=_st($6)._nodes();
  75485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75486. $ctx1.sendIdx["nodes"]=1;
  75487. //>>excludeEnd("ctx");
  75488. $4=_st($5)._first();
  75489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75490. $ctx1.sendIdx["first"]=1;
  75491. //>>excludeEnd("ctx");
  75492. $3=_st($4)._receiver();
  75493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75494. $ctx1.sendIdx["receiver"]=1;
  75495. //>>excludeEnd("ctx");
  75496. $2=_st($3)._binding();
  75497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75498. $ctx1.sendIdx["binding"]=1;
  75499. //>>excludeEnd("ctx");
  75500. $1=_st($2)._isTempVar();
  75501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75502. $ctx1.sendIdx["isTempVar"]=1;
  75503. //>>excludeEnd("ctx");
  75504. self._assert_($1);
  75505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75506. $ctx1.sendIdx["assert:"]=1;
  75507. //>>excludeEnd("ctx");
  75508. $15=_st(ast)._nodes();
  75509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75510. $ctx1.sendIdx["nodes"]=4;
  75511. //>>excludeEnd("ctx");
  75512. $14=_st($15)._first();
  75513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75514. $ctx1.sendIdx["first"]=4;
  75515. //>>excludeEnd("ctx");
  75516. $13=_st($14)._nodes();
  75517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75518. $ctx1.sendIdx["nodes"]=3;
  75519. //>>excludeEnd("ctx");
  75520. $12=_st($13)._first();
  75521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75522. $ctx1.sendIdx["first"]=3;
  75523. //>>excludeEnd("ctx");
  75524. $11=_st($12)._receiver();
  75525. $10=_st($11)._binding();
  75526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75527. $ctx1.sendIdx["binding"]=2;
  75528. //>>excludeEnd("ctx");
  75529. $9=_st($10)._scope();
  75530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75531. $ctx1.sendIdx["scope"]=1;
  75532. //>>excludeEnd("ctx");
  75533. $16=_st(ast)._scope();
  75534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75535. $ctx1.sendIdx["scope"]=2;
  75536. //>>excludeEnd("ctx");
  75537. $8=_st($9).__eq_eq($16);
  75538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75539. $ctx1.sendIdx["=="]=1;
  75540. //>>excludeEnd("ctx");
  75541. self._assert_($8);
  75542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75543. $ctx1.sendIdx["assert:"]=2;
  75544. //>>excludeEnd("ctx");
  75545. $27=_st(ast)._nodes();
  75546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75547. $ctx1.sendIdx["nodes"]=8;
  75548. //>>excludeEnd("ctx");
  75549. $26=_st($27)._first();
  75550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75551. $ctx1.sendIdx["first"]=7;
  75552. //>>excludeEnd("ctx");
  75553. $25=_st($26)._nodes();
  75554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75555. $ctx1.sendIdx["nodes"]=7;
  75556. //>>excludeEnd("ctx");
  75557. $24=_st($25)._last();
  75558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75559. $ctx1.sendIdx["last"]=1;
  75560. //>>excludeEnd("ctx");
  75561. $23=_st($24)._nodes();
  75562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75563. $ctx1.sendIdx["nodes"]=6;
  75564. //>>excludeEnd("ctx");
  75565. $22=_st($23)._first();
  75566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75567. $ctx1.sendIdx["first"]=6;
  75568. //>>excludeEnd("ctx");
  75569. $21=_st($22)._nodes();
  75570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75571. $ctx1.sendIdx["nodes"]=5;
  75572. //>>excludeEnd("ctx");
  75573. $20=_st($21)._first();
  75574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75575. $ctx1.sendIdx["first"]=5;
  75576. //>>excludeEnd("ctx");
  75577. $19=_st($20)._left();
  75578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75579. $ctx1.sendIdx["left"]=1;
  75580. //>>excludeEnd("ctx");
  75581. $18=_st($19)._binding();
  75582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75583. $ctx1.sendIdx["binding"]=3;
  75584. //>>excludeEnd("ctx");
  75585. $17=_st($18)._isTempVar();
  75586. self._assert_($17);
  75587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75588. $ctx1.sendIdx["assert:"]=3;
  75589. //>>excludeEnd("ctx");
  75590. $39=_st(ast)._nodes();
  75591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75592. $ctx1.sendIdx["nodes"]=12;
  75593. //>>excludeEnd("ctx");
  75594. $38=_st($39)._first();
  75595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75596. $ctx1.sendIdx["first"]=10;
  75597. //>>excludeEnd("ctx");
  75598. $37=_st($38)._nodes();
  75599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75600. $ctx1.sendIdx["nodes"]=11;
  75601. //>>excludeEnd("ctx");
  75602. $36=_st($37)._last();
  75603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75604. $ctx1.sendIdx["last"]=2;
  75605. //>>excludeEnd("ctx");
  75606. $35=_st($36)._nodes();
  75607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75608. $ctx1.sendIdx["nodes"]=10;
  75609. //>>excludeEnd("ctx");
  75610. $34=_st($35)._first();
  75611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75612. $ctx1.sendIdx["first"]=9;
  75613. //>>excludeEnd("ctx");
  75614. $33=_st($34)._nodes();
  75615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75616. $ctx1.sendIdx["nodes"]=9;
  75617. //>>excludeEnd("ctx");
  75618. $32=_st($33)._first();
  75619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75620. $ctx1.sendIdx["first"]=8;
  75621. //>>excludeEnd("ctx");
  75622. $31=_st($32)._left();
  75623. $30=_st($31)._binding();
  75624. $29=_st($30)._scope();
  75625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75626. $ctx1.sendIdx["scope"]=3;
  75627. //>>excludeEnd("ctx");
  75628. $42=_st(_st(_st(ast)._nodes())._first())._nodes();
  75629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75630. $ctx1.sendIdx["nodes"]=13;
  75631. //>>excludeEnd("ctx");
  75632. $41=_st($42)._last();
  75633. $40=_st($41)._scope();
  75634. $28=_st($29).__eq_eq($40);
  75635. self._assert_($28);
  75636. return self;
  75637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75638. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75639. //>>excludeEnd("ctx");
  75640. },
  75641. //>>excludeStart("ide", pragmas.excludeIdeData);
  75642. args: [],
  75643. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
  75644. referencedClasses: ["Smalltalk"],
  75645. //>>excludeEnd("ide");
  75646. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  75647. }),
  75648. globals.SemanticAnalyzerTest);
  75649. smalltalk.addClass('AISemanticAnalyzerTest', globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  75650. smalltalk.addMethod(
  75651. smalltalk.method({
  75652. selector: "setUp",
  75653. protocol: 'running',
  75654. fn: function (){
  75655. var self=this;
  75656. function $AISemanticAnalyzer(){return globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  75657. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  75658. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  75659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75660. return smalltalk.withContext(function($ctx1) {
  75661. //>>excludeEnd("ctx");
  75662. var $1,$2,$4,$5,$3,$6;
  75663. $1=_st($AISemanticAnalyzer())._on_($Object());
  75664. $2=$1;
  75665. $4=_st($AIContext())._new();
  75666. _st($4)._defineLocal_("local");
  75667. _st($4)._localAt_put_("local",(3));
  75668. $5=_st($4)._yourself();
  75669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75670. $ctx1.sendIdx["yourself"]=1;
  75671. //>>excludeEnd("ctx");
  75672. $3=$5;
  75673. _st($2)._context_($3);
  75674. $6=_st($1)._yourself();
  75675. self["@analyzer"]=$6;
  75676. return self;
  75677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75678. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.AISemanticAnalyzerTest)});
  75679. //>>excludeEnd("ctx");
  75680. },
  75681. //>>excludeStart("ide", pragmas.excludeIdeData);
  75682. args: [],
  75683. source: "setUp\x0a\x09analyzer := (AISemanticAnalyzer on: Object)\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09defineLocal: 'local';\x0a\x09\x09\x09localAt: 'local' put: 3;\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  75684. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  75685. //>>excludeEnd("ide");
  75686. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  75687. }),
  75688. globals.AISemanticAnalyzerTest);
  75689. smalltalk.addMethod(
  75690. smalltalk.method({
  75691. selector: "testContextVariables",
  75692. protocol: 'tests',
  75693. fn: function (){
  75694. var self=this;
  75695. var src,ast;
  75696. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75697. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  75698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75699. return smalltalk.withContext(function($ctx1) {
  75700. //>>excludeEnd("ctx");
  75701. src="foo | a | local + a";
  75702. ast=_st($Smalltalk())._parse_(src);
  75703. self._shouldnt_raise_((function(){
  75704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75705. return smalltalk.withContext(function($ctx2) {
  75706. //>>excludeEnd("ctx");
  75707. return _st(self["@analyzer"])._visit_(ast);
  75708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75710. //>>excludeEnd("ctx");
  75711. }),$UnknownVariableError());
  75712. return self;
  75713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75714. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},globals.AISemanticAnalyzerTest)});
  75715. //>>excludeEnd("ctx");
  75716. },
  75717. //>>excludeStart("ide", pragmas.excludeIdeData);
  75718. args: [],
  75719. source: "testContextVariables\x0a\x09| src ast |\x0a\x09\x0a\x09src := 'foo | a | local + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError",
  75720. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  75721. //>>excludeEnd("ide");
  75722. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  75723. }),
  75724. globals.AISemanticAnalyzerTest);
  75725. });
  75726. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  75727. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  75728. smalltalk.addPackage('SUnit-Tests');
  75729. smalltalk.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  75730. smalltalk.addClass('ExampleSetTest', globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  75731. //>>excludeStart("ide", pragmas.excludeIdeData);
  75732. globals.ExampleSetTest.comment="ExampleSetTest is taken from Pharo 1.4.\x0a\x0aTHe purpose of this class is to demonstrate a simple use case of the test framework.";
  75733. //>>excludeEnd("ide");
  75734. smalltalk.addMethod(
  75735. smalltalk.method({
  75736. selector: "setUp",
  75737. protocol: 'running',
  75738. fn: function (){
  75739. var self=this;
  75740. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  75741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75742. return smalltalk.withContext(function($ctx1) {
  75743. //>>excludeEnd("ctx");
  75744. self["@empty"]=_st($Set())._new();
  75745. self["@full"]=_st($Set())._with_with_((5),"abc");
  75746. return self;
  75747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75748. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ExampleSetTest)});
  75749. //>>excludeEnd("ctx");
  75750. },
  75751. //>>excludeStart("ide", pragmas.excludeIdeData);
  75752. args: [],
  75753. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  75754. referencedClasses: ["Set"],
  75755. //>>excludeEnd("ide");
  75756. messageSends: ["new", "with:with:"]
  75757. }),
  75758. globals.ExampleSetTest);
  75759. smalltalk.addMethod(
  75760. smalltalk.method({
  75761. selector: "testAdd",
  75762. protocol: 'tests',
  75763. fn: function (){
  75764. var self=this;
  75765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75766. return smalltalk.withContext(function($ctx1) {
  75767. //>>excludeEnd("ctx");
  75768. _st(self["@empty"])._add_((5));
  75769. self._assert_(_st(self["@empty"])._includes_((5)));
  75770. return self;
  75771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75772. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},globals.ExampleSetTest)});
  75773. //>>excludeEnd("ctx");
  75774. },
  75775. //>>excludeStart("ide", pragmas.excludeIdeData);
  75776. args: [],
  75777. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  75778. referencedClasses: [],
  75779. //>>excludeEnd("ide");
  75780. messageSends: ["add:", "assert:", "includes:"]
  75781. }),
  75782. globals.ExampleSetTest);
  75783. smalltalk.addMethod(
  75784. smalltalk.method({
  75785. selector: "testGrow",
  75786. protocol: 'tests',
  75787. fn: function (){
  75788. var self=this;
  75789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75790. return smalltalk.withContext(function($ctx1) {
  75791. //>>excludeEnd("ctx");
  75792. _st(self["@empty"])._addAll_((1)._to_((100)));
  75793. self._assert_equals_(_st(self["@empty"])._size(),(100));
  75794. return self;
  75795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75796. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},globals.ExampleSetTest)});
  75797. //>>excludeEnd("ctx");
  75798. },
  75799. //>>excludeStart("ide", pragmas.excludeIdeData);
  75800. args: [],
  75801. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  75802. referencedClasses: [],
  75803. //>>excludeEnd("ide");
  75804. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  75805. }),
  75806. globals.ExampleSetTest);
  75807. smalltalk.addMethod(
  75808. smalltalk.method({
  75809. selector: "testIllegal",
  75810. protocol: 'tests',
  75811. fn: function (){
  75812. var self=this;
  75813. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  75814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75815. return smalltalk.withContext(function($ctx1) {
  75816. //>>excludeEnd("ctx");
  75817. self._should_raise_((function(){
  75818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75819. return smalltalk.withContext(function($ctx2) {
  75820. //>>excludeEnd("ctx");
  75821. return _st(self["@empty"])._at_((5));
  75822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75824. //>>excludeEnd("ctx");
  75825. }),$Error());
  75826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75827. $ctx1.sendIdx["should:raise:"]=1;
  75828. //>>excludeEnd("ctx");
  75829. self._should_raise_((function(){
  75830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75831. return smalltalk.withContext(function($ctx2) {
  75832. //>>excludeEnd("ctx");
  75833. return _st(self["@empty"])._at_put_((5),"abc");
  75834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  75836. //>>excludeEnd("ctx");
  75837. }),$Error());
  75838. return self;
  75839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75840. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},globals.ExampleSetTest)});
  75841. //>>excludeEnd("ctx");
  75842. },
  75843. //>>excludeStart("ide", pragmas.excludeIdeData);
  75844. args: [],
  75845. source: "testIllegal\x0a\x09self\x0a\x09\x09should: [ empty at: 5 ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ empty at: 5 put: #abc ]\x0a\x09\x09raise: Error",
  75846. referencedClasses: ["Error"],
  75847. //>>excludeEnd("ide");
  75848. messageSends: ["should:raise:", "at:", "at:put:"]
  75849. }),
  75850. globals.ExampleSetTest);
  75851. smalltalk.addMethod(
  75852. smalltalk.method({
  75853. selector: "testIncludes",
  75854. protocol: 'tests',
  75855. fn: function (){
  75856. var self=this;
  75857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75858. return smalltalk.withContext(function($ctx1) {
  75859. //>>excludeEnd("ctx");
  75860. var $1;
  75861. $1=_st(self["@full"])._includes_((5));
  75862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75863. $ctx1.sendIdx["includes:"]=1;
  75864. //>>excludeEnd("ctx");
  75865. self._assert_($1);
  75866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75867. $ctx1.sendIdx["assert:"]=1;
  75868. //>>excludeEnd("ctx");
  75869. self._assert_(_st(self["@full"])._includes_("abc"));
  75870. return self;
  75871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75872. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},globals.ExampleSetTest)});
  75873. //>>excludeEnd("ctx");
  75874. },
  75875. //>>excludeStart("ide", pragmas.excludeIdeData);
  75876. args: [],
  75877. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  75878. referencedClasses: [],
  75879. //>>excludeEnd("ide");
  75880. messageSends: ["assert:", "includes:"]
  75881. }),
  75882. globals.ExampleSetTest);
  75883. smalltalk.addMethod(
  75884. smalltalk.method({
  75885. selector: "testOccurrences",
  75886. protocol: 'tests',
  75887. fn: function (){
  75888. var self=this;
  75889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75890. return smalltalk.withContext(function($ctx1) {
  75891. //>>excludeEnd("ctx");
  75892. var $1,$2;
  75893. $1=_st(self["@empty"])._occurrencesOf_((0));
  75894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75895. $ctx1.sendIdx["occurrencesOf:"]=1;
  75896. //>>excludeEnd("ctx");
  75897. self._assert_equals_($1,(0));
  75898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75899. $ctx1.sendIdx["assert:equals:"]=1;
  75900. //>>excludeEnd("ctx");
  75901. $2=_st(self["@full"])._occurrencesOf_((5));
  75902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75903. $ctx1.sendIdx["occurrencesOf:"]=2;
  75904. //>>excludeEnd("ctx");
  75905. self._assert_equals_($2,(1));
  75906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75907. $ctx1.sendIdx["assert:equals:"]=2;
  75908. //>>excludeEnd("ctx");
  75909. _st(self["@full"])._add_((5));
  75910. self._assert_equals_(_st(self["@full"])._occurrencesOf_((5)),(1));
  75911. return self;
  75912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75913. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},globals.ExampleSetTest)});
  75914. //>>excludeEnd("ctx");
  75915. },
  75916. //>>excludeStart("ide", pragmas.excludeIdeData);
  75917. args: [],
  75918. source: "testOccurrences\x0a\x09self assert: (empty occurrencesOf: 0) equals: 0.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1.\x0a\x09full add: 5.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1",
  75919. referencedClasses: [],
  75920. //>>excludeEnd("ide");
  75921. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  75922. }),
  75923. globals.ExampleSetTest);
  75924. smalltalk.addMethod(
  75925. smalltalk.method({
  75926. selector: "testRemove",
  75927. protocol: 'tests',
  75928. fn: function (){
  75929. var self=this;
  75930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75931. return smalltalk.withContext(function($ctx1) {
  75932. //>>excludeEnd("ctx");
  75933. var $1;
  75934. _st(self["@full"])._remove_((5));
  75935. $1=_st(self["@full"])._includes_("abc");
  75936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75937. $ctx1.sendIdx["includes:"]=1;
  75938. //>>excludeEnd("ctx");
  75939. self._assert_($1);
  75940. self._deny_(_st(self["@full"])._includes_((5)));
  75941. return self;
  75942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75943. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},globals.ExampleSetTest)});
  75944. //>>excludeEnd("ctx");
  75945. },
  75946. //>>excludeStart("ide", pragmas.excludeIdeData);
  75947. args: [],
  75948. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  75949. referencedClasses: [],
  75950. //>>excludeEnd("ide");
  75951. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  75952. }),
  75953. globals.ExampleSetTest);
  75954. smalltalk.addClass('SUnitAsyncTest', globals.TestCase, ['flag'], 'SUnit-Tests');
  75955. smalltalk.addMethod(
  75956. smalltalk.method({
  75957. selector: "fakeError",
  75958. protocol: 'helpers',
  75959. fn: function (){
  75960. var self=this;
  75961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75962. return smalltalk.withContext(function($ctx1) {
  75963. //>>excludeEnd("ctx");
  75964. self["@flag"]="bad";
  75965. self._timeout_((30));
  75966. self["@flag"]=_st(self._async_((function(){
  75967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75968. return smalltalk.withContext(function($ctx2) {
  75969. //>>excludeEnd("ctx");
  75970. self["@flag"]="ok";
  75971. self["@flag"];
  75972. return self._error_("Intentional");
  75973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75975. //>>excludeEnd("ctx");
  75976. })))._valueWithTimeout_((20));
  75977. return self;
  75978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75979. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},globals.SUnitAsyncTest)});
  75980. //>>excludeEnd("ctx");
  75981. },
  75982. //>>excludeStart("ide", pragmas.excludeIdeData);
  75983. args: [],
  75984. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  75985. referencedClasses: [],
  75986. //>>excludeEnd("ide");
  75987. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  75988. }),
  75989. globals.SUnitAsyncTest);
  75990. smalltalk.addMethod(
  75991. smalltalk.method({
  75992. selector: "fakeErrorFailingInTearDown",
  75993. protocol: 'helpers',
  75994. fn: function (){
  75995. var self=this;
  75996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75997. return smalltalk.withContext(function($ctx1) {
  75998. //>>excludeEnd("ctx");
  75999. self["@flag"]="bad";
  76000. self._timeout_((30));
  76001. self["@flag"]=_st(self._async_((function(){
  76002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76003. return smalltalk.withContext(function($ctx2) {
  76004. //>>excludeEnd("ctx");
  76005. return self._error_("Intentional");
  76006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76008. //>>excludeEnd("ctx");
  76009. })))._valueWithTimeout_((20));
  76010. return self;
  76011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76012. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},globals.SUnitAsyncTest)});
  76013. //>>excludeEnd("ctx");
  76014. },
  76015. //>>excludeStart("ide", pragmas.excludeIdeData);
  76016. args: [],
  76017. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  76018. referencedClasses: [],
  76019. //>>excludeEnd("ide");
  76020. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  76021. }),
  76022. globals.SUnitAsyncTest);
  76023. smalltalk.addMethod(
  76024. smalltalk.method({
  76025. selector: "fakeFailure",
  76026. protocol: 'helpers',
  76027. fn: function (){
  76028. var self=this;
  76029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76030. return smalltalk.withContext(function($ctx1) {
  76031. //>>excludeEnd("ctx");
  76032. self["@flag"]="bad";
  76033. self._timeout_((30));
  76034. self["@flag"]=_st(self._async_((function(){
  76035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76036. return smalltalk.withContext(function($ctx2) {
  76037. //>>excludeEnd("ctx");
  76038. self["@flag"]="ok";
  76039. self["@flag"];
  76040. return self._assert_(false);
  76041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76043. //>>excludeEnd("ctx");
  76044. })))._valueWithTimeout_((20));
  76045. return self;
  76046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76047. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},globals.SUnitAsyncTest)});
  76048. //>>excludeEnd("ctx");
  76049. },
  76050. //>>excludeStart("ide", pragmas.excludeIdeData);
  76051. args: [],
  76052. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  76053. referencedClasses: [],
  76054. //>>excludeEnd("ide");
  76055. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  76056. }),
  76057. globals.SUnitAsyncTest);
  76058. smalltalk.addMethod(
  76059. smalltalk.method({
  76060. selector: "fakeMultipleTimeoutFailing",
  76061. protocol: 'helpers',
  76062. fn: function (){
  76063. var self=this;
  76064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76065. return smalltalk.withContext(function($ctx1) {
  76066. //>>excludeEnd("ctx");
  76067. var $1;
  76068. self._timeout_((100));
  76069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76070. $ctx1.sendIdx["timeout:"]=1;
  76071. //>>excludeEnd("ctx");
  76072. $1=self._async_((function(){
  76073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76074. return smalltalk.withContext(function($ctx2) {
  76075. //>>excludeEnd("ctx");
  76076. self._timeout_((20));
  76077. return _st(self._async_((function(){
  76078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76079. return smalltalk.withContext(function($ctx3) {
  76080. //>>excludeEnd("ctx");
  76081. return self._finished();
  76082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76083. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  76084. //>>excludeEnd("ctx");
  76085. })))._valueWithTimeout_((30));
  76086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76088. //>>excludeEnd("ctx");
  76089. }));
  76090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76091. $ctx1.sendIdx["async:"]=1;
  76092. //>>excludeEnd("ctx");
  76093. _st($1)._valueWithTimeout_((20));
  76094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76095. $ctx1.sendIdx["valueWithTimeout:"]=1;
  76096. //>>excludeEnd("ctx");
  76097. return self;
  76098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76099. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},globals.SUnitAsyncTest)});
  76100. //>>excludeEnd("ctx");
  76101. },
  76102. //>>excludeStart("ide", pragmas.excludeIdeData);
  76103. args: [],
  76104. source: "fakeMultipleTimeoutFailing\x0a\x09self timeout: 100.\x0a\x09(self async: [ \x0a\x09\x09self timeout: 20.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 30\x0a\x09]) valueWithTimeout: 20",
  76105. referencedClasses: [],
  76106. //>>excludeEnd("ide");
  76107. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  76108. }),
  76109. globals.SUnitAsyncTest);
  76110. smalltalk.addMethod(
  76111. smalltalk.method({
  76112. selector: "fakeMultipleTimeoutPassing",
  76113. protocol: 'helpers',
  76114. fn: function (){
  76115. var self=this;
  76116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76117. return smalltalk.withContext(function($ctx1) {
  76118. //>>excludeEnd("ctx");
  76119. var $1;
  76120. self._timeout_((20));
  76121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76122. $ctx1.sendIdx["timeout:"]=1;
  76123. //>>excludeEnd("ctx");
  76124. $1=self._async_((function(){
  76125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76126. return smalltalk.withContext(function($ctx2) {
  76127. //>>excludeEnd("ctx");
  76128. self._timeout_((40));
  76129. return _st(self._async_((function(){
  76130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76131. return smalltalk.withContext(function($ctx3) {
  76132. //>>excludeEnd("ctx");
  76133. return self._finished();
  76134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76135. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  76136. //>>excludeEnd("ctx");
  76137. })))._valueWithTimeout_((20));
  76138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76140. //>>excludeEnd("ctx");
  76141. }));
  76142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76143. $ctx1.sendIdx["async:"]=1;
  76144. //>>excludeEnd("ctx");
  76145. _st($1)._valueWithTimeout_((10));
  76146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76147. $ctx1.sendIdx["valueWithTimeout:"]=1;
  76148. //>>excludeEnd("ctx");
  76149. return self;
  76150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76151. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},globals.SUnitAsyncTest)});
  76152. //>>excludeEnd("ctx");
  76153. },
  76154. //>>excludeStart("ide", pragmas.excludeIdeData);
  76155. args: [],
  76156. source: "fakeMultipleTimeoutPassing\x0a\x09self timeout: 20.\x0a\x09(self async: [\x0a\x09\x09self timeout: 40.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 20\x0a\x09]) valueWithTimeout: 10",
  76157. referencedClasses: [],
  76158. //>>excludeEnd("ide");
  76159. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  76160. }),
  76161. globals.SUnitAsyncTest);
  76162. smalltalk.addMethod(
  76163. smalltalk.method({
  76164. selector: "fakeTimeout",
  76165. protocol: 'helpers',
  76166. fn: function (){
  76167. var self=this;
  76168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76169. return smalltalk.withContext(function($ctx1) {
  76170. //>>excludeEnd("ctx");
  76171. self._timeout_((10));
  76172. _st(self._async_((function(){
  76173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76174. return smalltalk.withContext(function($ctx2) {
  76175. //>>excludeEnd("ctx");
  76176. return self._finished();
  76177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76179. //>>excludeEnd("ctx");
  76180. })))._valueWithTimeout_((20));
  76181. return self;
  76182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76183. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},globals.SUnitAsyncTest)});
  76184. //>>excludeEnd("ctx");
  76185. },
  76186. //>>excludeStart("ide", pragmas.excludeIdeData);
  76187. args: [],
  76188. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  76189. referencedClasses: [],
  76190. //>>excludeEnd("ide");
  76191. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  76192. }),
  76193. globals.SUnitAsyncTest);
  76194. smalltalk.addMethod(
  76195. smalltalk.method({
  76196. selector: "selectorSetOf:",
  76197. protocol: 'private',
  76198. fn: function (aCollection){
  76199. var self=this;
  76200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76201. return smalltalk.withContext(function($ctx1) {
  76202. //>>excludeEnd("ctx");
  76203. var $1;
  76204. $1=_st(_st(aCollection)._collect_((function(each){
  76205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76206. return smalltalk.withContext(function($ctx2) {
  76207. //>>excludeEnd("ctx");
  76208. return _st(each)._selector();
  76209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76211. //>>excludeEnd("ctx");
  76212. })))._asSet();
  76213. return $1;
  76214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76215. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},globals.SUnitAsyncTest)});
  76216. //>>excludeEnd("ctx");
  76217. },
  76218. //>>excludeStart("ide", pragmas.excludeIdeData);
  76219. args: ["aCollection"],
  76220. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  76221. referencedClasses: [],
  76222. //>>excludeEnd("ide");
  76223. messageSends: ["asSet", "collect:", "selector"]
  76224. }),
  76225. globals.SUnitAsyncTest);
  76226. smalltalk.addMethod(
  76227. smalltalk.method({
  76228. selector: "setUp",
  76229. protocol: 'running',
  76230. fn: function (){
  76231. var self=this;
  76232. self["@flag"]="ok";
  76233. return self;
  76234. },
  76235. //>>excludeStart("ide", pragmas.excludeIdeData);
  76236. args: [],
  76237. source: "setUp\x0a\x09flag := 'ok'",
  76238. referencedClasses: [],
  76239. //>>excludeEnd("ide");
  76240. messageSends: []
  76241. }),
  76242. globals.SUnitAsyncTest);
  76243. smalltalk.addMethod(
  76244. smalltalk.method({
  76245. selector: "tearDown",
  76246. protocol: 'running',
  76247. fn: function (){
  76248. var self=this;
  76249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76250. return smalltalk.withContext(function($ctx1) {
  76251. //>>excludeEnd("ctx");
  76252. self._assert_equals_("ok",self["@flag"]);
  76253. return self;
  76254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76255. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.SUnitAsyncTest)});
  76256. //>>excludeEnd("ctx");
  76257. },
  76258. //>>excludeStart("ide", pragmas.excludeIdeData);
  76259. args: [],
  76260. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  76261. referencedClasses: [],
  76262. //>>excludeEnd("ide");
  76263. messageSends: ["assert:equals:"]
  76264. }),
  76265. globals.SUnitAsyncTest);
  76266. smalltalk.addMethod(
  76267. smalltalk.method({
  76268. selector: "testAsyncErrorsAndFailures",
  76269. protocol: 'tests',
  76270. fn: function (){
  76271. var self=this;
  76272. var suite,runner,result,assertBlock;
  76273. function $TestSuiteRunner(){return globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  76274. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  76275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76276. return smalltalk.withContext(function($ctx1) {
  76277. //>>excludeEnd("ctx");
  76278. var $1,$2,$3,$4;
  76279. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  76280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76281. return smalltalk.withContext(function($ctx2) {
  76282. //>>excludeEnd("ctx");
  76283. return _st(self._class())._selector_(each);
  76284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76286. //>>excludeEnd("ctx");
  76287. }));
  76288. runner=_st($TestSuiteRunner())._on_(suite);
  76289. self._timeout_((200));
  76290. result=_st(runner)._result();
  76291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76292. $ctx1.sendIdx["result"]=1;
  76293. //>>excludeEnd("ctx");
  76294. assertBlock=self._async_((function(){
  76295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76296. return smalltalk.withContext(function($ctx2) {
  76297. //>>excludeEnd("ctx");
  76298. $1=self._selectorSetOf_(_st(result)._errors());
  76299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76300. $ctx2.sendIdx["selectorSetOf:"]=1;
  76301. //>>excludeEnd("ctx");
  76302. $2=["fakeError"]._asSet();
  76303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76304. $ctx2.sendIdx["asSet"]=1;
  76305. //>>excludeEnd("ctx");
  76306. self._assert_equals_($1,$2);
  76307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76308. $ctx2.sendIdx["assert:equals:"]=1;
  76309. //>>excludeEnd("ctx");
  76310. self._assert_equals_(self._selectorSetOf_(_st(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  76311. return self._finished();
  76312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  76314. //>>excludeEnd("ctx");
  76315. }));
  76316. _st(_st(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  76317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76318. return smalltalk.withContext(function($ctx2) {
  76319. //>>excludeEnd("ctx");
  76320. $3=_st(_st(ann)._result()).__eq_eq(result);
  76321. if(smalltalk.assert($3)){
  76322. $4=_st(_st(result)._runs()).__eq(_st(result)._total());
  76323. return _st($4)._ifTrue_(assertBlock);
  76324. };
  76325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76326. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  76327. //>>excludeEnd("ctx");
  76328. }));
  76329. _st(runner)._run();
  76330. return self;
  76331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76332. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},globals.SUnitAsyncTest)});
  76333. //>>excludeEnd("ctx");
  76334. },
  76335. //>>excludeStart("ide", pragmas.excludeIdeData);
  76336. args: [],
  76337. source: "testAsyncErrorsAndFailures\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: #('fakeError') asSet.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeErrorFailingInTearDown' 'fakeFailure') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  76338. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  76339. //>>excludeEnd("ide");
  76340. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  76341. }),
  76342. globals.SUnitAsyncTest);
  76343. smalltalk.addMethod(
  76344. smalltalk.method({
  76345. selector: "testAsyncNeedsTimeout",
  76346. protocol: 'tests',
  76347. fn: function (){
  76348. var self=this;
  76349. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  76350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76351. return smalltalk.withContext(function($ctx1) {
  76352. //>>excludeEnd("ctx");
  76353. self._should_raise_((function(){
  76354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76355. return smalltalk.withContext(function($ctx2) {
  76356. //>>excludeEnd("ctx");
  76357. return self._async_((function(){
  76358. }));
  76359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76360. $ctx2.sendIdx["async:"]=1;
  76361. //>>excludeEnd("ctx");
  76362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76364. //>>excludeEnd("ctx");
  76365. }),$Error());
  76366. self._timeout_((0));
  76367. self._shouldnt_raise_((function(){
  76368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76369. return smalltalk.withContext(function($ctx2) {
  76370. //>>excludeEnd("ctx");
  76371. return self._async_((function(){
  76372. }));
  76373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  76375. //>>excludeEnd("ctx");
  76376. }),$Error());
  76377. self._finished();
  76378. return self;
  76379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76380. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},globals.SUnitAsyncTest)});
  76381. //>>excludeEnd("ctx");
  76382. },
  76383. //>>excludeStart("ide", pragmas.excludeIdeData);
  76384. args: [],
  76385. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  76386. referencedClasses: ["Error"],
  76387. //>>excludeEnd("ide");
  76388. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  76389. }),
  76390. globals.SUnitAsyncTest);
  76391. smalltalk.addMethod(
  76392. smalltalk.method({
  76393. selector: "testFinishedNeedsTimeout",
  76394. protocol: 'tests',
  76395. fn: function (){
  76396. var self=this;
  76397. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  76398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76399. return smalltalk.withContext(function($ctx1) {
  76400. //>>excludeEnd("ctx");
  76401. self._should_raise_((function(){
  76402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76403. return smalltalk.withContext(function($ctx2) {
  76404. //>>excludeEnd("ctx");
  76405. return self._finished();
  76406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76407. $ctx2.sendIdx["finished"]=1;
  76408. //>>excludeEnd("ctx");
  76409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76411. //>>excludeEnd("ctx");
  76412. }),$Error());
  76413. self._timeout_((0));
  76414. self._shouldnt_raise_((function(){
  76415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76416. return smalltalk.withContext(function($ctx2) {
  76417. //>>excludeEnd("ctx");
  76418. return self._finished();
  76419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  76421. //>>excludeEnd("ctx");
  76422. }),$Error());
  76423. return self;
  76424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76425. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},globals.SUnitAsyncTest)});
  76426. //>>excludeEnd("ctx");
  76427. },
  76428. //>>excludeStart("ide", pragmas.excludeIdeData);
  76429. args: [],
  76430. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  76431. referencedClasses: ["Error"],
  76432. //>>excludeEnd("ide");
  76433. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  76434. }),
  76435. globals.SUnitAsyncTest);
  76436. smalltalk.addMethod(
  76437. smalltalk.method({
  76438. selector: "testIsAsyncReturnsCorrectValues",
  76439. protocol: 'tests',
  76440. fn: function (){
  76441. var self=this;
  76442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76443. return smalltalk.withContext(function($ctx1) {
  76444. //>>excludeEnd("ctx");
  76445. var $1,$2;
  76446. $1=self._isAsync();
  76447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76448. $ctx1.sendIdx["isAsync"]=1;
  76449. //>>excludeEnd("ctx");
  76450. self._deny_($1);
  76451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76452. $ctx1.sendIdx["deny:"]=1;
  76453. //>>excludeEnd("ctx");
  76454. self._timeout_((0));
  76455. $2=self._isAsync();
  76456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76457. $ctx1.sendIdx["isAsync"]=2;
  76458. //>>excludeEnd("ctx");
  76459. self._assert_($2);
  76460. self._finished();
  76461. self._deny_(self._isAsync());
  76462. return self;
  76463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76464. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},globals.SUnitAsyncTest)});
  76465. //>>excludeEnd("ctx");
  76466. },
  76467. //>>excludeStart("ide", pragmas.excludeIdeData);
  76468. args: [],
  76469. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  76470. referencedClasses: [],
  76471. //>>excludeEnd("ide");
  76472. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  76473. }),
  76474. globals.SUnitAsyncTest);
  76475. smalltalk.addMethod(
  76476. smalltalk.method({
  76477. selector: "testPass",
  76478. protocol: 'tests',
  76479. fn: function (){
  76480. var self=this;
  76481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76482. return smalltalk.withContext(function($ctx1) {
  76483. //>>excludeEnd("ctx");
  76484. self["@flag"]="bad";
  76485. self._timeout_((10));
  76486. self["@flag"]=_st(self._async_((function(){
  76487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76488. return smalltalk.withContext(function($ctx2) {
  76489. //>>excludeEnd("ctx");
  76490. self._assert_(true);
  76491. self._finished();
  76492. self["@flag"]="ok";
  76493. return self["@flag"];
  76494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76496. //>>excludeEnd("ctx");
  76497. })))._valueWithTimeout_((5));
  76498. return self;
  76499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76500. }, function($ctx1) {$ctx1.fill(self,"testPass",{},globals.SUnitAsyncTest)});
  76501. //>>excludeEnd("ctx");
  76502. },
  76503. //>>excludeStart("ide", pragmas.excludeIdeData);
  76504. args: [],
  76505. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  76506. referencedClasses: [],
  76507. //>>excludeEnd("ide");
  76508. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  76509. }),
  76510. globals.SUnitAsyncTest);
  76511. smalltalk.addMethod(
  76512. smalltalk.method({
  76513. selector: "testTimeouts",
  76514. protocol: 'tests',
  76515. fn: function (){
  76516. var self=this;
  76517. var suite,runner,result,assertBlock;
  76518. function $TestSuiteRunner(){return globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  76519. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  76520. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  76521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76522. return smalltalk.withContext(function($ctx1) {
  76523. //>>excludeEnd("ctx");
  76524. var $1,$2,$3;
  76525. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  76526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76527. return smalltalk.withContext(function($ctx2) {
  76528. //>>excludeEnd("ctx");
  76529. return _st(self._class())._selector_(each);
  76530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76532. //>>excludeEnd("ctx");
  76533. }));
  76534. runner=_st($TestSuiteRunner())._on_(suite);
  76535. self._timeout_((200));
  76536. result=_st(runner)._result();
  76537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76538. $ctx1.sendIdx["result"]=1;
  76539. //>>excludeEnd("ctx");
  76540. assertBlock=self._async_((function(){
  76541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76542. return smalltalk.withContext(function($ctx2) {
  76543. //>>excludeEnd("ctx");
  76544. $1=self._selectorSetOf_(_st(result)._errors());
  76545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76546. $ctx2.sendIdx["selectorSetOf:"]=1;
  76547. //>>excludeEnd("ctx");
  76548. self._assert_equals_($1,_st($Set())._new());
  76549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76550. $ctx2.sendIdx["assert:equals:"]=1;
  76551. //>>excludeEnd("ctx");
  76552. self._assert_equals_(self._selectorSetOf_(_st(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  76553. return self._finished();
  76554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  76556. //>>excludeEnd("ctx");
  76557. }));
  76558. _st(_st(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  76559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76560. return smalltalk.withContext(function($ctx2) {
  76561. //>>excludeEnd("ctx");
  76562. $2=_st(_st(ann)._result()).__eq_eq(result);
  76563. if(smalltalk.assert($2)){
  76564. $3=_st(_st(result)._runs()).__eq(_st(result)._total());
  76565. return _st($3)._ifTrue_(assertBlock);
  76566. };
  76567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76568. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  76569. //>>excludeEnd("ctx");
  76570. }));
  76571. _st(runner)._run();
  76572. return self;
  76573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76574. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},globals.SUnitAsyncTest)});
  76575. //>>excludeEnd("ctx");
  76576. },
  76577. //>>excludeStart("ide", pragmas.excludeIdeData);
  76578. args: [],
  76579. source: "testTimeouts\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleTimeoutFailing' 'fakeMultipleTimeoutPassing' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: Set new.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeMultipleTimeoutFailing' 'fakeTimeout') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  76580. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  76581. //>>excludeEnd("ide");
  76582. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  76583. }),
  76584. globals.SUnitAsyncTest);
  76585. smalltalk.addMethod(
  76586. smalltalk.method({
  76587. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  76588. protocol: 'tests',
  76589. fn: function (){
  76590. var self=this;
  76591. var x;
  76592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76593. return smalltalk.withContext(function($ctx1) {
  76594. //>>excludeEnd("ctx");
  76595. var $1;
  76596. self["@flag"]="bad";
  76597. self._timeout_((10));
  76598. x=(0);
  76599. $1=self._async_((function(){
  76600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76601. return smalltalk.withContext(function($ctx2) {
  76602. //>>excludeEnd("ctx");
  76603. self._finished();
  76604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76605. $ctx2.sendIdx["finished"]=1;
  76606. //>>excludeEnd("ctx");
  76607. self["@flag"]="ok";
  76608. self["@flag"];
  76609. x=_st(x).__plus((1));
  76610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76611. $ctx2.sendIdx["+"]=1;
  76612. //>>excludeEnd("ctx");
  76613. x;
  76614. return self._assert_equals_(x,(1));
  76615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76616. $ctx2.sendIdx["assert:equals:"]=1;
  76617. //>>excludeEnd("ctx");
  76618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76620. //>>excludeEnd("ctx");
  76621. }));
  76622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76623. $ctx1.sendIdx["async:"]=1;
  76624. //>>excludeEnd("ctx");
  76625. self["@flag"]=_st($1)._valueWithTimeout_((0));
  76626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76627. $ctx1.sendIdx["valueWithTimeout:"]=1;
  76628. //>>excludeEnd("ctx");
  76629. self["@flag"]=_st(self._async_((function(){
  76630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76631. return smalltalk.withContext(function($ctx2) {
  76632. //>>excludeEnd("ctx");
  76633. self._finished();
  76634. self["@flag"]="ok";
  76635. self["@flag"];
  76636. x=_st(x).__plus((1));
  76637. x;
  76638. return self._assert_equals_(x,(1));
  76639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  76641. //>>excludeEnd("ctx");
  76642. })))._valueWithTimeout_((0));
  76643. return self;
  76644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76645. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},globals.SUnitAsyncTest)});
  76646. //>>excludeEnd("ctx");
  76647. },
  76648. //>>excludeStart("ide", pragmas.excludeIdeData);
  76649. args: [],
  76650. source: "testTwoAsyncPassesWithFinishedOnlyOneIsRun\x0a\x09| x |\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09x := 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.",
  76651. referencedClasses: [],
  76652. //>>excludeEnd("ide");
  76653. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  76654. }),
  76655. globals.SUnitAsyncTest);
  76656. });
  76657. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  76658. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  76659. smalltalk.addPackage('AmberCli');
  76660. smalltalk.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  76661. smalltalk.addClass('AmberCli', globals.Object, [], 'AmberCli');
  76662. //>>excludeStart("ide", pragmas.excludeIdeData);
  76663. globals.AmberCli.comment="I am the Amber CLI (CommandLine Interface) tool which runs on Node.js.\x0a\x0aMy responsibility is to start different Amber programs like the FileServer or the Repl.\x0aWhich program to start is determined by the first commandline parameters passed to the AmberCli executable.\x0aUse `help` to get a list of all available options.\x0aAny further commandline parameters are passed to the specific program.\x0a\x0a## Commands\x0a\x0aNew commands can be added by creating a class side method in the `commands` protocol which takes one parameter.\x0aThis parameter is an array of all commandline options + values passed on to the program.\x0aAny `camelCaseCommand` is transformed into a commandline parameter of the form `camel-case-command` and vice versa.";
  76664. //>>excludeEnd("ide");
  76665. smalltalk.addMethod(
  76666. smalltalk.method({
  76667. selector: "commandLineSwitches",
  76668. protocol: 'commandline',
  76669. fn: function (){
  76670. var self=this;
  76671. var switches;
  76672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76673. return smalltalk.withContext(function($ctx1) {
  76674. //>>excludeEnd("ctx");
  76675. var $1;
  76676. switches=_st(_st(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  76677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76678. return smalltalk.withContext(function($ctx2) {
  76679. //>>excludeEnd("ctx");
  76680. return _st(each)._selector();
  76681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76683. //>>excludeEnd("ctx");
  76684. }));
  76685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76686. $ctx1.sendIdx["collect:"]=1;
  76687. //>>excludeEnd("ctx");
  76688. switches=_st(switches)._select_((function(each){
  76689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76690. return smalltalk.withContext(function($ctx2) {
  76691. //>>excludeEnd("ctx");
  76692. return _st(each)._match_("^[^:]*:$");
  76693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76694. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  76695. //>>excludeEnd("ctx");
  76696. }));
  76697. switches=_st(switches)._collect_((function(each){
  76698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76699. return smalltalk.withContext(function($ctx2) {
  76700. //>>excludeEnd("ctx");
  76701. return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  76702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  76704. //>>excludeEnd("ctx");
  76705. }));
  76706. $1=switches;
  76707. return $1;
  76708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76709. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},globals.AmberCli.klass)});
  76710. //>>excludeEnd("ctx");
  76711. },
  76712. //>>excludeStart("ide", pragmas.excludeIdeData);
  76713. args: [],
  76714. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'commands' protocol of the class\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name.\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 class methodsInProtocol: 'commands') 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].\x0a\x09^ switches",
  76715. referencedClasses: [],
  76716. //>>excludeEnd("ide");
  76717. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  76718. }),
  76719. globals.AmberCli.klass);
  76720. smalltalk.addMethod(
  76721. smalltalk.method({
  76722. selector: "config:",
  76723. protocol: 'commands',
  76724. fn: function (args){
  76725. var self=this;
  76726. function $Configurator(){return globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
  76727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76728. return smalltalk.withContext(function($ctx1) {
  76729. //>>excludeEnd("ctx");
  76730. _st(_st($Configurator())._new())._start();
  76731. return self;
  76732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76733. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},globals.AmberCli.klass)});
  76734. //>>excludeEnd("ctx");
  76735. },
  76736. //>>excludeStart("ide", pragmas.excludeIdeData);
  76737. args: ["args"],
  76738. source: "config: args\x0a\x09Configurator new start",
  76739. referencedClasses: ["Configurator"],
  76740. //>>excludeEnd("ide");
  76741. messageSends: ["start", "new"]
  76742. }),
  76743. globals.AmberCli.klass);
  76744. smalltalk.addMethod(
  76745. smalltalk.method({
  76746. selector: "handleArguments:",
  76747. protocol: 'commandline',
  76748. fn: function (args){
  76749. var self=this;
  76750. var selector;
  76751. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  76752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76753. return smalltalk.withContext(function($ctx1) {
  76754. //>>excludeEnd("ctx");
  76755. var $1;
  76756. $1=_st(args)._first();
  76757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76758. $ctx1.sendIdx["first"]=1;
  76759. //>>excludeEnd("ctx");
  76760. selector=self._selectorForCommandLineSwitch_($1);
  76761. _st(args)._remove_(_st(args)._first());
  76762. self._perform_withArguments_(selector,_st($Array())._with_(args));
  76763. return self;
  76764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76765. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},globals.AmberCli.klass)});
  76766. //>>excludeEnd("ctx");
  76767. },
  76768. //>>excludeStart("ide", pragmas.excludeIdeData);
  76769. args: ["args"],
  76770. source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)",
  76771. referencedClasses: ["Array"],
  76772. //>>excludeEnd("ide");
  76773. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  76774. }),
  76775. globals.AmberCli.klass);
  76776. smalltalk.addMethod(
  76777. smalltalk.method({
  76778. selector: "help:",
  76779. protocol: 'commands',
  76780. fn: function (args){
  76781. var self=this;
  76782. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  76783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76784. return smalltalk.withContext(function($ctx1) {
  76785. //>>excludeEnd("ctx");
  76786. _st($Transcript())._show_("Available commands");
  76787. _st(self._commandLineSwitches())._do_((function(each){
  76788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76789. return smalltalk.withContext(function($ctx2) {
  76790. //>>excludeEnd("ctx");
  76791. return _st(console)._log_(each);
  76792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76794. //>>excludeEnd("ctx");
  76795. }));
  76796. return self;
  76797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76798. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},globals.AmberCli.klass)});
  76799. //>>excludeEnd("ctx");
  76800. },
  76801. //>>excludeStart("ide", pragmas.excludeIdeData);
  76802. args: ["args"],
  76803. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  76804. referencedClasses: ["Transcript"],
  76805. //>>excludeEnd("ide");
  76806. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  76807. }),
  76808. globals.AmberCli.klass);
  76809. smalltalk.addMethod(
  76810. smalltalk.method({
  76811. selector: "init:",
  76812. protocol: 'commands',
  76813. fn: function (args){
  76814. var self=this;
  76815. function $Initer(){return globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
  76816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76817. return smalltalk.withContext(function($ctx1) {
  76818. //>>excludeEnd("ctx");
  76819. _st(_st($Initer())._new())._start();
  76820. return self;
  76821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76822. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},globals.AmberCli.klass)});
  76823. //>>excludeEnd("ctx");
  76824. },
  76825. //>>excludeStart("ide", pragmas.excludeIdeData);
  76826. args: ["args"],
  76827. source: "init: args\x0a\x09Initer new start",
  76828. referencedClasses: ["Initer"],
  76829. //>>excludeEnd("ide");
  76830. messageSends: ["start", "new"]
  76831. }),
  76832. globals.AmberCli.klass);
  76833. smalltalk.addMethod(
  76834. smalltalk.method({
  76835. selector: "main",
  76836. protocol: 'startup',
  76837. fn: function (){
  76838. var self=this;
  76839. var args,nodeMinorVersion;
  76840. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  76841. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  76842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76843. return smalltalk.withContext(function($ctx1) {
  76844. //>>excludeEnd("ctx");
  76845. var $5,$4,$3,$2,$1,$8,$7,$6,$9,$10,$11;
  76846. $5=_st($Smalltalk())._version();
  76847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76848. $ctx1.sendIdx["version"]=1;
  76849. //>>excludeEnd("ctx");
  76850. $4="Welcome to Amber version ".__comma($5);
  76851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76852. $ctx1.sendIdx[","]=4;
  76853. //>>excludeEnd("ctx");
  76854. $3=_st($4).__comma(" (NodeJS ");
  76855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76856. $ctx1.sendIdx[","]=3;
  76857. //>>excludeEnd("ctx");
  76858. $2=_st($3).__comma(_st(_st(process)._versions())._node());
  76859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76860. $ctx1.sendIdx[","]=2;
  76861. //>>excludeEnd("ctx");
  76862. $1=_st($2).__comma(").");
  76863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76864. $ctx1.sendIdx[","]=1;
  76865. //>>excludeEnd("ctx");
  76866. _st($Transcript())._show_($1);
  76867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76868. $ctx1.sendIdx["show:"]=1;
  76869. //>>excludeEnd("ctx");
  76870. $8=_st(process)._version();
  76871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76872. $ctx1.sendIdx["version"]=2;
  76873. //>>excludeEnd("ctx");
  76874. $7=_st($8)._tokenize_(".");
  76875. $6=_st($7)._second();
  76876. nodeMinorVersion=_st($6)._asNumber();
  76877. $9=_st(nodeMinorVersion).__lt((8));
  76878. if(smalltalk.assert($9)){
  76879. _st($Transcript())._show_("You are currently using Node.js ".__comma(_st(process)._version()));
  76880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76881. $ctx1.sendIdx["show:"]=2;
  76882. //>>excludeEnd("ctx");
  76883. _st($Transcript())._show_("Required is at least Node.js v0.8.x or greater.");
  76884. return (-1);
  76885. };
  76886. args=_st(process)._argv();
  76887. _st(args)._removeFrom_to_((1),(2));
  76888. $10=_st(args)._isEmpty();
  76889. if(smalltalk.assert($10)){
  76890. self._help_(nil);
  76891. } else {
  76892. $11=self._handleArguments_(args);
  76893. return $11;
  76894. };
  76895. return self;
  76896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76897. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},globals.AmberCli.klass)});
  76898. //>>excludeEnd("ctx");
  76899. },
  76900. //>>excludeStart("ide", pragmas.excludeIdeData);
  76901. args: [],
  76902. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args nodeMinorVersion |\x0a\x09\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk version, ' (NodeJS ', process versions node, ').'.\x0a\x0a\x09nodeMinorVersion := ((process version) tokenize: '.') second asNumber.\x0a\x09nodeMinorVersion < 8 ifTrue: [\x0a\x09\x09Transcript show: 'You are currently using Node.js ', (process version).\x0a\x09\x09Transcript show: 'Required is at least Node.js v0.8.x or greater.'.\x0a\x09\x09^ -1.\x0a\x09].\x0a\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: 2.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  76903. referencedClasses: ["Transcript", "Smalltalk"],
  76904. //>>excludeEnd("ide");
  76905. messageSends: ["show:", ",", "version", "node", "versions", "asNumber", "second", "tokenize:", "ifTrue:", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  76906. }),
  76907. globals.AmberCli.klass);
  76908. smalltalk.addMethod(
  76909. smalltalk.method({
  76910. selector: "repl:",
  76911. protocol: 'commands',
  76912. fn: function (args){
  76913. var self=this;
  76914. function $Repl(){return globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  76915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76916. return smalltalk.withContext(function($ctx1) {
  76917. //>>excludeEnd("ctx");
  76918. var $1;
  76919. $1=_st(_st($Repl())._new())._createInterface();
  76920. return $1;
  76921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76922. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},globals.AmberCli.klass)});
  76923. //>>excludeEnd("ctx");
  76924. },
  76925. //>>excludeStart("ide", pragmas.excludeIdeData);
  76926. args: ["args"],
  76927. source: "repl: args\x0a\x09^ Repl new createInterface",
  76928. referencedClasses: ["Repl"],
  76929. //>>excludeEnd("ide");
  76930. messageSends: ["createInterface", "new"]
  76931. }),
  76932. globals.AmberCli.klass);
  76933. smalltalk.addMethod(
  76934. smalltalk.method({
  76935. selector: "selectorForCommandLineSwitch:",
  76936. protocol: 'commandline',
  76937. fn: function (aSwitch){
  76938. var self=this;
  76939. var command,selector;
  76940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76941. return smalltalk.withContext(function($ctx1) {
  76942. //>>excludeEnd("ctx");
  76943. var $1,$2;
  76944. $1=_st(self._commandLineSwitches())._includes_(aSwitch);
  76945. if(smalltalk.assert($1)){
  76946. selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
  76947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76948. return smalltalk.withContext(function($ctx2) {
  76949. //>>excludeEnd("ctx");
  76950. return _st(_st(each)._second())._asUppercase();
  76951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  76953. //>>excludeEnd("ctx");
  76954. }))).__comma(":");
  76955. selector;
  76956. } else {
  76957. selector="help:";
  76958. selector;
  76959. };
  76960. $2=selector;
  76961. return $2;
  76962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76963. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},globals.AmberCli.klass)});
  76964. //>>excludeEnd("ctx");
  76965. },
  76966. //>>excludeStart("ide", pragmas.excludeIdeData);
  76967. args: ["aSwitch"],
  76968. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Add ':' at the end and replace all occurences of a lowercase letter preceded by a '-' with the Uppercase letter.\x0a\x09 Example: fallback-page becomes fallbackPage:.\x0a\x09 If no correct selector is found return 'help:'\x22\x0a\x09 | command selector |\x0a\x0a\x09 (self commandLineSwitches includes: aSwitch)\x0a\x09 ifTrue: [ selector := (aSwitch replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':']\x0a\x09 ifFalse: [ selector := 'help:' ].\x0a\x09^ selector",
  76969. referencedClasses: [],
  76970. //>>excludeEnd("ide");
  76971. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  76972. }),
  76973. globals.AmberCli.klass);
  76974. smalltalk.addMethod(
  76975. smalltalk.method({
  76976. selector: "serve:",
  76977. protocol: 'commands',
  76978. fn: function (args){
  76979. var self=this;
  76980. function $FileServer(){return globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  76981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76982. return smalltalk.withContext(function($ctx1) {
  76983. //>>excludeEnd("ctx");
  76984. var $1;
  76985. $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
  76986. return $1;
  76987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76988. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},globals.AmberCli.klass)});
  76989. //>>excludeEnd("ctx");
  76990. },
  76991. //>>excludeStart("ide", pragmas.excludeIdeData);
  76992. args: ["args"],
  76993. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  76994. referencedClasses: ["FileServer"],
  76995. //>>excludeEnd("ide");
  76996. messageSends: ["start", "createServerWithArguments:"]
  76997. }),
  76998. globals.AmberCli.klass);
  76999. smalltalk.addMethod(
  77000. smalltalk.method({
  77001. selector: "version:",
  77002. protocol: 'commands',
  77003. fn: function (arguments){
  77004. var self=this;
  77005. return self;
  77006. },
  77007. //>>excludeStart("ide", pragmas.excludeIdeData);
  77008. args: ["arguments"],
  77009. source: "version: arguments",
  77010. referencedClasses: [],
  77011. //>>excludeEnd("ide");
  77012. messageSends: []
  77013. }),
  77014. globals.AmberCli.klass);
  77015. smalltalk.addClass('BaseFileManipulator', globals.Object, ['path', 'fs'], 'AmberCli');
  77016. smalltalk.addMethod(
  77017. smalltalk.method({
  77018. selector: "dirname",
  77019. protocol: 'private',
  77020. fn: function (){
  77021. var self=this;
  77022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77023. return smalltalk.withContext(function($ctx1) {
  77024. //>>excludeEnd("ctx");
  77025. return __dirname;
  77026. return self;
  77027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77028. }, function($ctx1) {$ctx1.fill(self,"dirname",{},globals.BaseFileManipulator)});
  77029. //>>excludeEnd("ctx");
  77030. },
  77031. //>>excludeStart("ide", pragmas.excludeIdeData);
  77032. args: [],
  77033. source: "dirname\x0a\x09<return __dirname>",
  77034. referencedClasses: [],
  77035. //>>excludeEnd("ide");
  77036. messageSends: []
  77037. }),
  77038. globals.BaseFileManipulator);
  77039. smalltalk.addMethod(
  77040. smalltalk.method({
  77041. selector: "initialize",
  77042. protocol: 'initialization',
  77043. fn: function (){
  77044. var self=this;
  77045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77046. return smalltalk.withContext(function($ctx1) {
  77047. //>>excludeEnd("ctx");
  77048. (
  77049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77050. $ctx1.supercall = true,
  77051. //>>excludeEnd("ctx");
  77052. globals.BaseFileManipulator.superclass.fn.prototype._initialize.apply(_st(self), []));
  77053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77054. $ctx1.supercall = false;
  77055. //>>excludeEnd("ctx");;
  77056. self["@path"]=_st(require)._value_("path");
  77057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77058. $ctx1.sendIdx["value:"]=1;
  77059. //>>excludeEnd("ctx");
  77060. self["@fs"]=_st(require)._value_("fs");
  77061. return self;
  77062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77063. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.BaseFileManipulator)});
  77064. //>>excludeEnd("ctx");
  77065. },
  77066. //>>excludeStart("ide", pragmas.excludeIdeData);
  77067. args: [],
  77068. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  77069. referencedClasses: [],
  77070. //>>excludeEnd("ide");
  77071. messageSends: ["initialize", "value:"]
  77072. }),
  77073. globals.BaseFileManipulator);
  77074. smalltalk.addMethod(
  77075. smalltalk.method({
  77076. selector: "rootDirname",
  77077. protocol: 'private',
  77078. fn: function (){
  77079. var self=this;
  77080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77081. return smalltalk.withContext(function($ctx1) {
  77082. //>>excludeEnd("ctx");
  77083. var $1;
  77084. $1=_st(self["@path"])._join_with_(self._dirname(),"..");
  77085. return $1;
  77086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77087. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},globals.BaseFileManipulator)});
  77088. //>>excludeEnd("ctx");
  77089. },
  77090. //>>excludeStart("ide", pragmas.excludeIdeData);
  77091. args: [],
  77092. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  77093. referencedClasses: [],
  77094. //>>excludeEnd("ide");
  77095. messageSends: ["join:with:", "dirname"]
  77096. }),
  77097. globals.BaseFileManipulator);
  77098. smalltalk.addClass('Configurator', globals.BaseFileManipulator, [], 'AmberCli');
  77099. smalltalk.addMethod(
  77100. smalltalk.method({
  77101. selector: "initialize",
  77102. protocol: 'initialization',
  77103. fn: function (){
  77104. var self=this;
  77105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77106. return smalltalk.withContext(function($ctx1) {
  77107. //>>excludeEnd("ctx");
  77108. (
  77109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77110. $ctx1.supercall = true,
  77111. //>>excludeEnd("ctx");
  77112. globals.Configurator.superclass.fn.prototype._initialize.apply(_st(self), []));
  77113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77114. $ctx1.supercall = false;
  77115. //>>excludeEnd("ctx");;
  77116. return self;
  77117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77118. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Configurator)});
  77119. //>>excludeEnd("ctx");
  77120. },
  77121. //>>excludeStart("ide", pragmas.excludeIdeData);
  77122. args: [],
  77123. source: "initialize\x0a\x09super initialize",
  77124. referencedClasses: [],
  77125. //>>excludeEnd("ide");
  77126. messageSends: ["initialize"]
  77127. }),
  77128. globals.Configurator);
  77129. smalltalk.addMethod(
  77130. smalltalk.method({
  77131. selector: "start",
  77132. protocol: 'action',
  77133. fn: function (){
  77134. var self=this;
  77135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77136. return smalltalk.withContext(function($ctx1) {
  77137. //>>excludeEnd("ctx");
  77138. self._writeConfigThenDo_((function(){
  77139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77140. return smalltalk.withContext(function($ctx2) {
  77141. //>>excludeEnd("ctx");
  77142. return _st(process)._exit();
  77143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  77145. //>>excludeEnd("ctx");
  77146. }));
  77147. return self;
  77148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77149. }, function($ctx1) {$ctx1.fill(self,"start",{},globals.Configurator)});
  77150. //>>excludeEnd("ctx");
  77151. },
  77152. //>>excludeStart("ide", pragmas.excludeIdeData);
  77153. args: [],
  77154. source: "start\x0a\x09self writeConfigThenDo: [ process exit ]",
  77155. referencedClasses: [],
  77156. //>>excludeEnd("ide");
  77157. messageSends: ["writeConfigThenDo:", "exit"]
  77158. }),
  77159. globals.Configurator);
  77160. smalltalk.addMethod(
  77161. smalltalk.method({
  77162. selector: "writeConfigThenDo:",
  77163. protocol: 'action',
  77164. fn: function (aBlock){
  77165. var self=this;
  77166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77167. return smalltalk.withContext(function($ctx1) {
  77168. //>>excludeEnd("ctx");
  77169. _st(_st(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_(_st(process)._cwd(),"config.js",aBlock);
  77170. return self;
  77171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77172. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},globals.Configurator)});
  77173. //>>excludeEnd("ctx");
  77174. },
  77175. //>>excludeStart("ide", pragmas.excludeIdeData);
  77176. args: ["aBlock"],
  77177. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev/lib/config')\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  77178. referencedClasses: [],
  77179. //>>excludeEnd("ide");
  77180. messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"]
  77181. }),
  77182. globals.Configurator);
  77183. smalltalk.addClass('FileServer', globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  77184. //>>excludeStart("ide", pragmas.excludeIdeData);
  77185. globals.FileServer.comment="I am the Amber Smalltalk FileServer.\x0aMy runtime requirement is a functional Node.js executable.\x0a\x0aTo start a FileServer instance on port `4000` use the following code:\x0a\x0a FileServer new start\x0a\x0aA parameterized instance can be created with the following code:\x0a\x0a FileServer createServerWithArguments: options\x0a\x0aHere, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.\x0aA list of all available parameters can be printed to the commandline by passing `--help` as parameter.\x0aSee the `Options` section for further details on how options are mapped to instance methods.\x0a\x0aAfter startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.\x0a\x0a\x0a## Options\x0a\x0aEach option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.\x0aThe trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.\x0aAfterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.\x0a\x0a## Adding new commandline parameters\x0a\x0aAdding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol.";
  77186. //>>excludeEnd("ide");
  77187. smalltalk.addMethod(
  77188. smalltalk.method({
  77189. selector: "base64Decode:",
  77190. protocol: 'private',
  77191. fn: function (aString){
  77192. var self=this;
  77193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77194. return smalltalk.withContext(function($ctx1) {
  77195. //>>excludeEnd("ctx");
  77196. return (new Buffer(aString, 'base64').toString());
  77197. return self;
  77198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77199. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},globals.FileServer)});
  77200. //>>excludeEnd("ctx");
  77201. },
  77202. //>>excludeStart("ide", pragmas.excludeIdeData);
  77203. args: ["aString"],
  77204. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  77205. referencedClasses: [],
  77206. //>>excludeEnd("ide");
  77207. messageSends: []
  77208. }),
  77209. globals.FileServer);
  77210. smalltalk.addMethod(
  77211. smalltalk.method({
  77212. selector: "basePath",
  77213. protocol: 'accessing',
  77214. fn: function (){
  77215. var self=this;
  77216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77217. return smalltalk.withContext(function($ctx1) {
  77218. //>>excludeEnd("ctx");
  77219. var $2,$1,$receiver;
  77220. $2=self["@basePath"];
  77221. if(($receiver = $2) == null || $receiver.isNil){
  77222. $1=_st(self._class())._defaultBasePath();
  77223. } else {
  77224. $1=$2;
  77225. };
  77226. return $1;
  77227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77228. }, function($ctx1) {$ctx1.fill(self,"basePath",{},globals.FileServer)});
  77229. //>>excludeEnd("ctx");
  77230. },
  77231. //>>excludeStart("ide", pragmas.excludeIdeData);
  77232. args: [],
  77233. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  77234. referencedClasses: [],
  77235. //>>excludeEnd("ide");
  77236. messageSends: ["ifNil:", "defaultBasePath", "class"]
  77237. }),
  77238. globals.FileServer);
  77239. smalltalk.addMethod(
  77240. smalltalk.method({
  77241. selector: "basePath:",
  77242. protocol: 'accessing',
  77243. fn: function (aString){
  77244. var self=this;
  77245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77246. return smalltalk.withContext(function($ctx1) {
  77247. //>>excludeEnd("ctx");
  77248. self["@basePath"]=aString;
  77249. self._validateBasePath();
  77250. return self;
  77251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77252. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},globals.FileServer)});
  77253. //>>excludeEnd("ctx");
  77254. },
  77255. //>>excludeStart("ide", pragmas.excludeIdeData);
  77256. args: ["aString"],
  77257. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  77258. referencedClasses: [],
  77259. //>>excludeEnd("ide");
  77260. messageSends: ["validateBasePath"]
  77261. }),
  77262. globals.FileServer);
  77263. smalltalk.addMethod(
  77264. smalltalk.method({
  77265. selector: "checkDirectoryLayout",
  77266. protocol: 'initialization',
  77267. fn: function (){
  77268. var self=this;
  77269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77270. return smalltalk.withContext(function($ctx1) {
  77271. //>>excludeEnd("ctx");
  77272. var $1;
  77273. $1=_st(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  77274. if(! smalltalk.assert($1)){
  77275. _st(console)._warn_("Warning: project directory does not contain index.html.");
  77276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77277. $ctx1.sendIdx["warn:"]=1;
  77278. //>>excludeEnd("ctx");
  77279. _st(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  77280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77281. $ctx1.sendIdx["warn:"]=2;
  77282. //>>excludeEnd("ctx");
  77283. _st(console)._warn_(" You can also specify a page to be served by default,");
  77284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77285. $ctx1.sendIdx["warn:"]=3;
  77286. //>>excludeEnd("ctx");
  77287. _st(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  77288. };
  77289. return self;
  77290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77291. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},globals.FileServer)});
  77292. //>>excludeEnd("ctx");
  77293. },
  77294. //>>excludeStart("ide", pragmas.excludeIdeData);
  77295. args: [],
  77296. source: "checkDirectoryLayout\x0a\x09(fs existsSync:\x09(self withBasePath: 'index.html')) ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html.'.\x0a\x09\x09console warn: ' You can specify the directory containing index.html with --base-path.'.\x0a\x09\x09console warn: ' You can also specify a page to be served by default,'.\x0a\x09\x09console warn: ' for all paths that do not map to a file, with --fallback-page.'].",
  77297. referencedClasses: [],
  77298. //>>excludeEnd("ide");
  77299. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  77300. }),
  77301. globals.FileServer);
  77302. smalltalk.addMethod(
  77303. smalltalk.method({
  77304. selector: "fallbackPage",
  77305. protocol: 'accessing',
  77306. fn: function (){
  77307. var self=this;
  77308. var $1;
  77309. $1=self["@fallbackPage"];
  77310. return $1;
  77311. },
  77312. //>>excludeStart("ide", pragmas.excludeIdeData);
  77313. args: [],
  77314. source: "fallbackPage\x0a\x09^ fallbackPage",
  77315. referencedClasses: [],
  77316. //>>excludeEnd("ide");
  77317. messageSends: []
  77318. }),
  77319. globals.FileServer);
  77320. smalltalk.addMethod(
  77321. smalltalk.method({
  77322. selector: "fallbackPage:",
  77323. protocol: 'accessing',
  77324. fn: function (aString){
  77325. var self=this;
  77326. self["@fallbackPage"]=aString;
  77327. return self;
  77328. },
  77329. //>>excludeStart("ide", pragmas.excludeIdeData);
  77330. args: ["aString"],
  77331. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  77332. referencedClasses: [],
  77333. //>>excludeEnd("ide");
  77334. messageSends: []
  77335. }),
  77336. globals.FileServer);
  77337. smalltalk.addMethod(
  77338. smalltalk.method({
  77339. selector: "handleGETRequest:respondTo:",
  77340. protocol: 'request handling',
  77341. fn: function (aRequest,aResponse){
  77342. var self=this;
  77343. var uri,filename;
  77344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77345. return smalltalk.withContext(function($ctx1) {
  77346. //>>excludeEnd("ctx");
  77347. var $1;
  77348. uri=_st(self["@url"])._parse_(_st(aRequest)._url());
  77349. filename=_st(self["@path"])._join_with_(self._basePath(),_st(uri)._pathname());
  77350. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  77351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77352. return smalltalk.withContext(function($ctx2) {
  77353. //>>excludeEnd("ctx");
  77354. if(smalltalk.assert(aBoolean)){
  77355. $1=_st(_st(self["@fs"])._statSync_(filename))._isDirectory();
  77356. if(smalltalk.assert($1)){
  77357. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  77358. } else {
  77359. return self._respondFileNamed_to_(filename,aResponse);
  77360. };
  77361. } else {
  77362. return self._respondNotFoundTo_(aResponse);
  77363. };
  77364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77365. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  77366. //>>excludeEnd("ctx");
  77367. }));
  77368. return self;
  77369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77370. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},globals.FileServer)});
  77371. //>>excludeEnd("ctx");
  77372. },
  77373. //>>excludeStart("ide", pragmas.excludeIdeData);
  77374. args: ["aRequest", "aResponse"],
  77375. source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := url parse: aRequest url.\x0a\x09filename := path join: self basePath with: uri pathname.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [(fs statSync: filename) isDirectory\x0a\x09\x09\x09\x09ifTrue: [self respondDirectoryNamed: filename from: uri to: aResponse]\x0a\x09\x09\x09\x09ifFalse: [self respondFileNamed: filename to: aResponse]]]",
  77376. referencedClasses: [],
  77377. //>>excludeEnd("ide");
  77378. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  77379. }),
  77380. globals.FileServer);
  77381. smalltalk.addMethod(
  77382. smalltalk.method({
  77383. selector: "handleOPTIONSRequest:respondTo:",
  77384. protocol: 'request handling',
  77385. fn: function (aRequest,aResponse){
  77386. var self=this;
  77387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77388. return smalltalk.withContext(function($ctx1) {
  77389. //>>excludeEnd("ctx");
  77390. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Access-Control-Allow-Origin","*","Access-Control-Allow-Methods","GET, PUT, POST, DELETE, OPTIONS","Access-Control-Allow-Headers","Content-Type, Accept","Content-Length",(0),"Access-Control-Max-Age",(10)]));
  77391. _st(aResponse)._end();
  77392. return self;
  77393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77394. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},globals.FileServer)});
  77395. //>>excludeEnd("ctx");
  77396. },
  77397. //>>excludeStart("ide", pragmas.excludeIdeData);
  77398. args: ["aRequest", "aResponse"],
  77399. 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",
  77400. referencedClasses: [],
  77401. //>>excludeEnd("ide");
  77402. messageSends: ["writeHead:options:", "end"]
  77403. }),
  77404. globals.FileServer);
  77405. smalltalk.addMethod(
  77406. smalltalk.method({
  77407. selector: "handlePUTRequest:respondTo:",
  77408. protocol: 'request handling',
  77409. fn: function (aRequest,aResponse){
  77410. var self=this;
  77411. var file,stream;
  77412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77413. return smalltalk.withContext(function($ctx1) {
  77414. //>>excludeEnd("ctx");
  77415. var $1,$2,$3,$4;
  77416. $1=self._isAuthenticated_(aRequest);
  77417. if(! smalltalk.assert($1)){
  77418. self._respondAuthenticationRequiredTo_(aResponse);
  77419. return nil;
  77420. };
  77421. file=".".__comma(_st(aRequest)._url());
  77422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77423. $ctx1.sendIdx[","]=1;
  77424. //>>excludeEnd("ctx");
  77425. stream=_st(self["@fs"])._createWriteStream_(file);
  77426. _st(stream)._on_do_("error",(function(error){
  77427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77428. return smalltalk.withContext(function($ctx2) {
  77429. //>>excludeEnd("ctx");
  77430. $2=console;
  77431. $3="Error creating WriteStream for file ".__comma(file);
  77432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77433. $ctx2.sendIdx[","]=2;
  77434. //>>excludeEnd("ctx");
  77435. _st($2)._warn_($3);
  77436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77437. $ctx2.sendIdx["warn:"]=1;
  77438. //>>excludeEnd("ctx");
  77439. _st(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  77440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77441. $ctx2.sendIdx["warn:"]=2;
  77442. //>>excludeEnd("ctx");
  77443. _st(console)._warn_(" The exact error is: ".__comma(error));
  77444. return self._respondNotCreatedTo_(aResponse);
  77445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77446. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  77447. //>>excludeEnd("ctx");
  77448. }));
  77449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77450. $ctx1.sendIdx["on:do:"]=1;
  77451. //>>excludeEnd("ctx");
  77452. _st(stream)._on_do_("close",(function(){
  77453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77454. return smalltalk.withContext(function($ctx2) {
  77455. //>>excludeEnd("ctx");
  77456. return self._respondCreatedTo_(aResponse);
  77457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  77459. //>>excludeEnd("ctx");
  77460. }));
  77461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77462. $ctx1.sendIdx["on:do:"]=2;
  77463. //>>excludeEnd("ctx");
  77464. _st(aRequest)._setEncoding_("utf8");
  77465. _st(aRequest)._on_do_("data",(function(data){
  77466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77467. return smalltalk.withContext(function($ctx2) {
  77468. //>>excludeEnd("ctx");
  77469. return _st(stream)._write_(data);
  77470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77471. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  77472. //>>excludeEnd("ctx");
  77473. }));
  77474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77475. $ctx1.sendIdx["on:do:"]=3;
  77476. //>>excludeEnd("ctx");
  77477. _st(aRequest)._on_do_("end",(function(){
  77478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77479. return smalltalk.withContext(function($ctx2) {
  77480. //>>excludeEnd("ctx");
  77481. $4=_st(stream)._writable();
  77482. if(smalltalk.assert($4)){
  77483. return _st(stream)._end();
  77484. };
  77485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  77487. //>>excludeEnd("ctx");
  77488. }));
  77489. return self;
  77490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77491. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},globals.FileServer)});
  77492. //>>excludeEnd("ctx");
  77493. },
  77494. //>>excludeStart("ide", pragmas.excludeIdeData);
  77495. args: ["aRequest", "aResponse"],
  77496. 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 directory in your project (often /src)?'.\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]]",
  77497. referencedClasses: [],
  77498. //>>excludeEnd("ide");
  77499. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  77500. }),
  77501. globals.FileServer);
  77502. smalltalk.addMethod(
  77503. smalltalk.method({
  77504. selector: "handleRequest:respondTo:",
  77505. protocol: 'request handling',
  77506. fn: function (aRequest,aResponse){
  77507. var self=this;
  77508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77509. return smalltalk.withContext(function($ctx1) {
  77510. //>>excludeEnd("ctx");
  77511. var $2,$1,$4,$3,$5;
  77512. $2=_st(aRequest)._method();
  77513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77514. $ctx1.sendIdx["method"]=1;
  77515. //>>excludeEnd("ctx");
  77516. $1=_st($2).__eq("PUT");
  77517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77518. $ctx1.sendIdx["="]=1;
  77519. //>>excludeEnd("ctx");
  77520. if(smalltalk.assert($1)){
  77521. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  77522. };
  77523. $4=_st(aRequest)._method();
  77524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77525. $ctx1.sendIdx["method"]=2;
  77526. //>>excludeEnd("ctx");
  77527. $3=_st($4).__eq("GET");
  77528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77529. $ctx1.sendIdx["="]=2;
  77530. //>>excludeEnd("ctx");
  77531. if(smalltalk.assert($3)){
  77532. self._handleGETRequest_respondTo_(aRequest,aResponse);
  77533. };
  77534. $5=_st(_st(aRequest)._method()).__eq("OPTIONS");
  77535. if(smalltalk.assert($5)){
  77536. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  77537. };
  77538. return self;
  77539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77540. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},globals.FileServer)});
  77541. //>>excludeEnd("ctx");
  77542. },
  77543. //>>excludeStart("ide", pragmas.excludeIdeData);
  77544. args: ["aRequest", "aResponse"],
  77545. 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]",
  77546. referencedClasses: [],
  77547. //>>excludeEnd("ide");
  77548. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  77549. }),
  77550. globals.FileServer);
  77551. smalltalk.addMethod(
  77552. smalltalk.method({
  77553. selector: "host",
  77554. protocol: 'accessing',
  77555. fn: function (){
  77556. var self=this;
  77557. var $1;
  77558. $1=self["@host"];
  77559. return $1;
  77560. },
  77561. //>>excludeStart("ide", pragmas.excludeIdeData);
  77562. args: [],
  77563. source: "host\x0a\x09^ host",
  77564. referencedClasses: [],
  77565. //>>excludeEnd("ide");
  77566. messageSends: []
  77567. }),
  77568. globals.FileServer);
  77569. smalltalk.addMethod(
  77570. smalltalk.method({
  77571. selector: "host:",
  77572. protocol: 'accessing',
  77573. fn: function (hostname){
  77574. var self=this;
  77575. self["@host"]=hostname;
  77576. return self;
  77577. },
  77578. //>>excludeStart("ide", pragmas.excludeIdeData);
  77579. args: ["hostname"],
  77580. source: "host: hostname\x0a\x09host := hostname",
  77581. referencedClasses: [],
  77582. //>>excludeEnd("ide");
  77583. messageSends: []
  77584. }),
  77585. globals.FileServer);
  77586. smalltalk.addMethod(
  77587. smalltalk.method({
  77588. selector: "initialize",
  77589. protocol: 'initialization',
  77590. fn: function (){
  77591. var self=this;
  77592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77593. return smalltalk.withContext(function($ctx1) {
  77594. //>>excludeEnd("ctx");
  77595. var $1;
  77596. (
  77597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77598. $ctx1.supercall = true,
  77599. //>>excludeEnd("ctx");
  77600. globals.FileServer.superclass.fn.prototype._initialize.apply(_st(self), []));
  77601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77602. $ctx1.supercall = false;
  77603. //>>excludeEnd("ctx");;
  77604. self["@http"]=self._require_("http");
  77605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77606. $ctx1.sendIdx["require:"]=1;
  77607. //>>excludeEnd("ctx");
  77608. self["@util"]=self._require_("util");
  77609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77610. $ctx1.sendIdx["require:"]=2;
  77611. //>>excludeEnd("ctx");
  77612. self["@url"]=self._require_("url");
  77613. $1=self._class();
  77614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77615. $ctx1.sendIdx["class"]=1;
  77616. //>>excludeEnd("ctx");
  77617. self["@host"]=_st($1)._defaultHost();
  77618. self["@port"]=_st(self._class())._defaultPort();
  77619. self["@username"]=nil;
  77620. self["@password"]=nil;
  77621. self["@fallbackPage"]=nil;
  77622. return self;
  77623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77624. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.FileServer)});
  77625. //>>excludeEnd("ctx");
  77626. },
  77627. //>>excludeStart("ide", pragmas.excludeIdeData);
  77628. args: [],
  77629. source: "initialize\x0a\x09super initialize.\x0a\x09http := self require: 'http'.\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.",
  77630. referencedClasses: [],
  77631. //>>excludeEnd("ide");
  77632. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  77633. }),
  77634. globals.FileServer);
  77635. smalltalk.addMethod(
  77636. smalltalk.method({
  77637. selector: "isAuthenticated:",
  77638. protocol: 'private',
  77639. fn: function (aRequest){
  77640. var self=this;
  77641. var header,token,auth,parts;
  77642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77643. return smalltalk.withContext(function($ctx1) {
  77644. //>>excludeEnd("ctx");
  77645. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  77646. $2=_st(self["@username"])._isNil();
  77647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77648. $ctx1.sendIdx["isNil"]=1;
  77649. //>>excludeEnd("ctx");
  77650. $1=_st($2)._and_((function(){
  77651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77652. return smalltalk.withContext(function($ctx2) {
  77653. //>>excludeEnd("ctx");
  77654. return _st(self["@password"])._isNil();
  77655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  77657. //>>excludeEnd("ctx");
  77658. }));
  77659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77660. $ctx1.sendIdx["and:"]=1;
  77661. //>>excludeEnd("ctx");
  77662. if(smalltalk.assert($1)){
  77663. return true;
  77664. };
  77665. $3=_st(_st(aRequest)._headers())._at_("authorization");
  77666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77667. $ctx1.sendIdx["at:"]=1;
  77668. //>>excludeEnd("ctx");
  77669. if(($receiver = $3) == null || $receiver.isNil){
  77670. header="";
  77671. } else {
  77672. header=$3;
  77673. };
  77674. $4=_st(header)._isEmpty();
  77675. if(smalltalk.assert($4)){
  77676. return false;
  77677. } else {
  77678. $5=_st(header)._tokenize_(" ");
  77679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77680. $ctx1.sendIdx["tokenize:"]=1;
  77681. //>>excludeEnd("ctx");
  77682. if(($receiver = $5) == null || $receiver.isNil){
  77683. token="";
  77684. } else {
  77685. token=$5;
  77686. };
  77687. token;
  77688. $6=_st(token)._at_((2));
  77689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77690. $ctx1.sendIdx["at:"]=2;
  77691. //>>excludeEnd("ctx");
  77692. auth=self._base64Decode_($6);
  77693. auth;
  77694. parts=_st(auth)._tokenize_(":");
  77695. parts;
  77696. $9=self["@username"];
  77697. $10=_st(parts)._at_((1));
  77698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77699. $ctx1.sendIdx["at:"]=3;
  77700. //>>excludeEnd("ctx");
  77701. $8=_st($9).__eq($10);
  77702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77703. $ctx1.sendIdx["="]=1;
  77704. //>>excludeEnd("ctx");
  77705. $7=_st($8)._and_((function(){
  77706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77707. return smalltalk.withContext(function($ctx2) {
  77708. //>>excludeEnd("ctx");
  77709. return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  77710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  77712. //>>excludeEnd("ctx");
  77713. }));
  77714. if(smalltalk.assert($7)){
  77715. return true;
  77716. } else {
  77717. return false;
  77718. };
  77719. };
  77720. return self;
  77721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77722. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},globals.FileServer)});
  77723. //>>excludeEnd("ctx");
  77724. },
  77725. //>>excludeStart("ide", pragmas.excludeIdeData);
  77726. args: ["aRequest"],
  77727. 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].",
  77728. referencedClasses: [],
  77729. //>>excludeEnd("ide");
  77730. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  77731. }),
  77732. globals.FileServer);
  77733. smalltalk.addMethod(
  77734. smalltalk.method({
  77735. selector: "password:",
  77736. protocol: 'accessing',
  77737. fn: function (aPassword){
  77738. var self=this;
  77739. self["@password"]=aPassword;
  77740. return self;
  77741. },
  77742. //>>excludeStart("ide", pragmas.excludeIdeData);
  77743. args: ["aPassword"],
  77744. source: "password: aPassword\x0a\x09password := aPassword.",
  77745. referencedClasses: [],
  77746. //>>excludeEnd("ide");
  77747. messageSends: []
  77748. }),
  77749. globals.FileServer);
  77750. smalltalk.addMethod(
  77751. smalltalk.method({
  77752. selector: "port",
  77753. protocol: 'accessing',
  77754. fn: function (){
  77755. var self=this;
  77756. var $1;
  77757. $1=self["@port"];
  77758. return $1;
  77759. },
  77760. //>>excludeStart("ide", pragmas.excludeIdeData);
  77761. args: [],
  77762. source: "port\x0a\x09^ port",
  77763. referencedClasses: [],
  77764. //>>excludeEnd("ide");
  77765. messageSends: []
  77766. }),
  77767. globals.FileServer);
  77768. smalltalk.addMethod(
  77769. smalltalk.method({
  77770. selector: "port:",
  77771. protocol: 'accessing',
  77772. fn: function (aNumber){
  77773. var self=this;
  77774. self["@port"]=aNumber;
  77775. return self;
  77776. },
  77777. //>>excludeStart("ide", pragmas.excludeIdeData);
  77778. args: ["aNumber"],
  77779. source: "port: aNumber\x0a\x09port := aNumber",
  77780. referencedClasses: [],
  77781. //>>excludeEnd("ide");
  77782. messageSends: []
  77783. }),
  77784. globals.FileServer);
  77785. smalltalk.addMethod(
  77786. smalltalk.method({
  77787. selector: "require:",
  77788. protocol: 'private',
  77789. fn: function (aModuleString){
  77790. var self=this;
  77791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77792. return smalltalk.withContext(function($ctx1) {
  77793. //>>excludeEnd("ctx");
  77794. var $1;
  77795. $1=_st(require)._value_(aModuleString);
  77796. return $1;
  77797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77798. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},globals.FileServer)});
  77799. //>>excludeEnd("ctx");
  77800. },
  77801. //>>excludeStart("ide", pragmas.excludeIdeData);
  77802. args: ["aModuleString"],
  77803. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  77804. referencedClasses: [],
  77805. //>>excludeEnd("ide");
  77806. messageSends: ["value:"]
  77807. }),
  77808. globals.FileServer);
  77809. smalltalk.addMethod(
  77810. smalltalk.method({
  77811. selector: "respondAuthenticationRequiredTo:",
  77812. protocol: 'request handling',
  77813. fn: function (aResponse){
  77814. var self=this;
  77815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77816. return smalltalk.withContext(function($ctx1) {
  77817. //>>excludeEnd("ctx");
  77818. var $1;
  77819. _st(aResponse)._writeHead_options_((401),globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  77820. _st(aResponse)._write_("<html><body>Authentication needed</body></html>");
  77821. $1=_st(aResponse)._end();
  77822. return self;
  77823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77824. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},globals.FileServer)});
  77825. //>>excludeEnd("ctx");
  77826. },
  77827. //>>excludeStart("ide", pragmas.excludeIdeData);
  77828. args: ["aResponse"],
  77829. 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.",
  77830. referencedClasses: [],
  77831. //>>excludeEnd("ide");
  77832. messageSends: ["writeHead:options:", "write:", "end"]
  77833. }),
  77834. globals.FileServer);
  77835. smalltalk.addMethod(
  77836. smalltalk.method({
  77837. selector: "respondCreatedTo:",
  77838. protocol: 'request handling',
  77839. fn: function (aResponse){
  77840. var self=this;
  77841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77842. return smalltalk.withContext(function($ctx1) {
  77843. //>>excludeEnd("ctx");
  77844. var $1;
  77845. _st(aResponse)._writeHead_options_((201),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  77846. $1=_st(aResponse)._end();
  77847. return self;
  77848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77849. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},globals.FileServer)});
  77850. //>>excludeEnd("ctx");
  77851. },
  77852. //>>excludeStart("ide", pragmas.excludeIdeData);
  77853. args: ["aResponse"],
  77854. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  77855. referencedClasses: [],
  77856. //>>excludeEnd("ide");
  77857. messageSends: ["writeHead:options:", "end"]
  77858. }),
  77859. globals.FileServer);
  77860. smalltalk.addMethod(
  77861. smalltalk.method({
  77862. selector: "respondDirectoryNamed:from:to:",
  77863. protocol: 'request handling',
  77864. fn: function (aDirname,aUrl,aResponse){
  77865. var self=this;
  77866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77867. return smalltalk.withContext(function($ctx1) {
  77868. //>>excludeEnd("ctx");
  77869. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  77870. $2=_st(aUrl)._pathname();
  77871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77872. $ctx1.sendIdx["pathname"]=1;
  77873. //>>excludeEnd("ctx");
  77874. $1=_st($2)._endsWith_("/");
  77875. if(smalltalk.assert($1)){
  77876. $3=_st(aDirname).__comma("index.html");
  77877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77878. $ctx1.sendIdx[","]=1;
  77879. //>>excludeEnd("ctx");
  77880. self._respondFileNamed_to_($3,aResponse);
  77881. } else {
  77882. $5=_st(_st(aUrl)._pathname()).__comma("/");
  77883. $7=_st(aUrl)._search();
  77884. if(($receiver = $7) == null || $receiver.isNil){
  77885. $6="";
  77886. } else {
  77887. $6=$7;
  77888. };
  77889. $4=_st($5).__comma($6);
  77890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77891. $ctx1.sendIdx[","]=2;
  77892. //>>excludeEnd("ctx");
  77893. self._respondRedirect_to_($4,aResponse);
  77894. };
  77895. return self;
  77896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77897. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},globals.FileServer)});
  77898. //>>excludeEnd("ctx");
  77899. },
  77900. //>>excludeStart("ide", pragmas.excludeIdeData);
  77901. args: ["aDirname", "aUrl", "aResponse"],
  77902. source: "respondDirectoryNamed: aDirname from: aUrl to: aResponse\x0a\x09(aUrl pathname endsWith: '/')\x0a\x09\x09ifTrue: [self respondFileNamed: aDirname, 'index.html' to: aResponse]\x0a\x09\x09ifFalse: [self respondRedirect: aUrl pathname, '/', (aUrl search ifNil: ['']) to: aResponse]",
  77903. referencedClasses: [],
  77904. //>>excludeEnd("ide");
  77905. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  77906. }),
  77907. globals.FileServer);
  77908. smalltalk.addMethod(
  77909. smalltalk.method({
  77910. selector: "respondFileNamed:to:",
  77911. protocol: 'request handling',
  77912. fn: function (aFilename,aResponse){
  77913. var self=this;
  77914. var type,filename;
  77915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77916. return smalltalk.withContext(function($ctx1) {
  77917. //>>excludeEnd("ctx");
  77918. var $1,$2,$3,$4,$5;
  77919. filename=aFilename;
  77920. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  77921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77922. return smalltalk.withContext(function($ctx2) {
  77923. //>>excludeEnd("ctx");
  77924. $1=_st(ex)._notNil();
  77925. if(smalltalk.assert($1)){
  77926. $2=console;
  77927. $3=_st(filename).__comma(" does not exist");
  77928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77929. $ctx2.sendIdx[","]=1;
  77930. //>>excludeEnd("ctx");
  77931. _st($2)._log_($3);
  77932. return self._respondNotFoundTo_(aResponse);
  77933. } else {
  77934. type=_st(self._class())._mimeTypeFor_(filename);
  77935. type;
  77936. $4=_st(type).__eq("application/javascript");
  77937. if(smalltalk.assert($4)){
  77938. type=_st(type).__comma(";charset=utf-8");
  77939. type;
  77940. };
  77941. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  77942. _st(aResponse)._write_encoding_(file,"binary");
  77943. $5=_st(aResponse)._end();
  77944. return $5;
  77945. };
  77946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77947. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  77948. //>>excludeEnd("ctx");
  77949. }));
  77950. return self;
  77951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77952. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},globals.FileServer)});
  77953. //>>excludeEnd("ctx");
  77954. },
  77955. //>>excludeStart("ide", pragmas.excludeIdeData);
  77956. args: ["aFilename", "aResponse"],
  77957. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\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 respondNotFoundTo: 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]]",
  77958. referencedClasses: [],
  77959. //>>excludeEnd("ide");
  77960. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  77961. }),
  77962. globals.FileServer);
  77963. smalltalk.addMethod(
  77964. smalltalk.method({
  77965. selector: "respondInternalErrorTo:",
  77966. protocol: 'request handling',
  77967. fn: function (aResponse){
  77968. var self=this;
  77969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77970. return smalltalk.withContext(function($ctx1) {
  77971. //>>excludeEnd("ctx");
  77972. var $1;
  77973. _st(aResponse)._writeHead_options_((500),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  77974. _st(aResponse)._write_("500 Internal server error");
  77975. $1=_st(aResponse)._end();
  77976. return self;
  77977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77978. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},globals.FileServer)});
  77979. //>>excludeEnd("ctx");
  77980. },
  77981. //>>excludeStart("ide", pragmas.excludeIdeData);
  77982. args: ["aResponse"],
  77983. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  77984. referencedClasses: [],
  77985. //>>excludeEnd("ide");
  77986. messageSends: ["writeHead:options:", "write:", "end"]
  77987. }),
  77988. globals.FileServer);
  77989. smalltalk.addMethod(
  77990. smalltalk.method({
  77991. selector: "respondNotCreatedTo:",
  77992. protocol: 'request handling',
  77993. fn: function (aResponse){
  77994. var self=this;
  77995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77996. return smalltalk.withContext(function($ctx1) {
  77997. //>>excludeEnd("ctx");
  77998. var $1;
  77999. _st(aResponse)._writeHead_options_((400),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  78000. _st(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  78001. $1=_st(aResponse)._end();
  78002. return self;
  78003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78004. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},globals.FileServer)});
  78005. //>>excludeEnd("ctx");
  78006. },
  78007. //>>excludeStart("ide", pragmas.excludeIdeData);
  78008. args: ["aResponse"],
  78009. 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 src directory on the server?';\x0a\x09\x09end.",
  78010. referencedClasses: [],
  78011. //>>excludeEnd("ide");
  78012. messageSends: ["writeHead:options:", "write:", "end"]
  78013. }),
  78014. globals.FileServer);
  78015. smalltalk.addMethod(
  78016. smalltalk.method({
  78017. selector: "respondNotFoundTo:",
  78018. protocol: 'request handling',
  78019. fn: function (aResponse){
  78020. var self=this;
  78021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78022. return smalltalk.withContext(function($ctx1) {
  78023. //>>excludeEnd("ctx");
  78024. var $2,$1,$3,$4;
  78025. $2=self._fallbackPage();
  78026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78027. $ctx1.sendIdx["fallbackPage"]=1;
  78028. //>>excludeEnd("ctx");
  78029. $1=_st($2)._isNil();
  78030. if(! smalltalk.assert($1)){
  78031. $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  78032. return $3;
  78033. };
  78034. _st(aResponse)._writeHead_options_((404),globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  78035. _st(aResponse)._write_("<html><body><p>404 Not found</p>");
  78036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78037. $ctx1.sendIdx["write:"]=1;
  78038. //>>excludeEnd("ctx");
  78039. _st(aResponse)._write_("<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>");
  78040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78041. $ctx1.sendIdx["write:"]=2;
  78042. //>>excludeEnd("ctx");
  78043. _st(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  78044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78045. $ctx1.sendIdx["write:"]=3;
  78046. //>>excludeEnd("ctx");
  78047. _st(aResponse)._write_("<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>");
  78048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78049. $ctx1.sendIdx["write:"]=4;
  78050. //>>excludeEnd("ctx");
  78051. _st(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  78052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78053. $ctx1.sendIdx["write:"]=5;
  78054. //>>excludeEnd("ctx");
  78055. _st(aResponse)._write_("</ul></p></body></html>");
  78056. $4=_st(aResponse)._end();
  78057. return self;
  78058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78059. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},globals.FileServer)});
  78060. //>>excludeEnd("ctx");
  78061. },
  78062. //>>excludeStart("ide", pragmas.excludeIdeData);
  78063. args: ["aResponse"],
  78064. source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/html'};\x0a\x09\x09write: '<html><body><p>404 Not found</p>';\x0a\x09\x09write: '<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>';\x0a\x09\x09write: '<li>create an index.html in the served directory.</li>';\x0a\x09\x09write: '<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>';\x0a\x09\x09write: '<li>change the directory to be served with the \x22--base-path\x22 option.</li>';\x0a\x09\x09write: '</ul></p></body></html>';\x0a\x09\x09end",
  78065. referencedClasses: [],
  78066. //>>excludeEnd("ide");
  78067. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  78068. }),
  78069. globals.FileServer);
  78070. smalltalk.addMethod(
  78071. smalltalk.method({
  78072. selector: "respondOKTo:",
  78073. protocol: 'request handling',
  78074. fn: function (aResponse){
  78075. var self=this;
  78076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78077. return smalltalk.withContext(function($ctx1) {
  78078. //>>excludeEnd("ctx");
  78079. var $1;
  78080. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  78081. $1=_st(aResponse)._end();
  78082. return self;
  78083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78084. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},globals.FileServer)});
  78085. //>>excludeEnd("ctx");
  78086. },
  78087. //>>excludeStart("ide", pragmas.excludeIdeData);
  78088. args: ["aResponse"],
  78089. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  78090. referencedClasses: [],
  78091. //>>excludeEnd("ide");
  78092. messageSends: ["writeHead:options:", "end"]
  78093. }),
  78094. globals.FileServer);
  78095. smalltalk.addMethod(
  78096. smalltalk.method({
  78097. selector: "respondRedirect:to:",
  78098. protocol: 'request handling',
  78099. fn: function (aString,aResponse){
  78100. var self=this;
  78101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78102. return smalltalk.withContext(function($ctx1) {
  78103. //>>excludeEnd("ctx");
  78104. var $1;
  78105. _st(aResponse)._writeHead_options_((303),globals.HashedCollection._newFromPairs_(["Location",aString]));
  78106. $1=_st(aResponse)._end();
  78107. return self;
  78108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78109. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},globals.FileServer)});
  78110. //>>excludeEnd("ctx");
  78111. },
  78112. //>>excludeStart("ide", pragmas.excludeIdeData);
  78113. args: ["aString", "aResponse"],
  78114. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  78115. referencedClasses: [],
  78116. //>>excludeEnd("ide");
  78117. messageSends: ["writeHead:options:", "end"]
  78118. }),
  78119. globals.FileServer);
  78120. smalltalk.addMethod(
  78121. smalltalk.method({
  78122. selector: "start",
  78123. protocol: 'starting',
  78124. fn: function (){
  78125. var self=this;
  78126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78127. return smalltalk.withContext(function($ctx1) {
  78128. //>>excludeEnd("ctx");
  78129. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
  78130. self._checkDirectoryLayout();
  78131. $1=_st(self["@http"])._createServer_((function(request,response){
  78132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78133. return smalltalk.withContext(function($ctx2) {
  78134. //>>excludeEnd("ctx");
  78135. return self._handleRequest_respondTo_(request,response);
  78136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78137. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  78138. //>>excludeEnd("ctx");
  78139. }));
  78140. _st($1)._on_do_("error",(function(error){
  78141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78142. return smalltalk.withContext(function($ctx2) {
  78143. //>>excludeEnd("ctx");
  78144. $2=console;
  78145. $3="Error starting server: ".__comma(error);
  78146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78147. $ctx2.sendIdx[","]=1;
  78148. //>>excludeEnd("ctx");
  78149. return _st($2)._log_($3);
  78150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78151. $ctx2.sendIdx["log:"]=1;
  78152. //>>excludeEnd("ctx");
  78153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78154. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  78155. //>>excludeEnd("ctx");
  78156. }));
  78157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78158. $ctx1.sendIdx["on:do:"]=1;
  78159. //>>excludeEnd("ctx");
  78160. _st($1)._on_do_("listening",(function(){
  78161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78162. return smalltalk.withContext(function($ctx2) {
  78163. //>>excludeEnd("ctx");
  78164. $4=console;
  78165. $8=self._host();
  78166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78167. $ctx2.sendIdx["host"]=1;
  78168. //>>excludeEnd("ctx");
  78169. $7="Starting file server on http://".__comma($8);
  78170. $6=_st($7).__comma(":");
  78171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78172. $ctx2.sendIdx[","]=3;
  78173. //>>excludeEnd("ctx");
  78174. $10=self._port();
  78175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78176. $ctx2.sendIdx["port"]=1;
  78177. //>>excludeEnd("ctx");
  78178. $9=_st($10)._asString();
  78179. $5=_st($6).__comma($9);
  78180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78181. $ctx2.sendIdx[","]=2;
  78182. //>>excludeEnd("ctx");
  78183. return _st($4)._log_($5);
  78184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  78186. //>>excludeEnd("ctx");
  78187. }));
  78188. $11=_st($1)._listen_host_(self._port(),self._host());
  78189. return self;
  78190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78191. }, function($ctx1) {$ctx1.fill(self,"start",{},globals.FileServer)});
  78192. //>>excludeEnd("ctx");
  78193. },
  78194. //>>excludeStart("ide", pragmas.excludeIdeData);
  78195. args: [],
  78196. 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 http://', self host, ':', self port asString];\x0a\x09 listen: self port host: self host.",
  78197. referencedClasses: [],
  78198. //>>excludeEnd("ide");
  78199. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  78200. }),
  78201. globals.FileServer);
  78202. smalltalk.addMethod(
  78203. smalltalk.method({
  78204. selector: "startOn:",
  78205. protocol: 'starting',
  78206. fn: function (aPort){
  78207. var self=this;
  78208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78209. return smalltalk.withContext(function($ctx1) {
  78210. //>>excludeEnd("ctx");
  78211. self._port_(aPort);
  78212. self._start();
  78213. return self;
  78214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78215. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},globals.FileServer)});
  78216. //>>excludeEnd("ctx");
  78217. },
  78218. //>>excludeStart("ide", pragmas.excludeIdeData);
  78219. args: ["aPort"],
  78220. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  78221. referencedClasses: [],
  78222. //>>excludeEnd("ide");
  78223. messageSends: ["port:", "start"]
  78224. }),
  78225. globals.FileServer);
  78226. smalltalk.addMethod(
  78227. smalltalk.method({
  78228. selector: "username:",
  78229. protocol: 'accessing',
  78230. fn: function (aUsername){
  78231. var self=this;
  78232. self["@username"]=aUsername;
  78233. return self;
  78234. },
  78235. //>>excludeStart("ide", pragmas.excludeIdeData);
  78236. args: ["aUsername"],
  78237. source: "username: aUsername\x0a\x09username := aUsername.",
  78238. referencedClasses: [],
  78239. //>>excludeEnd("ide");
  78240. messageSends: []
  78241. }),
  78242. globals.FileServer);
  78243. smalltalk.addMethod(
  78244. smalltalk.method({
  78245. selector: "validateBasePath",
  78246. protocol: 'private',
  78247. fn: function (){
  78248. var self=this;
  78249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78250. return smalltalk.withContext(function($ctx1) {
  78251. //>>excludeEnd("ctx");
  78252. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  78253. $1=self["@fs"];
  78254. $2=self._basePath();
  78255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78256. $ctx1.sendIdx["basePath"]=1;
  78257. //>>excludeEnd("ctx");
  78258. _st($1)._stat_then_($2,(function(err,stat){
  78259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78260. return smalltalk.withContext(function($ctx2) {
  78261. //>>excludeEnd("ctx");
  78262. if(($receiver = err) == null || $receiver.isNil){
  78263. $3=_st(stat)._isDirectory();
  78264. if(! smalltalk.assert($3)){
  78265. $4=console;
  78266. $7=self._basePath();
  78267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78268. $ctx2.sendIdx["basePath"]=2;
  78269. //>>excludeEnd("ctx");
  78270. $6="Warning: --base-path parameter ".__comma($7);
  78271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78272. $ctx2.sendIdx[","]=2;
  78273. //>>excludeEnd("ctx");
  78274. $5=_st($6).__comma(" is not a directory.");
  78275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78276. $ctx2.sendIdx[","]=1;
  78277. //>>excludeEnd("ctx");
  78278. return _st($4)._warn_($5);
  78279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78280. $ctx2.sendIdx["warn:"]=1;
  78281. //>>excludeEnd("ctx");
  78282. };
  78283. } else {
  78284. $8=console;
  78285. $9=_st("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  78286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78287. $ctx2.sendIdx[","]=3;
  78288. //>>excludeEnd("ctx");
  78289. return _st($8)._warn_($9);
  78290. };
  78291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78292. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  78293. //>>excludeEnd("ctx");
  78294. }));
  78295. return self;
  78296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78297. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},globals.FileServer)});
  78298. //>>excludeEnd("ctx");
  78299. },
  78300. //>>excludeStart("ide", pragmas.excludeIdeData);
  78301. args: [],
  78302. source: "validateBasePath\x0a\x09\x22The basePath must be an existing directory. \x22\x0a\x09fs stat: self basePath then: [ :err :stat | err\x0a\x09\x09ifNil: [ stat isDirectory ifFalse: [ console warn: 'Warning: --base-path parameter ' , self basePath , ' is not a directory.' ]]\x0a\x09\x09ifNotNil: [ console warn: 'Warning: path at --base-path parameter ' , self basePath , ' does not exist.' ]].",
  78303. referencedClasses: [],
  78304. //>>excludeEnd("ide");
  78305. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  78306. }),
  78307. globals.FileServer);
  78308. smalltalk.addMethod(
  78309. smalltalk.method({
  78310. selector: "withBasePath:",
  78311. protocol: 'private',
  78312. fn: function (aBaseRelativePath){
  78313. var self=this;
  78314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78315. return smalltalk.withContext(function($ctx1) {
  78316. //>>excludeEnd("ctx");
  78317. var $1;
  78318. $1=_st(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  78319. return $1;
  78320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78321. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},globals.FileServer)});
  78322. //>>excludeEnd("ctx");
  78323. },
  78324. //>>excludeStart("ide", pragmas.excludeIdeData);
  78325. args: ["aBaseRelativePath"],
  78326. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  78327. referencedClasses: [],
  78328. //>>excludeEnd("ide");
  78329. messageSends: ["join:with:", "basePath"]
  78330. }),
  78331. globals.FileServer);
  78332. smalltalk.addMethod(
  78333. smalltalk.method({
  78334. selector: "writeData:toFileNamed:",
  78335. protocol: 'private',
  78336. fn: function (data,aFilename){
  78337. var self=this;
  78338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78339. return smalltalk.withContext(function($ctx1) {
  78340. //>>excludeEnd("ctx");
  78341. _st(console)._log_(aFilename);
  78342. return self;
  78343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78344. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},globals.FileServer)});
  78345. //>>excludeEnd("ctx");
  78346. },
  78347. //>>excludeStart("ide", pragmas.excludeIdeData);
  78348. args: ["data", "aFilename"],
  78349. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  78350. referencedClasses: [],
  78351. //>>excludeEnd("ide");
  78352. messageSends: ["log:"]
  78353. }),
  78354. globals.FileServer);
  78355. globals.FileServer.klass.iVarNames = ['mimeTypes'];
  78356. smalltalk.addMethod(
  78357. smalltalk.method({
  78358. selector: "commandLineSwitches",
  78359. protocol: 'accessing',
  78360. fn: function (){
  78361. var self=this;
  78362. var switches;
  78363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78364. return smalltalk.withContext(function($ctx1) {
  78365. //>>excludeEnd("ctx");
  78366. var $1;
  78367. switches=_st(self._methodsInProtocol_("accessing"))._collect_((function(each){
  78368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78369. return smalltalk.withContext(function($ctx2) {
  78370. //>>excludeEnd("ctx");
  78371. return _st(each)._selector();
  78372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  78374. //>>excludeEnd("ctx");
  78375. }));
  78376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78377. $ctx1.sendIdx["collect:"]=1;
  78378. //>>excludeEnd("ctx");
  78379. switches=_st(switches)._select_((function(each){
  78380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78381. return smalltalk.withContext(function($ctx2) {
  78382. //>>excludeEnd("ctx");
  78383. return _st(each)._match_("^[^:]*:$");
  78384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78385. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  78386. //>>excludeEnd("ctx");
  78387. }));
  78388. switches=_st(switches)._collect_((function(each){
  78389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78390. return smalltalk.withContext(function($ctx2) {
  78391. //>>excludeEnd("ctx");
  78392. return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  78393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78394. $ctx2.sendIdx["replace:with:"]=1;
  78395. //>>excludeEnd("ctx");
  78396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78397. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  78398. //>>excludeEnd("ctx");
  78399. }));
  78400. $1=switches;
  78401. return $1;
  78402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78403. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},globals.FileServer.klass)});
  78404. //>>excludeEnd("ctx");
  78405. },
  78406. //>>excludeStart("ide", pragmas.excludeIdeData);
  78407. args: [],
  78408. 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",
  78409. referencedClasses: [],
  78410. //>>excludeEnd("ide");
  78411. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  78412. }),
  78413. globals.FileServer.klass);
  78414. smalltalk.addMethod(
  78415. smalltalk.method({
  78416. selector: "createServerWithArguments:",
  78417. protocol: 'initialization',
  78418. fn: function (options){
  78419. var self=this;
  78420. var server,popFront,front,optionName,optionValue,switches;
  78421. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  78422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78423. return smalltalk.withContext(function($ctx1) {
  78424. //>>excludeEnd("ctx");
  78425. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
  78426. var $early={};
  78427. try {
  78428. switches=self._commandLineSwitches();
  78429. server=self._new();
  78430. _st(options)._ifEmpty_((function(){
  78431. $1=server;
  78432. throw $early=[$1];
  78433. }));
  78434. $2=_st(_st(options)._size())._even();
  78435. if(! smalltalk.assert($2)){
  78436. _st(console)._log_("Using default parameters.");
  78437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78438. $ctx1.sendIdx["log:"]=1;
  78439. //>>excludeEnd("ctx");
  78440. $3=console;
  78441. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  78442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78443. $ctx1.sendIdx[","]=1;
  78444. //>>excludeEnd("ctx");
  78445. _st($3)._log_($4);
  78446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78447. $ctx1.sendIdx["log:"]=2;
  78448. //>>excludeEnd("ctx");
  78449. $5=console;
  78450. $6="Use any of the following ones: ".__comma(switches);
  78451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78452. $ctx1.sendIdx[","]=2;
  78453. //>>excludeEnd("ctx");
  78454. _st($5)._log_($6);
  78455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78456. $ctx1.sendIdx["log:"]=3;
  78457. //>>excludeEnd("ctx");
  78458. $7=server;
  78459. return $7;
  78460. };
  78461. popFront=(function(args){
  78462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78463. return smalltalk.withContext(function($ctx2) {
  78464. //>>excludeEnd("ctx");
  78465. front=_st(args)._first();
  78466. front;
  78467. _st(args)._remove_(front);
  78468. return front;
  78469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78470. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  78471. //>>excludeEnd("ctx");
  78472. });
  78473. _st((function(){
  78474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78475. return smalltalk.withContext(function($ctx2) {
  78476. //>>excludeEnd("ctx");
  78477. return _st(options)._notEmpty();
  78478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  78480. //>>excludeEnd("ctx");
  78481. }))._whileTrue_((function(){
  78482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78483. return smalltalk.withContext(function($ctx2) {
  78484. //>>excludeEnd("ctx");
  78485. optionName=_st(popFront)._value_(options);
  78486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78487. $ctx2.sendIdx["value:"]=1;
  78488. //>>excludeEnd("ctx");
  78489. optionName;
  78490. optionValue=_st(popFront)._value_(options);
  78491. optionValue;
  78492. $8=_st(switches)._includes_(optionName);
  78493. if(smalltalk.assert($8)){
  78494. optionName=self._selectorForCommandLineSwitch_(optionName);
  78495. optionName;
  78496. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  78497. } else {
  78498. $9=console;
  78499. $10=_st(optionName).__comma(" is not a valid commandline option");
  78500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78501. $ctx2.sendIdx[","]=3;
  78502. //>>excludeEnd("ctx");
  78503. _st($9)._log_($10);
  78504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78505. $ctx2.sendIdx["log:"]=4;
  78506. //>>excludeEnd("ctx");
  78507. return _st(console)._log_("Use any of the following ones: ".__comma(switches));
  78508. };
  78509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  78511. //>>excludeEnd("ctx");
  78512. }));
  78513. $11=server;
  78514. return $11;
  78515. }
  78516. catch(e) {if(e===$early)return e[0]; throw e}
  78517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78518. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},globals.FileServer.klass)});
  78519. //>>excludeEnd("ctx");
  78520. },
  78521. //>>excludeStart("ide", pragmas.excludeIdeData);
  78522. args: ["options"],
  78523. 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.",
  78524. referencedClasses: ["Array"],
  78525. //>>excludeEnd("ide");
  78526. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  78527. }),
  78528. globals.FileServer.klass);
  78529. smalltalk.addMethod(
  78530. smalltalk.method({
  78531. selector: "defaultBasePath",
  78532. protocol: 'accessing',
  78533. fn: function (){
  78534. var self=this;
  78535. return "./";
  78536. },
  78537. //>>excludeStart("ide", pragmas.excludeIdeData);
  78538. args: [],
  78539. source: "defaultBasePath\x0a\x09^ './'",
  78540. referencedClasses: [],
  78541. //>>excludeEnd("ide");
  78542. messageSends: []
  78543. }),
  78544. globals.FileServer.klass);
  78545. smalltalk.addMethod(
  78546. smalltalk.method({
  78547. selector: "defaultHost",
  78548. protocol: 'accessing',
  78549. fn: function (){
  78550. var self=this;
  78551. return "127.0.0.1";
  78552. },
  78553. //>>excludeStart("ide", pragmas.excludeIdeData);
  78554. args: [],
  78555. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  78556. referencedClasses: [],
  78557. //>>excludeEnd("ide");
  78558. messageSends: []
  78559. }),
  78560. globals.FileServer.klass);
  78561. smalltalk.addMethod(
  78562. smalltalk.method({
  78563. selector: "defaultMimeTypes",
  78564. protocol: 'accessing',
  78565. fn: function (){
  78566. var self=this;
  78567. var $1;
  78568. $1=globals.HashedCollection._newFromPairs_(["%","application/x-trash","323","text/h323","abw","application/x-abiword","ai","application/postscript","aif","audio/x-aiff","aifc","audio/x-aiff","aiff","audio/x-aiff","alc","chemical/x-alchemy","art","image/x-jg","asc","text/plain","asf","video/x-ms-asf","asn","chemical/x-ncbi-asn1-spec","aso","chemical/x-ncbi-asn1-binary","asx","video/x-ms-asf","au","audio/basic","avi","video/x-msvideo","b","chemical/x-molconn-Z","bak","application/x-trash","bat","application/x-msdos-program","bcpio","application/x-bcpio","bib","text/x-bibtex","bin","application/octet-stream","bmp","image/x-ms-bmp","book","application/x-maker","bsd","chemical/x-crossfire","c","text/x-csrc","c++","text/x-c++src","c3d","chemical/x-chem3d","cac","chemical/x-cache","cache","chemical/x-cache","cascii","chemical/x-cactvs-binary","cat","application/vnd.ms-pki.seccat","cbin","chemical/x-cactvs-binary","cc","text/x-c++src","cdf","application/x-cdf","cdr","image/x-coreldraw","cdt","image/x-coreldrawtemplate","cdx","chemical/x-cdx","cdy","application/vnd.cinderella","cef","chemical/x-cxf","cer","chemical/x-cerius","chm","chemical/x-chemdraw","chrt","application/x-kchart","cif","chemical/x-cif","class","application/java-vm","cls","text/x-tex","cmdf","chemical/x-cmdf","cml","chemical/x-cml","cod","application/vnd.rim.cod","com","application/x-msdos-program","cpa","chemical/x-compass","cpio","application/x-cpio","cpp","text/x-c++src","cpt","image/x-corelphotopaint","crl","application/x-pkcs7-crl","crt","application/x-x509-ca-cert","csf","chemical/x-cache-csf","csh","text/x-csh","csm","chemical/x-csml","csml","chemical/x-csml","css","text/css","csv","text/comma-separated-values","ctab","chemical/x-cactvs-binary","ctx","chemical/x-ctx","cu","application/cu-seeme","cub","chemical/x-gaussian-cube","cxf","chemical/x-cxf","cxx","text/x-c++src","dat","chemical/x-mopac-input","dcr","application/x-director","deb","application/x-debian-package","dif","video/dv","diff","text/plain","dir","application/x-director","djv","image/vnd.djvu","djvu","image/vnd.djvu","dl","video/dl","dll","application/x-msdos-program","dmg","application/x-apple-diskimage","dms","application/x-dms","doc","application/msword","dot","application/msword","dv","video/dv","dvi","application/x-dvi","dx","chemical/x-jcamp-dx","dxr","application/x-director","emb","chemical/x-embl-dl-nucleotide","embl","chemical/x-embl-dl-nucleotide","ent","chemical/x-pdb","eps","application/postscript","etx","text/x-setext","exe","application/x-msdos-program","ez","application/andrew-inset","fb","application/x-maker","fbdoc","application/x-maker","fch","chemical/x-gaussian-checkpoint","fchk","chemical/x-gaussian-checkpoint","fig","application/x-xfig","flac","application/x-flac","fli","video/fli","fm","application/x-maker","frame","application/x-maker","frm","application/x-maker","gal","chemical/x-gaussian-log","gam","chemical/x-gamess-input","gamin","chemical/x-gamess-input","gau","chemical/x-gaussian-input","gcd","text/x-pcs-gcd","gcf","application/x-graphing-calculator","gcg","chemical/x-gcg8-sequence","gen","chemical/x-genbank","gf","application/x-tex-gf","gif","image/gif","gjc","chemical/x-gaussian-input","gjf","chemical/x-gaussian-input","gl","video/gl","gnumeric","application/x-gnumeric","gpt","chemical/x-mopac-graph","gsf","application/x-font","gsm","audio/x-gsm","gtar","application/x-gtar","h","text/x-chdr","h++","text/x-c++hdr","hdf","application/x-hdf","hh","text/x-c++hdr","hin","chemical/x-hin","hpp","text/x-c++hdr","hqx","application/mac-binhex40","hs","text/x-haskell","hta","application/hta","htc","text/x-component","htm","text/html","html","text/html","hxx","text/x-c++hdr","ica","application/x-ica","ice","x-conference/x-cooltalk","ico","image/x-icon","ics","text/calendar","icz","text/calendar","ief","image/ief","iges","model/iges","igs","model/iges","iii","application/x-iphone","inp","chemical/x-gamess-input","ins","application/x-internet-signup","iso","application/x-iso9660-image","isp","application/x-internet-signup","ist","chemical/x-isostar","istr","chemical/x-isostar","jad","text/vnd.sun.j2me.app-descriptor","jar","application/java-archive","java","text/x-java","jdx","chemical/x-jcamp-dx","jmz","application/x-jmol","jng","image/x-jng","jnlp","application/x-java-jnlp-file","jpe","image/jpeg","jpeg","image/jpeg","jpg","image/jpeg","js","application/javascript","kar","audio/midi","key","application/pgp-keys","kil","application/x-killustrator","kin","chemical/x-kinemage","kpr","application/x-kpresenter","kpt","application/x-kpresenter","ksp","application/x-kspread","kwd","application/x-kword","kwt","application/x-kword","latex","application/x-latex","lha","application/x-lha","lhs","text/x-literate-haskell","lsf","video/x-la-asf","lsx","video/x-la-asf","ltx","text/x-tex","lzh","application/x-lzh","lzx","application/x-lzx","m3u","audio/x-mpegurl","m4a","audio/mpeg","maker","application/x-maker","man","application/x-troff-man","mcif","chemical/x-mmcif","mcm","chemical/x-macmolecule","mdb","application/msaccess","me","application/x-troff-me","mesh","model/mesh","mid","audio/midi","midi","audio/midi","mif","application/x-mif","mm","application/x-freemind","mmd","chemical/x-macromodel-input","mmf","application/vnd.smaf","mml","text/mathml","mmod","chemical/x-macromodel-input","mng","video/x-mng","moc","text/x-moc","mol","chemical/x-mdl-molfile","mol2","chemical/x-mol2","moo","chemical/x-mopac-out","mop","chemical/x-mopac-input","mopcrt","chemical/x-mopac-input","mov","video/quicktime","movie","video/x-sgi-movie","mp2","audio/mpeg","mp3","audio/mpeg","mp4","video/mp4","mpc","chemical/x-mopac-input","mpe","video/mpeg","mpeg","video/mpeg","mpega","audio/mpeg","mpg","video/mpeg","mpga","audio/mpeg","ms","application/x-troff-ms","msh","model/mesh","msi","application/x-msi","mvb","chemical/x-mopac-vib","mxu","video/vnd.mpegurl","nb","application/mathematica","nc","application/x-netcdf","nwc","application/x-nwc","o","application/x-object","oda","application/oda","odb","application/vnd.oasis.opendocument.database","odc","application/vnd.oasis.opendocument.chart","odf","application/vnd.oasis.opendocument.formula","odg","application/vnd.oasis.opendocument.graphics","odi","application/vnd.oasis.opendocument.image","odm","application/vnd.oasis.opendocument.text-master","odp","application/vnd.oasis.opendocument.presentation","ods","application/vnd.oasis.opendocument.spreadsheet","odt","application/vnd.oasis.opendocument.text","ogg","application/ogg","old","application/x-trash","oth","application/vnd.oasis.opendocument.text-web","oza","application/x-oz-application","p","text/x-pascal","p7r","application/x-pkcs7-certreqresp","pac","application/x-ns-proxy-autoconfig","pas","text/x-pascal","pat","image/x-coreldrawpattern","pbm","image/x-portable-bitmap","pcf","application/x-font","pcf.Z","application/x-font","pcx","image/pcx","pdb","chemical/x-pdb","pdf","application/pdf","pfa","application/x-font","pfb","application/x-font","pgm","image/x-portable-graymap","pgn","application/x-chess-pgn","pgp","application/pgp-signature","pk","application/x-tex-pk","pl","text/x-perl","pls","audio/x-scpls","pm","text/x-perl","png","image/png","pnm","image/x-portable-anymap","pot","text/plain","ppm","image/x-portable-pixmap","pps","application/vnd.ms-powerpoint","ppt","application/vnd.ms-powerpoint","prf","application/pics-rules","prt","chemical/x-ncbi-asn1-ascii","ps","application/postscript","psd","image/x-photoshop","psp","text/x-psp","py","text/x-python","pyc","application/x-python-code","pyo","application/x-python-code","qt","video/quicktime","qtl","application/x-quicktimeplayer","ra","audio/x-realaudio","ram","audio/x-pn-realaudio","rar","application/rar","ras","image/x-cmu-raster","rd","chemical/x-mdl-rdfile","rdf","application/rdf+xml","rgb","image/x-rgb","rm","audio/x-pn-realaudio","roff","application/x-troff","ros","chemical/x-rosdal","rpm","application/x-redhat-package-manager","rss","application/rss+xml","rtf","text/rtf","rtx","text/richtext","rxn","chemical/x-mdl-rxnfile","sct","text/scriptlet","sd","chemical/x-mdl-sdfile","sd2","audio/x-sd2","sda","application/vnd.stardivision.draw","sdc","application/vnd.stardivision.calc","sdd","application/vnd.stardivision.impress","sdf","chemical/x-mdl-sdfile","sdp","application/vnd.stardivision.impress","sdw","application/vnd.stardivision.writer","ser","application/java-serialized-object","sgf","application/x-go-sgf","sgl","application/vnd.stardivision.writer-global","sh","text/x-sh","shar","application/x-shar","shtml","text/html","sid","audio/prs.sid","sik","application/x-trash","silo","model/mesh","sis","application/vnd.symbian.install","sit","application/x-stuffit","skd","application/x-koan","skm","application/x-koan","skp","application/x-koan","skt","application/x-koan","smf","application/vnd.stardivision.math","smi","application/smil","smil","application/smil","snd","audio/basic","spc","chemical/x-galactic-spc","spl","application/x-futuresplash","src","application/x-wais-source","stc","application/vnd.sun.xml.calc.template","std","application/vnd.sun.xml.draw.template","sti","application/vnd.sun.xml.impress.template","stl","application/vnd.ms-pki.stl","stw","application/vnd.sun.xml.writer.template","sty","text/x-tex","sv4cpio","application/x-sv4cpio","sv4crc","application/x-sv4crc","svg","image/svg+xml","svgz","image/svg+xml","sw","chemical/x-swissprot","swf","application/x-shockwave-flash","swfl","application/x-shockwave-flash","sxc","application/vnd.sun.xml.calc","sxd","application/vnd.sun.xml.draw","sxg","application/vnd.sun.xml.writer.global","sxi","application/vnd.sun.xml.impress","sxm","application/vnd.sun.xml.math","sxw","application/vnd.sun.xml.writer","t","application/x-troff","tar","application/x-tar","taz","application/x-gtar","tcl","text/x-tcl","tex","text/x-tex","texi","application/x-texinfo","texinfo","application/x-texinfo","text","text/plain","tgf","chemical/x-mdl-tgf","tgz","application/x-gtar","tif","image/tiff","tiff","image/tiff","tk","text/x-tcl","tm","text/texmacs","torrent","application/x-bittorrent","tr","application/x-troff","ts","text/texmacs","tsp","application/dsptype","tsv","text/tab-separated-values","txt","text/plain","udeb","application/x-debian-package","uls","text/iuls","ustar","application/x-ustar","val","chemical/x-ncbi-asn1-binary","vcd","application/x-cdlink","vcf","text/x-vcard","vcs","text/x-vcalendar","vmd","chemical/x-vmd","vms","chemical/x-vamas-iso14976","vor","application/vnd.stardivision.writer","vrm","x-world/x-vrml","vrml","x-world/x-vrml","vsd","application/vnd.visio","wad","application/x-doom","wav","audio/x-wav","wax","audio/x-ms-wax","wbmp","image/vnd.wap.wbmp","wbxml","application/vnd.wap.wbxml","wk","application/x-123","wm","video/x-ms-wm","wma","audio/x-ms-wma","wmd","application/x-ms-wmd","wml","text/vnd.wap.wml","wmlc","application/vnd.wap.wmlc","wmls","text/vnd.wap.wmlscript","wmlsc","application/vnd.wap.wmlscriptc","wmv","video/x-ms-wmv","wmx","video/x-ms-wmx","wmz","application/x-ms-wmz","wp5","application/wordperfect5.1","wpd","application/wordperfect","wrl","x-world/x-vrml","wsc","text/scriptlet","wvx","video/x-ms-wvx","wz","application/x-wingz","xbm","image/x-xbitmap","xcf","application/x-xcf","xht","application/xhtml+xml","xhtml","application/xhtml+xml","xlb","application/vnd.ms-excel","xls","application/vnd.ms-excel","xlt","application/vnd.ms-excel","xml","application/xml","xpi","application/x-xpinstall","xpm","image/x-xpixmap","xsl","application/xml","xtel","chemical/x-xtel","xul","application/vnd.mozilla.xul+xml","xwd","image/x-xwindowdump","xyz","chemical/x-xyz","zip","application/zip","zmt","chemical/x-mopac-input","~","application/x-trash"]);
  78569. return $1;
  78570. },
  78571. //>>excludeStart("ide", pragmas.excludeIdeData);
  78572. args: [],
  78573. 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}",
  78574. referencedClasses: [],
  78575. //>>excludeEnd("ide");
  78576. messageSends: []
  78577. }),
  78578. globals.FileServer.klass);
  78579. smalltalk.addMethod(
  78580. smalltalk.method({
  78581. selector: "defaultPort",
  78582. protocol: 'accessing',
  78583. fn: function (){
  78584. var self=this;
  78585. return (4000);
  78586. },
  78587. //>>excludeStart("ide", pragmas.excludeIdeData);
  78588. args: [],
  78589. source: "defaultPort\x0a\x09^ 4000",
  78590. referencedClasses: [],
  78591. //>>excludeEnd("ide");
  78592. messageSends: []
  78593. }),
  78594. globals.FileServer.klass);
  78595. smalltalk.addMethod(
  78596. smalltalk.method({
  78597. selector: "main",
  78598. protocol: 'initialization',
  78599. fn: function (){
  78600. var self=this;
  78601. var fileServer,args;
  78602. function $FileServer(){return globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  78603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78604. return smalltalk.withContext(function($ctx1) {
  78605. //>>excludeEnd("ctx");
  78606. var $1,$2;
  78607. var $early={};
  78608. try {
  78609. args=_st(process)._argv();
  78610. _st(args)._removeFrom_to_((1),(3));
  78611. _st(args)._detect_ifNone_((function(each){
  78612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78613. return smalltalk.withContext(function($ctx2) {
  78614. //>>excludeEnd("ctx");
  78615. $1=_st(each).__eq("--help");
  78616. if(smalltalk.assert($1)){
  78617. return _st($FileServer())._printHelp();
  78618. };
  78619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78620. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  78621. //>>excludeEnd("ctx");
  78622. }),(function(){
  78623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78624. return smalltalk.withContext(function($ctx2) {
  78625. //>>excludeEnd("ctx");
  78626. fileServer=_st($FileServer())._createServerWithArguments_(args);
  78627. fileServer;
  78628. $2=_st(fileServer)._start();
  78629. throw $early=[$2];
  78630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  78632. //>>excludeEnd("ctx");
  78633. }));
  78634. return self;
  78635. }
  78636. catch(e) {if(e===$early)return e[0]; throw e}
  78637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78638. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},globals.FileServer.klass)});
  78639. //>>excludeEnd("ctx");
  78640. },
  78641. //>>excludeStart("ide", pragmas.excludeIdeData);
  78642. args: [],
  78643. 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]",
  78644. referencedClasses: ["FileServer"],
  78645. //>>excludeEnd("ide");
  78646. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  78647. }),
  78648. globals.FileServer.klass);
  78649. smalltalk.addMethod(
  78650. smalltalk.method({
  78651. selector: "mimeTypeFor:",
  78652. protocol: 'accessing',
  78653. fn: function (aString){
  78654. var self=this;
  78655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78656. return smalltalk.withContext(function($ctx1) {
  78657. //>>excludeEnd("ctx");
  78658. var $1;
  78659. $1=_st(self._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  78660. return "text/plain";
  78661. }));
  78662. return $1;
  78663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78664. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},globals.FileServer.klass)});
  78665. //>>excludeEnd("ctx");
  78666. },
  78667. //>>excludeStart("ide", pragmas.excludeIdeData);
  78668. args: ["aString"],
  78669. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  78670. referencedClasses: [],
  78671. //>>excludeEnd("ide");
  78672. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  78673. }),
  78674. globals.FileServer.klass);
  78675. smalltalk.addMethod(
  78676. smalltalk.method({
  78677. selector: "mimeTypes",
  78678. protocol: 'accessing',
  78679. fn: function (){
  78680. var self=this;
  78681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78682. return smalltalk.withContext(function($ctx1) {
  78683. //>>excludeEnd("ctx");
  78684. var $2,$1,$receiver;
  78685. $2=self["@mimeTypes"];
  78686. if(($receiver = $2) == null || $receiver.isNil){
  78687. self["@mimeTypes"]=self._defaultMimeTypes();
  78688. $1=self["@mimeTypes"];
  78689. } else {
  78690. $1=$2;
  78691. };
  78692. return $1;
  78693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78694. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},globals.FileServer.klass)});
  78695. //>>excludeEnd("ctx");
  78696. },
  78697. //>>excludeStart("ide", pragmas.excludeIdeData);
  78698. args: [],
  78699. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  78700. referencedClasses: [],
  78701. //>>excludeEnd("ide");
  78702. messageSends: ["ifNil:", "defaultMimeTypes"]
  78703. }),
  78704. globals.FileServer.klass);
  78705. smalltalk.addMethod(
  78706. smalltalk.method({
  78707. selector: "printHelp",
  78708. protocol: 'accessing',
  78709. fn: function (){
  78710. var self=this;
  78711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78712. return smalltalk.withContext(function($ctx1) {
  78713. //>>excludeEnd("ctx");
  78714. _st(console)._log_("Available commandline options are:");
  78715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78716. $ctx1.sendIdx["log:"]=1;
  78717. //>>excludeEnd("ctx");
  78718. _st(console)._log_("--help");
  78719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78720. $ctx1.sendIdx["log:"]=2;
  78721. //>>excludeEnd("ctx");
  78722. _st(self._commandLineSwitches())._do_((function(each){
  78723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78724. return smalltalk.withContext(function($ctx2) {
  78725. //>>excludeEnd("ctx");
  78726. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  78727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  78729. //>>excludeEnd("ctx");
  78730. }));
  78731. return self;
  78732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78733. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},globals.FileServer.klass)});
  78734. //>>excludeEnd("ctx");
  78735. },
  78736. //>>excludeStart("ide", pragmas.excludeIdeData);
  78737. args: [],
  78738. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  78739. referencedClasses: [],
  78740. //>>excludeEnd("ide");
  78741. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  78742. }),
  78743. globals.FileServer.klass);
  78744. smalltalk.addMethod(
  78745. smalltalk.method({
  78746. selector: "selectorForCommandLineSwitch:",
  78747. protocol: 'accessing',
  78748. fn: function (aSwitch){
  78749. var self=this;
  78750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78751. return smalltalk.withContext(function($ctx1) {
  78752. //>>excludeEnd("ctx");
  78753. var $2,$1;
  78754. $2=_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  78755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78756. return smalltalk.withContext(function($ctx2) {
  78757. //>>excludeEnd("ctx");
  78758. return _st(_st(each)._second())._asUppercase();
  78759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  78761. //>>excludeEnd("ctx");
  78762. }));
  78763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78764. $ctx1.sendIdx["replace:with:"]=1;
  78765. //>>excludeEnd("ctx");
  78766. $1=_st($2).__comma(":");
  78767. return $1;
  78768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78769. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},globals.FileServer.klass)});
  78770. //>>excludeEnd("ctx");
  78771. },
  78772. //>>excludeStart("ide", pragmas.excludeIdeData);
  78773. args: ["aSwitch"],
  78774. 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 ]), ':'",
  78775. referencedClasses: [],
  78776. //>>excludeEnd("ide");
  78777. messageSends: [",", "replace:with:", "asUppercase", "second"]
  78778. }),
  78779. globals.FileServer.klass);
  78780. smalltalk.addClass('Initer', globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  78781. smalltalk.addMethod(
  78782. smalltalk.method({
  78783. selector: "bowerInstallThenDo:",
  78784. protocol: 'action',
  78785. fn: function (aBlock){
  78786. var self=this;
  78787. var child;
  78788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78789. return smalltalk.withContext(function($ctx1) {
  78790. //>>excludeEnd("ctx");
  78791. var $1,$2,$3;
  78792. $1=self["@childProcess"];
  78793. $2=_st("\x22".__comma(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","bower"))).__comma("\x22 install");
  78794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78795. $ctx1.sendIdx[","]=1;
  78796. //>>excludeEnd("ctx");
  78797. child=_st($1)._exec_thenDo_($2,aBlock);
  78798. $3=_st(child)._stdout();
  78799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78800. $ctx1.sendIdx["stdout"]=1;
  78801. //>>excludeEnd("ctx");
  78802. _st($3)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
  78803. return self;
  78804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78805. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},globals.Initer)});
  78806. //>>excludeEnd("ctx");
  78807. },
  78808. //>>excludeStart("ide", pragmas.excludeIdeData);
  78809. args: ["aBlock"],
  78810. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: '\x22', (path join: nmPath with: '.bin' with: 'bower'), '\x22 install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  78811. referencedClasses: [],
  78812. //>>excludeEnd("ide");
  78813. messageSends: ["exec:thenDo:", ",", "join:with:with:", "pipe:options:", "stdout"]
  78814. }),
  78815. globals.Initer);
  78816. smalltalk.addMethod(
  78817. smalltalk.method({
  78818. selector: "finishMessage",
  78819. protocol: 'action',
  78820. fn: function (){
  78821. var self=this;
  78822. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  78823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78824. return smalltalk.withContext(function($ctx1) {
  78825. //>>excludeEnd("ctx");
  78826. _st(console)._log_([" ", "The project should now be set up.", " ", " ", "To manage project from cli (run tests, recompile),", "the `grunt` command-line tool needs to be installed.", "If not present, it can be installed with:", " (sudo) npm install -g grunt-cli", " ", "To manage project dependencies,", "the `bower` command-line tool needs to be installed.", "If not present, it can be installed with:", " (sudo) npm install -g bower", " "]._join_(_st($String())._lf()));
  78827. _st((function(){
  78828. }))._valueWithTimeout_((600));
  78829. return self;
  78830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78831. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},globals.Initer)});
  78832. //>>excludeEnd("ctx");
  78833. },
  78834. //>>excludeStart("ide", pragmas.excludeIdeData);
  78835. args: [],
  78836. source: "finishMessage\x0a\x09console log: (#(\x0a\x09\x09' '\x0a\x09\x09'The project should now be set up.'\x0a\x09\x09' '\x0a\x09\x09' '\x0a\x09\x09'To manage project from cli (run tests, recompile),'\x0a\x09\x09'the `grunt` command-line tool needs to be installed.'\x0a\x09\x09'If not present, it can be installed with:'\x0a\x09\x09' (sudo) npm install -g grunt-cli'\x0a\x09\x09' '\x0a\x09\x09'To manage project dependencies,'\x0a\x09\x09'the `bower` command-line tool needs to be installed.'\x0a\x09\x09'If not present, it can be installed with:'\x0a\x09\x09' (sudo) npm install -g bower'\x0a\x09\x09' '\x0a\x09) join: String lf).\x0a\x09[] valueWithTimeout: 600",
  78837. referencedClasses: ["String"],
  78838. //>>excludeEnd("ide");
  78839. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  78840. }),
  78841. globals.Initer);
  78842. smalltalk.addMethod(
  78843. smalltalk.method({
  78844. selector: "gruntInitThenDo:",
  78845. protocol: 'action',
  78846. fn: function (aBlock){
  78847. var self=this;
  78848. var child;
  78849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78850. return smalltalk.withContext(function($ctx1) {
  78851. //>>excludeEnd("ctx");
  78852. var $1,$4,$5,$3,$2,$6,$7,$8;
  78853. $1=self["@childProcess"];
  78854. $4=_st("\x22".__comma(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","grunt-init"))).__comma("\x22 \x22");
  78855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78856. $ctx1.sendIdx[","]=3;
  78857. //>>excludeEnd("ctx");
  78858. $5=_st(_st(_st(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  78859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78860. $ctx1.sendIdx["replace:with:"]=1;
  78861. //>>excludeEnd("ctx");
  78862. $3=_st($4).__comma($5);
  78863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78864. $ctx1.sendIdx[","]=2;
  78865. //>>excludeEnd("ctx");
  78866. $2=_st($3).__comma("\x22");
  78867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78868. $ctx1.sendIdx[","]=1;
  78869. //>>excludeEnd("ctx");
  78870. child=_st($1)._exec_thenDo_($2,aBlock);
  78871. $6=_st(child)._stdout();
  78872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78873. $ctx1.sendIdx["stdout"]=1;
  78874. //>>excludeEnd("ctx");
  78875. _st($6)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
  78876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78877. $ctx1.sendIdx["pipe:options:"]=1;
  78878. //>>excludeEnd("ctx");
  78879. $7=_st(process)._stdin();
  78880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78881. $ctx1.sendIdx["stdin"]=1;
  78882. //>>excludeEnd("ctx");
  78883. _st($7)._resume();
  78884. $8=_st(process)._stdin();
  78885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78886. $ctx1.sendIdx["stdin"]=2;
  78887. //>>excludeEnd("ctx");
  78888. _st($8)._pipe_options_(_st(child)._stdin(),globals.HashedCollection._newFromPairs_(["end",false]));
  78889. return self;
  78890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78891. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child},globals.Initer)});
  78892. //>>excludeEnd("ctx");
  78893. },
  78894. //>>excludeStart("ide", pragmas.excludeIdeData);
  78895. args: ["aBlock"],
  78896. source: "gruntInitThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: '\x22', (path join: nmPath with: '.bin' with: 'grunt-init'), '\x22 \x22', (((path join: nmPath with: 'grunt-init-amber') replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'), '\x22'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }.\x0a\x09process stdin resume.\x0a\x09process stdin pipe: child stdin options: #{ 'end' -> false }",
  78897. referencedClasses: [],
  78898. //>>excludeEnd("ide");
  78899. messageSends: ["exec:thenDo:", ",", "join:with:with:", "replace:with:", "join:with:", "pipe:options:", "stdout", "resume", "stdin"]
  78900. }),
  78901. globals.Initer);
  78902. smalltalk.addMethod(
  78903. smalltalk.method({
  78904. selector: "gruntThenDo:",
  78905. protocol: 'action',
  78906. fn: function (aBlock){
  78907. var self=this;
  78908. var child;
  78909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78910. return smalltalk.withContext(function($ctx1) {
  78911. //>>excludeEnd("ctx");
  78912. var $1,$2,$3;
  78913. $1=self["@childProcess"];
  78914. $2=_st("\x22".__comma(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","grunt"))).__comma("\x22");
  78915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78916. $ctx1.sendIdx[","]=1;
  78917. //>>excludeEnd("ctx");
  78918. child=_st($1)._exec_thenDo_($2,aBlock);
  78919. $3=_st(child)._stdout();
  78920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78921. $ctx1.sendIdx["stdout"]=1;
  78922. //>>excludeEnd("ctx");
  78923. _st($3)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
  78924. return self;
  78925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78926. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},globals.Initer)});
  78927. //>>excludeEnd("ctx");
  78928. },
  78929. //>>excludeStart("ide", pragmas.excludeIdeData);
  78930. args: ["aBlock"],
  78931. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: '\x22', (path join: nmPath with: '.bin' with: 'grunt'), '\x22'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  78932. referencedClasses: [],
  78933. //>>excludeEnd("ide");
  78934. messageSends: ["exec:thenDo:", ",", "join:with:with:", "pipe:options:", "stdout"]
  78935. }),
  78936. globals.Initer);
  78937. smalltalk.addMethod(
  78938. smalltalk.method({
  78939. selector: "initialize",
  78940. protocol: 'initialization',
  78941. fn: function (){
  78942. var self=this;
  78943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78944. return smalltalk.withContext(function($ctx1) {
  78945. //>>excludeEnd("ctx");
  78946. (
  78947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78948. $ctx1.supercall = true,
  78949. //>>excludeEnd("ctx");
  78950. globals.Initer.superclass.fn.prototype._initialize.apply(_st(self), []));
  78951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78952. $ctx1.supercall = false;
  78953. //>>excludeEnd("ctx");;
  78954. self["@childProcess"]=_st(require)._value_("child_process");
  78955. self["@nmPath"]=_st(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  78956. return self;
  78957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78958. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Initer)});
  78959. //>>excludeEnd("ctx");
  78960. },
  78961. //>>excludeStart("ide", pragmas.excludeIdeData);
  78962. args: [],
  78963. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  78964. referencedClasses: [],
  78965. //>>excludeEnd("ide");
  78966. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  78967. }),
  78968. globals.Initer);
  78969. smalltalk.addMethod(
  78970. smalltalk.method({
  78971. selector: "npmInstallThenDo:",
  78972. protocol: 'action',
  78973. fn: function (aBlock){
  78974. var self=this;
  78975. var child;
  78976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78977. return smalltalk.withContext(function($ctx1) {
  78978. //>>excludeEnd("ctx");
  78979. var $1;
  78980. child=_st(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  78981. $1=_st(child)._stdout();
  78982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78983. $ctx1.sendIdx["stdout"]=1;
  78984. //>>excludeEnd("ctx");
  78985. _st($1)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
  78986. return self;
  78987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78988. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},globals.Initer)});
  78989. //>>excludeEnd("ctx");
  78990. },
  78991. //>>excludeStart("ide", pragmas.excludeIdeData);
  78992. args: ["aBlock"],
  78993. source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  78994. referencedClasses: [],
  78995. //>>excludeEnd("ide");
  78996. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  78997. }),
  78998. globals.Initer);
  78999. smalltalk.addMethod(
  79000. smalltalk.method({
  79001. selector: "start",
  79002. protocol: 'action',
  79003. fn: function (){
  79004. var self=this;
  79005. function $Configurator(){return globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
  79006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79007. return smalltalk.withContext(function($ctx1) {
  79008. //>>excludeEnd("ctx");
  79009. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$receiver;
  79010. self._gruntInitThenDo_((function(error){
  79011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79012. return smalltalk.withContext(function($ctx2) {
  79013. //>>excludeEnd("ctx");
  79014. if(($receiver = error) == null || $receiver.isNil){
  79015. return self._bowerInstallThenDo_((function(error2){
  79016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79017. return smalltalk.withContext(function($ctx3) {
  79018. //>>excludeEnd("ctx");
  79019. if(($receiver = error2) == null || $receiver.isNil){
  79020. return self._npmInstallThenDo_((function(error3){
  79021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79022. return smalltalk.withContext(function($ctx4) {
  79023. //>>excludeEnd("ctx");
  79024. if(($receiver = error3) == null || $receiver.isNil){
  79025. return self._gruntThenDo_((function(error4){
  79026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79027. return smalltalk.withContext(function($ctx5) {
  79028. //>>excludeEnd("ctx");
  79029. if(($receiver = error4) == null || $receiver.isNil){
  79030. return _st(_st($Configurator())._new())._writeConfigThenDo_((function(error5){
  79031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79032. return smalltalk.withContext(function($ctx6) {
  79033. //>>excludeEnd("ctx");
  79034. if(($receiver = error5) == null || $receiver.isNil){
  79035. self._finishMessage();
  79036. return _st(process)._exit();
  79037. } else {
  79038. $9=console;
  79039. _st($9)._log_("amber config exec error:");
  79040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79041. $ctx6.sendIdx["log:"]=9;
  79042. //>>excludeEnd("ctx");
  79043. $10=_st($9)._log_(error5);
  79044. $10;
  79045. return _st(process)._exit();
  79046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79047. $ctx6.sendIdx["exit"]=5;
  79048. //>>excludeEnd("ctx");
  79049. };
  79050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79051. }, function($ctx6) {$ctx6.fillBlock({error5:error5},$ctx5,13)});
  79052. //>>excludeEnd("ctx");
  79053. }));
  79054. } else {
  79055. $7=console;
  79056. _st($7)._log_("grunt exec error:");
  79057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79058. $ctx5.sendIdx["log:"]=7;
  79059. //>>excludeEnd("ctx");
  79060. $8=_st($7)._log_(error4);
  79061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79062. $ctx5.sendIdx["log:"]=8;
  79063. //>>excludeEnd("ctx");
  79064. $8;
  79065. return _st(process)._exit();
  79066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79067. $ctx5.sendIdx["exit"]=4;
  79068. //>>excludeEnd("ctx");
  79069. };
  79070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79071. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  79072. //>>excludeEnd("ctx");
  79073. }));
  79074. } else {
  79075. $5=console;
  79076. _st($5)._log_("npm install exec error:");
  79077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79078. $ctx4.sendIdx["log:"]=5;
  79079. //>>excludeEnd("ctx");
  79080. $6=_st($5)._log_(error3);
  79081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79082. $ctx4.sendIdx["log:"]=6;
  79083. //>>excludeEnd("ctx");
  79084. $6;
  79085. return _st(process)._exit();
  79086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79087. $ctx4.sendIdx["exit"]=3;
  79088. //>>excludeEnd("ctx");
  79089. };
  79090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79091. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  79092. //>>excludeEnd("ctx");
  79093. }));
  79094. } else {
  79095. $3=console;
  79096. _st($3)._log_("bower install exec error:");
  79097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79098. $ctx3.sendIdx["log:"]=3;
  79099. //>>excludeEnd("ctx");
  79100. $4=_st($3)._log_(error2);
  79101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79102. $ctx3.sendIdx["log:"]=4;
  79103. //>>excludeEnd("ctx");
  79104. $4;
  79105. return _st(process)._exit();
  79106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79107. $ctx3.sendIdx["exit"]=2;
  79108. //>>excludeEnd("ctx");
  79109. };
  79110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79111. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  79112. //>>excludeEnd("ctx");
  79113. }));
  79114. } else {
  79115. $1=console;
  79116. _st($1)._log_("grunt-init exec error:");
  79117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79118. $ctx2.sendIdx["log:"]=1;
  79119. //>>excludeEnd("ctx");
  79120. $2=_st($1)._log_(error);
  79121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79122. $ctx2.sendIdx["log:"]=2;
  79123. //>>excludeEnd("ctx");
  79124. $2;
  79125. return _st(process)._exit();
  79126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79127. $ctx2.sendIdx["exit"]=1;
  79128. //>>excludeEnd("ctx");
  79129. };
  79130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79131. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  79132. //>>excludeEnd("ctx");
  79133. }));
  79134. return self;
  79135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79136. }, function($ctx1) {$ctx1.fill(self,"start",{},globals.Initer)});
  79137. //>>excludeEnd("ctx");
  79138. },
  79139. //>>excludeStart("ide", pragmas.excludeIdeData);
  79140. args: [],
  79141. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09Configurator new writeConfigThenDo: [ :error5 | error5\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'amber config exec error:'; log: error5.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]]]",
  79142. referencedClasses: ["Configurator"],
  79143. //>>excludeEnd("ide");
  79144. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "writeConfigThenDo:", "new", "finishMessage"]
  79145. }),
  79146. globals.Initer);
  79147. smalltalk.addClass('Repl', globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  79148. //>>excludeStart("ide", pragmas.excludeIdeData);
  79149. globals.Repl.comment="I am a class representing a REPL (Read Evaluate Print Loop) and provide a command line interface to Amber Smalltalk.\x0aOn the prompt you can type Amber statements which will be evaluated after pressing <Enter>.\x0aThe evaluation is comparable with executing a 'DoIt' in a workspace.\x0a\x0aMy runtime requirement is a functional Node.js executable with working Readline support.";
  79150. //>>excludeEnd("ide");
  79151. smalltalk.addMethod(
  79152. smalltalk.method({
  79153. selector: "addVariableNamed:to:",
  79154. protocol: 'private',
  79155. fn: function (aString,anObject){
  79156. var self=this;
  79157. var newClass,newObject;
  79158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79159. return smalltalk.withContext(function($ctx1) {
  79160. //>>excludeEnd("ctx");
  79161. var $1;
  79162. newClass=self._subclass_withVariable_(_st(anObject)._class(),aString);
  79163. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  79164. newObject=_st(newClass)._new();
  79165. self._setPreviousVariablesFor_from_(newObject,anObject);
  79166. $1=newObject;
  79167. return $1;
  79168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79169. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},globals.Repl)});
  79170. //>>excludeEnd("ctx");
  79171. },
  79172. //>>excludeStart("ide", pragmas.excludeIdeData);
  79173. args: ["aString", "anObject"],
  79174. source: "addVariableNamed: aString to: anObject\x0a\x09| newClass newObject |\x0a\x09newClass := self subclass: anObject class withVariable: aString.\x0a\x09self encapsulateVariable: aString withValue: anObject in: newClass.\x0a\x09newObject := newClass new.\x0a\x09self setPreviousVariablesFor: newObject from: anObject.\x0a\x09^ newObject",
  79175. referencedClasses: [],
  79176. //>>excludeEnd("ide");
  79177. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  79178. }),
  79179. globals.Repl);
  79180. smalltalk.addMethod(
  79181. smalltalk.method({
  79182. selector: "assignNewVariable:do:",
  79183. protocol: 'private',
  79184. fn: function (buffer,aBlock){
  79185. var self=this;
  79186. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  79187. function $ConsoleErrorHandler(){return globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
  79188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79189. return smalltalk.withContext(function($ctx1) {
  79190. //>>excludeEnd("ctx");
  79191. var $3,$4,$2,$1,$receiver;
  79192. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  79193. var varName,value;
  79194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79195. return smalltalk.withContext(function($ctx2) {
  79196. //>>excludeEnd("ctx");
  79197. if(($receiver = name) == null || $receiver.isNil){
  79198. varName=self._nextResultName();
  79199. } else {
  79200. varName=name;
  79201. };
  79202. varName;
  79203. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  79204. self["@session"];
  79205. _st((function(){
  79206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79207. return smalltalk.withContext(function($ctx3) {
  79208. //>>excludeEnd("ctx");
  79209. $3=_st(varName).__comma(" := ");
  79210. if(($receiver = expr) == null || $receiver.isNil){
  79211. $4=buffer;
  79212. } else {
  79213. $4=expr;
  79214. };
  79215. $2=_st($3).__comma($4);
  79216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79217. $ctx3.sendIdx[","]=1;
  79218. //>>excludeEnd("ctx");
  79219. value=self._eval_on_($2,self["@session"]);
  79220. return value;
  79221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79222. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  79223. //>>excludeEnd("ctx");
  79224. }))._on_do_($Error(),(function(e){
  79225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79226. return smalltalk.withContext(function($ctx3) {
  79227. //>>excludeEnd("ctx");
  79228. _st(_st($ConsoleErrorHandler())._new())._logError_(e);
  79229. value=nil;
  79230. return value;
  79231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79232. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  79233. //>>excludeEnd("ctx");
  79234. }));
  79235. return _st(aBlock)._value_value_(varName,value);
  79236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79237. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  79238. //>>excludeEnd("ctx");
  79239. }));
  79240. return $1;
  79241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79242. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},globals.Repl)});
  79243. //>>excludeEnd("ctx");
  79244. },
  79245. //>>excludeStart("ide", pragmas.excludeIdeData);
  79246. args: ["buffer", "aBlock"],
  79247. source: "assignNewVariable: buffer do: aBlock\x0a\x09\x22Assigns a new variable and calls the given block with the variable's name and value\x0a\x09 if buffer contains an assignment expression. If it doesn't the block is called with nil for\x0a\x09 both arguments.\x22\x0a\x09^ self parseAssignment: buffer do: [ :name :expr || varName value |\x0a\x09\x09varName := name ifNil: [self nextResultName].\x0a\x09\x09session := self addVariableNamed: varName to: session.\x0a\x09\x09[ value := self eval: varName, ' := ', (expr ifNil: [buffer]) on: session ]\x0a\x09\x09\x09on: Error\x0a\x09\x09\x09do: [ :e | ConsoleErrorHandler new logError: e. value := nil].\x0a\x09\x09aBlock value: varName value: value]",
  79248. referencedClasses: ["Error", "ConsoleErrorHandler"],
  79249. //>>excludeEnd("ide");
  79250. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  79251. }),
  79252. globals.Repl);
  79253. smalltalk.addMethod(
  79254. smalltalk.method({
  79255. selector: "clearScreen",
  79256. protocol: 'actions',
  79257. fn: function (){
  79258. var self=this;
  79259. var esc,cls;
  79260. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  79261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79262. return smalltalk.withContext(function($ctx1) {
  79263. //>>excludeEnd("ctx");
  79264. var $1;
  79265. esc=_st($String())._fromCharCode_((27));
  79266. $1=_st(_st(esc).__comma("[2J")).__comma(esc);
  79267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79268. $ctx1.sendIdx[","]=2;
  79269. //>>excludeEnd("ctx");
  79270. cls=_st($1).__comma("[0;0f");
  79271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79272. $ctx1.sendIdx[","]=1;
  79273. //>>excludeEnd("ctx");
  79274. _st(_st(process)._stdout())._write_(cls);
  79275. _st(self["@interface"])._prompt();
  79276. return self;
  79277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79278. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},globals.Repl)});
  79279. //>>excludeEnd("ctx");
  79280. },
  79281. //>>excludeStart("ide", pragmas.excludeIdeData);
  79282. args: [],
  79283. source: "clearScreen\x0a\x09| esc cls |\x0a\x09esc := String fromCharCode: 27.\x0a\x09cls := esc, '[2J', esc, '[0;0f'.\x0a\x09process stdout write: cls.\x0a\x09interface prompt",
  79284. referencedClasses: ["String"],
  79285. //>>excludeEnd("ide");
  79286. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  79287. }),
  79288. globals.Repl);
  79289. smalltalk.addMethod(
  79290. smalltalk.method({
  79291. selector: "close",
  79292. protocol: 'actions',
  79293. fn: function (){
  79294. var self=this;
  79295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79296. return smalltalk.withContext(function($ctx1) {
  79297. //>>excludeEnd("ctx");
  79298. _st(_st(process)._stdin())._destroy();
  79299. return self;
  79300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79301. }, function($ctx1) {$ctx1.fill(self,"close",{},globals.Repl)});
  79302. //>>excludeEnd("ctx");
  79303. },
  79304. //>>excludeStart("ide", pragmas.excludeIdeData);
  79305. args: [],
  79306. source: "close\x0a\x09process stdin destroy",
  79307. referencedClasses: [],
  79308. //>>excludeEnd("ide");
  79309. messageSends: ["destroy", "stdin"]
  79310. }),
  79311. globals.Repl);
  79312. smalltalk.addMethod(
  79313. smalltalk.method({
  79314. selector: "commands",
  79315. protocol: 'accessing',
  79316. fn: function (){
  79317. var self=this;
  79318. var $1;
  79319. $1=self["@commands"];
  79320. return $1;
  79321. },
  79322. //>>excludeStart("ide", pragmas.excludeIdeData);
  79323. args: [],
  79324. source: "commands\x0a\x09^ commands",
  79325. referencedClasses: [],
  79326. //>>excludeEnd("ide");
  79327. messageSends: []
  79328. }),
  79329. globals.Repl);
  79330. smalltalk.addMethod(
  79331. smalltalk.method({
  79332. selector: "createInterface",
  79333. protocol: 'actions',
  79334. fn: function (){
  79335. var self=this;
  79336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79337. return smalltalk.withContext(function($ctx1) {
  79338. //>>excludeEnd("ctx");
  79339. var $1;
  79340. self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
  79341. _st(self["@interface"])._on_do_("line",(function(buffer){
  79342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79343. return smalltalk.withContext(function($ctx2) {
  79344. //>>excludeEnd("ctx");
  79345. return self._processLine_(buffer);
  79346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79347. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  79348. //>>excludeEnd("ctx");
  79349. }));
  79350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79351. $ctx1.sendIdx["on:do:"]=1;
  79352. //>>excludeEnd("ctx");
  79353. _st(self["@interface"])._on_do_("close",(function(){
  79354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79355. return smalltalk.withContext(function($ctx2) {
  79356. //>>excludeEnd("ctx");
  79357. return self._close();
  79358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  79360. //>>excludeEnd("ctx");
  79361. }));
  79362. self._printWelcome();
  79363. self._setupHotkeys();
  79364. $1=self._setPrompt();
  79365. _st(self["@interface"])._prompt();
  79366. return self;
  79367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79368. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},globals.Repl)});
  79369. //>>excludeEnd("ctx");
  79370. },
  79371. //>>excludeStart("ide", pragmas.excludeIdeData);
  79372. args: [],
  79373. source: "createInterface\x0a\x09interface := readline createInterface: process stdin stdout: process stdout.\x0a\x09interface on: 'line' do: [:buffer | self processLine: buffer].\x0a\x09interface on: 'close' do: [self close].\x0a\x09self printWelcome; setupHotkeys; setPrompt.\x0a\x09interface prompt",
  79374. referencedClasses: [],
  79375. //>>excludeEnd("ide");
  79376. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  79377. }),
  79378. globals.Repl);
  79379. smalltalk.addMethod(
  79380. smalltalk.method({
  79381. selector: "encapsulateVariable:withValue:in:",
  79382. protocol: 'private',
  79383. fn: function (aString,anObject,aClass){
  79384. var self=this;
  79385. var compiler;
  79386. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  79387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79388. return smalltalk.withContext(function($ctx1) {
  79389. //>>excludeEnd("ctx");
  79390. var $1,$4,$3,$2,$5,$6;
  79391. compiler=_st($Compiler())._new();
  79392. $1=compiler;
  79393. $4=_st(aString).__comma(": anObject ^ ");
  79394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79395. $ctx1.sendIdx[","]=3;
  79396. //>>excludeEnd("ctx");
  79397. $3=_st($4).__comma(aString);
  79398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79399. $ctx1.sendIdx[","]=2;
  79400. //>>excludeEnd("ctx");
  79401. $2=_st($3).__comma(" := anObject");
  79402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79403. $ctx1.sendIdx[","]=1;
  79404. //>>excludeEnd("ctx");
  79405. _st($1)._install_forClass_protocol_($2,aClass,"session");
  79406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79407. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  79408. //>>excludeEnd("ctx");
  79409. $5=compiler;
  79410. $6=_st(_st(aString).__comma(" ^ ")).__comma(aString);
  79411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79412. $ctx1.sendIdx[","]=4;
  79413. //>>excludeEnd("ctx");
  79414. _st($5)._install_forClass_protocol_($6,aClass,"session");
  79415. return self;
  79416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79417. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},globals.Repl)});
  79418. //>>excludeEnd("ctx");
  79419. },
  79420. //>>excludeStart("ide", pragmas.excludeIdeData);
  79421. args: ["aString", "anObject", "aClass"],
  79422. source: "encapsulateVariable: aString withValue: anObject in: aClass\x0a\x09\x22Add getter and setter for given variable to session.\x22\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09compiler install: aString, ': anObject ^ ', aString, ' := anObject' forClass: aClass protocol: 'session'.\x0a\x09compiler install: aString, ' ^ ', aString forClass: aClass protocol: 'session'.",
  79423. referencedClasses: ["Compiler"],
  79424. //>>excludeEnd("ide");
  79425. messageSends: ["new", "install:forClass:protocol:", ","]
  79426. }),
  79427. globals.Repl);
  79428. smalltalk.addMethod(
  79429. smalltalk.method({
  79430. selector: "eval:",
  79431. protocol: 'actions',
  79432. fn: function (buffer){
  79433. var self=this;
  79434. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  79435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79436. return smalltalk.withContext(function($ctx1) {
  79437. //>>excludeEnd("ctx");
  79438. var $1;
  79439. $1=self._eval_on_(buffer,_st($DoIt())._new());
  79440. return $1;
  79441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79442. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},globals.Repl)});
  79443. //>>excludeEnd("ctx");
  79444. },
  79445. //>>excludeStart("ide", pragmas.excludeIdeData);
  79446. args: ["buffer"],
  79447. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  79448. referencedClasses: ["DoIt"],
  79449. //>>excludeEnd("ide");
  79450. messageSends: ["eval:on:", "new"]
  79451. }),
  79452. globals.Repl);
  79453. smalltalk.addMethod(
  79454. smalltalk.method({
  79455. selector: "eval:on:",
  79456. protocol: 'actions',
  79457. fn: function (buffer,anObject){
  79458. var self=this;
  79459. var result;
  79460. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  79461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79462. return smalltalk.withContext(function($ctx1) {
  79463. //>>excludeEnd("ctx");
  79464. var $1,$2,$3;
  79465. $1=_st(buffer)._isEmpty();
  79466. if(! smalltalk.assert($1)){
  79467. _st((function(){
  79468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79469. return smalltalk.withContext(function($ctx2) {
  79470. //>>excludeEnd("ctx");
  79471. result=_st(_st($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  79472. return result;
  79473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  79475. //>>excludeEnd("ctx");
  79476. }))._tryCatch_((function(e){
  79477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79478. return smalltalk.withContext(function($ctx2) {
  79479. //>>excludeEnd("ctx");
  79480. $2=_st(e)._isSmalltalkError();
  79481. if(smalltalk.assert($2)){
  79482. return _st(e)._resignal();
  79483. } else {
  79484. return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
  79485. };
  79486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79487. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  79488. //>>excludeEnd("ctx");
  79489. }));
  79490. };
  79491. $3=result;
  79492. return $3;
  79493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79494. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},globals.Repl)});
  79495. //>>excludeEnd("ctx");
  79496. },
  79497. //>>excludeStart("ide", pragmas.excludeIdeData);
  79498. args: ["buffer", "anObject"],
  79499. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09 ifTrue: [ e resignal ]\x0a\x09\x09\x09 \x09 ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  79500. referencedClasses: ["Compiler"],
  79501. //>>excludeEnd("ide");
  79502. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  79503. }),
  79504. globals.Repl);
  79505. smalltalk.addMethod(
  79506. smalltalk.method({
  79507. selector: "executeCommand:",
  79508. protocol: 'private',
  79509. fn: function (aString){
  79510. var self=this;
  79511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79512. return smalltalk.withContext(function($ctx1) {
  79513. //>>excludeEnd("ctx");
  79514. var $1;
  79515. var $early={};
  79516. try {
  79517. _st(self._commands())._keysAndValuesDo_((function(names,cmd){
  79518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79519. return smalltalk.withContext(function($ctx2) {
  79520. //>>excludeEnd("ctx");
  79521. $1=_st(names)._includes_(aString);
  79522. if(smalltalk.assert($1)){
  79523. _st(cmd)._value();
  79524. throw $early=[true];
  79525. };
  79526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79527. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  79528. //>>excludeEnd("ctx");
  79529. }));
  79530. return false;
  79531. }
  79532. catch(e) {if(e===$early)return e[0]; throw e}
  79533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79534. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},globals.Repl)});
  79535. //>>excludeEnd("ctx");
  79536. },
  79537. //>>excludeStart("ide", pragmas.excludeIdeData);
  79538. args: ["aString"],
  79539. source: "executeCommand: aString\x0a\x09\x22Tries to process the given string as a command. Returns true if it was a command, false if not.\x22\x0a\x09self commands keysAndValuesDo: [:names :cmd |\x0a\x09\x09(names includes: aString) ifTrue: [\x0a\x09\x09\x09cmd value.\x0a\x09\x09\x09^ true]].\x0a\x09^ false",
  79540. referencedClasses: [],
  79541. //>>excludeEnd("ide");
  79542. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  79543. }),
  79544. globals.Repl);
  79545. smalltalk.addMethod(
  79546. smalltalk.method({
  79547. selector: "initialize",
  79548. protocol: 'initialization',
  79549. fn: function (){
  79550. var self=this;
  79551. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  79552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79553. return smalltalk.withContext(function($ctx1) {
  79554. //>>excludeEnd("ctx");
  79555. (
  79556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79557. $ctx1.supercall = true,
  79558. //>>excludeEnd("ctx");
  79559. globals.Repl.superclass.fn.prototype._initialize.apply(_st(self), []));
  79560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79561. $ctx1.supercall = false;
  79562. //>>excludeEnd("ctx");;
  79563. self["@session"]=_st($DoIt())._new();
  79564. self["@readline"]=_st(require)._value_("readline");
  79565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79566. $ctx1.sendIdx["value:"]=1;
  79567. //>>excludeEnd("ctx");
  79568. self["@util"]=_st(require)._value_("util");
  79569. self._setupCommands();
  79570. return self;
  79571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79572. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Repl)});
  79573. //>>excludeEnd("ctx");
  79574. },
  79575. //>>excludeStart("ide", pragmas.excludeIdeData);
  79576. args: [],
  79577. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  79578. referencedClasses: ["DoIt"],
  79579. //>>excludeEnd("ide");
  79580. messageSends: ["initialize", "new", "value:", "setupCommands"]
  79581. }),
  79582. globals.Repl);
  79583. smalltalk.addMethod(
  79584. smalltalk.method({
  79585. selector: "instanceVariableNamesFor:",
  79586. protocol: 'private',
  79587. fn: function (aClass){
  79588. var self=this;
  79589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79590. return smalltalk.withContext(function($ctx1) {
  79591. //>>excludeEnd("ctx");
  79592. var $2,$3,$1,$receiver;
  79593. $2=_st(aClass)._superclass();
  79594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79595. $ctx1.sendIdx["superclass"]=1;
  79596. //>>excludeEnd("ctx");
  79597. if(($receiver = $2) == null || $receiver.isNil){
  79598. $1=_st(aClass)._instanceVariableNames();
  79599. } else {
  79600. $3=_st(aClass)._instanceVariableNames();
  79601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79602. $ctx1.sendIdx["instanceVariableNames"]=1;
  79603. //>>excludeEnd("ctx");
  79604. $1=_st($3)._copyWithAll_(self._instanceVariableNamesFor_(_st(aClass)._superclass()));
  79605. };
  79606. return $1;
  79607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79608. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},globals.Repl)});
  79609. //>>excludeEnd("ctx");
  79610. },
  79611. //>>excludeStart("ide", pragmas.excludeIdeData);
  79612. args: ["aClass"],
  79613. source: "instanceVariableNamesFor: aClass\x0a\x09\x22Yields all instance variable names for the given class, including inherited ones.\x22\x0a\x09^ aClass superclass\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09aClass instanceVariableNames copyWithAll: (self instanceVariableNamesFor: aClass superclass)]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass instanceVariableNames]",
  79614. referencedClasses: [],
  79615. //>>excludeEnd("ide");
  79616. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  79617. }),
  79618. globals.Repl);
  79619. smalltalk.addMethod(
  79620. smalltalk.method({
  79621. selector: "isIdentifier:",
  79622. protocol: 'private',
  79623. fn: function (aString){
  79624. var self=this;
  79625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79626. return smalltalk.withContext(function($ctx1) {
  79627. //>>excludeEnd("ctx");
  79628. var $1;
  79629. $1=_st(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  79630. return $1;
  79631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79632. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},globals.Repl)});
  79633. //>>excludeEnd("ctx");
  79634. },
  79635. //>>excludeStart("ide", pragmas.excludeIdeData);
  79636. args: ["aString"],
  79637. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  79638. referencedClasses: [],
  79639. //>>excludeEnd("ide");
  79640. messageSends: ["match:", "asRegexp"]
  79641. }),
  79642. globals.Repl);
  79643. smalltalk.addMethod(
  79644. smalltalk.method({
  79645. selector: "isVariableDefined:",
  79646. protocol: 'private',
  79647. fn: function (aString){
  79648. var self=this;
  79649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79650. return smalltalk.withContext(function($ctx1) {
  79651. //>>excludeEnd("ctx");
  79652. var $1;
  79653. $1=_st(self._instanceVariableNamesFor_(_st(self["@session"])._class()))._includes_(aString);
  79654. return $1;
  79655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79656. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},globals.Repl)});
  79657. //>>excludeEnd("ctx");
  79658. },
  79659. //>>excludeStart("ide", pragmas.excludeIdeData);
  79660. args: ["aString"],
  79661. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  79662. referencedClasses: [],
  79663. //>>excludeEnd("ide");
  79664. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  79665. }),
  79666. globals.Repl);
  79667. smalltalk.addMethod(
  79668. smalltalk.method({
  79669. selector: "nextResultName",
  79670. protocol: 'private',
  79671. fn: function (){
  79672. var self=this;
  79673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79674. return smalltalk.withContext(function($ctx1) {
  79675. //>>excludeEnd("ctx");
  79676. var $1,$2,$receiver;
  79677. $1=self["@resultCount"];
  79678. if(($receiver = $1) == null || $receiver.isNil){
  79679. self["@resultCount"]=(1);
  79680. } else {
  79681. self["@resultCount"]=_st(self["@resultCount"]).__plus((1));
  79682. };
  79683. $2="res".__comma(_st(self["@resultCount"])._asString());
  79684. return $2;
  79685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79686. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},globals.Repl)});
  79687. //>>excludeEnd("ctx");
  79688. },
  79689. //>>excludeStart("ide", pragmas.excludeIdeData);
  79690. args: [],
  79691. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  79692. referencedClasses: [],
  79693. //>>excludeEnd("ide");
  79694. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  79695. }),
  79696. globals.Repl);
  79697. smalltalk.addMethod(
  79698. smalltalk.method({
  79699. selector: "onKeyPress:",
  79700. protocol: 'private',
  79701. fn: function (key){
  79702. var self=this;
  79703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79704. return smalltalk.withContext(function($ctx1) {
  79705. //>>excludeEnd("ctx");
  79706. var $1;
  79707. $1=_st(_st(key)._ctrl())._and_((function(){
  79708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79709. return smalltalk.withContext(function($ctx2) {
  79710. //>>excludeEnd("ctx");
  79711. return _st(_st(key)._name()).__eq("l");
  79712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  79714. //>>excludeEnd("ctx");
  79715. }));
  79716. if(smalltalk.assert($1)){
  79717. self._clearScreen();
  79718. };
  79719. return self;
  79720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79721. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},globals.Repl)});
  79722. //>>excludeEnd("ctx");
  79723. },
  79724. //>>excludeStart("ide", pragmas.excludeIdeData);
  79725. args: ["key"],
  79726. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  79727. referencedClasses: [],
  79728. //>>excludeEnd("ide");
  79729. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  79730. }),
  79731. globals.Repl);
  79732. smalltalk.addMethod(
  79733. smalltalk.method({
  79734. selector: "parseAssignment:do:",
  79735. protocol: 'private',
  79736. fn: function (aString,aBlock){
  79737. var self=this;
  79738. var assignment;
  79739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79740. return smalltalk.withContext(function($ctx1) {
  79741. //>>excludeEnd("ctx");
  79742. var $3,$2,$1;
  79743. assignment=_st(_st(aString)._tokenize_(":="))._collect_((function(s){
  79744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79745. return smalltalk.withContext(function($ctx2) {
  79746. //>>excludeEnd("ctx");
  79747. return _st(s)._trimBoth();
  79748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79749. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  79750. //>>excludeEnd("ctx");
  79751. }));
  79752. $2=_st(_st(_st(assignment)._size()).__eq((2)))._and_((function(){
  79753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79754. return smalltalk.withContext(function($ctx2) {
  79755. //>>excludeEnd("ctx");
  79756. $3=_st(assignment)._first();
  79757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79758. $ctx2.sendIdx["first"]=1;
  79759. //>>excludeEnd("ctx");
  79760. return self._isIdentifier_($3);
  79761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  79763. //>>excludeEnd("ctx");
  79764. }));
  79765. if(smalltalk.assert($2)){
  79766. $1=_st(aBlock)._value_value_(_st(assignment)._first(),_st(assignment)._last());
  79767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79768. $ctx1.sendIdx["value:value:"]=1;
  79769. //>>excludeEnd("ctx");
  79770. } else {
  79771. $1=_st(aBlock)._value_value_(nil,nil);
  79772. };
  79773. return $1;
  79774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79775. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},globals.Repl)});
  79776. //>>excludeEnd("ctx");
  79777. },
  79778. //>>excludeStart("ide", pragmas.excludeIdeData);
  79779. args: ["aString", "aBlock"],
  79780. source: "parseAssignment: aString do: aBlock\x0a\x09\x22Assigns a new variable if the given string is an assignment expression. Calls the given block with name and value.\x0a\x09 If the string is not one no variable will be assigned and the block will be called with nil for both arguments.\x22\x0a\x09| assignment |\x0a\x09assignment := (aString tokenize: ':=') collect: [:s | s trimBoth].\x0a\x09^ (assignment size = 2 and: [self isIdentifier: assignment first])\x0a\x09\x09ifTrue: [ aBlock value: assignment first value: assignment last ]\x0a\x09\x09ifFalse: [ aBlock value: nil value: nil ]",
  79781. referencedClasses: [],
  79782. //>>excludeEnd("ide");
  79783. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  79784. }),
  79785. globals.Repl);
  79786. smalltalk.addMethod(
  79787. smalltalk.method({
  79788. selector: "presentResultNamed:withValue:",
  79789. protocol: 'private',
  79790. fn: function (varName,value){
  79791. var self=this;
  79792. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  79793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79794. return smalltalk.withContext(function($ctx1) {
  79795. //>>excludeEnd("ctx");
  79796. var $3,$2,$1,$4;
  79797. $3=_st(_st(varName).__comma(": ")).__comma(_st(_st(value)._class())._name());
  79798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79799. $ctx1.sendIdx[","]=3;
  79800. //>>excludeEnd("ctx");
  79801. $2=_st($3).__comma(" = ");
  79802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79803. $ctx1.sendIdx[","]=2;
  79804. //>>excludeEnd("ctx");
  79805. $1=_st($2).__comma(_st(value)._asString());
  79806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79807. $ctx1.sendIdx[","]=1;
  79808. //>>excludeEnd("ctx");
  79809. _st($Transcript())._show_($1);
  79810. $4=_st($Transcript())._cr();
  79811. _st(self["@interface"])._prompt();
  79812. return self;
  79813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79814. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},globals.Repl)});
  79815. //>>excludeEnd("ctx");
  79816. },
  79817. //>>excludeStart("ide", pragmas.excludeIdeData);
  79818. args: ["varName", "value"],
  79819. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  79820. referencedClasses: ["Transcript"],
  79821. //>>excludeEnd("ide");
  79822. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  79823. }),
  79824. globals.Repl);
  79825. smalltalk.addMethod(
  79826. smalltalk.method({
  79827. selector: "printWelcome",
  79828. protocol: 'actions',
  79829. fn: function (){
  79830. var self=this;
  79831. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  79832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79833. return smalltalk.withContext(function($ctx1) {
  79834. //>>excludeEnd("ctx");
  79835. var $1;
  79836. _st($Transcript())._show_("Type :q to exit.");
  79837. $1=_st($Transcript())._cr();
  79838. return self;
  79839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79840. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},globals.Repl)});
  79841. //>>excludeEnd("ctx");
  79842. },
  79843. //>>excludeStart("ide", pragmas.excludeIdeData);
  79844. args: [],
  79845. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  79846. referencedClasses: ["Transcript"],
  79847. //>>excludeEnd("ide");
  79848. messageSends: ["show:", "cr"]
  79849. }),
  79850. globals.Repl);
  79851. smalltalk.addMethod(
  79852. smalltalk.method({
  79853. selector: "processLine:",
  79854. protocol: 'private',
  79855. fn: function (buffer){
  79856. var self=this;
  79857. var show;
  79858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79859. return smalltalk.withContext(function($ctx1) {
  79860. //>>excludeEnd("ctx");
  79861. var $1,$2;
  79862. show=(function(varName,value){
  79863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79864. return smalltalk.withContext(function($ctx2) {
  79865. //>>excludeEnd("ctx");
  79866. return self._presentResultNamed_withValue_(varName,value);
  79867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79868. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  79869. //>>excludeEnd("ctx");
  79870. });
  79871. $1=self._executeCommand_(buffer);
  79872. if(! smalltalk.assert($1)){
  79873. $2=self._isVariableDefined_(buffer);
  79874. if(smalltalk.assert($2)){
  79875. _st(show)._value_value_(buffer,_st(self["@session"])._perform_(buffer));
  79876. } else {
  79877. self._assignNewVariable_do_(buffer,show);
  79878. };
  79879. };
  79880. return self;
  79881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79882. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},globals.Repl)});
  79883. //>>excludeEnd("ctx");
  79884. },
  79885. //>>excludeStart("ide", pragmas.excludeIdeData);
  79886. args: ["buffer"],
  79887. source: "processLine: buffer\x0a\x09\x22Processes lines entered through the readline interface.\x22\x0a\x09| show |\x0a\x09show := [:varName :value | self presentResultNamed: varName withValue: value].\x0a\x09(self executeCommand: buffer) ifFalse: [\x0a\x09\x09(self isVariableDefined: buffer)\x0a\x09\x09\x09ifTrue: [show value: buffer value: (session perform: buffer)]\x0a\x09\x09\x09ifFalse: [self assignNewVariable: buffer do: show]]",
  79888. referencedClasses: [],
  79889. //>>excludeEnd("ide");
  79890. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  79891. }),
  79892. globals.Repl);
  79893. smalltalk.addMethod(
  79894. smalltalk.method({
  79895. selector: "prompt",
  79896. protocol: 'accessing',
  79897. fn: function (){
  79898. var self=this;
  79899. return "amber >> ";
  79900. },
  79901. //>>excludeStart("ide", pragmas.excludeIdeData);
  79902. args: [],
  79903. source: "prompt\x0a\x09^ 'amber >> '",
  79904. referencedClasses: [],
  79905. //>>excludeEnd("ide");
  79906. messageSends: []
  79907. }),
  79908. globals.Repl);
  79909. smalltalk.addMethod(
  79910. smalltalk.method({
  79911. selector: "setPreviousVariablesFor:from:",
  79912. protocol: 'private',
  79913. fn: function (newObject,oldObject){
  79914. var self=this;
  79915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79916. return smalltalk.withContext(function($ctx1) {
  79917. //>>excludeEnd("ctx");
  79918. _st(self._instanceVariableNamesFor_(_st(oldObject)._class()))._do_((function(each){
  79919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79920. return smalltalk.withContext(function($ctx2) {
  79921. //>>excludeEnd("ctx");
  79922. return _st(newObject)._perform_withArguments_(_st(each).__comma(":"),[_st(oldObject)._perform_(each)]);
  79923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  79925. //>>excludeEnd("ctx");
  79926. }));
  79927. return self;
  79928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79929. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},globals.Repl)});
  79930. //>>excludeEnd("ctx");
  79931. },
  79932. //>>excludeStart("ide", pragmas.excludeIdeData);
  79933. args: ["newObject", "oldObject"],
  79934. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  79935. referencedClasses: [],
  79936. //>>excludeEnd("ide");
  79937. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  79938. }),
  79939. globals.Repl);
  79940. smalltalk.addMethod(
  79941. smalltalk.method({
  79942. selector: "setPrompt",
  79943. protocol: 'actions',
  79944. fn: function (){
  79945. var self=this;
  79946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79947. return smalltalk.withContext(function($ctx1) {
  79948. //>>excludeEnd("ctx");
  79949. _st(self["@interface"])._setPrompt_(self._prompt());
  79950. return self;
  79951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79952. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},globals.Repl)});
  79953. //>>excludeEnd("ctx");
  79954. },
  79955. //>>excludeStart("ide", pragmas.excludeIdeData);
  79956. args: [],
  79957. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  79958. referencedClasses: [],
  79959. //>>excludeEnd("ide");
  79960. messageSends: ["setPrompt:", "prompt"]
  79961. }),
  79962. globals.Repl);
  79963. smalltalk.addMethod(
  79964. smalltalk.method({
  79965. selector: "setupCommands",
  79966. protocol: 'initialization',
  79967. fn: function (){
  79968. var self=this;
  79969. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  79970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79971. return smalltalk.withContext(function($ctx1) {
  79972. //>>excludeEnd("ctx");
  79973. var $2,$1;
  79974. $2=_st([":q"]).__minus_gt((function(){
  79975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79976. return smalltalk.withContext(function($ctx2) {
  79977. //>>excludeEnd("ctx");
  79978. return _st(process)._exit();
  79979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  79981. //>>excludeEnd("ctx");
  79982. }));
  79983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79984. $ctx1.sendIdx["->"]=1;
  79985. //>>excludeEnd("ctx");
  79986. $1=[$2,_st([""]).__minus_gt((function(){
  79987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79988. return smalltalk.withContext(function($ctx2) {
  79989. //>>excludeEnd("ctx");
  79990. return _st(self["@interface"])._prompt();
  79991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  79993. //>>excludeEnd("ctx");
  79994. }))];
  79995. self["@commands"]=_st($Dictionary())._from_($1);
  79996. return self;
  79997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79998. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},globals.Repl)});
  79999. //>>excludeEnd("ctx");
  80000. },
  80001. //>>excludeStart("ide", pragmas.excludeIdeData);
  80002. args: [],
  80003. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  80004. referencedClasses: ["Dictionary"],
  80005. //>>excludeEnd("ide");
  80006. messageSends: ["from:", "->", "exit", "prompt"]
  80007. }),
  80008. globals.Repl);
  80009. smalltalk.addMethod(
  80010. smalltalk.method({
  80011. selector: "setupHotkeys",
  80012. protocol: 'initialization',
  80013. fn: function (){
  80014. var self=this;
  80015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80016. return smalltalk.withContext(function($ctx1) {
  80017. //>>excludeEnd("ctx");
  80018. var $receiver;
  80019. _st(_st(process)._stdin())._on_do_("keypress",(function(s,key){
  80020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80021. return smalltalk.withContext(function($ctx2) {
  80022. //>>excludeEnd("ctx");
  80023. if(($receiver = key) == null || $receiver.isNil){
  80024. return key;
  80025. } else {
  80026. return self._onKeyPress_(key);
  80027. };
  80028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80029. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  80030. //>>excludeEnd("ctx");
  80031. }));
  80032. return self;
  80033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80034. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},globals.Repl)});
  80035. //>>excludeEnd("ctx");
  80036. },
  80037. //>>excludeStart("ide", pragmas.excludeIdeData);
  80038. args: [],
  80039. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  80040. referencedClasses: [],
  80041. //>>excludeEnd("ide");
  80042. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  80043. }),
  80044. globals.Repl);
  80045. smalltalk.addMethod(
  80046. smalltalk.method({
  80047. selector: "subclass:withVariable:",
  80048. protocol: 'private',
  80049. fn: function (aClass,varName){
  80050. var self=this;
  80051. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  80052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80053. return smalltalk.withContext(function($ctx1) {
  80054. //>>excludeEnd("ctx");
  80055. var $1;
  80056. $1=_st(_st($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,_st(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  80057. return $1;
  80058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80059. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},globals.Repl)});
  80060. //>>excludeEnd("ctx");
  80061. },
  80062. //>>excludeStart("ide", pragmas.excludeIdeData);
  80063. args: ["aClass", "varName"],
  80064. source: "subclass: aClass withVariable: varName\x0a\x09\x22Create subclass with new variable.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: (self subclassNameFor: aClass) asSymbol\x0a\x09\x09instanceVariableNames: {varName}\x0a\x09\x09package: 'Compiler-Core'",
  80065. referencedClasses: ["ClassBuilder"],
  80066. //>>excludeEnd("ide");
  80067. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  80068. }),
  80069. globals.Repl);
  80070. smalltalk.addMethod(
  80071. smalltalk.method({
  80072. selector: "subclassNameFor:",
  80073. protocol: 'private',
  80074. fn: function (aClass){
  80075. var self=this;
  80076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80077. return smalltalk.withContext(function($ctx1) {
  80078. //>>excludeEnd("ctx");
  80079. var $3,$2,$7,$6,$5,$4,$8,$1,$receiver;
  80080. $3=_st(aClass)._name();
  80081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80082. $ctx1.sendIdx["name"]=1;
  80083. //>>excludeEnd("ctx");
  80084. $2=_st($3)._matchesOf_("\x5cd+$");
  80085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80086. $ctx1.sendIdx["matchesOf:"]=1;
  80087. //>>excludeEnd("ctx");
  80088. if(($receiver = $2) == null || $receiver.isNil){
  80089. $1=_st(_st(aClass)._name()).__comma("2");
  80090. } else {
  80091. var counter;
  80092. $7=_st(aClass)._name();
  80093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80094. $ctx1.sendIdx["name"]=2;
  80095. //>>excludeEnd("ctx");
  80096. $6=_st($7)._matchesOf_("\x5cd+$");
  80097. $5=_st($6)._first();
  80098. $4=_st($5)._asNumber();
  80099. counter=_st($4).__plus((1));
  80100. counter;
  80101. $8=_st(aClass)._name();
  80102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80103. $ctx1.sendIdx["name"]=3;
  80104. //>>excludeEnd("ctx");
  80105. $1=_st($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),_st(counter)._asString());
  80106. };
  80107. return $1;
  80108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80109. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},globals.Repl)});
  80110. //>>excludeEnd("ctx");
  80111. },
  80112. //>>excludeStart("ide", pragmas.excludeIdeData);
  80113. args: ["aClass"],
  80114. source: "subclassNameFor: aClass\x0a\x09^ (aClass name matchesOf: '\x5cd+$')\x0a\x09\x09ifNotNil: [ | counter |\x0a\x09\x09\x09counter := (aClass name matchesOf: '\x5cd+$') first asNumber + 1.\x0a\x09\x09\x09aClass name replaceRegexp: '\x5cd+$' asRegexp with: counter asString]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass name, '2'].",
  80115. referencedClasses: [],
  80116. //>>excludeEnd("ide");
  80117. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  80118. }),
  80119. globals.Repl);
  80120. smalltalk.addMethod(
  80121. smalltalk.method({
  80122. selector: "main",
  80123. protocol: 'initialization',
  80124. fn: function (){
  80125. var self=this;
  80126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80127. return smalltalk.withContext(function($ctx1) {
  80128. //>>excludeEnd("ctx");
  80129. _st(self._new())._createInterface();
  80130. return self;
  80131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80132. }, function($ctx1) {$ctx1.fill(self,"main",{},globals.Repl.klass)});
  80133. //>>excludeEnd("ctx");
  80134. },
  80135. //>>excludeStart("ide", pragmas.excludeIdeData);
  80136. args: [],
  80137. source: "main\x0a\x09self new createInterface",
  80138. referencedClasses: [],
  80139. //>>excludeEnd("ide");
  80140. messageSends: ["createInterface", "new"]
  80141. }),
  80142. globals.Repl.klass);
  80143. });
  80144. define("amber_vm/boot", ["amber/boot"], function (boot) { return boot; });
  80145. define("amber/_init", ["amber/boot","amber_vm/smalltalk","amber_vm/globals","amber_vm/nil","amber_vm/_st","amber_core/Kernel-Objects","amber_core/Kernel-Classes","amber_core/Kernel-Methods","amber_core/Kernel-Collections","amber_core/Kernel-Infrastructure","amber_core/Kernel-Exceptions","amber_core/Kernel-Transcript","amber_core/Kernel-Announcements","amber_core/Compiler-Exceptions","amber_core/Compiler-Core","amber_core/Compiler-AST","amber_core/Compiler-IR","amber_core/Compiler-Inlining","amber_core/Compiler-Semantic","amber_core/Compiler-Interpreter","amber/parser","amber_core/SUnit","amber_core/Kernel-ImportExport","amber_core/Kernel-Tests","amber_core/Compiler-Tests","amber_core/SUnit-Tests","amber_cli/AmberCli"], function (boot) {
  80146. boot.vm.initialize();
  80147. var vm = boot.vm, globals = boot.globals;
  80148. globals.AmberCli._main();
  80149. });
  80150. requirejs("amber/_init");