Compiler-Core.js 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  1. define("amber_core/Compiler-Core", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Compiler-Core');
  3. smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AbstractCodeGenerator', smalltalk.Object, ['currentClass', 'source'], 'Compiler-Core');
  5. smalltalk.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "classNameFor:",
  9. protocol: 'accessing',
  10. fn: function (aClass){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $2,$3,$4,$1;
  14. $2=_st(aClass)._isMetaclass();
  15. if(smalltalk.assert($2)){
  16. $3=_st(_st(aClass)._instanceClass())._name();
  17. $ctx1.sendIdx["name"]=1;
  18. $1=_st($3).__comma(".klass");
  19. } else {
  20. $4=_st(aClass)._isNil();
  21. if(smalltalk.assert($4)){
  22. $1="nil";
  23. } else {
  24. $1=_st(aClass)._name();
  25. };
  26. };
  27. return $1;
  28. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.AbstractCodeGenerator)})},
  29. args: ["aClass"],
  30. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]",
  31. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  32. referencedClasses: []
  33. }),
  34. smalltalk.AbstractCodeGenerator);
  35. smalltalk.addMethod(
  36. smalltalk.method({
  37. selector: "compileNode:",
  38. protocol: 'compiling',
  39. fn: function (aNode){
  40. var self=this;
  41. return smalltalk.withContext(function($ctx1) {
  42. self._subclassResponsibility();
  43. return self}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},smalltalk.AbstractCodeGenerator)})},
  44. args: ["aNode"],
  45. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  46. messageSends: ["subclassResponsibility"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.AbstractCodeGenerator);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "currentClass",
  53. protocol: 'accessing',
  54. fn: function (){
  55. var self=this;
  56. return smalltalk.withContext(function($ctx1) {
  57. var $1;
  58. $1=self["@currentClass"];
  59. return $1;
  60. }, function($ctx1) {$ctx1.fill(self,"currentClass",{},smalltalk.AbstractCodeGenerator)})},
  61. args: [],
  62. source: "currentClass\x0a\x09^ currentClass",
  63. messageSends: [],
  64. referencedClasses: []
  65. }),
  66. smalltalk.AbstractCodeGenerator);
  67. smalltalk.addMethod(
  68. smalltalk.method({
  69. selector: "currentClass:",
  70. protocol: 'accessing',
  71. fn: function (aClass){
  72. var self=this;
  73. return smalltalk.withContext(function($ctx1) {
  74. self["@currentClass"]=aClass;
  75. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass},smalltalk.AbstractCodeGenerator)})},
  76. args: ["aClass"],
  77. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  78. messageSends: [],
  79. referencedClasses: []
  80. }),
  81. smalltalk.AbstractCodeGenerator);
  82. smalltalk.addMethod(
  83. smalltalk.method({
  84. selector: "pseudoVariables",
  85. protocol: 'accessing',
  86. fn: function (){
  87. var self=this;
  88. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  89. return smalltalk.withContext(function($ctx1) {
  90. var $1;
  91. $1=_st($Smalltalk())._pseudoVariableNames();
  92. return $1;
  93. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},smalltalk.AbstractCodeGenerator)})},
  94. args: [],
  95. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  96. messageSends: ["pseudoVariableNames"],
  97. referencedClasses: ["Smalltalk"]
  98. }),
  99. smalltalk.AbstractCodeGenerator);
  100. smalltalk.addMethod(
  101. smalltalk.method({
  102. selector: "source",
  103. protocol: 'accessing',
  104. fn: function (){
  105. var self=this;
  106. return smalltalk.withContext(function($ctx1) {
  107. var $2,$1;
  108. $2=self["@source"];
  109. if(($receiver = $2) == nil || $receiver == null){
  110. $1="";
  111. } else {
  112. $1=$2;
  113. };
  114. return $1;
  115. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.AbstractCodeGenerator)})},
  116. args: [],
  117. source: "source\x0a\x09^ source ifNil: [ '' ]",
  118. messageSends: ["ifNil:"],
  119. referencedClasses: []
  120. }),
  121. smalltalk.AbstractCodeGenerator);
  122. smalltalk.addMethod(
  123. smalltalk.method({
  124. selector: "source:",
  125. protocol: 'accessing',
  126. fn: function (aString){
  127. var self=this;
  128. return smalltalk.withContext(function($ctx1) {
  129. self["@source"]=aString;
  130. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.AbstractCodeGenerator)})},
  131. args: ["aString"],
  132. source: "source: aString\x0a\x09source := aString",
  133. messageSends: [],
  134. referencedClasses: []
  135. }),
  136. smalltalk.AbstractCodeGenerator);
  137. smalltalk.addClass('CodeGenerator', smalltalk.AbstractCodeGenerator, [], 'Compiler-Core');
  138. smalltalk.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation.";
  139. smalltalk.addMethod(
  140. smalltalk.method({
  141. selector: "compileNode:",
  142. protocol: 'compiling',
  143. fn: function (aNode){
  144. var self=this;
  145. var ir,stream;
  146. return smalltalk.withContext(function($ctx1) {
  147. var $2,$3,$1;
  148. _st(self._semanticAnalyzer())._visit_(aNode);
  149. $ctx1.sendIdx["visit:"]=1;
  150. ir=_st(self._translator())._visit_(aNode);
  151. $ctx1.sendIdx["visit:"]=2;
  152. $2=self._irTranslator();
  153. _st($2)._currentClass_(self._currentClass());
  154. _st($2)._visit_(ir);
  155. $3=_st($2)._contents();
  156. $1=$3;
  157. return $1;
  158. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},smalltalk.CodeGenerator)})},
  159. args: ["aNode"],
  160. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  161. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"],
  162. referencedClasses: []
  163. }),
  164. smalltalk.CodeGenerator);
  165. smalltalk.addMethod(
  166. smalltalk.method({
  167. selector: "irTranslator",
  168. protocol: 'compiling',
  169. fn: function (){
  170. var self=this;
  171. function $IRJSTranslator(){return smalltalk.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  172. return smalltalk.withContext(function($ctx1) {
  173. var $1;
  174. $1=_st($IRJSTranslator())._new();
  175. return $1;
  176. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},smalltalk.CodeGenerator)})},
  177. args: [],
  178. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  179. messageSends: ["new"],
  180. referencedClasses: ["IRJSTranslator"]
  181. }),
  182. smalltalk.CodeGenerator);
  183. smalltalk.addMethod(
  184. smalltalk.method({
  185. selector: "semanticAnalyzer",
  186. protocol: 'compiling',
  187. fn: function (){
  188. var self=this;
  189. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  190. return smalltalk.withContext(function($ctx1) {
  191. var $1;
  192. $1=_st($SemanticAnalyzer())._on_(self._currentClass());
  193. return $1;
  194. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},smalltalk.CodeGenerator)})},
  195. args: [],
  196. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  197. messageSends: ["on:", "currentClass"],
  198. referencedClasses: ["SemanticAnalyzer"]
  199. }),
  200. smalltalk.CodeGenerator);
  201. smalltalk.addMethod(
  202. smalltalk.method({
  203. selector: "translator",
  204. protocol: 'compiling',
  205. fn: function (){
  206. var self=this;
  207. function $IRASTTranslator(){return smalltalk.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  208. return smalltalk.withContext(function($ctx1) {
  209. var $2,$3,$1;
  210. $2=_st($IRASTTranslator())._new();
  211. _st($2)._source_(self._source());
  212. _st($2)._theClass_(self._currentClass());
  213. $3=_st($2)._yourself();
  214. $1=$3;
  215. return $1;
  216. }, function($ctx1) {$ctx1.fill(self,"translator",{},smalltalk.CodeGenerator)})},
  217. args: [],
  218. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  219. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"],
  220. referencedClasses: ["IRASTTranslator"]
  221. }),
  222. smalltalk.CodeGenerator);
  223. smalltalk.addClass('Compiler', smalltalk.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  224. smalltalk.Compiler.comment="I provide the public interface for compiling Amber source code into JavaScript.\x0a\x0aThe code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.\x0aThe default code generator is an instance of `InlinedCodeGenerator`";
  225. smalltalk.addMethod(
  226. smalltalk.method({
  227. selector: "codeGeneratorClass",
  228. protocol: 'accessing',
  229. fn: function (){
  230. var self=this;
  231. function $InliningCodeGenerator(){return smalltalk.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  232. return smalltalk.withContext(function($ctx1) {
  233. var $2,$1;
  234. $2=self["@codeGeneratorClass"];
  235. if(($receiver = $2) == nil || $receiver == null){
  236. $1=$InliningCodeGenerator();
  237. } else {
  238. $1=$2;
  239. };
  240. return $1;
  241. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.Compiler)})},
  242. args: [],
  243. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  244. messageSends: ["ifNil:"],
  245. referencedClasses: ["InliningCodeGenerator"]
  246. }),
  247. smalltalk.Compiler);
  248. smalltalk.addMethod(
  249. smalltalk.method({
  250. selector: "codeGeneratorClass:",
  251. protocol: 'accessing',
  252. fn: function (aClass){
  253. var self=this;
  254. return smalltalk.withContext(function($ctx1) {
  255. self["@codeGeneratorClass"]=aClass;
  256. return self}, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass:",{aClass:aClass},smalltalk.Compiler)})},
  257. args: ["aClass"],
  258. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  259. messageSends: [],
  260. referencedClasses: []
  261. }),
  262. smalltalk.Compiler);
  263. smalltalk.addMethod(
  264. smalltalk.method({
  265. selector: "compile:",
  266. protocol: 'compiling',
  267. fn: function (aString){
  268. var self=this;
  269. return smalltalk.withContext(function($ctx1) {
  270. var $1;
  271. $1=self._compileNode_(self._parse_(aString));
  272. return $1;
  273. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Compiler)})},
  274. args: ["aString"],
  275. source: "compile: aString\x0a\x09^ self compileNode: (self parse: aString)",
  276. messageSends: ["compileNode:", "parse:"],
  277. referencedClasses: []
  278. }),
  279. smalltalk.Compiler);
  280. smalltalk.addMethod(
  281. smalltalk.method({
  282. selector: "compile:forClass:",
  283. protocol: 'compiling',
  284. fn: function (aString,aClass){
  285. var self=this;
  286. return smalltalk.withContext(function($ctx1) {
  287. var $1;
  288. self._currentClass_(aClass);
  289. self._source_(aString);
  290. $1=self._compile_(aString);
  291. return $1;
  292. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass},smalltalk.Compiler)})},
  293. args: ["aString", "aClass"],
  294. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^ self compile: aString",
  295. messageSends: ["currentClass:", "source:", "compile:"],
  296. referencedClasses: []
  297. }),
  298. smalltalk.Compiler);
  299. smalltalk.addMethod(
  300. smalltalk.method({
  301. selector: "compileExpression:",
  302. protocol: 'compiling',
  303. fn: function (aString){
  304. var self=this;
  305. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  306. return smalltalk.withContext(function($ctx1) {
  307. var $1,$2;
  308. self._currentClass_($DoIt());
  309. $1=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  310. $ctx1.sendIdx[","]=1;
  311. self._source_($1);
  312. $2=self._compileNode_(self._parse_(self._source()));
  313. return $2;
  314. }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString},smalltalk.Compiler)})},
  315. args: ["aString"],
  316. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  317. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
  318. referencedClasses: ["DoIt"]
  319. }),
  320. smalltalk.Compiler);
  321. smalltalk.addMethod(
  322. smalltalk.method({
  323. selector: "compileExpression:on:",
  324. protocol: 'compiling',
  325. fn: function (aString,anObject){
  326. var self=this;
  327. return smalltalk.withContext(function($ctx1) {
  328. var $1,$2;
  329. self._currentClass_(_st(anObject)._class());
  330. $1=_st("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  331. $ctx1.sendIdx[","]=1;
  332. self._source_($1);
  333. $2=self._compileNode_(self._parse_(self._source()));
  334. return $2;
  335. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},smalltalk.Compiler)})},
  336. args: ["aString", "anObject"],
  337. source: "compileExpression: aString on: anObject\x0a\x09self currentClass: anObject class.\x0a\x09self source: 'xxxDoIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  338. messageSends: ["currentClass:", "class", "source:", ",", "compileNode:", "parse:", "source"],
  339. referencedClasses: []
  340. }),
  341. smalltalk.Compiler);
  342. smalltalk.addMethod(
  343. smalltalk.method({
  344. selector: "compileNode:",
  345. protocol: 'compiling',
  346. fn: function (aNode){
  347. var self=this;
  348. var generator,result;
  349. return smalltalk.withContext(function($ctx1) {
  350. var $1,$2,$3;
  351. generator=_st(self._codeGeneratorClass())._new();
  352. $1=generator;
  353. _st($1)._source_(self._source());
  354. $2=_st($1)._currentClass_(self._currentClass());
  355. result=_st(generator)._compileNode_(aNode);
  356. self._unknownVariables_([]);
  357. $3=result;
  358. return $3;
  359. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},smalltalk.Compiler)})},
  360. args: ["aNode"],
  361. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
  362. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
  363. referencedClasses: []
  364. }),
  365. smalltalk.Compiler);
  366. smalltalk.addMethod(
  367. smalltalk.method({
  368. selector: "currentClass",
  369. protocol: 'accessing',
  370. fn: function (){
  371. var self=this;
  372. return smalltalk.withContext(function($ctx1) {
  373. var $1;
  374. $1=self["@currentClass"];
  375. return $1;
  376. }, function($ctx1) {$ctx1.fill(self,"currentClass",{},smalltalk.Compiler)})},
  377. args: [],
  378. source: "currentClass\x0a\x09^ currentClass",
  379. messageSends: [],
  380. referencedClasses: []
  381. }),
  382. smalltalk.Compiler);
  383. smalltalk.addMethod(
  384. smalltalk.method({
  385. selector: "currentClass:",
  386. protocol: 'accessing',
  387. fn: function (aClass){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. self["@currentClass"]=aClass;
  391. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass},smalltalk.Compiler)})},
  392. args: ["aClass"],
  393. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  394. messageSends: [],
  395. referencedClasses: []
  396. }),
  397. smalltalk.Compiler);
  398. smalltalk.addMethod(
  399. smalltalk.method({
  400. selector: "eval:",
  401. protocol: 'compiling',
  402. fn: function (aString){
  403. var self=this;
  404. return smalltalk.withContext(function($ctx1) {
  405. return eval(aString);
  406. return self}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},smalltalk.Compiler)})},
  407. args: ["aString"],
  408. source: "eval: aString\x0a\x09<return eval(aString)>",
  409. messageSends: [],
  410. referencedClasses: []
  411. }),
  412. smalltalk.Compiler);
  413. smalltalk.addMethod(
  414. smalltalk.method({
  415. selector: "evaluateExpression:",
  416. protocol: 'compiling',
  417. fn: function (aString){
  418. var self=this;
  419. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  420. return smalltalk.withContext(function($ctx1) {
  421. var $1;
  422. $1=self._evaluateExpression_on_(aString,_st($DoIt())._new());
  423. return $1;
  424. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},smalltalk.Compiler)})},
  425. args: ["aString"],
  426. source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09^ self evaluateExpression: aString on: DoIt new",
  427. messageSends: ["evaluateExpression:on:", "new"],
  428. referencedClasses: ["DoIt"]
  429. }),
  430. smalltalk.Compiler);
  431. smalltalk.addMethod(
  432. smalltalk.method({
  433. selector: "evaluateExpression:on:",
  434. protocol: 'compiling',
  435. fn: function (aString,anObject){
  436. var self=this;
  437. var result,method;
  438. return smalltalk.withContext(function($ctx1) {
  439. var $1,$2;
  440. method=self._eval_(self._compileExpression_on_(aString,anObject));
  441. _st(method)._protocol_("xxxDoIt");
  442. $1=_st(anObject)._class();
  443. $ctx1.sendIdx["class"]=1;
  444. _st($1)._addCompiledMethod_(method);
  445. result=_st(anObject)._xxxDoIt();
  446. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  447. $2=result;
  448. return $2;
  449. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},smalltalk.Compiler)})},
  450. args: ["aString", "anObject"],
  451. source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: 'xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  452. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"],
  453. referencedClasses: []
  454. }),
  455. smalltalk.Compiler);
  456. smalltalk.addMethod(
  457. smalltalk.method({
  458. selector: "install:forClass:protocol:",
  459. protocol: 'compiling',
  460. fn: function (aString,aBehavior,anotherString){
  461. var self=this;
  462. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  463. return smalltalk.withContext(function($ctx1) {
  464. var $1;
  465. $1=_st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(self._eval_(self._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
  466. return $1;
  467. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString},smalltalk.Compiler)})},
  468. args: ["aString", "aBehavior", "anotherString"],
  469. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: (self eval: (self compile: aString forClass: aBehavior))\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
  470. messageSends: ["installMethod:forClass:protocol:", "new", "eval:", "compile:forClass:"],
  471. referencedClasses: ["ClassBuilder"]
  472. }),
  473. smalltalk.Compiler);
  474. smalltalk.addMethod(
  475. smalltalk.method({
  476. selector: "parse:",
  477. protocol: 'compiling',
  478. fn: function (aString){
  479. var self=this;
  480. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  481. return smalltalk.withContext(function($ctx1) {
  482. var $1;
  483. $1=_st($Smalltalk())._parse_(aString);
  484. return $1;
  485. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Compiler)})},
  486. args: ["aString"],
  487. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  488. messageSends: ["parse:"],
  489. referencedClasses: ["Smalltalk"]
  490. }),
  491. smalltalk.Compiler);
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "parseExpression:",
  495. protocol: 'compiling',
  496. fn: function (aString){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $2,$1;
  500. $2=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  501. $ctx1.sendIdx[","]=1;
  502. $1=self._parse_($2);
  503. return $1;
  504. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},smalltalk.Compiler)})},
  505. args: ["aString"],
  506. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  507. messageSends: ["parse:", ","],
  508. referencedClasses: []
  509. }),
  510. smalltalk.Compiler);
  511. smalltalk.addMethod(
  512. smalltalk.method({
  513. selector: "recompile:",
  514. protocol: 'compiling',
  515. fn: function (aClass){
  516. var self=this;
  517. return smalltalk.withContext(function($ctx1) {
  518. var $1;
  519. _st(_st(_st(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  520. return smalltalk.withContext(function($ctx2) {
  521. return self._install_forClass_protocol_(_st(each)._source(),aClass,_st(each)._protocol());
  522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Recompiling ".__comma(_st(aClass)._name()));
  523. $1=_st(aClass)._isMetaclass();
  524. if(! smalltalk.assert($1)){
  525. self._recompile_(_st(aClass)._class());
  526. };
  527. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},smalltalk.Compiler)})},
  528. args: ["aClass"],
  529. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]",
  530. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"],
  531. referencedClasses: []
  532. }),
  533. smalltalk.Compiler);
  534. smalltalk.addMethod(
  535. smalltalk.method({
  536. selector: "recompileAll",
  537. protocol: 'compiling',
  538. fn: function (){
  539. var self=this;
  540. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  541. return smalltalk.withContext(function($ctx1) {
  542. _st(_st($Smalltalk())._classes())._do_displayingProgress_((function(each){
  543. return smalltalk.withContext(function($ctx2) {
  544. return self._recompile_(each);
  545. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Compiling all classes...");
  546. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler)})},
  547. args: [],
  548. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  549. messageSends: ["do:displayingProgress:", "classes", "recompile:"],
  550. referencedClasses: ["Smalltalk"]
  551. }),
  552. smalltalk.Compiler);
  553. smalltalk.addMethod(
  554. smalltalk.method({
  555. selector: "source",
  556. protocol: 'accessing',
  557. fn: function (){
  558. var self=this;
  559. return smalltalk.withContext(function($ctx1) {
  560. var $2,$1;
  561. $2=self["@source"];
  562. if(($receiver = $2) == nil || $receiver == null){
  563. $1="";
  564. } else {
  565. $1=$2;
  566. };
  567. return $1;
  568. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.Compiler)})},
  569. args: [],
  570. source: "source\x0a\x09^ source ifNil: [ '' ]",
  571. messageSends: ["ifNil:"],
  572. referencedClasses: []
  573. }),
  574. smalltalk.Compiler);
  575. smalltalk.addMethod(
  576. smalltalk.method({
  577. selector: "source:",
  578. protocol: 'accessing',
  579. fn: function (aString){
  580. var self=this;
  581. return smalltalk.withContext(function($ctx1) {
  582. self["@source"]=aString;
  583. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.Compiler)})},
  584. args: ["aString"],
  585. source: "source: aString\x0a\x09source := aString",
  586. messageSends: [],
  587. referencedClasses: []
  588. }),
  589. smalltalk.Compiler);
  590. smalltalk.addMethod(
  591. smalltalk.method({
  592. selector: "unknownVariables",
  593. protocol: 'accessing',
  594. fn: function (){
  595. var self=this;
  596. return smalltalk.withContext(function($ctx1) {
  597. var $1;
  598. $1=self["@unknownVariables"];
  599. return $1;
  600. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},smalltalk.Compiler)})},
  601. args: [],
  602. source: "unknownVariables\x0a\x09^ unknownVariables",
  603. messageSends: [],
  604. referencedClasses: []
  605. }),
  606. smalltalk.Compiler);
  607. smalltalk.addMethod(
  608. smalltalk.method({
  609. selector: "unknownVariables:",
  610. protocol: 'accessing',
  611. fn: function (aCollection){
  612. var self=this;
  613. return smalltalk.withContext(function($ctx1) {
  614. self["@unknownVariables"]=aCollection;
  615. return self}, function($ctx1) {$ctx1.fill(self,"unknownVariables:",{aCollection:aCollection},smalltalk.Compiler)})},
  616. args: ["aCollection"],
  617. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  618. messageSends: [],
  619. referencedClasses: []
  620. }),
  621. smalltalk.Compiler);
  622. smalltalk.addMethod(
  623. smalltalk.method({
  624. selector: "recompile:",
  625. protocol: 'compiling',
  626. fn: function (aClass){
  627. var self=this;
  628. return smalltalk.withContext(function($ctx1) {
  629. _st(self._new())._recompile_(aClass);
  630. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},smalltalk.Compiler.klass)})},
  631. args: ["aClass"],
  632. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  633. messageSends: ["recompile:", "new"],
  634. referencedClasses: []
  635. }),
  636. smalltalk.Compiler.klass);
  637. smalltalk.addMethod(
  638. smalltalk.method({
  639. selector: "recompileAll",
  640. protocol: 'compiling',
  641. fn: function (){
  642. var self=this;
  643. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  644. return smalltalk.withContext(function($ctx1) {
  645. _st(_st($Smalltalk())._classes())._do_((function(each){
  646. return smalltalk.withContext(function($ctx2) {
  647. return self._recompile_(each);
  648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  649. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler.klass)})},
  650. args: [],
  651. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  652. messageSends: ["do:", "classes", "recompile:"],
  653. referencedClasses: ["Smalltalk"]
  654. }),
  655. smalltalk.Compiler.klass);
  656. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler-Core');
  657. smalltalk.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  658. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler-Core');
  659. smalltalk.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  660. smalltalk.addMethod(
  661. smalltalk.method({
  662. selector: "visit:",
  663. protocol: 'visiting',
  664. fn: function (aNode){
  665. var self=this;
  666. return smalltalk.withContext(function($ctx1) {
  667. var $1;
  668. $1=_st(aNode)._accept_(self);
  669. return $1;
  670. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},smalltalk.NodeVisitor)})},
  671. args: ["aNode"],
  672. source: "visit: aNode\x0a\x09^ aNode accept: self",
  673. messageSends: ["accept:"],
  674. referencedClasses: []
  675. }),
  676. smalltalk.NodeVisitor);
  677. smalltalk.addMethod(
  678. smalltalk.method({
  679. selector: "visitAll:",
  680. protocol: 'visiting',
  681. fn: function (aCollection){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) {
  684. var $1;
  685. $1=_st(aCollection)._collect_((function(each){
  686. return smalltalk.withContext(function($ctx2) {
  687. return self._visit_(each);
  688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  689. return $1;
  690. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},smalltalk.NodeVisitor)})},
  691. args: ["aCollection"],
  692. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  693. messageSends: ["collect:", "visit:"],
  694. referencedClasses: []
  695. }),
  696. smalltalk.NodeVisitor);
  697. smalltalk.addMethod(
  698. smalltalk.method({
  699. selector: "visitAssignmentNode:",
  700. protocol: 'visiting',
  701. fn: function (aNode){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) {
  704. var $1;
  705. $1=self._visitNode_(aNode);
  706. return $1;
  707. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  708. args: ["aNode"],
  709. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  710. messageSends: ["visitNode:"],
  711. referencedClasses: []
  712. }),
  713. smalltalk.NodeVisitor);
  714. smalltalk.addMethod(
  715. smalltalk.method({
  716. selector: "visitBlockNode:",
  717. protocol: 'visiting',
  718. fn: function (aNode){
  719. var self=this;
  720. return smalltalk.withContext(function($ctx1) {
  721. var $1;
  722. $1=self._visitNode_(aNode);
  723. return $1;
  724. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  725. args: ["aNode"],
  726. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  727. messageSends: ["visitNode:"],
  728. referencedClasses: []
  729. }),
  730. smalltalk.NodeVisitor);
  731. smalltalk.addMethod(
  732. smalltalk.method({
  733. selector: "visitBlockSequenceNode:",
  734. protocol: 'visiting',
  735. fn: function (aNode){
  736. var self=this;
  737. return smalltalk.withContext(function($ctx1) {
  738. var $1;
  739. $1=self._visitSequenceNode_(aNode);
  740. return $1;
  741. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  742. args: ["aNode"],
  743. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  744. messageSends: ["visitSequenceNode:"],
  745. referencedClasses: []
  746. }),
  747. smalltalk.NodeVisitor);
  748. smalltalk.addMethod(
  749. smalltalk.method({
  750. selector: "visitCascadeNode:",
  751. protocol: 'visiting',
  752. fn: function (aNode){
  753. var self=this;
  754. return smalltalk.withContext(function($ctx1) {
  755. var $1;
  756. $1=self._visitNode_(aNode);
  757. return $1;
  758. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  759. args: ["aNode"],
  760. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  761. messageSends: ["visitNode:"],
  762. referencedClasses: []
  763. }),
  764. smalltalk.NodeVisitor);
  765. smalltalk.addMethod(
  766. smalltalk.method({
  767. selector: "visitDynamicArrayNode:",
  768. protocol: 'visiting',
  769. fn: function (aNode){
  770. var self=this;
  771. return smalltalk.withContext(function($ctx1) {
  772. var $1;
  773. $1=self._visitNode_(aNode);
  774. return $1;
  775. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  776. args: ["aNode"],
  777. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  778. messageSends: ["visitNode:"],
  779. referencedClasses: []
  780. }),
  781. smalltalk.NodeVisitor);
  782. smalltalk.addMethod(
  783. smalltalk.method({
  784. selector: "visitDynamicDictionaryNode:",
  785. protocol: 'visiting',
  786. fn: function (aNode){
  787. var self=this;
  788. return smalltalk.withContext(function($ctx1) {
  789. var $1;
  790. $1=self._visitNode_(aNode);
  791. return $1;
  792. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  793. args: ["aNode"],
  794. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  795. messageSends: ["visitNode:"],
  796. referencedClasses: []
  797. }),
  798. smalltalk.NodeVisitor);
  799. smalltalk.addMethod(
  800. smalltalk.method({
  801. selector: "visitJSStatementNode:",
  802. protocol: 'visiting',
  803. fn: function (aNode){
  804. var self=this;
  805. return smalltalk.withContext(function($ctx1) {
  806. var $1;
  807. $1=self._visitNode_(aNode);
  808. return $1;
  809. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  810. args: ["aNode"],
  811. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  812. messageSends: ["visitNode:"],
  813. referencedClasses: []
  814. }),
  815. smalltalk.NodeVisitor);
  816. smalltalk.addMethod(
  817. smalltalk.method({
  818. selector: "visitMethodNode:",
  819. protocol: 'visiting',
  820. fn: function (aNode){
  821. var self=this;
  822. return smalltalk.withContext(function($ctx1) {
  823. var $1;
  824. $1=self._visitNode_(aNode);
  825. return $1;
  826. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  827. args: ["aNode"],
  828. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  829. messageSends: ["visitNode:"],
  830. referencedClasses: []
  831. }),
  832. smalltalk.NodeVisitor);
  833. smalltalk.addMethod(
  834. smalltalk.method({
  835. selector: "visitNode:",
  836. protocol: 'visiting',
  837. fn: function (aNode){
  838. var self=this;
  839. return smalltalk.withContext(function($ctx1) {
  840. var $1;
  841. $1=self._visitAll_(_st(aNode)._nodes());
  842. return $1;
  843. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  844. args: ["aNode"],
  845. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  846. messageSends: ["visitAll:", "nodes"],
  847. referencedClasses: []
  848. }),
  849. smalltalk.NodeVisitor);
  850. smalltalk.addMethod(
  851. smalltalk.method({
  852. selector: "visitReturnNode:",
  853. protocol: 'visiting',
  854. fn: function (aNode){
  855. var self=this;
  856. return smalltalk.withContext(function($ctx1) {
  857. var $1;
  858. $1=self._visitNode_(aNode);
  859. return $1;
  860. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  861. args: ["aNode"],
  862. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  863. messageSends: ["visitNode:"],
  864. referencedClasses: []
  865. }),
  866. smalltalk.NodeVisitor);
  867. smalltalk.addMethod(
  868. smalltalk.method({
  869. selector: "visitSendNode:",
  870. protocol: 'visiting',
  871. fn: function (aNode){
  872. var self=this;
  873. return smalltalk.withContext(function($ctx1) {
  874. var $1;
  875. $1=self._visitNode_(aNode);
  876. return $1;
  877. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  878. args: ["aNode"],
  879. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  880. messageSends: ["visitNode:"],
  881. referencedClasses: []
  882. }),
  883. smalltalk.NodeVisitor);
  884. smalltalk.addMethod(
  885. smalltalk.method({
  886. selector: "visitSequenceNode:",
  887. protocol: 'visiting',
  888. fn: function (aNode){
  889. var self=this;
  890. return smalltalk.withContext(function($ctx1) {
  891. var $1;
  892. $1=self._visitNode_(aNode);
  893. return $1;
  894. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  895. args: ["aNode"],
  896. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  897. messageSends: ["visitNode:"],
  898. referencedClasses: []
  899. }),
  900. smalltalk.NodeVisitor);
  901. smalltalk.addMethod(
  902. smalltalk.method({
  903. selector: "visitValueNode:",
  904. protocol: 'visiting',
  905. fn: function (aNode){
  906. var self=this;
  907. return smalltalk.withContext(function($ctx1) {
  908. var $1;
  909. $1=self._visitNode_(aNode);
  910. return $1;
  911. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  912. args: ["aNode"],
  913. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  914. messageSends: ["visitNode:"],
  915. referencedClasses: []
  916. }),
  917. smalltalk.NodeVisitor);
  918. smalltalk.addMethod(
  919. smalltalk.method({
  920. selector: "visitVariableNode:",
  921. protocol: 'visiting',
  922. fn: function (aNode){
  923. var self=this;
  924. return smalltalk.withContext(function($ctx1) {
  925. var $1;
  926. $1=self._visitNode_(aNode);
  927. return $1;
  928. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  929. args: ["aNode"],
  930. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  931. messageSends: ["visitNode:"],
  932. referencedClasses: []
  933. }),
  934. smalltalk.NodeVisitor);
  935. smalltalk.addMethod(
  936. smalltalk.method({
  937. selector: "asVariableName",
  938. protocol: '*Compiler-Core',
  939. fn: function (){
  940. var self=this;
  941. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  942. return smalltalk.withContext(function($ctx1) {
  943. var $2,$1;
  944. $2=_st(_st($Smalltalk())._reservedWords())._includes_(self);
  945. if(smalltalk.assert($2)){
  946. $1=self.__comma("_");
  947. } else {
  948. $1=self;
  949. };
  950. return $1;
  951. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},smalltalk.String)})},
  952. args: [],
  953. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  954. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","],
  955. referencedClasses: ["Smalltalk"]
  956. }),
  957. smalltalk.String);
  958. });