jtalk.deploy.js 184 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395
  1. function Smalltalk(){};
  2. function SmalltalkObject(){};
  3. function SmalltalkBehavior(){};
  4. function SmalltalkClass(){};
  5. function SmalltalkMetaclass(){
  6. this.meta = true;
  7. };
  8. function SmalltalkMethod(){};
  9. function SmalltalkNil(){};
  10. var nil = new SmalltalkNil();
  11. var smalltalk = new Smalltalk();
  12. smalltalk.klass = function(spec) {
  13. var spec = spec || {};
  14. var that;
  15. if(spec.meta) {
  16. that = new SmalltalkMetaclass();
  17. } else {
  18. that = new (smalltalk.klass({meta: true})).fn;
  19. that.klass.instanceClass = that;
  20. that.className = spec.className;
  21. that.klass.className = that.className + ' class';
  22. }
  23. that.fn = spec.fn || function(){};
  24. that.superclass = spec.superclass;
  25. that.iVarNames = spec.iVarNames || [];
  26. if(that.superclass) {
  27. that.klass.superclass = that.superclass.klass;
  28. }
  29. that.category = spec.category || "";
  30. that.fn.prototype.methods = {};
  31. that.fn.prototype.klass = that;
  32. return that;
  33. };
  34. smalltalk.method = function(spec) {
  35. var that = new SmalltalkMethod();
  36. that.selector = spec.selector;
  37. that.category = spec.category;
  38. that.source = spec.source;
  39. that.fn = spec.fn;
  40. return that
  41. };
  42. smalltalk.init = function(klass) {
  43. var subclasses = smalltalk.subclasses(klass);
  44. for(var i=0;i<klass.iVarNames.length;i++) {
  45. klass.fn.prototype["@"+klass.iVarNames[i]] = nil;
  46. }
  47. if(klass.superclass && klass.superclass !== nil) {
  48. klass.fn.prototype.__proto__ = klass.superclass.fn.prototype;
  49. for(var i=0;i<klass.superclass.iVarNames.length;i++) {
  50. if(!klass["@"+klass.superclass.iVarNames[i]]) {
  51. klass.fn.prototype["@"+klass.superclass.iVarNames[i]] = nil;
  52. }
  53. }
  54. }
  55. for(var i=0;i<subclasses.length;i++) {
  56. smalltalk.init(subclasses[i]);
  57. }
  58. if(klass.klass && !klass.meta) {
  59. smalltalk.init(klass.klass);
  60. }
  61. };
  62. smalltalk.classes = function() {
  63. var classes = [];
  64. for(var i in smalltalk) {
  65. if(i.search(/^[A-Z]/g) != -1) {
  66. classes.push(smalltalk[i]);
  67. }
  68. }
  69. return classes
  70. };
  71. smalltalk.subclasses = function(klass) {
  72. var subclasses = [];
  73. var classes = smalltalk.classes();
  74. for(var i in classes) {
  75. if(classes[i].fn) {
  76. //Metaclasses
  77. if(classes[i].klass && classes[i].klass.superclass === klass) {
  78. subclasses.push(classes[i].klass);
  79. }
  80. //Classes
  81. if(classes[i].superclass === klass) {
  82. subclasses.push(classes[i]);
  83. }
  84. }
  85. }
  86. return subclasses;
  87. };
  88. smalltalk.mapClassName = function(className, category, fn, superclass) {
  89. smalltalk[className] = smalltalk.klass({
  90. className: className,
  91. category: category,
  92. superclass: superclass,
  93. fn: fn
  94. });
  95. };
  96. smalltalk.addClass = function(className, superclass, iVarNames, category) {
  97. if(smalltalk[className]) {
  98. smalltalk[className].superclass = superclass;
  99. smalltalk[className].iVarNames = iVarNames;
  100. } else {
  101. smalltalk[className] = smalltalk.klass({
  102. className: className,
  103. iVarNames: iVarNames,
  104. superclass: superclass
  105. });
  106. }
  107. smalltalk[className].category = category || '';
  108. };
  109. smalltalk.addMethod = function(jsSelector, method, klass) {
  110. klass.fn.prototype[jsSelector] = method.fn;
  111. klass.fn.prototype.methods[method.selector] = method;
  112. };
  113. smalltalk.mapClassName("Object", "Kernel", SmalltalkObject);
  114. smalltalk.mapClassName("Smalltalk", "Kernel", Smalltalk, smalltalk.Object);
  115. smalltalk.mapClassName("Behavior", "Kernel", SmalltalkBehavior, smalltalk.Object);
  116. smalltalk.mapClassName("Class", "Kernel", SmalltalkClass, smalltalk.Behavior);
  117. smalltalk.mapClassName("Metaclass", "Kernel", SmalltalkMetaclass, smalltalk.Behavior);
  118. smalltalk.mapClassName("CompiledMethod", "Kernel", SmalltalkMethod, smalltalk.Object);
  119. smalltalk.Object.klass.superclass = smalltalk.Class
  120. smalltalk.mapClassName("Number", "Kernel", Number, smalltalk.Object);
  121. smalltalk.mapClassName("BlockClosure", "Kernel", Function, smalltalk.Object);
  122. smalltalk.mapClassName("Boolean", "Kernel", Boolean, smalltalk.Object);
  123. smalltalk.mapClassName("UndefinedObject", "Kernel", SmalltalkNil, smalltalk.Object);
  124. smalltalk.mapClassName("Collection", "Kernel", null, smalltalk.Object);
  125. smalltalk.mapClassName("String", "Kernel", String, smalltalk.Collection);
  126. smalltalk.mapClassName("RegularExpression", "Kernel", RegExp, smalltalk.String);
  127. smalltalk.mapClassName("Array", "Kernel", Array, smalltalk.Collection);
  128. if(CanvasRenderingContext2D) {
  129. smalltalk.mapClassName("CanvasRenderingContext", "Canvas", CanvasRenderingContext2D, smalltalk.Object);
  130. }
  131. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel');
  132. smalltalk.addMethod(
  133. '__eq',
  134. smalltalk.method({
  135. selector: '=',
  136. category: 'comparing',
  137. fn: function (anObject) {
  138. var self = this;
  139. return function () {return self == anObject;}();
  140. return self;
  141. },
  142. source: unescape('%3D%20anObject%0A%09%5E%7B%27return%20self%20%3D%3D%20anObject%27%7D%0A')}),
  143. smalltalk.Object);
  144. smalltalk.addMethod(
  145. '_~_eq',
  146. smalltalk.method({
  147. selector: '~=',
  148. category: 'comparing',
  149. fn: function (anObject) {
  150. var self = this;
  151. return self.__eq(anObject).__eq_eq(false);
  152. return self;
  153. },
  154. source: unescape('%7E%3D%20anObject%0A%09%5E%28self%20%3D%20anObject%29%20%3D%3D%20false%0A')}),
  155. smalltalk.Object);
  156. smalltalk.addMethod(
  157. '_initialize',
  158. smalltalk.method({
  159. selector: 'initialize',
  160. category: 'initialization',
  161. fn: function () {
  162. var self = this;
  163. return self;
  164. },
  165. source: unescape('initialize%0A')}),
  166. smalltalk.Object);
  167. smalltalk.addMethod(
  168. '_yourself',
  169. smalltalk.method({
  170. selector: 'yourself',
  171. category: 'accessing',
  172. fn: function () {
  173. var self = this;
  174. return self;
  175. return self;
  176. },
  177. source: unescape('yourself%0A%09%5Eself%0A')}),
  178. smalltalk.Object);
  179. smalltalk.addMethod(
  180. '_class',
  181. smalltalk.method({
  182. selector: 'class',
  183. category: 'accessing',
  184. fn: function () {
  185. var self = this;
  186. return function () {return self.klass;}();
  187. return self;
  188. },
  189. source: unescape('class%0A%09%5E%7B%27return%20self.klass%27%7D%0A')}),
  190. smalltalk.Object);
  191. smalltalk.addMethod(
  192. '_size',
  193. smalltalk.method({
  194. selector: 'size',
  195. category: 'accessing',
  196. fn: function () {
  197. var self = this;
  198. self._error_("Object not indexable");
  199. return self;
  200. },
  201. source: unescape('size%0A%09self%20error%3A%20%27Object%20not%20indexable%27%0A')}),
  202. smalltalk.Object);
  203. smalltalk.addMethod(
  204. '_copy',
  205. smalltalk.method({
  206. selector: 'copy',
  207. category: 'copying',
  208. fn: function () {
  209. var self = this;
  210. return self._shallowCopy()._postCopy();
  211. return self;
  212. },
  213. source: unescape('copy%0A%09%5Eself%20shallowCopy%20postCopy%0A')}),
  214. smalltalk.Object);
  215. smalltalk.addMethod(
  216. '_shallowCopy',
  217. smalltalk.method({
  218. selector: 'shallowCopy',
  219. category: 'copying',
  220. fn: function () {
  221. var self = this;
  222. return function () {var copy = self.klass._new();for (var i in self) {if (/^@.+/.test(i)) {copy[i] = self[i];}}return copy;}();
  223. return self;
  224. },
  225. source: unescape('shallowCopy%0A%09%5E%7B%27%0A%09%20%20%20%20var%20copy%20%3D%20self.klass._new%28%29%3B%0A%09%20%20%20%20for%28var%20i%20in%20self%29%20%7B%0A%09%09if%28/%5E@.+/.test%28i%29%29%20%7B%0A%09%09%20%20%20%20copy%5Bi%5D%20%3D%20self%5Bi%5D%3B%0A%09%09%7D%0A%09%20%20%20%20%7D%0A%09%20%20%20%20return%20copy%3B%0A%09%27%7D%0A')}),
  226. smalltalk.Object);
  227. smalltalk.addMethod(
  228. '_deepCopy',
  229. smalltalk.method({
  230. selector: 'deepCopy',
  231. category: 'copying',
  232. fn: function () {
  233. var self = this;
  234. (function () {var copy = self.klass._new();for (var i in self) {if (/^@.+/.test(i)) {copy[i] = self[i]._deepCopy();}}return copy;}());
  235. return self;
  236. },
  237. source: unescape('deepCopy%0A%09%7B%27%09%20%20%20%20%0A%09%20%20%20%20var%20copy%20%3D%20self.klass._new%28%29%3B%0A%09%20%20%20%20for%28var%20i%20in%20self%29%20%7B%0A%09%09if%28/%5E@.+/.test%28i%29%29%20%7B%0A%09%09%20%20%20%20copy%5Bi%5D%20%3D%20self%5Bi%5D._deepCopy%28%29%3B%0A%09%09%7D%0A%09%20%20%20%20%7D%0A%09%20%20%20%20return%20copy%3B%0A%09%27%7D.%0A')}),
  238. smalltalk.Object);
  239. smalltalk.addMethod(
  240. '_postCopy',
  241. smalltalk.method({
  242. selector: 'postCopy',
  243. category: 'copying',
  244. fn: function () {
  245. var self = this;
  246. return self;
  247. },
  248. source: unescape('postCopy%0A')}),
  249. smalltalk.Object);
  250. smalltalk.addMethod(
  251. '__minus_gt',
  252. smalltalk.method({
  253. selector: '->',
  254. category: 'converting',
  255. fn: function (anObject) {
  256. var self = this;
  257. return smalltalk.Association._key_value_(self, anObject);
  258. return self;
  259. },
  260. source: unescape('-%3E%20anObject%0A%09%5EAssociation%20key%3A%20self%20value%3A%20anObject%0A')}),
  261. smalltalk.Object);
  262. smalltalk.addMethod(
  263. '_asString',
  264. smalltalk.method({
  265. selector: 'asString',
  266. category: 'converting',
  267. fn: function () {
  268. var self = this;
  269. return self._printString();
  270. return self;
  271. },
  272. source: unescape('asString%0A%09%5Eself%20printString%0A')}),
  273. smalltalk.Object);
  274. smalltalk.addMethod(
  275. '_asJavascript',
  276. smalltalk.method({
  277. selector: 'asJavascript',
  278. category: 'converting',
  279. fn: function () {
  280. var self = this;
  281. return self._asString();
  282. return self;
  283. },
  284. source: unescape('asJavascript%0A%09%5Eself%20asString%0A')}),
  285. smalltalk.Object);
  286. smalltalk.addMethod(
  287. '_perform_',
  288. smalltalk.method({
  289. selector: 'perform:',
  290. category: 'message handling',
  291. fn: function (aSymbol) {
  292. var self = this;
  293. return self._perform_withArguments_(aSymbol, []);
  294. return self;
  295. },
  296. source: unescape('perform%3A%20aSymbol%0A%09%5Eself%20perform%3A%20aSymbol%20withArguments%3A%20%23%28%29%0A')}),
  297. smalltalk.Object);
  298. smalltalk.addMethod(
  299. '_perform_withArguments_',
  300. smalltalk.method({
  301. selector: 'perform:withArguments:',
  302. category: 'error handling',
  303. fn: function (aSymbol, aCollection) {
  304. var self = this;
  305. return self._basicPerform_withArguments_(aSymbol._asSelector(), aCollection);
  306. return self;
  307. },
  308. source: unescape('perform%3A%20aSymbol%20withArguments%3A%20aCollection%0A%09%5Eself%20basicPerform%3A%20aSymbol%20asSelector%20withArguments%3A%20aCollection%0A')}),
  309. smalltalk.Object);
  310. smalltalk.addMethod(
  311. '_instVarAt_',
  312. smalltalk.method({
  313. selector: 'instVarAt:',
  314. category: 'accessing',
  315. fn: function (aString) {
  316. var self = this;
  317. return function () {var value = self["@" + aString];if (typeof value == "undefined") {return nil;} else {return value;}}();
  318. return self;
  319. },
  320. source: unescape('instVarAt%3A%20aString%0A%09%5E%7B%27%0A%09%20%20%20%20var%20value%20%3D%20self%5B%27%27@%27%27+aString%5D%3B%0A%09%20%20%20%20if%28typeof%28value%29%20%3D%3D%20%27%27undefined%27%27%29%20%7B%0A%09%09return%20nil%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20value%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  321. smalltalk.Object);
  322. smalltalk.addMethod(
  323. '_instVarAt_put_',
  324. smalltalk.method({
  325. selector: 'instVarAt:put:',
  326. category: 'accessing',
  327. fn: function (aString, anObject) {
  328. var self = this;
  329. return function () {self["@" + aString] = anObject;}();
  330. return self;
  331. },
  332. source: unescape('instVarAt%3A%20aString%20put%3A%20anObject%0A%09%5E%7B%27self%5B%27%27@%27%27%20+%20aString%5D%20%3D%20anObject%27%7D%0A')}),
  333. smalltalk.Object);
  334. smalltalk.addMethod(
  335. '_basicAt_',
  336. smalltalk.method({
  337. selector: 'basicAt:',
  338. category: 'accessing',
  339. fn: function (aString) {
  340. var self = this;
  341. return function () {var value = self[aString];if (typeof value == "undefined") {return nil;} else {return value;}}();
  342. return self;
  343. },
  344. source: unescape('basicAt%3A%20aString%0A%09%5E%7B%27%0A%09%20%20%20%20var%20value%20%3D%20self%5BaString%5D%3B%0A%09%20%20%20%20if%28typeof%28value%29%20%3D%3D%20%27%27undefined%27%27%29%20%7B%0A%09%09return%20nil%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20value%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  345. smalltalk.Object);
  346. smalltalk.addMethod(
  347. '_basicAt_put_',
  348. smalltalk.method({
  349. selector: 'basicAt:put:',
  350. category: 'accessing',
  351. fn: function (aString, anObject) {
  352. var self = this;
  353. return function () {return self[aString] = anObject;}();
  354. return self;
  355. },
  356. source: unescape('basicAt%3A%20aString%20put%3A%20anObject%0A%09%5E%7B%27return%20self%5BaString%5D%20%3D%20anObject%27%7D%0A')}),
  357. smalltalk.Object);
  358. smalltalk.addMethod(
  359. '_error_',
  360. smalltalk.method({
  361. selector: 'error:',
  362. category: 'error handling',
  363. fn: function (aString) {
  364. var self = this;
  365. smalltalk.Error._signal_(aString);
  366. return self;
  367. },
  368. source: unescape('error%3A%20aString%0A%09Error%20signal%3A%20aString%0A')}),
  369. smalltalk.Object);
  370. smalltalk.addMethod(
  371. '_subclassResponsibility',
  372. smalltalk.method({
  373. selector: 'subclassResponsibility',
  374. category: 'error handling',
  375. fn: function () {
  376. var self = this;
  377. self._error_("This method is a responsibility of a subclass");
  378. return self;
  379. },
  380. source: unescape('subclassResponsibility%0A%09self%20error%3A%20%27This%20method%20is%20a%20responsibility%20of%20a%20subclass%27%0A')}),
  381. smalltalk.Object);
  382. smalltalk.addMethod(
  383. '_shouldNotImplement',
  384. smalltalk.method({
  385. selector: 'shouldNotImplement',
  386. category: 'error handling',
  387. fn: function () {
  388. var self = this;
  389. self._error_("This method should not be implemented in ".__comma(self._class()._name()));
  390. return self;
  391. },
  392. source: unescape('shouldNotImplement%0A%09self%20error%3A%20%27This%20method%20should%20not%20be%20implemented%20in%20%27%2C%20self%20class%20name%0A')}),
  393. smalltalk.Object);
  394. smalltalk.addMethod(
  395. '_try_catch_',
  396. smalltalk.method({
  397. selector: 'try:catch:',
  398. category: 'error handling',
  399. fn: function (aBlock, anotherBlock) {
  400. var self = this;
  401. (function () {try {aBlock();} catch (e) {anotherBlock(e);}}());
  402. return self;
  403. },
  404. source: unescape('try%3A%20aBlock%20catch%3A%20anotherBlock%0A%09%7B%27try%7BaBlock%28%29%7D%20catch%28e%29%20%7BanotherBlock%28e%29%7D%27%7D%0A')}),
  405. smalltalk.Object);
  406. smalltalk.addMethod(
  407. '_printString',
  408. smalltalk.method({
  409. selector: 'printString',
  410. category: 'printing',
  411. fn: function () {
  412. var self = this;
  413. return "a ".__comma(self._class()._name());
  414. return self;
  415. },
  416. source: unescape('printString%0A%09%5E%27a%20%27%2C%20self%20class%20name%0A')}),
  417. smalltalk.Object);
  418. smalltalk.addMethod(
  419. '_printNl',
  420. smalltalk.method({
  421. selector: 'printNl',
  422. category: 'printing',
  423. fn: function () {
  424. var self = this;
  425. (function () {console.log(self);}());
  426. return self;
  427. },
  428. source: unescape('printNl%0A%09%7B%27console.log%28self%29%27%7D%0A')}),
  429. smalltalk.Object);
  430. smalltalk.addMethod(
  431. '_isKindOf_',
  432. smalltalk.method({
  433. selector: 'isKindOf:',
  434. category: 'testing',
  435. fn: function (aClass) {
  436. var self = this;
  437. return self._isMemberOf_(aClass)._ifTrue_ifFalse_(function () {return true;}, function () {return self._class()._inheritsFrom_(aClass);});
  438. return self;
  439. },
  440. source: unescape('isKindOf%3A%20aClass%0A%09%5E%28self%20isMemberOf%3A%20aClass%29%0A%09%20%20%20%20ifTrue%3A%20%5Btrue%5D%0A%09%20%20%20%20ifFalse%3A%20%5Bself%20class%20inheritsFrom%3A%20aClass%5D%0A')}),
  441. smalltalk.Object);
  442. smalltalk.addMethod(
  443. '_isMemberOf_',
  444. smalltalk.method({
  445. selector: 'isMemberOf:',
  446. category: 'testing',
  447. fn: function (aClass) {
  448. var self = this;
  449. return self._class().__eq(aClass);
  450. return self;
  451. },
  452. source: unescape('isMemberOf%3A%20aClass%0A%09%5Eself%20class%20%3D%20aClass%0A')}),
  453. smalltalk.Object);
  454. smalltalk.addMethod(
  455. '_ifNil_',
  456. smalltalk.method({
  457. selector: 'ifNil:',
  458. category: 'testing',
  459. fn: function (aBlock) {
  460. var self = this;
  461. return self;
  462. return self;
  463. },
  464. source: unescape('ifNil%3A%20aBlock%0A%09%5Eself%0A')}),
  465. smalltalk.Object);
  466. smalltalk.addMethod(
  467. '_ifNil_ifNotNil_',
  468. smalltalk.method({
  469. selector: 'ifNil:ifNotNil:',
  470. category: 'testing',
  471. fn: function (aBlock, anotherBlock) {
  472. var self = this;
  473. return anotherBlock._value();
  474. return self;
  475. },
  476. source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%5EanotherBlock%20value%0A')}),
  477. smalltalk.Object);
  478. smalltalk.addMethod(
  479. '_ifNotNil_',
  480. smalltalk.method({
  481. selector: 'ifNotNil:',
  482. category: 'testing',
  483. fn: function (aBlock) {
  484. var self = this;
  485. return aBlock._value();
  486. return self;
  487. },
  488. source: unescape('ifNotNil%3A%20aBlock%0A%09%5EaBlock%20value%0A')}),
  489. smalltalk.Object);
  490. smalltalk.addMethod(
  491. '_ifNotNil_ifNil_',
  492. smalltalk.method({
  493. selector: 'ifNotNil:ifNil:',
  494. category: 'testing',
  495. fn: function (aBlock, anotherBlock) {
  496. var self = this;
  497. return aBlock._value();
  498. return self;
  499. },
  500. source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%5EaBlock%20value%0A')}),
  501. smalltalk.Object);
  502. smalltalk.addMethod(
  503. '_isNil',
  504. smalltalk.method({
  505. selector: 'isNil',
  506. category: 'testing',
  507. fn: function () {
  508. var self = this;
  509. return false;
  510. return self;
  511. },
  512. source: unescape('isNil%0A%09%5Efalse%0A')}),
  513. smalltalk.Object);
  514. smalltalk.addMethod(
  515. '_notNil',
  516. smalltalk.method({
  517. selector: 'notNil',
  518. category: 'testing',
  519. fn: function () {
  520. var self = this;
  521. return self._isNil()._not();
  522. return self;
  523. },
  524. source: unescape('notNil%0A%09%5Eself%20isNil%20not%0A')}),
  525. smalltalk.Object);
  526. smalltalk.addMethod(
  527. '_isClass',
  528. smalltalk.method({
  529. selector: 'isClass',
  530. category: 'testing',
  531. fn: function () {
  532. var self = this;
  533. return false;
  534. return self;
  535. },
  536. source: unescape('isClass%0A%09%5Efalse%0A')}),
  537. smalltalk.Object);
  538. smalltalk.addMethod(
  539. '_isMetaclass',
  540. smalltalk.method({
  541. selector: 'isMetaclass',
  542. category: 'testing',
  543. fn: function () {
  544. var self = this;
  545. return false;
  546. return self;
  547. },
  548. source: unescape('isMetaclass%0A%09%5Efalse%0A')}),
  549. smalltalk.Object);
  550. smalltalk.addMethod(
  551. '_isNumber',
  552. smalltalk.method({
  553. selector: 'isNumber',
  554. category: 'testing',
  555. fn: function () {
  556. var self = this;
  557. return false;
  558. return self;
  559. },
  560. source: unescape('isNumber%0A%09%5Efalse%0A')}),
  561. smalltalk.Object);
  562. smalltalk.addMethod(
  563. '_isString',
  564. smalltalk.method({
  565. selector: 'isString',
  566. category: 'testing',
  567. fn: function () {
  568. var self = this;
  569. return false;
  570. return self;
  571. },
  572. source: unescape('isString%0A%09%5Efalse%0A')}),
  573. smalltalk.Object);
  574. smalltalk.addMethod(
  575. '_isParseFailure',
  576. smalltalk.method({
  577. selector: 'isParseFailure',
  578. category: 'testing',
  579. fn: function () {
  580. var self = this;
  581. return false;
  582. return self;
  583. },
  584. source: unescape('isParseFailure%0A%09%5Efalse%0A')}),
  585. smalltalk.Object);
  586. smalltalk.addMethod(
  587. '_basicPerform_',
  588. smalltalk.method({
  589. selector: 'basicPerform:',
  590. category: 'error handling',
  591. fn: function (aSymbol) {
  592. var self = this;
  593. return self._basicPerform_withArguments_(aSymbol, []);
  594. return self;
  595. },
  596. source: unescape('basicPerform%3A%20aSymbol%20%0A%20%20%20%20%5Eself%20basicPerform%3A%20aSymbol%20withArguments%3A%20%23%28%29%0A')}),
  597. smalltalk.Object);
  598. smalltalk.addMethod(
  599. '_basicPerform_withArguments_',
  600. smalltalk.method({
  601. selector: 'basicPerform:withArguments:',
  602. category: 'error handling',
  603. fn: function (aSymbol, aCollection) {
  604. var self = this;
  605. return function () {return self[aSymbol].apply(self, aCollection);}();
  606. return self;
  607. },
  608. source: unescape('basicPerform%3A%20aSymbol%20withArguments%3A%20aCollection%0A%09%5E%7B%27return%20self%5BaSymbol%5D.apply%28self%2C%20aCollection%29%3B%27%7D%0A')}),
  609. smalltalk.Object);
  610. smalltalk.addMethod(
  611. '_appendToBrush_',
  612. smalltalk.method({
  613. selector: 'appendToBrush:',
  614. category: '*Canvas',
  615. fn: function (aTagBrush) {
  616. var self = this;
  617. aTagBrush._append_(self._asString());
  618. return self;
  619. },
  620. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20append%3A%20self%20asString%0A')}),
  621. smalltalk.Object);
  622. smalltalk.addMethod(
  623. '_basicDelete_',
  624. smalltalk.method({
  625. selector: 'basicDelete:',
  626. category: 'accessing',
  627. fn: function (aString) {
  628. var self = this;
  629. (function () {delete self[aString];}());
  630. return self;
  631. },
  632. source: unescape('basicDelete%3A%20aString%0A%20%20%20%20%7B%27delete%20self%5BaString%5D%27%7D%0A')}),
  633. smalltalk.Object);
  634. smalltalk.addMethod(
  635. '_inspect',
  636. smalltalk.method({
  637. selector: 'inspect',
  638. category: '*IDE',
  639. fn: function () {
  640. var self = this;
  641. (function ($rec) {$rec._inspect_(self);return $rec._open();}(smalltalk.Inspector._new()));
  642. return self;
  643. },
  644. source: unescape('inspect%0A%09Inspector%20new%20%0A%09%09inspect%3A%20self%3B%0A%09%09open')}),
  645. smalltalk.Object);
  646. smalltalk.addMethod(
  647. '_inspectOn_',
  648. smalltalk.method({
  649. selector: 'inspectOn:',
  650. category: '*IDE',
  651. fn: function (anInspector) {
  652. var self = this;
  653. var variables = nil;
  654. variables = smalltalk.Dictionary._new();
  655. variables._at_put_(unescape("%23self"), self);
  656. self._class()._instanceVariableNames()._do_(function (each) {return variables._at_put_(each, self._instVarAt_(each));});
  657. (function ($rec) {$rec._setLabel_(self._printString());return $rec._setVariables_(variables);}(anInspector));
  658. return self;
  659. },
  660. source: unescape('inspectOn%3A%20anInspector%0A%09%7C%20variables%20%7C%0A%09variables%20%3A%3D%20Dictionary%20new.%0A%09variables%20at%3A%20%27%23self%27%20put%3A%20self.%0A%09self%20class%20instanceVariableNames%20do%3A%20%5B%3Aeach%20%7C%0A%09%09variables%20at%3A%20each%20put%3A%20%28self%20instVarAt%3A%20each%29%5D.%0A%09anInspector%20%0A%09%09setLabel%3A%20self%20printString%3B%0A%09%09setVariables%3A%20variables%0A%09%0A%09')}),
  661. smalltalk.Object);
  662. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel');
  663. smalltalk.addMethod(
  664. '_classes',
  665. smalltalk.method({
  666. selector: 'classes',
  667. category: 'accessing',
  668. fn: function () {
  669. var self = this;
  670. return function () {return self.classes();}();
  671. return self;
  672. },
  673. source: unescape('classes%0A%09%5E%7B%27return%20self.classes%28%29%27%7D%0A')}),
  674. smalltalk.Smalltalk);
  675. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  676. smalltalk.addMethod(
  677. '_current',
  678. smalltalk.method({
  679. selector: 'current',
  680. category: 'accessing',
  681. fn: function () {
  682. var self = this;
  683. return function () {return smalltalk;}();
  684. return self;
  685. },
  686. source: unescape('current%0A%09%20%20%20%20%5E%7B%27return%20smalltalk%27%7D%0A')}),
  687. smalltalk.Smalltalk.klass);
  688. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel');
  689. smalltalk.addMethod(
  690. '_new',
  691. smalltalk.method({
  692. selector: 'new',
  693. category: 'instance creation',
  694. fn: function () {
  695. var self = this;
  696. return function ($rec) {$rec._initialize();return $rec._yourself();}(self._basicNew());
  697. return self;
  698. },
  699. source: unescape('new%0A%09%5Eself%20basicNew%20%0A%09%20%20%20%20initialize%3B%0A%09%20%20%20%20yourself%0A')}),
  700. smalltalk.Behavior);
  701. smalltalk.addMethod(
  702. '_basicNew',
  703. smalltalk.method({
  704. selector: 'basicNew',
  705. category: 'instance creation',
  706. fn: function () {
  707. var self = this;
  708. return function () {return new self.fn;}();
  709. return self;
  710. },
  711. source: unescape('basicNew%0A%09%5E%7B%27return%20new%20self.fn%28%29%3B%27%7D%0A')}),
  712. smalltalk.Behavior);
  713. smalltalk.addMethod(
  714. '_name',
  715. smalltalk.method({
  716. selector: 'name',
  717. category: 'accessing',
  718. fn: function () {
  719. var self = this;
  720. return function () {return self.className || nil;}();
  721. return self;
  722. },
  723. source: unescape('name%0A%09%5E%7B%27return%20self.className%20%7C%7C%20nil%27%7D%0A')}),
  724. smalltalk.Behavior);
  725. smalltalk.addMethod(
  726. '_superclass',
  727. smalltalk.method({
  728. selector: 'superclass',
  729. category: 'accessing',
  730. fn: function () {
  731. var self = this;
  732. return function () {return self.superclass || nil;}();
  733. return self;
  734. },
  735. source: unescape('superclass%0A%09%5E%7B%27return%20self.superclass%20%7C%7C%20nil%27%7D%0A')}),
  736. smalltalk.Behavior);
  737. smalltalk.addMethod(
  738. '_subclasses',
  739. smalltalk.method({
  740. selector: 'subclasses',
  741. category: 'accessing',
  742. fn: function () {
  743. var self = this;
  744. return function () {return smalltalk.subclasses(self);}();
  745. return self;
  746. },
  747. source: unescape('subclasses%0A%09%5E%7B%27return%20smalltalk.subclasses%28self%29%27%7D%0A')}),
  748. smalltalk.Behavior);
  749. smalltalk.addMethod(
  750. '_allSubclasses',
  751. smalltalk.method({
  752. selector: 'allSubclasses',
  753. category: 'accessing',
  754. fn: function () {
  755. var self = this;
  756. var result = nil;
  757. result = self._subclasses();
  758. self._subclasses()._do_(function (each) {return result._addAll_(each._allSubclasses());});
  759. return result;
  760. return self;
  761. },
  762. source: unescape('allSubclasses%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%20self%20subclasses.%0A%09self%20subclasses%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20result%20addAll%3A%20each%20allSubclasses%5D.%0A%09%5Eresult%0A')}),
  763. smalltalk.Behavior);
  764. smalltalk.addMethod(
  765. '_withAllSubclasses',
  766. smalltalk.method({
  767. selector: 'withAllSubclasses',
  768. category: 'accessing',
  769. fn: function () {
  770. var self = this;
  771. return function ($rec) {$rec._addAll_(self._allSubclasses());return $rec._yourself();}(smalltalk.Array._with_(self));
  772. return self;
  773. },
  774. source: unescape('withAllSubclasses%0A%09%5E%28Array%20with%3A%20self%29%20addAll%3A%20self%20allSubclasses%3B%20yourself%0A')}),
  775. smalltalk.Behavior);
  776. smalltalk.addMethod(
  777. '_prototype',
  778. smalltalk.method({
  779. selector: 'prototype',
  780. category: 'accessing',
  781. fn: function () {
  782. var self = this;
  783. return function () {return self.fn.prototype;}();
  784. return self;
  785. },
  786. source: unescape('prototype%0A%09%5E%7B%27return%20self.fn.prototype%27%7D%0A')}),
  787. smalltalk.Behavior);
  788. smalltalk.addMethod(
  789. '_methodDictionary',
  790. smalltalk.method({
  791. selector: 'methodDictionary',
  792. category: 'accessing',
  793. fn: function () {
  794. var self = this;
  795. return function () {var dict = smalltalk.Dictionary._new();var methods = self.fn.prototype.methods;for (var i in methods) {if (methods[i].selector) {dict._at_put_(methods[i].selector, methods[i]);}}return dict;}();
  796. return self;
  797. },
  798. source: unescape('methodDictionary%0A%09%5E%7B%27var%20dict%20%3D%20smalltalk.Dictionary._new%28%29%3B%0A%09var%20methods%20%3D%20self.fn.prototype.methods%3B%0A%09for%28var%20i%20in%20methods%29%20%7B%0A%09%09if%28methods%5Bi%5D.selector%29%20%7B%0A%09%09%09dict._at_put_%28methods%5Bi%5D.selector%2C%20methods%5Bi%5D%29%3B%0A%09%09%7D%0A%09%7D%3B%0A%09return%20dict%27%7D%0A')}),
  799. smalltalk.Behavior);
  800. smalltalk.addMethod(
  801. '_instVarNames',
  802. smalltalk.method({
  803. selector: 'instVarNames',
  804. category: '',
  805. fn: function () {
  806. var self = this;
  807. return function () {return self.iVarNames;}();
  808. return self;
  809. },
  810. source: unescape('')}),
  811. smalltalk.Behavior);
  812. smalltalk.addMethod(
  813. '_methodsFor_',
  814. smalltalk.method({
  815. selector: 'methodsFor:',
  816. category: 'accessing',
  817. fn: function (aString) {
  818. var self = this;
  819. return function ($rec) {$rec._class_category_(self, aString);return $rec._yourself();}(smalltalk.ClassCategoryReader._new());
  820. return self;
  821. },
  822. source: unescape('methodsFor%3A%20aString%0A%09%5EClassCategoryReader%20new%0A%09%20%20%20%20class%3A%20self%20category%3A%20aString%3B%0A%09%20%20%20%20yourself%0A')}),
  823. smalltalk.Behavior);
  824. smalltalk.addMethod(
  825. '_addCompiledMethod_',
  826. smalltalk.method({
  827. selector: 'addCompiledMethod:',
  828. category: 'accessing',
  829. fn: function (aMethod) {
  830. var self = this;
  831. (function () {self.fn.prototype[aMethod.selector._asSelector()] = aMethod.fn;self.fn.prototype.methods[aMethod.selector] = aMethod;}());
  832. return self;
  833. },
  834. source: unescape('addCompiledMethod%3A%20aMethod%0A%09%7B%27self.fn.prototype%5BaMethod.selector._asSelector%28%29%5D%20%3D%20aMethod.fn%3B%0A%09self.fn.prototype.methods%5BaMethod.selector%5D%20%3D%20aMethod%27%7D%0A')}),
  835. smalltalk.Behavior);
  836. smalltalk.addMethod(
  837. '_instanceVariableNames',
  838. smalltalk.method({
  839. selector: 'instanceVariableNames',
  840. category: 'accessing',
  841. fn: function () {
  842. var self = this;
  843. return function () {return self.iVarNames;}();
  844. return self;
  845. },
  846. source: unescape('instanceVariableNames%0A%09%5E%7B%27return%20self.iVarNames%27%7D%0A')}),
  847. smalltalk.Behavior);
  848. smalltalk.addMethod(
  849. '_comment',
  850. smalltalk.method({
  851. selector: 'comment',
  852. category: 'accessing',
  853. fn: function () {
  854. var self = this;
  855. return self._basicAt_("comment")._ifNil_(function () {return "";});
  856. return self;
  857. },
  858. source: unescape('comment%0A%20%20%20%20%5E%28self%20basicAt%3A%20%27comment%27%29%20ifNil%3A%20%5B%27%27%5D%0A')}),
  859. smalltalk.Behavior);
  860. smalltalk.addMethod(
  861. '_comment_',
  862. smalltalk.method({
  863. selector: 'comment:',
  864. category: 'accessing',
  865. fn: function (aString) {
  866. var self = this;
  867. self._basicAt_put_("comment", aString);
  868. return self;
  869. },
  870. source: unescape('comment%3A%20aString%0A%20%20%20%20self%20basicAt%3A%20%27comment%27%20put%3A%20aString%0A')}),
  871. smalltalk.Behavior);
  872. smalltalk.addMethod(
  873. '_commentStamp',
  874. smalltalk.method({
  875. selector: 'commentStamp',
  876. category: 'accessing',
  877. fn: function () {
  878. var self = this;
  879. return function ($rec) {$rec._class_(self);return $rec._yourself();}(smalltalk.ClassCommentReader._new());
  880. return self;
  881. },
  882. source: unescape('commentStamp%0A%20%20%20%20%5EClassCommentReader%20new%0A%09class%3A%20self%3B%0A%09yourself%0A')}),
  883. smalltalk.Behavior);
  884. smalltalk.addMethod(
  885. '_removeCompiledMethod_',
  886. smalltalk.method({
  887. selector: 'removeCompiledMethod:',
  888. category: 'accessing',
  889. fn: function (aMethod) {
  890. var self = this;
  891. (function () {delete self.fn.prototype[aMethod.selector._asSelector()];delete self.fn.prototype.methods[aMethod.selector];}());
  892. return self;
  893. },
  894. source: unescape('removeCompiledMethod%3A%20aMethod%0A%09%7B%27delete%20self.fn.prototype%5BaMethod.selector._asSelector%28%29%5D%3B%0A%09delete%20self.fn.prototype.methods%5BaMethod.selector%5D%27%7D%0A')}),
  895. smalltalk.Behavior);
  896. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel');
  897. smalltalk.addMethod(
  898. '_category',
  899. smalltalk.method({
  900. selector: 'category',
  901. category: 'accessing',
  902. fn: function () {
  903. var self = this;
  904. return function () {return self.category;}();
  905. return self;
  906. },
  907. source: unescape('category%0A%09%5E%7B%27return%20self.category%27%7D%0A')}),
  908. smalltalk.Class);
  909. smalltalk.addMethod(
  910. '_category_',
  911. smalltalk.method({
  912. selector: 'category:',
  913. category: 'accessing',
  914. fn: function (aString) {
  915. var self = this;
  916. (function () {self.category = aString;}());
  917. return self;
  918. },
  919. source: unescape('category%3A%20aString%0A%09%7B%27self.category%20%3D%20aString%27%7D%0A')}),
  920. smalltalk.Class);
  921. smalltalk.addMethod(
  922. '_subclass_instanceVariableNames_',
  923. smalltalk.method({
  924. selector: 'subclass:instanceVariableNames:',
  925. category: 'class creation',
  926. fn: function (aString, anotherString) {
  927. var self = this;
  928. return self._subclass_instanceVariableNames_category_(aString, anotherString, nil);
  929. return self;
  930. },
  931. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%0A%09%5Eself%20subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%20category%3A%20nil%0A')}),
  932. smalltalk.Class);
  933. smalltalk.addMethod(
  934. '_subclass_instanceVariableNames_category_',
  935. smalltalk.method({
  936. selector: 'subclass:instanceVariableNames:category:',
  937. category: 'class creation',
  938. fn: function (aString, aString2, aString3) {
  939. var self = this;
  940. return smalltalk.ClassBuilder._new()._superclass_subclass_instanceVariableNames_category_(self, aString, aString2, aString3);
  941. return self;
  942. },
  943. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%5EClassBuilder%20new%0A%09%20%20%20%20superclass%3A%20self%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A')}),
  944. smalltalk.Class);
  945. smalltalk.addMethod(
  946. '_isClass',
  947. smalltalk.method({
  948. selector: 'isClass',
  949. category: 'testing',
  950. fn: function () {
  951. var self = this;
  952. return true;
  953. return self;
  954. },
  955. source: unescape('isClass%0A%09%5Etrue%0A')}),
  956. smalltalk.Class);
  957. smalltalk.addMethod(
  958. '_printString',
  959. smalltalk.method({
  960. selector: 'printString',
  961. category: 'printing',
  962. fn: function () {
  963. var self = this;
  964. return self._name();
  965. return self;
  966. },
  967. source: unescape('printString%0A%09%5Eself%20name%0A')}),
  968. smalltalk.Class);
  969. smalltalk.addMethod(
  970. '_rename_',
  971. smalltalk.method({
  972. selector: 'rename:',
  973. category: 'accessing',
  974. fn: function (aString) {
  975. var self = this;
  976. (function () {smalltalk[aString] = self;delete smalltalk[self.className];self.className = aString;}());
  977. return self;
  978. },
  979. source: unescape('rename%3A%20aString%0A%09%7B%27%0A%09%09smalltalk%5BaString%5D%20%3D%20self%3B%0A%09%09delete%20smalltalk%5Bself.className%5D%3B%0A%09%09self.className%20%3D%20aString%3B%0A%09%27%7D')}),
  980. smalltalk.Class);
  981. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel');
  982. smalltalk.addMethod(
  983. '_instanceClass',
  984. smalltalk.method({
  985. selector: 'instanceClass',
  986. category: 'accessing',
  987. fn: function () {
  988. var self = this;
  989. return function () {return self.instanceClass;}();
  990. return self;
  991. },
  992. source: unescape('instanceClass%0A%09%5E%7B%27return%20self.instanceClass%27%7D%0A')}),
  993. smalltalk.Metaclass);
  994. smalltalk.addMethod(
  995. '_instanceVariableNames_',
  996. smalltalk.method({
  997. selector: 'instanceVariableNames:',
  998. category: 'accessing',
  999. fn: function (aCollection) {
  1000. var self = this;
  1001. smalltalk.ClassBuilder._new()._class_instanceVariableNames_(self, aCollection);
  1002. return self;
  1003. },
  1004. source: unescape('instanceVariableNames%3A%20aCollection%0A%09ClassBuilder%20new%0A%09%20%20%20%20class%3A%20self%20instanceVariableNames%3A%20aCollection%0A')}),
  1005. smalltalk.Metaclass);
  1006. smalltalk.addMethod(
  1007. '_isMetaclass',
  1008. smalltalk.method({
  1009. selector: 'isMetaclass',
  1010. category: 'testing',
  1011. fn: function () {
  1012. var self = this;
  1013. return true;
  1014. return self;
  1015. },
  1016. source: unescape('isMetaclass%0A%09%5Etrue%0A')}),
  1017. smalltalk.Metaclass);
  1018. smalltalk.addMethod(
  1019. '_printString',
  1020. smalltalk.method({
  1021. selector: 'printString',
  1022. category: 'printing',
  1023. fn: function () {
  1024. var self = this;
  1025. return self._instanceClass()._name().__comma(" class");
  1026. return self;
  1027. },
  1028. source: unescape('printString%0A%09%5Eself%20instanceClass%20name%2C%20%27%20class%27%0A')}),
  1029. smalltalk.Metaclass);
  1030. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel');
  1031. smalltalk.addMethod(
  1032. '_source',
  1033. smalltalk.method({
  1034. selector: 'source',
  1035. category: 'accessing',
  1036. fn: function () {
  1037. var self = this;
  1038. return self._basicAt_("source")._ifNil_(function () {return "";});
  1039. return self;
  1040. },
  1041. source: unescape('source%0A%09%5E%28self%20basicAt%3A%20%27source%27%29%20ifNil%3A%20%5B%27%27%5D%0A')}),
  1042. smalltalk.CompiledMethod);
  1043. smalltalk.addMethod(
  1044. '_source_',
  1045. smalltalk.method({
  1046. selector: 'source:',
  1047. category: 'accessing',
  1048. fn: function (aString) {
  1049. var self = this;
  1050. self._basicAt_put_("source", aString);
  1051. return self;
  1052. },
  1053. source: unescape('source%3A%20aString%0A%09self%20basicAt%3A%20%27source%27%20put%3A%20aString%0A')}),
  1054. smalltalk.CompiledMethod);
  1055. smalltalk.addMethod(
  1056. '_category',
  1057. smalltalk.method({
  1058. selector: 'category',
  1059. category: 'accessing',
  1060. fn: function () {
  1061. var self = this;
  1062. return self._basicAt_("category")._ifNil_(function () {return "";});
  1063. return self;
  1064. },
  1065. source: unescape('category%0A%09%5E%28self%20basicAt%3A%20%27category%27%29%20ifNil%3A%20%5B%27%27%5D%0A')}),
  1066. smalltalk.CompiledMethod);
  1067. smalltalk.addMethod(
  1068. '_category_',
  1069. smalltalk.method({
  1070. selector: 'category:',
  1071. category: 'accessing',
  1072. fn: function (aString) {
  1073. var self = this;
  1074. self._basicAt_put_("category", aString);
  1075. return self;
  1076. },
  1077. source: unescape('category%3A%20aString%0A%09self%20basicAt%3A%20%27category%27%20put%3A%20aString%0A')}),
  1078. smalltalk.CompiledMethod);
  1079. smalltalk.addMethod(
  1080. '_selector',
  1081. smalltalk.method({
  1082. selector: 'selector',
  1083. category: 'accessing',
  1084. fn: function () {
  1085. var self = this;
  1086. return self._basicAt_("selector");
  1087. return self;
  1088. },
  1089. source: unescape('selector%0A%09%5Eself%20basicAt%3A%20%27selector%27%0A')}),
  1090. smalltalk.CompiledMethod);
  1091. smalltalk.addMethod(
  1092. '_selector_',
  1093. smalltalk.method({
  1094. selector: 'selector:',
  1095. category: 'accessing',
  1096. fn: function (aString) {
  1097. var self = this;
  1098. self._basicAt_put_("selector", aString);
  1099. return self;
  1100. },
  1101. source: unescape('selector%3A%20aString%0A%09self%20basicAt%3A%20%27selector%27%20put%3A%20aString%0A')}),
  1102. smalltalk.CompiledMethod);
  1103. smalltalk.addMethod(
  1104. '_fn',
  1105. smalltalk.method({
  1106. selector: 'fn',
  1107. category: 'accessing',
  1108. fn: function () {
  1109. var self = this;
  1110. return self._basicAt_("fn");
  1111. return self;
  1112. },
  1113. source: unescape('fn%0A%09%5Eself%20basicAt%3A%20%27fn%27%0A')}),
  1114. smalltalk.CompiledMethod);
  1115. smalltalk.addMethod(
  1116. '_fn_',
  1117. smalltalk.method({
  1118. selector: 'fn:',
  1119. category: 'accessing',
  1120. fn: function (aBlock) {
  1121. var self = this;
  1122. self._basicAt_put_("fn", aBlock);
  1123. return self;
  1124. },
  1125. source: unescape('fn%3A%20aBlock%0A%09self%20basicAt%3A%20%27fn%27%20put%3A%20aBlock%0A')}),
  1126. smalltalk.CompiledMethod);
  1127. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel');
  1128. smalltalk.addMethod(
  1129. '__eq',
  1130. smalltalk.method({
  1131. selector: '=',
  1132. category: 'comparing',
  1133. fn: function (aNumber) {
  1134. var self = this;
  1135. return function () {return Number(self) == aNumber;}();
  1136. return self;
  1137. },
  1138. source: unescape('%3D%20aNumber%0A%09%5E%7B%27return%20Number%28self%29%20%3D%3D%20aNumber%27%7D%0A')}),
  1139. smalltalk.Number);
  1140. smalltalk.addMethod(
  1141. '__gt',
  1142. smalltalk.method({
  1143. selector: '>',
  1144. category: 'comparing',
  1145. fn: function (aNumber) {
  1146. var self = this;
  1147. return function () {return self > aNumber;}();
  1148. return self;
  1149. },
  1150. source: unescape('%3E%20aNumber%0A%09%5E%7B%27return%20self%20%3E%20aNumber%27%7D%0A')}),
  1151. smalltalk.Number);
  1152. smalltalk.addMethod(
  1153. '__lt',
  1154. smalltalk.method({
  1155. selector: '<',
  1156. category: 'comparing',
  1157. fn: function (aNumber) {
  1158. var self = this;
  1159. return function () {return self < aNumber;}();
  1160. return self;
  1161. },
  1162. source: unescape('%3C%20aNumber%0A%09%5E%7B%27return%20self%20%3C%20aNumber%27%7D%0A')}),
  1163. smalltalk.Number);
  1164. smalltalk.addMethod(
  1165. '__gt_eq',
  1166. smalltalk.method({
  1167. selector: '>=',
  1168. category: 'comparing',
  1169. fn: function (aNumber) {
  1170. var self = this;
  1171. return function () {return self >= aNumber;}();
  1172. return self;
  1173. },
  1174. source: unescape('%3E%3D%20aNumber%0A%09%5E%7B%27return%20self%20%3E%3D%20aNumber%27%7D%0A')}),
  1175. smalltalk.Number);
  1176. smalltalk.addMethod(
  1177. '__lt_eq',
  1178. smalltalk.method({
  1179. selector: '<=',
  1180. category: 'comparing',
  1181. fn: function (aNumber) {
  1182. var self = this;
  1183. return function () {return self <= aNumber;}();
  1184. return self;
  1185. },
  1186. source: unescape('%3C%3D%20aNumber%0A%09%5E%7B%27return%20self%20%3C%3D%20aNumber%27%7D%0A')}),
  1187. smalltalk.Number);
  1188. smalltalk.addMethod(
  1189. '__plus',
  1190. smalltalk.method({
  1191. selector: '+',
  1192. category: 'arithmetic',
  1193. fn: function (aNumber) {
  1194. var self = this;
  1195. return function () {return self + aNumber;}();
  1196. return self;
  1197. },
  1198. source: unescape('+%20aNumber%0A%09%5E%7B%27return%20self%20+%20aNumber%27%7D%0A')}),
  1199. smalltalk.Number);
  1200. smalltalk.addMethod(
  1201. '__minus',
  1202. smalltalk.method({
  1203. selector: '-',
  1204. category: 'arithmetic',
  1205. fn: function (aNumber) {
  1206. var self = this;
  1207. return function () {return self - aNumber;}();
  1208. return self;
  1209. },
  1210. source: unescape('-%20aNumber%0A%09%5E%7B%27return%20self%20-%20aNumber%27%7D%0A')}),
  1211. smalltalk.Number);
  1212. smalltalk.addMethod(
  1213. '__star',
  1214. smalltalk.method({
  1215. selector: '*',
  1216. category: 'arithmetic',
  1217. fn: function (aNumber) {
  1218. var self = this;
  1219. return function () {return self * aNumber;}();
  1220. return self;
  1221. },
  1222. source: unescape('*%20aNumber%0A%09%5E%7B%27return%20self%20*%20aNumber%27%7D%0A')}),
  1223. smalltalk.Number);
  1224. smalltalk.addMethod(
  1225. '__slash',
  1226. smalltalk.method({
  1227. selector: '/',
  1228. category: 'arithmetic',
  1229. fn: function (aNumber) {
  1230. var self = this;
  1231. return function () {return self / aNumber;}();
  1232. return self;
  1233. },
  1234. source: unescape('/%20aNumber%0A%09%5E%7B%27return%20self%20/%20aNumber%27%7D%0A')}),
  1235. smalltalk.Number);
  1236. smalltalk.addMethod(
  1237. '_max_',
  1238. smalltalk.method({
  1239. selector: 'max:',
  1240. category: 'arithmetic',
  1241. fn: function (aNumber) {
  1242. var self = this;
  1243. return function () {return Math.max(self, aNumber);}();
  1244. return self;
  1245. },
  1246. source: unescape('max%3A%20aNumber%0A%09%5E%7B%27return%20Math.max%28self%2C%20aNumber%29%3B%27%7D%0A')}),
  1247. smalltalk.Number);
  1248. smalltalk.addMethod(
  1249. '_min_',
  1250. smalltalk.method({
  1251. selector: 'min:',
  1252. category: 'arithmetic',
  1253. fn: function (aNumber) {
  1254. var self = this;
  1255. return function () {return Math.min(self, aNumber);}();
  1256. return self;
  1257. },
  1258. source: unescape('min%3A%20aNumber%0A%09%5E%7B%27return%20Math.min%28self%2C%20aNumber%29%3B%27%7D%0A')}),
  1259. smalltalk.Number);
  1260. smalltalk.addMethod(
  1261. '_rounded',
  1262. smalltalk.method({
  1263. selector: 'rounded',
  1264. category: 'converting',
  1265. fn: function () {
  1266. var self = this;
  1267. return function () {return Math.round(self);}();
  1268. return self;
  1269. },
  1270. source: unescape('rounded%0A%09%5E%7B%27return%20Math.round%28self%29%3B%27%7D%0A')}),
  1271. smalltalk.Number);
  1272. smalltalk.addMethod(
  1273. '_truncated',
  1274. smalltalk.method({
  1275. selector: 'truncated',
  1276. category: 'converting',
  1277. fn: function () {
  1278. var self = this;
  1279. return function () {return Math.floor(self);}();
  1280. return self;
  1281. },
  1282. source: unescape('truncated%0A%09%5E%7B%27return%20Math.floor%28self%29%3B%27%7D%0A')}),
  1283. smalltalk.Number);
  1284. smalltalk.addMethod(
  1285. '_to_',
  1286. smalltalk.method({
  1287. selector: 'to:',
  1288. category: 'converting',
  1289. fn: function (aNumber) {
  1290. var self = this;
  1291. var array = nil;
  1292. var first = nil;
  1293. var last = nil;
  1294. var count = nil;
  1295. first = self._truncated();
  1296. last = aNumber._truncated().__plus(1);
  1297. count = 1;
  1298. first.__lt_eq(last)._ifFalse_(function () {return self._error_("Wrong interval");});
  1299. array = smalltalk.Array._new();
  1300. last.__minus(first)._timesRepeat_(function () {array._at_put_(count, first);count = count.__plus(1);return first = first.__plus(1);});
  1301. return array;
  1302. return self;
  1303. },
  1304. source: unescape('to%3A%20aNumber%0A%09%7C%20array%20first%20last%20count%20%7C%0A%09first%20%3A%3D%20self%20truncated.%0A%09last%20%3A%3D%20aNumber%20truncated%20+%201.%0A%09count%20%3A%3D%201.%0A%09%28first%20%3C%3D%20last%29%20ifFalse%3A%20%5Bself%20error%3A%20%27Wrong%20interval%27%5D.%0A%09array%20%3A%3D%20Array%20new.%0A%09%28last%20-%20first%29%20timesRepeat%3A%20%5B%0A%09%20%20%20%20array%20at%3A%20count%20put%3A%20first.%0A%09%20%20%20%20count%20%3A%3D%20count%20+%201.%0A%09%20%20%20%20first%20%3A%3D%20first%20+%201%5D.%0A%09%5Earray%0A')}),
  1305. smalltalk.Number);
  1306. smalltalk.addMethod(
  1307. '_timesRepeat_',
  1308. smalltalk.method({
  1309. selector: 'timesRepeat:',
  1310. category: 'enumerating',
  1311. fn: function (aBlock) {
  1312. var self = this;
  1313. var integer = nil;
  1314. var count = nil;
  1315. integer = self._truncated();
  1316. count = 1;
  1317. (function () {return count.__gt(self);}._whileFalse_(function () {aBlock._value();return count = count.__plus(1);}));
  1318. return self;
  1319. },
  1320. source: unescape('timesRepeat%3A%20aBlock%0A%09%7C%20integer%20count%20%7C%0A%09integer%20%3A%3D%20self%20truncated.%0A%09count%20%3A%3D%201.%0A%09%5Bcount%20%3E%20self%5D%20whileFalse%3A%20%5B%0A%09%20%20%20%20aBlock%20value.%0A%09%20%20%20%20count%20%3A%3D%20count%20+%201%5D%0A')}),
  1321. smalltalk.Number);
  1322. smalltalk.addMethod(
  1323. '_to_do_',
  1324. smalltalk.method({
  1325. selector: 'to:do:',
  1326. category: 'enumerating',
  1327. fn: function (aNumber, aBlock) {
  1328. var self = this;
  1329. return self._to_(aNumber)._do_(aBlock);
  1330. return self;
  1331. },
  1332. source: unescape('to%3A%20aNumber%20do%3A%20aBlock%0A%09%5E%28self%20to%3A%20aNumber%29%20do%3A%20aBlock%0A')}),
  1333. smalltalk.Number);
  1334. smalltalk.addMethod(
  1335. '_asString',
  1336. smalltalk.method({
  1337. selector: 'asString',
  1338. category: 'converting',
  1339. fn: function () {
  1340. var self = this;
  1341. return self._printString();
  1342. return self;
  1343. },
  1344. source: unescape('asString%0A%09%5Eself%20printString%0A')}),
  1345. smalltalk.Number);
  1346. smalltalk.addMethod(
  1347. '_asJavascript',
  1348. smalltalk.method({
  1349. selector: 'asJavascript',
  1350. category: 'converting',
  1351. fn: function () {
  1352. var self = this;
  1353. return unescape("%28").__comma(self._printString()).__comma(unescape("%29"));
  1354. return self;
  1355. },
  1356. source: unescape('asJavascript%0A%09%5E%27%28%27%2C%20self%20printString%2C%20%27%29%27%0A')}),
  1357. smalltalk.Number);
  1358. smalltalk.addMethod(
  1359. '_printString',
  1360. smalltalk.method({
  1361. selector: 'printString',
  1362. category: 'printing',
  1363. fn: function () {
  1364. var self = this;
  1365. return function () {return String(self);}();
  1366. return self;
  1367. },
  1368. source: unescape('printString%0A%09%5E%7B%27return%20String%28self%29%27%7D%0A')}),
  1369. smalltalk.Number);
  1370. smalltalk.addMethod(
  1371. '_isNumber',
  1372. smalltalk.method({
  1373. selector: 'isNumber',
  1374. category: 'testing',
  1375. fn: function () {
  1376. var self = this;
  1377. return true;
  1378. return self;
  1379. },
  1380. source: unescape('isNumber%0A%09%5Etrue%0A')}),
  1381. smalltalk.Number);
  1382. smalltalk.addMethod(
  1383. '_atRandom',
  1384. smalltalk.method({
  1385. selector: 'atRandom',
  1386. category: 'converting',
  1387. fn: function () {
  1388. var self = this;
  1389. return smalltalk.Random._new()._next().__star(self)._truncated().__plus(1);
  1390. return self;
  1391. },
  1392. source: unescape('atRandom%0A%20%20%20%20%5E%28Random%20new%20next%20*%20self%29%20truncated%20+%201%0A')}),
  1393. smalltalk.Number);
  1394. smalltalk.addMethod(
  1395. '__at',
  1396. smalltalk.method({
  1397. selector: '@',
  1398. category: 'converting',
  1399. fn: function (aNumber) {
  1400. var self = this;
  1401. return smalltalk.Point._x_y_(self, aNumber);
  1402. return self;
  1403. },
  1404. source: unescape('@%20aNumber%0A%09%5EPoint%20x%3A%20self%20y%3A%20aNumber')}),
  1405. smalltalk.Number);
  1406. smalltalk.addMethod(
  1407. '_asPoint',
  1408. smalltalk.method({
  1409. selector: 'asPoint',
  1410. category: 'converting',
  1411. fn: function () {
  1412. var self = this;
  1413. return smalltalk.Point._x_y_(self, self);
  1414. return self;
  1415. },
  1416. source: unescape('asPoint%0A%09%5EPoint%20x%3A%20self%20y%3A%20self')}),
  1417. smalltalk.Number);
  1418. smalltalk.addMethod(
  1419. '_clearInterval',
  1420. smalltalk.method({
  1421. selector: 'clearInterval',
  1422. category: 'intervals',
  1423. fn: function () {
  1424. var self = this;
  1425. (function () {clearInterval(Number(self));}());
  1426. return self;
  1427. },
  1428. source: unescape('clearInterval%0A%09%7B%27clearInterval%28Number%28self%29%29%27%7D')}),
  1429. smalltalk.Number);
  1430. smalltalk.addMethod(
  1431. '_pi',
  1432. smalltalk.method({
  1433. selector: 'pi',
  1434. category: 'instance creation',
  1435. fn: function () {
  1436. var self = this;
  1437. return function () {return Math.PI;}();
  1438. return self;
  1439. },
  1440. source: unescape('pi%0A%09%5E%7B%27return%20Math.PI%27%7D')}),
  1441. smalltalk.Number.klass);
  1442. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel');
  1443. smalltalk.addMethod(
  1444. '_compiledSource',
  1445. smalltalk.method({
  1446. selector: 'compiledSource',
  1447. category: 'accessing',
  1448. fn: function () {
  1449. var self = this;
  1450. return function () {return self.toString();}();
  1451. return self;
  1452. },
  1453. source: unescape('compiledSource%0A%09%5E%7B%27return%20self.toString%28%29%27%7D%0A')}),
  1454. smalltalk.BlockClosure);
  1455. smalltalk.addMethod(
  1456. '_whileTrue_',
  1457. smalltalk.method({
  1458. selector: 'whileTrue:',
  1459. category: 'controlling',
  1460. fn: function (aBlock) {
  1461. var self = this;
  1462. (function () {while (self()) {aBlock();}}());
  1463. return self;
  1464. },
  1465. source: unescape('whileTrue%3A%20aBlock%0A%09%7B%27while%28self%28%29%29%20%7BaBlock%28%29%7D%27%7D%0A')}),
  1466. smalltalk.BlockClosure);
  1467. smalltalk.addMethod(
  1468. '_whileFalse_',
  1469. smalltalk.method({
  1470. selector: 'whileFalse:',
  1471. category: 'controlling',
  1472. fn: function (aBlock) {
  1473. var self = this;
  1474. (function () {while (!self()) {aBlock();}}());
  1475. return self;
  1476. },
  1477. source: unescape('whileFalse%3A%20aBlock%0A%09%7B%27while%28%21self%28%29%29%20%7BaBlock%28%29%7D%27%7D%0A')}),
  1478. smalltalk.BlockClosure);
  1479. smalltalk.addMethod(
  1480. '_value',
  1481. smalltalk.method({
  1482. selector: 'value',
  1483. category: 'evaluating',
  1484. fn: function () {
  1485. var self = this;
  1486. return function () {return self();}();
  1487. return self;
  1488. },
  1489. source: unescape('value%0A%09%5E%7B%27return%20self%28%29%3B%27%7D%0A')}),
  1490. smalltalk.BlockClosure);
  1491. smalltalk.addMethod(
  1492. '_value_',
  1493. smalltalk.method({
  1494. selector: 'value:',
  1495. category: 'evaluating',
  1496. fn: function (anArg) {
  1497. var self = this;
  1498. return function () {return self(anArg);}();
  1499. return self;
  1500. },
  1501. source: unescape('value%3A%20anArg%0A%09%5E%7B%27return%20self%28anArg%29%3B%27%7D%0A')}),
  1502. smalltalk.BlockClosure);
  1503. smalltalk.addMethod(
  1504. '_value_value_',
  1505. smalltalk.method({
  1506. selector: 'value:value:',
  1507. category: 'evaluating',
  1508. fn: function (firstArg, secondArg) {
  1509. var self = this;
  1510. return function () {return self(firstArg, secondArg);}();
  1511. return self;
  1512. },
  1513. source: unescape('value%3A%20firstArg%20value%3A%20secondArg%0A%09%5E%7B%27return%20self%28firstArg%2C%20secondArg%29%3B%27%7D%0A')}),
  1514. smalltalk.BlockClosure);
  1515. smalltalk.addMethod(
  1516. '_value_value_value_',
  1517. smalltalk.method({
  1518. selector: 'value:value:value:',
  1519. category: 'evaluating',
  1520. fn: function (firstArg, secondArg, thirdArg) {
  1521. var self = this;
  1522. return function () {return self(firstArg, secondArg, thirdArg);}();
  1523. return self;
  1524. },
  1525. source: unescape('value%3A%20firstArg%20value%3A%20secondArg%20value%3A%20thirdArg%0A%09%5E%7B%27return%20self%28firstArg%2C%20secondArg%2C%20thirdArg%29%3B%27%7D%0A')}),
  1526. smalltalk.BlockClosure);
  1527. smalltalk.addMethod(
  1528. '_valueWithPossibleArguments_',
  1529. smalltalk.method({
  1530. selector: 'valueWithPossibleArguments:',
  1531. category: 'evaluating',
  1532. fn: function (aCollection) {
  1533. var self = this;
  1534. return function () {return self.apply(null, aCollection);}();
  1535. return self;
  1536. },
  1537. source: unescape('valueWithPossibleArguments%3A%20aCollection%0A%09%5E%7B%27return%20self.apply%28null%2C%20aCollection%29%3B%27%7D%0A')}),
  1538. smalltalk.BlockClosure);
  1539. smalltalk.addMethod(
  1540. '_on_do_',
  1541. smalltalk.method({
  1542. selector: 'on:do:',
  1543. category: 'error handling',
  1544. fn: function (anErrorClass, aBlock) {
  1545. var self = this;
  1546. self._try_catch_(self, function (error) {return error._isKindOf_(anErrorClass)._ifTrue_ifFalse_(function () {return aBlock._value();}, function () {return error._signal();});});
  1547. return self;
  1548. },
  1549. source: unescape('on%3A%20anErrorClass%20do%3A%20aBlock%0A%09self%20try%3A%20self%20catch%3A%20%5B%3Aerror%20%7C%0A%09%20%20%20%20%28error%20isKindOf%3A%20anErrorClass%29%20%0A%09%20%20%20%20%20ifTrue%3A%20%5BaBlock%20value%5D%0A%09%20%20%20%20%20ifFalse%3A%20%5Berror%20signal%5D%5D%0A')}),
  1550. smalltalk.BlockClosure);
  1551. smalltalk.addMethod(
  1552. '_appendToJQuery_',
  1553. smalltalk.method({
  1554. selector: 'appendToJQuery:',
  1555. category: '*JQuery',
  1556. fn: function (aJQuery) {
  1557. var self = this;
  1558. var canvas = nil;
  1559. canvas = smalltalk.HTMLCanvas._new();
  1560. self._value_(canvas);
  1561. aJQuery._append_(canvas);
  1562. return self;
  1563. },
  1564. source: unescape('appendToJQuery%3A%20aJQuery%0A%09%7C%20canvas%20%7C%0A%09canvas%20%3A%3D%20HTMLCanvas%20new.%0A%09self%20value%3A%20canvas.%0A%09aJQuery%20append%3A%20canvas%0A')}),
  1565. smalltalk.BlockClosure);
  1566. smalltalk.addMethod(
  1567. '_appendToBrush_',
  1568. smalltalk.method({
  1569. selector: 'appendToBrush:',
  1570. category: '*Canvas',
  1571. fn: function (aTagBrush) {
  1572. var self = this;
  1573. aTagBrush._appendBlock_(self);
  1574. return self;
  1575. },
  1576. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20appendBlock%3A%20self%0A')}),
  1577. smalltalk.BlockClosure);
  1578. smalltalk.addMethod(
  1579. '_valueWithTimeout_',
  1580. smalltalk.method({
  1581. selector: 'valueWithTimeout:',
  1582. category: 'timeout/interval',
  1583. fn: function (aNumber) {
  1584. var self = this;
  1585. (function () {setTimeout(self, aNumber);}());
  1586. return self;
  1587. },
  1588. source: unescape('valueWithTimeout%3A%20aNumber%0A%09%7B%27setTimeout%28self%2C%20aNumber%29%27%7D')}),
  1589. smalltalk.BlockClosure);
  1590. smalltalk.addMethod(
  1591. '_valueWithInterval_',
  1592. smalltalk.method({
  1593. selector: 'valueWithInterval:',
  1594. category: 'timeout/interval',
  1595. fn: function (aNumber) {
  1596. var self = this;
  1597. return function () {return setInterval(self, aNumber);}();
  1598. return self;
  1599. },
  1600. source: unescape('valueWithInterval%3A%20aNumber%0A%09%5E%7B%27return%20setInterval%28self%2C%20aNumber%29%27%7D')}),
  1601. smalltalk.BlockClosure);
  1602. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel');
  1603. smalltalk.addMethod(
  1604. '__eq',
  1605. smalltalk.method({
  1606. selector: '=',
  1607. category: 'comparing',
  1608. fn: function (aBoolean) {
  1609. var self = this;
  1610. return function () {return Boolean(self == true) == aBoolean;}();
  1611. return self;
  1612. },
  1613. source: unescape('%3D%20aBoolean%0A%20%20%20%20%09%5E%7B%27return%20Boolean%28self%20%3D%3D%20true%29%20%3D%3D%20aBoolean%27%7D%0A')}),
  1614. smalltalk.Boolean);
  1615. smalltalk.addMethod(
  1616. '_shallowCopy',
  1617. smalltalk.method({
  1618. selector: 'shallowCopy',
  1619. category: 'copying',
  1620. fn: function () {
  1621. var self = this;
  1622. return self;
  1623. return self;
  1624. },
  1625. source: unescape('shallowCopy%0A%09%5Eself%0A')}),
  1626. smalltalk.Boolean);
  1627. smalltalk.addMethod(
  1628. '_deepCopy',
  1629. smalltalk.method({
  1630. selector: 'deepCopy',
  1631. category: 'copying',
  1632. fn: function () {
  1633. var self = this;
  1634. return self;
  1635. return self;
  1636. },
  1637. source: unescape('deepCopy%0A%09%5Eself%0A')}),
  1638. smalltalk.Boolean);
  1639. smalltalk.addMethod(
  1640. '_ifTrue_',
  1641. smalltalk.method({
  1642. selector: 'ifTrue:',
  1643. category: 'controlling',
  1644. fn: function (aBlock) {
  1645. var self = this;
  1646. return self._ifTrue_ifFalse_(aBlock, function () {return nil;});
  1647. return self;
  1648. },
  1649. source: unescape('ifTrue%3A%20aBlock%0A%09%5Eself%20ifTrue%3A%20aBlock%20ifFalse%3A%20%5B%5D%0A')}),
  1650. smalltalk.Boolean);
  1651. smalltalk.addMethod(
  1652. '_ifFalse_',
  1653. smalltalk.method({
  1654. selector: 'ifFalse:',
  1655. category: 'controlling',
  1656. fn: function (aBlock) {
  1657. var self = this;
  1658. return self._ifTrue_ifFalse_(function () {return nil;}, aBlock);
  1659. return self;
  1660. },
  1661. source: unescape('ifFalse%3A%20aBlock%0A%09%5Eself%20ifTrue%3A%20%5B%5D%20ifFalse%3A%20aBlock%0A')}),
  1662. smalltalk.Boolean);
  1663. smalltalk.addMethod(
  1664. '_ifFalse_ifTrue_',
  1665. smalltalk.method({
  1666. selector: 'ifFalse:ifTrue:',
  1667. category: 'controlling',
  1668. fn: function (aBlock, anotherBlock) {
  1669. var self = this;
  1670. return self._ifTrue_ifFalse_(anotherBlock, aBlock);
  1671. return self;
  1672. },
  1673. source: unescape('ifFalse%3A%20aBlock%20ifTrue%3A%20anotherBlock%0A%09%5Eself%20ifTrue%3A%20anotherBlock%20ifFalse%3A%20aBlock%0A')}),
  1674. smalltalk.Boolean);
  1675. smalltalk.addMethod(
  1676. '_ifTrue_ifFalse_',
  1677. smalltalk.method({
  1678. selector: 'ifTrue:ifFalse:',
  1679. category: 'controlling',
  1680. fn: function (aBlock, anotherBlock) {
  1681. var self = this;
  1682. return function () {if (self == true) {return aBlock();} else {return anotherBlock();}}();
  1683. return self;
  1684. },
  1685. source: unescape('ifTrue%3A%20aBlock%20ifFalse%3A%20anotherBlock%0A%09%5E%7B%27%0A%09%20%20%20%20if%28self%20%3D%3D%20true%29%20%7B%0A%09%09return%20aBlock%28%29%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20anotherBlock%28%29%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  1686. smalltalk.Boolean);
  1687. smalltalk.addMethod(
  1688. '_and_',
  1689. smalltalk.method({
  1690. selector: 'and:',
  1691. category: 'controlling',
  1692. fn: function (aBlock) {
  1693. var self = this;
  1694. return self.__eq(true)._ifTrue_ifFalse_(aBlock, function () {return false;});
  1695. return self;
  1696. },
  1697. source: unescape('and%3A%20aBlock%0A%09%5Eself%20%3D%20true%0A%09%20%20%20%20ifTrue%3A%20aBlock%0A%09%20%20%20%20ifFalse%3A%20%5Bfalse%5D%0A')}),
  1698. smalltalk.Boolean);
  1699. smalltalk.addMethod(
  1700. '_or_',
  1701. smalltalk.method({
  1702. selector: 'or:',
  1703. category: 'controlling',
  1704. fn: function (aBlock) {
  1705. var self = this;
  1706. return self.__eq(true)._ifTrue_ifFalse_(function () {return true;}, aBlock);
  1707. return self;
  1708. },
  1709. source: unescape('or%3A%20aBlock%0A%09%5Eself%20%3D%20true%0A%09%20%20%20%20ifTrue%3A%20%5Btrue%5D%0A%09%20%20%20%20ifFalse%3A%20aBlock%0A')}),
  1710. smalltalk.Boolean);
  1711. smalltalk.addMethod(
  1712. '_not',
  1713. smalltalk.method({
  1714. selector: 'not',
  1715. category: 'controlling',
  1716. fn: function () {
  1717. var self = this;
  1718. return self.__eq(false);
  1719. return self;
  1720. },
  1721. source: unescape('not%0A%09%5Eself%20%3D%20false%0A')}),
  1722. smalltalk.Boolean);
  1723. smalltalk.addMethod(
  1724. '_printString',
  1725. smalltalk.method({
  1726. selector: 'printString',
  1727. category: 'printing',
  1728. fn: function () {
  1729. var self = this;
  1730. return function () {return self.toString();}();
  1731. return self;
  1732. },
  1733. source: unescape('printString%0A%09%5E%7B%27return%20self.toString%28%29%27%7D%0A')}),
  1734. smalltalk.Boolean);
  1735. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel');
  1736. smalltalk.addMethod(
  1737. '_subclass_instanceVariableNames_',
  1738. smalltalk.method({
  1739. selector: 'subclass:instanceVariableNames:',
  1740. category: 'class creation',
  1741. fn: function (aString, anotherString) {
  1742. var self = this;
  1743. return self._subclass_instanceVariableNames_category_(aString, anotherString, nil);
  1744. return self;
  1745. },
  1746. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%0A%09%5Eself%20subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%20category%3A%20nil%0A')}),
  1747. smalltalk.UndefinedObject);
  1748. smalltalk.addMethod(
  1749. '_subclass_instanceVariableNames_category_',
  1750. smalltalk.method({
  1751. selector: 'subclass:instanceVariableNames:category:',
  1752. category: 'class creation',
  1753. fn: function (aString, aString2, aString3) {
  1754. var self = this;
  1755. return smalltalk.ClassBuilder._new()._superclass_subclass_instanceVariableNames_category_(self, aString, aString2, aString3);
  1756. return self;
  1757. },
  1758. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%5EClassBuilder%20new%0A%09%20%20%20%20superclass%3A%20self%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A')}),
  1759. smalltalk.UndefinedObject);
  1760. smalltalk.addMethod(
  1761. '_shallowCopy',
  1762. smalltalk.method({
  1763. selector: 'shallowCopy',
  1764. category: 'copying',
  1765. fn: function () {
  1766. var self = this;
  1767. return self;
  1768. return self;
  1769. },
  1770. source: unescape('shallowCopy%0A%09%5Eself%0A')}),
  1771. smalltalk.UndefinedObject);
  1772. smalltalk.addMethod(
  1773. '_deepCopy',
  1774. smalltalk.method({
  1775. selector: 'deepCopy',
  1776. category: 'copying',
  1777. fn: function () {
  1778. var self = this;
  1779. return self;
  1780. return self;
  1781. },
  1782. source: unescape('deepCopy%0A%09%5Eself%0A')}),
  1783. smalltalk.UndefinedObject);
  1784. smalltalk.addMethod(
  1785. '_ifNil_',
  1786. smalltalk.method({
  1787. selector: 'ifNil:',
  1788. category: 'testing',
  1789. fn: function (aBlock) {
  1790. var self = this;
  1791. return self._ifNil_ifNotNil_(aBlock, function () {return nil;});
  1792. return self;
  1793. },
  1794. source: unescape('ifNil%3A%20aBlock%0A%09%5Eself%20ifNil%3A%20aBlock%20ifNotNil%3A%20%5B%5D%0A')}),
  1795. smalltalk.UndefinedObject);
  1796. smalltalk.addMethod(
  1797. '_ifNotNil_',
  1798. smalltalk.method({
  1799. selector: 'ifNotNil:',
  1800. category: 'testing',
  1801. fn: function (aBlock) {
  1802. var self = this;
  1803. return self;
  1804. return self;
  1805. },
  1806. source: unescape('ifNotNil%3A%20aBlock%0A%09%5Eself%0A')}),
  1807. smalltalk.UndefinedObject);
  1808. smalltalk.addMethod(
  1809. '_ifNil_ifNotNil_',
  1810. smalltalk.method({
  1811. selector: 'ifNil:ifNotNil:',
  1812. category: 'testing',
  1813. fn: function (aBlock, anotherBlock) {
  1814. var self = this;
  1815. return aBlock._value();
  1816. return self;
  1817. },
  1818. source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%5EaBlock%20value%0A')}),
  1819. smalltalk.UndefinedObject);
  1820. smalltalk.addMethod(
  1821. '_ifNotNil_ifNil_',
  1822. smalltalk.method({
  1823. selector: 'ifNotNil:ifNil:',
  1824. category: 'testing',
  1825. fn: function (aBlock, anotherBlock) {
  1826. var self = this;
  1827. return anotherBlock._value();
  1828. return self;
  1829. },
  1830. source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%5EanotherBlock%20value%0A')}),
  1831. smalltalk.UndefinedObject);
  1832. smalltalk.addMethod(
  1833. '_isNil',
  1834. smalltalk.method({
  1835. selector: 'isNil',
  1836. category: 'testing',
  1837. fn: function () {
  1838. var self = this;
  1839. return true;
  1840. return self;
  1841. },
  1842. source: unescape('isNil%0A%09%5Etrue%0A')}),
  1843. smalltalk.UndefinedObject);
  1844. smalltalk.addMethod(
  1845. '_notNil',
  1846. smalltalk.method({
  1847. selector: 'notNil',
  1848. category: 'testing',
  1849. fn: function () {
  1850. var self = this;
  1851. return false;
  1852. return self;
  1853. },
  1854. source: unescape('notNil%0A%09%5Efalse%0A')}),
  1855. smalltalk.UndefinedObject);
  1856. smalltalk.addMethod(
  1857. '_printString',
  1858. smalltalk.method({
  1859. selector: 'printString',
  1860. category: 'printing',
  1861. fn: function () {
  1862. var self = this;
  1863. return "nil";
  1864. return self;
  1865. },
  1866. source: unescape('printString%0A%20%20%20%20%5E%27nil%27%0A')}),
  1867. smalltalk.UndefinedObject);
  1868. smalltalk.addMethod(
  1869. '_new',
  1870. smalltalk.method({
  1871. selector: 'new',
  1872. category: 'instance creation',
  1873. fn: function () {
  1874. var self = this;
  1875. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  1876. return self;
  1877. },
  1878. source: unescape('new%0A%09%20%20%20%20self%20error%3A%20%27You%20cannot%20create%20new%20instances%20of%20UndefinedObject.%20Use%20nil%27%0A')}),
  1879. smalltalk.UndefinedObject.klass);
  1880. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel');
  1881. smalltalk.addMethod(
  1882. '_size',
  1883. smalltalk.method({
  1884. selector: 'size',
  1885. category: 'accessing',
  1886. fn: function () {
  1887. var self = this;
  1888. self._subclassResponsibility();
  1889. return self;
  1890. },
  1891. source: unescape('size%0A%09self%20subclassResponsibility%0A')}),
  1892. smalltalk.Collection);
  1893. smalltalk.addMethod(
  1894. '_at_',
  1895. smalltalk.method({
  1896. selector: 'at:',
  1897. category: 'accessing',
  1898. fn: function (anIndex) {
  1899. var self = this;
  1900. return self._at_ifAbsent_(anIndex, function () {return self._errorNotFound();});
  1901. return self;
  1902. },
  1903. source: unescape('at%3A%20anIndex%0A%09%5Eself%20at%3A%20anIndex%20ifAbsent%3A%20%5B%0A%09%20%20%20%20self%20errorNotFound%5D%0A')}),
  1904. smalltalk.Collection);
  1905. smalltalk.addMethod(
  1906. '_at_put_',
  1907. smalltalk.method({
  1908. selector: 'at:put:',
  1909. category: 'accessing',
  1910. fn: function (anIndex, anObject) {
  1911. var self = this;
  1912. self._subclassResponsibility();
  1913. return self;
  1914. },
  1915. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%09self%20subclassResponsibility%0A')}),
  1916. smalltalk.Collection);
  1917. smalltalk.addMethod(
  1918. '_at_ifAbsent_',
  1919. smalltalk.method({
  1920. selector: 'at:ifAbsent:',
  1921. category: 'accessing',
  1922. fn: function (anIndex, aBlock) {
  1923. var self = this;
  1924. self._subclassResponsibility();
  1925. return self;
  1926. },
  1927. source: unescape('at%3A%20anIndex%20ifAbsent%3A%20aBlock%0A%09self%20subclassResponsibility%0A')}),
  1928. smalltalk.Collection);
  1929. smalltalk.addMethod(
  1930. '_first',
  1931. smalltalk.method({
  1932. selector: 'first',
  1933. category: 'accessing',
  1934. fn: function () {
  1935. var self = this;
  1936. return self._at_(1);
  1937. return self;
  1938. },
  1939. source: unescape('first%0A%09%5Eself%20at%3A%201%0A')}),
  1940. smalltalk.Collection);
  1941. smalltalk.addMethod(
  1942. '_second',
  1943. smalltalk.method({
  1944. selector: 'second',
  1945. category: 'accessing',
  1946. fn: function () {
  1947. var self = this;
  1948. return self._at_(2);
  1949. return self;
  1950. },
  1951. source: unescape('second%0A%09%5Eself%20at%3A%202%0A')}),
  1952. smalltalk.Collection);
  1953. smalltalk.addMethod(
  1954. '_third',
  1955. smalltalk.method({
  1956. selector: 'third',
  1957. category: 'accessing',
  1958. fn: function () {
  1959. var self = this;
  1960. return self._at_(3);
  1961. return self;
  1962. },
  1963. source: unescape('third%0A%09%5Eself%20at%3A%203%0A')}),
  1964. smalltalk.Collection);
  1965. smalltalk.addMethod(
  1966. '_fourth',
  1967. smalltalk.method({
  1968. selector: 'fourth',
  1969. category: 'accessing',
  1970. fn: function () {
  1971. var self = this;
  1972. return self._at_(4);
  1973. return self;
  1974. },
  1975. source: unescape('fourth%0A%09%5Eself%20at%3A%204%0A')}),
  1976. smalltalk.Collection);
  1977. smalltalk.addMethod(
  1978. '_last',
  1979. smalltalk.method({
  1980. selector: 'last',
  1981. category: 'accessing',
  1982. fn: function () {
  1983. var self = this;
  1984. return self._at_(self._size());
  1985. return self;
  1986. },
  1987. source: unescape('last%0A%09%5Eself%20at%3A%20self%20size%0A')}),
  1988. smalltalk.Collection);
  1989. smalltalk.addMethod(
  1990. '_readStream',
  1991. smalltalk.method({
  1992. selector: 'readStream',
  1993. category: 'accessing',
  1994. fn: function () {
  1995. var self = this;
  1996. return self._stream();
  1997. return self;
  1998. },
  1999. source: unescape('readStream%0A%09%5Eself%20stream%0A')}),
  2000. smalltalk.Collection);
  2001. smalltalk.addMethod(
  2002. '_writeStream',
  2003. smalltalk.method({
  2004. selector: 'writeStream',
  2005. category: 'accessing',
  2006. fn: function () {
  2007. var self = this;
  2008. return self._stream();
  2009. return self;
  2010. },
  2011. source: unescape('writeStream%0A%09%5Eself%20stream%0A')}),
  2012. smalltalk.Collection);
  2013. smalltalk.addMethod(
  2014. '_stream',
  2015. smalltalk.method({
  2016. selector: 'stream',
  2017. category: 'accessing',
  2018. fn: function () {
  2019. var self = this;
  2020. return self._streamClass()._on_(self);
  2021. return self;
  2022. },
  2023. source: unescape('stream%0A%09%5Eself%20streamClass%20on%3A%20self%0A')}),
  2024. smalltalk.Collection);
  2025. smalltalk.addMethod(
  2026. '_streamClass',
  2027. smalltalk.method({
  2028. selector: 'streamClass',
  2029. category: 'accessing',
  2030. fn: function () {
  2031. var self = this;
  2032. return self._class()._streamClass();
  2033. return self;
  2034. },
  2035. source: unescape('streamClass%0A%09%5Eself%20class%20streamClass%0A')}),
  2036. smalltalk.Collection);
  2037. smalltalk.addMethod(
  2038. '_add_',
  2039. smalltalk.method({
  2040. selector: 'add:',
  2041. category: 'adding/removing',
  2042. fn: function (anObject) {
  2043. var self = this;
  2044. self._subclassResponsibility();
  2045. return self;
  2046. },
  2047. source: unescape('add%3A%20anObject%0A%09self%20subclassResponsibility%0A')}),
  2048. smalltalk.Collection);
  2049. smalltalk.addMethod(
  2050. '_addAll_',
  2051. smalltalk.method({
  2052. selector: 'addAll:',
  2053. category: 'adding/removing',
  2054. fn: function (aCollection) {
  2055. var self = this;
  2056. aCollection._do_(function (each) {return self._add_(each);});
  2057. return aCollection;
  2058. return self;
  2059. },
  2060. source: unescape('addAll%3A%20aCollection%0A%09aCollection%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20self%20add%3A%20each%5D.%0A%09%5EaCollection%0A')}),
  2061. smalltalk.Collection);
  2062. smalltalk.addMethod(
  2063. '__comma',
  2064. smalltalk.method({
  2065. selector: ',',
  2066. category: 'copying',
  2067. fn: function (aCollection) {
  2068. var self = this;
  2069. return function ($rec) {$rec._addAll_(aCollection);return $rec._yourself();}(self._copy());
  2070. return self;
  2071. },
  2072. source: unescape('%2C%20aCollection%0A%09%5Eself%20copy%20%0A%09%20%20%20%20addAll%3A%20aCollection%3B%20%0A%09%20%20%20%20yourself%0A')}),
  2073. smalltalk.Collection);
  2074. smalltalk.addMethod(
  2075. '_copyFrom_to_',
  2076. smalltalk.method({
  2077. selector: 'copyFrom:to:',
  2078. category: 'copying',
  2079. fn: function (anIndex, anotherIndex) {
  2080. var self = this;
  2081. self._subclassResponsibility();
  2082. return self;
  2083. },
  2084. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09self%20subclassResponsibility%0A')}),
  2085. smalltalk.Collection);
  2086. smalltalk.addMethod(
  2087. '_copyWith_',
  2088. smalltalk.method({
  2089. selector: 'copyWith:',
  2090. category: 'copying',
  2091. fn: function (anObject) {
  2092. var self = this;
  2093. return function ($rec) {$rec._add_(anObject);return $rec._yourself();}(self._copy());
  2094. return self;
  2095. },
  2096. source: unescape('copyWith%3A%20anObject%0A%09%5Eself%20copy%20add%3A%20anObject%3B%20yourself%0A')}),
  2097. smalltalk.Collection);
  2098. smalltalk.addMethod(
  2099. '_copyWithAll_',
  2100. smalltalk.method({
  2101. selector: 'copyWithAll:',
  2102. category: 'copying',
  2103. fn: function (aCollection) {
  2104. var self = this;
  2105. return function ($rec) {$rec._addAll_(aCollection);return $rec._yourself();}(self._copy());
  2106. return self;
  2107. },
  2108. source: unescape('copyWithAll%3A%20aCollection%0A%09%5Eself%20copy%20addAll%3A%20aCollection%3B%20yourself%0A')}),
  2109. smalltalk.Collection);
  2110. smalltalk.addMethod(
  2111. '_asArray',
  2112. smalltalk.method({
  2113. selector: 'asArray',
  2114. category: 'converting',
  2115. fn: function () {
  2116. var self = this;
  2117. var array = nil;
  2118. var index = nil;
  2119. array = smalltalk.Array._new();
  2120. index = 0;
  2121. self._do_(function (each) {index = index.__plus(1);return array._at_put_(index, each);});
  2122. return array;
  2123. return self;
  2124. },
  2125. source: unescape('asArray%0A%09%7C%20array%20index%20%7C%0A%09array%20%3A%3D%20Array%20new.%0A%09index%20%3A%3D%200.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20index%20%3A%3D%20index%20+%201.%0A%09%20%20%20%20array%20at%3A%20index%20put%3A%20each%5D.%0A%09%5Earray%0A')}),
  2126. smalltalk.Collection);
  2127. smalltalk.addMethod(
  2128. '_do_',
  2129. smalltalk.method({
  2130. selector: 'do:',
  2131. category: 'enumerating',
  2132. fn: function (aBlock) {
  2133. var self = this;
  2134. (function () {for (var i = 0; i < self.length; i++) {aBlock(self[i]);}}());
  2135. return self;
  2136. },
  2137. source: unescape('do%3A%20aBlock%0A%09%7B%27for%28var%20i%3D0%3Bi%3Cself.length%3Bi++%29%7BaBlock%28self%5Bi%5D%29%3B%7D%27%7D%0A')}),
  2138. smalltalk.Collection);
  2139. smalltalk.addMethod(
  2140. '_collect_',
  2141. smalltalk.method({
  2142. selector: 'collect:',
  2143. category: 'enumerating',
  2144. fn: function (aBlock) {
  2145. var self = this;
  2146. var stream = nil;
  2147. stream = self._class()._new()._writeStream();
  2148. self._do_(function (each) {return stream._nextPut_(aBlock._value_(each));});
  2149. return stream._contents();
  2150. return self;
  2151. },
  2152. source: unescape('collect%3A%20aBlock%0A%09%7C%20stream%20%7C%0A%09stream%20%3A%3D%20self%20class%20new%20writeStream.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20stream%20nextPut%3A%20%28aBlock%20value%3A%20each%29%5D.%0A%09%5Estream%20contents%0A')}),
  2153. smalltalk.Collection);
  2154. smalltalk.addMethod(
  2155. '_detect_',
  2156. smalltalk.method({
  2157. selector: 'detect:',
  2158. category: 'enumerating',
  2159. fn: function (aBlock) {
  2160. var self = this;
  2161. return self._detect_ifNone_(aBlock, function () {return self._errorNotFound();});
  2162. return self;
  2163. },
  2164. source: unescape('detect%3A%20aBlock%0A%09%5Eself%20detect%3A%20aBlock%20ifNone%3A%20%5Bself%20errorNotFound%5D%0A')}),
  2165. smalltalk.Collection);
  2166. smalltalk.addMethod(
  2167. '_detect_ifNone_',
  2168. smalltalk.method({
  2169. selector: 'detect:ifNone:',
  2170. category: 'enumerating',
  2171. fn: function (aBlock, anotherBlock) {
  2172. var self = this;
  2173. return function () {for (var i = 0; i < self.length; i++) {if (aBlock(self[i])) {return self[i];}}return anotherBlock();}();
  2174. return self;
  2175. },
  2176. source: unescape('detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A%09%5E%7B%27%0A%09for%28var%20i%20%3D%200%3B%20i%20%3C%20self.length%3B%20i++%29%0A%09%09if%28aBlock%28self%5Bi%5D%29%29%0A%09%09%09return%20self%5Bi%5D%3B%0A%09return%20anotherBlock%28%29%3B%0A%09%27%7D%0A')}),
  2177. smalltalk.Collection);
  2178. smalltalk.addMethod(
  2179. '_do_separatedBy_',
  2180. smalltalk.method({
  2181. selector: 'do:separatedBy:',
  2182. category: 'enumerating',
  2183. fn: function (aBlock, anotherBlock) {
  2184. var self = this;
  2185. var first = nil;
  2186. first = true;
  2187. self._do_(function (each) {first._ifTrue_ifFalse_(function () {return first = false;}, function () {return anotherBlock._value();});return aBlock._value_(each);});
  2188. return self;
  2189. },
  2190. source: unescape('do%3A%20aBlock%20separatedBy%3A%20anotherBlock%0A%20%20%20%20%09%7C%20first%20%7C%0A%20%20%20%20%09first%20%3A%3D%20true.%0A%20%20%20%20%09self%20do%3A%20%5B%3Aeach%20%7C%0A%20%20%20%20%09%20%20%20%20first%0A%20%20%20%20%09%09ifTrue%3A%20%5Bfirst%20%3A%3D%20false%5D%0A%20%20%20%20%09%09ifFalse%3A%20%5BanotherBlock%20value%5D.%0A%20%20%20%20%09%20%20%20%20aBlock%20value%3A%20each%5D%0A')}),
  2191. smalltalk.Collection);
  2192. smalltalk.addMethod(
  2193. '_inject_into_',
  2194. smalltalk.method({
  2195. selector: 'inject:into:',
  2196. category: 'enumerating',
  2197. fn: function (anObject, aBlock) {
  2198. var self = this;
  2199. var result = nil;
  2200. result = anObject;
  2201. self._do_(function (each) {return result = aBlock._value_value_(result, each);});
  2202. return result;
  2203. return self;
  2204. },
  2205. source: unescape('inject%3A%20anObject%20into%3A%20aBlock%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%20anObject.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%20%0A%09%20%20%20%20result%20%3A%3D%20aBlock%20value%3A%20result%20value%3A%20each%5D.%0A%09%5Eresult%0A')}),
  2206. smalltalk.Collection);
  2207. smalltalk.addMethod(
  2208. '_reject_',
  2209. smalltalk.method({
  2210. selector: 'reject:',
  2211. category: 'enumerating',
  2212. fn: function (aBlock) {
  2213. var self = this;
  2214. return self._select_(function (each) {return aBlock._value_(each).__eq(false);});
  2215. return self;
  2216. },
  2217. source: unescape('reject%3A%20aBlock%0A%09%5Eself%20select%3A%20%5B%3Aeach%20%7C%20%28aBlock%20value%3A%20each%29%20%3D%20false%5D%0A')}),
  2218. smalltalk.Collection);
  2219. smalltalk.addMethod(
  2220. '_select_',
  2221. smalltalk.method({
  2222. selector: 'select:',
  2223. category: 'enumerating',
  2224. fn: function (aBlock) {
  2225. var self = this;
  2226. var stream = nil;
  2227. stream = self._class()._new()._writeStream();
  2228. self._do_(function (each) {return aBlock._value_(each)._ifTrue_(function () {return stream._nextPut_(each);});});
  2229. return stream._contents();
  2230. return self;
  2231. },
  2232. source: unescape('select%3A%20aBlock%0A%09%7C%20stream%20%7C%0A%09stream%20%3A%3D%20self%20class%20new%20writeStream.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20%28aBlock%20value%3A%20each%29%20ifTrue%3A%20%5B%0A%09%09stream%20nextPut%3A%20each%5D%5D.%0A%09%5Estream%20contents%0A')}),
  2233. smalltalk.Collection);
  2234. smalltalk.addMethod(
  2235. '_errorNotFound',
  2236. smalltalk.method({
  2237. selector: 'errorNotFound',
  2238. category: 'error handling',
  2239. fn: function () {
  2240. var self = this;
  2241. self._error_("Object is not in the collection");
  2242. return self;
  2243. },
  2244. source: unescape('errorNotFound%0A%09self%20error%3A%20%27Object%20is%20not%20in%20the%20collection%27%0A')}),
  2245. smalltalk.Collection);
  2246. smalltalk.addMethod(
  2247. '_includes_',
  2248. smalltalk.method({
  2249. selector: 'includes:',
  2250. category: 'testing',
  2251. fn: function (anObject) {
  2252. var self = this;
  2253. return function () {var i = self.length;while (i--) {if (self[i].__eq(anObject)) {return true;}}return false;}();
  2254. return self;
  2255. },
  2256. source: unescape('includes%3A%20anObject%0A%09%5E%7B%27%0A%09%09var%20i%20%3D%20self.length%3B%0A%09%09while%20%28i--%29%20%7B%0A%09%09%09if%20%28self%5Bi%5D.__eq%28anObject%29%29%20%7B%0A%09%09%09%09return%20true%3B%0A%09%09%09%7D%09%0A%09%09%7D%0A%09%09return%20false%3B%0A%0A%09%27%7D%0A')}),
  2257. smalltalk.Collection);
  2258. smalltalk.addMethod(
  2259. '_notEmpty',
  2260. smalltalk.method({
  2261. selector: 'notEmpty',
  2262. category: 'testing',
  2263. fn: function () {
  2264. var self = this;
  2265. return self._isEmpty()._not();
  2266. return self;
  2267. },
  2268. source: unescape('notEmpty%0A%09%5Eself%20isEmpty%20not%0A')}),
  2269. smalltalk.Collection);
  2270. smalltalk.addMethod(
  2271. '_isEmpty',
  2272. smalltalk.method({
  2273. selector: 'isEmpty',
  2274. category: 'testing',
  2275. fn: function () {
  2276. var self = this;
  2277. return self._size().__eq(0);
  2278. return self;
  2279. },
  2280. source: unescape('isEmpty%0A%09%5Eself%20size%20%3D%200%0A')}),
  2281. smalltalk.Collection);
  2282. smalltalk.addMethod(
  2283. '_remove_',
  2284. smalltalk.method({
  2285. selector: 'remove:',
  2286. category: 'adding/removing',
  2287. fn: function (anObject) {
  2288. var self = this;
  2289. self._subclassResponsibility();
  2290. return self;
  2291. },
  2292. source: unescape('remove%3A%20anObject%0A%20%20%20%20self%20subclassResponsibility%0A')}),
  2293. smalltalk.Collection);
  2294. smalltalk.addMethod(
  2295. '_streamClass',
  2296. smalltalk.method({
  2297. selector: 'streamClass',
  2298. category: 'accessing',
  2299. fn: function () {
  2300. var self = this;
  2301. return smalltalk.Stream;
  2302. return self;
  2303. },
  2304. source: unescape('streamClass%0A%09%20%20%20%20%5EStream%0A')}),
  2305. smalltalk.Collection.klass);
  2306. smalltalk.addMethod(
  2307. '_with_',
  2308. smalltalk.method({
  2309. selector: 'with:',
  2310. category: 'instance creation',
  2311. fn: function (anObject) {
  2312. var self = this;
  2313. return function ($rec) {$rec._add_(anObject);return $rec._yourself();}(self._new());
  2314. return self;
  2315. },
  2316. source: unescape('with%3A%20anObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20anObject%3B%0A%09%09yourself%0A')}),
  2317. smalltalk.Collection.klass);
  2318. smalltalk.addMethod(
  2319. '_with_with_',
  2320. smalltalk.method({
  2321. selector: 'with:with:',
  2322. category: 'instance creation',
  2323. fn: function (anObject, anotherObject) {
  2324. var self = this;
  2325. return function ($rec) {$rec._add_(anObject);$rec._add_(anotherObject);return $rec._yourself();}(self._new());
  2326. return self;
  2327. },
  2328. source: unescape('with%3A%20anObject%20with%3A%20anotherObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20anObject%3B%0A%09%09add%3A%20anotherObject%3B%0A%09%09yourself%0A')}),
  2329. smalltalk.Collection.klass);
  2330. smalltalk.addMethod(
  2331. '_with_with_with_',
  2332. smalltalk.method({
  2333. selector: 'with:with:with:',
  2334. category: 'instance creation',
  2335. fn: function (firstObject, secondObject, thirdObject) {
  2336. var self = this;
  2337. return function ($rec) {$rec._add_(firstObject);$rec._add_(secondObject);$rec._add_(thirdObject);return $rec._yourself();}(self._new());
  2338. return self;
  2339. },
  2340. source: unescape('with%3A%20firstObject%20with%3A%20secondObject%20with%3A%20thirdObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20firstObject%3B%0A%09%09add%3A%20secondObject%3B%0A%09%09add%3A%20thirdObject%3B%0A%09%09yourself%0A')}),
  2341. smalltalk.Collection.klass);
  2342. smalltalk.addMethod(
  2343. '_withAll_',
  2344. smalltalk.method({
  2345. selector: 'withAll:',
  2346. category: 'instance creation',
  2347. fn: function (aCollection) {
  2348. var self = this;
  2349. return function ($rec) {$rec._addAll_(aCollection);return $rec._yourself();}(self._new());
  2350. return self;
  2351. },
  2352. source: unescape('withAll%3A%20aCollection%0A%09%20%20%20%20%5Eself%20new%0A%09%09addAll%3A%20aCollection%3B%0A%09%09yourself%0A')}),
  2353. smalltalk.Collection.klass);
  2354. smalltalk.addClass('String', smalltalk.Collection, [], 'Kernel');
  2355. smalltalk.addMethod(
  2356. '__eq',
  2357. smalltalk.method({
  2358. selector: '=',
  2359. category: 'comparing',
  2360. fn: function (aString) {
  2361. var self = this;
  2362. return function () {return String(self) == aString;}();
  2363. return self;
  2364. },
  2365. source: unescape('%3D%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3D%3D%20aString%27%7D%0A')}),
  2366. smalltalk.String);
  2367. smalltalk.addMethod(
  2368. '_size',
  2369. smalltalk.method({
  2370. selector: 'size',
  2371. category: 'accessing',
  2372. fn: function () {
  2373. var self = this;
  2374. return function () {return self.length;}();
  2375. return self;
  2376. },
  2377. source: unescape('size%0A%09%5E%7B%27return%20self.length%27%7D%0A')}),
  2378. smalltalk.String);
  2379. smalltalk.addMethod(
  2380. '_at_',
  2381. smalltalk.method({
  2382. selector: 'at:',
  2383. category: 'accessing',
  2384. fn: function (anIndex) {
  2385. var self = this;
  2386. return function () {return self[anIndex - 1] || nil;}();
  2387. return self;
  2388. },
  2389. source: unescape('at%3A%20anIndex%0A%20%20%20%20%09%5E%7B%27return%20self%5BanIndex%20-%201%5D%20%7C%7C%20nil%3B%27%7D%0A')}),
  2390. smalltalk.String);
  2391. smalltalk.addMethod(
  2392. '_at_put_',
  2393. smalltalk.method({
  2394. selector: 'at:put:',
  2395. category: 'accessing',
  2396. fn: function (anIndex, anObject) {
  2397. var self = this;
  2398. self._errorReadOnly();
  2399. return self;
  2400. },
  2401. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%20%20%20%20%09self%20errorReadOnly%0A')}),
  2402. smalltalk.String);
  2403. smalltalk.addMethod(
  2404. '_at_ifAbsent_',
  2405. smalltalk.method({
  2406. selector: 'at:ifAbsent:',
  2407. category: 'accessing',
  2408. fn: function (anIndex, aBlock) {
  2409. var self = this;
  2410. self._at_(anIndex)._ifNil_(function () {return aBlock;});
  2411. return self;
  2412. },
  2413. source: unescape('at%3A%20anIndex%20ifAbsent%3A%20aBlock%0A%20%20%20%20%09%28self%20at%3A%20anIndex%29%20ifNil%3A%20%5BaBlock%5D%0A')}),
  2414. smalltalk.String);
  2415. smalltalk.addMethod(
  2416. '_escaped',
  2417. smalltalk.method({
  2418. selector: 'escaped',
  2419. category: 'accessing',
  2420. fn: function () {
  2421. var self = this;
  2422. return function () {return escape(self);}();
  2423. return self;
  2424. },
  2425. source: unescape('escaped%0A%09%5E%7B%27return%20escape%28self%29%27%7D%0A')}),
  2426. smalltalk.String);
  2427. smalltalk.addMethod(
  2428. '_unescaped',
  2429. smalltalk.method({
  2430. selector: 'unescaped',
  2431. category: 'accessing',
  2432. fn: function () {
  2433. var self = this;
  2434. return function () {return unescape(self);}();
  2435. return self;
  2436. },
  2437. source: unescape('unescaped%0A%09%5E%7B%27return%20unescape%28self%29%27%7D%0A')}),
  2438. smalltalk.String);
  2439. smalltalk.addMethod(
  2440. '_add_',
  2441. smalltalk.method({
  2442. selector: 'add:',
  2443. category: 'adding',
  2444. fn: function (anObject) {
  2445. var self = this;
  2446. self._errorReadOnly();
  2447. return self;
  2448. },
  2449. source: unescape('add%3A%20anObject%0A%20%20%20%20%09self%20errorReadOnly%0A')}),
  2450. smalltalk.String);
  2451. smalltalk.addMethod(
  2452. '__comma',
  2453. smalltalk.method({
  2454. selector: ',',
  2455. category: 'copying',
  2456. fn: function (aString) {
  2457. var self = this;
  2458. return function () {return self + aString;}();
  2459. return self;
  2460. },
  2461. source: unescape('%2C%20aString%0A%20%20%20%20%09%5E%7B%27return%20self%20+%20aString%27%7D%0A')}),
  2462. smalltalk.String);
  2463. smalltalk.addMethod(
  2464. '_copyFrom_to_',
  2465. smalltalk.method({
  2466. selector: 'copyFrom:to:',
  2467. category: 'copying',
  2468. fn: function (anIndex, anotherIndex) {
  2469. var self = this;
  2470. return function () {return self.substring(anIndex - 1, anotherIndex);}();
  2471. return self;
  2472. },
  2473. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%20%20%20%20%09%5E%7B%27return%20self.substring%28anIndex%20-%201%2C%20anotherIndex%29%3B%27%7D%0A')}),
  2474. smalltalk.String);
  2475. smalltalk.addMethod(
  2476. '_shallowCopy',
  2477. smalltalk.method({
  2478. selector: 'shallowCopy',
  2479. category: 'copying',
  2480. fn: function () {
  2481. var self = this;
  2482. return self._class()._fromString_(self);
  2483. return self;
  2484. },
  2485. source: unescape('shallowCopy%0A%20%20%20%20%09%5Eself%20class%20fromString%3A%20self%0A')}),
  2486. smalltalk.String);
  2487. smalltalk.addMethod(
  2488. '_deepCopy',
  2489. smalltalk.method({
  2490. selector: 'deepCopy',
  2491. category: 'copying',
  2492. fn: function () {
  2493. var self = this;
  2494. return self._shallowCopy();
  2495. return self;
  2496. },
  2497. source: unescape('deepCopy%0A%20%20%20%20%09%5Eself%20shallowCopy%0A')}),
  2498. smalltalk.String);
  2499. smalltalk.addMethod(
  2500. '_asSelector',
  2501. smalltalk.method({
  2502. selector: 'asSelector',
  2503. category: 'converting',
  2504. fn: function () {
  2505. var self = this;
  2506. var selector = nil;
  2507. selector = "_".__comma(self);
  2508. selector = selector._replace_with_(":", "_");
  2509. selector = selector._replace_with_(unescape("%5B+%5D"), "_plus");
  2510. selector = selector._replace_with_(unescape("-"), "_minus");
  2511. selector = selector._replace_with_(unescape("%5B*%5D"), "_star");
  2512. selector = selector._replace_with_(unescape("%5B/%5D"), "_slash");
  2513. selector = selector._replace_with_(unescape("%3E"), "_gt");
  2514. selector = selector._replace_with_(unescape("%3C"), "_lt");
  2515. selector = selector._replace_with_(unescape("%3D"), "_eq");
  2516. selector = selector._replace_with_(unescape("%2C"), "_comma");
  2517. selector = selector._replace_with_(unescape("%5B@%5D"), "_at");
  2518. return selector;
  2519. return self;
  2520. },
  2521. source: unescape('asSelector%0A%09%7C%20selector%20%7C%0A%09selector%20%3A%3D%20%27_%27%2C%20self.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3A%27%20with%3A%20%27_%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B+%5D%27%20with%3A%20%27_plus%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27-%27%20with%3A%20%27_minus%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B*%5D%27%20with%3A%20%27_star%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B/%5D%27%20with%3A%20%27_slash%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3E%27%20with%3A%20%27_gt%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3C%27%20with%3A%20%27_lt%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3D%27%20with%3A%20%27_eq%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%2C%27%20with%3A%20%27_comma%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B@%5D%27%20with%3A%20%27_at%27.%0A%09%5Eselector%0A')}),
  2522. smalltalk.String);
  2523. smalltalk.addMethod(
  2524. '_asJavascript',
  2525. smalltalk.method({
  2526. selector: 'asJavascript',
  2527. category: 'converting',
  2528. fn: function () {
  2529. var self = this;
  2530. return function () {if (self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1) {return "unescape(\"" + escape(self) + "\")";} else {return "\"" + self + "\"";}}();
  2531. return self;
  2532. },
  2533. source: unescape('asJavascript%0A%09%5E%7B%27%0A%09if%28self.search%28/%5E%5Ba-zA-Z0-9_%3A.%24%20%5D*%24/%29%20%3D%3D%20-1%29%0A%09%09return%20%22unescape%28%5C%22%22%20+%20escape%28self%29%20+%20%22%5C%22%29%22%3B%0A%09else%0A%09%09return%20%22%5C%22%22%20+%20self%20+%20%22%5C%22%22%3B%0A%09%27%7D%0A')}),
  2534. smalltalk.String);
  2535. smalltalk.addMethod(
  2536. '_replace_with_',
  2537. smalltalk.method({
  2538. selector: 'replace:with:',
  2539. category: 'regular expressions',
  2540. fn: function (aString, anotherString) {
  2541. var self = this;
  2542. return self._replaceRegexp_with_(smalltalk.RegularExpression._fromString_flag_(aString, "g"), anotherString);
  2543. return self;
  2544. },
  2545. source: unescape('replace%3A%20aString%20with%3A%20anotherString%0A%20%20%20%20%09%5Eself%20replaceRegexp%3A%20%28RegularExpression%20fromString%3A%20aString%20flag%3A%20%27g%27%29%20with%3A%20anotherString%0A')}),
  2546. smalltalk.String);
  2547. smalltalk.addMethod(
  2548. '_replaceRegexp_with_',
  2549. smalltalk.method({
  2550. selector: 'replaceRegexp:with:',
  2551. category: 'regular expressions',
  2552. fn: function (aRegexp, aString) {
  2553. var self = this;
  2554. return function () {return self.replace(aRegexp, aString);}();
  2555. return self;
  2556. },
  2557. source: unescape('replaceRegexp%3A%20aRegexp%20with%3A%20aString%0A%20%20%20%20%09%5E%7B%27return%20self.replace%28aRegexp%2C%20aString%29%3B%27%7D%0A')}),
  2558. smalltalk.String);
  2559. smalltalk.addMethod(
  2560. '_tokenize_',
  2561. smalltalk.method({
  2562. selector: 'tokenize:',
  2563. category: 'converting',
  2564. fn: function (aString) {
  2565. var self = this;
  2566. return function () {return self.split(aString);}();
  2567. return self;
  2568. },
  2569. source: unescape('tokenize%3A%20aString%0A%09%5E%7B%27return%20self.split%28aString%29%27%7D%0A')}),
  2570. smalltalk.String);
  2571. smalltalk.addMethod(
  2572. '_match_',
  2573. smalltalk.method({
  2574. selector: 'match:',
  2575. category: 'regular expressions',
  2576. fn: function (aRegexp) {
  2577. var self = this;
  2578. return function () {return self.search(aRegexp) != -1;}();
  2579. return self;
  2580. },
  2581. source: unescape('match%3A%20aRegexp%0A%20%20%20%20%09%5E%7B%27return%20self.search%28aRegexp%29%20%21%3D%20-1%27%7D%0A')}),
  2582. smalltalk.String);
  2583. smalltalk.addMethod(
  2584. '_asString',
  2585. smalltalk.method({
  2586. selector: 'asString',
  2587. category: 'converting',
  2588. fn: function () {
  2589. var self = this;
  2590. return self;
  2591. return self;
  2592. },
  2593. source: unescape('asString%0A%20%20%20%20%09%5Eself%0A')}),
  2594. smalltalk.String);
  2595. smalltalk.addMethod(
  2596. '_asNumber',
  2597. smalltalk.method({
  2598. selector: 'asNumber',
  2599. category: 'converting',
  2600. fn: function () {
  2601. var self = this;
  2602. return function () {return Number(self);}();
  2603. return self;
  2604. },
  2605. source: unescape('asNumber%0A%09%5E%7B%27return%20Number%28self%29%3B%27%7D%0A')}),
  2606. smalltalk.String);
  2607. smalltalk.addMethod(
  2608. '_asParser',
  2609. smalltalk.method({
  2610. selector: 'asParser',
  2611. category: 'converting',
  2612. fn: function () {
  2613. var self = this;
  2614. return smalltalk.PPStringParser._new()._string_(self);
  2615. return self;
  2616. },
  2617. source: unescape('asParser%0A%20%20%20%20%09%5EPPStringParser%20new%20string%3A%20self%0A')}),
  2618. smalltalk.String);
  2619. smalltalk.addMethod(
  2620. '_asChoiceParser',
  2621. smalltalk.method({
  2622. selector: 'asChoiceParser',
  2623. category: 'converting',
  2624. fn: function () {
  2625. var self = this;
  2626. return smalltalk.PPChoiceParser._withAll_(self._asArray()._collect_(function (each) {return each._asParser();}));
  2627. return self;
  2628. },
  2629. source: unescape('asChoiceParser%0A%20%20%20%20%09%5EPPChoiceParser%20withAll%3A%20%28self%20asArray%20collect%3A%20%5B%3Aeach%20%7C%20each%20asParser%5D%29%0A')}),
  2630. smalltalk.String);
  2631. smalltalk.addMethod(
  2632. '_asCharacterParser',
  2633. smalltalk.method({
  2634. selector: 'asCharacterParser',
  2635. category: 'converting',
  2636. fn: function () {
  2637. var self = this;
  2638. return smalltalk.PPCharacterParser._new()._string_(self);
  2639. return self;
  2640. },
  2641. source: unescape('asCharacterParser%0A%20%20%20%20%09%5EPPCharacterParser%20new%20string%3A%20self%0A')}),
  2642. smalltalk.String);
  2643. smalltalk.addMethod(
  2644. '_errorReadOnly',
  2645. smalltalk.method({
  2646. selector: 'errorReadOnly',
  2647. category: 'error handling',
  2648. fn: function () {
  2649. var self = this;
  2650. self._error_(unescape("Object%20is%20read-only"));
  2651. return self;
  2652. },
  2653. source: unescape('errorReadOnly%0A%20%20%20%20%09self%20error%3A%20%27Object%20is%20read-only%27%0A')}),
  2654. smalltalk.String);
  2655. smalltalk.addMethod(
  2656. '_printString',
  2657. smalltalk.method({
  2658. selector: 'printString',
  2659. category: 'printing',
  2660. fn: function () {
  2661. var self = this;
  2662. return unescape("%27").__comma(self).__comma(unescape("%27"));
  2663. return self;
  2664. },
  2665. source: unescape('printString%0A%20%20%20%20%09%5E%27%27%27%27%2C%20self%2C%20%27%27%27%27%0A')}),
  2666. smalltalk.String);
  2667. smalltalk.addMethod(
  2668. '_printNl',
  2669. smalltalk.method({
  2670. selector: 'printNl',
  2671. category: 'printing',
  2672. fn: function () {
  2673. var self = this;
  2674. (function () {console.log(self);}());
  2675. return self;
  2676. },
  2677. source: unescape('printNl%0A%09%7B%27console.log%28self%29%27%7D%0A')}),
  2678. smalltalk.String);
  2679. smalltalk.addMethod(
  2680. '_isString',
  2681. smalltalk.method({
  2682. selector: 'isString',
  2683. category: 'testing',
  2684. fn: function () {
  2685. var self = this;
  2686. return true;
  2687. return self;
  2688. },
  2689. source: unescape('isString%0A%20%20%20%20%09%5Etrue%0A')}),
  2690. smalltalk.String);
  2691. smalltalk.addMethod(
  2692. '_asJQuery',
  2693. smalltalk.method({
  2694. selector: 'asJQuery',
  2695. category: '*JQuery',
  2696. fn: function () {
  2697. var self = this;
  2698. return smalltalk.JQuery._fromString_(self);
  2699. return self;
  2700. },
  2701. source: unescape('asJQuery%0A%20%20%20%20%5EJQuery%20fromString%3A%20self%0A')}),
  2702. smalltalk.String);
  2703. smalltalk.addMethod(
  2704. '_appendToJQuery_',
  2705. smalltalk.method({
  2706. selector: 'appendToJQuery:',
  2707. category: '*JQuery',
  2708. fn: function (aJQuery) {
  2709. var self = this;
  2710. (function () {aJQuery._appendElement_(String(self));}());
  2711. return self;
  2712. },
  2713. source: unescape('appendToJQuery%3A%20aJQuery%0A%20%20%20%20%7B%27aJQuery._appendElement_%28String%28self%29%29%27%7D%0A')}),
  2714. smalltalk.String);
  2715. smalltalk.addMethod(
  2716. '_appendToBrush_',
  2717. smalltalk.method({
  2718. selector: 'appendToBrush:',
  2719. category: '*Canvas',
  2720. fn: function (aTagBrush) {
  2721. var self = this;
  2722. aTagBrush._appendString_(self);
  2723. return self;
  2724. },
  2725. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20appendString%3A%20self%0A')}),
  2726. smalltalk.String);
  2727. smalltalk.addMethod(
  2728. '__gt',
  2729. smalltalk.method({
  2730. selector: '>',
  2731. category: 'comparing',
  2732. fn: function (aString) {
  2733. var self = this;
  2734. return function () {return String(self) > aString;}();
  2735. return self;
  2736. },
  2737. source: unescape('%3E%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3E%20aString%27%7D%0A')}),
  2738. smalltalk.String);
  2739. smalltalk.addMethod(
  2740. '__lt',
  2741. smalltalk.method({
  2742. selector: '<',
  2743. category: 'comparing',
  2744. fn: function (aString) {
  2745. var self = this;
  2746. return function () {return String(self) < aString;}();
  2747. return self;
  2748. },
  2749. source: unescape('%3C%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3C%20aString%27%7D%0A')}),
  2750. smalltalk.String);
  2751. smalltalk.addMethod(
  2752. '__gt_eq',
  2753. smalltalk.method({
  2754. selector: '>=',
  2755. category: 'comparing',
  2756. fn: function (aString) {
  2757. var self = this;
  2758. return function () {return String(self) >= aString;}();
  2759. return self;
  2760. },
  2761. source: unescape('%3E%3D%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3E%3D%20aString%27%7D%0A')}),
  2762. smalltalk.String);
  2763. smalltalk.addMethod(
  2764. '__lt_eq',
  2765. smalltalk.method({
  2766. selector: '<=',
  2767. category: 'comparing',
  2768. fn: function (aString) {
  2769. var self = this;
  2770. return function () {return String(self) <= aString;}();
  2771. return self;
  2772. },
  2773. source: unescape('%3C%3D%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3C%3D%20aString%27%7D%0A')}),
  2774. smalltalk.String);
  2775. smalltalk.addMethod(
  2776. '_remove_',
  2777. smalltalk.method({
  2778. selector: 'remove:',
  2779. category: 'adding',
  2780. fn: function (anObject) {
  2781. var self = this;
  2782. self._errorReadOnly();
  2783. return self;
  2784. },
  2785. source: unescape('remove%3A%20anObject%0A%20%20%20%20self%20errorReadOnly%0A')}),
  2786. smalltalk.String);
  2787. smalltalk.addMethod(
  2788. '_streamClass',
  2789. smalltalk.method({
  2790. selector: 'streamClass',
  2791. category: 'accessing',
  2792. fn: function () {
  2793. var self = this;
  2794. return smalltalk.StringStream;
  2795. return self;
  2796. },
  2797. source: unescape('streamClass%0A%09%20%20%20%20%5EStringStream%0A')}),
  2798. smalltalk.String.klass);
  2799. smalltalk.addMethod(
  2800. '_fromString_',
  2801. smalltalk.method({
  2802. selector: 'fromString:',
  2803. category: 'instance creation',
  2804. fn: function (aString) {
  2805. var self = this;
  2806. return function () {return new self.fn(aString);}();
  2807. return self;
  2808. },
  2809. source: unescape('fromString%3A%20aString%0A%09%20%20%20%20%5E%7B%27return%20new%20self.fn%28aString%29%3B%27%7D%0A')}),
  2810. smalltalk.String.klass);
  2811. smalltalk.addMethod(
  2812. '_cr',
  2813. smalltalk.method({
  2814. selector: 'cr',
  2815. category: 'accessing',
  2816. fn: function () {
  2817. var self = this;
  2818. return function () {return "\n";}();
  2819. return self;
  2820. },
  2821. source: unescape('cr%0A%09%20%20%20%20%5E%7B%27%7Breturn%20%27%27%5Cn%27%27%7D%3B%27%7D%0A')}),
  2822. smalltalk.String.klass);
  2823. smalltalk.addMethod(
  2824. '_lf',
  2825. smalltalk.method({
  2826. selector: 'lf',
  2827. category: 'accessing',
  2828. fn: function () {
  2829. var self = this;
  2830. return function () {return "\r";}();
  2831. return self;
  2832. },
  2833. source: unescape('lf%0A%09%20%20%20%20%5E%7B%27return%20%27%27%5Cr%27%27%3B%27%7D%0A')}),
  2834. smalltalk.String.klass);
  2835. smalltalk.addMethod(
  2836. '_space',
  2837. smalltalk.method({
  2838. selector: 'space',
  2839. category: 'accessing',
  2840. fn: function () {
  2841. var self = this;
  2842. return function () {return " ";}();
  2843. return self;
  2844. },
  2845. source: unescape('space%0A%09%20%20%20%20%5E%7B%27return%20%27%27%20%27%27%3B%27%7D%0A')}),
  2846. smalltalk.String.klass);
  2847. smalltalk.addMethod(
  2848. '_tab',
  2849. smalltalk.method({
  2850. selector: 'tab',
  2851. category: 'accessing',
  2852. fn: function () {
  2853. var self = this;
  2854. return function () {return "\t";}();
  2855. return self;
  2856. },
  2857. source: unescape('tab%0A%09%20%20%20%20%5E%7B%27return%20%27%27%5Ct%27%27%3B%27%7D%0A')}),
  2858. smalltalk.String.klass);
  2859. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel');
  2860. smalltalk.addMethod(
  2861. '_compile_',
  2862. smalltalk.method({
  2863. selector: 'compile:',
  2864. category: 'evaluating',
  2865. fn: function (aString) {
  2866. var self = this;
  2867. return function () {return self.compile(aString);}();
  2868. return self;
  2869. },
  2870. source: unescape('compile%3A%20aString%0A%09%5E%7B%27return%20self.compile%28aString%29%3B%27%7D%0A')}),
  2871. smalltalk.RegularExpression);
  2872. smalltalk.addMethod(
  2873. '_exec_',
  2874. smalltalk.method({
  2875. selector: 'exec:',
  2876. category: 'evaluating',
  2877. fn: function (aString) {
  2878. var self = this;
  2879. return function () {return self.exec(aString);}();
  2880. return self;
  2881. },
  2882. source: unescape('exec%3A%20aString%0A%09%5E%7B%27return%20self.exec%28aString%29%3B%27%7D%0A')}),
  2883. smalltalk.RegularExpression);
  2884. smalltalk.addMethod(
  2885. '_test_',
  2886. smalltalk.method({
  2887. selector: 'test:',
  2888. category: 'evaluating',
  2889. fn: function (aString) {
  2890. var self = this;
  2891. return function () {return self.test(aString);}();
  2892. return self;
  2893. },
  2894. source: unescape('test%3A%20aString%0A%09%5E%7B%27return%20self.test%28aString%29%3B%27%7D%0A')}),
  2895. smalltalk.RegularExpression);
  2896. smalltalk.addMethod(
  2897. '_fromString_flag_',
  2898. smalltalk.method({
  2899. selector: 'fromString:flag:',
  2900. category: 'instance creation',
  2901. fn: function (aString, anotherString) {
  2902. var self = this;
  2903. return function () {return new RegExp(aString, anotherString);}();
  2904. return self;
  2905. },
  2906. source: unescape('fromString%3A%20aString%20flag%3A%20anotherString%0A%09%20%20%20%20%5E%7B%27return%20new%20RegExp%28aString%2C%20anotherString%29%3B%27%7D%0A')}),
  2907. smalltalk.RegularExpression.klass);
  2908. smalltalk.addMethod(
  2909. '_fromString_',
  2910. smalltalk.method({
  2911. selector: 'fromString:',
  2912. category: 'instance creation',
  2913. fn: function (aString) {
  2914. var self = this;
  2915. return self._fromString_flag_(aString, "");
  2916. return self;
  2917. },
  2918. source: unescape('fromString%3A%20aString%0A%09%20%20%20%20%5Eself%20fromString%3A%20aString%20flag%3A%20%27%27%0A')}),
  2919. smalltalk.RegularExpression.klass);
  2920. smalltalk.addClass('Array', smalltalk.Collection, [], 'Kernel');
  2921. smalltalk.addMethod(
  2922. '_size',
  2923. smalltalk.method({
  2924. selector: 'size',
  2925. category: 'accessing',
  2926. fn: function () {
  2927. var self = this;
  2928. return function () {return self.length;}();
  2929. return self;
  2930. },
  2931. source: unescape('size%0A%09%5E%7B%27return%20self.length%27%7D%0A')}),
  2932. smalltalk.Array);
  2933. smalltalk.addMethod(
  2934. '_at_put_',
  2935. smalltalk.method({
  2936. selector: 'at:put:',
  2937. category: 'accessing',
  2938. fn: function (anIndex, anObject) {
  2939. var self = this;
  2940. return function () {return self[anIndex - 1] = anObject;}();
  2941. return self;
  2942. },
  2943. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%09%5E%7B%27return%20self%5BanIndex%20-%201%5D%20%3D%20anObject%27%7D%0A')}),
  2944. smalltalk.Array);
  2945. smalltalk.addMethod(
  2946. '_at_ifAbsent_',
  2947. smalltalk.method({
  2948. selector: 'at:ifAbsent:',
  2949. category: 'accessing',
  2950. fn: function (anIndex, aBlock) {
  2951. var self = this;
  2952. return function () {var value = self[anIndex - 1];if (value === undefined) {return aBlock();} else {return value;}}();
  2953. return self;
  2954. },
  2955. source: unescape('at%3A%20anIndex%20ifAbsent%3A%20aBlock%0A%09%5E%7B%27%0A%09%20%20%20%20var%20value%20%3D%20self%5BanIndex%20-%201%5D%3B%0A%09%20%20%20%20if%28value%20%3D%3D%3D%20undefined%29%20%7B%0A%09%09return%20aBlock%28%29%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20value%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  2956. smalltalk.Array);
  2957. smalltalk.addMethod(
  2958. '_add_',
  2959. smalltalk.method({
  2960. selector: 'add:',
  2961. category: 'adding',
  2962. fn: function (anObject) {
  2963. var self = this;
  2964. return function () {self.push(anObject);return anObject;}();
  2965. return self;
  2966. },
  2967. source: unescape('add%3A%20anObject%0A%09%5E%7B%27self.push%28anObject%29%3B%20return%20anObject%3B%27%7D%0A')}),
  2968. smalltalk.Array);
  2969. smalltalk.addMethod(
  2970. '_addLast_',
  2971. smalltalk.method({
  2972. selector: 'addLast:',
  2973. category: 'adding',
  2974. fn: function (anObject) {
  2975. var self = this;
  2976. return self._add_(anObject);
  2977. return self;
  2978. },
  2979. source: unescape('addLast%3A%20anObject%0A%09%5Eself%20add%3A%20anObject%0A')}),
  2980. smalltalk.Array);
  2981. smalltalk.addMethod(
  2982. '_shallowCopy',
  2983. smalltalk.method({
  2984. selector: 'shallowCopy',
  2985. category: 'copying',
  2986. fn: function () {
  2987. var self = this;
  2988. var newCollection = nil;
  2989. newCollection = self._class()._new();
  2990. self._do_(function (each) {return newCollection._add_(each);});
  2991. return newCollection;
  2992. return self;
  2993. },
  2994. source: unescape('shallowCopy%0A%09%7C%20newCollection%20%7C%0A%09newCollection%20%3A%3D%20self%20class%20new.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%20newCollection%20add%3A%20each%5D.%0A%09%5EnewCollection%0A')}),
  2995. smalltalk.Array);
  2996. smalltalk.addMethod(
  2997. '_deepCopy',
  2998. smalltalk.method({
  2999. selector: 'deepCopy',
  3000. category: 'copying',
  3001. fn: function () {
  3002. var self = this;
  3003. var newCollection = nil;
  3004. newCollection = self._class()._new();
  3005. self._do_(function (each) {return newCollection._add_(each._deepCopy());});
  3006. return newCollection;
  3007. return self;
  3008. },
  3009. source: unescape('deepCopy%0A%09%7C%20newCollection%20%7C%0A%09newCollection%20%3A%3D%20self%20class%20new.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%20newCollection%20add%3A%20each%20deepCopy%5D.%0A%09%5EnewCollection%0A')}),
  3010. smalltalk.Array);
  3011. smalltalk.addMethod(
  3012. '_copyFrom_to_',
  3013. smalltalk.method({
  3014. selector: 'copyFrom:to:',
  3015. category: 'copying',
  3016. fn: function (anIndex, anotherIndex) {
  3017. var self = this;
  3018. var array = nil;
  3019. array = self._class()._new();
  3020. anIndex._to_do_(anotherIndex, function (each) {return array._add_(self._at_(each));});
  3021. return array;
  3022. return self;
  3023. },
  3024. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09%7C%20array%20%7C%0A%09array%20%3A%3D%20self%20class%20new.%0A%09anIndex%20to%3A%20anotherIndex%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20array%20add%3A%20%28self%20at%3A%20each%29%5D.%0A%09%5Earray%0A')}),
  3025. smalltalk.Array);
  3026. smalltalk.addMethod(
  3027. '_join_',
  3028. smalltalk.method({
  3029. selector: 'join:',
  3030. category: 'enumerating',
  3031. fn: function (aString) {
  3032. var self = this;
  3033. return function () {return self.join(aString);}();
  3034. return self;
  3035. },
  3036. source: unescape('join%3A%20aString%0A%09%5E%7B%27return%20self.join%28aString%29%3B%27%7D%0A')}),
  3037. smalltalk.Array);
  3038. smalltalk.addMethod(
  3039. '_asJavascript',
  3040. smalltalk.method({
  3041. selector: 'asJavascript',
  3042. category: 'converting',
  3043. fn: function () {
  3044. var self = this;
  3045. return unescape("%5B").__comma(self._collect_(function (each) {return each._asJavascript();})._join_(unescape("%2C%20"))).__comma(unescape("%5D"));
  3046. return self;
  3047. },
  3048. source: unescape('asJavascript%0A%09%5E%27%5B%27%2C%20%28%28self%20collect%3A%20%5B%3Aeach%20%7C%20each%20asJavascript%5D%29%20join%3A%20%27%2C%20%27%29%2C%20%20%27%5D%27%0A')}),
  3049. smalltalk.Array);
  3050. smalltalk.addMethod(
  3051. '_sort',
  3052. smalltalk.method({
  3053. selector: 'sort',
  3054. category: 'enumerating',
  3055. fn: function () {
  3056. var self = this;
  3057. return self._copy()._basicPerform_("sort");
  3058. return self;
  3059. },
  3060. source: unescape('sort%0A%20%20%20%20%5Eself%20copy%20basicPerform%3A%20%27sort%27%0A')}),
  3061. smalltalk.Array);
  3062. smalltalk.addMethod(
  3063. '_sort_',
  3064. smalltalk.method({
  3065. selector: 'sort:',
  3066. category: 'enumerating',
  3067. fn: function (aBlock) {
  3068. var self = this;
  3069. return self._copy()._basicPerform_withArguments_("sort", smalltalk.Array._with_(aBlock));
  3070. return self;
  3071. },
  3072. source: unescape('sort%3A%20aBlock%0A%20%20%20%20%5Eself%20copy%20basicPerform%3A%20%27sort%27%20withArguments%3A%20%28Array%20with%3A%20aBlock%29%0A')}),
  3073. smalltalk.Array);
  3074. smalltalk.addMethod(
  3075. '_remove_',
  3076. smalltalk.method({
  3077. selector: 'remove:',
  3078. category: 'adding',
  3079. fn: function (anObject) {
  3080. var self = this;
  3081. (function () {for (var i = 0; i < self.length; i++) {if (self[i] == anObject) {self.splice(i, 1);break;}}}());
  3082. return self;
  3083. },
  3084. source: unescape('remove%3A%20anObject%0A%20%20%20%20%7B%27for%28var%20i%3D0%3Bi%3Cself.length%3Bi++%29%20%7B%0A%09if%28self%5Bi%5D%20%3D%3D%20anObject%29%20%7B%0A%09%09self.splice%28i%2C1%29%3B%0A%09%09break%3B%0A%09%7D%0A%20%20%20%20%7D%27%7D%0A')}),
  3085. smalltalk.Array);
  3086. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel');
  3087. smalltalk.addMethod(
  3088. '_messageText',
  3089. smalltalk.method({
  3090. selector: 'messageText',
  3091. category: 'accessing',
  3092. fn: function () {
  3093. var self = this;
  3094. return self['@messageText'];
  3095. return self;
  3096. },
  3097. source: unescape('messageText%0A%09%5EmessageText%0A')}),
  3098. smalltalk.Error);
  3099. smalltalk.addMethod(
  3100. '_messageText_',
  3101. smalltalk.method({
  3102. selector: 'messageText:',
  3103. category: 'accessing',
  3104. fn: function (aString) {
  3105. var self = this;
  3106. self['@messageText'] = aString;
  3107. return self;
  3108. },
  3109. source: unescape('messageText%3A%20aString%0A%09messageText%20%3A%3D%20aString%0A')}),
  3110. smalltalk.Error);
  3111. smalltalk.addMethod(
  3112. '_signal',
  3113. smalltalk.method({
  3114. selector: 'signal',
  3115. category: 'signaling',
  3116. fn: function () {
  3117. var self = this;
  3118. return function () {throw {smalltalkError: self};}();
  3119. return self;
  3120. },
  3121. source: unescape('signal%0A%09%5E%7B%27throw%28%7BsmalltalkError%3A%20self%7D%29%27%7D%0A')}),
  3122. smalltalk.Error);
  3123. smalltalk.addMethod(
  3124. '_signal_',
  3125. smalltalk.method({
  3126. selector: 'signal:',
  3127. category: 'instance creation',
  3128. fn: function (aString) {
  3129. var self = this;
  3130. return function ($rec) {$rec._messageText_(aString);return $rec._signal();}(self._new());
  3131. return self;
  3132. },
  3133. source: unescape('signal%3A%20aString%0A%09%20%20%20%20%5Eself%20new%0A%09%09messageText%3A%20aString%3B%0A%09%09signal%0A')}),
  3134. smalltalk.Error.klass);
  3135. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel');
  3136. smalltalk.addMethod(
  3137. '__eq',
  3138. smalltalk.method({
  3139. selector: '=',
  3140. category: 'comparing',
  3141. fn: function (anAssociation) {
  3142. var self = this;
  3143. return self._class().__eq(anAssociation._class())._and_(function () {return self._key().__eq(anAssociation._key())._and_(function () {return self._value().__eq(anAssociation._value());});});
  3144. return self;
  3145. },
  3146. source: unescape('%3D%20anAssociation%0A%09%5Eself%20class%20%3D%20anAssociation%20class%20and%3A%20%5B%0A%09%20%20%20%20self%20key%20%3D%20anAssociation%20key%20and%3A%20%5B%0A%09%09self%20value%20%3D%20anAssociation%20value%5D%5D%0A')}),
  3147. smalltalk.Association);
  3148. smalltalk.addMethod(
  3149. '_key_',
  3150. smalltalk.method({
  3151. selector: 'key:',
  3152. category: 'accessing',
  3153. fn: function (aKey) {
  3154. var self = this;
  3155. self['@key'] = aKey;
  3156. return self;
  3157. },
  3158. source: unescape('key%3A%20aKey%0A%09key%20%3A%3D%20aKey%0A')}),
  3159. smalltalk.Association);
  3160. smalltalk.addMethod(
  3161. '_key',
  3162. smalltalk.method({
  3163. selector: 'key',
  3164. category: 'accessing',
  3165. fn: function () {
  3166. var self = this;
  3167. return self['@key'];
  3168. return self;
  3169. },
  3170. source: unescape('key%0A%09%5Ekey%0A')}),
  3171. smalltalk.Association);
  3172. smalltalk.addMethod(
  3173. '_value_',
  3174. smalltalk.method({
  3175. selector: 'value:',
  3176. category: 'accessing',
  3177. fn: function (aValue) {
  3178. var self = this;
  3179. self['@value'] = aValue;
  3180. return self;
  3181. },
  3182. source: unescape('value%3A%20aValue%0A%09value%20%3A%3D%20aValue%0A')}),
  3183. smalltalk.Association);
  3184. smalltalk.addMethod(
  3185. '_value',
  3186. smalltalk.method({
  3187. selector: 'value',
  3188. category: 'accessing',
  3189. fn: function () {
  3190. var self = this;
  3191. return self['@value'];
  3192. return self;
  3193. },
  3194. source: unescape('value%0A%09%5Evalue%0A')}),
  3195. smalltalk.Association);
  3196. smalltalk.addMethod(
  3197. '_key_value_',
  3198. smalltalk.method({
  3199. selector: 'key:value:',
  3200. category: 'instance creation',
  3201. fn: function (aKey, aValue) {
  3202. var self = this;
  3203. return function ($rec) {$rec._key_(aKey);$rec._value_(aValue);return $rec._yourself();}(self._new());
  3204. return self;
  3205. },
  3206. source: unescape('key%3A%20aKey%20value%3A%20aValue%0A%09%20%20%20%20%5Eself%20new%0A%09%09key%3A%20aKey%3B%0A%09%09value%3A%20aValue%3B%0A%09%09yourself%0A')}),
  3207. smalltalk.Association.klass);
  3208. smalltalk.addClass('Dictionary', smalltalk.Collection, ['keys'], 'Kernel');
  3209. smalltalk.addMethod(
  3210. '__eq',
  3211. smalltalk.method({
  3212. selector: '=',
  3213. category: 'comparing',
  3214. fn: function (aDictionary) {
  3215. var self = this;
  3216. try {
  3217. self._class().__eq(aDictionary._class())._ifFalse_(function () {return function () {throw {name: "stReturn", selector: "__eq", fn: function () {return false;}};}();});
  3218. self._associationsDo_(function (assoc) {return aDictionary._at_ifAbsent_(assoc._key(), function () {return function () {throw {name: "stReturn", selector: "__eq", fn: function () {return false;}};}();}).__eq(assoc._value())._ifFalse_(function () {return function () {throw {name: "stReturn", selector: "__eq", fn: function () {return false;}};}();});});
  3219. (function () {throw {name: "stReturn", selector: "__eq", fn: function () {return true;}};}());
  3220. return self;
  3221. } catch (e) {
  3222. if (e.name === "stReturn" && e.selector === "__eq") {
  3223. return e.fn();
  3224. }
  3225. throw e;
  3226. }
  3227. },
  3228. source: unescape('%3D%20aDictionary%0A%09self%20class%20%3D%20aDictionary%20class%20ifFalse%3A%20%5B%5Efalse%5D.%0A%09self%20associationsDo%3A%20%5B%3Aassoc%20%7C%0A%09%20%20%20%20%28aDictionary%20at%3A%20assoc%20key%20ifAbsent%3A%20%5B%5Efalse%5D%29%20%3D%20assoc%20value%20%0A%09%09ifFalse%3A%20%5B%5Efalse%5D%5D.%0A%09%5Etrue%0A')}),
  3229. smalltalk.Dictionary);
  3230. smalltalk.addMethod(
  3231. '_shallowCopy',
  3232. smalltalk.method({
  3233. selector: 'shallowCopy',
  3234. category: 'copying',
  3235. fn: function () {
  3236. var self = this;
  3237. var copy = nil;
  3238. copy = self._class()._new();
  3239. self._associationsDo_(function (each) {return copy._at_put_(each._key(), each._value());});
  3240. return copy;
  3241. return self;
  3242. },
  3243. source: unescape('shallowCopy%0A%09%7C%20copy%20%7C%0A%09copy%20%3A%3D%20self%20class%20new.%0A%09self%20associationsDo%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20copy%20at%3A%20each%20key%20%20put%3A%20each%20value%5D.%0A%09%5Ecopy%0A')}),
  3244. smalltalk.Dictionary);
  3245. smalltalk.addMethod(
  3246. '_initialize',
  3247. smalltalk.method({
  3248. selector: 'initialize',
  3249. category: 'initialization',
  3250. fn: function () {
  3251. var self = this;
  3252. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  3253. self['@keys'] = [];
  3254. return self;
  3255. },
  3256. source: unescape('initialize%0A%20%20%20%20%09super%20initialize.%0A%20%20%20%20%09keys%20%3A%3D%20%23%28%29%0A')}),
  3257. smalltalk.Dictionary);
  3258. smalltalk.addMethod(
  3259. '_size',
  3260. smalltalk.method({
  3261. selector: 'size',
  3262. category: 'accessing',
  3263. fn: function () {
  3264. var self = this;
  3265. return self['@keys']._size();
  3266. return self;
  3267. },
  3268. source: unescape('size%0A%09%5Ekeys%20size%0A')}),
  3269. smalltalk.Dictionary);
  3270. smalltalk.addMethod(
  3271. '_associations',
  3272. smalltalk.method({
  3273. selector: 'associations',
  3274. category: 'accessing',
  3275. fn: function () {
  3276. var self = this;
  3277. var associations = nil;
  3278. associations = [];
  3279. self['@keys']._do_(function (each) {return associations._add_(smalltalk.Association._key_value_(each, self._at_(each)));});
  3280. return associations;
  3281. return self;
  3282. },
  3283. source: unescape('associations%0A%09%7C%20associations%20%7C%0A%09associations%20%3A%3D%20%23%28%29.%0A%09keys%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20associations%20add%3A%20%28Association%20key%3A%20each%20value%3A%20%28self%20at%3A%20each%29%29%5D.%0A%09%5Eassociations%0A')}),
  3284. smalltalk.Dictionary);
  3285. smalltalk.addMethod(
  3286. '_keys',
  3287. smalltalk.method({
  3288. selector: 'keys',
  3289. category: 'accessing',
  3290. fn: function () {
  3291. var self = this;
  3292. return self['@keys']._copy();
  3293. return self;
  3294. },
  3295. source: unescape('keys%0A%09%5Ekeys%20copy%0A')}),
  3296. smalltalk.Dictionary);
  3297. smalltalk.addMethod(
  3298. '_values',
  3299. smalltalk.method({
  3300. selector: 'values',
  3301. category: 'accessing',
  3302. fn: function () {
  3303. var self = this;
  3304. return self['@keys']._collect_(function (each) {return self._at_(each);});
  3305. return self;
  3306. },
  3307. source: unescape('values%0A%20%20%20%20%09%5Ekeys%20collect%3A%20%5B%3Aeach%20%7C%20self%20at%3A%20each%5D%0A')}),
  3308. smalltalk.Dictionary);
  3309. smalltalk.addMethod(
  3310. '_at_put_',
  3311. smalltalk.method({
  3312. selector: 'at:put:',
  3313. category: 'accessing',
  3314. fn: function (aKey, aValue) {
  3315. var self = this;
  3316. self['@keys']._includes_(aKey)._ifFalse_(function () {return self['@keys']._add_(aKey);});
  3317. return self._basicAt_put_(aKey, aValue);
  3318. return self;
  3319. },
  3320. source: unescape('at%3A%20aKey%20put%3A%20aValue%0A%09%28keys%20includes%3A%20aKey%29%20ifFalse%3A%20%5Bkeys%20add%3A%20aKey%5D.%0A%09%5Eself%20basicAt%3A%20aKey%20put%3A%20aValue%0A')}),
  3321. smalltalk.Dictionary);
  3322. smalltalk.addMethod(
  3323. '_at_ifAbsent_',
  3324. smalltalk.method({
  3325. selector: 'at:ifAbsent:',
  3326. category: 'accessing',
  3327. fn: function (aKey, aBlock) {
  3328. var self = this;
  3329. return self._basicAt_(aKey)._ifNil_(aBlock);
  3330. return self;
  3331. },
  3332. source: unescape('at%3A%20aKey%20ifAbsent%3A%20aBlock%0A%09%5E%28self%20basicAt%3A%20aKey%29%20ifNil%3A%20aBlock%0A')}),
  3333. smalltalk.Dictionary);
  3334. smalltalk.addMethod(
  3335. '_at_ifAbsentPut_',
  3336. smalltalk.method({
  3337. selector: 'at:ifAbsentPut:',
  3338. category: 'accessing',
  3339. fn: function (aKey, aBlock) {
  3340. var self = this;
  3341. return self._at_ifAbsent_(aKey, function () {return self._at_put_(aKey, aBlock._value());});
  3342. return self;
  3343. },
  3344. source: unescape('at%3A%20aKey%20ifAbsentPut%3A%20aBlock%0A%20%20%20%20%09%5Eself%20at%3A%20aKey%20ifAbsent%3A%20%5B%0A%20%20%20%20%09%20%20%20%20self%20at%3A%20aKey%20put%3A%20aBlock%20value%5D%0A')}),
  3345. smalltalk.Dictionary);
  3346. smalltalk.addMethod(
  3347. '_at_ifPresent_',
  3348. smalltalk.method({
  3349. selector: 'at:ifPresent:',
  3350. category: 'accessing',
  3351. fn: function (aKey, aBlock) {
  3352. var self = this;
  3353. return self._basicAt_(aKey)._ifNotNil_(function () {return aBlock._value_(self._at_(aKey));});
  3354. return self;
  3355. },
  3356. source: unescape('at%3A%20aKey%20ifPresent%3A%20aBlock%0A%09%5E%28self%20basicAt%3A%20aKey%29%20ifNotNil%3A%20%5BaBlock%20value%3A%20%28self%20at%3A%20aKey%29%5D%0A')}),
  3357. smalltalk.Dictionary);
  3358. smalltalk.addMethod(
  3359. '_at_ifPresent_ifAbsent_',
  3360. smalltalk.method({
  3361. selector: 'at:ifPresent:ifAbsent:',
  3362. category: 'accessing',
  3363. fn: function (aKey, aBlock, anotherBlock) {
  3364. var self = this;
  3365. return self._basicAt_(aKey)._ifNil_ifNotNil_(anotherBlock, function () {return aBlock._value_(self._at_(aKey));});
  3366. return self;
  3367. },
  3368. source: unescape('at%3A%20aKey%20ifPresent%3A%20aBlock%20ifAbsent%3A%20anotherBlock%0A%09%5E%28self%20basicAt%3A%20aKey%29%0A%09%20%20%20%20ifNil%3A%20anotherBlock%0A%09%20%20%20%20ifNotNil%3A%20%5BaBlock%20value%3A%20%28self%20at%3A%20aKey%29%5D%0A')}),
  3369. smalltalk.Dictionary);
  3370. smalltalk.addMethod(
  3371. '_add_',
  3372. smalltalk.method({
  3373. selector: 'add:',
  3374. category: 'adding/removing',
  3375. fn: function (anAssociation) {
  3376. var self = this;
  3377. self._at_put_(anAssociation._key(), anAssociation._value());
  3378. return self;
  3379. },
  3380. source: unescape('add%3A%20anAssociation%0A%20%20%20%20%09self%20at%3A%20anAssociation%20key%20put%3A%20anAssociation%20value%0A')}),
  3381. smalltalk.Dictionary);
  3382. smalltalk.addMethod(
  3383. '_addAll_',
  3384. smalltalk.method({
  3385. selector: 'addAll:',
  3386. category: 'adding/removing',
  3387. fn: function (aDictionary) {
  3388. var self = this;
  3389. self.klass.superclass.fn.prototype._addAll_.apply(self, [aDictionary._associations()]);
  3390. return aDictionary;
  3391. return self;
  3392. },
  3393. source: unescape('addAll%3A%20aDictionary%0A%20%20%20%20%09super%20addAll%3A%20aDictionary%20associations.%0A%20%20%20%20%09%5EaDictionary%0A')}),
  3394. smalltalk.Dictionary);
  3395. smalltalk.addMethod(
  3396. '__comma',
  3397. smalltalk.method({
  3398. selector: ',',
  3399. category: 'copying',
  3400. fn: function (aCollection) {
  3401. var self = this;
  3402. self._shouldNotImplement();
  3403. return self;
  3404. },
  3405. source: unescape('%2C%20aCollection%0A%09self%20shouldNotImplement%0A')}),
  3406. smalltalk.Dictionary);
  3407. smalltalk.addMethod(
  3408. '_copyFrom_to_',
  3409. smalltalk.method({
  3410. selector: 'copyFrom:to:',
  3411. category: 'copying',
  3412. fn: function (anIndex, anotherIndex) {
  3413. var self = this;
  3414. self._shouldNotImplement();
  3415. return self;
  3416. },
  3417. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09self%20shouldNotImplement%0A')}),
  3418. smalltalk.Dictionary);
  3419. smalltalk.addMethod(
  3420. '_associationsDo_',
  3421. smalltalk.method({
  3422. selector: 'associationsDo:',
  3423. category: 'enumerating',
  3424. fn: function (aBlock) {
  3425. var self = this;
  3426. self._associations()._do_(aBlock);
  3427. return self;
  3428. },
  3429. source: unescape('associationsDo%3A%20aBlock%0A%20%20%20%20%09self%20associations%20do%3A%20aBlock%0A')}),
  3430. smalltalk.Dictionary);
  3431. smalltalk.addMethod(
  3432. '_keysAndValuesDo_',
  3433. smalltalk.method({
  3434. selector: 'keysAndValuesDo:',
  3435. category: 'enumerating',
  3436. fn: function (aBlock) {
  3437. var self = this;
  3438. self._associationsDo_(function (each) {return aBlock._value_value_(each._key(), each._value());});
  3439. return self;
  3440. },
  3441. source: unescape('keysAndValuesDo%3A%20aBlock%0A%20%20%20%20%09self%20associationsDo%3A%20%5B%3Aeach%20%7C%0A%20%20%20%20%09%20%20%20%20aBlock%20value%3A%20each%20key%20value%3A%20each%20value%5D%0A')}),
  3442. smalltalk.Dictionary);
  3443. smalltalk.addMethod(
  3444. '_do_',
  3445. smalltalk.method({
  3446. selector: 'do:',
  3447. category: 'enumerating',
  3448. fn: function (aBlock) {
  3449. var self = this;
  3450. self._values()._do_(aBlock);
  3451. return self;
  3452. },
  3453. source: unescape('do%3A%20aBlock%0A%20%20%20%20%09self%20values%20do%3A%20aBlock%0A')}),
  3454. smalltalk.Dictionary);
  3455. smalltalk.addMethod(
  3456. '_select_',
  3457. smalltalk.method({
  3458. selector: 'select:',
  3459. category: 'enumerating',
  3460. fn: function (aBlock) {
  3461. var self = this;
  3462. var newDict = nil;
  3463. newDict = self._class()._new();
  3464. self._keysAndValuesDo_(function (key, value) {return aBlock._value_(value)._ifTrue_(function () {return newDict._at_put_(key, value);});});
  3465. return newDict;
  3466. return self;
  3467. },
  3468. source: unescape('select%3A%20aBlock%0A%20%20%20%20%09%7C%20newDict%20%7C%0A%20%20%20%20%09newDict%20%3A%3D%20self%20class%20new.%0A%20%20%20%20%09self%20keysAndValuesDo%3A%20%5B%3Akey%20%3Avalue%20%7C%0A%20%20%20%20%09%20%20%20%20%28aBlock%20value%3A%20value%29%20ifTrue%3A%20%5BnewDict%20at%3A%20key%20put%3A%20value%5D%5D.%0A%20%20%20%20%09%5EnewDict%0A')}),
  3469. smalltalk.Dictionary);
  3470. smalltalk.addMethod(
  3471. '_collect_',
  3472. smalltalk.method({
  3473. selector: 'collect:',
  3474. category: 'enumerating',
  3475. fn: function (aBlock) {
  3476. var self = this;
  3477. var newDict = nil;
  3478. newDict = self._class()._new();
  3479. self._keysAndValuesDo_(function (key, value) {return aBlock._value_(value)._ifTrue_(function () {return newDict._at_put_(key, value);});});
  3480. return newDict;
  3481. return self;
  3482. },
  3483. source: unescape('collect%3A%20aBlock%0A%20%20%20%20%09%7C%20newDict%20%7C%0A%20%20%20%20%09newDict%20%3A%3D%20self%20class%20new.%0A%20%20%20%20%09self%20keysAndValuesDo%3A%20%5B%3Akey%20%3Avalue%20%7C%0A%20%20%20%20%09%20%20%20%20%28aBlock%20value%3A%20value%29%20ifTrue%3A%20%5BnewDict%20at%3A%20key%20put%3A%20value%5D%5D.%0A%20%20%20%20%09%5EnewDict%0A')}),
  3484. smalltalk.Dictionary);
  3485. smalltalk.addMethod(
  3486. '_detect_ifNone_',
  3487. smalltalk.method({
  3488. selector: 'detect:ifNone:',
  3489. category: 'enumerating',
  3490. fn: function (aBlock, anotherBlock) {
  3491. var self = this;
  3492. return self._values()._detect_ifNone_(aBlock, anotherBlock);
  3493. return self;
  3494. },
  3495. source: unescape('detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A%09%5Eself%20values%20detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A')}),
  3496. smalltalk.Dictionary);
  3497. smalltalk.addMethod(
  3498. '_includes_',
  3499. smalltalk.method({
  3500. selector: 'includes:',
  3501. category: 'enumerating',
  3502. fn: function (anObject) {
  3503. var self = this;
  3504. return self._values()._includes_(anObject);
  3505. return self;
  3506. },
  3507. source: unescape('includes%3A%20anObject%0A%09%5Eself%20values%20includes%3A%20anObject%0A')}),
  3508. smalltalk.Dictionary);
  3509. smalltalk.addMethod(
  3510. '_remove_',
  3511. smalltalk.method({
  3512. selector: 'remove:',
  3513. category: 'adding/removing',
  3514. fn: function (aKey) {
  3515. var self = this;
  3516. self._removeKey_(aKey);
  3517. return self;
  3518. },
  3519. source: unescape('remove%3A%20aKey%0A%20%20%20%20self%20removeKey%3A%20aKey%0A')}),
  3520. smalltalk.Dictionary);
  3521. smalltalk.addMethod(
  3522. '_removeKey_',
  3523. smalltalk.method({
  3524. selector: 'removeKey:',
  3525. category: 'adding/removing',
  3526. fn: function (aKey) {
  3527. var self = this;
  3528. self['@keys']._remove_(aKey);
  3529. return self;
  3530. },
  3531. source: unescape('removeKey%3A%20aKey%0A%20%20%20%20keys%20remove%3A%20aKey%0A')}),
  3532. smalltalk.Dictionary);
  3533. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel');
  3534. smalltalk.addMethod(
  3535. '_superclass_subclass_',
  3536. smalltalk.method({
  3537. selector: 'superclass:subclass:',
  3538. category: 'class creation',
  3539. fn: function (aClass, aString) {
  3540. var self = this;
  3541. self._superclass_subclass_instanceVariableNames_category_(aClass, aString, "", nil);
  3542. return self;
  3543. },
  3544. source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%0A%09self%20superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20%27%27%20category%3A%20nil%0A')}),
  3545. smalltalk.ClassBuilder);
  3546. smalltalk.addMethod(
  3547. '_superclass_subclass_instanceVariableNames_category_',
  3548. smalltalk.method({
  3549. selector: 'superclass:subclass:instanceVariableNames:category:',
  3550. category: 'class creation',
  3551. fn: function (aClass, aString, aString2, aString3) {
  3552. var self = this;
  3553. var newClass = nil;
  3554. newClass = self._addSubclassOf_named_instanceVariableNames_(aClass, aString, self._instanceVariableNamesFor_(aString2));
  3555. self._setupClass_(newClass);
  3556. newClass._category_(aString3._ifNil_(function () {return "unclassified";}));
  3557. return self;
  3558. },
  3559. source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%7C%20newClass%20%7C%0A%09newClass%20%3A%3D%20self%20addSubclassOf%3A%20aClass%20named%3A%20aString%20instanceVariableNames%3A%20%28self%20instanceVariableNamesFor%3A%20aString2%29.%0A%09self%20setupClass%3A%20newClass.%0A%09newClass%20category%3A%20%28aString3%20ifNil%3A%20%5B%27unclassified%27%5D%29%0A')}),
  3560. smalltalk.ClassBuilder);
  3561. smalltalk.addMethod(
  3562. '_class_instanceVariableNames_',
  3563. smalltalk.method({
  3564. selector: 'class:instanceVariableNames:',
  3565. category: 'class creation',
  3566. fn: function (aClass, aString) {
  3567. var self = this;
  3568. aClass._isMetaclass()._ifFalse_(function () {return self._error_(aClass._name().__comma(" is not a metaclass"));});
  3569. aClass._basicAt_put_("iVarNames", self._instanceVariableNamesFor_(aString));
  3570. self._setupClass_(aClass);
  3571. return self;
  3572. },
  3573. source: unescape('class%3A%20aClass%20instanceVariableNames%3A%20aString%0A%09aClass%20isMetaclass%20ifFalse%3A%20%5Bself%20error%3A%20aClass%20name%2C%20%27%20is%20not%20a%20metaclass%27%5D.%0A%09aClass%20basicAt%3A%20%27iVarNames%27%20put%3A%20%28self%20instanceVariableNamesFor%3A%20aString%29.%0A%09self%20setupClass%3A%20aClass%0A')}),
  3574. smalltalk.ClassBuilder);
  3575. smalltalk.addMethod(
  3576. '_instanceVariableNamesFor_',
  3577. smalltalk.method({
  3578. selector: 'instanceVariableNamesFor:',
  3579. category: 'private',
  3580. fn: function (aString) {
  3581. var self = this;
  3582. return aString._tokenize_(" ")._reject_(function (each) {return each._isEmpty();});
  3583. return self;
  3584. },
  3585. source: unescape('instanceVariableNamesFor%3A%20aString%0A%09%5E%28aString%20tokenize%3A%20%27%20%27%29%20reject%3A%20%5B%3Aeach%20%7C%20each%20isEmpty%5D%0A')}),
  3586. smalltalk.ClassBuilder);
  3587. smalltalk.addMethod(
  3588. '_addSubclassOf_named_instanceVariableNames_',
  3589. smalltalk.method({
  3590. selector: 'addSubclassOf:named:instanceVariableNames:',
  3591. category: 'private',
  3592. fn: function (aClass, aString, aCollection) {
  3593. var self = this;
  3594. return function () {smalltalk.addClass(aString, aClass, aCollection);return smalltalk[aString];}();
  3595. return self;
  3596. },
  3597. source: unescape('addSubclassOf%3A%20aClass%20named%3A%20aString%20instanceVariableNames%3A%20aCollection%0A%09%5E%7B%27smalltalk.addClass%28aString%2C%20aClass%2C%20aCollection%29%3B%0A%09%20%20%20%20return%20smalltalk%5BaString%5D%27%7D%0A')}),
  3598. smalltalk.ClassBuilder);
  3599. smalltalk.addMethod(
  3600. '_setupClass_',
  3601. smalltalk.method({
  3602. selector: 'setupClass:',
  3603. category: 'private',
  3604. fn: function (aClass) {
  3605. var self = this;
  3606. (function () {smalltalk.init(aClass);}());
  3607. return self;
  3608. },
  3609. source: unescape('setupClass%3A%20aClass%0A%09%7B%27smalltalk.init%28aClass%29%3B%27%7D%0A')}),
  3610. smalltalk.ClassBuilder);
  3611. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel');
  3612. smalltalk.addMethod(
  3613. '_initialize',
  3614. smalltalk.method({
  3615. selector: 'initialize',
  3616. category: 'initialization',
  3617. fn: function () {
  3618. var self = this;
  3619. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  3620. self['@chunkParser'] = smalltalk.ChunkParser._new();
  3621. return self;
  3622. },
  3623. source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.%0A')}),
  3624. smalltalk.ClassCategoryReader);
  3625. smalltalk.addMethod(
  3626. '_class_category_',
  3627. smalltalk.method({
  3628. selector: 'class:category:',
  3629. category: 'accessing',
  3630. fn: function (aClass, aString) {
  3631. var self = this;
  3632. self['@class'] = aClass;
  3633. self['@category'] = aString;
  3634. return self;
  3635. },
  3636. source: unescape('class%3A%20aClass%20category%3A%20aString%0A%09class%20%3A%3D%20aClass.%0A%09category%20%3A%3D%20aString%0A')}),
  3637. smalltalk.ClassCategoryReader);
  3638. smalltalk.addMethod(
  3639. '_scanFrom_',
  3640. smalltalk.method({
  3641. selector: 'scanFrom:',
  3642. category: 'fileIn',
  3643. fn: function (aStream) {
  3644. var self = this;
  3645. var nextChunk = nil;
  3646. nextChunk = self['@chunkParser']._emptyChunk().__slash(self['@chunkParser']._chunk())._parse_(aStream);
  3647. nextChunk._isEmptyChunk()._ifFalse_(function () {self._compileMethod_(nextChunk._contents());return self._scanFrom_(aStream);});
  3648. return self;
  3649. },
  3650. source: unescape('scanFrom%3A%20aStream%0A%09%7C%20nextChunk%20%7C%0A%09nextChunk%20%3A%3D%20%28chunkParser%20emptyChunk%20/%20chunkParser%20chunk%29%20parse%3A%20aStream.%0A%09nextChunk%20isEmptyChunk%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20compileMethod%3A%20nextChunk%20contents.%0A%09%20%20%20%20self%20scanFrom%3A%20aStream%5D.%0A')}),
  3651. smalltalk.ClassCategoryReader);
  3652. smalltalk.addMethod(
  3653. '_compileMethod_',
  3654. smalltalk.method({
  3655. selector: 'compileMethod:',
  3656. category: 'private',
  3657. fn: function (aString) {
  3658. var self = this;
  3659. var method = nil;
  3660. method = smalltalk.Compiler._new()._load_forClass_(aString, self['@class']);
  3661. method._category_(self['@category']);
  3662. self['@class']._addCompiledMethod_(method);
  3663. return self;
  3664. },
  3665. source: unescape('compileMethod%3A%20aString%0A%09%7C%20method%20%7C%0A%09method%20%3A%3D%20Compiler%20new%20load%3A%20aString%20forClass%3A%20class.%0A%09method%20category%3A%20category.%0A%09class%20addCompiledMethod%3A%20method%0A')}),
  3666. smalltalk.ClassCategoryReader);
  3667. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel');
  3668. smalltalk.addMethod(
  3669. '_collection',
  3670. smalltalk.method({
  3671. selector: 'collection',
  3672. category: 'accessing',
  3673. fn: function () {
  3674. var self = this;
  3675. return self['@collection'];
  3676. return self;
  3677. },
  3678. source: unescape('collection%0A%09%5Ecollection%0A')}),
  3679. smalltalk.Stream);
  3680. smalltalk.addMethod(
  3681. '_setCollection_',
  3682. smalltalk.method({
  3683. selector: 'setCollection:',
  3684. category: 'accessing',
  3685. fn: function (aCollection) {
  3686. var self = this;
  3687. self['@collection'] = aCollection;
  3688. return self;
  3689. },
  3690. source: unescape('setCollection%3A%20aCollection%0A%09collection%20%3A%3D%20aCollection%0A')}),
  3691. smalltalk.Stream);
  3692. smalltalk.addMethod(
  3693. '_position',
  3694. smalltalk.method({
  3695. selector: 'position',
  3696. category: 'accessing',
  3697. fn: function () {
  3698. var self = this;
  3699. return self['@position']._ifNil_(function () {return self['@position'] = 0;});
  3700. return self;
  3701. },
  3702. source: unescape('position%0A%09%5Eposition%20ifNil%3A%20%5Bposition%20%3A%3D%200%5D%0A')}),
  3703. smalltalk.Stream);
  3704. smalltalk.addMethod(
  3705. '_position_',
  3706. smalltalk.method({
  3707. selector: 'position:',
  3708. category: 'accessing',
  3709. fn: function (anInteger) {
  3710. var self = this;
  3711. self['@position'] = anInteger;
  3712. return self;
  3713. },
  3714. source: unescape('position%3A%20anInteger%0A%09position%20%3A%3D%20anInteger%0A')}),
  3715. smalltalk.Stream);
  3716. smalltalk.addMethod(
  3717. '_streamSize',
  3718. smalltalk.method({
  3719. selector: 'streamSize',
  3720. category: 'accessing',
  3721. fn: function () {
  3722. var self = this;
  3723. return self['@streamSize'];
  3724. return self;
  3725. },
  3726. source: unescape('streamSize%0A%09%5EstreamSize%0A')}),
  3727. smalltalk.Stream);
  3728. smalltalk.addMethod(
  3729. '_setStreamSize_',
  3730. smalltalk.method({
  3731. selector: 'setStreamSize:',
  3732. category: 'accessing',
  3733. fn: function (anInteger) {
  3734. var self = this;
  3735. self['@streamSize'] = anInteger;
  3736. return self;
  3737. },
  3738. source: unescape('setStreamSize%3A%20anInteger%0A%09streamSize%20%3A%3D%20anInteger%0A')}),
  3739. smalltalk.Stream);
  3740. smalltalk.addMethod(
  3741. '_contents',
  3742. smalltalk.method({
  3743. selector: 'contents',
  3744. category: 'accessing',
  3745. fn: function () {
  3746. var self = this;
  3747. return self._collection()._copyFrom_to_(1, self._streamSize());
  3748. return self;
  3749. },
  3750. source: unescape('contents%0A%09%5Eself%20collection%0A%09%20%20%20%20copyFrom%3A%201%20%0A%09%20%20%20%20to%3A%20self%20streamSize%0A')}),
  3751. smalltalk.Stream);
  3752. smalltalk.addMethod(
  3753. '_size',
  3754. smalltalk.method({
  3755. selector: 'size',
  3756. category: 'accessing',
  3757. fn: function () {
  3758. var self = this;
  3759. return self._streamSize();
  3760. return self;
  3761. },
  3762. source: unescape('size%0A%09%5Eself%20streamSize%0A')}),
  3763. smalltalk.Stream);
  3764. smalltalk.addMethod(
  3765. '_reset',
  3766. smalltalk.method({
  3767. selector: 'reset',
  3768. category: 'actions',
  3769. fn: function () {
  3770. var self = this;
  3771. self._position_(0);
  3772. return self;
  3773. },
  3774. source: unescape('reset%0A%09self%20position%3A%200%0A')}),
  3775. smalltalk.Stream);
  3776. smalltalk.addMethod(
  3777. '_close',
  3778. smalltalk.method({
  3779. selector: 'close',
  3780. category: 'actions',
  3781. fn: function () {
  3782. var self = this;
  3783. return self;
  3784. },
  3785. source: unescape('close%0A')}),
  3786. smalltalk.Stream);
  3787. smalltalk.addMethod(
  3788. '_flush',
  3789. smalltalk.method({
  3790. selector: 'flush',
  3791. category: 'actions',
  3792. fn: function () {
  3793. var self = this;
  3794. return self;
  3795. },
  3796. source: unescape('flush%0A')}),
  3797. smalltalk.Stream);
  3798. smalltalk.addMethod(
  3799. '_resetContents',
  3800. smalltalk.method({
  3801. selector: 'resetContents',
  3802. category: 'actions',
  3803. fn: function () {
  3804. var self = this;
  3805. self._reset();
  3806. self._setStreamSize_(0);
  3807. return self;
  3808. },
  3809. source: unescape('resetContents%0A%09self%20reset.%0A%09self%20setStreamSize%3A%200%0A')}),
  3810. smalltalk.Stream);
  3811. smalltalk.addMethod(
  3812. '_do_',
  3813. smalltalk.method({
  3814. selector: 'do:',
  3815. category: 'enumerating',
  3816. fn: function (aBlock) {
  3817. var self = this;
  3818. (function () {return self._atEnd();}._whileFalse_(function () {return aBlock._value_(self._next());}));
  3819. return self;
  3820. },
  3821. source: unescape('do%3A%20aBlock%0A%09%5Bself%20atEnd%5D%20whileFalse%3A%20%5BaBlock%20value%3A%20self%20next%5D%0A')}),
  3822. smalltalk.Stream);
  3823. smalltalk.addMethod(
  3824. '_setToEnd',
  3825. smalltalk.method({
  3826. selector: 'setToEnd',
  3827. category: 'positioning',
  3828. fn: function () {
  3829. var self = this;
  3830. self._position_(self._size());
  3831. return self;
  3832. },
  3833. source: unescape('setToEnd%0A%09self%20position%3A%20self%20size%0A')}),
  3834. smalltalk.Stream);
  3835. smalltalk.addMethod(
  3836. '_skip_',
  3837. smalltalk.method({
  3838. selector: 'skip:',
  3839. category: 'positioning',
  3840. fn: function (anInteger) {
  3841. var self = this;
  3842. self._position_(self._position().__plus(anInteger)._min_max_(self._size(), 0));
  3843. return self;
  3844. },
  3845. source: unescape('skip%3A%20anInteger%0A%09self%20position%3A%20%28%28self%20position%20+%20anInteger%29%20min%3A%20self%20size%20max%3A%200%29%0A')}),
  3846. smalltalk.Stream);
  3847. smalltalk.addMethod(
  3848. '_next',
  3849. smalltalk.method({
  3850. selector: 'next',
  3851. category: 'reading',
  3852. fn: function () {
  3853. var self = this;
  3854. self._position_(self._position().__plus(1));
  3855. return self['@collection']._at_(self._position());
  3856. return self;
  3857. },
  3858. source: unescape('next%0A%09self%20position%3A%20self%20position%20+%201.%20%0A%09%5Ecollection%20at%3A%20self%20position%0A')}),
  3859. smalltalk.Stream);
  3860. smalltalk.addMethod(
  3861. '_next_',
  3862. smalltalk.method({
  3863. selector: 'next:',
  3864. category: 'reading',
  3865. fn: function (anInteger) {
  3866. var self = this;
  3867. var tempCollection = nil;
  3868. tempCollection = self._collection()._class()._new();
  3869. anInteger._timesRepeat_(function () {return self._atEnd()._ifFalse_(function () {return tempCollection._add_(self._next());});});
  3870. return tempCollection;
  3871. return self;
  3872. },
  3873. source: unescape('next%3A%20anInteger%0A%09%7C%20tempCollection%20%7C%0A%09tempCollection%20%3A%3D%20self%20collection%20class%20new.%0A%09anInteger%20timesRepeat%3A%20%5B%0A%09%20%20%20%20self%20atEnd%20ifFalse%3A%20%5B%0A%09%09tempCollection%20add%3A%20self%20next%5D%5D.%0A%09%5EtempCollection%0A')}),
  3874. smalltalk.Stream);
  3875. smalltalk.addMethod(
  3876. '_nextPut_',
  3877. smalltalk.method({
  3878. selector: 'nextPut:',
  3879. category: 'writing',
  3880. fn: function (anObject) {
  3881. var self = this;
  3882. self._position_(self._position().__plus(1));
  3883. self._collection()._at_put_(self._position(), anObject);
  3884. self._setStreamSize_(self._streamSize()._max_(self._position()));
  3885. return self;
  3886. },
  3887. source: unescape('nextPut%3A%20anObject%0A%09self%20position%3A%20self%20position%20+%201.%0A%09self%20collection%20at%3A%20self%20position%20put%3A%20anObject.%0A%09self%20setStreamSize%3A%20%28self%20streamSize%20max%3A%20self%20position%29%0A')}),
  3888. smalltalk.Stream);
  3889. smalltalk.addMethod(
  3890. '_nextPutAll_',
  3891. smalltalk.method({
  3892. selector: 'nextPutAll:',
  3893. category: 'writing',
  3894. fn: function (aCollection) {
  3895. var self = this;
  3896. aCollection._do_(function (each) {return self._nextPut_(each);});
  3897. return self;
  3898. },
  3899. source: unescape('nextPutAll%3A%20aCollection%0A%09aCollection%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20self%20nextPut%3A%20each%5D%0A')}),
  3900. smalltalk.Stream);
  3901. smalltalk.addMethod(
  3902. '_peek',
  3903. smalltalk.method({
  3904. selector: 'peek',
  3905. category: 'reading',
  3906. fn: function () {
  3907. var self = this;
  3908. return self._atEnd()._ifFalse_(function () {return self._collection()._at_(self._position().__plus(1));});
  3909. return self;
  3910. },
  3911. source: unescape('peek%0A%09%5Eself%20atEnd%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20collection%20at%3A%20self%20position%20+%201%5D%0A')}),
  3912. smalltalk.Stream);
  3913. smalltalk.addMethod(
  3914. '_atEnd',
  3915. smalltalk.method({
  3916. selector: 'atEnd',
  3917. category: 'testing',
  3918. fn: function () {
  3919. var self = this;
  3920. return self._position().__eq(self._size());
  3921. return self;
  3922. },
  3923. source: unescape('atEnd%0A%09%5Eself%20position%20%3D%20self%20size%0A')}),
  3924. smalltalk.Stream);
  3925. smalltalk.addMethod(
  3926. '_atStart',
  3927. smalltalk.method({
  3928. selector: 'atStart',
  3929. category: 'testing',
  3930. fn: function () {
  3931. var self = this;
  3932. return self._position().__eq(0);
  3933. return self;
  3934. },
  3935. source: unescape('atStart%0A%09%5Eself%20position%20%3D%200%0A')}),
  3936. smalltalk.Stream);
  3937. smalltalk.addMethod(
  3938. '_isEmpty',
  3939. smalltalk.method({
  3940. selector: 'isEmpty',
  3941. category: 'testing',
  3942. fn: function () {
  3943. var self = this;
  3944. return self._size().__eq(0);
  3945. return self;
  3946. },
  3947. source: unescape('isEmpty%0A%09%5Eself%20size%20%3D%200%0A')}),
  3948. smalltalk.Stream);
  3949. smalltalk.addMethod(
  3950. '_on_',
  3951. smalltalk.method({
  3952. selector: 'on:',
  3953. category: 'instance creation',
  3954. fn: function (aCollection) {
  3955. var self = this;
  3956. return function ($rec) {$rec._setCollection_(aCollection);$rec._setStreamSize_(aCollection._size());return $rec._yourself();}(self._new());
  3957. return self;
  3958. },
  3959. source: unescape('on%3A%20aCollection%0A%09%20%20%20%20%5Eself%20new%20%0A%09%09setCollection%3A%20aCollection%3B%0A%09%09setStreamSize%3A%20aCollection%20size%3B%0A%09%09yourself%0A')}),
  3960. smalltalk.Stream.klass);
  3961. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel');
  3962. smalltalk.addMethod(
  3963. '_next_',
  3964. smalltalk.method({
  3965. selector: 'next:',
  3966. category: 'reading',
  3967. fn: function (anInteger) {
  3968. var self = this;
  3969. var tempCollection = nil;
  3970. tempCollection = self._collection()._class()._new();
  3971. anInteger._timesRepeat_(function () {return self._atEnd()._ifFalse_(function () {return tempCollection = tempCollection.__comma(self._next());});});
  3972. return tempCollection;
  3973. return self;
  3974. },
  3975. source: unescape('next%3A%20anInteger%0A%09%7C%20tempCollection%20%7C%0A%09tempCollection%20%3A%3D%20self%20collection%20class%20new.%0A%09anInteger%20timesRepeat%3A%20%5B%0A%09%20%20%20%20self%20atEnd%20ifFalse%3A%20%5B%0A%09%09tempCollection%20%3A%3D%20tempCollection%2C%20self%20next%5D%5D.%0A%09%5EtempCollection%0A')}),
  3976. smalltalk.StringStream);
  3977. smalltalk.addMethod(
  3978. '_nextPut_',
  3979. smalltalk.method({
  3980. selector: 'nextPut:',
  3981. category: 'writing',
  3982. fn: function (aString) {
  3983. var self = this;
  3984. self._nextPutAll_(aString);
  3985. return self;
  3986. },
  3987. source: unescape('nextPut%3A%20aString%0A%09self%20nextPutAll%3A%20aString%0A')}),
  3988. smalltalk.StringStream);
  3989. smalltalk.addMethod(
  3990. '_nextPutAll_',
  3991. smalltalk.method({
  3992. selector: 'nextPutAll:',
  3993. category: 'writing',
  3994. fn: function (aString) {
  3995. var self = this;
  3996. self._setCollection_(self._collection()._copyFrom_to_(1, self._position()).__comma(aString).__comma(self._collection()._copyFrom_to_(self._position().__plus(1).__plus(aString._size()), self._collection()._size())));
  3997. self._position_(self._position().__plus(aString._size()));
  3998. self._setStreamSize_(self._streamSize()._max_(self._position()));
  3999. return self;
  4000. },
  4001. source: unescape('nextPutAll%3A%20aString%0A%09self%20setCollection%3A%20%0A%09%20%20%20%20%28self%20collection%20copyFrom%3A%201%20to%3A%20self%20position%29%2C%0A%09%20%20%20%20aString%2C%0A%09%20%20%20%20%28self%20collection%20copyFrom%3A%20%28self%20position%20+%201%20+%20aString%20size%29%20to%3A%20self%20collection%20size%29.%0A%09self%20position%3A%20self%20position%20+%20aString%20size.%0A%09self%20setStreamSize%3A%20%28self%20streamSize%20max%3A%20self%20position%29%0A')}),
  4002. smalltalk.StringStream);
  4003. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel');
  4004. smalltalk.addMethod(
  4005. '_class_',
  4006. smalltalk.method({
  4007. selector: 'class:',
  4008. category: 'accessing',
  4009. fn: function (aClass) {
  4010. var self = this;
  4011. self['@class'] = aClass;
  4012. return self;
  4013. },
  4014. source: unescape('class%3A%20aClass%0A%09class%20%3A%3D%20aClass%0A')}),
  4015. smalltalk.ClassCommentReader);
  4016. smalltalk.addMethod(
  4017. '_scanFrom_',
  4018. smalltalk.method({
  4019. selector: 'scanFrom:',
  4020. category: 'fileIn',
  4021. fn: function (aStream) {
  4022. var self = this;
  4023. var nextChunk = nil;
  4024. nextChunk = self['@chunkParser']._emptyChunk().__slash(self['@chunkParser']._chunk())._parse_(aStream);
  4025. nextChunk._isEmptyChunk()._ifFalse_(function () {return self._setComment_(nextChunk._contents());});
  4026. return self;
  4027. },
  4028. source: unescape('scanFrom%3A%20aStream%0A%09%7C%20nextChunk%20%7C%0A%09nextChunk%20%3A%3D%20%28chunkParser%20emptyChunk%20/%20chunkParser%20chunk%29%20parse%3A%20aStream.%0A%09nextChunk%20isEmptyChunk%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20setComment%3A%20nextChunk%20contents%5D.%0A')}),
  4029. smalltalk.ClassCommentReader);
  4030. smalltalk.addMethod(
  4031. '_initialize',
  4032. smalltalk.method({
  4033. selector: 'initialize',
  4034. category: 'initialization',
  4035. fn: function () {
  4036. var self = this;
  4037. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  4038. self['@chunkParser'] = smalltalk.ChunkParser._new();
  4039. return self;
  4040. },
  4041. source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.%0A')}),
  4042. smalltalk.ClassCommentReader);
  4043. smalltalk.addMethod(
  4044. '_setComment_',
  4045. smalltalk.method({
  4046. selector: 'setComment:',
  4047. category: 'private',
  4048. fn: function (aString) {
  4049. var self = this;
  4050. self['@class']._comment_(aString);
  4051. return self;
  4052. },
  4053. source: unescape('setComment%3A%20aString%0A%20%20%20%20class%20comment%3A%20aString%0A')}),
  4054. smalltalk.ClassCommentReader);
  4055. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel');
  4056. smalltalk.addMethod(
  4057. '_next',
  4058. smalltalk.method({
  4059. selector: 'next',
  4060. category: 'accessing',
  4061. fn: function () {
  4062. var self = this;
  4063. return function () {return Math.random();}();
  4064. return self;
  4065. },
  4066. source: unescape('next%0A%20%20%20%20%5E%7B%27return%20Math.random%28%29%27%7D%0A')}),
  4067. smalltalk.Random);
  4068. smalltalk.addMethod(
  4069. '_next_',
  4070. smalltalk.method({
  4071. selector: 'next:',
  4072. category: 'accessing',
  4073. fn: function (anInteger) {
  4074. var self = this;
  4075. return (1)._to_collect_(anInteger, function (each) {return self._next();});
  4076. return self;
  4077. },
  4078. source: unescape('next%3A%20anInteger%0A%20%20%20%20%5E1%20to%3A%20anInteger%20collect%3A%20%5B%3Aeach%20%7C%20self%20next%5D%0A')}),
  4079. smalltalk.Random);
  4080. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel');
  4081. smalltalk.addMethod(
  4082. '_x',
  4083. smalltalk.method({
  4084. selector: 'x',
  4085. category: 'accessing',
  4086. fn: function () {
  4087. var self = this;
  4088. return self['@x'];
  4089. return self;
  4090. },
  4091. source: unescape('x%0A%09%5Ex')}),
  4092. smalltalk.Point);
  4093. smalltalk.addMethod(
  4094. '_y',
  4095. smalltalk.method({
  4096. selector: 'y',
  4097. category: 'accessing',
  4098. fn: function () {
  4099. var self = this;
  4100. return self['@y'];
  4101. return self;
  4102. },
  4103. source: unescape('y%0A%09%5Ey')}),
  4104. smalltalk.Point);
  4105. smalltalk.addMethod(
  4106. '_y_',
  4107. smalltalk.method({
  4108. selector: 'y:',
  4109. category: 'accessing',
  4110. fn: function (aNumber) {
  4111. var self = this;
  4112. self['@y'] = aNumber;
  4113. return self;
  4114. },
  4115. source: unescape('y%3A%20aNumber%0A%09y%20%3A%3D%20aNumber')}),
  4116. smalltalk.Point);
  4117. smalltalk.addMethod(
  4118. '_x_',
  4119. smalltalk.method({
  4120. selector: 'x:',
  4121. category: 'accessing',
  4122. fn: function (aNumber) {
  4123. var self = this;
  4124. self['@x'] = aNumber;
  4125. return self;
  4126. },
  4127. source: unescape('x%3A%20aNumber%0A%09x%20%3A%3D%20aNumber')}),
  4128. smalltalk.Point);
  4129. smalltalk.addMethod(
  4130. '__star',
  4131. smalltalk.method({
  4132. selector: '*',
  4133. category: 'arithmetic',
  4134. fn: function (aPoint) {
  4135. var self = this;
  4136. return smalltalk.Point._x_y_(self._x().__star(aPoint._asPoint()._x()), self._y().__star(aPoint._asPoint()._y()));
  4137. return self;
  4138. },
  4139. source: unescape('*%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20*%20aPoint%20asPoint%20x%20y%3A%20self%20y%20*%20aPoint%20asPoint%20y')}),
  4140. smalltalk.Point);
  4141. smalltalk.addMethod(
  4142. '__plus',
  4143. smalltalk.method({
  4144. selector: '+',
  4145. category: 'arithmetic',
  4146. fn: function (aPoint) {
  4147. var self = this;
  4148. return smalltalk.Point._x_y_(self._x().__plus(aPoint._asPoint()._x()), self._y().__plus(aPoint._asPoint()._y()));
  4149. return self;
  4150. },
  4151. source: unescape('+%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20+%20aPoint%20asPoint%20x%20y%3A%20self%20y%20+%20aPoint%20asPoint%20y')}),
  4152. smalltalk.Point);
  4153. smalltalk.addMethod(
  4154. '__minus',
  4155. smalltalk.method({
  4156. selector: '-',
  4157. category: 'arithmetic',
  4158. fn: function (aPoint) {
  4159. var self = this;
  4160. return smalltalk.Point._x_y_(self._x().__minus(aPoint._asPoint()._x()), self._y().__minus(aPoint._asPoint()._y()));
  4161. return self;
  4162. },
  4163. source: unescape('-%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20-%20aPoint%20asPoint%20x%20y%3A%20self%20y%20-%20aPoint%20asPoint%20y')}),
  4164. smalltalk.Point);
  4165. smalltalk.addMethod(
  4166. '__slash',
  4167. smalltalk.method({
  4168. selector: '/',
  4169. category: 'arithmetic',
  4170. fn: function (aPoint) {
  4171. var self = this;
  4172. return smalltalk.Point._x_y_(self._x().__slash(aPoint._asPoint()._x()), self._y().__slash(aPoint._asPoint()._y()));
  4173. return self;
  4174. },
  4175. source: unescape('/%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20/%20aPoint%20asPoint%20x%20y%3A%20self%20y%20/%20aPoint%20asPoint%20y')}),
  4176. smalltalk.Point);
  4177. smalltalk.addMethod(
  4178. '_asPoint',
  4179. smalltalk.method({
  4180. selector: 'asPoint',
  4181. category: 'converting',
  4182. fn: function () {
  4183. var self = this;
  4184. return self;
  4185. return self;
  4186. },
  4187. source: unescape('asPoint%0A%09%5Eself')}),
  4188. smalltalk.Point);
  4189. smalltalk.addMethod(
  4190. '_x_y_',
  4191. smalltalk.method({
  4192. selector: 'x:y:',
  4193. category: 'instance creation',
  4194. fn: function (aNumber, anotherNumber) {
  4195. var self = this;
  4196. return function ($rec) {$rec._x_(aNumber);$rec._y_(anotherNumber);return $rec._yourself();}(self._new());
  4197. return self;
  4198. },
  4199. source: unescape('x%3A%20aNumber%20y%3A%20anotherNumber%0A%09%5Eself%20new%0A%09%09x%3A%20aNumber%3B%0A%09%09y%3A%20anotherNumber%3B%0A%09%09yourself')}),
  4200. smalltalk.Point.klass);
  4201. smalltalk.addClass('JQuery', smalltalk.Object, ['jquery'], 'JQuery');
  4202. smalltalk.addMethod(
  4203. '_removeAttribute_',
  4204. smalltalk.method({
  4205. selector: 'removeAttribute:',
  4206. category: 'attributes',
  4207. fn: function (aString){
  4208. var self=this;
  4209. return self._call_withArgument_("removeAttribute",aString);
  4210. return self;},
  4211. source: unescape('removeAttribute%3A%20aString%0A%20%20%20%20%22Remove%20an%20attribute%20from%20each%20element%20in%20the%20set%20of%20matched%20elements.%22%0A%20%20%20%20%5Eself%20call%3A%20%27removeAttribute%27%20withArgument%3A%20aString%0A')}),
  4212. smalltalk.JQuery);
  4213. smalltalk.addMethod(
  4214. '_attr_',
  4215. smalltalk.method({
  4216. selector: 'attr:',
  4217. category: 'attributes',
  4218. fn: function (aString){
  4219. var self=this;
  4220. return self._call_withArgument_("attr",aString);
  4221. return self;},
  4222. source: unescape('attr%3A%20aString%0A%20%20%20%20%22Get%20the%20value%20of%20an%20attribute%20for%20the%20first%20element%20in%20the%20set%20of%20matched%20elements.%22%0A%20%20%20%20%5Eself%20call%3A%20%27attr%27%20withArgument%3A%20aString%0A')}),
  4223. smalltalk.JQuery);
  4224. smalltalk.addMethod(
  4225. '_val',
  4226. smalltalk.method({
  4227. selector: 'val',
  4228. category: 'attributes',
  4229. fn: function (){
  4230. var self=this;
  4231. return self._call_("val");
  4232. return self;},
  4233. source: unescape('val%0A%20%20%20%20%22Get%20the%20current%20value%20of%20the%20first%20element%20in%20the%20set%20of%20matched%20elements.%22%0A%20%20%20%20%5Eself%20call%3A%20%27val%27%0A')}),
  4234. smalltalk.JQuery);
  4235. smalltalk.addMethod(
  4236. '_val_',
  4237. smalltalk.method({
  4238. selector: 'val:',
  4239. category: 'attributes',
  4240. fn: function (aString){
  4241. var self=this;
  4242. self._call_withArgument_("val",aString);
  4243. return self;},
  4244. source: unescape('val%3A%20aString%0A%20%20%20%20self%20call%3A%20%27val%27%20withArgument%3A%20aString%0A')}),
  4245. smalltalk.JQuery);
  4246. smalltalk.addMethod(
  4247. '_cssAt_',
  4248. smalltalk.method({
  4249. selector: 'cssAt:',
  4250. category: 'css',
  4251. fn: function (aString){
  4252. var self=this;
  4253. return (function(){return self['@jquery'].css(aString)})();
  4254. return self;},
  4255. source: unescape('cssAt%3A%20aString%0A%20%20%20%20%5E%7B%27return%20self%5B%27%27@jquery%27%27%5D.css%28aString%29%27%7D%0A')}),
  4256. smalltalk.JQuery);
  4257. smalltalk.addMethod(
  4258. '_cssAt_put_',
  4259. smalltalk.method({
  4260. selector: 'cssAt:put:',
  4261. category: 'css',
  4262. fn: function (aString, anotherString){
  4263. var self=this;
  4264. (function(){self['@jquery'].css(aString, anotherString)})();
  4265. return self;},
  4266. source: unescape('cssAt%3A%20aString%20put%3A%20anotherString%0A%20%20%20%20%7B%27self%5B%27%27@jquery%27%27%5D.css%28aString%2C%20anotherString%29%27%7D%0A')}),
  4267. smalltalk.JQuery);
  4268. smalltalk.addMethod(
  4269. '_addClass_',
  4270. smalltalk.method({
  4271. selector: 'addClass:',
  4272. category: 'css',
  4273. fn: function (aString){
  4274. var self=this;
  4275. self._call_withArgument_("addClass",aString);
  4276. return self;},
  4277. source: unescape('addClass%3A%20aString%0A%20%20%20%20%22Adds%20the%20specified%20class%28es%29%20to%20each%20of%20the%20set%20of%20matched%20elements.%22%0A%20%20%20%20self%20call%3A%20%27addClass%27%20withArgument%3A%20aString%0A')}),
  4278. smalltalk.JQuery);
  4279. smalltalk.addMethod(
  4280. '_removeClass_',
  4281. smalltalk.method({
  4282. selector: 'removeClass:',
  4283. category: 'css',
  4284. fn: function (aString){
  4285. var self=this;
  4286. self._call_withArgument_("removeClass",aString);
  4287. return self;},
  4288. source: unescape('removeClass%3A%20aString%0A%20%20%20%20%22Remove%20a%20single%20class%2C%20multiple%20classes%2C%20or%20all%20classes%20from%20each%20element%20in%20the%20set%20of%20matched%20elements.%22%0A%20%20%20%20self%20call%3A%20%27removeClass%27%20withArgument%3A%20aString%0A')}),
  4289. smalltalk.JQuery);
  4290. smalltalk.addMethod(
  4291. '_toggleClass_',
  4292. smalltalk.method({
  4293. selector: 'toggleClass:',
  4294. category: 'css',
  4295. fn: function (aString){
  4296. var self=this;
  4297. self._call_withArgument_("toggleClass",aString);
  4298. return self;},
  4299. source: unescape('toggleClass%3A%20aString%0A%20%20%20%20%22Add%20or%20remove%20one%20or%20more%20classes%20from%20each%20element%20in%20the%20set%20of%20matched%20elements%2C%20depending%20on%20either%20the%20class%27s%20presence%20or%20the%20value%20of%20the%20switch%20argument.%22%0A%20%20%20%20self%20call%3A%20%27toggleClass%27%20withArgument%3A%20aString%0A')}),
  4300. smalltalk.JQuery);
  4301. smalltalk.addMethod(
  4302. '_height',
  4303. smalltalk.method({
  4304. selector: 'height',
  4305. category: 'css',
  4306. fn: function (){
  4307. var self=this;
  4308. return self._call_("height");
  4309. return self;},
  4310. source: unescape('height%20%0A%20%20%20%20%22Get%20the%20current%20computed%20height%20for%20the%20first%20element%20in%20the%20set%20of%20matched%20elements.%22%0A%20%20%20%20%5Eself%20call%3A%20%27height%27%0A')}),
  4311. smalltalk.JQuery);
  4312. smalltalk.addMethod(
  4313. '_height_',
  4314. smalltalk.method({
  4315. selector: 'height:',
  4316. category: 'css',
  4317. fn: function (anInteger){
  4318. var self=this;
  4319. self._call_withArgument_("height",anInteger);
  4320. return self;},
  4321. source: unescape('height%3A%20anInteger%0A%20%20%20%20self%20call%3A%20%27height%27%20withArgument%3A%20anInteger%0A')}),
  4322. smalltalk.JQuery);
  4323. smalltalk.addMethod(
  4324. '_width_',
  4325. smalltalk.method({
  4326. selector: 'width:',
  4327. category: 'css',
  4328. fn: function (anInteger){
  4329. var self=this;
  4330. self._call_withArgument_("width",anInteger);
  4331. return self;},
  4332. source: unescape('width%3A%20anInteger%0A%20%20%20%20self%20call%3A%20%27width%27%20withArgument%3A%20anInteger%0A')}),
  4333. smalltalk.JQuery);
  4334. smalltalk.addMethod(
  4335. '_width',
  4336. smalltalk.method({
  4337. selector: 'width',
  4338. category: 'css',
  4339. fn: function (){
  4340. var self=this;
  4341. return self._call_("width");
  4342. return self;},
  4343. source: unescape('width%0A%20%20%20%20%22Get%20the%20current%20computed%20width%20for%20the%20first%20element%20in%20the%20set%20of%20matched%20elements.%22%0A%20%20%20%20%5Eself%20call%3A%20%27width%27%0A')}),
  4344. smalltalk.JQuery);
  4345. smalltalk.addMethod(
  4346. '_innerHeight',
  4347. smalltalk.method({
  4348. selector: 'innerHeight',
  4349. category: 'css',
  4350. fn: function (){
  4351. var self=this;
  4352. return self._call_("innerHeight");
  4353. return self;},
  4354. source: unescape('innerHeight%0A%20%20%20%20%22Get%20the%20current%20computed%20height%20for%20the%20first%20element%20in%20the%20set%20of%20matched%20elements%2C%20including%20padding%20but%20not%20border.%22%0A%20%20%20%20%5Eself%20call%3A%20%27innerHeight%27%0A')}),
  4355. smalltalk.JQuery);
  4356. smalltalk.addMethod(
  4357. '_innerWidth',
  4358. smalltalk.method({
  4359. selector: 'innerWidth',
  4360. category: 'css',
  4361. fn: function (){
  4362. var self=this;
  4363. return self._call_("innerWidth");
  4364. return self;},
  4365. source: unescape('innerWidth%0A%20%20%20%20%22Get%20the%20current%20computed%20width%20for%20the%20first%20element%20in%20the%20set%20of%20matched%20elements%2C%20including%20padding%20but%20not%20border.%22%0A%20%20%20%20%5Eself%20call%3A%20%27innerWidth%27%0A')}),
  4366. smalltalk.JQuery);
  4367. smalltalk.addMethod(
  4368. '_outerHeight',
  4369. smalltalk.method({
  4370. selector: 'outerHeight',
  4371. category: 'css',
  4372. fn: function (){
  4373. var self=this;
  4374. return self._call_("outerHeight");
  4375. return self;},
  4376. source: unescape('outerHeight%0A%20%20%20%20%22Get%20the%20current%20computed%20height%20for%20the%20first%20element%20in%20the%20set%20of%20matched%20elements%2C%20including%20padding%2C%20border%2C%20and%20optionally%20margin.%22%0A%20%20%20%20%5Eself%20call%3A%20%27outerHeight%27%0A')}),
  4377. smalltalk.JQuery);
  4378. smalltalk.addMethod(
  4379. '_outerWidth',
  4380. smalltalk.method({
  4381. selector: 'outerWidth',
  4382. category: 'css',
  4383. fn: function (){
  4384. var self=this;
  4385. return self._call_("outerWidth");
  4386. return self;},
  4387. source: unescape('outerWidth%0A%20%20%20%20%22Get%20the%20current%20computed%20width%20for%20the%20first%20element%20in%20the%20set%20of%20matched%20elements%2C%20including%20padding%20and%20border.%22%0A%20%20%20%20%5Eself%20call%3A%20%27outerWidth%27%0A')}),
  4388. smalltalk.JQuery);
  4389. smalltalk.addMethod(
  4390. '_top',
  4391. smalltalk.method({
  4392. selector: 'top',
  4393. category: 'css',
  4394. fn: function (){
  4395. var self=this;
  4396. return self._call_("position")._basicAt_("top");
  4397. return self;},
  4398. source: unescape('top%0A%20%20%20%20%22Get%20the%20current%20y%20coordinate%20of%20the%20first%20element%20in%20the%20set%20of%20matched%20elements%2C%20relative%20to%20the%20offset%20parent.%22%0A%20%20%20%20%5E%28self%20call%3A%20%27position%27%29%20basicAt%3A%20%27top%27%0A')}),
  4399. smalltalk.JQuery);
  4400. smalltalk.addMethod(
  4401. '_left',
  4402. smalltalk.method({
  4403. selector: 'left',
  4404. category: 'css',
  4405. fn: function (){
  4406. var self=this;
  4407. return self._call_("position")._basicAt_("left");
  4408. return self;},
  4409. source: unescape('left%0A%20%20%20%20%22Get%20the%20current%20x%20coordinate%20of%20the%20first%20element%20in%20the%20set%20of%20matched%20elements%2C%20relative%20to%20the%20offset%20parent.%22%0A%20%20%20%20%5E%28self%20call%3A%20%27position%27%29%20basicAt%3A%20%27left%27%0A')}),
  4410. smalltalk.JQuery);
  4411. smalltalk.addMethod(
  4412. '_offsetLeft',
  4413. smalltalk.method({
  4414. selector: 'offsetLeft',
  4415. category: 'css',
  4416. fn: function (){
  4417. var self=this;
  4418. return self._call_("offset")._basicAt_("left");
  4419. return self;},
  4420. source: unescape('offsetLeft%0A%20%20%20%20%22Get%20the%20current%20coordinates%20of%20the%20first%20element%20in%20the%20set%20of%20matched%20elements%2C%20relative%20to%20the%20document.%22%0A%20%20%20%20%5E%28self%20call%3A%20%27offset%27%29%20basicAt%3A%20%27left%27%0A')}),
  4421. smalltalk.JQuery);
  4422. smalltalk.addMethod(
  4423. '_offsetTop',
  4424. smalltalk.method({
  4425. selector: 'offsetTop',
  4426. category: 'css',
  4427. fn: function (){
  4428. var self=this;
  4429. return self._call_("offset")._basicAt_("top");
  4430. return self;},
  4431. source: unescape('offsetTop%0A%20%20%20%20%22Get%20the%20current%20coordinates%20of%20the%20first%20element%20in%20the%20set%20of%20matched%20elements%2C%20relative%20to%20the%20document.%22%0A%20%20%20%20%5E%28self%20call%3A%20%27offset%27%29%20basicAt%3A%20%27top%27%0A')}),
  4432. smalltalk.JQuery);
  4433. smalltalk.addMethod(
  4434. '_scrollLeft',
  4435. smalltalk.method({
  4436. selector: 'scrollLeft',
  4437. category: 'css',
  4438. fn: function (){
  4439. var self=this;
  4440. return self._call_("scrollLeft");
  4441. return self;},
  4442. source: unescape('scrollLeft%0A%20%20%20%20%22Get%20the%20current%20horizontal%20position%20of%20the%20scroll%20bar%20for%20the%20first%20element%20in%20the%20set%20of%20matched%20elements.%22%0A%20%20%20%20%5Eself%20call%3A%20%27scrollLeft%27%0A')}),
  4443. smalltalk.JQuery);
  4444. smalltalk.addMethod(
  4445. '_scrollTop',
  4446. smalltalk.method({
  4447. selector: 'scrollTop',
  4448. category: 'css',
  4449. fn: function (){
  4450. var self=this;
  4451. return self._call_("scrollTop");
  4452. return self;},
  4453. source: unescape('scrollTop%0A%20%20%20%20%22Get%20the%20current%20vertical%20position%20of%20the%20scroll%20bar%20for%20the%20first%20element%20in%20the%20set%20of%20matched%20elements.%22%0A%20%20%20%20%5Eself%20call%3A%20%27scrollTop%27%0A')}),
  4454. smalltalk.JQuery);
  4455. smalltalk.addMethod(
  4456. '_scrollLeft_',
  4457. smalltalk.method({
  4458. selector: 'scrollLeft:',
  4459. category: 'css',
  4460. fn: function (anInteger){
  4461. var self=this;
  4462. self._call_withArgument_("scrollLeft",anInteger);
  4463. return self;},
  4464. source: unescape('scrollLeft%3A%20anInteger%0A%20%20%20%20self%20call%3A%20%27scrollLeft%27%20withArgument%3A%20anInteger%0A')}),
  4465. smalltalk.JQuery);
  4466. smalltalk.addMethod(
  4467. '_scrollTop_',
  4468. smalltalk.method({
  4469. selector: 'scrollTop:',
  4470. category: 'css',
  4471. fn: function (anInteger){
  4472. var self=this;
  4473. self._call_withArgument_("scrollTop",anInteger);
  4474. return self;},
  4475. source: unescape('scrollTop%3A%20anInteger%0A%20%20%20%20self%20call%3A%20%27scrollTop%27%20withArgument%3A%20anInteger%0A')}),
  4476. smalltalk.JQuery);
  4477. smalltalk.addMethod(
  4478. '_focus',
  4479. smalltalk.method({
  4480. selector: 'focus',
  4481. category: 'events',
  4482. fn: function (){
  4483. var self=this;
  4484. self._call_("focus");
  4485. return self;},
  4486. source: unescape('focus%0A%20%20%20%20self%20call%3A%20%27focus%27%0A')}),
  4487. smalltalk.JQuery);
  4488. smalltalk.addMethod(
  4489. '_show',
  4490. smalltalk.method({
  4491. selector: 'show',
  4492. category: 'events',
  4493. fn: function (){
  4494. var self=this;
  4495. self._call_("show");
  4496. return self;},
  4497. source: unescape('show%0A%20%20%20%20self%20call%3A%20%27show%27%0A')}),
  4498. smalltalk.JQuery);
  4499. smalltalk.addMethod(
  4500. '_hide',
  4501. smalltalk.method({
  4502. selector: 'hide',
  4503. category: 'events',
  4504. fn: function (){
  4505. var self=this;
  4506. self._call_("hide");
  4507. return self;},
  4508. source: unescape('hide%0A%20%20%20%20self%20call%3A%20%27hide%27%0A')}),
  4509. smalltalk.JQuery);
  4510. smalltalk.addMethod(
  4511. '_remove',
  4512. smalltalk.method({
  4513. selector: 'remove',
  4514. category: 'events',
  4515. fn: function (){
  4516. var self=this;
  4517. self._call_("remove");
  4518. return self;},
  4519. source: unescape('remove%0A%20%20%20%20self%20call%3A%20%27remove%27%0A')}),
  4520. smalltalk.JQuery);
  4521. smalltalk.addMethod(
  4522. '_on_do_',
  4523. smalltalk.method({
  4524. selector: 'on:do:',
  4525. category: 'events',
  4526. fn: function (anEventString, aBlock){
  4527. var self=this;
  4528. (function(){self['@jquery'].bind(anEventString, function(e){aBlock(self)})})();
  4529. return self;},
  4530. source: unescape('on%3A%20anEventString%20do%3A%20aBlock%0A%20%20%20%20%22Attach%20aBlock%20for%20anEventString%20on%20the%20element%22%0A%20%20%20%20%7B%27self%5B%27%27@jquery%27%27%5D.bind%28anEventString%2C%20function%28e%29%7BaBlock%28self%29%7D%29%27%7D%0A')}),
  4531. smalltalk.JQuery);
  4532. smalltalk.addMethod(
  4533. '_removeEvents_',
  4534. smalltalk.method({
  4535. selector: 'removeEvents:',
  4536. category: 'events',
  4537. fn: function (aString){
  4538. var self=this;
  4539. self._call_withArgument_("unbind",aString);
  4540. return self;},
  4541. source: unescape('removeEvents%3A%20aString%0A%20%20%20%20%22Unbind%20all%20handlers%20attached%20to%20the%20event%20aString%22%0A%20%20%20%20self%20call%3A%20%27unbind%27%20withArgument%3A%20aString%0A')}),
  4542. smalltalk.JQuery);
  4543. smalltalk.addMethod(
  4544. '_append_',
  4545. smalltalk.method({
  4546. selector: 'append:',
  4547. category: 'DOM insertion',
  4548. fn: function (anObject){
  4549. var self=this;
  4550. anObject._appendToJQuery_(self);
  4551. return self;},
  4552. source: unescape('append%3A%20anObject%0A%20%20%20%20%22Append%20anObject%20at%20the%20end%20of%20the%20element.%22%0A%20%20%20%20anObject%20appendToJQuery%3A%20self%0A')}),
  4553. smalltalk.JQuery);
  4554. smalltalk.addMethod(
  4555. '_appendElement_',
  4556. smalltalk.method({
  4557. selector: 'appendElement:',
  4558. category: 'DOM insertion',
  4559. fn: function (anElement){
  4560. var self=this;
  4561. self._call_withArgument_("append",anElement);
  4562. return self;},
  4563. source: unescape('appendElement%3A%20anElement%0A%20%20%20%20%22Append%20anElement%20at%20the%20end%20of%20the%20element.%0A%20%20%20%20%20Dont%27t%20call%20this%20method%20directly%2C%20use%20%23append%3A%20instead%22%0A%20%20%20%20self%20call%3A%20%27append%27%20withArgument%3A%20anElement%0A')}),
  4564. smalltalk.JQuery);
  4565. smalltalk.addMethod(
  4566. '_appendToJQuery_',
  4567. smalltalk.method({
  4568. selector: 'appendToJQuery:',
  4569. category: 'DOM insertion',
  4570. fn: function (aJQuery){
  4571. var self=this;
  4572. aJQuery._appendElement_(self['@jquery']);
  4573. return self;},
  4574. source: unescape('appendToJQuery%3A%20aJQuery%0A%20%20%20%20aJQuery%20appendElement%3A%20jquery%0A')}),
  4575. smalltalk.JQuery);
  4576. smalltalk.addMethod(
  4577. '_contents_',
  4578. smalltalk.method({
  4579. selector: 'contents:',
  4580. category: 'DOM insertion',
  4581. fn: function (anObject){
  4582. var self=this;
  4583. self._empty();
  4584. self._append_(anObject);
  4585. return self;},
  4586. source: unescape('contents%3A%20anObject%0A%20%20%20%20self%20empty.%0A%20%20%20%20self%20append%3A%20anObject%0A')}),
  4587. smalltalk.JQuery);
  4588. smalltalk.addMethod(
  4589. '_empty',
  4590. smalltalk.method({
  4591. selector: 'empty',
  4592. category: 'DOM insertion',
  4593. fn: function (){
  4594. var self=this;
  4595. self._call_("empty");
  4596. return self;},
  4597. source: unescape('empty%0A%20%20%20%20self%20call%3A%20%27empty%27%0A')}),
  4598. smalltalk.JQuery);
  4599. smalltalk.addMethod(
  4600. '_initializeWithJQueryObject_',
  4601. smalltalk.method({
  4602. selector: 'initializeWithJQueryObject:',
  4603. category: 'initialization',
  4604. fn: function (anObject){
  4605. var self=this;
  4606. self['@jquery']=anObject;
  4607. return self;},
  4608. source: unescape('initializeWithJQueryObject%3A%20anObject%0A%20%20%20%20jquery%20%3A%3D%20anObject%0A')}),
  4609. smalltalk.JQuery);
  4610. smalltalk.addMethod(
  4611. '_call_',
  4612. smalltalk.method({
  4613. selector: 'call:',
  4614. category: 'private',
  4615. fn: function (aString){
  4616. var self=this;
  4617. return (function(){return self['@jquery'][aString]()})();
  4618. return self;},
  4619. source: unescape('call%3A%20aString%0A%20%20%20%20%5E%7B%27return%20self%5B%27%27@jquery%27%27%5D%5BaString%5D%28%29%27%7D%0A')}),
  4620. smalltalk.JQuery);
  4621. smalltalk.addMethod(
  4622. '_call_withArgument_',
  4623. smalltalk.method({
  4624. selector: 'call:withArgument:',
  4625. category: 'private',
  4626. fn: function (aString, anObject){
  4627. var self=this;
  4628. return (function(){return self['@jquery'][aString](anObject)})();
  4629. return self;},
  4630. source: unescape('call%3A%20aString%20withArgument%3A%20anObject%0A%20%20%20%20%5E%7B%27return%20self%5B%27%27@jquery%27%27%5D%5BaString%5D%28anObject%29%27%7D%0A')}),
  4631. smalltalk.JQuery);
  4632. smalltalk.addMethod(
  4633. '_hasClass_',
  4634. smalltalk.method({
  4635. selector: 'hasClass:',
  4636. category: 'testing',
  4637. fn: function (aString){
  4638. var self=this;
  4639. return self._call_withArgument_("hasClass",aString);
  4640. return self;},
  4641. source: unescape('hasClass%3A%20aString%0A%20%20%20%20%22Determine%20whether%20any%20of%20the%20matched%20elements%20are%20assigned%20the%20given%20class.%22%0A%20%20%20%20%5Eself%20call%3A%20%27hasClass%27%20withArgument%3A%20aString%0A')}),
  4642. smalltalk.JQuery);
  4643. smalltalk.addMethod(
  4644. '_fromString_',
  4645. smalltalk.method({
  4646. selector: 'fromString:',
  4647. category: 'instance creation',
  4648. fn: function (aString){
  4649. var self=this;
  4650. var newJQuery=nil;
  4651. (function(){newJQuery = jQuery(String(aString))})();
  4652. return self._from_(newJQuery);
  4653. return self;},
  4654. source: unescape('fromString%3A%20aString%0A%20%20%20%20%7C%20newJQuery%20%7C%0A%20%20%20%20%7B%27newJQuery%20%3D%20jQuery%28String%28aString%29%29%27%7D.%0A%20%20%20%20%5Eself%20from%3A%20newJQuery%0A')}),
  4655. smalltalk.JQuery.klass);
  4656. smalltalk.addMethod(
  4657. '_from_',
  4658. smalltalk.method({
  4659. selector: 'from:',
  4660. category: 'instance creation',
  4661. fn: function (anObject){
  4662. var self=this;
  4663. return (function($rec){$rec._initializeWithJQueryObject_(anObject);return $rec._yourself();})(self._new());
  4664. return self;},
  4665. source: unescape('from%3A%20anObject%0A%20%20%20%20%5Eself%20new%0A%09initializeWithJQueryObject%3A%20anObject%3B%0A%09yourself%0A')}),
  4666. smalltalk.JQuery.klass);
  4667. smalltalk.addClass('Ajax', smalltalk.Object, ['settings'], 'JQuery');
  4668. smalltalk.Ajax.comment=unescape('instance%20variable%20names%3A%0A-%20settings%20%20A%20set%20of%20key/value%20pairs%20that%20configure%20the%20Ajax%20request.%20All%20settings%20are%20optional.%0A%0AFull%20list%20of%20settings%20options%20at%20http%3A//api.jquery.com/jQuery.ajax/%0A')
  4669. smalltalk.addMethod(
  4670. '_initialize',
  4671. smalltalk.method({
  4672. selector: 'initialize',
  4673. category: 'initialization',
  4674. fn: function (){
  4675. var self=this;
  4676. self.klass.superclass.fn.prototype['_initialize'].apply(self, []);
  4677. self['@settings']=smalltalk.Dictionary._new();
  4678. return self;},
  4679. source: unescape('initialize%0A%20%20%20%20super%20initialize.%0A%20%20%20%20settings%20%3A%3D%20Dictionary%20new%0A')}),
  4680. smalltalk.Ajax);
  4681. smalltalk.addMethod(
  4682. '_at_',
  4683. smalltalk.method({
  4684. selector: 'at:',
  4685. category: 'accessing',
  4686. fn: function (aKey){
  4687. var self=this;
  4688. return self['@settings']._at_ifAbsent_(aKey,(function(){return nil;}));
  4689. return self;},
  4690. source: unescape('at%3A%20aKey%0A%20%20%20%20%5Esettings%20at%3A%20aKey%20ifAbsent%3A%20%5Bnil%5D%0A')}),
  4691. smalltalk.Ajax);
  4692. smalltalk.addMethod(
  4693. '_at_put_',
  4694. smalltalk.method({
  4695. selector: 'at:put:',
  4696. category: 'accessing',
  4697. fn: function (aKey, aValue){
  4698. var self=this;
  4699. self['@settings']._at_put_(aKey,aValue);
  4700. return self;},
  4701. source: unescape('at%3A%20aKey%20put%3A%20aValue%0A%20%20%20%20settings%20at%3A%20aKey%20put%3A%20aValue%0A')}),
  4702. smalltalk.Ajax);
  4703. smalltalk.addMethod(
  4704. '_url',
  4705. smalltalk.method({
  4706. selector: 'url',
  4707. category: 'accessing',
  4708. fn: function (){
  4709. var self=this;
  4710. return self._at_("url");
  4711. return self;},
  4712. source: unescape('url%0A%20%20%20%20%5Eself%20at%3A%20%27url%27%0A')}),
  4713. smalltalk.Ajax);
  4714. smalltalk.addMethod(
  4715. '_url_',
  4716. smalltalk.method({
  4717. selector: 'url:',
  4718. category: 'accessing',
  4719. fn: function (aString){
  4720. var self=this;
  4721. self._at_put_("url",aString);
  4722. return self;},
  4723. source: unescape('url%3A%20aString%0A%20%20%20%20self%20at%3A%20%27url%27%20put%3A%20aString%0A')}),
  4724. smalltalk.Ajax);
  4725. smalltalk.addMethod(
  4726. '_send',
  4727. smalltalk.method({
  4728. selector: 'send',
  4729. category: 'actions',
  4730. fn: function (){
  4731. var self=this;
  4732. (function(){jQuery.ajax(self['@settings'])})();
  4733. return self;},
  4734. source: unescape('send%0A%20%20%20%20%7B%27jQuery.ajax%28self%5B%27%27@settings%27%27%5D%29%27%7D%0A')}),
  4735. smalltalk.Ajax);
  4736. smalltalk.addMethod(
  4737. '_url_',
  4738. smalltalk.method({
  4739. selector: 'url:',
  4740. category: 'instance creation',
  4741. fn: function (aString){
  4742. var self=this;
  4743. return (function($rec){$rec._url_(aString);return $rec._yourself();})(self._new());
  4744. return self;},
  4745. source: unescape('url%3A%20aString%0A%20%20%20%20%5Eself%20new%0A%09url%3A%20aString%3B%0A%09yourself%0A')}),
  4746. smalltalk.Ajax.klass);
  4747. smalltalk.addClass('CanvasRenderingContext', smalltalk.Object, [], 'Canvas');
  4748. smalltalk.addMethod(
  4749. '_fillStyle_',
  4750. smalltalk.method({
  4751. selector: 'fillStyle:',
  4752. category: 'drawing paths',
  4753. fn: function (aString) {
  4754. var self = this;
  4755. (function () {self.fillStyle = String(aString);}());
  4756. return self;
  4757. },
  4758. source: unescape('fillStyle%3A%20aString%0A%09%7B%27self.fillStyle%20%3D%20String%28aString%29%27%7D')}),
  4759. smalltalk.CanvasRenderingContext);
  4760. smalltalk.addMethod(
  4761. '_beginPath',
  4762. smalltalk.method({
  4763. selector: 'beginPath',
  4764. category: 'drawing paths',
  4765. fn: function () {
  4766. var self = this;
  4767. (function () {self.beginPath();}());
  4768. return self;
  4769. },
  4770. source: unescape('beginPath%0A%09%7B%27self.beginPath%28%29%27%7D')}),
  4771. smalltalk.CanvasRenderingContext);
  4772. smalltalk.addMethod(
  4773. '_closePath',
  4774. smalltalk.method({
  4775. selector: 'closePath',
  4776. category: 'drawing paths',
  4777. fn: function () {
  4778. var self = this;
  4779. (function () {self.closePath();}());
  4780. return self;
  4781. },
  4782. source: unescape('closePath%0A%09%7B%27self.closePath%28%29%27%7D')}),
  4783. smalltalk.CanvasRenderingContext);
  4784. smalltalk.addMethod(
  4785. '_fill',
  4786. smalltalk.method({
  4787. selector: 'fill',
  4788. category: 'drawing paths',
  4789. fn: function () {
  4790. var self = this;
  4791. (function () {self.fill();}());
  4792. return self;
  4793. },
  4794. source: unescape('fill%0A%09%7B%27self.fill%28%29%27%7D')}),
  4795. smalltalk.CanvasRenderingContext);
  4796. smalltalk.addMethod(
  4797. '_stroke',
  4798. smalltalk.method({
  4799. selector: 'stroke',
  4800. category: 'drawing paths',
  4801. fn: function () {
  4802. var self = this;
  4803. (function () {self.stroke();}());
  4804. return self;
  4805. },
  4806. source: unescape('stroke%0A%09%7B%27self.stroke%28%29%27%7D')}),
  4807. smalltalk.CanvasRenderingContext);
  4808. smalltalk.addMethod(
  4809. '_moveTo_',
  4810. smalltalk.method({
  4811. selector: 'moveTo:',
  4812. category: 'drawing paths',
  4813. fn: function (aPoint) {
  4814. var self = this;
  4815. (function () {self.moveTo(aPoint._x(), aPoint._y());}());
  4816. return self;
  4817. },
  4818. source: unescape('moveTo%3A%20aPoint%0A%09%7B%27self.moveTo%28aPoint._x%28%29%2C%20aPoint._y%28%29%29%27%7D')}),
  4819. smalltalk.CanvasRenderingContext);
  4820. smalltalk.addMethod(
  4821. '_lineTo_',
  4822. smalltalk.method({
  4823. selector: 'lineTo:',
  4824. category: 'drawing paths',
  4825. fn: function (aPoint) {
  4826. var self = this;
  4827. (function () {self.lineTo(aPoint._x(), aPoint._y());}());
  4828. return self;
  4829. },
  4830. source: unescape('lineTo%3A%20aPoint%0A%09%7B%27self.lineTo%28aPoint._x%28%29%2C%20aPoint._y%28%29%29%27%7D')}),
  4831. smalltalk.CanvasRenderingContext);
  4832. smalltalk.addMethod(
  4833. '_arcTo_radius_startAngle_endAngle_anticlockwise_',
  4834. smalltalk.method({
  4835. selector: 'arcTo:radius:startAngle:endAngle:anticlockwise:',
  4836. category: 'drawing arcs',
  4837. fn: function (aPoint, aNumber, aNumber2, aNumber3, aBoolean) {
  4838. var self = this;
  4839. (function () {self.arc(aPoint._x(), aPoint._y(), aNumber, aNumber2, aNumber3, aBoolean);}());
  4840. return self;
  4841. },
  4842. source: unescape('arcTo%3A%20aPoint%20radius%3A%20aNumber%20startAngle%3A%20aNumber2%20endAngle%3A%20aNumber3%20anticlockwise%3A%20aBoolean%0A%09%7B%27self.arc%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20aNumber%2C%20aNumber2%2C%20aNumber3%2C%20aBoolean%29%27%7D%20')}),
  4843. smalltalk.CanvasRenderingContext);
  4844. smalltalk.addMethod(
  4845. '_arcTo_radius_',
  4846. smalltalk.method({
  4847. selector: 'arcTo:radius:',
  4848. category: 'drawing arcs',
  4849. fn: function (aPoint, aNumber) {
  4850. var self = this;
  4851. self._arcTo_radius_startAngle_endAngle_anticlockwise_(aPoint, aNumber, 0, smalltalk.Number._pi().__star(2), false);
  4852. return self;
  4853. },
  4854. source: unescape('arcTo%3A%20aPoint%20radius%3A%20aNumber%0A%09self%20arcTo%3A%20aPoint%20radius%3A%20aNumber%20startAngle%3A%200%20endAngle%3A%20Number%20pi%20*%202%20anticlockwise%3A%20false')}),
  4855. smalltalk.CanvasRenderingContext);
  4856. smalltalk.addMethod(
  4857. '_fillRectFrom_to_',
  4858. smalltalk.method({
  4859. selector: 'fillRectFrom:to:',
  4860. category: 'drawing rectangles',
  4861. fn: function (aPoint, anotherPoint) {
  4862. var self = this;
  4863. (function () {self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y());}());
  4864. return self;
  4865. },
  4866. source: unescape('fillRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%7B%27self.fillRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%27%7D')}),
  4867. smalltalk.CanvasRenderingContext);
  4868. smalltalk.addMethod(
  4869. '_strokeRectFrom_to_',
  4870. smalltalk.method({
  4871. selector: 'strokeRectFrom:to:',
  4872. category: 'drawing rectangles',
  4873. fn: function (aPoint, anotherPoint) {
  4874. var self = this;
  4875. (function () {self.strokeRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y());}());
  4876. return self;
  4877. },
  4878. source: unescape('strokeRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%7B%27self.strokeRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%27%7D')}),
  4879. smalltalk.CanvasRenderingContext);
  4880. smalltalk.addMethod(
  4881. '_clearRectFrom_to_',
  4882. smalltalk.method({
  4883. selector: 'clearRectFrom:to:',
  4884. category: 'drawing rectangles',
  4885. fn: function (aPoint, anotherPoint) {
  4886. var self = this;
  4887. (function () {self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y());}());
  4888. return self;
  4889. },
  4890. source: unescape('clearRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%7B%27self.fillRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%27%7D')}),
  4891. smalltalk.CanvasRenderingContext);
  4892. smalltalk.addMethod(
  4893. '_strokeStyle_',
  4894. smalltalk.method({
  4895. selector: 'strokeStyle:',
  4896. category: 'drawing paths',
  4897. fn: function (aString) {
  4898. var self = this;
  4899. (function () {self.strokeStyle = String(aString);}());
  4900. return self;
  4901. },
  4902. source: unescape('strokeStyle%3A%20aString%0A%09%7B%27self.strokeStyle%20%3D%20String%28aString%29%27%7D')}),
  4903. smalltalk.CanvasRenderingContext);
  4904. smalltalk.addMethod(
  4905. '_lineWidth_',
  4906. smalltalk.method({
  4907. selector: 'lineWidth:',
  4908. category: 'drawing paths',
  4909. fn: function (aNumber) {
  4910. var self = this;
  4911. (function () {self.lineWidth = aNumber;}());
  4912. return self;
  4913. },
  4914. source: unescape('lineWidth%3A%20aNumber%0A%09%7B%27self.lineWidth%20%3D%20aNumber%27%7D')}),
  4915. smalltalk.CanvasRenderingContext);
  4916. smalltalk.addMethod(
  4917. '_tagBrush_',
  4918. smalltalk.method({
  4919. selector: 'tagBrush:',
  4920. category: 'instance creation',
  4921. fn: function (aTagBrush) {
  4922. var self = this;
  4923. return function () {return aTagBrush._element().getContext("2d");}();
  4924. return self;
  4925. },
  4926. source: unescape('tagBrush%3A%20aTagBrush%0A%09%5E%7B%27return%20aTagBrush._element%28%29.getContext%28%27%272d%27%27%29%27%7D')}),
  4927. smalltalk.CanvasRenderingContext.klass);
  4928. smalltalk.addClass('HTMLCanvas', smalltalk.Object, ['root'], 'Canvas');
  4929. smalltalk.addMethod(
  4930. '_root_',
  4931. smalltalk.method({
  4932. selector: 'root:',
  4933. category: 'accessing',
  4934. fn: function (aTagBrush) {
  4935. var self = this;
  4936. self['@root'] = aTagBrush;
  4937. return self;
  4938. },
  4939. source: unescape('root%3A%20aTagBrush%0A%20%20%20%20root%20%3A%3D%20aTagBrush%0A')}),
  4940. smalltalk.HTMLCanvas);
  4941. smalltalk.addMethod(
  4942. '_root',
  4943. smalltalk.method({
  4944. selector: 'root',
  4945. category: 'accessing',
  4946. fn: function () {
  4947. var self = this;
  4948. return self['@root'];
  4949. return self;
  4950. },
  4951. source: unescape('root%0A%20%20%20%20%5Eroot%0A')}),
  4952. smalltalk.HTMLCanvas);
  4953. smalltalk.addMethod(
  4954. '_initialize',
  4955. smalltalk.method({
  4956. selector: 'initialize',
  4957. category: 'initialization',
  4958. fn: function () {
  4959. var self = this;
  4960. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  4961. self['@root'] = smalltalk.TagBrush._fromString_canvas_("div", self);
  4962. return self;
  4963. },
  4964. source: unescape('initialize%0A%20%20%20%20super%20initialize.%0A%20%20%20%20root%20%3A%3D%20TagBrush%20fromString%3A%20%27div%27%20canvas%3A%20self%0A')}),
  4965. smalltalk.HTMLCanvas);
  4966. smalltalk.addMethod(
  4967. '_with_',
  4968. smalltalk.method({
  4969. selector: 'with:',
  4970. category: 'adding',
  4971. fn: function (anObject) {
  4972. var self = this;
  4973. return self._root()._with_(anObject);
  4974. return self;
  4975. },
  4976. source: unescape('with%3A%20anObject%0A%20%20%20%20%5Eself%20root%20with%3A%20anObject%0A')}),
  4977. smalltalk.HTMLCanvas);
  4978. smalltalk.addMethod(
  4979. '_newTag_',
  4980. smalltalk.method({
  4981. selector: 'newTag:',
  4982. category: 'tags',
  4983. fn: function (aString) {
  4984. var self = this;
  4985. return smalltalk.TagBrush._fromString_canvas_(aString, self);
  4986. return self;
  4987. },
  4988. source: unescape('newTag%3A%20aString%0A%20%20%20%20%5ETagBrush%20fromString%3A%20aString%20canvas%3A%20self%0A')}),
  4989. smalltalk.HTMLCanvas);
  4990. smalltalk.addMethod(
  4991. '_tag_',
  4992. smalltalk.method({
  4993. selector: 'tag:',
  4994. category: 'tags',
  4995. fn: function (aString) {
  4996. var self = this;
  4997. return self['@root']._addBrush_(self._newTag_(aString));
  4998. return self;
  4999. },
  5000. source: unescape('tag%3A%20aString%0A%20%20%20%20%5Eroot%20addBrush%3A%20%28self%20newTag%3A%20aString%29%0A')}),
  5001. smalltalk.HTMLCanvas);
  5002. smalltalk.addMethod(
  5003. '_h1',
  5004. smalltalk.method({
  5005. selector: 'h1',
  5006. category: 'tags',
  5007. fn: function () {
  5008. var self = this;
  5009. return self._tag_("h1");
  5010. return self;
  5011. },
  5012. source: unescape('h1%0A%20%20%20%20%5Eself%20tag%3A%20%27h1%27%0A')}),
  5013. smalltalk.HTMLCanvas);
  5014. smalltalk.addMethod(
  5015. '_h2',
  5016. smalltalk.method({
  5017. selector: 'h2',
  5018. category: 'tags',
  5019. fn: function () {
  5020. var self = this;
  5021. return self._tag_("h2");
  5022. return self;
  5023. },
  5024. source: unescape('h2%0A%20%20%20%20%5Eself%20tag%3A%20%27h2%27%0A')}),
  5025. smalltalk.HTMLCanvas);
  5026. smalltalk.addMethod(
  5027. '_h3',
  5028. smalltalk.method({
  5029. selector: 'h3',
  5030. category: 'tags',
  5031. fn: function () {
  5032. var self = this;
  5033. return self._tag_("h3");
  5034. return self;
  5035. },
  5036. source: unescape('h3%0A%20%20%20%20%5Eself%20tag%3A%20%27h3%27%0A')}),
  5037. smalltalk.HTMLCanvas);
  5038. smalltalk.addMethod(
  5039. '_h4',
  5040. smalltalk.method({
  5041. selector: 'h4',
  5042. category: 'tags',
  5043. fn: function () {
  5044. var self = this;
  5045. return self._tag_("h4");
  5046. return self;
  5047. },
  5048. source: unescape('h4%0A%20%20%20%20%5Eself%20tag%3A%20%27h4%27%0A')}),
  5049. smalltalk.HTMLCanvas);
  5050. smalltalk.addMethod(
  5051. '_h5',
  5052. smalltalk.method({
  5053. selector: 'h5',
  5054. category: 'tags',
  5055. fn: function () {
  5056. var self = this;
  5057. return self._tag_("h5");
  5058. return self;
  5059. },
  5060. source: unescape('h5%0A%20%20%20%20%5Eself%20tag%3A%20%27h5%27%0A')}),
  5061. smalltalk.HTMLCanvas);
  5062. smalltalk.addMethod(
  5063. '_h6',
  5064. smalltalk.method({
  5065. selector: 'h6',
  5066. category: 'tags',
  5067. fn: function () {
  5068. var self = this;
  5069. return self._tag_("h6");
  5070. return self;
  5071. },
  5072. source: unescape('h6%0A%20%20%20%20%5Eself%20tag%3A%20%27h6%27%0A')}),
  5073. smalltalk.HTMLCanvas);
  5074. smalltalk.addMethod(
  5075. '_p',
  5076. smalltalk.method({
  5077. selector: 'p',
  5078. category: 'tags',
  5079. fn: function () {
  5080. var self = this;
  5081. return self._tag_("p");
  5082. return self;
  5083. },
  5084. source: unescape('p%0A%20%20%20%20%5Eself%20tag%3A%20%27p%27%0A')}),
  5085. smalltalk.HTMLCanvas);
  5086. smalltalk.addMethod(
  5087. '_div',
  5088. smalltalk.method({
  5089. selector: 'div',
  5090. category: 'tags',
  5091. fn: function () {
  5092. var self = this;
  5093. return self._tag_("div");
  5094. return self;
  5095. },
  5096. source: unescape('div%0A%20%20%20%20%5Eself%20tag%3A%20%27div%27%0A')}),
  5097. smalltalk.HTMLCanvas);
  5098. smalltalk.addMethod(
  5099. '_span',
  5100. smalltalk.method({
  5101. selector: 'span',
  5102. category: 'tags',
  5103. fn: function () {
  5104. var self = this;
  5105. return self._tag_("span");
  5106. return self;
  5107. },
  5108. source: unescape('span%0A%20%20%20%20%5Eself%20tag%3A%20%27span%27%0A')}),
  5109. smalltalk.HTMLCanvas);
  5110. smalltalk.addMethod(
  5111. '_img',
  5112. smalltalk.method({
  5113. selector: 'img',
  5114. category: 'tags',
  5115. fn: function () {
  5116. var self = this;
  5117. return self._tag_("img");
  5118. return self;
  5119. },
  5120. source: unescape('img%0A%20%20%20%20%5Eself%20tag%3A%20%27img%27%0A')}),
  5121. smalltalk.HTMLCanvas);
  5122. smalltalk.addMethod(
  5123. '_ul',
  5124. smalltalk.method({
  5125. selector: 'ul',
  5126. category: 'tags',
  5127. fn: function () {
  5128. var self = this;
  5129. return self._tag_("ul");
  5130. return self;
  5131. },
  5132. source: unescape('ul%0A%20%20%20%20%5Eself%20tag%3A%20%27ul%27%0A')}),
  5133. smalltalk.HTMLCanvas);
  5134. smalltalk.addMethod(
  5135. '_ol',
  5136. smalltalk.method({
  5137. selector: 'ol',
  5138. category: 'tags',
  5139. fn: function () {
  5140. var self = this;
  5141. return self._tag_("ol");
  5142. return self;
  5143. },
  5144. source: unescape('ol%0A%20%20%20%20%5Eself%20tag%3A%20%27ol%27%0A')}),
  5145. smalltalk.HTMLCanvas);
  5146. smalltalk.addMethod(
  5147. '_li',
  5148. smalltalk.method({
  5149. selector: 'li',
  5150. category: 'tags',
  5151. fn: function () {
  5152. var self = this;
  5153. return self._tag_("li");
  5154. return self;
  5155. },
  5156. source: unescape('li%0A%20%20%20%20%5Eself%20tag%3A%20%27li%27%0A')}),
  5157. smalltalk.HTMLCanvas);
  5158. smalltalk.addMethod(
  5159. '_table',
  5160. smalltalk.method({
  5161. selector: 'table',
  5162. category: 'tags',
  5163. fn: function () {
  5164. var self = this;
  5165. return self._tag_("table");
  5166. return self;
  5167. },
  5168. source: unescape('table%0A%20%20%20%20%5Eself%20tag%3A%20%27table%27%0A')}),
  5169. smalltalk.HTMLCanvas);
  5170. smalltalk.addMethod(
  5171. '_tr',
  5172. smalltalk.method({
  5173. selector: 'tr',
  5174. category: 'tags',
  5175. fn: function () {
  5176. var self = this;
  5177. return self._tag_("tr");
  5178. return self;
  5179. },
  5180. source: unescape('tr%0A%20%20%20%20%5Eself%20tag%3A%20%27tr%27%0A')}),
  5181. smalltalk.HTMLCanvas);
  5182. smalltalk.addMethod(
  5183. '_td',
  5184. smalltalk.method({
  5185. selector: 'td',
  5186. category: 'tags',
  5187. fn: function () {
  5188. var self = this;
  5189. return self._tag_("td");
  5190. return self;
  5191. },
  5192. source: unescape('td%20%0A%20%20%20%20%5Eself%20tag%3A%20%27td%27%0A')}),
  5193. smalltalk.HTMLCanvas);
  5194. smalltalk.addMethod(
  5195. '_th',
  5196. smalltalk.method({
  5197. selector: 'th',
  5198. category: 'tags',
  5199. fn: function () {
  5200. var self = this;
  5201. return self._tag_("th");
  5202. return self;
  5203. },
  5204. source: unescape('th%0A%20%20%20%20%5Eself%20tag%3A%20%27th%27%0A')}),
  5205. smalltalk.HTMLCanvas);
  5206. smalltalk.addMethod(
  5207. '_form',
  5208. smalltalk.method({
  5209. selector: 'form',
  5210. category: 'tags',
  5211. fn: function () {
  5212. var self = this;
  5213. return self._tag_("form");
  5214. return self;
  5215. },
  5216. source: unescape('form%0A%20%20%20%20%5Eself%20tag%3A%20%27form%27%0A')}),
  5217. smalltalk.HTMLCanvas);
  5218. smalltalk.addMethod(
  5219. '_input',
  5220. smalltalk.method({
  5221. selector: 'input',
  5222. category: 'tags',
  5223. fn: function () {
  5224. var self = this;
  5225. return self._tag_("input");
  5226. return self;
  5227. },
  5228. source: unescape('input%0A%20%20%20%20%5Eself%20tag%3A%20%27input%27%0A')}),
  5229. smalltalk.HTMLCanvas);
  5230. smalltalk.addMethod(
  5231. '_button',
  5232. smalltalk.method({
  5233. selector: 'button',
  5234. category: 'tags',
  5235. fn: function () {
  5236. var self = this;
  5237. return self._tag_("button");
  5238. return self;
  5239. },
  5240. source: unescape('button%0A%20%20%20%20%5Eself%20tag%3A%20%27button%27%0A')}),
  5241. smalltalk.HTMLCanvas);
  5242. smalltalk.addMethod(
  5243. '_select',
  5244. smalltalk.method({
  5245. selector: 'select',
  5246. category: 'tags',
  5247. fn: function () {
  5248. var self = this;
  5249. return self._tag_("select");
  5250. return self;
  5251. },
  5252. source: unescape('select%0A%20%20%20%20%5Eself%20tag%3A%20%27select%27%0A')}),
  5253. smalltalk.HTMLCanvas);
  5254. smalltalk.addMethod(
  5255. '_option',
  5256. smalltalk.method({
  5257. selector: 'option',
  5258. category: 'tags',
  5259. fn: function () {
  5260. var self = this;
  5261. return self._tag_("option");
  5262. return self;
  5263. },
  5264. source: unescape('option%0A%20%20%20%20%5Eself%20tag%3A%20%27option%27%0A')}),
  5265. smalltalk.HTMLCanvas);
  5266. smalltalk.addMethod(
  5267. '_textarea',
  5268. smalltalk.method({
  5269. selector: 'textarea',
  5270. category: 'tags',
  5271. fn: function () {
  5272. var self = this;
  5273. return self._tag_("textarea");
  5274. return self;
  5275. },
  5276. source: unescape('textarea%0A%20%20%20%20%5Eself%20tag%3A%20%27textarea%27%0A')}),
  5277. smalltalk.HTMLCanvas);
  5278. smalltalk.addMethod(
  5279. '_a',
  5280. smalltalk.method({
  5281. selector: 'a',
  5282. category: 'tags',
  5283. fn: function () {
  5284. var self = this;
  5285. return self._tag_("a");
  5286. return self;
  5287. },
  5288. source: unescape('a%0A%20%20%20%20%5Eself%20tag%3A%20%27a%27%0A')}),
  5289. smalltalk.HTMLCanvas);
  5290. smalltalk.addMethod(
  5291. '_appendToJQuery_',
  5292. smalltalk.method({
  5293. selector: 'appendToJQuery:',
  5294. category: '*JQuery',
  5295. fn: function (aJQuery) {
  5296. var self = this;
  5297. aJQuery._appendElement_(self['@root']._element());
  5298. return self;
  5299. },
  5300. source: unescape('appendToJQuery%3A%20aJQuery%0A%20%20%20%20aJQuery%20appendElement%3A%20root%20element%0A')}),
  5301. smalltalk.HTMLCanvas);
  5302. smalltalk.addMethod(
  5303. '_canvas',
  5304. smalltalk.method({
  5305. selector: 'canvas',
  5306. category: 'tags',
  5307. fn: function () {
  5308. var self = this;
  5309. return self._tag_("canvas");
  5310. return self;
  5311. },
  5312. source: unescape('canvas%0A%09%5Eself%20tag%3A%20%27canvas%27%0A')}),
  5313. smalltalk.HTMLCanvas);
  5314. smalltalk.addClass('TagBrush', smalltalk.Object, ['canvas', 'element'], 'Canvas');
  5315. smalltalk.addMethod(
  5316. '_contents_',
  5317. smalltalk.method({
  5318. selector: 'contents:',
  5319. category: 'adding',
  5320. fn: function (anObject) {
  5321. var self = this;
  5322. self._asJQuery()._empty();
  5323. self._append_(anObject);
  5324. return self;
  5325. },
  5326. source: unescape('contents%3A%20anObject%0A%20%20%20%20self%20asJQuery%20empty.%0A%20%20%20%20self%20append%3A%20anObject%0A')}),
  5327. smalltalk.TagBrush);
  5328. smalltalk.addMethod(
  5329. '_addBrush_',
  5330. smalltalk.method({
  5331. selector: 'addBrush:',
  5332. category: 'adding',
  5333. fn: function (aTagBrush) {
  5334. var self = this;
  5335. self._appendChild_(aTagBrush._element());
  5336. return aTagBrush;
  5337. return self;
  5338. },
  5339. source: unescape('addBrush%3A%20aTagBrush%0A%20%20%20%20self%20appendChild%3A%20aTagBrush%20element.%0A%20%20%20%20%5EaTagBrush%0A')}),
  5340. smalltalk.TagBrush);
  5341. smalltalk.addMethod(
  5342. '_with_',
  5343. smalltalk.method({
  5344. selector: 'with:',
  5345. category: 'adding',
  5346. fn: function (anObject) {
  5347. var self = this;
  5348. self._append_(anObject);
  5349. return self;
  5350. },
  5351. source: unescape('with%3A%20anObject%0A%20%20%20%20self%20append%3A%20anObject%0A')}),
  5352. smalltalk.TagBrush);
  5353. smalltalk.addMethod(
  5354. '_append_',
  5355. smalltalk.method({
  5356. selector: 'append:',
  5357. category: 'adding',
  5358. fn: function (anObject) {
  5359. var self = this;
  5360. anObject._appendToBrush_(self);
  5361. return self;
  5362. },
  5363. source: unescape('append%3A%20anObject%0A%20%20%20%20anObject%20appendToBrush%3A%20self%0A')}),
  5364. smalltalk.TagBrush);
  5365. smalltalk.addMethod(
  5366. '_appendToBrush_',
  5367. smalltalk.method({
  5368. selector: 'appendToBrush:',
  5369. category: 'adding',
  5370. fn: function (aTagBrush) {
  5371. var self = this;
  5372. aTagBrush._addBrush_(self);
  5373. return self;
  5374. },
  5375. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20addBrush%3A%20self%0A')}),
  5376. smalltalk.TagBrush);
  5377. smalltalk.addMethod(
  5378. '_appendBlock_',
  5379. smalltalk.method({
  5380. selector: 'appendBlock:',
  5381. category: 'adding',
  5382. fn: function (aBlock) {
  5383. var self = this;
  5384. var root = nil;
  5385. root = canvas._root();
  5386. canvas._root_(self);
  5387. aBlock._value_(canvas);
  5388. canvas._root_(root);
  5389. return self;
  5390. },
  5391. source: unescape('appendBlock%3A%20aBlock%0A%20%20%20%20%7C%20root%20%7C%0A%20%20%20%20root%20%3A%3D%20canvas%20root.%0A%20%20%20%20canvas%20root%3A%20self.%0A%20%20%20%20aBlock%20value%3A%20canvas.%0A%20%20%20%20canvas%20root%3A%20root%0A')}),
  5392. smalltalk.TagBrush);
  5393. smalltalk.addMethod(
  5394. '_appendChild_',
  5395. smalltalk.method({
  5396. selector: 'appendChild:',
  5397. category: 'adding',
  5398. fn: function (anElement) {
  5399. var self = this;
  5400. (function () {self['@element'].appendChild(anElement);}());
  5401. return self;
  5402. },
  5403. source: unescape('appendChild%3A%20anElement%0A%20%20%20%20%7B%27self%5B%27%27@element%27%27%5D.appendChild%28anElement%29%27%7D%0A')}),
  5404. smalltalk.TagBrush);
  5405. smalltalk.addMethod(
  5406. '_appendString_',
  5407. smalltalk.method({
  5408. selector: 'appendString:',
  5409. category: 'adding',
  5410. fn: function (aString) {
  5411. var self = this;
  5412. self._appendChild_(self._createTextNodeFor_(aString));
  5413. return self;
  5414. },
  5415. source: unescape('appendString%3A%20aString%0A%20%20%20%20self%20appendChild%3A%20%28self%20createTextNodeFor%3A%20aString%29%0A')}),
  5416. smalltalk.TagBrush);
  5417. smalltalk.addMethod(
  5418. '_at_put_',
  5419. smalltalk.method({
  5420. selector: 'at:put:',
  5421. category: 'attributes',
  5422. fn: function (aString, aValue) {
  5423. var self = this;
  5424. (function () {self['@element'].setAttribute(aString, aValue);}());
  5425. return self;
  5426. },
  5427. source: unescape('at%3A%20aString%20put%3A%20aValue%0A%20%20%20%20%7B%27self%5B%27%27@element%27%27%5D.setAttribute%28aString%2C%20aValue%29%27%7D%0A')}),
  5428. smalltalk.TagBrush);
  5429. smalltalk.addMethod(
  5430. '_removeAt_',
  5431. smalltalk.method({
  5432. selector: 'removeAt:',
  5433. category: 'attributes',
  5434. fn: function (aString) {
  5435. var self = this;
  5436. (function () {self['@element'].removeAttribute(aString);}());
  5437. return self;
  5438. },
  5439. source: unescape('removeAt%3A%20aString%0A%20%20%20%20%7B%27self%5B%27%27@element%27%27%5D.removeAttribute%28aString%29%27%7D%0A')}),
  5440. smalltalk.TagBrush);
  5441. smalltalk.addMethod(
  5442. '_class_',
  5443. smalltalk.method({
  5444. selector: 'class:',
  5445. category: 'attributes',
  5446. fn: function (aString) {
  5447. var self = this;
  5448. self._at_put_("class", aString);
  5449. return self;
  5450. },
  5451. source: unescape('class%3A%20aString%0A%20%20%20%20self%20at%3A%20%27class%27%20put%3A%20aString%0A')}),
  5452. smalltalk.TagBrush);
  5453. smalltalk.addMethod(
  5454. '_id_',
  5455. smalltalk.method({
  5456. selector: 'id:',
  5457. category: 'attributes',
  5458. fn: function (aString) {
  5459. var self = this;
  5460. self._at_put_("id", aString);
  5461. return self;
  5462. },
  5463. source: unescape('id%3A%20aString%0A%20%20%20%20self%20at%3A%20%27id%27%20put%3A%20aString%0A')}),
  5464. smalltalk.TagBrush);
  5465. smalltalk.addMethod(
  5466. '_src_',
  5467. smalltalk.method({
  5468. selector: 'src:',
  5469. category: 'attributes',
  5470. fn: function (aString) {
  5471. var self = this;
  5472. self._at_put_("src", aString);
  5473. return self;
  5474. },
  5475. source: unescape('src%3A%20aString%0A%20%20%20%20self%20%20at%3A%20%27src%27%20put%3A%20aString%0A')}),
  5476. smalltalk.TagBrush);
  5477. smalltalk.addMethod(
  5478. '_href_',
  5479. smalltalk.method({
  5480. selector: 'href:',
  5481. category: 'attributes',
  5482. fn: function (aString) {
  5483. var self = this;
  5484. self._at_put_("href", aString);
  5485. return self;
  5486. },
  5487. source: unescape('href%3A%20aString%0A%20%20%20%20self%20at%3A%20%27href%27%20put%3A%20aString%0A')}),
  5488. smalltalk.TagBrush);
  5489. smalltalk.addMethod(
  5490. '_title_',
  5491. smalltalk.method({
  5492. selector: 'title:',
  5493. category: 'attributes',
  5494. fn: function (aString) {
  5495. var self = this;
  5496. self._at_put_("title", aString);
  5497. return self;
  5498. },
  5499. source: unescape('title%3A%20aString%0A%20%20%20%20self%20at%3A%20%27title%27%20put%3A%20aString%0A')}),
  5500. smalltalk.TagBrush);
  5501. smalltalk.addMethod(
  5502. '_style_',
  5503. smalltalk.method({
  5504. selector: 'style:',
  5505. category: 'attributes',
  5506. fn: function (aString) {
  5507. var self = this;
  5508. self._at_put_("style", aString);
  5509. return self;
  5510. },
  5511. source: unescape('style%3A%20aString%0A%20%20%20%20self%20at%3A%20%27style%27%20put%3A%20aString%0A')}),
  5512. smalltalk.TagBrush);
  5513. smalltalk.addMethod(
  5514. '_initializeFromString_canvas_',
  5515. smalltalk.method({
  5516. selector: 'initializeFromString:canvas:',
  5517. category: 'initialization',
  5518. fn: function (aString, aCanvas) {
  5519. var self = this;
  5520. self['@element'] = self._createElementFor_(aString);
  5521. canvas = aCanvas;
  5522. return self;
  5523. },
  5524. source: unescape('initializeFromString%3A%20aString%20canvas%3A%20aCanvas%0A%20%20%20%20element%20%3A%3D%20self%20createElementFor%3A%20aString.%0A%20%20%20%20canvas%20%3A%3D%20aCanvas%0A')}),
  5525. smalltalk.TagBrush);
  5526. smalltalk.addMethod(
  5527. '_element',
  5528. smalltalk.method({
  5529. selector: 'element',
  5530. category: 'accessing',
  5531. fn: function () {
  5532. var self = this;
  5533. return self['@element'];
  5534. return self;
  5535. },
  5536. source: unescape('element%0A%20%20%20%20%5Eelement%0A')}),
  5537. smalltalk.TagBrush);
  5538. smalltalk.addMethod(
  5539. '_asJQuery',
  5540. smalltalk.method({
  5541. selector: 'asJQuery',
  5542. category: 'converting',
  5543. fn: function () {
  5544. var self = this;
  5545. return function () {return smalltalk.JQuery._from_(jQuery(self['@element']));}();
  5546. return self;
  5547. },
  5548. source: unescape('asJQuery%0A%20%20%20%20%5E%7B%27return%20smalltalk.JQuery._from_%28jQuery%28self%5B%27%27@element%27%27%5D%29%29%27%7D%0A')}),
  5549. smalltalk.TagBrush);
  5550. smalltalk.addMethod(
  5551. '_asJQueryDo_',
  5552. smalltalk.method({
  5553. selector: 'asJQueryDo:',
  5554. category: 'converting',
  5555. fn: function (aBlock) {
  5556. var self = this;
  5557. aBlock._value_(self._asJQuery());
  5558. return self;
  5559. },
  5560. source: unescape('asJQueryDo%3A%20aBlock%0A%20%20%20%20aBlock%20value%3A%20self%20asJQuery%0A')}),
  5561. smalltalk.TagBrush);
  5562. smalltalk.addMethod(
  5563. '_onKeyDown_',
  5564. smalltalk.method({
  5565. selector: 'onKeyDown:',
  5566. category: 'events',
  5567. fn: function (aBlock) {
  5568. var self = this;
  5569. self._asJQuery()._on_do_("keydown", aBlock);
  5570. return self;
  5571. },
  5572. source: unescape('onKeyDown%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27keydown%27%20do%3A%20aBlock%0A')}),
  5573. smalltalk.TagBrush);
  5574. smalltalk.addMethod(
  5575. '_onKeyPress_',
  5576. smalltalk.method({
  5577. selector: 'onKeyPress:',
  5578. category: 'events',
  5579. fn: function (aBlock) {
  5580. var self = this;
  5581. self._asJQuery()._on_do_("keypress", aBlock);
  5582. return self;
  5583. },
  5584. source: unescape('onKeyPress%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27keypress%27%20do%3A%20aBlock%0A')}),
  5585. smalltalk.TagBrush);
  5586. smalltalk.addMethod(
  5587. '_onKeyUp_',
  5588. smalltalk.method({
  5589. selector: 'onKeyUp:',
  5590. category: 'events',
  5591. fn: function (aBlock) {
  5592. var self = this;
  5593. self._asJQuery()._on_do_("keyup", aBlock);
  5594. return self;
  5595. },
  5596. source: unescape('onKeyUp%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27keyup%27%20do%3A%20aBlock%0A')}),
  5597. smalltalk.TagBrush);
  5598. smalltalk.addMethod(
  5599. '_onFocus_',
  5600. smalltalk.method({
  5601. selector: 'onFocus:',
  5602. category: 'events',
  5603. fn: function (aBlock) {
  5604. var self = this;
  5605. self._asJQuery()._on_do_("focus", aBlock);
  5606. return self;
  5607. },
  5608. source: unescape('onFocus%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27focus%27%20do%3A%20aBlock%0A')}),
  5609. smalltalk.TagBrush);
  5610. smalltalk.addMethod(
  5611. '_onBlur_',
  5612. smalltalk.method({
  5613. selector: 'onBlur:',
  5614. category: 'events',
  5615. fn: function (aBlock) {
  5616. var self = this;
  5617. self._asJQuery()._on_do_("blur", aBlock);
  5618. return self;
  5619. },
  5620. source: unescape('onBlur%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27blur%27%20do%3A%20aBlock%0A')}),
  5621. smalltalk.TagBrush);
  5622. smalltalk.addMethod(
  5623. '_onChange_',
  5624. smalltalk.method({
  5625. selector: 'onChange:',
  5626. category: 'events',
  5627. fn: function (aBlock) {
  5628. var self = this;
  5629. self._asJQuery()._on_do_("change", aBlock);
  5630. return self;
  5631. },
  5632. source: unescape('onChange%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27change%27%20do%3A%20aBlock%0A')}),
  5633. smalltalk.TagBrush);
  5634. smalltalk.addMethod(
  5635. '_onClick_',
  5636. smalltalk.method({
  5637. selector: 'onClick:',
  5638. category: 'events',
  5639. fn: function (aBlock) {
  5640. var self = this;
  5641. self._asJQuery()._on_do_("click", aBlock);
  5642. return self;
  5643. },
  5644. source: unescape('onClick%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27click%27%20do%3A%20aBlock%0A')}),
  5645. smalltalk.TagBrush);
  5646. smalltalk.addMethod(
  5647. '_createElementFor_',
  5648. smalltalk.method({
  5649. selector: 'createElementFor:',
  5650. category: 'private',
  5651. fn: function (aString) {
  5652. var self = this;
  5653. return function () {return document.createElement(String(aString));}();
  5654. return self;
  5655. },
  5656. source: unescape('createElementFor%3A%20aString%0A%20%20%20%20%5E%7B%27return%20document.createElement%28String%28aString%29%29%27%7D%0A')}),
  5657. smalltalk.TagBrush);
  5658. smalltalk.addMethod(
  5659. '_createTextNodeFor_',
  5660. smalltalk.method({
  5661. selector: 'createTextNodeFor:',
  5662. category: 'private',
  5663. fn: function (aString) {
  5664. var self = this;
  5665. return function () {return document.createTextNode(String(aString));}();
  5666. return self;
  5667. },
  5668. source: unescape('createTextNodeFor%3A%20aString%0A%20%20%20%20%5E%7B%27return%20document.createTextNode%28String%28aString%29%29%27%7D%0A')}),
  5669. smalltalk.TagBrush);
  5670. smalltalk.addMethod(
  5671. '_fromString_canvas_',
  5672. smalltalk.method({
  5673. selector: 'fromString:canvas:',
  5674. category: 'instance creation',
  5675. fn: function (aString, aCanvas) {
  5676. var self = this;
  5677. return function ($rec) {$rec._initializeFromString_canvas_(aString, aCanvas);return $rec._yourself();}(self._new());
  5678. return self;
  5679. },
  5680. source: unescape('fromString%3A%20aString%20canvas%3A%20aCanvas%0A%20%20%20%20%5Eself%20new%0A%09initializeFromString%3A%20aString%20canvas%3A%20aCanvas%3B%0A%09yourself%0A')}),
  5681. smalltalk.TagBrush.klass);
  5682. smalltalk.addClass('Widget', smalltalk.Object, ['root'], 'Canvas');
  5683. smalltalk.addMethod(
  5684. '_root',
  5685. smalltalk.method({
  5686. selector: 'root',
  5687. category: 'accessing',
  5688. fn: function () {
  5689. var self = this;
  5690. return self['@root'];
  5691. return self;
  5692. },
  5693. source: unescape('root%0A%20%20%20%20%5Eroot%0A')}),
  5694. smalltalk.Widget);
  5695. smalltalk.addMethod(
  5696. '_appendToBrush_',
  5697. smalltalk.method({
  5698. selector: 'appendToBrush:',
  5699. category: 'adding',
  5700. fn: function (aTagBrush) {
  5701. var self = this;
  5702. self._appendToJQuery_(aTagBrush._asJQuery());
  5703. return self;
  5704. },
  5705. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20self%20appendToJQuery%3A%20aTagBrush%20asJQuery%0A')}),
  5706. smalltalk.Widget);
  5707. smalltalk.addMethod(
  5708. '_appendToJQuery_',
  5709. smalltalk.method({
  5710. selector: 'appendToJQuery:',
  5711. category: 'adding',
  5712. fn: function (aJQuery) {
  5713. var self = this;
  5714. self._render();
  5715. aJQuery._append_(self._root()._asJQuery());
  5716. return self;
  5717. },
  5718. source: unescape('appendToJQuery%3A%20aJQuery%0A%20%20%20%20self%20render.%0A%20%20%20%20aJQuery%20append%3A%20self%20root%20asJQuery%0A')}),
  5719. smalltalk.Widget);
  5720. smalltalk.addMethod(
  5721. '_alert_',
  5722. smalltalk.method({
  5723. selector: 'alert:',
  5724. category: 'actions',
  5725. fn: function (aString) {
  5726. var self = this;
  5727. (function () {alert(aString);}());
  5728. return self;
  5729. },
  5730. source: unescape('alert%3A%20aString%0A%20%20%20%20%7B%27alert%28aString%29%27%7D%0A')}),
  5731. smalltalk.Widget);
  5732. smalltalk.addMethod(
  5733. '_confirm_',
  5734. smalltalk.method({
  5735. selector: 'confirm:',
  5736. category: 'actions',
  5737. fn: function (aString) {
  5738. var self = this;
  5739. return function () {return window.confirm(aString);}();
  5740. return self;
  5741. },
  5742. source: unescape('confirm%3A%20aString%0A%20%20%20%20%5E%7B%27return%20window.confirm%28aString%29%27%7D%0A')}),
  5743. smalltalk.Widget);
  5744. smalltalk.addMethod(
  5745. '_prompt_',
  5746. smalltalk.method({
  5747. selector: 'prompt:',
  5748. category: 'actions',
  5749. fn: function (aString) {
  5750. var self = this;
  5751. return self._prompt_default_(aString, "");
  5752. return self;
  5753. },
  5754. source: unescape('prompt%3A%20aString%0A%20%20%20%20%5Eself%20prompt%3A%20aString%20default%3A%20%27%27%0A')}),
  5755. smalltalk.Widget);
  5756. smalltalk.addMethod(
  5757. '_prompt_default_',
  5758. smalltalk.method({
  5759. selector: 'prompt:default:',
  5760. category: 'actions',
  5761. fn: function (aString, anotherString) {
  5762. var self = this;
  5763. return function () {return window.prompt(aString, anotherString);}();
  5764. return self;
  5765. },
  5766. source: unescape('prompt%3A%20aString%20default%3A%20anotherString%0A%20%20%20%20%5E%7B%27return%20window.prompt%28aString%2C%20anotherString%29%27%7D%0A')}),
  5767. smalltalk.Widget);
  5768. smalltalk.addMethod(
  5769. '_update',
  5770. smalltalk.method({
  5771. selector: 'update',
  5772. category: 'actions',
  5773. fn: function () {
  5774. var self = this;
  5775. var canvas = nil;
  5776. canvas = smalltalk.HTMLCanvas._new();
  5777. canvas._root_(self._root());
  5778. self._root()._asJQuery()._empty();
  5779. self._renderOn_(canvas);
  5780. return self;
  5781. },
  5782. source: unescape('update%0A%20%20%20%20%7C%20canvas%20%7C%0A%20%20%20%20canvas%20%3A%3D%20HTMLCanvas%20new.%0A%20%20%20%20canvas%20root%3A%20self%20root.%0A%20%20%20%20self%20root%20asJQuery%20empty.%0A%20%20%20%20self%20renderOn%3A%20canvas%0A')}),
  5783. smalltalk.Widget);
  5784. smalltalk.addMethod(
  5785. '_render',
  5786. smalltalk.method({
  5787. selector: 'render',
  5788. category: 'rendering',
  5789. fn: function () {
  5790. var self = this;
  5791. var canvas = nil;
  5792. canvas = smalltalk.HTMLCanvas._new();
  5793. self['@root'] = canvas._root();
  5794. self._renderOn_(canvas);
  5795. return self;
  5796. },
  5797. source: unescape('render%0A%20%20%20%20%7C%20canvas%20%7C%0A%20%20%20%20canvas%20%3A%3D%20HTMLCanvas%20new.%0A%20%20%20%20root%20%3A%3D%20canvas%20root.%0A%20%20%20%20self%20renderOn%3A%20canvas%0A')}),
  5798. smalltalk.Widget);
  5799. smalltalk.addMethod(
  5800. '_renderOn_',
  5801. smalltalk.method({
  5802. selector: 'renderOn:',
  5803. category: 'rendering',
  5804. fn: function (html) {
  5805. var self = this;
  5806. return self;
  5807. },
  5808. source: unescape('renderOn%3A%20html%0A%20%20%20%20self%0A')}),
  5809. smalltalk.Widget);
  5810. smalltalk.addClass('CanvasBrush', smalltalk.TagBrush, [], 'Canvas');
  5811. smalltalk.addMethod(
  5812. '_createElement',
  5813. smalltalk.method({
  5814. selector: 'createElement',
  5815. category: 'private',
  5816. fn: function () {
  5817. var self = this;
  5818. return function () {return document.createElement("canvas");}();
  5819. return self;
  5820. },
  5821. source: unescape('createElement%0A%20%20%20%20%5E%7B%27return%20document.createElement%28%27%27canvas%27%27%29%27%7D%0A')}),
  5822. smalltalk.CanvasBrush);
  5823. smalltalk.addMethod(
  5824. '_initializeWithCanvas_',
  5825. smalltalk.method({
  5826. selector: 'initializeWithCanvas:',
  5827. category: 'initialization',
  5828. fn: function (aCanvas) {
  5829. var self = this;
  5830. canvas = aCanvas;
  5831. return self;
  5832. },
  5833. source: unescape('initializeWithCanvas%3A%20aCanvas%0A%09canvas%20%3A%3D%20aCanvas')}),
  5834. smalltalk.CanvasBrush);
  5835. smalltalk.addMethod(
  5836. '_canvas_',
  5837. smalltalk.method({
  5838. selector: 'canvas:',
  5839. category: 'instance creation',
  5840. fn: function (aCanvas) {
  5841. var self = this;
  5842. return function ($rec) {$rec._initializeWithCanvas_(aCanvas);return $rec._yourself();}(self._new());
  5843. return self;
  5844. },
  5845. source: unescape('canvas%3A%20aCanvas%0A%09%5Eself%20new%0A%09%09initializeWithCanvas%3A%20aCanvas%3B%0A%09%09yourself')}),
  5846. smalltalk.CanvasBrush.klass);
  5847. smalltalk.init(smalltalk.Object);