Compiler-Tests.js 147 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804
  1. define(["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Compiler-Tests");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  6. $core.addClass("ASTMethodRunningTest", $globals.TestCase, ["receiver"], "Compiler-Tests");
  7. $core.addMethod(
  8. $core.method({
  9. selector: "receiver",
  10. protocol: "accessing",
  11. //>>excludeStart("ide", pragmas.excludeIdeData);
  12. args: [],
  13. source: "receiver\x0a\x09^ receiver",
  14. referencedClasses: [],
  15. //>>excludeEnd("ide");
  16. pragmas: [],
  17. messageSends: []
  18. }, function ($methodClass){ return function (){
  19. var self=this,$self=this;
  20. return $self.receiver;
  21. }; }),
  22. $globals.ASTMethodRunningTest);
  23. $core.addMethod(
  24. $core.method({
  25. selector: "setUp",
  26. protocol: "initialization",
  27. //>>excludeStart("ide", pragmas.excludeIdeData);
  28. args: [],
  29. source: "setUp\x0a\x09receiver := DoIt new",
  30. referencedClasses: ["DoIt"],
  31. //>>excludeEnd("ide");
  32. pragmas: [],
  33. messageSends: ["new"]
  34. }, function ($methodClass){ return function (){
  35. var self=this,$self=this;
  36. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37. return $core.withContext(function($ctx1) {
  38. //>>excludeEnd("ctx");
  39. $self.receiver=$recv($globals.DoIt)._new();
  40. return self;
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  43. //>>excludeEnd("ctx");
  44. }; }),
  45. $globals.ASTMethodRunningTest);
  46. $core.addMethod(
  47. $core.method({
  48. selector: "should:class:receiver:return:",
  49. protocol: "testing",
  50. //>>excludeStart("ide", pragmas.excludeIdeData);
  51. args: ["aString", "aClass", "anObject", "aResult"],
  52. source: "should: aString class: aClass receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09self while: aString inClass: aClass should: [ :runBlock |\x0a\x09\x09self assert: runBlock value equals: aResult ]",
  53. referencedClasses: [],
  54. //>>excludeEnd("ide");
  55. pragmas: [],
  56. messageSends: ["while:inClass:should:", "assert:equals:", "value"]
  57. }, function ($methodClass){ return function (aString,aClass,anObject,aResult){
  58. var self=this,$self=this;
  59. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60. return $core.withContext(function($ctx1) {
  61. //>>excludeEnd("ctx");
  62. $self.receiver=anObject;
  63. $self._while_inClass_should_(aString,aClass,(function(runBlock){
  64. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65. return $core.withContext(function($ctx2) {
  66. //>>excludeEnd("ctx");
  67. return $self._assert_equals_($recv(runBlock)._value(),aResult);
  68. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69. }, function($ctx2) {$ctx2.fillBlock({runBlock:runBlock},$ctx1,1)});
  70. //>>excludeEnd("ctx");
  71. }));
  72. return self;
  73. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74. }, function($ctx1) {$ctx1.fill(self,"should:class:receiver:return:",{aString:aString,aClass:aClass,anObject:anObject,aResult:aResult})});
  75. //>>excludeEnd("ctx");
  76. }; }),
  77. $globals.ASTMethodRunningTest);
  78. $core.addMethod(
  79. $core.method({
  80. selector: "should:receiver:raise:",
  81. protocol: "testing",
  82. //>>excludeStart("ide", pragmas.excludeIdeData);
  83. args: ["aString", "anObject", "anErrorClass"],
  84. source: "should: aString receiver: anObject raise: anErrorClass\x0a\x09receiver := anObject.\x0a\x09self while: aString should: [ :runBlock |\x0a\x09\x09self should: runBlock raise: anErrorClass ]",
  85. referencedClasses: [],
  86. //>>excludeEnd("ide");
  87. pragmas: [],
  88. messageSends: ["while:should:", "should:raise:"]
  89. }, function ($methodClass){ return function (aString,anObject,anErrorClass){
  90. var self=this,$self=this;
  91. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  92. return $core.withContext(function($ctx1) {
  93. //>>excludeEnd("ctx");
  94. $self.receiver=anObject;
  95. $self._while_should_(aString,(function(runBlock){
  96. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  97. return $core.withContext(function($ctx2) {
  98. //>>excludeEnd("ctx");
  99. return $self._should_raise_(runBlock,anErrorClass);
  100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  101. }, function($ctx2) {$ctx2.fillBlock({runBlock:runBlock},$ctx1,1)});
  102. //>>excludeEnd("ctx");
  103. }));
  104. return self;
  105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  106. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass})});
  107. //>>excludeEnd("ctx");
  108. }; }),
  109. $globals.ASTMethodRunningTest);
  110. $core.addMethod(
  111. $core.method({
  112. selector: "should:receiver:return:",
  113. protocol: "testing",
  114. //>>excludeStart("ide", pragmas.excludeIdeData);
  115. args: ["aString", "anObject", "aResult"],
  116. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09self should: aString return: aResult",
  117. referencedClasses: [],
  118. //>>excludeEnd("ide");
  119. pragmas: [],
  120. messageSends: ["should:return:"]
  121. }, function ($methodClass){ return function (aString,anObject,aResult){
  122. var self=this,$self=this;
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. return $core.withContext(function($ctx1) {
  125. //>>excludeEnd("ctx");
  126. $self.receiver=anObject;
  127. $self._should_return_(aString,aResult);
  128. return self;
  129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  130. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult})});
  131. //>>excludeEnd("ctx");
  132. }; }),
  133. $globals.ASTMethodRunningTest);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "should:return:",
  137. protocol: "testing",
  138. //>>excludeStart("ide", pragmas.excludeIdeData);
  139. args: ["aString", "anObject"],
  140. source: "should: aString return: anObject\x0a\x09self while: aString should: [ :runBlock |\x0a\x09\x09self assert: runBlock value equals: anObject ]",
  141. referencedClasses: [],
  142. //>>excludeEnd("ide");
  143. pragmas: [],
  144. messageSends: ["while:should:", "assert:equals:", "value"]
  145. }, function ($methodClass){ return function (aString,anObject){
  146. var self=this,$self=this;
  147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  148. return $core.withContext(function($ctx1) {
  149. //>>excludeEnd("ctx");
  150. $self._while_should_(aString,(function(runBlock){
  151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  152. return $core.withContext(function($ctx2) {
  153. //>>excludeEnd("ctx");
  154. return $self._assert_equals_($recv(runBlock)._value(),anObject);
  155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  156. }, function($ctx2) {$ctx2.fillBlock({runBlock:runBlock},$ctx1,1)});
  157. //>>excludeEnd("ctx");
  158. }));
  159. return self;
  160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  161. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject})});
  162. //>>excludeEnd("ctx");
  163. }; }),
  164. $globals.ASTMethodRunningTest);
  165. $core.addClass("AbstractCompilerTest", $globals.ASTMethodRunningTest, [], "Compiler-Tests");
  166. $core.addMethod(
  167. $core.method({
  168. selector: "testAfterInliningNonLocalBlockReturnIndexSend",
  169. protocol: "tests",
  170. //>>excludeStart("ide", pragmas.excludeIdeData);
  171. args: [],
  172. source: "testAfterInliningNonLocalBlockReturnIndexSend\x0a\x09self should: 'foo [ ^ true ifTrue: [ self class ] ] value. self class' return: DoIt.\x0a",
  173. referencedClasses: ["DoIt"],
  174. //>>excludeEnd("ide");
  175. pragmas: [],
  176. messageSends: ["should:return:"]
  177. }, function ($methodClass){ return function (){
  178. var self=this,$self=this;
  179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  180. return $core.withContext(function($ctx1) {
  181. //>>excludeEnd("ctx");
  182. $self._should_return_("foo [ ^ true ifTrue: [ self class ] ] value. self class",$globals.DoIt);
  183. return self;
  184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  185. }, function($ctx1) {$ctx1.fill(self,"testAfterInliningNonLocalBlockReturnIndexSend",{})});
  186. //>>excludeEnd("ctx");
  187. }; }),
  188. $globals.AbstractCompilerTest);
  189. $core.addMethod(
  190. $core.method({
  191. selector: "testAfterInliningNonLocalBlockReturnSuperSend",
  192. protocol: "tests",
  193. //>>excludeStart("ide", pragmas.excludeIdeData);
  194. args: [],
  195. source: "testAfterInliningNonLocalBlockReturnSuperSend\x0a\x09self should: 'foo [ ^ true ifTrue: [ super class ] ] value' return: DoIt.\x0a",
  196. referencedClasses: ["DoIt"],
  197. //>>excludeEnd("ide");
  198. pragmas: [],
  199. messageSends: ["should:return:"]
  200. }, function ($methodClass){ return function (){
  201. var self=this,$self=this;
  202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  203. return $core.withContext(function($ctx1) {
  204. //>>excludeEnd("ctx");
  205. $self._should_return_("foo [ ^ true ifTrue: [ super class ] ] value",$globals.DoIt);
  206. return self;
  207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  208. }, function($ctx1) {$ctx1.fill(self,"testAfterInliningNonLocalBlockReturnSuperSend",{})});
  209. //>>excludeEnd("ctx");
  210. }; }),
  211. $globals.AbstractCompilerTest);
  212. $core.addMethod(
  213. $core.method({
  214. selector: "testAssignment",
  215. protocol: "tests",
  216. //>>excludeStart("ide", pragmas.excludeIdeData);
  217. args: [],
  218. source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1",
  219. referencedClasses: [],
  220. //>>excludeEnd("ide");
  221. pragmas: [],
  222. messageSends: ["should:return:"]
  223. }, function ($methodClass){ return function (){
  224. var self=this,$self=this;
  225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  226. return $core.withContext(function($ctx1) {
  227. //>>excludeEnd("ctx");
  228. [$self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1))
  229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  230. ,$ctx1.sendIdx["should:return:"]=1
  231. //>>excludeEnd("ctx");
  232. ][0];
  233. [$self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil)
  234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  235. ,$ctx1.sendIdx["should:return:"]=2
  236. //>>excludeEnd("ctx");
  237. ][0];
  238. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  239. return self;
  240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  241. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{})});
  242. //>>excludeEnd("ctx");
  243. }; }),
  244. $globals.AbstractCompilerTest);
  245. $core.addMethod(
  246. $core.method({
  247. selector: "testBackslashSelectors",
  248. protocol: "tests",
  249. //>>excludeStart("ide", pragmas.excludeIdeData);
  250. args: [],
  251. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  252. referencedClasses: [],
  253. //>>excludeEnd("ide");
  254. pragmas: [],
  255. messageSends: ["should:return:"]
  256. }, function ($methodClass){ return function (){
  257. var self=this,$self=this;
  258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  259. return $core.withContext(function($ctx1) {
  260. //>>excludeEnd("ctx");
  261. [$self._should_return_("\x5c arg ^ 4",(4))
  262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  263. ,$ctx1.sendIdx["should:return:"]=1
  264. //>>excludeEnd("ctx");
  265. ][0];
  266. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  267. return self;
  268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  269. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{})});
  270. //>>excludeEnd("ctx");
  271. }; }),
  272. $globals.AbstractCompilerTest);
  273. $core.addMethod(
  274. $core.method({
  275. selector: "testBlockReturn",
  276. protocol: "tests",
  277. //>>excludeStart("ide", pragmas.excludeIdeData);
  278. args: [],
  279. source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
  280. referencedClasses: [],
  281. //>>excludeEnd("ide");
  282. pragmas: [],
  283. messageSends: ["should:return:"]
  284. }, function ($methodClass){ return function (){
  285. var self=this,$self=this;
  286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  287. return $core.withContext(function($ctx1) {
  288. //>>excludeEnd("ctx");
  289. [$self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)])
  290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  291. ,$ctx1.sendIdx["should:return:"]=1
  292. //>>excludeEnd("ctx");
  293. ][0];
  294. [$self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)])
  295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  296. ,$ctx1.sendIdx["should:return:"]=2
  297. //>>excludeEnd("ctx");
  298. ][0];
  299. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  300. return self;
  301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  302. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{})});
  303. //>>excludeEnd("ctx");
  304. }; }),
  305. $globals.AbstractCompilerTest);
  306. $core.addMethod(
  307. $core.method({
  308. selector: "testCascades",
  309. protocol: "tests",
  310. //>>excludeStart("ide", pragmas.excludeIdeData);
  311. args: [],
  312. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  313. referencedClasses: [],
  314. //>>excludeEnd("ide");
  315. pragmas: [],
  316. messageSends: ["should:return:"]
  317. }, function ($methodClass){ return function (){
  318. var self=this,$self=this;
  319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  320. return $core.withContext(function($ctx1) {
  321. //>>excludeEnd("ctx");
  322. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  323. return self;
  324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  325. }, function($ctx1) {$ctx1.fill(self,"testCascades",{})});
  326. //>>excludeEnd("ctx");
  327. }; }),
  328. $globals.AbstractCompilerTest);
  329. $core.addMethod(
  330. $core.method({
  331. selector: "testCascadesInDynamicArray",
  332. protocol: "tests",
  333. //>>excludeStart("ide", pragmas.excludeIdeData);
  334. args: [],
  335. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  336. referencedClasses: [],
  337. //>>excludeEnd("ide");
  338. pragmas: [],
  339. messageSends: ["should:return:"]
  340. }, function ($methodClass){ return function (){
  341. var self=this,$self=this;
  342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  343. return $core.withContext(function($ctx1) {
  344. //>>excludeEnd("ctx");
  345. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  346. return self;
  347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  348. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{})});
  349. //>>excludeEnd("ctx");
  350. }; }),
  351. $globals.AbstractCompilerTest);
  352. $core.addMethod(
  353. $core.method({
  354. selector: "testCascadesInDynamicDictioary",
  355. protocol: "tests",
  356. //>>excludeStart("ide", pragmas.excludeIdeData);
  357. args: [],
  358. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  359. referencedClasses: [],
  360. //>>excludeEnd("ide");
  361. pragmas: [],
  362. messageSends: ["should:return:"]
  363. }, function ($methodClass){ return function (){
  364. var self=this,$self=this;
  365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  366. return $core.withContext(function($ctx1) {
  367. //>>excludeEnd("ctx");
  368. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  369. return self;
  370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  371. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{})});
  372. //>>excludeEnd("ctx");
  373. }; }),
  374. $globals.AbstractCompilerTest);
  375. $core.addMethod(
  376. $core.method({
  377. selector: "testCascadesInSend",
  378. protocol: "tests",
  379. //>>excludeStart("ide", pragmas.excludeIdeData);
  380. args: [],
  381. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  382. referencedClasses: [],
  383. //>>excludeEnd("ide");
  384. pragmas: [],
  385. messageSends: ["should:return:"]
  386. }, function ($methodClass){ return function (){
  387. var self=this,$self=this;
  388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  389. return $core.withContext(function($ctx1) {
  390. //>>excludeEnd("ctx");
  391. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  392. return self;
  393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  394. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{})});
  395. //>>excludeEnd("ctx");
  396. }; }),
  397. $globals.AbstractCompilerTest);
  398. $core.addMethod(
  399. $core.method({
  400. selector: "testCascadesWithInlining",
  401. protocol: "tests",
  402. //>>excludeStart("ide", pragmas.excludeIdeData);
  403. args: [],
  404. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  405. referencedClasses: [],
  406. //>>excludeEnd("ide");
  407. pragmas: [],
  408. messageSends: ["should:return:"]
  409. }, function ($methodClass){ return function (){
  410. var self=this,$self=this;
  411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  412. return $core.withContext(function($ctx1) {
  413. //>>excludeEnd("ctx");
  414. [$self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1))
  415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  416. ,$ctx1.sendIdx["should:return:"]=1
  417. //>>excludeEnd("ctx");
  418. ][0];
  419. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  420. return self;
  421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  422. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{})});
  423. //>>excludeEnd("ctx");
  424. }; }),
  425. $globals.AbstractCompilerTest);
  426. $core.addMethod(
  427. $core.method({
  428. selector: "testDynamicArrayElementsOrdered",
  429. protocol: "tests",
  430. //>>excludeStart("ide", pragmas.excludeIdeData);
  431. args: [],
  432. source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).",
  433. referencedClasses: [],
  434. //>>excludeEnd("ide");
  435. pragmas: [],
  436. messageSends: ["should:return:"]
  437. }, function ($methodClass){ return function (){
  438. var self=this,$self=this;
  439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  440. return $core.withContext(function($ctx1) {
  441. //>>excludeEnd("ctx");
  442. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)])
  443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  444. ,$ctx1.sendIdx["should:return:"]=1
  445. //>>excludeEnd("ctx");
  446. ][0];
  447. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  448. return self;
  449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  450. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{})});
  451. //>>excludeEnd("ctx");
  452. }; }),
  453. $globals.AbstractCompilerTest);
  454. $core.addMethod(
  455. $core.method({
  456. selector: "testDynamicDictionaryElementsOrdered",
  457. protocol: "tests",
  458. //>>excludeStart("ide", pragmas.excludeIdeData);
  459. args: [],
  460. source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  461. referencedClasses: [],
  462. //>>excludeEnd("ide");
  463. pragmas: [],
  464. messageSends: ["should:return:"]
  465. }, function ($methodClass){ return function (){
  466. var self=this,$self=this;
  467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  468. return $core.withContext(function($ctx1) {
  469. //>>excludeEnd("ctx");
  470. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  471. return self;
  472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  473. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{})});
  474. //>>excludeEnd("ctx");
  475. }; }),
  476. $globals.AbstractCompilerTest);
  477. $core.addMethod(
  478. $core.method({
  479. selector: "testDynamicDictionaryWithMoreArrows",
  480. protocol: "tests",
  481. //>>excludeStart("ide", pragmas.excludeIdeData);
  482. args: [],
  483. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  484. referencedClasses: ["HashedCollection"],
  485. //>>excludeEnd("ide");
  486. pragmas: [],
  487. messageSends: ["should:return:", "with:", "->"]
  488. }, function ($methodClass){ return function (){
  489. var self=this,$self=this;
  490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  491. return $core.withContext(function($ctx1) {
  492. //>>excludeEnd("ctx");
  493. $self._should_return_("foo ^ #{1->2->3}",$recv($globals.HashedCollection)._with_([$recv((1).__minus_gt((2))).__minus_gt((3))
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. ,$ctx1.sendIdx["->"]=1
  496. //>>excludeEnd("ctx");
  497. ][0]));
  498. return self;
  499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  500. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{})});
  501. //>>excludeEnd("ctx");
  502. }; }),
  503. $globals.AbstractCompilerTest);
  504. $core.addMethod(
  505. $core.method({
  506. selector: "testGlobalVar",
  507. protocol: "tests",
  508. //>>excludeStart("ide", pragmas.excludeIdeData);
  509. args: [],
  510. source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil",
  511. referencedClasses: ["BlockClosure"],
  512. //>>excludeEnd("ide");
  513. pragmas: [],
  514. messageSends: ["should:return:"]
  515. }, function ($methodClass){ return function (){
  516. var self=this,$self=this;
  517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  518. return $core.withContext(function($ctx1) {
  519. //>>excludeEnd("ctx");
  520. [$self._should_return_("foo ^ eval class",$globals.BlockClosure)
  521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  522. ,$ctx1.sendIdx["should:return:"]=1
  523. //>>excludeEnd("ctx");
  524. ][0];
  525. [$self._should_return_("foo ^ Math cos: 0",(1))
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. ,$ctx1.sendIdx["should:return:"]=2
  528. //>>excludeEnd("ctx");
  529. ][0];
  530. $self._should_return_("foo ^ NonExistingVar",nil);
  531. return self;
  532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  533. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{})});
  534. //>>excludeEnd("ctx");
  535. }; }),
  536. $globals.AbstractCompilerTest);
  537. $core.addMethod(
  538. $core.method({
  539. selector: "testInnerTemporalDependentElementsOrdered",
  540. protocol: "tests",
  541. //>>excludeStart("ide", pragmas.excludeIdeData);
  542. args: [],
  543. source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  544. referencedClasses: ["Array"],
  545. //>>excludeEnd("ide");
  546. pragmas: [],
  547. messageSends: ["should:return:", "->"]
  548. }, function ($methodClass){ return function (){
  549. var self=this,$self=this;
  550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  551. return $core.withContext(function($ctx1) {
  552. //>>excludeEnd("ctx");
  553. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",[["foo".__minus_gt($globals.Array)
  554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  555. ,$ctx1.sendIdx["->"]=1
  556. //>>excludeEnd("ctx");
  557. ][0],["bar".__minus_gt((2))
  558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  559. ,$ctx1.sendIdx["->"]=2
  560. //>>excludeEnd("ctx");
  561. ][0]])
  562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  563. ,$ctx1.sendIdx["should:return:"]=1
  564. //>>excludeEnd("ctx");
  565. ][0];
  566. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",[["foo".__minus_gt($globals.Array)
  567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  568. ,$ctx1.sendIdx["->"]=3
  569. //>>excludeEnd("ctx");
  570. ][0],["bar".__minus_gt((2))
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. ,$ctx1.sendIdx["->"]=4
  573. //>>excludeEnd("ctx");
  574. ][0]])
  575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  576. ,$ctx1.sendIdx["should:return:"]=2
  577. //>>excludeEnd("ctx");
  578. ][0];
  579. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",[["foo".__minus_gt((1))
  580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  581. ,$ctx1.sendIdx["->"]=5
  582. //>>excludeEnd("ctx");
  583. ][0],["bar".__minus_gt((2))
  584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  585. ,$ctx1.sendIdx["->"]=6
  586. //>>excludeEnd("ctx");
  587. ][0]])
  588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  589. ,$ctx1.sendIdx["should:return:"]=3
  590. //>>excludeEnd("ctx");
  591. ][0];
  592. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",[["foo".__minus_gt((1))
  593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  594. ,$ctx1.sendIdx["->"]=7
  595. //>>excludeEnd("ctx");
  596. ][0],"bar".__minus_gt((2))])
  597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  598. ,$ctx1.sendIdx["should:return:"]=4
  599. //>>excludeEnd("ctx");
  600. ][0];
  601. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  602. return self;
  603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  604. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{})});
  605. //>>excludeEnd("ctx");
  606. }; }),
  607. $globals.AbstractCompilerTest);
  608. $core.addMethod(
  609. $core.method({
  610. selector: "testLexicalScope",
  611. protocol: "tests",
  612. //>>excludeStart("ide", pragmas.excludeIdeData);
  613. args: [],
  614. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  615. referencedClasses: [],
  616. //>>excludeEnd("ide");
  617. pragmas: [],
  618. messageSends: ["should:return:"]
  619. }, function ($methodClass){ return function (){
  620. var self=this,$self=this;
  621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  622. return $core.withContext(function($ctx1) {
  623. //>>excludeEnd("ctx");
  624. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  625. return self;
  626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  627. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{})});
  628. //>>excludeEnd("ctx");
  629. }; }),
  630. $globals.AbstractCompilerTest);
  631. $core.addMethod(
  632. $core.method({
  633. selector: "testLiterals",
  634. protocol: "tests",
  635. //>>excludeStart("ide", pragmas.excludeIdeData);
  636. args: [],
  637. source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ $h' return: 'h'.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.",
  638. referencedClasses: [],
  639. //>>excludeEnd("ide");
  640. pragmas: [],
  641. messageSends: ["should:return:"]
  642. }, function ($methodClass){ return function (){
  643. var self=this,$self=this;
  644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  645. return $core.withContext(function($ctx1) {
  646. //>>excludeEnd("ctx");
  647. [$self._should_return_("foo ^ 1",(1))
  648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  649. ,$ctx1.sendIdx["should:return:"]=1
  650. //>>excludeEnd("ctx");
  651. ][0];
  652. [$self._should_return_("foo ^ 'hello'","hello")
  653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  654. ,$ctx1.sendIdx["should:return:"]=2
  655. //>>excludeEnd("ctx");
  656. ][0];
  657. [$self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)])
  658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  659. ,$ctx1.sendIdx["should:return:"]=3
  660. //>>excludeEnd("ctx");
  661. ][0];
  662. [$self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)])
  663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  664. ,$ctx1.sendIdx["should:return:"]=4
  665. //>>excludeEnd("ctx");
  666. ][0];
  667. [$self._should_return_("foo ^ true",true)
  668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  669. ,$ctx1.sendIdx["should:return:"]=5
  670. //>>excludeEnd("ctx");
  671. ][0];
  672. [$self._should_return_("foo ^ false",false)
  673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  674. ,$ctx1.sendIdx["should:return:"]=6
  675. //>>excludeEnd("ctx");
  676. ][0];
  677. [$self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]))
  678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  679. ,$ctx1.sendIdx["should:return:"]=7
  680. //>>excludeEnd("ctx");
  681. ][0];
  682. [$self._should_return_("foo ^ #hello","hello")
  683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  684. ,$ctx1.sendIdx["should:return:"]=8
  685. //>>excludeEnd("ctx");
  686. ][0];
  687. [$self._should_return_("foo ^ $h","h")
  688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  689. ,$ctx1.sendIdx["should:return:"]=9
  690. //>>excludeEnd("ctx");
  691. ][0];
  692. [$self._should_return_("foo ^ -123.456",(-123.456))
  693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  694. ,$ctx1.sendIdx["should:return:"]=10
  695. //>>excludeEnd("ctx");
  696. ][0];
  697. $self._should_return_("foo ^ -2.5e4",(-25000));
  698. return self;
  699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  700. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{})});
  701. //>>excludeEnd("ctx");
  702. }; }),
  703. $globals.AbstractCompilerTest);
  704. $core.addMethod(
  705. $core.method({
  706. selector: "testLocalReturn",
  707. protocol: "tests",
  708. //>>excludeStart("ide", pragmas.excludeIdeData);
  709. args: [],
  710. source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
  711. referencedClasses: [],
  712. //>>excludeEnd("ide");
  713. pragmas: [],
  714. messageSends: ["should:return:"]
  715. }, function ($methodClass){ return function (){
  716. var self=this,$self=this;
  717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  718. return $core.withContext(function($ctx1) {
  719. //>>excludeEnd("ctx");
  720. [$self._should_return_("foo ^ 1",(1))
  721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  722. ,$ctx1.sendIdx["should:return:"]=1
  723. //>>excludeEnd("ctx");
  724. ][0];
  725. [$self._should_return_("foo ^ 1 + 1",(2))
  726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  727. ,$ctx1.sendIdx["should:return:"]=2
  728. //>>excludeEnd("ctx");
  729. ][0];
  730. [$self._should_return_("foo ",$self.receiver)
  731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  732. ,$ctx1.sendIdx["should:return:"]=3
  733. //>>excludeEnd("ctx");
  734. ][0];
  735. [$self._should_return_("foo self asString",$self.receiver)
  736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  737. ,$ctx1.sendIdx["should:return:"]=4
  738. //>>excludeEnd("ctx");
  739. ][0];
  740. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  741. return self;
  742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  743. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{})});
  744. //>>excludeEnd("ctx");
  745. }; }),
  746. $globals.AbstractCompilerTest);
  747. $core.addMethod(
  748. $core.method({
  749. selector: "testMessageSends",
  750. protocol: "tests",
  751. //>>excludeStart("ide", pragmas.excludeIdeData);
  752. args: [],
  753. source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
  754. referencedClasses: [],
  755. //>>excludeEnd("ide");
  756. pragmas: [],
  757. messageSends: ["should:return:"]
  758. }, function ($methodClass){ return function (){
  759. var self=this,$self=this;
  760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  761. return $core.withContext(function($ctx1) {
  762. //>>excludeEnd("ctx");
  763. [$self._should_return_("foo ^ 1 asString","1")
  764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  765. ,$ctx1.sendIdx["should:return:"]=1
  766. //>>excludeEnd("ctx");
  767. ][0];
  768. [$self._should_return_("foo ^ 1 + 1",(2))
  769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  770. ,$ctx1.sendIdx["should:return:"]=2
  771. //>>excludeEnd("ctx");
  772. ][0];
  773. [$self._should_return_("foo ^ 1 + 2 * 3",(9))
  774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  775. ,$ctx1.sendIdx["should:return:"]=3
  776. //>>excludeEnd("ctx");
  777. ][0];
  778. [$self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)])
  779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  780. ,$ctx1.sendIdx["should:return:"]=4
  781. //>>excludeEnd("ctx");
  782. ][0];
  783. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  784. return self;
  785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  786. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{})});
  787. //>>excludeEnd("ctx");
  788. }; }),
  789. $globals.AbstractCompilerTest);
  790. $core.addMethod(
  791. $core.method({
  792. selector: "testMultipleSequences",
  793. protocol: "tests",
  794. //>>excludeStart("ide", pragmas.excludeIdeData);
  795. args: [],
  796. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  797. referencedClasses: [],
  798. //>>excludeEnd("ide");
  799. pragmas: [],
  800. messageSends: ["should:return:"]
  801. }, function ($methodClass){ return function (){
  802. var self=this,$self=this;
  803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  804. return $core.withContext(function($ctx1) {
  805. //>>excludeEnd("ctx");
  806. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  807. return self;
  808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  809. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{})});
  810. //>>excludeEnd("ctx");
  811. }; }),
  812. $globals.AbstractCompilerTest);
  813. $core.addMethod(
  814. $core.method({
  815. selector: "testMutableLiterals",
  816. protocol: "tests",
  817. //>>excludeStart("ide", pragmas.excludeIdeData);
  818. args: [],
  819. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://lolg.it/amber/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  820. referencedClasses: [],
  821. //>>excludeEnd("ide");
  822. pragmas: [],
  823. messageSends: ["should:return:"]
  824. }, function ($methodClass){ return function (){
  825. var self=this,$self=this;
  826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  827. return $core.withContext(function($ctx1) {
  828. //>>excludeEnd("ctx");
  829. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  830. return self;
  831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  832. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{})});
  833. //>>excludeEnd("ctx");
  834. }; }),
  835. $globals.AbstractCompilerTest);
  836. $core.addMethod(
  837. $core.method({
  838. selector: "testNestedIfTrue",
  839. protocol: "tests",
  840. //>>excludeStart("ide", pragmas.excludeIdeData);
  841. args: [],
  842. source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
  843. referencedClasses: [],
  844. //>>excludeEnd("ide");
  845. pragmas: [],
  846. messageSends: ["should:return:"]
  847. }, function ($methodClass){ return function (){
  848. var self=this,$self=this;
  849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  850. return $core.withContext(function($ctx1) {
  851. //>>excludeEnd("ctx");
  852. [$self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1))
  853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  854. ,$ctx1.sendIdx["should:return:"]=1
  855. //>>excludeEnd("ctx");
  856. ][0];
  857. [$self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil)
  858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  859. ,$ctx1.sendIdx["should:return:"]=2
  860. //>>excludeEnd("ctx");
  861. ][0];
  862. [$self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1))
  863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  864. ,$ctx1.sendIdx["should:return:"]=3
  865. //>>excludeEnd("ctx");
  866. ][0];
  867. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self.receiver);
  868. return self;
  869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  870. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{})});
  871. //>>excludeEnd("ctx");
  872. }; }),
  873. $globals.AbstractCompilerTest);
  874. $core.addMethod(
  875. $core.method({
  876. selector: "testNestedSends",
  877. protocol: "tests",
  878. //>>excludeStart("ide", pragmas.excludeIdeData);
  879. args: [],
  880. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  881. referencedClasses: ["Point"],
  882. //>>excludeEnd("ide");
  883. pragmas: [],
  884. messageSends: ["should:return:", "asString", "x:y:", "@"]
  885. }, function ($methodClass){ return function (){
  886. var self=this,$self=this;
  887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  888. return $core.withContext(function($ctx1) {
  889. //>>excludeEnd("ctx");
  890. $self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($globals.Point)._x_y_((2).__at((3)),(4)))._asString());
  891. return self;
  892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  893. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{})});
  894. //>>excludeEnd("ctx");
  895. }; }),
  896. $globals.AbstractCompilerTest);
  897. $core.addMethod(
  898. $core.method({
  899. selector: "testNilPerform",
  900. protocol: "tests",
  901. //>>excludeStart("ide", pragmas.excludeIdeData);
  902. args: [],
  903. source: "testNilPerform\x0a\x09self should: 'foo ^ nil perform: #yourself' return: nil",
  904. referencedClasses: [],
  905. //>>excludeEnd("ide");
  906. pragmas: [],
  907. messageSends: ["should:return:"]
  908. }, function ($methodClass){ return function (){
  909. var self=this,$self=this;
  910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  911. return $core.withContext(function($ctx1) {
  912. //>>excludeEnd("ctx");
  913. $self._should_return_("foo ^ nil perform: #yourself",nil);
  914. return self;
  915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  916. }, function($ctx1) {$ctx1.fill(self,"testNilPerform",{})});
  917. //>>excludeEnd("ctx");
  918. }; }),
  919. $globals.AbstractCompilerTest);
  920. $core.addMethod(
  921. $core.method({
  922. selector: "testNonLocalReturn",
  923. protocol: "tests",
  924. //>>excludeStart("ide", pragmas.excludeIdeData);
  925. args: [],
  926. source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
  927. referencedClasses: [],
  928. //>>excludeEnd("ide");
  929. pragmas: [],
  930. messageSends: ["should:return:"]
  931. }, function ($methodClass){ return function (){
  932. var self=this,$self=this;
  933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  934. return $core.withContext(function($ctx1) {
  935. //>>excludeEnd("ctx");
  936. [$self._should_return_("foo [ ^ 1 ] value",(1))
  937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  938. ,$ctx1.sendIdx["should:return:"]=1
  939. //>>excludeEnd("ctx");
  940. ][0];
  941. [$self._should_return_("foo [ ^ 1 + 1 ] value",(2))
  942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  943. ,$ctx1.sendIdx["should:return:"]=2
  944. //>>excludeEnd("ctx");
  945. ][0];
  946. [$self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3))
  947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  948. ,$ctx1.sendIdx["should:return:"]=3
  949. //>>excludeEnd("ctx");
  950. ][0];
  951. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  952. return self;
  953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  954. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{})});
  955. //>>excludeEnd("ctx");
  956. }; }),
  957. $globals.AbstractCompilerTest);
  958. $core.addMethod(
  959. $core.method({
  960. selector: "testPascalCaseGlobal",
  961. protocol: "tests",
  962. //>>excludeStart("ide", pragmas.excludeIdeData);
  963. args: [],
  964. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  965. referencedClasses: ["Smalltalk"],
  966. //>>excludeEnd("ide");
  967. pragmas: [],
  968. messageSends: ["should:return:", "at:", "globals"]
  969. }, function ($methodClass){ return function (){
  970. var self=this,$self=this;
  971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  972. return $core.withContext(function($ctx1) {
  973. //>>excludeEnd("ctx");
  974. [$self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"))
  975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  976. ,$ctx1.sendIdx["should:return:"]=1
  977. //>>excludeEnd("ctx");
  978. ][0];
  979. $self._should_return_("foo ^NonExistent",nil);
  980. return self;
  981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  982. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{})});
  983. //>>excludeEnd("ctx");
  984. }; }),
  985. $globals.AbstractCompilerTest);
  986. $core.addMethod(
  987. $core.method({
  988. selector: "testPragmaJSStatement",
  989. protocol: "tests",
  990. //>>excludeStart("ide", pragmas.excludeIdeData);
  991. args: [],
  992. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  993. referencedClasses: [],
  994. //>>excludeEnd("ide");
  995. pragmas: [],
  996. messageSends: ["should:return:"]
  997. }, function ($methodClass){ return function (){
  998. var self=this,$self=this;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. return $core.withContext(function($ctx1) {
  1001. //>>excludeEnd("ctx");
  1002. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  1003. return self;
  1004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1005. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{})});
  1006. //>>excludeEnd("ctx");
  1007. }; }),
  1008. $globals.AbstractCompilerTest);
  1009. $core.addMethod(
  1010. $core.method({
  1011. selector: "testReceiverEvaluatedOnceInSpecials",
  1012. protocol: "tests",
  1013. //>>excludeStart("ide", pragmas.excludeIdeData);
  1014. args: [],
  1015. source: "testReceiverEvaluatedOnceInSpecials\x0a\x09self should: 'foo |x| x := 1. ^ {[ x := x+1 ] value ifNil: []. x}' return: {2. 2}.\x0a\x09self should: 'foo |xs| xs := {nil. nil}. ^ {[ xs removeLast ] value ifNotNil: []. xs}' return: {nil. {nil}}.",
  1016. referencedClasses: [],
  1017. //>>excludeEnd("ide");
  1018. pragmas: [],
  1019. messageSends: ["should:return:"]
  1020. }, function ($methodClass){ return function (){
  1021. var self=this,$self=this;
  1022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1023. return $core.withContext(function($ctx1) {
  1024. //>>excludeEnd("ctx");
  1025. [$self._should_return_("foo |x| x := 1. ^ {[ x := x+1 ] value ifNil: []. x}",[(2),(2)])
  1026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1027. ,$ctx1.sendIdx["should:return:"]=1
  1028. //>>excludeEnd("ctx");
  1029. ][0];
  1030. $self._should_return_("foo |xs| xs := {nil. nil}. ^ {[ xs removeLast ] value ifNotNil: []. xs}",[nil,[nil]]);
  1031. return self;
  1032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1033. }, function($ctx1) {$ctx1.fill(self,"testReceiverEvaluatedOnceInSpecials",{})});
  1034. //>>excludeEnd("ctx");
  1035. }; }),
  1036. $globals.AbstractCompilerTest);
  1037. $core.addMethod(
  1038. $core.method({
  1039. selector: "testRegression1242",
  1040. protocol: "tests",
  1041. //>>excludeStart("ide", pragmas.excludeIdeData);
  1042. args: [],
  1043. source: "testRegression1242\x0a\x09self should: '\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := nil ifNil: [].\x0a\x09\x09\x09^ x\x0a\x09' return: nil.\x0a\x09\x0a\x09self should: '\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := 1 ifNotNil: [].\x0a\x09\x09\x09^ x\x0a\x09' return: nil.\x0a\x09\x0a\x09self should: '\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := false ifFalse: [].\x0a\x09\x09\x09^ x\x0a\x09' return: nil.\x0a\x09\x0a\x09self should: '\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := true ifTrue: [].\x0a\x09\x09\x09^ x\x0a\x09' return: nil.",
  1044. referencedClasses: [],
  1045. //>>excludeEnd("ide");
  1046. pragmas: [],
  1047. messageSends: ["should:return:"]
  1048. }, function ($methodClass){ return function (){
  1049. var self=this,$self=this;
  1050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1051. return $core.withContext(function($ctx1) {
  1052. //>>excludeEnd("ctx");
  1053. [$self._should_return_("\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := nil ifNil: [].\x0a\x09\x09\x09^ x\x0a\x09",nil)
  1054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1055. ,$ctx1.sendIdx["should:return:"]=1
  1056. //>>excludeEnd("ctx");
  1057. ][0];
  1058. [$self._should_return_("\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := 1 ifNotNil: [].\x0a\x09\x09\x09^ x\x0a\x09",nil)
  1059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1060. ,$ctx1.sendIdx["should:return:"]=2
  1061. //>>excludeEnd("ctx");
  1062. ][0];
  1063. [$self._should_return_("\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := false ifFalse: [].\x0a\x09\x09\x09^ x\x0a\x09",nil)
  1064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1065. ,$ctx1.sendIdx["should:return:"]=3
  1066. //>>excludeEnd("ctx");
  1067. ][0];
  1068. $self._should_return_("\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := true ifTrue: [].\x0a\x09\x09\x09^ x\x0a\x09",nil);
  1069. return self;
  1070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1071. }, function($ctx1) {$ctx1.fill(self,"testRegression1242",{})});
  1072. //>>excludeEnd("ctx");
  1073. }; }),
  1074. $globals.AbstractCompilerTest);
  1075. $core.addMethod(
  1076. $core.method({
  1077. selector: "testRegression1242ForReturn",
  1078. protocol: "tests",
  1079. //>>excludeStart("ide", pragmas.excludeIdeData);
  1080. args: [],
  1081. source: "testRegression1242ForReturn\x0a\x09self should: 'foo [ ^ nil ifNil: [] ] value' return: nil.\x0a\x09self should: 'foo [ ^ 1 ifNotNil: [] ] value' return: nil.\x0a\x09self should: 'foo [ ^ false ifFalse: [] ] value' return: nil.\x0a\x09self should: 'foo [ ^ true ifTrue: [] ] value' return: nil.",
  1082. referencedClasses: [],
  1083. //>>excludeEnd("ide");
  1084. pragmas: [],
  1085. messageSends: ["should:return:"]
  1086. }, function ($methodClass){ return function (){
  1087. var self=this,$self=this;
  1088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1089. return $core.withContext(function($ctx1) {
  1090. //>>excludeEnd("ctx");
  1091. [$self._should_return_("foo [ ^ nil ifNil: [] ] value",nil)
  1092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1093. ,$ctx1.sendIdx["should:return:"]=1
  1094. //>>excludeEnd("ctx");
  1095. ][0];
  1096. [$self._should_return_("foo [ ^ 1 ifNotNil: [] ] value",nil)
  1097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1098. ,$ctx1.sendIdx["should:return:"]=2
  1099. //>>excludeEnd("ctx");
  1100. ][0];
  1101. [$self._should_return_("foo [ ^ false ifFalse: [] ] value",nil)
  1102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1103. ,$ctx1.sendIdx["should:return:"]=3
  1104. //>>excludeEnd("ctx");
  1105. ][0];
  1106. $self._should_return_("foo [ ^ true ifTrue: [] ] value",nil);
  1107. return self;
  1108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1109. }, function($ctx1) {$ctx1.fill(self,"testRegression1242ForReturn",{})});
  1110. //>>excludeEnd("ctx");
  1111. }; }),
  1112. $globals.AbstractCompilerTest);
  1113. $core.addMethod(
  1114. $core.method({
  1115. selector: "testRegression1244",
  1116. protocol: "tests",
  1117. //>>excludeStart("ide", pragmas.excludeIdeData);
  1118. args: [],
  1119. source: "testRegression1244\x0a\x09self should: 'foo [ ^ true ifTrue: [1] ifFalse: [2] ] value' return: 1",
  1120. referencedClasses: [],
  1121. //>>excludeEnd("ide");
  1122. pragmas: [],
  1123. messageSends: ["should:return:"]
  1124. }, function ($methodClass){ return function (){
  1125. var self=this,$self=this;
  1126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1127. return $core.withContext(function($ctx1) {
  1128. //>>excludeEnd("ctx");
  1129. $self._should_return_("foo [ ^ true ifTrue: [1] ifFalse: [2] ] value",(1));
  1130. return self;
  1131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1132. }, function($ctx1) {$ctx1.fill(self,"testRegression1244",{})});
  1133. //>>excludeEnd("ctx");
  1134. }; }),
  1135. $globals.AbstractCompilerTest);
  1136. $core.addMethod(
  1137. $core.method({
  1138. selector: "testRootSuperSend",
  1139. protocol: "tests",
  1140. //>>excludeStart("ide", pragmas.excludeIdeData);
  1141. args: [],
  1142. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  1143. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  1144. //>>excludeEnd("ide");
  1145. pragmas: [],
  1146. messageSends: ["should:receiver:raise:", "new"]
  1147. }, function ($methodClass){ return function (){
  1148. var self=this,$self=this;
  1149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1150. return $core.withContext(function($ctx1) {
  1151. //>>excludeEnd("ctx");
  1152. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  1153. return self;
  1154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1155. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{})});
  1156. //>>excludeEnd("ctx");
  1157. }; }),
  1158. $globals.AbstractCompilerTest);
  1159. $core.addMethod(
  1160. $core.method({
  1161. selector: "testSendReceiverAndArgumentsOrdered",
  1162. protocol: "tests",
  1163. //>>excludeStart("ide", pragmas.excludeIdeData);
  1164. args: [],
  1165. source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.",
  1166. referencedClasses: ["Array"],
  1167. //>>excludeEnd("ide");
  1168. pragmas: [],
  1169. messageSends: ["should:return:"]
  1170. }, function ($methodClass){ return function (){
  1171. var self=this,$self=this;
  1172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1173. return $core.withContext(function($ctx1) {
  1174. //>>excludeEnd("ctx");
  1175. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)])
  1176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1177. ,$ctx1.sendIdx["should:return:"]=1
  1178. //>>excludeEnd("ctx");
  1179. ][0];
  1180. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  1181. return self;
  1182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1183. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{})});
  1184. //>>excludeEnd("ctx");
  1185. }; }),
  1186. $globals.AbstractCompilerTest);
  1187. $core.addMethod(
  1188. $core.method({
  1189. selector: "testSuperSend",
  1190. protocol: "tests",
  1191. //>>excludeStart("ide", pragmas.excludeIdeData);
  1192. args: [],
  1193. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  1194. referencedClasses: [],
  1195. //>>excludeEnd("ide");
  1196. pragmas: [],
  1197. messageSends: ["should:receiver:return:"]
  1198. }, function ($methodClass){ return function (){
  1199. var self=this,$self=this;
  1200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1201. return $core.withContext(function($ctx1) {
  1202. //>>excludeEnd("ctx");
  1203. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  1204. return self;
  1205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1206. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{})});
  1207. //>>excludeEnd("ctx");
  1208. }; }),
  1209. $globals.AbstractCompilerTest);
  1210. $core.addMethod(
  1211. $core.method({
  1212. selector: "testSuperSend2",
  1213. protocol: "tests",
  1214. //>>excludeStart("ide", pragmas.excludeIdeData);
  1215. args: [],
  1216. source: "testSuperSend2\x0a\x09self \x0a\x09\x09should: 'foo ^ super isNil'\x0a\x09\x09receiver: nil\x0a\x09\x09return: false",
  1217. referencedClasses: [],
  1218. //>>excludeEnd("ide");
  1219. pragmas: [],
  1220. messageSends: ["should:receiver:return:"]
  1221. }, function ($methodClass){ return function (){
  1222. var self=this,$self=this;
  1223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1224. return $core.withContext(function($ctx1) {
  1225. //>>excludeEnd("ctx");
  1226. $self._should_receiver_return_("foo ^ super isNil",nil,false);
  1227. return self;
  1228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1229. }, function($ctx1) {$ctx1.fill(self,"testSuperSend2",{})});
  1230. //>>excludeEnd("ctx");
  1231. }; }),
  1232. $globals.AbstractCompilerTest);
  1233. $core.addMethod(
  1234. $core.method({
  1235. selector: "testSuperSend3",
  1236. protocol: "tests",
  1237. //>>excludeStart("ide", pragmas.excludeIdeData);
  1238. args: [],
  1239. source: "testSuperSend3\x0a\x09self \x0a\x09\x09should: 'doo ^ super isNil'\x0a\x09\x09class: Object\x0a\x09\x09receiver: nil\x0a\x09\x09return: false",
  1240. referencedClasses: ["Object"],
  1241. //>>excludeEnd("ide");
  1242. pragmas: [],
  1243. messageSends: ["should:class:receiver:return:"]
  1244. }, function ($methodClass){ return function (){
  1245. var self=this,$self=this;
  1246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1247. return $core.withContext(function($ctx1) {
  1248. //>>excludeEnd("ctx");
  1249. $self._should_class_receiver_return_("doo ^ super isNil",$globals.Object,nil,false);
  1250. return self;
  1251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1252. }, function($ctx1) {$ctx1.fill(self,"testSuperSend3",{})});
  1253. //>>excludeEnd("ctx");
  1254. }; }),
  1255. $globals.AbstractCompilerTest);
  1256. $core.addMethod(
  1257. $core.method({
  1258. selector: "testSuperSend4",
  1259. protocol: "tests",
  1260. //>>excludeStart("ide", pragmas.excludeIdeData);
  1261. args: [],
  1262. source: "testSuperSend4\x0a\x09self \x0a\x09\x09should: 'foo ^ super asJavaScriptObject'\x0a\x09\x09receiver: 'me'\x0a\x09\x09return: #('m' 'e')",
  1263. referencedClasses: [],
  1264. //>>excludeEnd("ide");
  1265. pragmas: [],
  1266. messageSends: ["should:receiver:return:"]
  1267. }, function ($methodClass){ return function (){
  1268. var self=this,$self=this;
  1269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1270. return $core.withContext(function($ctx1) {
  1271. //>>excludeEnd("ctx");
  1272. $self._should_receiver_return_("foo ^ super asJavaScriptObject","me",["m", "e"]);
  1273. return self;
  1274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1275. }, function($ctx1) {$ctx1.fill(self,"testSuperSend4",{})});
  1276. //>>excludeEnd("ctx");
  1277. }; }),
  1278. $globals.AbstractCompilerTest);
  1279. $core.addMethod(
  1280. $core.method({
  1281. selector: "testSuperSend5",
  1282. protocol: "tests",
  1283. //>>excludeStart("ide", pragmas.excludeIdeData);
  1284. args: [],
  1285. source: "testSuperSend5\x0a\x09self \x0a\x09\x09should: 'foo [super addLast: 4] on: Error do: [ self add: 5 ]. ^ self'\x0a\x09\x09class: SequenceableCollection\x0a\x09\x09receiver: #(1 2 3)\x0a\x09\x09return: #(1 2 3 5)",
  1286. referencedClasses: ["SequenceableCollection"],
  1287. //>>excludeEnd("ide");
  1288. pragmas: [],
  1289. messageSends: ["should:class:receiver:return:"]
  1290. }, function ($methodClass){ return function (){
  1291. var self=this,$self=this;
  1292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1293. return $core.withContext(function($ctx1) {
  1294. //>>excludeEnd("ctx");
  1295. $self._should_class_receiver_return_("foo [super addLast: 4] on: Error do: [ self add: 5 ]. ^ self",$globals.SequenceableCollection,[(1), (2), (3)],[(1), (2), (3), (5)]);
  1296. return self;
  1297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1298. }, function($ctx1) {$ctx1.fill(self,"testSuperSend5",{})});
  1299. //>>excludeEnd("ctx");
  1300. }; }),
  1301. $globals.AbstractCompilerTest);
  1302. $core.addMethod(
  1303. $core.method({
  1304. selector: "testSuperSend6",
  1305. protocol: "tests",
  1306. //>>excludeStart("ide", pragmas.excludeIdeData);
  1307. args: [],
  1308. source: "testSuperSend6\x0a\x09self \x0a\x09\x09should: 'foo ^ super ifTrue: [ true ] ifFalse: [ false ]' \x0a\x09\x09receiver: true\x0a\x09\x09raise: Error",
  1309. referencedClasses: ["Error"],
  1310. //>>excludeEnd("ide");
  1311. pragmas: [],
  1312. messageSends: ["should:receiver:raise:"]
  1313. }, function ($methodClass){ return function (){
  1314. var self=this,$self=this;
  1315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1316. return $core.withContext(function($ctx1) {
  1317. //>>excludeEnd("ctx");
  1318. $self._should_receiver_raise_("foo ^ super ifTrue: [ true ] ifFalse: [ false ]",true,$globals.Error);
  1319. return self;
  1320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1321. }, function($ctx1) {$ctx1.fill(self,"testSuperSend6",{})});
  1322. //>>excludeEnd("ctx");
  1323. }; }),
  1324. $globals.AbstractCompilerTest);
  1325. $core.addMethod(
  1326. $core.method({
  1327. selector: "testTempVariables",
  1328. protocol: "tests",
  1329. //>>excludeStart("ide", pragmas.excludeIdeData);
  1330. args: [],
  1331. source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.",
  1332. referencedClasses: [],
  1333. //>>excludeEnd("ide");
  1334. pragmas: [],
  1335. messageSends: ["should:return:"]
  1336. }, function ($methodClass){ return function (){
  1337. var self=this,$self=this;
  1338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1339. return $core.withContext(function($ctx1) {
  1340. //>>excludeEnd("ctx");
  1341. [$self._should_return_("foo | a | ^ a",nil)
  1342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1343. ,$ctx1.sendIdx["should:return:"]=1
  1344. //>>excludeEnd("ctx");
  1345. ][0];
  1346. [$self._should_return_("foo | AVariable | ^ AVariable",nil)
  1347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1348. ,$ctx1.sendIdx["should:return:"]=2
  1349. //>>excludeEnd("ctx");
  1350. ][0];
  1351. [$self._should_return_("foo | a b c | ^ c",nil)
  1352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1353. ,$ctx1.sendIdx["should:return:"]=3
  1354. //>>excludeEnd("ctx");
  1355. ][0];
  1356. [$self._should_return_("foo | a | [ | d | ^ d ] value",nil)
  1357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1358. ,$ctx1.sendIdx["should:return:"]=4
  1359. //>>excludeEnd("ctx");
  1360. ][0];
  1361. [$self._should_return_("foo | a | a:= 1. ^ a",(1))
  1362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1363. ,$ctx1.sendIdx["should:return:"]=5
  1364. //>>excludeEnd("ctx");
  1365. ][0];
  1366. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  1367. return self;
  1368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1369. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{})});
  1370. //>>excludeEnd("ctx");
  1371. }; }),
  1372. $globals.AbstractCompilerTest);
  1373. $core.addMethod(
  1374. $core.method({
  1375. selector: "testThisContext",
  1376. protocol: "tests",
  1377. //>>excludeStart("ide", pragmas.excludeIdeData);
  1378. args: [],
  1379. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  1380. referencedClasses: [],
  1381. //>>excludeEnd("ide");
  1382. pragmas: [],
  1383. messageSends: ["should:return:"]
  1384. }, function ($methodClass){ return function (){
  1385. var self=this,$self=this;
  1386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1387. return $core.withContext(function($ctx1) {
  1388. //>>excludeEnd("ctx");
  1389. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  1390. return self;
  1391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1392. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{})});
  1393. //>>excludeEnd("ctx");
  1394. }; }),
  1395. $globals.AbstractCompilerTest);
  1396. $core.addMethod(
  1397. $core.method({
  1398. selector: "testUnknownPragma",
  1399. protocol: "tests",
  1400. //>>excludeStart("ide", pragmas.excludeIdeData);
  1401. args: [],
  1402. source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
  1403. referencedClasses: [],
  1404. //>>excludeEnd("ide");
  1405. pragmas: [],
  1406. messageSends: ["should:return:"]
  1407. }, function ($methodClass){ return function (){
  1408. var self=this,$self=this;
  1409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1410. return $core.withContext(function($ctx1) {
  1411. //>>excludeEnd("ctx");
  1412. [$self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6))
  1413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1414. ,$ctx1.sendIdx["should:return:"]=1
  1415. //>>excludeEnd("ctx");
  1416. ][0];
  1417. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  1418. return self;
  1419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1420. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{})});
  1421. //>>excludeEnd("ctx");
  1422. }; }),
  1423. $globals.AbstractCompilerTest);
  1424. $core.addMethod(
  1425. $core.method({
  1426. selector: "testifFalse",
  1427. protocol: "tests",
  1428. //>>excludeStart("ide", pragmas.excludeIdeData);
  1429. args: [],
  1430. source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
  1431. referencedClasses: [],
  1432. //>>excludeEnd("ide");
  1433. pragmas: [],
  1434. messageSends: ["should:return:"]
  1435. }, function ($methodClass){ return function (){
  1436. var self=this,$self=this;
  1437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1438. return $core.withContext(function($ctx1) {
  1439. //>>excludeEnd("ctx");
  1440. [$self._should_return_("foo true ifFalse: [ ^ 1 ]",$self.receiver)
  1441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1442. ,$ctx1.sendIdx["should:return:"]=1
  1443. //>>excludeEnd("ctx");
  1444. ][0];
  1445. [$self._should_return_("foo false ifFalse: [ ^ 2 ]",(2))
  1446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1447. ,$ctx1.sendIdx["should:return:"]=2
  1448. //>>excludeEnd("ctx");
  1449. ][0];
  1450. [$self._should_return_("foo ^ true ifFalse: [ 1 ]",nil)
  1451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1452. ,$ctx1.sendIdx["should:return:"]=3
  1453. //>>excludeEnd("ctx");
  1454. ][0];
  1455. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  1456. return self;
  1457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1458. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{})});
  1459. //>>excludeEnd("ctx");
  1460. }; }),
  1461. $globals.AbstractCompilerTest);
  1462. $core.addMethod(
  1463. $core.method({
  1464. selector: "testifFalseIfTrue",
  1465. protocol: "tests",
  1466. //>>excludeStart("ide", pragmas.excludeIdeData);
  1467. args: [],
  1468. source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
  1469. referencedClasses: [],
  1470. //>>excludeEnd("ide");
  1471. pragmas: [],
  1472. messageSends: ["should:return:"]
  1473. }, function ($methodClass){ return function (){
  1474. var self=this,$self=this;
  1475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1476. return $core.withContext(function($ctx1) {
  1477. //>>excludeEnd("ctx");
  1478. [$self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2))
  1479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1480. ,$ctx1.sendIdx["should:return:"]=1
  1481. //>>excludeEnd("ctx");
  1482. ][0];
  1483. [$self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2))
  1484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1485. ,$ctx1.sendIdx["should:return:"]=2
  1486. //>>excludeEnd("ctx");
  1487. ][0];
  1488. [$self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2))
  1489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1490. ,$ctx1.sendIdx["should:return:"]=3
  1491. //>>excludeEnd("ctx");
  1492. ][0];
  1493. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  1494. return self;
  1495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1496. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{})});
  1497. //>>excludeEnd("ctx");
  1498. }; }),
  1499. $globals.AbstractCompilerTest);
  1500. $core.addMethod(
  1501. $core.method({
  1502. selector: "testifNil",
  1503. protocol: "tests",
  1504. //>>excludeStart("ide", pragmas.excludeIdeData);
  1505. args: [],
  1506. source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
  1507. referencedClasses: [],
  1508. //>>excludeEnd("ide");
  1509. pragmas: [],
  1510. messageSends: ["should:return:"]
  1511. }, function ($methodClass){ return function (){
  1512. var self=this,$self=this;
  1513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1514. return $core.withContext(function($ctx1) {
  1515. //>>excludeEnd("ctx");
  1516. [$self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1))
  1517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1518. ,$ctx1.sendIdx["should:return:"]=1
  1519. //>>excludeEnd("ctx");
  1520. ][0];
  1521. [$self._should_return_("foo ^ nil ifNil: [ 2 ]",(2))
  1522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1523. ,$ctx1.sendIdx["should:return:"]=2
  1524. //>>excludeEnd("ctx");
  1525. ][0];
  1526. [$self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self.receiver)
  1527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1528. ,$ctx1.sendIdx["should:return:"]=3
  1529. //>>excludeEnd("ctx");
  1530. ][0];
  1531. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  1532. return self;
  1533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1534. }, function($ctx1) {$ctx1.fill(self,"testifNil",{})});
  1535. //>>excludeEnd("ctx");
  1536. }; }),
  1537. $globals.AbstractCompilerTest);
  1538. $core.addMethod(
  1539. $core.method({
  1540. selector: "testifNilIfNotNil",
  1541. protocol: "tests",
  1542. //>>excludeStart("ide", pragmas.excludeIdeData);
  1543. args: [],
  1544. source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
  1545. referencedClasses: [],
  1546. //>>excludeEnd("ide");
  1547. pragmas: [],
  1548. messageSends: ["should:return:"]
  1549. }, function ($methodClass){ return function (){
  1550. var self=this,$self=this;
  1551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1552. return $core.withContext(function($ctx1) {
  1553. //>>excludeEnd("ctx");
  1554. [$self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3))
  1555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1556. ,$ctx1.sendIdx["should:return:"]=1
  1557. //>>excludeEnd("ctx");
  1558. ][0];
  1559. [$self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2))
  1560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1561. ,$ctx1.sendIdx["should:return:"]=2
  1562. //>>excludeEnd("ctx");
  1563. ][0];
  1564. [$self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3))
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. ,$ctx1.sendIdx["should:return:"]=3
  1567. //>>excludeEnd("ctx");
  1568. ][0];
  1569. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  1570. return self;
  1571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1572. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{})});
  1573. //>>excludeEnd("ctx");
  1574. }; }),
  1575. $globals.AbstractCompilerTest);
  1576. $core.addMethod(
  1577. $core.method({
  1578. selector: "testifNotNil",
  1579. protocol: "tests",
  1580. //>>excludeStart("ide", pragmas.excludeIdeData);
  1581. args: [],
  1582. source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
  1583. referencedClasses: [],
  1584. //>>excludeEnd("ide");
  1585. pragmas: [],
  1586. messageSends: ["should:return:"]
  1587. }, function ($methodClass){ return function (){
  1588. var self=this,$self=this;
  1589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1590. return $core.withContext(function($ctx1) {
  1591. //>>excludeEnd("ctx");
  1592. [$self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2))
  1593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1594. ,$ctx1.sendIdx["should:return:"]=1
  1595. //>>excludeEnd("ctx");
  1596. ][0];
  1597. [$self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil)
  1598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1599. ,$ctx1.sendIdx["should:return:"]=2
  1600. //>>excludeEnd("ctx");
  1601. ][0];
  1602. [$self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2))
  1603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1604. ,$ctx1.sendIdx["should:return:"]=3
  1605. //>>excludeEnd("ctx");
  1606. ][0];
  1607. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self.receiver);
  1608. return self;
  1609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1610. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{})});
  1611. //>>excludeEnd("ctx");
  1612. }; }),
  1613. $globals.AbstractCompilerTest);
  1614. $core.addMethod(
  1615. $core.method({
  1616. selector: "testifNotNilWithArgument",
  1617. protocol: "tests",
  1618. //>>excludeStart("ide", pragmas.excludeIdeData);
  1619. args: [],
  1620. source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5",
  1621. referencedClasses: [],
  1622. //>>excludeEnd("ide");
  1623. pragmas: [],
  1624. messageSends: ["should:return:"]
  1625. }, function ($methodClass){ return function (){
  1626. var self=this,$self=this;
  1627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1628. return $core.withContext(function($ctx1) {
  1629. //>>excludeEnd("ctx");
  1630. [$self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3))
  1631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1632. ,$ctx1.sendIdx["should:return:"]=1
  1633. //>>excludeEnd("ctx");
  1634. ][0];
  1635. [$self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil)
  1636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1637. ,$ctx1.sendIdx["should:return:"]=2
  1638. //>>excludeEnd("ctx");
  1639. ][0];
  1640. [$self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3))
  1641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1642. ,$ctx1.sendIdx["should:return:"]=3
  1643. //>>excludeEnd("ctx");
  1644. ][0];
  1645. [$self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5))
  1646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1647. ,$ctx1.sendIdx["should:return:"]=4
  1648. //>>excludeEnd("ctx");
  1649. ][0];
  1650. [$self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3))
  1651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1652. ,$ctx1.sendIdx["should:return:"]=5
  1653. //>>excludeEnd("ctx");
  1654. ][0];
  1655. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  1656. return self;
  1657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1658. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{})});
  1659. //>>excludeEnd("ctx");
  1660. }; }),
  1661. $globals.AbstractCompilerTest);
  1662. $core.addMethod(
  1663. $core.method({
  1664. selector: "testifTrue",
  1665. protocol: "tests",
  1666. //>>excludeStart("ide", pragmas.excludeIdeData);
  1667. args: [],
  1668. source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
  1669. referencedClasses: [],
  1670. //>>excludeEnd("ide");
  1671. pragmas: [],
  1672. messageSends: ["should:return:"]
  1673. }, function ($methodClass){ return function (){
  1674. var self=this,$self=this;
  1675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1676. return $core.withContext(function($ctx1) {
  1677. //>>excludeEnd("ctx");
  1678. [$self._should_return_("foo false ifTrue: [ ^ 1 ]",$self.receiver)
  1679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1680. ,$ctx1.sendIdx["should:return:"]=1
  1681. //>>excludeEnd("ctx");
  1682. ][0];
  1683. [$self._should_return_("foo true ifTrue: [ ^ 2 ]",(2))
  1684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1685. ,$ctx1.sendIdx["should:return:"]=2
  1686. //>>excludeEnd("ctx");
  1687. ][0];
  1688. [$self._should_return_("foo ^ false ifTrue: [ 1 ]",nil)
  1689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1690. ,$ctx1.sendIdx["should:return:"]=3
  1691. //>>excludeEnd("ctx");
  1692. ][0];
  1693. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  1694. return self;
  1695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1696. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{})});
  1697. //>>excludeEnd("ctx");
  1698. }; }),
  1699. $globals.AbstractCompilerTest);
  1700. $core.addMethod(
  1701. $core.method({
  1702. selector: "testifTrueIfFalse",
  1703. protocol: "tests",
  1704. //>>excludeStart("ide", pragmas.excludeIdeData);
  1705. args: [],
  1706. source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
  1707. referencedClasses: [],
  1708. //>>excludeEnd("ide");
  1709. pragmas: [],
  1710. messageSends: ["should:return:"]
  1711. }, function ($methodClass){ return function (){
  1712. var self=this,$self=this;
  1713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1714. return $core.withContext(function($ctx1) {
  1715. //>>excludeEnd("ctx");
  1716. [$self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2))
  1717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1718. ,$ctx1.sendIdx["should:return:"]=1
  1719. //>>excludeEnd("ctx");
  1720. ][0];
  1721. [$self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1))
  1722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1723. ,$ctx1.sendIdx["should:return:"]=2
  1724. //>>excludeEnd("ctx");
  1725. ][0];
  1726. [$self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1))
  1727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1728. ,$ctx1.sendIdx["should:return:"]=3
  1729. //>>excludeEnd("ctx");
  1730. ][0];
  1731. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  1732. return self;
  1733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1734. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{})});
  1735. //>>excludeEnd("ctx");
  1736. }; }),
  1737. $globals.AbstractCompilerTest);
  1738. $core.addMethod(
  1739. $core.method({
  1740. selector: "isAbstract",
  1741. protocol: "testing",
  1742. //>>excludeStart("ide", pragmas.excludeIdeData);
  1743. args: [],
  1744. source: "isAbstract\x0a\x09^ self name = AbstractCompilerTest name",
  1745. referencedClasses: ["AbstractCompilerTest"],
  1746. //>>excludeEnd("ide");
  1747. pragmas: [],
  1748. messageSends: ["=", "name"]
  1749. }, function ($methodClass){ return function (){
  1750. var self=this,$self=this;
  1751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1752. return $core.withContext(function($ctx1) {
  1753. //>>excludeEnd("ctx");
  1754. return $recv([$self._name()
  1755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1756. ,$ctx1.sendIdx["name"]=1
  1757. //>>excludeEnd("ctx");
  1758. ][0]).__eq($recv($globals.AbstractCompilerTest)._name());
  1759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1760. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  1761. //>>excludeEnd("ctx");
  1762. }; }),
  1763. $globals.AbstractCompilerTest.a$cls);
  1764. $core.addClass("ASTDebuggerTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
  1765. $core.addClass("ASTInterpreterTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
  1766. $core.addClass("CodeGeneratorTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
  1767. $core.addClass("InliningCodeGeneratorTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
  1768. $core.addClass("ASTPCNodeVisitorTest", $globals.TestCase, [], "Compiler-Tests");
  1769. $core.addMethod(
  1770. $core.method({
  1771. selector: "astPCNodeVisitor",
  1772. protocol: "factory",
  1773. //>>excludeStart("ide", pragmas.excludeIdeData);
  1774. args: [],
  1775. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  1776. referencedClasses: ["ASTPCNodeVisitor"],
  1777. //>>excludeEnd("ide");
  1778. pragmas: [],
  1779. messageSends: ["index:", "new", "yourself"]
  1780. }, function ($methodClass){ return function (){
  1781. var self=this,$self=this;
  1782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1783. return $core.withContext(function($ctx1) {
  1784. //>>excludeEnd("ctx");
  1785. var $1;
  1786. $1=$recv($globals.ASTPCNodeVisitor)._new();
  1787. $recv($1)._index_((0));
  1788. return $recv($1)._yourself();
  1789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1790. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{})});
  1791. //>>excludeEnd("ctx");
  1792. }; }),
  1793. $globals.ASTPCNodeVisitorTest);
  1794. $core.addMethod(
  1795. $core.method({
  1796. selector: "astPCNodeVisitorForSelector:",
  1797. protocol: "factory",
  1798. //>>excludeStart("ide", pragmas.excludeIdeData);
  1799. args: ["aString"],
  1800. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  1801. referencedClasses: ["ASTPCNodeVisitor"],
  1802. //>>excludeEnd("ide");
  1803. pragmas: [],
  1804. messageSends: ["selector:", "new", "index:", "yourself"]
  1805. }, function ($methodClass){ return function (aString){
  1806. var self=this,$self=this;
  1807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1808. return $core.withContext(function($ctx1) {
  1809. //>>excludeEnd("ctx");
  1810. var $1;
  1811. $1=$recv($globals.ASTPCNodeVisitor)._new();
  1812. $recv($1)._selector_(aString);
  1813. $recv($1)._index_((0));
  1814. return $recv($1)._yourself();
  1815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1816. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString})});
  1817. //>>excludeEnd("ctx");
  1818. }; }),
  1819. $globals.ASTPCNodeVisitorTest);
  1820. $core.addMethod(
  1821. $core.method({
  1822. selector: "newTeachableVisitor",
  1823. protocol: "factory",
  1824. //>>excludeStart("ide", pragmas.excludeIdeData);
  1825. args: [],
  1826. source: "newTeachableVisitor\x0a\x09| result |\x0a\x09result := Teachable new\x0a\x09\x09whenSend: #visit: evaluate: [ :one | one acceptDagVisitor: result ];\x0a\x09\x09acceptSend: #visitDagNode:.\x0a\x09^ result",
  1827. referencedClasses: ["Teachable"],
  1828. //>>excludeEnd("ide");
  1829. pragmas: [],
  1830. messageSends: ["whenSend:evaluate:", "new", "acceptDagVisitor:", "acceptSend:"]
  1831. }, function ($methodClass){ return function (){
  1832. var self=this,$self=this;
  1833. var result;
  1834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1835. return $core.withContext(function($ctx1) {
  1836. //>>excludeEnd("ctx");
  1837. var $1;
  1838. $1=$recv($globals.Teachable)._new();
  1839. $recv($1)._whenSend_evaluate_("visit:",(function(one){
  1840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1841. return $core.withContext(function($ctx2) {
  1842. //>>excludeEnd("ctx");
  1843. return $recv(one)._acceptDagVisitor_(result);
  1844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1845. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  1846. //>>excludeEnd("ctx");
  1847. }));
  1848. result=$recv($1)._acceptSend_("visitDagNode:");
  1849. return result;
  1850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1851. }, function($ctx1) {$ctx1.fill(self,"newTeachableVisitor",{result:result})});
  1852. //>>excludeEnd("ctx");
  1853. }; }),
  1854. $globals.ASTPCNodeVisitorTest);
  1855. $core.addMethod(
  1856. $core.method({
  1857. selector: "testJSStatementNode",
  1858. protocol: "tests",
  1859. //>>excludeStart("ide", pragmas.excludeIdeData);
  1860. args: [],
  1861. source: "testJSStatementNode\x0a\x09| ast result |\x0a\x09\x0a\x09ast := self parse: 'foo <inlineJS: ''consolee.log(1)''>' forClass: Object.\x0a\x09result := self astPCNodeVisitor visit: ast; currentNode.\x0a\x09self\x0a\x09\x09assert: ((self newTeachableVisitor whenSend: #visitJSStatementNode: return: 'JS'; yourself) visit: result)\x0a\x09\x09equals: 'JS'",
  1862. referencedClasses: ["Object"],
  1863. //>>excludeEnd("ide");
  1864. pragmas: [],
  1865. messageSends: ["parse:forClass:", "visit:", "astPCNodeVisitor", "currentNode", "assert:equals:", "whenSend:return:", "newTeachableVisitor", "yourself"]
  1866. }, function ($methodClass){ return function (){
  1867. var self=this,$self=this;
  1868. var ast,result;
  1869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1870. return $core.withContext(function($ctx1) {
  1871. //>>excludeEnd("ctx");
  1872. var $1,$4,$3,$2;
  1873. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  1874. $1=$self._astPCNodeVisitor();
  1875. [$recv($1)._visit_(ast)
  1876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1877. ,$ctx1.sendIdx["visit:"]=1
  1878. //>>excludeEnd("ctx");
  1879. ][0];
  1880. result=$recv($1)._currentNode();
  1881. $4=$self._newTeachableVisitor();
  1882. $recv($4)._whenSend_return_("visitJSStatementNode:","JS");
  1883. $3=$recv($4)._yourself();
  1884. $2=$recv($3)._visit_(result);
  1885. $self._assert_equals_($2,"JS");
  1886. return self;
  1887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1888. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,result:result})});
  1889. //>>excludeEnd("ctx");
  1890. }; }),
  1891. $globals.ASTPCNodeVisitorTest);
  1892. $core.addMethod(
  1893. $core.method({
  1894. selector: "testMessageSend",
  1895. protocol: "tests",
  1896. //>>excludeStart("ide", pragmas.excludeIdeData);
  1897. args: [],
  1898. source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  1899. referencedClasses: ["Object"],
  1900. //>>excludeEnd("ide");
  1901. pragmas: [],
  1902. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  1903. }, function ($methodClass){ return function (){
  1904. var self=this,$self=this;
  1905. var ast;
  1906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1907. return $core.withContext(function($ctx1) {
  1908. //>>excludeEnd("ctx");
  1909. var $3,$2,$1;
  1910. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  1911. $3=$self._astPCNodeVisitorForSelector_("yourself");
  1912. $recv($3)._visit_(ast);
  1913. $2=$recv($3)._currentNode();
  1914. $1=$recv($2)._selector();
  1915. $self._assert_equals_($1,"yourself");
  1916. return self;
  1917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1918. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast})});
  1919. //>>excludeEnd("ctx");
  1920. }; }),
  1921. $globals.ASTPCNodeVisitorTest);
  1922. $core.addMethod(
  1923. $core.method({
  1924. selector: "testMessageSendWithBlocks",
  1925. protocol: "tests",
  1926. //>>excludeStart("ide", pragmas.excludeIdeData);
  1927. args: [],
  1928. source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  1929. referencedClasses: ["Object"],
  1930. //>>excludeEnd("ide");
  1931. pragmas: [],
  1932. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  1933. }, function ($methodClass){ return function (){
  1934. var self=this,$self=this;
  1935. var ast;
  1936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1937. return $core.withContext(function($ctx1) {
  1938. //>>excludeEnd("ctx");
  1939. var $3,$2,$1;
  1940. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  1941. $3=$self._astPCNodeVisitorForSelector_("yourself");
  1942. $recv($3)._visit_(ast);
  1943. $2=$recv($3)._currentNode();
  1944. $1=$recv($2)._selector();
  1945. $self._assert_equals_($1,"yourself");
  1946. return self;
  1947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1948. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast})});
  1949. //>>excludeEnd("ctx");
  1950. }; }),
  1951. $globals.ASTPCNodeVisitorTest);
  1952. $core.addMethod(
  1953. $core.method({
  1954. selector: "testMessageSendWithInlining",
  1955. protocol: "tests",
  1956. //>>excludeStart("ide", pragmas.excludeIdeData);
  1957. args: [],
  1958. source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
  1959. referencedClasses: ["Object"],
  1960. //>>excludeEnd("ide");
  1961. pragmas: [],
  1962. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  1963. }, function ($methodClass){ return function (){
  1964. var self=this,$self=this;
  1965. var ast;
  1966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1967. return $core.withContext(function($ctx1) {
  1968. //>>excludeEnd("ctx");
  1969. var $3,$2,$1,$6,$5,$4;
  1970. ast=[$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object)
  1971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1972. ,$ctx1.sendIdx["parse:forClass:"]=1
  1973. //>>excludeEnd("ctx");
  1974. ][0];
  1975. $3=[$self._astPCNodeVisitorForSelector_("yourself")
  1976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1977. ,$ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1
  1978. //>>excludeEnd("ctx");
  1979. ][0];
  1980. [$recv($3)._visit_(ast)
  1981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1982. ,$ctx1.sendIdx["visit:"]=1
  1983. //>>excludeEnd("ctx");
  1984. ][0];
  1985. $2=[$recv($3)._currentNode()
  1986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1987. ,$ctx1.sendIdx["currentNode"]=1
  1988. //>>excludeEnd("ctx");
  1989. ][0];
  1990. $1=[$recv($2)._selector()
  1991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1992. ,$ctx1.sendIdx["selector"]=1
  1993. //>>excludeEnd("ctx");
  1994. ][0];
  1995. [$self._assert_equals_($1,"yourself")
  1996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1997. ,$ctx1.sendIdx["assert:equals:"]=1
  1998. //>>excludeEnd("ctx");
  1999. ][0];
  2000. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  2001. $6=$self._astPCNodeVisitorForSelector_("asBoolean");
  2002. $recv($6)._visit_(ast);
  2003. $5=$recv($6)._currentNode();
  2004. $4=$recv($5)._selector();
  2005. $self._assert_equals_($4,"asBoolean");
  2006. return self;
  2007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2008. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast})});
  2009. //>>excludeEnd("ctx");
  2010. }; }),
  2011. $globals.ASTPCNodeVisitorTest);
  2012. $core.addMethod(
  2013. $core.method({
  2014. selector: "testNoMessageSend",
  2015. protocol: "tests",
  2016. //>>excludeStart("ide", pragmas.excludeIdeData);
  2017. args: [],
  2018. source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil",
  2019. referencedClasses: ["Object"],
  2020. //>>excludeEnd("ide");
  2021. pragmas: [],
  2022. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  2023. }, function ($methodClass){ return function (){
  2024. var self=this,$self=this;
  2025. var ast;
  2026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2027. return $core.withContext(function($ctx1) {
  2028. //>>excludeEnd("ctx");
  2029. var $3,$2,$1;
  2030. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  2031. $3=$self._astPCNodeVisitor();
  2032. $recv($3)._visit_(ast);
  2033. $2=$recv($3)._currentNode();
  2034. $1=$recv($2)._isNil();
  2035. $self._assert_($1);
  2036. return self;
  2037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2038. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast})});
  2039. //>>excludeEnd("ctx");
  2040. }; }),
  2041. $globals.ASTPCNodeVisitorTest);
  2042. $core.addClass("ASTPositionTest", $globals.TestCase, [], "Compiler-Tests");
  2043. $core.addMethod(
  2044. $core.method({
  2045. selector: "testNodeAtPosition",
  2046. protocol: "tests",
  2047. //>>excludeStart("ide", pragmas.excludeIdeData);
  2048. args: [],
  2049. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  2050. referencedClasses: ["Object"],
  2051. //>>excludeEnd("ide");
  2052. pragmas: [],
  2053. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  2054. }, function ($methodClass){ return function (){
  2055. var self=this,$self=this;
  2056. var node;
  2057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2058. return $core.withContext(function($ctx1) {
  2059. //>>excludeEnd("ctx");
  2060. node=[$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object)
  2061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2062. ,$ctx1.sendIdx["parse:forClass:"]=1
  2063. //>>excludeEnd("ctx");
  2064. ][0];
  2065. [$self._assert_equals_($recv([$recv(node)._navigationNodeAt_ifAbsent_([(2).__at((4))
  2066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2067. ,$ctx1.sendIdx["@"]=1
  2068. //>>excludeEnd("ctx");
  2069. ][0],(function(){
  2070. return nil;
  2071. }))
  2072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2073. ,$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1
  2074. //>>excludeEnd("ctx");
  2075. ][0])._source(),"self")
  2076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2077. ,$ctx1.sendIdx["assert:equals:"]=1
  2078. //>>excludeEnd("ctx");
  2079. ][0];
  2080. node=[$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object)
  2081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2082. ,$ctx1.sendIdx["parse:forClass:"]=2
  2083. //>>excludeEnd("ctx");
  2084. ][0];
  2085. [$self._assert_equals_([$recv([$recv(node)._navigationNodeAt_ifAbsent_([(2).__at((7))
  2086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2087. ,$ctx1.sendIdx["@"]=2
  2088. //>>excludeEnd("ctx");
  2089. ][0],(function(){
  2090. return nil;
  2091. }))
  2092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2093. ,$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2
  2094. //>>excludeEnd("ctx");
  2095. ][0])._selector()
  2096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2097. ,$ctx1.sendIdx["selector"]=1
  2098. //>>excludeEnd("ctx");
  2099. ][0],"ifTrue:")
  2100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2101. ,$ctx1.sendIdx["assert:equals:"]=2
  2102. //>>excludeEnd("ctx");
  2103. ][0];
  2104. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  2105. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  2106. return nil;
  2107. })))._selector(),"foo");
  2108. return self;
  2109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2110. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node})});
  2111. //>>excludeEnd("ctx");
  2112. }; }),
  2113. $globals.ASTPositionTest);
  2114. $core.addClass("AbstractCodeGeneratorInstallTest", $globals.TestCase, ["receiver"], "Compiler-Tests");
  2115. $core.addMethod(
  2116. $core.method({
  2117. selector: "receiver",
  2118. protocol: "accessing",
  2119. //>>excludeStart("ide", pragmas.excludeIdeData);
  2120. args: [],
  2121. source: "receiver\x0a\x09^ receiver",
  2122. referencedClasses: [],
  2123. //>>excludeEnd("ide");
  2124. pragmas: [],
  2125. messageSends: []
  2126. }, function ($methodClass){ return function (){
  2127. var self=this,$self=this;
  2128. return $self.receiver;
  2129. }; }),
  2130. $globals.AbstractCodeGeneratorInstallTest);
  2131. $core.addMethod(
  2132. $core.method({
  2133. selector: "shouldntInstall:",
  2134. protocol: "testing",
  2135. //>>excludeStart("ide", pragmas.excludeIdeData);
  2136. args: ["aString"],
  2137. source: "shouldntInstall: aString\x0a\x09| method |\x0a\x0a\x09[ self\x0a\x09\x09should: [ method := self install: aString forClass: receiver class ]\x0a\x09\x09raise: ParseError ]\x0a\x09ensure: [ method ifNotNil: [ receiver class removeCompiledMethod: method ] ]",
  2138. referencedClasses: ["ParseError"],
  2139. //>>excludeEnd("ide");
  2140. pragmas: [],
  2141. messageSends: ["ensure:", "should:raise:", "install:forClass:", "class", "ifNotNil:", "removeCompiledMethod:"]
  2142. }, function ($methodClass){ return function (aString){
  2143. var self=this,$self=this;
  2144. var method;
  2145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2146. return $core.withContext(function($ctx1) {
  2147. //>>excludeEnd("ctx");
  2148. var $1,$receiver;
  2149. $recv((function(){
  2150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2151. return $core.withContext(function($ctx2) {
  2152. //>>excludeEnd("ctx");
  2153. return $self._should_raise_((function(){
  2154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2155. return $core.withContext(function($ctx3) {
  2156. //>>excludeEnd("ctx");
  2157. method=$self._install_forClass_(aString,[$recv($self.receiver)._class()
  2158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2159. ,$ctx3.sendIdx["class"]=1
  2160. //>>excludeEnd("ctx");
  2161. ][0]);
  2162. return method;
  2163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2164. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2165. //>>excludeEnd("ctx");
  2166. }),$globals.ParseError);
  2167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2169. //>>excludeEnd("ctx");
  2170. }))._ensure_((function(){
  2171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2172. return $core.withContext(function($ctx2) {
  2173. //>>excludeEnd("ctx");
  2174. $1=method;
  2175. if(($receiver = $1) == null || $receiver.a$nil){
  2176. return $1;
  2177. } else {
  2178. return $recv($recv($self.receiver)._class())._removeCompiledMethod_(method);
  2179. }
  2180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  2182. //>>excludeEnd("ctx");
  2183. }));
  2184. return self;
  2185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2186. }, function($ctx1) {$ctx1.fill(self,"shouldntInstall:",{aString:aString,method:method})});
  2187. //>>excludeEnd("ctx");
  2188. }; }),
  2189. $globals.AbstractCodeGeneratorInstallTest);
  2190. $core.addMethod(
  2191. $core.method({
  2192. selector: "testMistypedPragmaJSStatement",
  2193. protocol: "tests",
  2194. //>>excludeStart("ide", pragmas.excludeIdeData);
  2195. args: [],
  2196. source: "testMistypedPragmaJSStatement\x0a\x09self shouldntInstall: 'foo < inlineJS: ''return ''foo'''' >'",
  2197. referencedClasses: [],
  2198. //>>excludeEnd("ide");
  2199. pragmas: [],
  2200. messageSends: ["shouldntInstall:"]
  2201. }, function ($methodClass){ return function (){
  2202. var self=this,$self=this;
  2203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2204. return $core.withContext(function($ctx1) {
  2205. //>>excludeEnd("ctx");
  2206. $self._shouldntInstall_("foo < inlineJS: 'return 'foo'' >");
  2207. return self;
  2208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2209. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{})});
  2210. //>>excludeEnd("ctx");
  2211. }; }),
  2212. $globals.AbstractCodeGeneratorInstallTest);
  2213. $core.addMethod(
  2214. $core.method({
  2215. selector: "testNiladicJSOverride",
  2216. protocol: "tests",
  2217. //>>excludeStart("ide", pragmas.excludeIdeData);
  2218. args: [],
  2219. source: "testNiladicJSOverride\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'baz <jsOverride: #baz> ^ (foo := foo + 3)' should: [\x0a\x09\x09self assert: receiver baz equals: 7.\x0a\x09\x09self assert: (receiver basicPerform: #baz) equals: 10.\x0a\x09\x09self assert: receiver baz equals: 13.\x0a\x09\x09self assert: receiver foo equals: 13 ]",
  2220. referencedClasses: ["ObjectMock"],
  2221. //>>excludeEnd("ide");
  2222. pragmas: [],
  2223. messageSends: ["new", "foo:", "while:should:", "assert:equals:", "baz", "basicPerform:", "foo"]
  2224. }, function ($methodClass){ return function (){
  2225. var self=this,$self=this;
  2226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2227. return $core.withContext(function($ctx1) {
  2228. //>>excludeEnd("ctx");
  2229. $self.receiver=$recv($globals.ObjectMock)._new();
  2230. $recv($self.receiver)._foo_((4));
  2231. $self._while_should_("baz <jsOverride: #baz> ^ (foo := foo + 3)",(function(){
  2232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2233. return $core.withContext(function($ctx2) {
  2234. //>>excludeEnd("ctx");
  2235. [$self._assert_equals_([$recv($self.receiver)._baz()
  2236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2237. ,$ctx2.sendIdx["baz"]=1
  2238. //>>excludeEnd("ctx");
  2239. ][0],(7))
  2240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2241. ,$ctx2.sendIdx["assert:equals:"]=1
  2242. //>>excludeEnd("ctx");
  2243. ][0];
  2244. [$self._assert_equals_($recv($self.receiver)._basicPerform_("baz"),(10))
  2245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2246. ,$ctx2.sendIdx["assert:equals:"]=2
  2247. //>>excludeEnd("ctx");
  2248. ][0];
  2249. [$self._assert_equals_($recv($self.receiver)._baz(),(13))
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. ,$ctx2.sendIdx["assert:equals:"]=3
  2252. //>>excludeEnd("ctx");
  2253. ][0];
  2254. return $self._assert_equals_($recv($self.receiver)._foo(),(13));
  2255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2257. //>>excludeEnd("ctx");
  2258. }));
  2259. return self;
  2260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2261. }, function($ctx1) {$ctx1.fill(self,"testNiladicJSOverride",{})});
  2262. //>>excludeEnd("ctx");
  2263. }; }),
  2264. $globals.AbstractCodeGeneratorInstallTest);
  2265. $core.addMethod(
  2266. $core.method({
  2267. selector: "testNiladicJSOverrideDifferentNames",
  2268. protocol: "tests",
  2269. //>>excludeStart("ide", pragmas.excludeIdeData);
  2270. args: [],
  2271. source: "testNiladicJSOverrideDifferentNames\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'quux <jsOverride: #mux> ^ (foo := foo + 3)' should: [\x0a\x09\x09self should: [ receiver mux ] raise: MessageNotUnderstood.\x0a\x09\x09self assert: (receiver basicPerform: #mux) equals: 7.\x0a\x09\x09self assert: receiver quux equals: 10.\x0a\x09\x09self should: [ receiver basicPerform: #quux ] raise: Error.\x0a\x09\x09self assert: receiver foo equals: 10 ]",
  2272. referencedClasses: ["ObjectMock", "MessageNotUnderstood", "Error"],
  2273. //>>excludeEnd("ide");
  2274. pragmas: [],
  2275. messageSends: ["new", "foo:", "while:should:", "should:raise:", "mux", "assert:equals:", "basicPerform:", "quux", "foo"]
  2276. }, function ($methodClass){ return function (){
  2277. var self=this,$self=this;
  2278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2279. return $core.withContext(function($ctx1) {
  2280. //>>excludeEnd("ctx");
  2281. $self.receiver=$recv($globals.ObjectMock)._new();
  2282. $recv($self.receiver)._foo_((4));
  2283. $self._while_should_("quux <jsOverride: #mux> ^ (foo := foo + 3)",(function(){
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. return $core.withContext(function($ctx2) {
  2286. //>>excludeEnd("ctx");
  2287. [$self._should_raise_((function(){
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. return $core.withContext(function($ctx3) {
  2290. //>>excludeEnd("ctx");
  2291. return $recv($self.receiver)._mux();
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2294. //>>excludeEnd("ctx");
  2295. }),$globals.MessageNotUnderstood)
  2296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2297. ,$ctx2.sendIdx["should:raise:"]=1
  2298. //>>excludeEnd("ctx");
  2299. ][0];
  2300. [$self._assert_equals_([$recv($self.receiver)._basicPerform_("mux")
  2301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2302. ,$ctx2.sendIdx["basicPerform:"]=1
  2303. //>>excludeEnd("ctx");
  2304. ][0],(7))
  2305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2306. ,$ctx2.sendIdx["assert:equals:"]=1
  2307. //>>excludeEnd("ctx");
  2308. ][0];
  2309. [$self._assert_equals_($recv($self.receiver)._quux(),(10))
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. ,$ctx2.sendIdx["assert:equals:"]=2
  2312. //>>excludeEnd("ctx");
  2313. ][0];
  2314. $self._should_raise_((function(){
  2315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2316. return $core.withContext(function($ctx3) {
  2317. //>>excludeEnd("ctx");
  2318. return $recv($self.receiver)._basicPerform_("quux");
  2319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2320. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  2321. //>>excludeEnd("ctx");
  2322. }),$globals.Error);
  2323. return $self._assert_equals_($recv($self.receiver)._foo(),(10));
  2324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2326. //>>excludeEnd("ctx");
  2327. }));
  2328. return self;
  2329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2330. }, function($ctx1) {$ctx1.fill(self,"testNiladicJSOverrideDifferentNames",{})});
  2331. //>>excludeEnd("ctx");
  2332. }; }),
  2333. $globals.AbstractCodeGeneratorInstallTest);
  2334. $core.addMethod(
  2335. $core.method({
  2336. selector: "testPragmaInBlock",
  2337. protocol: "tests",
  2338. //>>excludeStart("ide", pragmas.excludeIdeData);
  2339. args: [],
  2340. source: "testPragmaInBlock\x0a\x09self shouldntInstall: 'foo ^ [ < fooBar > 4 ] value'",
  2341. referencedClasses: [],
  2342. //>>excludeEnd("ide");
  2343. pragmas: [],
  2344. messageSends: ["shouldntInstall:"]
  2345. }, function ($methodClass){ return function (){
  2346. var self=this,$self=this;
  2347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2348. return $core.withContext(function($ctx1) {
  2349. //>>excludeEnd("ctx");
  2350. $self._shouldntInstall_("foo ^ [ < fooBar > 4 ] value");
  2351. return self;
  2352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2353. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{})});
  2354. //>>excludeEnd("ctx");
  2355. }; }),
  2356. $globals.AbstractCodeGeneratorInstallTest);
  2357. $core.addMethod(
  2358. $core.method({
  2359. selector: "isAbstract",
  2360. protocol: "testing",
  2361. //>>excludeStart("ide", pragmas.excludeIdeData);
  2362. args: [],
  2363. source: "isAbstract\x0a\x09^ self name = AbstractCodeGeneratorInstallTest name",
  2364. referencedClasses: ["AbstractCodeGeneratorInstallTest"],
  2365. //>>excludeEnd("ide");
  2366. pragmas: [],
  2367. messageSends: ["=", "name"]
  2368. }, function ($methodClass){ return function (){
  2369. var self=this,$self=this;
  2370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2371. return $core.withContext(function($ctx1) {
  2372. //>>excludeEnd("ctx");
  2373. return $recv([$self._name()
  2374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2375. ,$ctx1.sendIdx["name"]=1
  2376. //>>excludeEnd("ctx");
  2377. ][0]).__eq($recv($globals.AbstractCodeGeneratorInstallTest)._name());
  2378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2379. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  2380. //>>excludeEnd("ctx");
  2381. }; }),
  2382. $globals.AbstractCodeGeneratorInstallTest.a$cls);
  2383. $core.addClass("CodeGeneratorInstallTest", $globals.AbstractCodeGeneratorInstallTest, [], "Compiler-Tests");
  2384. $core.addClass("InliningCodeGeneratorInstallTest", $globals.AbstractCodeGeneratorInstallTest, [], "Compiler-Tests");
  2385. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  2386. $core.addMethod(
  2387. $core.method({
  2388. selector: "testClassRefVar",
  2389. protocol: "tests",
  2390. //>>excludeStart("ide", pragmas.excludeIdeData);
  2391. args: [],
  2392. source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar",
  2393. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  2394. //>>excludeEnd("ide");
  2395. pragmas: [],
  2396. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  2397. }, function ($methodClass){ return function (){
  2398. var self=this,$self=this;
  2399. var node;
  2400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2401. return $core.withContext(function($ctx1) {
  2402. //>>excludeEnd("ctx");
  2403. var $1,$2;
  2404. $1=[$recv($globals.VariableNode)._new()
  2405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2406. ,$ctx1.sendIdx["new"]=1
  2407. //>>excludeEnd("ctx");
  2408. ][0];
  2409. $recv($1)._value_("Object");
  2410. node=$recv($1)._yourself();
  2411. $2=[$recv($globals.SemanticAnalyzer)._new()
  2412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2413. ,$ctx1.sendIdx["new"]=2
  2414. //>>excludeEnd("ctx");
  2415. ][0];
  2416. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  2417. $recv($2)._visit_(node);
  2418. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  2419. return self;
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node})});
  2422. //>>excludeEnd("ctx");
  2423. }; }),
  2424. $globals.ScopeVarTest);
  2425. $core.addMethod(
  2426. $core.method({
  2427. selector: "testInstanceVar",
  2428. protocol: "tests",
  2429. //>>excludeStart("ide", pragmas.excludeIdeData);
  2430. args: [],
  2431. source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
  2432. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  2433. //>>excludeEnd("ide");
  2434. pragmas: [],
  2435. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  2436. }, function ($methodClass){ return function (){
  2437. var self=this,$self=this;
  2438. var node,scope;
  2439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2440. return $core.withContext(function($ctx1) {
  2441. //>>excludeEnd("ctx");
  2442. var $1;
  2443. $1=[$recv($globals.VariableNode)._new()
  2444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2445. ,$ctx1.sendIdx["new"]=1
  2446. //>>excludeEnd("ctx");
  2447. ][0];
  2448. $recv($1)._value_("bzzz");
  2449. node=$recv($1)._yourself();
  2450. scope=$recv($globals.MethodLexicalScope)._new();
  2451. $recv(scope)._addIVar_("bzzz");
  2452. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  2453. return self;
  2454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2455. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope})});
  2456. //>>excludeEnd("ctx");
  2457. }; }),
  2458. $globals.ScopeVarTest);
  2459. $core.addMethod(
  2460. $core.method({
  2461. selector: "testPseudoVar",
  2462. protocol: "tests",
  2463. //>>excludeStart("ide", pragmas.excludeIdeData);
  2464. args: [],
  2465. source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar]",
  2466. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  2467. //>>excludeEnd("ide");
  2468. pragmas: [],
  2469. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  2470. }, function ($methodClass){ return function (){
  2471. var self=this,$self=this;
  2472. var node,pseudoVars;
  2473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2474. return $core.withContext(function($ctx1) {
  2475. //>>excludeEnd("ctx");
  2476. var $1;
  2477. pseudoVars=["self", "super", "true", "false", "nil"];
  2478. $recv(pseudoVars)._do_((function(each){
  2479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2480. return $core.withContext(function($ctx2) {
  2481. //>>excludeEnd("ctx");
  2482. $1=[$recv($globals.VariableNode)._new()
  2483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2484. ,$ctx2.sendIdx["new"]=1
  2485. //>>excludeEnd("ctx");
  2486. ][0];
  2487. $recv($1)._value_(each);
  2488. node=$recv($1)._yourself();
  2489. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  2490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2492. //>>excludeEnd("ctx");
  2493. }));
  2494. return self;
  2495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2496. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars})});
  2497. //>>excludeEnd("ctx");
  2498. }; }),
  2499. $globals.ScopeVarTest);
  2500. $core.addMethod(
  2501. $core.method({
  2502. selector: "testTempVar",
  2503. protocol: "tests",
  2504. //>>excludeStart("ide", pragmas.excludeIdeData);
  2505. args: [],
  2506. source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
  2507. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  2508. //>>excludeEnd("ide");
  2509. pragmas: [],
  2510. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  2511. }, function ($methodClass){ return function (){
  2512. var self=this,$self=this;
  2513. var node,scope;
  2514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2515. return $core.withContext(function($ctx1) {
  2516. //>>excludeEnd("ctx");
  2517. var $1;
  2518. $1=[$recv($globals.VariableNode)._new()
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. ,$ctx1.sendIdx["new"]=1
  2521. //>>excludeEnd("ctx");
  2522. ][0];
  2523. $recv($1)._value_("bzzz");
  2524. node=$recv($1)._yourself();
  2525. scope=$recv($globals.MethodLexicalScope)._new();
  2526. $recv(scope)._addTemp_("bzzz");
  2527. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  2528. return self;
  2529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2530. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope})});
  2531. //>>excludeEnd("ctx");
  2532. }; }),
  2533. $globals.ScopeVarTest);
  2534. $core.addMethod(
  2535. $core.method({
  2536. selector: "testUnknownVar",
  2537. protocol: "tests",
  2538. //>>excludeStart("ide", pragmas.excludeIdeData);
  2539. args: [],
  2540. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  2541. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  2542. //>>excludeEnd("ide");
  2543. pragmas: [],
  2544. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  2545. }, function ($methodClass){ return function (){
  2546. var self=this,$self=this;
  2547. var node;
  2548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2549. return $core.withContext(function($ctx1) {
  2550. //>>excludeEnd("ctx");
  2551. var $1;
  2552. $1=[$recv($globals.VariableNode)._new()
  2553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2554. ,$ctx1.sendIdx["new"]=1
  2555. //>>excludeEnd("ctx");
  2556. ][0];
  2557. $recv($1)._value_("bzzz");
  2558. node=$recv($1)._yourself();
  2559. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  2560. return self;
  2561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2562. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node})});
  2563. //>>excludeEnd("ctx");
  2564. }; }),
  2565. $globals.ScopeVarTest);
  2566. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  2567. $core.addMethod(
  2568. $core.method({
  2569. selector: "setUp",
  2570. protocol: "running",
  2571. //>>excludeStart("ide", pragmas.excludeIdeData);
  2572. args: [],
  2573. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  2574. referencedClasses: ["SemanticAnalyzer", "Object"],
  2575. //>>excludeEnd("ide");
  2576. pragmas: [],
  2577. messageSends: ["on:"]
  2578. }, function ($methodClass){ return function (){
  2579. var self=this,$self=this;
  2580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2581. return $core.withContext(function($ctx1) {
  2582. //>>excludeEnd("ctx");
  2583. $self.analyzer=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  2584. return self;
  2585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2586. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  2587. //>>excludeEnd("ctx");
  2588. }; }),
  2589. $globals.SemanticAnalyzerTest);
  2590. $core.addMethod(
  2591. $core.method({
  2592. selector: "testAssignment",
  2593. protocol: "tests",
  2594. //>>excludeStart("ide", pragmas.excludeIdeData);
  2595. args: [],
  2596. source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
  2597. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  2598. //>>excludeEnd("ide");
  2599. pragmas: [],
  2600. messageSends: ["parse:", "should:raise:", "visit:"]
  2601. }, function ($methodClass){ return function (){
  2602. var self=this,$self=this;
  2603. var src,ast;
  2604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2605. return $core.withContext(function($ctx1) {
  2606. //>>excludeEnd("ctx");
  2607. src="foo self := 1";
  2608. ast=$recv($globals.Smalltalk)._parse_(src);
  2609. $self._should_raise_((function(){
  2610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2611. return $core.withContext(function($ctx2) {
  2612. //>>excludeEnd("ctx");
  2613. return $recv($self.analyzer)._visit_(ast);
  2614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2616. //>>excludeEnd("ctx");
  2617. }),$globals.InvalidAssignmentError);
  2618. return self;
  2619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2620. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast})});
  2621. //>>excludeEnd("ctx");
  2622. }; }),
  2623. $globals.SemanticAnalyzerTest);
  2624. $core.addMethod(
  2625. $core.method({
  2626. selector: "testNonLocalReturn",
  2627. protocol: "tests",
  2628. //>>excludeStart("ide", pragmas.excludeIdeData);
  2629. args: [],
  2630. source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
  2631. referencedClasses: ["Smalltalk"],
  2632. //>>excludeEnd("ide");
  2633. pragmas: [],
  2634. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  2635. }, function ($methodClass){ return function (){
  2636. var self=this,$self=this;
  2637. var src,ast;
  2638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2639. return $core.withContext(function($ctx1) {
  2640. //>>excludeEnd("ctx");
  2641. src="foo | a | a + 1. ^ a";
  2642. ast=$recv($globals.Smalltalk)._parse_(src);
  2643. $recv($self.analyzer)._visit_(ast);
  2644. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  2645. return self;
  2646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2647. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast})});
  2648. //>>excludeEnd("ctx");
  2649. }; }),
  2650. $globals.SemanticAnalyzerTest);
  2651. $core.addMethod(
  2652. $core.method({
  2653. selector: "testNonLocalReturn2",
  2654. protocol: "tests",
  2655. //>>excludeStart("ide", pragmas.excludeIdeData);
  2656. args: [],
  2657. source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
  2658. referencedClasses: ["Smalltalk"],
  2659. //>>excludeEnd("ide");
  2660. pragmas: [],
  2661. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  2662. }, function ($methodClass){ return function (){
  2663. var self=this,$self=this;
  2664. var src,ast;
  2665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2666. return $core.withContext(function($ctx1) {
  2667. //>>excludeEnd("ctx");
  2668. src="foo | a | a + 1. [ [ ^ a] ]";
  2669. ast=$recv($globals.Smalltalk)._parse_(src);
  2670. $recv($self.analyzer)._visit_(ast);
  2671. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  2672. return self;
  2673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2674. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast})});
  2675. //>>excludeEnd("ctx");
  2676. }; }),
  2677. $globals.SemanticAnalyzerTest);
  2678. $core.addMethod(
  2679. $core.method({
  2680. selector: "testScope",
  2681. protocol: "tests",
  2682. //>>excludeStart("ide", pragmas.excludeIdeData);
  2683. args: [],
  2684. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast sequenceNode dagChildren last scope == ast scope.",
  2685. referencedClasses: ["Smalltalk"],
  2686. //>>excludeEnd("ide");
  2687. pragmas: [],
  2688. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "sequenceNode"]
  2689. }, function ($methodClass){ return function (){
  2690. var self=this,$self=this;
  2691. var src,ast;
  2692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2693. return $core.withContext(function($ctx1) {
  2694. //>>excludeEnd("ctx");
  2695. src="foo | a | a + 1. [ | b | b := a ]";
  2696. ast=$recv($globals.Smalltalk)._parse_(src);
  2697. $recv($self.analyzer)._visit_(ast);
  2698. $self._deny_($recv([$recv($recv($recv($recv(ast)._sequenceNode())._dagChildren())._last())._scope()
  2699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2700. ,$ctx1.sendIdx["scope"]=1
  2701. //>>excludeEnd("ctx");
  2702. ][0]).__eq_eq($recv(ast)._scope()));
  2703. return self;
  2704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2705. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast})});
  2706. //>>excludeEnd("ctx");
  2707. }; }),
  2708. $globals.SemanticAnalyzerTest);
  2709. $core.addMethod(
  2710. $core.method({
  2711. selector: "testScope2",
  2712. protocol: "tests",
  2713. //>>excludeStart("ide", pragmas.excludeIdeData);
  2714. args: [],
  2715. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast sequenceNode dagChildren last sequenceNode dagChildren first scope == ast scope.",
  2716. referencedClasses: ["Smalltalk"],
  2717. //>>excludeEnd("ide");
  2718. pragmas: [],
  2719. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "sequenceNode", "last"]
  2720. }, function ($methodClass){ return function (){
  2721. var self=this,$self=this;
  2722. var src,ast;
  2723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2724. return $core.withContext(function($ctx1) {
  2725. //>>excludeEnd("ctx");
  2726. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  2727. ast=$recv($globals.Smalltalk)._parse_(src);
  2728. $recv($self.analyzer)._visit_(ast);
  2729. $self._deny_($recv([$recv($recv([$recv([$recv($recv($recv($recv(ast)._sequenceNode())._dagChildren())._last())._sequenceNode()
  2730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2731. ,$ctx1.sendIdx["sequenceNode"]=1
  2732. //>>excludeEnd("ctx");
  2733. ][0])._dagChildren()
  2734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2735. ,$ctx1.sendIdx["dagChildren"]=1
  2736. //>>excludeEnd("ctx");
  2737. ][0])._first())._scope()
  2738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2739. ,$ctx1.sendIdx["scope"]=1
  2740. //>>excludeEnd("ctx");
  2741. ][0]).__eq_eq($recv(ast)._scope()));
  2742. return self;
  2743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2744. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast})});
  2745. //>>excludeEnd("ctx");
  2746. }; }),
  2747. $globals.SemanticAnalyzerTest);
  2748. $core.addMethod(
  2749. $core.method({
  2750. selector: "testScopeLevel",
  2751. protocol: "tests",
  2752. //>>excludeStart("ide", pragmas.excludeIdeData);
  2753. args: [],
  2754. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast sequenceNode dagChildren last sequenceNode dagChildren first scope scopeLevel equals: 3",
  2755. referencedClasses: ["Smalltalk"],
  2756. //>>excludeEnd("ide");
  2757. pragmas: [],
  2758. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "sequenceNode", "last"]
  2759. }, function ($methodClass){ return function (){
  2760. var self=this,$self=this;
  2761. var src,ast;
  2762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2763. return $core.withContext(function($ctx1) {
  2764. //>>excludeEnd("ctx");
  2765. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  2766. ast=$recv($globals.Smalltalk)._parse_(src);
  2767. $recv($self.analyzer)._visit_(ast);
  2768. [$self._assert_equals_([$recv([$recv(ast)._scope()
  2769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2770. ,$ctx1.sendIdx["scope"]=1
  2771. //>>excludeEnd("ctx");
  2772. ][0])._scopeLevel()
  2773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2774. ,$ctx1.sendIdx["scopeLevel"]=1
  2775. //>>excludeEnd("ctx");
  2776. ][0],(1))
  2777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2778. ,$ctx1.sendIdx["assert:equals:"]=1
  2779. //>>excludeEnd("ctx");
  2780. ][0];
  2781. $self._assert_equals_($recv($recv($recv([$recv([$recv($recv($recv($recv(ast)._sequenceNode())._dagChildren())._last())._sequenceNode()
  2782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2783. ,$ctx1.sendIdx["sequenceNode"]=1
  2784. //>>excludeEnd("ctx");
  2785. ][0])._dagChildren()
  2786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2787. ,$ctx1.sendIdx["dagChildren"]=1
  2788. //>>excludeEnd("ctx");
  2789. ][0])._first())._scope())._scopeLevel(),(3));
  2790. return self;
  2791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2792. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast})});
  2793. //>>excludeEnd("ctx");
  2794. }; }),
  2795. $globals.SemanticAnalyzerTest);
  2796. $core.addMethod(
  2797. $core.method({
  2798. selector: "testUnknownVariables",
  2799. protocol: "tests",
  2800. //>>excludeStart("ide", pragmas.excludeIdeData);
  2801. args: [],
  2802. source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  2803. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  2804. //>>excludeEnd("ide");
  2805. pragmas: [],
  2806. messageSends: ["parse:", "should:raise:", "visit:"]
  2807. }, function ($methodClass){ return function (){
  2808. var self=this,$self=this;
  2809. var src,ast;
  2810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2811. return $core.withContext(function($ctx1) {
  2812. //>>excludeEnd("ctx");
  2813. src="foo | a | b + a";
  2814. ast=$recv($globals.Smalltalk)._parse_(src);
  2815. $self._should_raise_((function(){
  2816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2817. return $core.withContext(function($ctx2) {
  2818. //>>excludeEnd("ctx");
  2819. return $recv($self.analyzer)._visit_(ast);
  2820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2822. //>>excludeEnd("ctx");
  2823. }),$globals.UnknownVariableError);
  2824. return self;
  2825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2826. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast})});
  2827. //>>excludeEnd("ctx");
  2828. }; }),
  2829. $globals.SemanticAnalyzerTest);
  2830. $core.addMethod(
  2831. $core.method({
  2832. selector: "testUnknownVariablesWithScope",
  2833. protocol: "tests",
  2834. //>>excludeStart("ide", pragmas.excludeIdeData);
  2835. args: [],
  2836. source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  2837. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  2838. //>>excludeEnd("ide");
  2839. pragmas: [],
  2840. messageSends: ["parse:", "should:raise:", "visit:"]
  2841. }, function ($methodClass){ return function (){
  2842. var self=this,$self=this;
  2843. var src,ast;
  2844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2845. return $core.withContext(function($ctx1) {
  2846. //>>excludeEnd("ctx");
  2847. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  2848. ast=$recv($globals.Smalltalk)._parse_(src);
  2849. $self._should_raise_((function(){
  2850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2851. return $core.withContext(function($ctx2) {
  2852. //>>excludeEnd("ctx");
  2853. return $recv($self.analyzer)._visit_(ast);
  2854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2856. //>>excludeEnd("ctx");
  2857. }),$globals.UnknownVariableError);
  2858. return self;
  2859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2860. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast})});
  2861. //>>excludeEnd("ctx");
  2862. }; }),
  2863. $globals.SemanticAnalyzerTest);
  2864. $core.addMethod(
  2865. $core.method({
  2866. selector: "testVariableShadowing",
  2867. protocol: "tests",
  2868. //>>excludeStart("ide", pragmas.excludeIdeData);
  2869. args: [],
  2870. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  2871. referencedClasses: ["Smalltalk"],
  2872. //>>excludeEnd("ide");
  2873. pragmas: [],
  2874. messageSends: ["parse:", "visit:"]
  2875. }, function ($methodClass){ return function (){
  2876. var self=this,$self=this;
  2877. var src,ast;
  2878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2879. return $core.withContext(function($ctx1) {
  2880. //>>excludeEnd("ctx");
  2881. src="foo | a | a + 1";
  2882. ast=$recv($globals.Smalltalk)._parse_(src);
  2883. $recv($self.analyzer)._visit_(ast);
  2884. return self;
  2885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2886. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast})});
  2887. //>>excludeEnd("ctx");
  2888. }; }),
  2889. $globals.SemanticAnalyzerTest);
  2890. $core.addMethod(
  2891. $core.method({
  2892. selector: "testVariableShadowing2",
  2893. protocol: "tests",
  2894. //>>excludeStart("ide", pragmas.excludeIdeData);
  2895. args: [],
  2896. source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  2897. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  2898. //>>excludeEnd("ide");
  2899. pragmas: [],
  2900. messageSends: ["parse:", "should:raise:", "visit:"]
  2901. }, function ($methodClass){ return function (){
  2902. var self=this,$self=this;
  2903. var src,ast;
  2904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2905. return $core.withContext(function($ctx1) {
  2906. //>>excludeEnd("ctx");
  2907. src="foo | a | a + 1. [ | a | a := 2 ]";
  2908. ast=$recv($globals.Smalltalk)._parse_(src);
  2909. $self._should_raise_((function(){
  2910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2911. return $core.withContext(function($ctx2) {
  2912. //>>excludeEnd("ctx");
  2913. return $recv($self.analyzer)._visit_(ast);
  2914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2916. //>>excludeEnd("ctx");
  2917. }),$globals.ShadowingVariableError);
  2918. return self;
  2919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2920. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast})});
  2921. //>>excludeEnd("ctx");
  2922. }; }),
  2923. $globals.SemanticAnalyzerTest);
  2924. $core.addMethod(
  2925. $core.method({
  2926. selector: "testVariableShadowing3",
  2927. protocol: "tests",
  2928. //>>excludeStart("ide", pragmas.excludeIdeData);
  2929. args: [],
  2930. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  2931. referencedClasses: ["Smalltalk"],
  2932. //>>excludeEnd("ide");
  2933. pragmas: [],
  2934. messageSends: ["parse:", "visit:"]
  2935. }, function ($methodClass){ return function (){
  2936. var self=this,$self=this;
  2937. var src,ast;
  2938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2939. return $core.withContext(function($ctx1) {
  2940. //>>excludeEnd("ctx");
  2941. src="foo | a | a + 1. [ | b | b := 2 ]";
  2942. ast=$recv($globals.Smalltalk)._parse_(src);
  2943. $recv($self.analyzer)._visit_(ast);
  2944. return self;
  2945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2946. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast})});
  2947. //>>excludeEnd("ctx");
  2948. }; }),
  2949. $globals.SemanticAnalyzerTest);
  2950. $core.addMethod(
  2951. $core.method({
  2952. selector: "testVariableShadowing4",
  2953. protocol: "tests",
  2954. //>>excludeStart("ide", pragmas.excludeIdeData);
  2955. args: [],
  2956. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  2957. referencedClasses: ["Smalltalk"],
  2958. //>>excludeEnd("ide");
  2959. pragmas: [],
  2960. messageSends: ["parse:", "visit:"]
  2961. }, function ($methodClass){ return function (){
  2962. var self=this,$self=this;
  2963. var src,ast;
  2964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2965. return $core.withContext(function($ctx1) {
  2966. //>>excludeEnd("ctx");
  2967. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  2968. ast=$recv($globals.Smalltalk)._parse_(src);
  2969. $recv($self.analyzer)._visit_(ast);
  2970. return self;
  2971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2972. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast})});
  2973. //>>excludeEnd("ctx");
  2974. }; }),
  2975. $globals.SemanticAnalyzerTest);
  2976. $core.addMethod(
  2977. $core.method({
  2978. selector: "testVariableShadowing5",
  2979. protocol: "tests",
  2980. //>>excludeStart("ide", pragmas.excludeIdeData);
  2981. args: [],
  2982. source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  2983. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  2984. //>>excludeEnd("ide");
  2985. pragmas: [],
  2986. messageSends: ["parse:", "should:raise:", "visit:"]
  2987. }, function ($methodClass){ return function (){
  2988. var self=this,$self=this;
  2989. var src,ast;
  2990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2991. return $core.withContext(function($ctx1) {
  2992. //>>excludeEnd("ctx");
  2993. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  2994. ast=$recv($globals.Smalltalk)._parse_(src);
  2995. $self._should_raise_((function(){
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. return $core.withContext(function($ctx2) {
  2998. //>>excludeEnd("ctx");
  2999. return $recv($self.analyzer)._visit_(ast);
  3000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3002. //>>excludeEnd("ctx");
  3003. }),$globals.ShadowingVariableError);
  3004. return self;
  3005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3006. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast})});
  3007. //>>excludeEnd("ctx");
  3008. }; }),
  3009. $globals.SemanticAnalyzerTest);
  3010. $core.addMethod(
  3011. $core.method({
  3012. selector: "testVariablesLookup",
  3013. protocol: "tests",
  3014. //>>excludeStart("ide", pragmas.excludeIdeData);
  3015. args: [],
  3016. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast sequenceNode dagChildren first receiver binding isTempVar.\x0a\x09self assert: ast sequenceNode dagChildren first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast sequenceNode dagChildren last sequenceNode dagChildren first left binding isTempVar.\x0a\x09self assert: ast sequenceNode dagChildren last sequenceNode dagChildren first left binding scope == ast sequenceNode dagChildren last scope.",
  3017. referencedClasses: ["Smalltalk"],
  3018. //>>excludeEnd("ide");
  3019. pragmas: [],
  3020. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "sequenceNode", "==", "scope", "left", "last"]
  3021. }, function ($methodClass){ return function (){
  3022. var self=this,$self=this;
  3023. var src,ast;
  3024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3025. return $core.withContext(function($ctx1) {
  3026. //>>excludeEnd("ctx");
  3027. src="foo | a | a + 1. [ | b | b := a ]";
  3028. ast=$recv($globals.Smalltalk)._parse_(src);
  3029. $recv($self.analyzer)._visit_(ast);
  3030. [$self._assert_([$recv([$recv([$recv([$recv([$recv([$recv(ast)._sequenceNode()
  3031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3032. ,$ctx1.sendIdx["sequenceNode"]=1
  3033. //>>excludeEnd("ctx");
  3034. ][0])._dagChildren()
  3035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3036. ,$ctx1.sendIdx["dagChildren"]=1
  3037. //>>excludeEnd("ctx");
  3038. ][0])._first()
  3039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3040. ,$ctx1.sendIdx["first"]=1
  3041. //>>excludeEnd("ctx");
  3042. ][0])._receiver()
  3043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3044. ,$ctx1.sendIdx["receiver"]=1
  3045. //>>excludeEnd("ctx");
  3046. ][0])._binding()
  3047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3048. ,$ctx1.sendIdx["binding"]=1
  3049. //>>excludeEnd("ctx");
  3050. ][0])._isTempVar()
  3051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3052. ,$ctx1.sendIdx["isTempVar"]=1
  3053. //>>excludeEnd("ctx");
  3054. ][0])
  3055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3056. ,$ctx1.sendIdx["assert:"]=1
  3057. //>>excludeEnd("ctx");
  3058. ][0];
  3059. [$self._assert_([$recv([$recv([$recv($recv([$recv([$recv([$recv(ast)._sequenceNode()
  3060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3061. ,$ctx1.sendIdx["sequenceNode"]=2
  3062. //>>excludeEnd("ctx");
  3063. ][0])._dagChildren()
  3064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3065. ,$ctx1.sendIdx["dagChildren"]=2
  3066. //>>excludeEnd("ctx");
  3067. ][0])._first()
  3068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3069. ,$ctx1.sendIdx["first"]=2
  3070. //>>excludeEnd("ctx");
  3071. ][0])._receiver())._binding()
  3072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3073. ,$ctx1.sendIdx["binding"]=2
  3074. //>>excludeEnd("ctx");
  3075. ][0])._scope()
  3076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3077. ,$ctx1.sendIdx["scope"]=1
  3078. //>>excludeEnd("ctx");
  3079. ][0]).__eq_eq([$recv(ast)._scope()
  3080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3081. ,$ctx1.sendIdx["scope"]=2
  3082. //>>excludeEnd("ctx");
  3083. ][0])
  3084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3085. ,$ctx1.sendIdx["=="]=1
  3086. //>>excludeEnd("ctx");
  3087. ][0])
  3088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3089. ,$ctx1.sendIdx["assert:"]=2
  3090. //>>excludeEnd("ctx");
  3091. ][0];
  3092. [$self._assert_($recv([$recv([$recv([$recv([$recv([$recv([$recv([$recv([$recv(ast)._sequenceNode()
  3093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3094. ,$ctx1.sendIdx["sequenceNode"]=4
  3095. //>>excludeEnd("ctx");
  3096. ][0])._dagChildren()
  3097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3098. ,$ctx1.sendIdx["dagChildren"]=4
  3099. //>>excludeEnd("ctx");
  3100. ][0])._last()
  3101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3102. ,$ctx1.sendIdx["last"]=1
  3103. //>>excludeEnd("ctx");
  3104. ][0])._sequenceNode()
  3105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3106. ,$ctx1.sendIdx["sequenceNode"]=3
  3107. //>>excludeEnd("ctx");
  3108. ][0])._dagChildren()
  3109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3110. ,$ctx1.sendIdx["dagChildren"]=3
  3111. //>>excludeEnd("ctx");
  3112. ][0])._first()
  3113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3114. ,$ctx1.sendIdx["first"]=3
  3115. //>>excludeEnd("ctx");
  3116. ][0])._left()
  3117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3118. ,$ctx1.sendIdx["left"]=1
  3119. //>>excludeEnd("ctx");
  3120. ][0])._binding()
  3121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3122. ,$ctx1.sendIdx["binding"]=3
  3123. //>>excludeEnd("ctx");
  3124. ][0])._isTempVar())
  3125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3126. ,$ctx1.sendIdx["assert:"]=3
  3127. //>>excludeEnd("ctx");
  3128. ][0];
  3129. $self._assert_($recv([$recv($recv($recv($recv([$recv([$recv([$recv([$recv([$recv(ast)._sequenceNode()
  3130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3131. ,$ctx1.sendIdx["sequenceNode"]=6
  3132. //>>excludeEnd("ctx");
  3133. ][0])._dagChildren()
  3134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3135. ,$ctx1.sendIdx["dagChildren"]=6
  3136. //>>excludeEnd("ctx");
  3137. ][0])._last()
  3138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3139. ,$ctx1.sendIdx["last"]=2
  3140. //>>excludeEnd("ctx");
  3141. ][0])._sequenceNode()
  3142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3143. ,$ctx1.sendIdx["sequenceNode"]=5
  3144. //>>excludeEnd("ctx");
  3145. ][0])._dagChildren()
  3146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3147. ,$ctx1.sendIdx["dagChildren"]=5
  3148. //>>excludeEnd("ctx");
  3149. ][0])._first())._left())._binding())._scope()
  3150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3151. ,$ctx1.sendIdx["scope"]=3
  3152. //>>excludeEnd("ctx");
  3153. ][0]).__eq_eq($recv($recv($recv($recv(ast)._sequenceNode())._dagChildren())._last())._scope()));
  3154. return self;
  3155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3156. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast})});
  3157. //>>excludeEnd("ctx");
  3158. }; }),
  3159. $globals.SemanticAnalyzerTest);
  3160. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  3161. $core.addMethod(
  3162. $core.method({
  3163. selector: "setUp",
  3164. protocol: "running",
  3165. //>>excludeStart("ide", pragmas.excludeIdeData);
  3166. args: [],
  3167. source: "setUp\x0a\x09analyzer := (AISemanticAnalyzer on: Object)\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09defineLocal: 'local';\x0a\x09\x09\x09localAt: 'local' put: 3;\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  3168. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  3169. //>>excludeEnd("ide");
  3170. pragmas: [],
  3171. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  3172. }, function ($methodClass){ return function (){
  3173. var self=this,$self=this;
  3174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3175. return $core.withContext(function($ctx1) {
  3176. //>>excludeEnd("ctx");
  3177. var $1,$3,$2;
  3178. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  3179. $3=$recv($globals.AIContext)._new();
  3180. $recv($3)._defineLocal_("local");
  3181. $recv($3)._localAt_put_("local",(3));
  3182. $2=[$recv($3)._yourself()
  3183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3184. ,$ctx1.sendIdx["yourself"]=1
  3185. //>>excludeEnd("ctx");
  3186. ][0];
  3187. $recv($1)._context_($2);
  3188. $self.analyzer=$recv($1)._yourself();
  3189. return self;
  3190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3191. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  3192. //>>excludeEnd("ctx");
  3193. }; }),
  3194. $globals.AISemanticAnalyzerTest);
  3195. $core.addMethod(
  3196. $core.method({
  3197. selector: "testContextVariables",
  3198. protocol: "tests",
  3199. //>>excludeStart("ide", pragmas.excludeIdeData);
  3200. args: [],
  3201. source: "testContextVariables\x0a\x09| src ast |\x0a\x09\x0a\x09src := 'foo | a | local + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError",
  3202. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  3203. //>>excludeEnd("ide");
  3204. pragmas: [],
  3205. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  3206. }, function ($methodClass){ return function (){
  3207. var self=this,$self=this;
  3208. var src,ast;
  3209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3210. return $core.withContext(function($ctx1) {
  3211. //>>excludeEnd("ctx");
  3212. src="foo | a | local + a";
  3213. ast=$recv($globals.Smalltalk)._parse_(src);
  3214. $self._shouldnt_raise_((function(){
  3215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3216. return $core.withContext(function($ctx2) {
  3217. //>>excludeEnd("ctx");
  3218. return $recv($self.analyzer)._visit_(ast);
  3219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3221. //>>excludeEnd("ctx");
  3222. }),$globals.UnknownVariableError);
  3223. return self;
  3224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3225. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast})});
  3226. //>>excludeEnd("ctx");
  3227. }; }),
  3228. $globals.AISemanticAnalyzerTest);
  3229. $core.addTrait("TASTCompilingTest", "Compiler-Tests");
  3230. $core.addMethod(
  3231. $core.method({
  3232. selector: "codeGeneratorClass",
  3233. protocol: "accessing",
  3234. //>>excludeStart("ide", pragmas.excludeIdeData);
  3235. args: [],
  3236. source: "codeGeneratorClass\x0a\x09self subclassResponsibility",
  3237. referencedClasses: [],
  3238. //>>excludeEnd("ide");
  3239. pragmas: [],
  3240. messageSends: ["subclassResponsibility"]
  3241. }, function ($methodClass){ return function (){
  3242. var self=this,$self=this;
  3243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3244. return $core.withContext(function($ctx1) {
  3245. //>>excludeEnd("ctx");
  3246. $self._subclassResponsibility();
  3247. return self;
  3248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3249. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{})});
  3250. //>>excludeEnd("ctx");
  3251. }; }),
  3252. $globals.TASTCompilingTest);
  3253. $core.addMethod(
  3254. $core.method({
  3255. selector: "compiler",
  3256. protocol: "factory",
  3257. //>>excludeStart("ide", pragmas.excludeIdeData);
  3258. args: [],
  3259. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  3260. referencedClasses: ["Compiler"],
  3261. //>>excludeEnd("ide");
  3262. pragmas: [],
  3263. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  3264. }, function ($methodClass){ return function (){
  3265. var self=this,$self=this;
  3266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3267. return $core.withContext(function($ctx1) {
  3268. //>>excludeEnd("ctx");
  3269. var $1;
  3270. $1=$recv($globals.Compiler)._new();
  3271. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  3272. return $recv($1)._yourself();
  3273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3274. }, function($ctx1) {$ctx1.fill(self,"compiler",{})});
  3275. //>>excludeEnd("ctx");
  3276. }; }),
  3277. $globals.TASTCompilingTest);
  3278. $core.addMethod(
  3279. $core.method({
  3280. selector: "install:forClass:",
  3281. protocol: "compiling",
  3282. //>>excludeStart("ide", pragmas.excludeIdeData);
  3283. args: ["aString", "aClass"],
  3284. source: "install: aString forClass: aClass\x0a\x09^ self compiler\x0a\x09\x09install: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'tests'",
  3285. referencedClasses: [],
  3286. //>>excludeEnd("ide");
  3287. pragmas: [],
  3288. messageSends: ["install:forClass:protocol:", "compiler"]
  3289. }, function ($methodClass){ return function (aString,aClass){
  3290. var self=this,$self=this;
  3291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3292. return $core.withContext(function($ctx1) {
  3293. //>>excludeEnd("ctx");
  3294. return $recv($self._compiler())._install_forClass_protocol_(aString,aClass,"tests");
  3295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3296. }, function($ctx1) {$ctx1.fill(self,"install:forClass:",{aString:aString,aClass:aClass})});
  3297. //>>excludeEnd("ctx");
  3298. }; }),
  3299. $globals.TASTCompilingTest);
  3300. $core.addMethod(
  3301. $core.method({
  3302. selector: "while:inClass:should:",
  3303. protocol: "testing",
  3304. //>>excludeStart("ide", pragmas.excludeIdeData);
  3305. args: ["aString", "aClass", "aBlock"],
  3306. source: "while: aString inClass: aClass should: aBlock\x0a\x09| method |\x0a\x0a\x09[\x0a\x09\x09method := self install: aString forClass: aClass.\x0a\x09\x09aBlock value: method ]\x0a\x09ensure: [ method ifNotNil: [ aClass removeCompiledMethod: method ] ]",
  3307. referencedClasses: [],
  3308. //>>excludeEnd("ide");
  3309. pragmas: [],
  3310. messageSends: ["ensure:", "install:forClass:", "value:", "ifNotNil:", "removeCompiledMethod:"]
  3311. }, function ($methodClass){ return function (aString,aClass,aBlock){
  3312. var self=this,$self=this;
  3313. var method;
  3314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3315. return $core.withContext(function($ctx1) {
  3316. //>>excludeEnd("ctx");
  3317. var $1,$receiver;
  3318. $recv((function(){
  3319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3320. return $core.withContext(function($ctx2) {
  3321. //>>excludeEnd("ctx");
  3322. method=$self._install_forClass_(aString,aClass);
  3323. return $recv(aBlock)._value_(method);
  3324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3326. //>>excludeEnd("ctx");
  3327. }))._ensure_((function(){
  3328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3329. return $core.withContext(function($ctx2) {
  3330. //>>excludeEnd("ctx");
  3331. $1=method;
  3332. if(($receiver = $1) == null || $receiver.a$nil){
  3333. return $1;
  3334. } else {
  3335. return $recv(aClass)._removeCompiledMethod_(method);
  3336. }
  3337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3339. //>>excludeEnd("ctx");
  3340. }));
  3341. return self;
  3342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3343. }, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock,method:method})});
  3344. //>>excludeEnd("ctx");
  3345. }; }),
  3346. $globals.TASTCompilingTest);
  3347. $core.addMethod(
  3348. $core.method({
  3349. selector: "while:should:",
  3350. protocol: "testing",
  3351. //>>excludeStart("ide", pragmas.excludeIdeData);
  3352. args: ["aString", "aBlock"],
  3353. source: "while: aString should: aBlock\x0a\x09self while: aString inClass: self receiver class should: aBlock",
  3354. referencedClasses: [],
  3355. //>>excludeEnd("ide");
  3356. pragmas: [],
  3357. messageSends: ["while:inClass:should:", "class", "receiver"]
  3358. }, function ($methodClass){ return function (aString,aBlock){
  3359. var self=this,$self=this;
  3360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3361. return $core.withContext(function($ctx1) {
  3362. //>>excludeEnd("ctx");
  3363. $self._while_inClass_should_(aString,$recv($self._receiver())._class(),aBlock);
  3364. return self;
  3365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3366. }, function($ctx1) {$ctx1.fill(self,"while:should:",{aString:aString,aBlock:aBlock})});
  3367. //>>excludeEnd("ctx");
  3368. }; }),
  3369. $globals.TASTCompilingTest);
  3370. $core.addTrait("TASTParsingTest", "Compiler-Tests");
  3371. $core.addMethod(
  3372. $core.method({
  3373. selector: "parse:forClass:",
  3374. protocol: "parsing",
  3375. //>>excludeStart("ide", pragmas.excludeIdeData);
  3376. args: ["aString", "aClass"],
  3377. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  3378. referencedClasses: ["Compiler"],
  3379. //>>excludeEnd("ide");
  3380. pragmas: [],
  3381. messageSends: ["ast:forClass:protocol:", "new"]
  3382. }, function ($methodClass){ return function (aString,aClass){
  3383. var self=this,$self=this;
  3384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3385. return $core.withContext(function($ctx1) {
  3386. //>>excludeEnd("ctx");
  3387. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  3388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3389. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass})});
  3390. //>>excludeEnd("ctx");
  3391. }; }),
  3392. $globals.TASTParsingTest);
  3393. $core.addTrait("TCTDebugged", "Compiler-Tests");
  3394. $core.addMethod(
  3395. $core.method({
  3396. selector: "interpret:forClass:receiver:withArguments:",
  3397. protocol: "private",
  3398. //>>excludeStart("ide", pragmas.excludeIdeData);
  3399. args: ["aString", "aClass", "anObject", "aDictionary"],
  3400. source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ (ASTDebugger context: ctx) proceed; result",
  3401. referencedClasses: ["ASTDebugger"],
  3402. //>>excludeEnd("ide");
  3403. pragmas: [],
  3404. messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "context:", "result"]
  3405. }, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
  3406. var self=this,$self=this;
  3407. var ctx;
  3408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3409. return $core.withContext(function($ctx1) {
  3410. //>>excludeEnd("ctx");
  3411. var $1;
  3412. ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
  3413. $1=$recv($globals.ASTDebugger)._context_(ctx);
  3414. $recv($1)._proceed();
  3415. return $recv($1)._result();
  3416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3417. }, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
  3418. //>>excludeEnd("ctx");
  3419. }; }),
  3420. $globals.TCTDebugged);
  3421. $core.addTrait("TCTExecuted", "Compiler-Tests");
  3422. $core.addMethod(
  3423. $core.method({
  3424. selector: "while:inClass:should:",
  3425. protocol: "testing",
  3426. //>>excludeStart("ide", pragmas.excludeIdeData);
  3427. args: ["aString", "aClass", "aBlock"],
  3428. source: "while: aString inClass: aClass should: aBlock\x0a\x09super\x0a\x09\x09while: aString\x0a\x09\x09inClass: aClass\x0a\x09\x09should: [ :method | aBlock value: [\x0a\x09\x09\x09self receiver perform: method selector ] ]",
  3429. referencedClasses: [],
  3430. //>>excludeEnd("ide");
  3431. pragmas: [],
  3432. messageSends: ["while:inClass:should:", "value:", "perform:", "receiver", "selector"]
  3433. }, function ($methodClass){ return function (aString,aClass,aBlock){
  3434. var self=this,$self=this;
  3435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3436. return $core.withContext(function($ctx1) {
  3437. //>>excludeEnd("ctx");
  3438. [(
  3439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3440. $ctx1.supercall = true,
  3441. //>>excludeEnd("ctx");
  3442. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._while_inClass_should_.call($self,aString,aClass,(function(method){
  3443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3444. return $core.withContext(function($ctx2) {
  3445. //>>excludeEnd("ctx");
  3446. return $recv(aBlock)._value_((function(){
  3447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3448. return $core.withContext(function($ctx3) {
  3449. //>>excludeEnd("ctx");
  3450. return $recv($self._receiver())._perform_($recv(method)._selector());
  3451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3452. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  3453. //>>excludeEnd("ctx");
  3454. }));
  3455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3456. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  3457. //>>excludeEnd("ctx");
  3458. })))
  3459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3460. ,$ctx1.supercall = false
  3461. //>>excludeEnd("ctx");
  3462. ][0];
  3463. return self;
  3464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3465. }, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock})});
  3466. //>>excludeEnd("ctx");
  3467. }; }),
  3468. $globals.TCTExecuted);
  3469. $core.addTrait("TCTInlined", "Compiler-Tests");
  3470. $core.addMethod(
  3471. $core.method({
  3472. selector: "codeGeneratorClass",
  3473. protocol: "accessing",
  3474. //>>excludeStart("ide", pragmas.excludeIdeData);
  3475. args: [],
  3476. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  3477. referencedClasses: ["InliningCodeGenerator"],
  3478. //>>excludeEnd("ide");
  3479. pragmas: [],
  3480. messageSends: []
  3481. }, function ($methodClass){ return function (){
  3482. var self=this,$self=this;
  3483. return $globals.InliningCodeGenerator;
  3484. }; }),
  3485. $globals.TCTInlined);
  3486. $core.addTrait("TCTInterpreted", "Compiler-Tests");
  3487. $core.addMethod(
  3488. $core.method({
  3489. selector: "interpret:forClass:receiver:withArguments:",
  3490. protocol: "private",
  3491. //>>excludeStart("ide", pragmas.excludeIdeData);
  3492. args: ["aString", "aClass", "anObject", "aDictionary"],
  3493. source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ ctx interpreter proceed; result",
  3494. referencedClasses: [],
  3495. //>>excludeEnd("ide");
  3496. pragmas: [],
  3497. messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "interpreter", "result"]
  3498. }, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
  3499. var self=this,$self=this;
  3500. var ctx;
  3501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3502. return $core.withContext(function($ctx1) {
  3503. //>>excludeEnd("ctx");
  3504. var $1;
  3505. ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
  3506. $1=$recv(ctx)._interpreter();
  3507. $recv($1)._proceed();
  3508. return $recv($1)._result();
  3509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3510. }, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
  3511. //>>excludeEnd("ctx");
  3512. }; }),
  3513. $globals.TCTInterpreted);
  3514. $core.addMethod(
  3515. $core.method({
  3516. selector: "prepareContextFor:class:receiver:withArguments:",
  3517. protocol: "private",
  3518. //>>excludeStart("ide", pragmas.excludeIdeData);
  3519. args: ["aString", "aClass", "anObject", "aDictionary"],
  3520. source: "prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast |\x0a\x09\x0a\x09ast := self parse: aString forClass: aClass.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09selector: ast selector;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09ctx interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode.\x0a\x09\x0a\x09^ctx",
  3521. referencedClasses: ["AIContext", "ASTInterpreter"],
  3522. //>>excludeEnd("ide");
  3523. pragmas: [],
  3524. messageSends: ["parse:forClass:", "receiver:", "new", "selector:", "selector", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode"]
  3525. }, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
  3526. var self=this,$self=this;
  3527. var ctx,ast;
  3528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3529. return $core.withContext(function($ctx1) {
  3530. //>>excludeEnd("ctx");
  3531. var $1,$2,$3,$receiver;
  3532. ast=$self._parse_forClass_(aString,aClass);
  3533. $1=[$recv($globals.AIContext)._new()
  3534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3535. ,$ctx1.sendIdx["new"]=1
  3536. //>>excludeEnd("ctx");
  3537. ][0];
  3538. $recv($1)._receiver_(anObject);
  3539. $recv($1)._selector_($recv(ast)._selector());
  3540. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  3541. ctx=$recv($1)._yourself();
  3542. $2=$recv(ast)._sequenceNode();
  3543. if(($receiver = $2) == null || $receiver.a$nil){
  3544. $2;
  3545. } else {
  3546. var sequence;
  3547. sequence=$receiver;
  3548. $recv($recv(sequence)._temps())._do_((function(each){
  3549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3550. return $core.withContext(function($ctx2) {
  3551. //>>excludeEnd("ctx");
  3552. return $recv(ctx)._defineLocal_(each);
  3553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3554. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3555. //>>excludeEnd("ctx");
  3556. }));
  3557. }
  3558. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  3559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3560. return $core.withContext(function($ctx2) {
  3561. //>>excludeEnd("ctx");
  3562. return $recv(ctx)._localAt_put_(key,value);
  3563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3564. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  3565. //>>excludeEnd("ctx");
  3566. }));
  3567. $3=$recv(ctx)._interpreter();
  3568. $recv($3)._context_(ctx);
  3569. $recv($3)._node_(ast);
  3570. $recv($3)._enterNode();
  3571. return ctx;
  3572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3573. }, function($ctx1) {$ctx1.fill(self,"prepareContextFor:class:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast})});
  3574. //>>excludeEnd("ctx");
  3575. }; }),
  3576. $globals.TCTInterpreted);
  3577. $core.addMethod(
  3578. $core.method({
  3579. selector: "while:inClass:should:",
  3580. protocol: "testing",
  3581. //>>excludeStart("ide", pragmas.excludeIdeData);
  3582. args: ["aString", "aClass", "aBlock"],
  3583. source: "while: aString inClass: aClass should: aBlock\x0a\x09super\x0a\x09\x09while: aString\x0a\x09\x09inClass: aClass\x0a\x09\x09should: [ aBlock value: [\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09interpret: aString\x0a\x09\x09\x09\x09forClass: aClass\x0a\x09\x09\x09\x09receiver: self receiver\x0a\x09\x09\x09\x09withArguments: #{} ] ]",
  3584. referencedClasses: [],
  3585. //>>excludeEnd("ide");
  3586. pragmas: [],
  3587. messageSends: ["while:inClass:should:", "value:", "interpret:forClass:receiver:withArguments:", "receiver"]
  3588. }, function ($methodClass){ return function (aString,aClass,aBlock){
  3589. var self=this,$self=this;
  3590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3591. return $core.withContext(function($ctx1) {
  3592. //>>excludeEnd("ctx");
  3593. [(
  3594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3595. $ctx1.supercall = true,
  3596. //>>excludeEnd("ctx");
  3597. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._while_inClass_should_.call($self,aString,aClass,(function(){
  3598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3599. return $core.withContext(function($ctx2) {
  3600. //>>excludeEnd("ctx");
  3601. return $recv(aBlock)._value_((function(){
  3602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3603. return $core.withContext(function($ctx3) {
  3604. //>>excludeEnd("ctx");
  3605. return $self._interpret_forClass_receiver_withArguments_(aString,aClass,$self._receiver(),$globals.HashedCollection._newFromPairs_([]));
  3606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3607. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  3608. //>>excludeEnd("ctx");
  3609. }));
  3610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3612. //>>excludeEnd("ctx");
  3613. })))
  3614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3615. ,$ctx1.supercall = false
  3616. //>>excludeEnd("ctx");
  3617. ][0];
  3618. return self;
  3619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3620. }, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock})});
  3621. //>>excludeEnd("ctx");
  3622. }; }),
  3623. $globals.TCTInterpreted);
  3624. $core.addTrait("TCTNonInlined", "Compiler-Tests");
  3625. $core.addMethod(
  3626. $core.method({
  3627. selector: "codeGeneratorClass",
  3628. protocol: "accessing",
  3629. //>>excludeStart("ide", pragmas.excludeIdeData);
  3630. args: [],
  3631. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  3632. referencedClasses: ["CodeGenerator"],
  3633. //>>excludeEnd("ide");
  3634. pragmas: [],
  3635. messageSends: []
  3636. }, function ($methodClass){ return function (){
  3637. var self=this,$self=this;
  3638. return $globals.CodeGenerator;
  3639. }; }),
  3640. $globals.TCTNonInlined);
  3641. $core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.TASTCompilingTest);
  3642. $core.setTraitComposition([{trait: $globals.TCTInterpreted}], $globals.TCTDebugged);
  3643. $core.setTraitComposition([{trait: $globals.TASTCompilingTest}], $globals.ASTMethodRunningTest);
  3644. $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTDebugged}], $globals.ASTDebuggerTest);
  3645. $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTInterpreted}], $globals.ASTInterpreterTest);
  3646. $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTExecuted}], $globals.CodeGeneratorTest);
  3647. $core.setTraitComposition([{trait: $globals.TCTInlined}, {trait: $globals.TCTExecuted}], $globals.InliningCodeGeneratorTest);
  3648. $core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.ASTPCNodeVisitorTest);
  3649. $core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.ASTPositionTest);
  3650. $core.setTraitComposition([{trait: $globals.TASTCompilingTest}], $globals.AbstractCodeGeneratorInstallTest);
  3651. $core.setTraitComposition([{trait: $globals.TCTNonInlined}], $globals.CodeGeneratorInstallTest);
  3652. $core.setTraitComposition([{trait: $globals.TCTInlined}], $globals.InliningCodeGeneratorInstallTest);
  3653. });