Kernel.js 169 KB

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