compiler.js 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106
  1. smalltalk.addClass('Node', smalltalk.Object, ['nodes'], 'Compiler');
  2. smalltalk.addMethod(
  3. '_nodes',
  4. smalltalk.method({
  5. selector: 'nodes',
  6. category: 'accessing',
  7. fn: function (){
  8. var self=this;
  9. return self['@nodes']._ifNil_((function(){return self['@nodes']=smalltalk.Array._new();}));
  10. return self;},
  11. source: unescape('nodes%0A%09%5Enodes%20ifNil%3A%20%5Bnodes%20%3A%3D%20Array%20new%5D%0A')}),
  12. smalltalk.Node);
  13. smalltalk.addMethod(
  14. '_nodes_',
  15. smalltalk.method({
  16. selector: 'nodes:',
  17. category: 'building',
  18. fn: function (aCollection){
  19. var self=this;
  20. self['@nodes']=aCollection;
  21. return self;},
  22. source: unescape('nodes%3A%20aCollection%0A%09nodes%20%3A%3D%20aCollection%0A')}),
  23. smalltalk.Node);
  24. smalltalk.addMethod(
  25. '_addNode_',
  26. smalltalk.method({
  27. selector: 'addNode:',
  28. category: 'accessing',
  29. fn: function (aNode){
  30. var self=this;
  31. self._nodes()._add_(aNode);
  32. return self;},
  33. source: unescape('addNode%3A%20aNode%0A%09self%20nodes%20add%3A%20aNode%0A')}),
  34. smalltalk.Node);
  35. smalltalk.addMethod(
  36. '_accept_',
  37. smalltalk.method({
  38. selector: 'accept:',
  39. category: 'visiting',
  40. fn: function (aVisitor){
  41. var self=this;
  42. aVisitor._visitNode_(self);
  43. return self;},
  44. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitNode%3A%20self%0A')}),
  45. smalltalk.Node);
  46. smalltalk.addClass('MethodNode', smalltalk.Node, ['selector', 'arguments', 'source'], 'Compiler');
  47. smalltalk.addMethod(
  48. '_selector',
  49. smalltalk.method({
  50. selector: 'selector',
  51. category: 'accessing',
  52. fn: function (){
  53. var self=this;
  54. return self['@selector'];
  55. return self;},
  56. source: unescape('selector%0A%09%5Eselector%0A')}),
  57. smalltalk.MethodNode);
  58. smalltalk.addMethod(
  59. '_selector_',
  60. smalltalk.method({
  61. selector: 'selector:',
  62. category: 'accessing',
  63. fn: function (aString){
  64. var self=this;
  65. self['@selector']=aString;
  66. return self;},
  67. source: unescape('selector%3A%20aString%0A%09selector%20%3A%3D%20aString%0A')}),
  68. smalltalk.MethodNode);
  69. smalltalk.addMethod(
  70. '_arguments',
  71. smalltalk.method({
  72. selector: 'arguments',
  73. category: 'accessing',
  74. fn: function (){
  75. var self=this;
  76. return self['@arguments']._ifNil_((function(){return [];}));
  77. return self;},
  78. source: unescape('arguments%0A%09%5Earguments%20ifNil%3A%20%5B%23%28%29%5D%0A')}),
  79. smalltalk.MethodNode);
  80. smalltalk.addMethod(
  81. '_arguments_',
  82. smalltalk.method({
  83. selector: 'arguments:',
  84. category: 'accessing',
  85. fn: function (aCollection){
  86. var self=this;
  87. self['@arguments']=aCollection;
  88. return self;},
  89. source: unescape('arguments%3A%20aCollection%0A%09arguments%20%3A%3D%20aCollection%0A')}),
  90. smalltalk.MethodNode);
  91. smalltalk.addMethod(
  92. '_source',
  93. smalltalk.method({
  94. selector: 'source',
  95. category: 'accessing',
  96. fn: function (){
  97. var self=this;
  98. return self['@source'];
  99. return self;},
  100. source: unescape('source%0A%09%5Esource%0A')}),
  101. smalltalk.MethodNode);
  102. smalltalk.addMethod(
  103. '_source_',
  104. smalltalk.method({
  105. selector: 'source:',
  106. category: 'accessing',
  107. fn: function (aString){
  108. var self=this;
  109. self['@source']=aString;
  110. return self;},
  111. source: unescape('source%3A%20aString%0A%09source%20%3A%3D%20aString%0A')}),
  112. smalltalk.MethodNode);
  113. smalltalk.addMethod(
  114. '_accept_',
  115. smalltalk.method({
  116. selector: 'accept:',
  117. category: 'visiting',
  118. fn: function (aVisitor){
  119. var self=this;
  120. aVisitor._visitMethodNode_(self);
  121. return self;},
  122. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitMethodNode%3A%20self%0A')}),
  123. smalltalk.MethodNode);
  124. smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver'], 'Compiler');
  125. smalltalk.addMethod(
  126. '_selector',
  127. smalltalk.method({
  128. selector: 'selector',
  129. category: 'accessing',
  130. fn: function (){
  131. var self=this;
  132. return self['@selector'];
  133. return self;},
  134. source: unescape('selector%0A%09%5Eselector%0A')}),
  135. smalltalk.SendNode);
  136. smalltalk.addMethod(
  137. '_selector_',
  138. smalltalk.method({
  139. selector: 'selector:',
  140. category: 'accessing',
  141. fn: function (aString){
  142. var self=this;
  143. self['@selector']=aString;
  144. return self;},
  145. source: unescape('selector%3A%20aString%0A%09selector%20%3A%3D%20aString%0A')}),
  146. smalltalk.SendNode);
  147. smalltalk.addMethod(
  148. '_arguments',
  149. smalltalk.method({
  150. selector: 'arguments',
  151. category: 'accessing',
  152. fn: function (){
  153. var self=this;
  154. return self['@arguments']._ifNil_((function(){return self['@arguments']=[];}));
  155. return self;},
  156. source: unescape('arguments%0A%09%5Earguments%20ifNil%3A%20%5Barguments%20%3A%3D%20%23%28%29%5D%0A')}),
  157. smalltalk.SendNode);
  158. smalltalk.addMethod(
  159. '_arguments_',
  160. smalltalk.method({
  161. selector: 'arguments:',
  162. category: 'accessing',
  163. fn: function (aCollection){
  164. var self=this;
  165. self['@arguments']=aCollection;
  166. return self;},
  167. source: unescape('arguments%3A%20aCollection%0A%09arguments%20%3A%3D%20aCollection%0A')}),
  168. smalltalk.SendNode);
  169. smalltalk.addMethod(
  170. '_receiver',
  171. smalltalk.method({
  172. selector: 'receiver',
  173. category: 'accessing',
  174. fn: function (){
  175. var self=this;
  176. return self['@receiver'];
  177. return self;},
  178. source: unescape('receiver%0A%09%5Ereceiver%0A')}),
  179. smalltalk.SendNode);
  180. smalltalk.addMethod(
  181. '_receiver_',
  182. smalltalk.method({
  183. selector: 'receiver:',
  184. category: 'accessing',
  185. fn: function (aNode){
  186. var self=this;
  187. self['@receiver']=aNode;
  188. return self;},
  189. source: unescape('receiver%3A%20aNode%0A%09receiver%20%3A%3D%20aNode%0A')}),
  190. smalltalk.SendNode);
  191. smalltalk.addMethod(
  192. '_valueForReceiver_',
  193. smalltalk.method({
  194. selector: 'valueForReceiver:',
  195. category: 'accessing',
  196. fn: function (anObject){
  197. var self=this;
  198. return (function($rec){$rec._receiver_(self._receiver()._ifNil_ifNotNil_((function(){return anObject;}),(function(){return self._receiver()._valueForReceiver_(anObject);})));$rec._selector_(self._selector());$rec._arguments_(self._arguments());return $rec._yourself();})(smalltalk.SendNode._new());
  199. return self;},
  200. source: unescape('valueForReceiver%3A%20anObject%0A%09%5ESendNode%20new%0A%09%20%20%20%20receiver%3A%20%28self%20receiver%20%0A%09%09ifNil%3A%20%5BanObject%5D%0A%09%09ifNotNil%3A%20%5Bself%20receiver%20valueForReceiver%3A%20anObject%5D%29%3B%0A%09%20%20%20%20selector%3A%20self%20selector%3B%0A%09%20%20%20%20arguments%3A%20self%20arguments%3B%0A%09%20%20%20%20yourself%0A')}),
  201. smalltalk.SendNode);
  202. smalltalk.addMethod(
  203. '_cascadeNodeWithMessages_',
  204. smalltalk.method({
  205. selector: 'cascadeNodeWithMessages:',
  206. category: 'accessing',
  207. fn: function (aCollection){
  208. var self=this;
  209. var first=nil;
  210. first=(function($rec){$rec._selector_(self._selector());$rec._arguments_(self._arguments());return $rec._yourself();})(smalltalk.SendNode._new());
  211. return (function($rec){$rec._receiver_(self._receiver());$rec._nodes_(smalltalk.Array._with_(first).__comma(aCollection));return $rec._yourself();})(smalltalk.CascadeNode._new());
  212. return self;},
  213. source: unescape('cascadeNodeWithMessages%3A%20aCollection%0A%09%7C%20first%20%7C%0A%09first%20%3A%3D%20SendNode%20new%0A%09%20%20%20%20selector%3A%20self%20selector%3B%0A%09%20%20%20%20arguments%3A%20self%20arguments%3B%0A%09%20%20%20%20yourself.%0A%09%5ECascadeNode%20new%0A%09%20%20%20%20receiver%3A%20self%20receiver%3B%0A%09%20%20%20%20nodes%3A%20%28Array%20with%3A%20first%29%2C%20aCollection%3B%0A%09%20%20%20%20yourself%0A')}),
  214. smalltalk.SendNode);
  215. smalltalk.addMethod(
  216. '_accept_',
  217. smalltalk.method({
  218. selector: 'accept:',
  219. category: 'visiting',
  220. fn: function (aVisitor){
  221. var self=this;
  222. aVisitor._visitSendNode_(self);
  223. return self;},
  224. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitSendNode%3A%20self%0A')}),
  225. smalltalk.SendNode);
  226. smalltalk.addClass('CascadeNode', smalltalk.Node, ['receiver'], 'Compiler');
  227. smalltalk.addMethod(
  228. '_receiver',
  229. smalltalk.method({
  230. selector: 'receiver',
  231. category: 'accessing',
  232. fn: function (){
  233. var self=this;
  234. return self['@receiver'];
  235. return self;},
  236. source: unescape('receiver%0A%09%5Ereceiver%0A')}),
  237. smalltalk.CascadeNode);
  238. smalltalk.addMethod(
  239. '_receiver_',
  240. smalltalk.method({
  241. selector: 'receiver:',
  242. category: 'accessing',
  243. fn: function (aNode){
  244. var self=this;
  245. self['@receiver']=aNode;
  246. return self;},
  247. source: unescape('receiver%3A%20aNode%0A%09receiver%20%3A%3D%20aNode%0A')}),
  248. smalltalk.CascadeNode);
  249. smalltalk.addMethod(
  250. '_accept_',
  251. smalltalk.method({
  252. selector: 'accept:',
  253. category: 'visiting',
  254. fn: function (aVisitor){
  255. var self=this;
  256. aVisitor._visitCascadeNode_(self);
  257. return self;},
  258. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitCascadeNode%3A%20self%0A')}),
  259. smalltalk.CascadeNode);
  260. smalltalk.addClass('AssignmentNode', smalltalk.Node, ['left', 'right'], 'Compiler');
  261. smalltalk.addMethod(
  262. '_left',
  263. smalltalk.method({
  264. selector: 'left',
  265. category: 'accessing',
  266. fn: function (){
  267. var self=this;
  268. return self['@left'];
  269. return self;},
  270. source: unescape('left%0A%09%5Eleft%0A')}),
  271. smalltalk.AssignmentNode);
  272. smalltalk.addMethod(
  273. '_left_',
  274. smalltalk.method({
  275. selector: 'left:',
  276. category: 'accessing',
  277. fn: function (aNode){
  278. var self=this;
  279. self['@left']=aNode;
  280. return self;},
  281. source: unescape('left%3A%20aNode%0A%09left%20%3A%3D%20aNode%0A')}),
  282. smalltalk.AssignmentNode);
  283. smalltalk.addMethod(
  284. '_right',
  285. smalltalk.method({
  286. selector: 'right',
  287. category: 'accessing',
  288. fn: function (){
  289. var self=this;
  290. return self['@right'];
  291. return self;},
  292. source: unescape('right%0A%09%5Eright%0A')}),
  293. smalltalk.AssignmentNode);
  294. smalltalk.addMethod(
  295. '_right_',
  296. smalltalk.method({
  297. selector: 'right:',
  298. category: 'accessing',
  299. fn: function (aNode){
  300. var self=this;
  301. self['@right']=aNode;
  302. return self;},
  303. source: unescape('right%3A%20aNode%0A%09right%20%3A%3D%20aNode%0A')}),
  304. smalltalk.AssignmentNode);
  305. smalltalk.addMethod(
  306. '_accept_',
  307. smalltalk.method({
  308. selector: 'accept:',
  309. category: 'visiting',
  310. fn: function (aVisitor){
  311. var self=this;
  312. aVisitor._visitAssignmentNode_(self);
  313. return self;},
  314. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitAssignmentNode%3A%20self%0A')}),
  315. smalltalk.AssignmentNode);
  316. smalltalk.addClass('BlockNode', smalltalk.Node, ['parameters'], 'Compiler');
  317. smalltalk.addMethod(
  318. '_parameters',
  319. smalltalk.method({
  320. selector: 'parameters',
  321. category: 'accessing',
  322. fn: function (){
  323. var self=this;
  324. return self['@parameters']._ifNil_((function(){return self['@parameters']=smalltalk.Array._new();}));
  325. return self;},
  326. source: unescape('parameters%0A%09%5Eparameters%20ifNil%3A%20%5Bparameters%20%3A%3D%20Array%20new%5D%0A')}),
  327. smalltalk.BlockNode);
  328. smalltalk.addMethod(
  329. '_parameters_',
  330. smalltalk.method({
  331. selector: 'parameters:',
  332. category: 'accessing',
  333. fn: function (aCollection){
  334. var self=this;
  335. self['@parameters']=aCollection;
  336. return self;},
  337. source: unescape('parameters%3A%20aCollection%0A%09parameters%20%3A%3D%20aCollection%0A')}),
  338. smalltalk.BlockNode);
  339. smalltalk.addMethod(
  340. '_accept_',
  341. smalltalk.method({
  342. selector: 'accept:',
  343. category: 'visiting',
  344. fn: function (aVisitor){
  345. var self=this;
  346. aVisitor._visitBlockNode_(self);
  347. return self;},
  348. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitBlockNode%3A%20self%0A')}),
  349. smalltalk.BlockNode);
  350. smalltalk.addClass('SequenceNode', smalltalk.Node, ['temps'], 'Compiler');
  351. smalltalk.addMethod(
  352. '_temps',
  353. smalltalk.method({
  354. selector: 'temps',
  355. category: 'accessing',
  356. fn: function (){
  357. var self=this;
  358. return self['@temps']._ifNil_((function(){return [];}));
  359. return self;},
  360. source: unescape('temps%0A%09%5Etemps%20ifNil%3A%20%5B%23%28%29%5D%0A')}),
  361. smalltalk.SequenceNode);
  362. smalltalk.addMethod(
  363. '_temps_',
  364. smalltalk.method({
  365. selector: 'temps:',
  366. category: 'accessing',
  367. fn: function (aCollection){
  368. var self=this;
  369. self['@temps']=aCollection;
  370. return self;},
  371. source: unescape('temps%3A%20aCollection%0A%09temps%20%3A%3D%20aCollection%0A')}),
  372. smalltalk.SequenceNode);
  373. smalltalk.addMethod(
  374. '_asBlockSequenceNode',
  375. smalltalk.method({
  376. selector: 'asBlockSequenceNode',
  377. category: 'testing',
  378. fn: function (){
  379. var self=this;
  380. return (function($rec){$rec._nodes_(self._nodes());$rec._temps_(self._temps());return $rec._yourself();})(smalltalk.BlockSequenceNode._new());
  381. return self;},
  382. source: unescape('asBlockSequenceNode%0A%09%5EBlockSequenceNode%20new%0A%09%20%20%20%20nodes%3A%20self%20nodes%3B%0A%09%20%20%20%20temps%3A%20self%20temps%3B%0A%09%20%20%20%20yourself%0A')}),
  383. smalltalk.SequenceNode);
  384. smalltalk.addMethod(
  385. '_accept_',
  386. smalltalk.method({
  387. selector: 'accept:',
  388. category: 'visiting',
  389. fn: function (aVisitor){
  390. var self=this;
  391. aVisitor._visitSequenceNode_(self);
  392. return self;},
  393. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitSequenceNode%3A%20self%0A')}),
  394. smalltalk.SequenceNode);
  395. smalltalk.addClass('BlockSequenceNode', smalltalk.SequenceNode, [], 'Compiler');
  396. smalltalk.addMethod(
  397. '_accept_',
  398. smalltalk.method({
  399. selector: 'accept:',
  400. category: 'visiting',
  401. fn: function (aVisitor){
  402. var self=this;
  403. aVisitor._visitBlockSequenceNode_(self);
  404. return self;},
  405. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitBlockSequenceNode%3A%20self%0A')}),
  406. smalltalk.BlockSequenceNode);
  407. smalltalk.addClass('ReturnNode', smalltalk.Node, [], 'Compiler');
  408. smalltalk.addMethod(
  409. '_accept_',
  410. smalltalk.method({
  411. selector: 'accept:',
  412. category: 'visiting',
  413. fn: function (aVisitor){
  414. var self=this;
  415. aVisitor._visitReturnNode_(self);
  416. return self;},
  417. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitReturnNode%3A%20self%0A')}),
  418. smalltalk.ReturnNode);
  419. smalltalk.addClass('ValueNode', smalltalk.Node, ['value'], 'Compiler');
  420. smalltalk.addMethod(
  421. '_value',
  422. smalltalk.method({
  423. selector: 'value',
  424. category: 'accessing',
  425. fn: function (){
  426. var self=this;
  427. return self['@value'];
  428. return self;},
  429. source: unescape('value%0A%09%5Evalue%0A')}),
  430. smalltalk.ValueNode);
  431. smalltalk.addMethod(
  432. '_value_',
  433. smalltalk.method({
  434. selector: 'value:',
  435. category: 'accessing',
  436. fn: function (anObject){
  437. var self=this;
  438. self['@value']=anObject;
  439. return self;},
  440. source: unescape('value%3A%20anObject%0A%09value%20%3A%3D%20anObject%0A')}),
  441. smalltalk.ValueNode);
  442. smalltalk.addMethod(
  443. '_accept_',
  444. smalltalk.method({
  445. selector: 'accept:',
  446. category: 'visiting',
  447. fn: function (aVisitor){
  448. var self=this;
  449. aVisitor._visitValueNode_(self);
  450. return self;},
  451. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitValueNode%3A%20self%0A')}),
  452. smalltalk.ValueNode);
  453. smalltalk.addClass('VariableNode', smalltalk.ValueNode, [], 'Compiler');
  454. smalltalk.addMethod(
  455. '_accept_',
  456. smalltalk.method({
  457. selector: 'accept:',
  458. category: 'visiting',
  459. fn: function (aVisitor){
  460. var self=this;
  461. aVisitor._visitVariableNode_(self);
  462. return self;},
  463. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitVariableNode%3A%20self%0A')}),
  464. smalltalk.VariableNode);
  465. smalltalk.addClass('ClassReferenceNode', smalltalk.VariableNode, [], 'Compiler');
  466. smalltalk.addMethod(
  467. '_accept_',
  468. smalltalk.method({
  469. selector: 'accept:',
  470. category: 'visiting',
  471. fn: function (aVisitor){
  472. var self=this;
  473. aVisitor._visitClassReferenceNode_(self);
  474. return self;},
  475. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitClassReferenceNode%3A%20self%0A')}),
  476. smalltalk.ClassReferenceNode);
  477. smalltalk.addClass('JSStatementNode', smalltalk.Node, ['source'], 'Compiler');
  478. smalltalk.addMethod(
  479. '_source',
  480. smalltalk.method({
  481. selector: 'source',
  482. category: 'accessing',
  483. fn: function (){
  484. var self=this;
  485. return self['@source']._ifNil_((function(){return "";}));
  486. return self;},
  487. source: unescape('source%0A%09%5Esource%20ifNil%3A%20%5B%27%27%5D%0A')}),
  488. smalltalk.JSStatementNode);
  489. smalltalk.addMethod(
  490. '_source_',
  491. smalltalk.method({
  492. selector: 'source:',
  493. category: 'accessing',
  494. fn: function (aString){
  495. var self=this;
  496. self['@source']=aString;
  497. return self;},
  498. source: unescape('source%3A%20aString%0A%09source%20%3A%3D%20aString%0A')}),
  499. smalltalk.JSStatementNode);
  500. smalltalk.addMethod(
  501. '_accept_',
  502. smalltalk.method({
  503. selector: 'accept:',
  504. category: 'visiting',
  505. fn: function (aVisitor){
  506. var self=this;
  507. aVisitor._visitJSStatementNode_(self);
  508. return self;},
  509. source: unescape('accept%3A%20aVisitor%0A%09aVisitor%20visitJSStatementNode%3A%20self%0A')}),
  510. smalltalk.JSStatementNode);
  511. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler');
  512. smalltalk.addMethod(
  513. '_visit_',
  514. smalltalk.method({
  515. selector: 'visit:',
  516. category: 'visiting',
  517. fn: function (aNode){
  518. var self=this;
  519. aNode._accept_(self);
  520. return self;},
  521. source: unescape('visit%3A%20aNode%0A%09aNode%20accept%3A%20self%0A')}),
  522. smalltalk.NodeVisitor);
  523. smalltalk.addMethod(
  524. '_visitNode_',
  525. smalltalk.method({
  526. selector: 'visitNode:',
  527. category: 'visiting',
  528. fn: function (aNode){
  529. var self=this;
  530. return self;},
  531. source: unescape('visitNode%3A%20aNode%0A')}),
  532. smalltalk.NodeVisitor);
  533. smalltalk.addMethod(
  534. '_visitMethodNode_',
  535. smalltalk.method({
  536. selector: 'visitMethodNode:',
  537. category: 'visiting',
  538. fn: function (aNode){
  539. var self=this;
  540. self._visitNode_(aNode);
  541. return self;},
  542. source: unescape('visitMethodNode%3A%20aNode%0A%09self%20visitNode%3A%20aNode%0A')}),
  543. smalltalk.NodeVisitor);
  544. smalltalk.addMethod(
  545. '_visitSequenceNode_',
  546. smalltalk.method({
  547. selector: 'visitSequenceNode:',
  548. category: 'visiting',
  549. fn: function (aNode){
  550. var self=this;
  551. self._visitNode_(aNode);
  552. return self;},
  553. source: unescape('visitSequenceNode%3A%20aNode%0A%09self%20visitNode%3A%20aNode%0A')}),
  554. smalltalk.NodeVisitor);
  555. smalltalk.addMethod(
  556. '_visitBlockSequenceNode_',
  557. smalltalk.method({
  558. selector: 'visitBlockSequenceNode:',
  559. category: 'visiting',
  560. fn: function (aNode){
  561. var self=this;
  562. self._visitSequenceNode_(aNode);
  563. return self;},
  564. source: unescape('visitBlockSequenceNode%3A%20aNode%0A%09self%20visitSequenceNode%3A%20aNode%0A')}),
  565. smalltalk.NodeVisitor);
  566. smalltalk.addMethod(
  567. '_visitBlockNode_',
  568. smalltalk.method({
  569. selector: 'visitBlockNode:',
  570. category: 'visiting',
  571. fn: function (aNode){
  572. var self=this;
  573. self._visitNode_(aNode);
  574. return self;},
  575. source: unescape('visitBlockNode%3A%20aNode%0A%09self%20visitNode%3A%20aNode%0A')}),
  576. smalltalk.NodeVisitor);
  577. smalltalk.addMethod(
  578. '_visitReturnNode_',
  579. smalltalk.method({
  580. selector: 'visitReturnNode:',
  581. category: 'visiting',
  582. fn: function (aNode){
  583. var self=this;
  584. self._visitNode_(aNode);
  585. return self;},
  586. source: unescape('visitReturnNode%3A%20aNode%0A%09self%20visitNode%3A%20aNode%0A')}),
  587. smalltalk.NodeVisitor);
  588. smalltalk.addMethod(
  589. '_visitSendNode_',
  590. smalltalk.method({
  591. selector: 'visitSendNode:',
  592. category: 'visiting',
  593. fn: function (aNode){
  594. var self=this;
  595. self._visitNode_(aNode);
  596. return self;},
  597. source: unescape('visitSendNode%3A%20aNode%0A%09self%20visitNode%3A%20aNode%0A')}),
  598. smalltalk.NodeVisitor);
  599. smalltalk.addMethod(
  600. '_visitCascadeNode_',
  601. smalltalk.method({
  602. selector: 'visitCascadeNode:',
  603. category: 'visiting',
  604. fn: function (aNode){
  605. var self=this;
  606. self._visitNode_(aNode);
  607. return self;},
  608. source: unescape('visitCascadeNode%3A%20aNode%0A%09self%20visitNode%3A%20aNode%0A')}),
  609. smalltalk.NodeVisitor);
  610. smalltalk.addMethod(
  611. '_visitValueNode_',
  612. smalltalk.method({
  613. selector: 'visitValueNode:',
  614. category: 'visiting',
  615. fn: function (aNode){
  616. var self=this;
  617. self._visitNode_(aNode);
  618. return self;},
  619. source: unescape('visitValueNode%3A%20aNode%0A%09self%20visitNode%3A%20aNode%0A')}),
  620. smalltalk.NodeVisitor);
  621. smalltalk.addMethod(
  622. '_visitVariableNode_',
  623. smalltalk.method({
  624. selector: 'visitVariableNode:',
  625. category: 'visiting',
  626. fn: function (aNode){
  627. var self=this;
  628. return self;},
  629. source: unescape('visitVariableNode%3A%20aNode%0A')}),
  630. smalltalk.NodeVisitor);
  631. smalltalk.addMethod(
  632. '_visitAssignmentNode_',
  633. smalltalk.method({
  634. selector: 'visitAssignmentNode:',
  635. category: 'visiting',
  636. fn: function (aNode){
  637. var self=this;
  638. self._visitNode_(aNode);
  639. return self;},
  640. source: unescape('visitAssignmentNode%3A%20aNode%0A%09self%20visitNode%3A%20aNode%0A')}),
  641. smalltalk.NodeVisitor);
  642. smalltalk.addMethod(
  643. '_visitClassReferenceNode_',
  644. smalltalk.method({
  645. selector: 'visitClassReferenceNode:',
  646. category: 'visiting',
  647. fn: function (aNode){
  648. var self=this;
  649. (function($rec){$rec._nextPutAll_("smalltalk.");return $rec._nextPutAll_(aNode._value());})(self);
  650. return self;},
  651. source: unescape('visitClassReferenceNode%3A%20aNode%0A%09self%20%0A%09%20%20%20%20nextPutAll%3A%20%27smalltalk.%27%3B%0A%09%20%20%20%20nextPutAll%3A%20aNode%20value%0A')}),
  652. smalltalk.NodeVisitor);
  653. smalltalk.addMethod(
  654. '_visitJSStatementNode_',
  655. smalltalk.method({
  656. selector: 'visitJSStatementNode:',
  657. category: 'visiting',
  658. fn: function (aNode){
  659. var self=this;
  660. (function($rec){$rec._nextPutAll_(unescape("function%28%29%7B"));$rec._nextPutAll_(aNode._source());return $rec._nextPutAll_(unescape("%7D%29%28%29"));})(self);
  661. return self;},
  662. source: unescape('visitJSStatementNode%3A%20aNode%0A%09self%20%0A%09%20%20%20%20nextPutAll%3A%20%27function%28%29%7B%27%3B%0A%09%20%20%20%20nextPutAll%3A%20aNode%20source%3B%0A%09%20%20%20%20nextPutAll%3A%20%27%7D%29%28%29%27%0A')}),
  663. smalltalk.NodeVisitor);
  664. smalltalk.addClass('Compiler', smalltalk.NodeVisitor, ['stream', 'nestedBlocks', 'earlyReturn', 'currentClass', 'currentSelector'], 'Compiler');
  665. smalltalk.addMethod(
  666. '_initialize',
  667. smalltalk.method({
  668. selector: 'initialize',
  669. category: 'initialization',
  670. fn: function (){
  671. var self=this;
  672. self.klass.superclass.fn.prototype['_initialize'].apply(self, []);
  673. self['@stream']=""._writeStream();
  674. return self;},
  675. source: unescape('initialize%0A%09super%20initialize.%0A%09stream%20%3A%3D%20%27%27%20writeStream%0A')}),
  676. smalltalk.Compiler);
  677. smalltalk.addMethod(
  678. '_parser',
  679. smalltalk.method({
  680. selector: 'parser',
  681. category: 'accessing',
  682. fn: function (){
  683. var self=this;
  684. return smalltalk.SmalltalkParser._new();
  685. return self;},
  686. source: unescape('parser%0A%09%5ESmalltalkParser%20new%0A')}),
  687. smalltalk.Compiler);
  688. smalltalk.addMethod(
  689. '_currentClass',
  690. smalltalk.method({
  691. selector: 'currentClass',
  692. category: 'accessing',
  693. fn: function (){
  694. var self=this;
  695. return self['@currentClass'];
  696. return self;},
  697. source: unescape('currentClass%0A%09%5EcurrentClass%0A')}),
  698. smalltalk.Compiler);
  699. smalltalk.addMethod(
  700. '_currentClass_',
  701. smalltalk.method({
  702. selector: 'currentClass:',
  703. category: 'accessing',
  704. fn: function (aClass){
  705. var self=this;
  706. self['@currentClass']=aClass;
  707. return self;},
  708. source: unescape('currentClass%3A%20aClass%0A%09currentClass%20%3A%3D%20aClass%0A')}),
  709. smalltalk.Compiler);
  710. smalltalk.addMethod(
  711. '_loadExpression_',
  712. smalltalk.method({
  713. selector: 'loadExpression:',
  714. category: 'compiling',
  715. fn: function (aString){
  716. var self=this;
  717. smalltalk.DoIt._addCompiledMethod_(self._eval_(self._compileExpression_(aString)));
  718. return smalltalk.DoIt._new()._doIt();
  719. return self;},
  720. source: unescape('loadExpression%3A%20aString%0A%09DoIt%20addCompiledMethod%3A%20%28self%20eval%3A%20%28self%20compileExpression%3A%20aString%29%29.%0A%09%5EDoIt%20new%20doIt%0A')}),
  721. smalltalk.Compiler);
  722. smalltalk.addMethod(
  723. '_load_forClass_',
  724. smalltalk.method({
  725. selector: 'load:forClass:',
  726. category: 'compiling',
  727. fn: function (aString, aClass){
  728. var self=this;
  729. return self._eval_(self._compile_forClass_(aString,aClass));
  730. return self;},
  731. source: unescape('load%3A%20aString%20forClass%3A%20aClass%0A%09%5Eself%20eval%3A%20%28self%20compile%3A%20aString%20forClass%3A%20aClass%29%0A')}),
  732. smalltalk.Compiler);
  733. smalltalk.addMethod(
  734. '_compile_forClass_',
  735. smalltalk.method({
  736. selector: 'compile:forClass:',
  737. category: 'compiling',
  738. fn: function (aString, aClass){
  739. var self=this;
  740. self._currentClass_(aClass);
  741. return self._compile_(aString);
  742. return self;},
  743. source: unescape('compile%3A%20aString%20forClass%3A%20aClass%0A%09self%20currentClass%3A%20aClass.%0A%09%5Eself%20compile%3A%20aString%0A')}),
  744. smalltalk.Compiler);
  745. smalltalk.addMethod(
  746. '_compileExpression_',
  747. smalltalk.method({
  748. selector: 'compileExpression:',
  749. category: 'compiling',
  750. fn: function (aString){
  751. var self=this;
  752. self._currentClass_(smalltalk.DoIt);
  753. return self._compile_(unescape("doIt%20%5E%5B").__comma(aString).__comma(unescape("%5D%20value")));
  754. return self;},
  755. source: unescape('compileExpression%3A%20aString%0A%09self%20currentClass%3A%20DoIt.%0A%09%5Eself%20compile%3A%20%27doIt%20%5E%5B%27%2C%20aString%2C%20%27%5D%20value%27%0A')}),
  756. smalltalk.Compiler);
  757. smalltalk.addMethod(
  758. '_eval_',
  759. smalltalk.method({
  760. selector: 'eval:',
  761. category: 'compiling',
  762. fn: function (aString){
  763. var self=this;
  764. return (function(){return eval(aString);})();
  765. return self;},
  766. source: unescape('eval%3A%20aString%0A%09%5E%7B%27return%20eval%28aString%29%3B%27%7D%0A')}),
  767. smalltalk.Compiler);
  768. smalltalk.addMethod(
  769. '_compile_',
  770. smalltalk.method({
  771. selector: 'compile:',
  772. category: 'compiling',
  773. fn: function (aString){
  774. var self=this;
  775. return self._compileNode_(self._parser()._parse_(aString._readStream()));
  776. return self;},
  777. source: unescape('compile%3A%20aString%0A%09%5Eself%20compileNode%3A%20%28self%20parser%20parse%3A%20aString%20readStream%29%0A')}),
  778. smalltalk.Compiler);
  779. smalltalk.addMethod(
  780. '_compileNode_',
  781. smalltalk.method({
  782. selector: 'compileNode:',
  783. category: 'compiling',
  784. fn: function (aNode){
  785. var self=this;
  786. self['@stream']=""._writeStream();
  787. self._visit_(aNode);
  788. return self['@stream']._contents();
  789. return self;},
  790. source: unescape('compileNode%3A%20aNode%0A%09stream%20%3A%3D%20%27%27%20writeStream.%0A%09self%20visit%3A%20aNode.%0A%09%5Estream%20contents%0A')}),
  791. smalltalk.Compiler);
  792. smalltalk.addMethod(
  793. '_visit_',
  794. smalltalk.method({
  795. selector: 'visit:',
  796. category: 'visiting',
  797. fn: function (aNode){
  798. var self=this;
  799. aNode._accept_(self);
  800. return self;},
  801. source: unescape('visit%3A%20aNode%0A%09aNode%20accept%3A%20self%0A')}),
  802. smalltalk.Compiler);
  803. smalltalk.addMethod(
  804. '_visitMethodNode_',
  805. smalltalk.method({
  806. selector: 'visitMethodNode:',
  807. category: 'visiting',
  808. fn: function (aNode){
  809. var self=this;
  810. var str=nil;
  811. var currentSelector=nil;
  812. self['@currentSelector']=aNode._selector()._asSelector();
  813. self['@nestedBlocks']=(0);
  814. self['@earlyReturn']=false;
  815. (function($rec){$rec._nextPutAll_(unescape("smalltalk.method%28%7B").__comma(smalltalk.String._cr()));$rec._nextPutAll_(unescape("selector%3A%20%22").__comma(aNode._selector()).__comma(unescape("%22%2C")).__comma(smalltalk.String._cr()));$rec._nextPutAll_(unescape("source%3A%20unescape%28%22").__comma(aNode._source()._escaped()).__comma(unescape("%22%29%2C")).__comma(smalltalk.String._cr()));return $rec._nextPutAll_(unescape("fn%3A%20function%28"));})(self['@stream']);
  816. aNode._arguments()._do_separatedBy_((function(each){return self['@stream']._nextPutAll_(each);}),(function(){return self['@stream']._nextPutAll_(unescape("%2C%20"));}));
  817. (function($rec){$rec._nextPutAll_(unescape("%29%7B").__comma(smalltalk.String._cr()));return $rec._nextPutAll_(unescape("var%20self%3Dthis%3B").__comma(smalltalk.String._cr()));})(self['@stream']);
  818. str=self['@stream'];
  819. self['@stream']=""._writeStream();
  820. aNode._nodes()._do_((function(each){return self._visit_(each);}));
  821. self['@earlyReturn']._ifTrue_((function(){return str._nextPutAll_(unescape("try%7B"));}));
  822. str._nextPutAll_(self['@stream']._contents());
  823. self['@stream']=str;
  824. (function($rec){$rec._nextPutAll_(smalltalk.String._cr());return $rec._nextPutAll_(unescape("return%20self%3B"));})(self['@stream']);
  825. self['@earlyReturn']._ifTrue_((function(){return self['@stream']._nextPutAll_(smalltalk.String._cr().__comma(unescape("%7D%20catch%28e%29%20%7Bif%28e.name%20%3D%3D%3D%20%27stReturn%27%20%26%26%20e.selector%20%3D%3D%3D%20")).__comma(self['@currentSelector']._printString()).__comma(unescape("%29%7Breturn%20e.fn%28%29%7D%20throw%28e%29%7D")));}));
  826. (function($rec){$rec._nextPutAll_(unescape("%7D").__comma(smalltalk.String._cr()));return $rec._nextPutAll_(unescape("%7D%29"));})(self['@stream']);
  827. return self;},
  828. source: unescape('visitMethodNode%3A%20aNode%0A%09%7C%20str%20currentSelector%20%7C%0A%09currentSelector%20%3A%3D%20aNode%20selector%20asSelector.%0A%09nestedBlocks%20%3A%3D%200.%0A%09earlyReturn%20%3A%3D%20false.%0A%09stream%20%0A%09%20%20%20%20nextPutAll%3A%20%27smalltalk.method%28%7B%27%2C%20String%20cr%3B%0A%09%20%20%20%20nextPutAll%3A%20%27selector%3A%20%22%27%2C%20aNode%20selector%2C%20%27%22%2C%27%2C%20String%20cr%3B%0A%09%20%20%20%20nextPutAll%3A%20%27source%3A%20unescape%28%22%27%2C%20aNode%20source%20escaped%2C%20%27%22%29%2C%27%2C%20String%20cr%3B%0A%09%20%20%20%20nextPutAll%3A%20%27fn%3A%20function%28%27.%0A%09aNode%20arguments%20%0A%09%20%20%20%20do%3A%20%5B%3Aeach%20%7C%20stream%20nextPutAll%3A%20each%5D%0A%09%20%20%20%20separatedBy%3A%20%5Bstream%20nextPutAll%3A%20%27%2C%20%27%5D.%0A%09stream%20%0A%09%20%20%20%20nextPutAll%3A%20%27%29%7B%27%2C%20String%20cr%3B%0A%09%20%20%20%20nextPutAll%3A%20%27var%20self%3Dthis%3B%27%2C%20String%20cr.%0A%09str%20%3A%3D%20stream.%0A%09stream%20%3A%3D%20%27%27%20writeStream.%0A%09aNode%20nodes%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20self%20visit%3A%20each%5D.%0A%09earlyReturn%20ifTrue%3A%20%5B%0A%09%20%20%20%20str%20nextPutAll%3A%20%27try%7B%27%5D.%0A%09str%20nextPutAll%3A%20stream%20contents.%0A%09stream%20%3A%3D%20str.%0A%09stream%20%0A%09%20%20%20%20nextPutAll%3A%20String%20cr%3B%20%0A%09%20%20%20%20nextPutAll%3A%20%27return%20self%3B%27.%0A%09earlyReturn%20ifTrue%3A%20%5B%0A%09%20%20%20%20stream%20nextPutAll%3A%20String%20cr%2C%20%27%7D%20catch%28e%29%20%7Bif%28e.name%20%3D%3D%3D%20%27%27stReturn%27%27%20%26%26%20e.selector%20%3D%3D%3D%20%27%2C%20currentSelector%20printString%2C%20%27%29%7Breturn%20e.fn%28%29%7D%20throw%28e%29%7D%27%5D.%0A%09stream%20%0A%09%20%20%20%20nextPutAll%3A%20%27%7D%27%2C%20String%20cr%3B%0A%09%20%20%20%20nextPutAll%3A%20%27%7D%29%27%0A')}),
  829. smalltalk.Compiler);
  830. smalltalk.addMethod(
  831. '_visitBlockNode_',
  832. smalltalk.method({
  833. selector: 'visitBlockNode:',
  834. category: 'visiting',
  835. fn: function (aNode){
  836. var self=this;
  837. self['@stream']._nextPutAll_(unescape("%28function%28"));
  838. aNode._parameters()._do_separatedBy_((function(each){return self['@stream']._nextPutAll_(each);}),(function(){return self['@stream']._nextPutAll_(unescape("%2C%20"));}));
  839. self['@stream']._nextPutAll_(unescape("%29%7B"));
  840. aNode._nodes()._do_((function(each){return self._visit_(each);}));
  841. self['@stream']._nextPutAll_(unescape("%7D%29"));
  842. return self;},
  843. source: unescape('visitBlockNode%3A%20aNode%0A%09stream%20nextPutAll%3A%20%27%28function%28%27.%0A%09aNode%20parameters%20%0A%09%20%20%20%20do%3A%20%5B%3Aeach%20%7C%0A%09%09stream%20nextPutAll%3A%20each%5D%0A%09%20%20%20%20separatedBy%3A%20%5Bstream%20nextPutAll%3A%20%27%2C%20%27%5D.%0A%09stream%20nextPutAll%3A%20%27%29%7B%27.%0A%09aNode%20nodes%20do%3A%20%5B%3Aeach%20%7C%20self%20visit%3A%20each%5D.%0A%09stream%20nextPutAll%3A%20%27%7D%29%27%0A')}),
  844. smalltalk.Compiler);
  845. smalltalk.addMethod(
  846. '_visitSequenceNode_',
  847. smalltalk.method({
  848. selector: 'visitSequenceNode:',
  849. category: 'visiting',
  850. fn: function (aNode){
  851. var self=this;
  852. aNode._temps()._do_((function(each){self['@stream']._nextPutAll_("var ".__comma(each).__comma(unescape("%3Dnil%3B")));return self['@stream']._nextPutAll_(smalltalk.String._cr());}));
  853. aNode._nodes()._do_separatedBy_((function(each){self._visit_(each);return self['@stream']._nextPutAll_(unescape("%3B"));}),(function(){return self['@stream']._nextPutAll_(smalltalk.String._cr());}));
  854. return self;},
  855. source: unescape('visitSequenceNode%3A%20aNode%0A%09aNode%20temps%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20stream%20nextPutAll%3A%20%27var%20%27%2C%20each%2C%20%27%3Dnil%3B%27.%0A%09%20%20%20%20stream%20nextPutAll%3A%20String%20cr%5D.%0A%09aNode%20nodes%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20self%20visit%3A%20each.%0A%09%20%20%20%20stream%20nextPutAll%3A%20%27%3B%27%5D%0A%09%20%20%20%20separatedBy%3A%20%5Bstream%20nextPutAll%3A%20String%20cr%5D%0A')}),
  856. smalltalk.Compiler);
  857. smalltalk.addMethod(
  858. '_visitBlockSequenceNode_',
  859. smalltalk.method({
  860. selector: 'visitBlockSequenceNode:',
  861. category: 'visiting',
  862. fn: function (aNode){
  863. var self=this;
  864. var index=nil;
  865. self['@nestedBlocks']=self['@nestedBlocks'].__plus((1));
  866. aNode._nodes()._isEmpty()._ifTrue_ifFalse_((function(){return self['@stream']._nextPutAll_(unescape("return%20nil%3B"));}),(function(){aNode._temps()._do_((function(each){self['@stream']._nextPutAll_("var ".__comma(each).__comma(unescape("%3Dnil%3B")));return self['@stream']._nextPutAll_(smalltalk.String._cr());}));index=(0);return aNode._nodes()._do_((function(each){index=index.__plus((1));index.__eq(aNode._nodes()._size())._ifTrue_((function(){return self['@stream']._nextPutAll_("return ");}));self._visit_(each);return self['@stream']._nextPutAll_(unescape("%3B"));}));}));
  867. self['@nestedBlocks']=self['@nestedBlocks'].__minus((1));
  868. return self;},
  869. source: unescape('visitBlockSequenceNode%3A%20aNode%0A%09%7C%20index%20%7C%0A%09nestedBlocks%20%3A%3D%20nestedBlocks%20+%201.%0A%09aNode%20nodes%20isEmpty%0A%09%20%20%20%20ifTrue%3A%20%5B%0A%09%09stream%20nextPutAll%3A%20%27return%20nil%3B%27%5D%0A%09%20%20%20%20ifFalse%3A%20%5B%0A%09%09aNode%20temps%20do%3A%20%5B%3Aeach%20%7C%0A%09%09%20%20%20%20stream%20nextPutAll%3A%20%27var%20%27%2C%20each%2C%20%27%3Dnil%3B%27.%0A%09%09%20%20%20%20stream%20nextPutAll%3A%20String%20cr%5D.%0A%09%09index%20%3A%3D%200.%0A%09%09aNode%20nodes%20do%3A%20%5B%3Aeach%20%7C%0A%09%09%20%20%20%20index%20%3A%3D%20index%20+%201.%0A%09%09%20%20%20%20index%20%3D%20aNode%20nodes%20size%20ifTrue%3A%20%5B%0A%09%09%09stream%20nextPutAll%3A%20%27return%20%27%5D.%0A%09%09%20%20%20%20self%20visit%3A%20each.%0A%09%09%20%20%20%20stream%20nextPutAll%3A%20%27%3B%27%5D%5D.%0A%09nestedBlocks%20%3A%3D%20nestedBlocks%20-%201%0A')}),
  870. smalltalk.Compiler);
  871. smalltalk.addMethod(
  872. '_visitReturnNode_',
  873. smalltalk.method({
  874. selector: 'visitReturnNode:',
  875. category: 'visiting',
  876. fn: function (aNode){
  877. var self=this;
  878. self['@nestedBlocks'].__gt((0))._ifTrue_((function(){return self['@earlyReturn']=true;}));
  879. self['@earlyReturn']._ifTrue_ifFalse_((function(){return (function($rec){$rec._nextPutAll_(unescape("%28function%28%29%7Bthrow%28"));$rec._nextPutAll_(unescape("%7Bname%3A%20%27stReturn%27%2C%20selector%3A%20"));$rec._nextPutAll_(self['@currentSelector']._printString());return $rec._nextPutAll_(unescape("%2C%20fn%3A%20function%28%29%7Breturn%20"));})(self['@stream']);}),(function(){return self['@stream']._nextPutAll_("return ");}));
  880. aNode._nodes()._do_((function(each){return self._visit_(each);}));
  881. self['@earlyReturn']._ifTrue_((function(){return self['@stream']._nextPutAll_(unescape("%7D%7D%29%7D%29%28%29"));}));
  882. return self;},
  883. source: unescape('visitReturnNode%3A%20aNode%0A%09nestedBlocks%20%3E%200%20ifTrue%3A%20%5B%0A%09%20%20%20%20earlyReturn%20%3A%3D%20true%5D.%0A%09earlyReturn%0A%09%20%20%20%20ifTrue%3A%20%5B%0A%09%09stream%0A%09%09%20%20%20%20nextPutAll%3A%20%27%28function%28%29%7Bthrow%28%27%3B%0A%09%09%20%20%20%20nextPutAll%3A%20%27%7Bname%3A%20%27%27stReturn%27%27%2C%20selector%3A%20%27%3B%0A%09%09%20%20%20%20nextPutAll%3A%20currentSelector%20printString%3B%0A%09%09%20%20%20%20nextPutAll%3A%20%27%2C%20fn%3A%20function%28%29%7Breturn%20%27%5D%0A%09%20%20%20%20ifFalse%3A%20%5Bstream%20nextPutAll%3A%20%27return%20%27%5D.%0A%09aNode%20nodes%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20self%20visit%3A%20each%5D.%0A%09earlyReturn%20ifTrue%3A%20%5B%0A%09%20%20%20%20stream%20nextPutAll%3A%20%27%7D%7D%29%7D%29%28%29%27%5D%0A')}),
  884. smalltalk.Compiler);
  885. smalltalk.addMethod(
  886. '_visitSendNode_',
  887. smalltalk.method({
  888. selector: 'visitSendNode:',
  889. category: 'visiting',
  890. fn: function (aNode){
  891. var self=this;
  892. var str=nil;
  893. str=self['@stream'];
  894. self['@stream']=""._writeStream();
  895. self._visit_(aNode._receiver());
  896. self['@stream']._contents().__eq("super")._ifTrue_ifFalse_((function(){self['@stream']=str;(function($rec){$rec._nextPutAll_(unescape("self.klass.superclass.fn.prototype%5B%27"));$rec._nextPutAll_(aNode._selector()._asSelector());return $rec._nextPutAll_(unescape("%27%5D.apply%28self%2C%20%5B"));})(self['@stream']);aNode._arguments()._do_separatedBy_((function(each){return self._visit_(each);}),(function(){return self['@stream']._nextPutAll_(unescape("%2C"));}));return self['@stream']._nextPutAll_(unescape("%5D%29"));}),(function(){str._nextPutAll_(self['@stream']._contents());self['@stream']=str;self['@stream']._nextPutAll_(".".__comma(aNode._selector()._asSelector()).__comma(unescape("%28")));aNode._arguments()._do_separatedBy_((function(each){return self._visit_(each);}),(function(){return self['@stream']._nextPutAll_(unescape("%2C"));}));return self['@stream']._nextPutAll_(unescape("%29"));}));
  897. return self;},
  898. source: unescape('visitSendNode%3A%20aNode%0A%09%7C%20str%20%7C%0A%09str%20%3A%3D%20stream.%0A%09stream%20%3A%3D%20%27%27%20writeStream.%0A%09self%20visit%3A%20aNode%20receiver.%0A%09stream%20contents%20%3D%20%27super%27%20%0A%09%20%20%20%20ifTrue%3A%20%5B%0A%09%09stream%20%3A%3D%20str.%0A%09%09stream%20%0A%09%09%20%20%20%20nextPutAll%3A%20%27self.klass.superclass.fn.prototype%5B%27%27%27%3B%0A%09%09%20%20%20%20nextPutAll%3A%20aNode%20selector%20asSelector%3B%0A%09%09%20%20%20%20nextPutAll%3A%20%27%27%27%5D.apply%28self%2C%20%5B%27.%0A%09%09aNode%20arguments%20%0A%09%09%20%20%20%20do%3A%20%5B%3Aeach%20%7C%20self%20visit%3A%20each%5D%0A%09%09%20%20%20%20separatedBy%3A%20%5Bstream%20nextPutAll%3A%20%27%2C%27%5D.%0A%09%09stream%20nextPutAll%3A%20%27%5D%29%27%5D%0A%09%20%20%20%20ifFalse%3A%20%5B%0A%09%09str%20nextPutAll%3A%20stream%20contents.%0A%09%09stream%20%3A%3D%20str.%0A%09%09stream%20nextPutAll%3A%20%27.%27%2C%20aNode%20selector%20asSelector%2C%20%27%28%27.%0A%09%09aNode%20arguments%20%0A%09%09%20%20%20%20do%3A%20%5B%3Aeach%20%7C%20self%20visit%3A%20each%5D%0A%09%09%20%20%20%20separatedBy%3A%20%5Bstream%20nextPutAll%3A%20%27%2C%27%5D.%0A%09%09stream%20nextPutAll%3A%20%27%29%27%5D%0A')}),
  899. smalltalk.Compiler);
  900. smalltalk.addMethod(
  901. '_visitCascadeNode_',
  902. smalltalk.method({
  903. selector: 'visitCascadeNode:',
  904. category: 'visiting',
  905. fn: function (aNode){
  906. var self=this;
  907. var index=nil;
  908. index=(0);
  909. self['@stream']._nextPutAll_(unescape("%28function%28%24rec%29%7B"));
  910. aNode._nodes()._do_((function(each){index=index.__plus((1));index.__eq(aNode._nodes()._size())._ifTrue_((function(){return self['@stream']._nextPutAll_("return ");}));each._receiver_(smalltalk.VariableNode._new()._value_("$rec"));self._visit_(each);return self['@stream']._nextPutAll_(unescape("%3B"));}));
  911. self['@stream']._nextPutAll_(unescape("%7D%29%28"));
  912. self._visit_(aNode._receiver());
  913. self['@stream']._nextPutAll_(unescape("%29"));
  914. return self;},
  915. source: unescape('visitCascadeNode%3A%20aNode%0A%09%7C%20index%20%7C%0A%09index%20%3A%3D%200.%0A%09stream%20nextPutAll%3A%20%27%28function%28%24rec%29%7B%27.%0A%09aNode%20nodes%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20index%20%3A%3D%20index%20+%201.%0A%09%20%20%20%20index%20%3D%20aNode%20nodes%20size%20ifTrue%3A%20%5B%0A%09%09stream%20nextPutAll%3A%20%27return%20%27%5D.%0A%09%20%20%20%20each%20receiver%3A%20%28VariableNode%20new%20value%3A%20%27%24rec%27%29.%0A%09%20%20%20%20self%20visit%3A%20each.%0A%09%20%20%20%20stream%20nextPutAll%3A%20%27%3B%27%5D.%0A%09stream%20nextPutAll%3A%20%27%7D%29%28%27.%0A%09self%20visit%3A%20aNode%20receiver.%0A%09stream%20nextPutAll%3A%20%27%29%27%0A')}),
  916. smalltalk.Compiler);
  917. smalltalk.addMethod(
  918. '_visitValueNode_',
  919. smalltalk.method({
  920. selector: 'visitValueNode:',
  921. category: 'visiting',
  922. fn: function (aNode){
  923. var self=this;
  924. self['@stream']._nextPutAll_(aNode._value()._asJavascript());
  925. return self;},
  926. source: unescape('visitValueNode%3A%20aNode%0A%09stream%20nextPutAll%3A%20aNode%20value%20asJavascript%0A')}),
  927. smalltalk.Compiler);
  928. smalltalk.addMethod(
  929. '_visitAssignmentNode_',
  930. smalltalk.method({
  931. selector: 'visitAssignmentNode:',
  932. category: 'visiting',
  933. fn: function (aNode){
  934. var self=this;
  935. self._visit_(aNode._left());
  936. self['@stream']._nextPutAll_(unescape("%3D"));
  937. self._visit_(aNode._right());
  938. return self;},
  939. source: unescape('visitAssignmentNode%3A%20aNode%0A%09self%20visit%3A%20aNode%20left.%0A%09stream%20nextPutAll%3A%20%27%3D%27.%0A%09self%20visit%3A%20aNode%20right%0A')}),
  940. smalltalk.Compiler);
  941. smalltalk.addMethod(
  942. '_visitClassReferenceNode_',
  943. smalltalk.method({
  944. selector: 'visitClassReferenceNode:',
  945. category: 'visiting',
  946. fn: function (aNode){
  947. var self=this;
  948. (function($rec){$rec._nextPutAll_("smalltalk.");return $rec._nextPutAll_(aNode._value());})(self['@stream']);
  949. return self;},
  950. source: unescape('visitClassReferenceNode%3A%20aNode%0A%09stream%0A%09%20%20%20%20nextPutAll%3A%20%27smalltalk.%27%3B%0A%09%20%20%20%20nextPutAll%3A%20aNode%20value%0A')}),
  951. smalltalk.Compiler);
  952. smalltalk.addMethod(
  953. '_visitVariableNode_',
  954. smalltalk.method({
  955. selector: 'visitVariableNode:',
  956. category: 'visiting',
  957. fn: function (aNode){
  958. var self=this;
  959. self._currentClass()._instVarNames()._includes_(aNode._value())._ifTrue_ifFalse_((function(){return self['@stream']._nextPutAll_(unescape("self%5B%27@").__comma(aNode._value()).__comma(unescape("%27%5D")));}),(function(){return self['@stream']._nextPutAll_(aNode._value());}));
  960. return self;},
  961. source: unescape('visitVariableNode%3A%20aNode%0A%09%28self%20currentClass%20instVarNames%20includes%3A%20aNode%20value%29%20%0A%09%20%20%20%20ifTrue%3A%20%5Bstream%20nextPutAll%3A%20%27self%5B%27%27@%27%2C%20aNode%20value%2C%20%27%27%27%5D%27%5D%0A%09%20%20%20%20ifFalse%3A%20%5Bstream%20nextPutAll%3A%20aNode%20value%5D%0A')}),
  962. smalltalk.Compiler);
  963. smalltalk.addMethod(
  964. '_visitJSStatementNode_',
  965. smalltalk.method({
  966. selector: 'visitJSStatementNode:',
  967. category: 'visiting',
  968. fn: function (aNode){
  969. var self=this;
  970. self['@stream']._nextPutAll_(unescape("%28function%28%29%7B"));
  971. self['@stream']._nextPutAll_(aNode._source()._value()._replace_with_(unescape("%27%27"),unescape("%27")));
  972. self['@stream']._nextPutAll_(unescape("%7D%29%28%29"));
  973. return self;},
  974. source: unescape('visitJSStatementNode%3A%20aNode%0A%09stream%20nextPutAll%3A%20%27%28function%28%29%7B%27.%0A%09stream%20nextPutAll%3A%20%28aNode%20source%20value%20replace%3A%20%27%27%27%27%27%27%20with%3A%20%27%27%27%27%29.%0A%09stream%20nextPutAll%3A%20%27%7D%29%28%29%27%0A')}),
  975. smalltalk.Compiler);
  976. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler');
  977. smalltalk.addMethod(
  978. '_doIt',
  979. smalltalk.method({
  980. selector: 'doIt',
  981. category: '',
  982. fn: function (){
  983. var self=this;
  984. return (function(){return smalltalk.Object._subclass_instanceVariableNames_category_("DoIt","","Compiler");})._value();
  985. return self;},
  986. source: unescape('doIt%20%5E%5BObject%20subclass%3A%20%23DoIt%0A%09instanceVariableNames%3A%20%27%27%0A%09category%3A%20%27Compiler%27%5D%20value')}),
  987. smalltalk.DoIt);