1
0

Helios-Helpers.js 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778
  1. define("helios/Helios-Helpers", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var smalltalk=$core,_st=$recv,globals=$globals;
  4. $core.addPackage('Helios-Helpers');
  5. $core.packages["Helios-Helpers"].transport = {"type":"amd","amdNamespace":"helios"};
  6. $core.addClass('HLClassifier', $globals.Object, ['next', 'method'], 'Helios-Helpers');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.HLClassifier.comment="I am an abstract class implementing a link in a `chain of responsibility` pattern.\x0a\x0aSubclasses are in charge of classifying a method according to multiple strategies.";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "classify",
  13. protocol: 'protocol',
  14. fn: function (){
  15. var self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. var $1,$3,$2,$receiver;
  20. $1=self._next();
  21. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22. $ctx1.sendIdx["next"]=1;
  23. //>>excludeEnd("ctx");
  24. if(($receiver = $1) == null || $receiver.isNil){
  25. return false;
  26. } else {
  27. $1;
  28. };
  29. $3=self._doClassify();
  30. if($core.assert($3)){
  31. $2=true;
  32. } else {
  33. $2=$recv(self._next())._classify();
  34. };
  35. return $2;
  36. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37. }, function($ctx1) {$ctx1.fill(self,"classify",{},$globals.HLClassifier)});
  38. //>>excludeEnd("ctx");
  39. },
  40. //>>excludeStart("ide", pragmas.excludeIdeData);
  41. args: [],
  42. source: "classify\x0a\x09self next ifNil: [ ^ false ].\x0a\x09\x0a\x09^ self doClassify\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self next classify ]",
  43. referencedClasses: [],
  44. //>>excludeEnd("ide");
  45. messageSends: ["ifNil:", "next", "ifTrue:ifFalse:", "doClassify", "classify"]
  46. }),
  47. $globals.HLClassifier);
  48. $core.addMethod(
  49. $core.method({
  50. selector: "doClassify",
  51. protocol: 'private',
  52. fn: function (){
  53. var self=this;
  54. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55. return $core.withContext(function($ctx1) {
  56. //>>excludeEnd("ctx");
  57. self._subclassResponsibility();
  58. return self;
  59. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60. }, function($ctx1) {$ctx1.fill(self,"doClassify",{},$globals.HLClassifier)});
  61. //>>excludeEnd("ctx");
  62. },
  63. //>>excludeStart("ide", pragmas.excludeIdeData);
  64. args: [],
  65. source: "doClassify\x0a\x09self subclassResponsibility",
  66. referencedClasses: [],
  67. //>>excludeEnd("ide");
  68. messageSends: ["subclassResponsibility"]
  69. }),
  70. $globals.HLClassifier);
  71. $core.addMethod(
  72. $core.method({
  73. selector: "method",
  74. protocol: 'accessing',
  75. fn: function (){
  76. var self=this;
  77. var $1;
  78. $1=self["@method"];
  79. return $1;
  80. },
  81. //>>excludeStart("ide", pragmas.excludeIdeData);
  82. args: [],
  83. source: "method\x0a\x09^ method",
  84. referencedClasses: [],
  85. //>>excludeEnd("ide");
  86. messageSends: []
  87. }),
  88. $globals.HLClassifier);
  89. $core.addMethod(
  90. $core.method({
  91. selector: "method:",
  92. protocol: 'accessing',
  93. fn: function (anObject){
  94. var self=this;
  95. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  96. return $core.withContext(function($ctx1) {
  97. //>>excludeEnd("ctx");
  98. var $1,$receiver;
  99. self["@method"]=anObject;
  100. $1=self._next();
  101. if(($receiver = $1) == null || $receiver.isNil){
  102. $1;
  103. } else {
  104. var nextLink;
  105. nextLink=$receiver;
  106. $recv(nextLink)._method_(anObject);
  107. };
  108. return self;
  109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  110. }, function($ctx1) {$ctx1.fill(self,"method:",{anObject:anObject},$globals.HLClassifier)});
  111. //>>excludeEnd("ctx");
  112. },
  113. //>>excludeStart("ide", pragmas.excludeIdeData);
  114. args: ["anObject"],
  115. source: "method: anObject\x0a\x09method := anObject.\x0a\x09self next\x0a\x09\x09ifNotNil: [ :nextLink | nextLink method: anObject ]",
  116. referencedClasses: [],
  117. //>>excludeEnd("ide");
  118. messageSends: ["ifNotNil:", "next", "method:"]
  119. }),
  120. $globals.HLClassifier);
  121. $core.addMethod(
  122. $core.method({
  123. selector: "next",
  124. protocol: 'accessing',
  125. fn: function (){
  126. var self=this;
  127. var $1;
  128. $1=self["@next"];
  129. return $1;
  130. },
  131. //>>excludeStart("ide", pragmas.excludeIdeData);
  132. args: [],
  133. source: "next\x0a\x09^ next",
  134. referencedClasses: [],
  135. //>>excludeEnd("ide");
  136. messageSends: []
  137. }),
  138. $globals.HLClassifier);
  139. $core.addMethod(
  140. $core.method({
  141. selector: "next:",
  142. protocol: 'accessing',
  143. fn: function (anObject){
  144. var self=this;
  145. self["@next"]=anObject;
  146. return self;
  147. },
  148. //>>excludeStart("ide", pragmas.excludeIdeData);
  149. args: ["anObject"],
  150. source: "next: anObject\x0a\x09next := anObject",
  151. referencedClasses: [],
  152. //>>excludeEnd("ide");
  153. messageSends: []
  154. }),
  155. $globals.HLClassifier);
  156. $core.addClass('HLAccessorClassifier', $globals.HLClassifier, [], 'Helios-Helpers');
  157. //>>excludeStart("ide", pragmas.excludeIdeData);
  158. $globals.HLAccessorClassifier.comment="I am a classifier checking the method selector matches an instance variable name.";
  159. //>>excludeEnd("ide");
  160. $core.addMethod(
  161. $core.method({
  162. selector: "doClassify",
  163. protocol: 'private',
  164. fn: function (){
  165. var self=this;
  166. var names,selector;
  167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  168. return $core.withContext(function($ctx1) {
  169. //>>excludeEnd("ctx");
  170. var $1,$2;
  171. names=$recv($recv(self["@method"])._methodClass())._allInstanceVariableNames();
  172. selector=$recv(self["@method"])._selector();
  173. $1=$recv($recv(selector)._last()).__eq(":");
  174. if($core.assert($1)){
  175. selector=$recv(selector)._allButLast();
  176. selector;
  177. };
  178. $2=$recv(names)._includes_(selector);
  179. if(!$core.assert($2)){
  180. return false;
  181. };
  182. $recv(self["@method"])._protocol_("accessing");
  183. return true;
  184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  185. }, function($ctx1) {$ctx1.fill(self,"doClassify",{names:names,selector:selector},$globals.HLAccessorClassifier)});
  186. //>>excludeEnd("ctx");
  187. },
  188. //>>excludeStart("ide", pragmas.excludeIdeData);
  189. args: [],
  190. source: "doClassify\x0a\x09| names selector |\x0a\x09\x0a\x09names := method methodClass allInstanceVariableNames.\x0a\x09selector := method selector.\x0a\x09\x0a\x09(selector last = ':')\x0a\x09\x09ifTrue: [ \x22selector might be a setter\x22\x0a\x09\x09\x09selector := selector allButLast ].\x0a\x09\x0a\x09(names includes: selector)\x0a\x09\x09ifFalse: [ ^ false ].\x0a\x09\x09\x0a\x09method protocol: 'accessing'.\x0a\x09^ true.",
  191. referencedClasses: [],
  192. //>>excludeEnd("ide");
  193. messageSends: ["allInstanceVariableNames", "methodClass", "selector", "ifTrue:", "=", "last", "allButLast", "ifFalse:", "includes:", "protocol:"]
  194. }),
  195. $globals.HLAccessorClassifier);
  196. $core.addClass('HLImplementorClassifier', $globals.HLClassifier, [], 'Helios-Helpers');
  197. //>>excludeStart("ide", pragmas.excludeIdeData);
  198. $globals.HLImplementorClassifier.comment="I am a classifier checking the other implementations of the same selector and choose the protocol the most populated.";
  199. //>>excludeEnd("ide");
  200. $core.addMethod(
  201. $core.method({
  202. selector: "doClassify",
  203. protocol: 'private',
  204. fn: function (){
  205. var self=this;
  206. var currentClass;
  207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  208. return $core.withContext(function($ctx1) {
  209. //>>excludeEnd("ctx");
  210. var $1,$3,$4,$2;
  211. var $early={};
  212. try {
  213. currentClass=$recv(self["@method"])._methodClass();
  214. $recv((function(){
  215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  216. return $core.withContext(function($ctx2) {
  217. //>>excludeEnd("ctx");
  218. $1=$recv(currentClass)._superclass();
  219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  220. $ctx2.sendIdx["superclass"]=1;
  221. //>>excludeEnd("ctx");
  222. return $recv($1)._isNil();
  223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  225. //>>excludeEnd("ctx");
  226. }))._whileFalse_((function(){
  227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  228. return $core.withContext(function($ctx2) {
  229. //>>excludeEnd("ctx");
  230. currentClass=$recv(currentClass)._superclass();
  231. currentClass;
  232. $3=currentClass;
  233. $4=$recv(self["@method"])._selector();
  234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  235. $ctx2.sendIdx["selector"]=1;
  236. //>>excludeEnd("ctx");
  237. $2=$recv($3)._includesSelector_($4);
  238. if($core.assert($2)){
  239. $recv(self["@method"])._protocol_($recv($recv(currentClass).__gt_gt($recv(self["@method"])._selector()))._protocol());
  240. throw $early=[true];
  241. };
  242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  244. //>>excludeEnd("ctx");
  245. }));
  246. return false;
  247. }
  248. catch(e) {if(e===$early)return e[0]; throw e}
  249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  250. }, function($ctx1) {$ctx1.fill(self,"doClassify",{currentClass:currentClass},$globals.HLImplementorClassifier)});
  251. //>>excludeEnd("ctx");
  252. },
  253. //>>excludeStart("ide", pragmas.excludeIdeData);
  254. args: [],
  255. source: "doClassify\x0a\x09| currentClass |\x0a\x09currentClass := method methodClass.\x0a\x09\x0a\x09[ currentClass superclass isNil ] whileFalse: [\x0a\x09\x09currentClass := currentClass superclass.\x0a\x09\x09(currentClass includesSelector: method selector)\x0a\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09method protocol: (currentClass >> method selector) protocol.\x0a\x09\x09\x09\x09^ true ]].\x0a\x09\x0a\x09^ false.",
  256. referencedClasses: [],
  257. //>>excludeEnd("ide");
  258. messageSends: ["methodClass", "whileFalse:", "isNil", "superclass", "ifTrue:", "includesSelector:", "selector", "protocol:", "protocol", ">>"]
  259. }),
  260. $globals.HLImplementorClassifier);
  261. $core.addClass('HLPrefixClassifier', $globals.HLClassifier, ['prefixMapping'], 'Helios-Helpers');
  262. //>>excludeStart("ide", pragmas.excludeIdeData);
  263. $globals.HLPrefixClassifier.comment="I am classifier checking the method selector to know if it begins with a known prefix.";
  264. //>>excludeEnd("ide");
  265. $core.addMethod(
  266. $core.method({
  267. selector: "buildPrefixDictionary",
  268. protocol: 'initialization',
  269. fn: function (){
  270. var self=this;
  271. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  273. return $core.withContext(function($ctx1) {
  274. //>>excludeEnd("ctx");
  275. var $1,$2;
  276. self["@prefixMapping"]=$recv($Dictionary())._new();
  277. $1=self["@prefixMapping"];
  278. $recv($1)._at_put_("test","tests");
  279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  280. $ctx1.sendIdx["at:put:"]=1;
  281. //>>excludeEnd("ctx");
  282. $recv($1)._at_put_("bench","benchmarking");
  283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  284. $ctx1.sendIdx["at:put:"]=2;
  285. //>>excludeEnd("ctx");
  286. $recv($1)._at_put_("copy","copying");
  287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  288. $ctx1.sendIdx["at:put:"]=3;
  289. //>>excludeEnd("ctx");
  290. $recv($1)._at_put_("initialize","initialization");
  291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  292. $ctx1.sendIdx["at:put:"]=4;
  293. //>>excludeEnd("ctx");
  294. $recv($1)._at_put_("accept","visitor");
  295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  296. $ctx1.sendIdx["at:put:"]=5;
  297. //>>excludeEnd("ctx");
  298. $recv($1)._at_put_("visit","visitor");
  299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  300. $ctx1.sendIdx["at:put:"]=6;
  301. //>>excludeEnd("ctx");
  302. $recv($1)._at_put_("signal","signalling");
  303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  304. $ctx1.sendIdx["at:put:"]=7;
  305. //>>excludeEnd("ctx");
  306. $recv($1)._at_put_("parse","parsing");
  307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  308. $ctx1.sendIdx["at:put:"]=8;
  309. //>>excludeEnd("ctx");
  310. $recv($1)._at_put_("add","adding");
  311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  312. $ctx1.sendIdx["at:put:"]=9;
  313. //>>excludeEnd("ctx");
  314. $recv($1)._at_put_("is","testing");
  315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  316. $ctx1.sendIdx["at:put:"]=10;
  317. //>>excludeEnd("ctx");
  318. $recv($1)._at_put_("as","converting");
  319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  320. $ctx1.sendIdx["at:put:"]=11;
  321. //>>excludeEnd("ctx");
  322. $2=$recv($1)._at_put_("new","instance creation");
  323. return self;
  324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  325. }, function($ctx1) {$ctx1.fill(self,"buildPrefixDictionary",{},$globals.HLPrefixClassifier)});
  326. //>>excludeEnd("ctx");
  327. },
  328. //>>excludeStart("ide", pragmas.excludeIdeData);
  329. args: [],
  330. source: "buildPrefixDictionary\x0a\x09prefixMapping := Dictionary new.\x0a\x09prefixMapping \x0a\x09\x09at: 'test' put: 'tests';\x0a\x09 \x09at: 'bench' put: 'benchmarking';\x0a\x09 \x09at: 'copy' put: 'copying';\x0a\x09\x09at: 'initialize' put: 'initialization';\x0a\x09\x09at: 'accept' put: 'visitor';\x0a\x09\x09at: 'visit' put: 'visitor';\x0a\x09\x09at: 'signal' put: 'signalling';\x0a\x09\x09at: 'parse' put: 'parsing';\x0a\x09\x09at: 'add' put: 'adding';\x0a\x09\x09at: 'is' put: 'testing';\x0a\x09\x09at: 'as' put: 'converting';\x0a\x09\x09at: 'new' put: 'instance creation'.",
  331. referencedClasses: ["Dictionary"],
  332. //>>excludeEnd("ide");
  333. messageSends: ["new", "at:put:"]
  334. }),
  335. $globals.HLPrefixClassifier);
  336. $core.addMethod(
  337. $core.method({
  338. selector: "doClassify",
  339. protocol: 'private',
  340. fn: function (){
  341. var self=this;
  342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  343. return $core.withContext(function($ctx1) {
  344. //>>excludeEnd("ctx");
  345. var $1;
  346. var $early={};
  347. try {
  348. $recv(self["@prefixMapping"])._keysAndValuesDo_((function(prefix,protocol){
  349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  350. return $core.withContext(function($ctx2) {
  351. //>>excludeEnd("ctx");
  352. $1=$recv($recv(self["@method"])._selector())._beginsWith_(prefix);
  353. if($core.assert($1)){
  354. $recv(self["@method"])._protocol_(protocol);
  355. throw $early=[true];
  356. };
  357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  358. }, function($ctx2) {$ctx2.fillBlock({prefix:prefix,protocol:protocol},$ctx1,1)});
  359. //>>excludeEnd("ctx");
  360. }));
  361. return false;
  362. }
  363. catch(e) {if(e===$early)return e[0]; throw e}
  364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  365. }, function($ctx1) {$ctx1.fill(self,"doClassify",{},$globals.HLPrefixClassifier)});
  366. //>>excludeEnd("ctx");
  367. },
  368. //>>excludeStart("ide", pragmas.excludeIdeData);
  369. args: [],
  370. source: "doClassify\x0a\x09prefixMapping keysAndValuesDo: [ :prefix :protocol |\x0a\x09\x09(method selector beginsWith: prefix)\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09method protocol: protocol.\x0a\x09\x09\x09\x09^ true ]].\x0a\x09^ false.",
  371. referencedClasses: [],
  372. //>>excludeEnd("ide");
  373. messageSends: ["keysAndValuesDo:", "ifTrue:", "beginsWith:", "selector", "protocol:"]
  374. }),
  375. $globals.HLPrefixClassifier);
  376. $core.addMethod(
  377. $core.method({
  378. selector: "initialize",
  379. protocol: 'initialization',
  380. fn: function (){
  381. var self=this;
  382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  383. return $core.withContext(function($ctx1) {
  384. //>>excludeEnd("ctx");
  385. (
  386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  387. $ctx1.supercall = true,
  388. //>>excludeEnd("ctx");
  389. $globals.HLPrefixClassifier.superclass.fn.prototype._initialize.apply($recv(self), []));
  390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  391. $ctx1.supercall = false;
  392. //>>excludeEnd("ctx");;
  393. self._buildPrefixDictionary();
  394. return self;
  395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  396. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.HLPrefixClassifier)});
  397. //>>excludeEnd("ctx");
  398. },
  399. //>>excludeStart("ide", pragmas.excludeIdeData);
  400. args: [],
  401. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09self buildPrefixDictionary",
  402. referencedClasses: [],
  403. //>>excludeEnd("ide");
  404. messageSends: ["initialize", "buildPrefixDictionary"]
  405. }),
  406. $globals.HLPrefixClassifier);
  407. $core.addClass('HLSuperclassClassifier', $globals.HLClassifier, [], 'Helios-Helpers');
  408. //>>excludeStart("ide", pragmas.excludeIdeData);
  409. $globals.HLSuperclassClassifier.comment="I am a classifier checking the superclass chain to find a matching selector.";
  410. //>>excludeEnd("ide");
  411. $core.addMethod(
  412. $core.method({
  413. selector: "doClassify",
  414. protocol: 'private',
  415. fn: function (){
  416. var self=this;
  417. var protocolBag,methods,protocolToUse,counter;
  418. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  419. function $HLReferencesModel(){return $globals.HLReferencesModel||(typeof HLReferencesModel=="undefined"?nil:HLReferencesModel)}
  420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  421. return $core.withContext(function($ctx1) {
  422. //>>excludeEnd("ctx");
  423. var $2,$1,$4,$3,$5;
  424. var $early={};
  425. try {
  426. protocolBag=$recv($Dictionary())._new();
  427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  428. $ctx1.sendIdx["new"]=1;
  429. //>>excludeEnd("ctx");
  430. methods=$recv($recv($HLReferencesModel())._new())._implementorsOf_($recv(self["@method"])._selector());
  431. $recv(methods)._ifEmpty_ifNotEmpty_((function(){
  432. throw $early=[false];
  433. }),(function(){
  434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  435. return $core.withContext(function($ctx2) {
  436. //>>excludeEnd("ctx");
  437. return $recv(methods)._do_((function(aMethod){
  438. var protocol;
  439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  440. return $core.withContext(function($ctx3) {
  441. //>>excludeEnd("ctx");
  442. protocol=$recv($recv(aMethod)._method())._protocol();
  443. protocol;
  444. $2=$recv(self["@method"])._methodClass();
  445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  446. $ctx3.sendIdx["methodClass"]=1;
  447. //>>excludeEnd("ctx");
  448. $1=$recv($2).__eq($recv(aMethod)._methodClass());
  449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  450. $ctx3.sendIdx["="]=1;
  451. //>>excludeEnd("ctx");
  452. if(!$core.assert($1)){
  453. $4=$recv($recv(protocol)._first()).__eq("*");
  454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  455. $ctx3.sendIdx["="]=2;
  456. //>>excludeEnd("ctx");
  457. $3=$recv($4)._or_((function(){
  458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  459. return $core.withContext(function($ctx4) {
  460. //>>excludeEnd("ctx");
  461. return $recv(protocol).__eq($recv(self["@method"])._defaultProtocol());
  462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  463. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  464. //>>excludeEnd("ctx");
  465. }));
  466. if(!$core.assert($3)){
  467. return $recv(protocolBag)._at_put_(protocol,$recv($recv(protocolBag)._at_ifAbsent_(protocol,(function(){
  468. return (0);
  469. }))).__plus((1)));
  470. };
  471. };
  472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  473. }, function($ctx3) {$ctx3.fillBlock({aMethod:aMethod,protocol:protocol},$ctx2,3)});
  474. //>>excludeEnd("ctx");
  475. }));
  476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  478. //>>excludeEnd("ctx");
  479. }));
  480. $recv(protocolBag)._ifEmpty_((function(){
  481. throw $early=[false];
  482. }));
  483. protocolToUse=nil;
  484. counter=(0);
  485. $recv(protocolBag)._keysAndValuesDo_((function(key,value){
  486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  487. return $core.withContext(function($ctx2) {
  488. //>>excludeEnd("ctx");
  489. $5=$recv(value).__gt(counter);
  490. if($core.assert($5)){
  491. counter=value;
  492. counter;
  493. protocolToUse=key;
  494. return protocolToUse;
  495. };
  496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  497. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,9)});
  498. //>>excludeEnd("ctx");
  499. }));
  500. $recv(self["@method"])._protocol_(protocolToUse);
  501. return true;
  502. }
  503. catch(e) {if(e===$early)return e[0]; throw e}
  504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  505. }, function($ctx1) {$ctx1.fill(self,"doClassify",{protocolBag:protocolBag,methods:methods,protocolToUse:protocolToUse,counter:counter},$globals.HLSuperclassClassifier)});
  506. //>>excludeEnd("ctx");
  507. },
  508. //>>excludeStart("ide", pragmas.excludeIdeData);
  509. args: [],
  510. source: "doClassify\x0a\x09| protocolBag methods protocolToUse counter |\x0a\x09\x0a\x09protocolBag := Dictionary new.\x0a\x09methods := HLReferencesModel new implementorsOf: method selector.\x0a\x09methods\x0a\x09\x09ifEmpty: [ ^ false ]\x0a\x09\x09ifNotEmpty: [\x0a\x09\x09\x09methods \x0a\x09\x09\x09\x09do: [ :aMethod || protocol |\x0a\x09\x09\x09\x09\x09protocol := aMethod method protocol.\x0a\x09\x09\x09\x09\x09(method methodClass = aMethod methodClass)\x0a\x09\x09\x09\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09\x09\x09((protocol first = '*') or: [ protocol = method defaultProtocol ])\x0a\x09\x09\x09\x09\x09\x09\x09ifFalse: [ \x0a\x09\x09\x09\x09\x09\x09\x09\x09protocolBag \x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09at: protocol \x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09put: (protocolBag at: protocol ifAbsent: [ 0 ]) + 1 ] ] ] ].\x0a\x09\x09\x09\x0a\x09protocolBag ifEmpty: [ ^ false ].\x0a\x09protocolToUse := nil.\x0a\x09counter := 0.\x0a\x09protocolBag keysAndValuesDo: [ :key :value | value > counter \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09counter := value.\x0a\x09\x09\x09protocolToUse := key ] ].\x0a\x09method protocol: protocolToUse.\x0a\x09^ true",
  511. referencedClasses: ["Dictionary", "HLReferencesModel"],
  512. //>>excludeEnd("ide");
  513. messageSends: ["new", "implementorsOf:", "selector", "ifEmpty:ifNotEmpty:", "do:", "protocol", "method", "ifFalse:", "=", "methodClass", "or:", "first", "defaultProtocol", "at:put:", "+", "at:ifAbsent:", "ifEmpty:", "keysAndValuesDo:", "ifTrue:", ">", "protocol:"]
  514. }),
  515. $globals.HLSuperclassClassifier);
  516. $core.addClass('HLGenerationOutput', $globals.Object, ['sourceCodes', 'protocol', 'targetClass'], 'Helios-Helpers');
  517. //>>excludeStart("ide", pragmas.excludeIdeData);
  518. $globals.HLGenerationOutput.comment="I am a simple data object used to store the result of a generation process.";
  519. //>>excludeEnd("ide");
  520. $core.addMethod(
  521. $core.method({
  522. selector: "addSourceCode:",
  523. protocol: 'protocol',
  524. fn: function (aString){
  525. var self=this;
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. return $core.withContext(function($ctx1) {
  528. //>>excludeEnd("ctx");
  529. $recv(self["@sourceCodes"])._add_(aString);
  530. return self;
  531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  532. }, function($ctx1) {$ctx1.fill(self,"addSourceCode:",{aString:aString},$globals.HLGenerationOutput)});
  533. //>>excludeEnd("ctx");
  534. },
  535. //>>excludeStart("ide", pragmas.excludeIdeData);
  536. args: ["aString"],
  537. source: "addSourceCode: aString\x0a\x09sourceCodes add: aString",
  538. referencedClasses: [],
  539. //>>excludeEnd("ide");
  540. messageSends: ["add:"]
  541. }),
  542. $globals.HLGenerationOutput);
  543. $core.addMethod(
  544. $core.method({
  545. selector: "compile",
  546. protocol: 'protocol',
  547. fn: function (){
  548. var self=this;
  549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  550. return $core.withContext(function($ctx1) {
  551. //>>excludeEnd("ctx");
  552. var $1;
  553. $recv(self["@sourceCodes"])._do_((function(methodSourceCode){
  554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  555. return $core.withContext(function($ctx2) {
  556. //>>excludeEnd("ctx");
  557. $1=$recv(self["@targetClass"])._includesSelector_($recv(methodSourceCode)._selector());
  558. if(!$core.assert($1)){
  559. return $recv(self["@targetClass"])._compile_protocol_($recv(methodSourceCode)._sourceCode(),self["@protocol"]);
  560. };
  561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  562. }, function($ctx2) {$ctx2.fillBlock({methodSourceCode:methodSourceCode},$ctx1,1)});
  563. //>>excludeEnd("ctx");
  564. }));
  565. return self;
  566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  567. }, function($ctx1) {$ctx1.fill(self,"compile",{},$globals.HLGenerationOutput)});
  568. //>>excludeEnd("ctx");
  569. },
  570. //>>excludeStart("ide", pragmas.excludeIdeData);
  571. args: [],
  572. source: "compile\x0a\x09sourceCodes do: [ :methodSourceCode |\x0a\x09\x09(targetClass includesSelector: methodSourceCode selector)\x0a\x09\x09\x09ifFalse: [ \x0a\x09\x09\x09\x09targetClass \x0a\x09\x09\x09\x09\x09compile: methodSourceCode sourceCode\x0a\x09\x09\x09\x09\x09protocol: protocol ] ]",
  573. referencedClasses: [],
  574. //>>excludeEnd("ide");
  575. messageSends: ["do:", "ifFalse:", "includesSelector:", "selector", "compile:protocol:", "sourceCode"]
  576. }),
  577. $globals.HLGenerationOutput);
  578. $core.addMethod(
  579. $core.method({
  580. selector: "initialize",
  581. protocol: 'initialization',
  582. fn: function (){
  583. var self=this;
  584. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  586. return $core.withContext(function($ctx1) {
  587. //>>excludeEnd("ctx");
  588. (
  589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  590. $ctx1.supercall = true,
  591. //>>excludeEnd("ctx");
  592. $globals.HLGenerationOutput.superclass.fn.prototype._initialize.apply($recv(self), []));
  593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  594. $ctx1.supercall = false;
  595. //>>excludeEnd("ctx");;
  596. self["@sourceCodes"]=$recv($OrderedCollection())._new();
  597. return self;
  598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  599. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.HLGenerationOutput)});
  600. //>>excludeEnd("ctx");
  601. },
  602. //>>excludeStart("ide", pragmas.excludeIdeData);
  603. args: [],
  604. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09sourceCodes := OrderedCollection new",
  605. referencedClasses: ["OrderedCollection"],
  606. //>>excludeEnd("ide");
  607. messageSends: ["initialize", "new"]
  608. }),
  609. $globals.HLGenerationOutput);
  610. $core.addMethod(
  611. $core.method({
  612. selector: "protocol",
  613. protocol: 'accessing',
  614. fn: function (){
  615. var self=this;
  616. var $1;
  617. $1=self["@protocol"];
  618. return $1;
  619. },
  620. //>>excludeStart("ide", pragmas.excludeIdeData);
  621. args: [],
  622. source: "protocol\x0a\x09^ protocol",
  623. referencedClasses: [],
  624. //>>excludeEnd("ide");
  625. messageSends: []
  626. }),
  627. $globals.HLGenerationOutput);
  628. $core.addMethod(
  629. $core.method({
  630. selector: "protocol:",
  631. protocol: 'accessing',
  632. fn: function (aString){
  633. var self=this;
  634. self["@protocol"]=aString;
  635. return self;
  636. },
  637. //>>excludeStart("ide", pragmas.excludeIdeData);
  638. args: ["aString"],
  639. source: "protocol: aString\x0a\x09protocol := aString",
  640. referencedClasses: [],
  641. //>>excludeEnd("ide");
  642. messageSends: []
  643. }),
  644. $globals.HLGenerationOutput);
  645. $core.addMethod(
  646. $core.method({
  647. selector: "sourceCodes",
  648. protocol: 'accessing',
  649. fn: function (){
  650. var self=this;
  651. var $1;
  652. $1=self["@sourceCodes"];
  653. return $1;
  654. },
  655. //>>excludeStart("ide", pragmas.excludeIdeData);
  656. args: [],
  657. source: "sourceCodes\x0a\x09^ sourceCodes",
  658. referencedClasses: [],
  659. //>>excludeEnd("ide");
  660. messageSends: []
  661. }),
  662. $globals.HLGenerationOutput);
  663. $core.addMethod(
  664. $core.method({
  665. selector: "sourceCodes:",
  666. protocol: 'accessing',
  667. fn: function (aCollection){
  668. var self=this;
  669. self["@sourceCodes"]=aCollection;
  670. return self;
  671. },
  672. //>>excludeStart("ide", pragmas.excludeIdeData);
  673. args: ["aCollection"],
  674. source: "sourceCodes: aCollection\x0a\x09sourceCodes := aCollection",
  675. referencedClasses: [],
  676. //>>excludeEnd("ide");
  677. messageSends: []
  678. }),
  679. $globals.HLGenerationOutput);
  680. $core.addMethod(
  681. $core.method({
  682. selector: "targetClass",
  683. protocol: 'accessing',
  684. fn: function (){
  685. var self=this;
  686. var $1;
  687. $1=self["@targetClass"];
  688. return $1;
  689. },
  690. //>>excludeStart("ide", pragmas.excludeIdeData);
  691. args: [],
  692. source: "targetClass\x0a\x09^ targetClass",
  693. referencedClasses: [],
  694. //>>excludeEnd("ide");
  695. messageSends: []
  696. }),
  697. $globals.HLGenerationOutput);
  698. $core.addMethod(
  699. $core.method({
  700. selector: "targetClass:",
  701. protocol: 'accessing',
  702. fn: function (aClass){
  703. var self=this;
  704. self["@targetClass"]=aClass;
  705. return self;
  706. },
  707. //>>excludeStart("ide", pragmas.excludeIdeData);
  708. args: ["aClass"],
  709. source: "targetClass: aClass\x0a\x09targetClass := aClass",
  710. referencedClasses: [],
  711. //>>excludeEnd("ide");
  712. messageSends: []
  713. }),
  714. $globals.HLGenerationOutput);
  715. $core.addClass('HLMethodClassifier', $globals.Object, ['firstClassifier'], 'Helios-Helpers');
  716. //>>excludeStart("ide", pragmas.excludeIdeData);
  717. $globals.HLMethodClassifier.comment="I am in charge of categorizing methods following this strategy:\x0a\x0a- is it an accessor?\x0a- is it overriding a superclass method?\x0a- is it starting with a know prefix?\x0a- how are categorized the other implementations?";
  718. //>>excludeEnd("ide");
  719. $core.addMethod(
  720. $core.method({
  721. selector: "addClassifier:",
  722. protocol: 'private',
  723. fn: function (aClassifier){
  724. var self=this;
  725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  726. return $core.withContext(function($ctx1) {
  727. //>>excludeEnd("ctx");
  728. $recv(aClassifier)._next_(self["@firstClassifier"]);
  729. self["@firstClassifier"]=aClassifier;
  730. return self;
  731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  732. }, function($ctx1) {$ctx1.fill(self,"addClassifier:",{aClassifier:aClassifier},$globals.HLMethodClassifier)});
  733. //>>excludeEnd("ctx");
  734. },
  735. //>>excludeStart("ide", pragmas.excludeIdeData);
  736. args: ["aClassifier"],
  737. source: "addClassifier: aClassifier\x0a\x09aClassifier next: firstClassifier.\x0a\x09firstClassifier := aClassifier",
  738. referencedClasses: [],
  739. //>>excludeEnd("ide");
  740. messageSends: ["next:"]
  741. }),
  742. $globals.HLMethodClassifier);
  743. $core.addMethod(
  744. $core.method({
  745. selector: "classify:",
  746. protocol: 'protocol',
  747. fn: function (aMethod){
  748. var self=this;
  749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  750. return $core.withContext(function($ctx1) {
  751. //>>excludeEnd("ctx");
  752. var $1,$2;
  753. $1=self["@firstClassifier"];
  754. $recv($1)._method_(aMethod);
  755. $2=$recv($1)._classify();
  756. return self;
  757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  758. }, function($ctx1) {$ctx1.fill(self,"classify:",{aMethod:aMethod},$globals.HLMethodClassifier)});
  759. //>>excludeEnd("ctx");
  760. },
  761. //>>excludeStart("ide", pragmas.excludeIdeData);
  762. args: ["aMethod"],
  763. source: "classify: aMethod\x0a\x09firstClassifier\x0a\x09\x09method: aMethod;\x0a\x09\x09classify",
  764. referencedClasses: [],
  765. //>>excludeEnd("ide");
  766. messageSends: ["method:", "classify"]
  767. }),
  768. $globals.HLMethodClassifier);
  769. $core.addMethod(
  770. $core.method({
  771. selector: "classifyAll:",
  772. protocol: 'protocol',
  773. fn: function (aCollectionOfMethods){
  774. var self=this;
  775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  776. return $core.withContext(function($ctx1) {
  777. //>>excludeEnd("ctx");
  778. $recv(aCollectionOfMethods)._do_((function(method){
  779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  780. return $core.withContext(function($ctx2) {
  781. //>>excludeEnd("ctx");
  782. return self._classify_(method);
  783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  784. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  785. //>>excludeEnd("ctx");
  786. }));
  787. return self;
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. }, function($ctx1) {$ctx1.fill(self,"classifyAll:",{aCollectionOfMethods:aCollectionOfMethods},$globals.HLMethodClassifier)});
  790. //>>excludeEnd("ctx");
  791. },
  792. //>>excludeStart("ide", pragmas.excludeIdeData);
  793. args: ["aCollectionOfMethods"],
  794. source: "classifyAll: aCollectionOfMethods\x0a\x09aCollectionOfMethods do: [ :method |\x0a\x09\x09self classify: method ]",
  795. referencedClasses: [],
  796. //>>excludeEnd("ide");
  797. messageSends: ["do:", "classify:"]
  798. }),
  799. $globals.HLMethodClassifier);
  800. $core.addMethod(
  801. $core.method({
  802. selector: "initialize",
  803. protocol: 'initialization',
  804. fn: function (){
  805. var self=this;
  806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  807. return $core.withContext(function($ctx1) {
  808. //>>excludeEnd("ctx");
  809. (
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. $ctx1.supercall = true,
  812. //>>excludeEnd("ctx");
  813. $globals.HLMethodClassifier.superclass.fn.prototype._initialize.apply($recv(self), []));
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. $ctx1.supercall = false;
  816. //>>excludeEnd("ctx");;
  817. self._setupClassifiers();
  818. return self;
  819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  820. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.HLMethodClassifier)});
  821. //>>excludeEnd("ctx");
  822. },
  823. //>>excludeStart("ide", pragmas.excludeIdeData);
  824. args: [],
  825. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09self setupClassifiers",
  826. referencedClasses: [],
  827. //>>excludeEnd("ide");
  828. messageSends: ["initialize", "setupClassifiers"]
  829. }),
  830. $globals.HLMethodClassifier);
  831. $core.addMethod(
  832. $core.method({
  833. selector: "setupClassifiers",
  834. protocol: 'initialization',
  835. fn: function (){
  836. var self=this;
  837. function $HLImplementorClassifier(){return $globals.HLImplementorClassifier||(typeof HLImplementorClassifier=="undefined"?nil:HLImplementorClassifier)}
  838. function $HLPrefixClassifier(){return $globals.HLPrefixClassifier||(typeof HLPrefixClassifier=="undefined"?nil:HLPrefixClassifier)}
  839. function $HLSuperclassClassifier(){return $globals.HLSuperclassClassifier||(typeof HLSuperclassClassifier=="undefined"?nil:HLSuperclassClassifier)}
  840. function $HLAccessorClassifier(){return $globals.HLAccessorClassifier||(typeof HLAccessorClassifier=="undefined"?nil:HLAccessorClassifier)}
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. return $core.withContext(function($ctx1) {
  843. //>>excludeEnd("ctx");
  844. var $1,$2,$3;
  845. $1=$recv($HLImplementorClassifier())._new();
  846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  847. $ctx1.sendIdx["new"]=1;
  848. //>>excludeEnd("ctx");
  849. self._addClassifier_($1);
  850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  851. $ctx1.sendIdx["addClassifier:"]=1;
  852. //>>excludeEnd("ctx");
  853. $2=$recv($HLPrefixClassifier())._new();
  854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  855. $ctx1.sendIdx["new"]=2;
  856. //>>excludeEnd("ctx");
  857. self._addClassifier_($2);
  858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  859. $ctx1.sendIdx["addClassifier:"]=2;
  860. //>>excludeEnd("ctx");
  861. $3=$recv($HLSuperclassClassifier())._new();
  862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  863. $ctx1.sendIdx["new"]=3;
  864. //>>excludeEnd("ctx");
  865. self._addClassifier_($3);
  866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  867. $ctx1.sendIdx["addClassifier:"]=3;
  868. //>>excludeEnd("ctx");
  869. self._addClassifier_($recv($HLAccessorClassifier())._new());
  870. return self;
  871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  872. }, function($ctx1) {$ctx1.fill(self,"setupClassifiers",{},$globals.HLMethodClassifier)});
  873. //>>excludeEnd("ctx");
  874. },
  875. //>>excludeStart("ide", pragmas.excludeIdeData);
  876. args: [],
  877. source: "setupClassifiers\x0a\x09self addClassifier: HLImplementorClassifier new.\x0a\x09self addClassifier: HLPrefixClassifier new.\x0a\x09self addClassifier: HLSuperclassClassifier new.\x0a\x09self addClassifier: HLAccessorClassifier new",
  878. referencedClasses: ["HLImplementorClassifier", "HLPrefixClassifier", "HLSuperclassClassifier", "HLAccessorClassifier"],
  879. //>>excludeEnd("ide");
  880. messageSends: ["addClassifier:", "new"]
  881. }),
  882. $globals.HLMethodClassifier);
  883. $core.addClass('HLMethodGenerator', $globals.Object, ['output'], 'Helios-Helpers');
  884. //>>excludeStart("ide", pragmas.excludeIdeData);
  885. $globals.HLMethodGenerator.comment="I am the abstract super class of the method generators.\x0a\x0aMy main method is `generate` which produces an `output` object accessed with `#output`.";
  886. //>>excludeEnd("ide");
  887. $core.addMethod(
  888. $core.method({
  889. selector: "class:",
  890. protocol: 'accessing',
  891. fn: function (aClass){
  892. var self=this;
  893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  894. return $core.withContext(function($ctx1) {
  895. //>>excludeEnd("ctx");
  896. $recv(self["@output"])._targetClass_(aClass);
  897. return self;
  898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  899. }, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},$globals.HLMethodGenerator)});
  900. //>>excludeEnd("ctx");
  901. },
  902. //>>excludeStart("ide", pragmas.excludeIdeData);
  903. args: ["aClass"],
  904. source: "class: aClass\x0a\x09output targetClass: aClass",
  905. referencedClasses: [],
  906. //>>excludeEnd("ide");
  907. messageSends: ["targetClass:"]
  908. }),
  909. $globals.HLMethodGenerator);
  910. $core.addMethod(
  911. $core.method({
  912. selector: "generate",
  913. protocol: 'protocol',
  914. fn: function (){
  915. var self=this;
  916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  917. return $core.withContext(function($ctx1) {
  918. //>>excludeEnd("ctx");
  919. var $1,$receiver;
  920. $1=$recv(self["@output"])._targetClass();
  921. if(($receiver = $1) == null || $receiver.isNil){
  922. self._error_("class should not be nil");
  923. } else {
  924. $1;
  925. };
  926. return self;
  927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  928. }, function($ctx1) {$ctx1.fill(self,"generate",{},$globals.HLMethodGenerator)});
  929. //>>excludeEnd("ctx");
  930. },
  931. //>>excludeStart("ide", pragmas.excludeIdeData);
  932. args: [],
  933. source: "generate\x0a\x09output targetClass ifNil: [ self error: 'class should not be nil'].",
  934. referencedClasses: [],
  935. //>>excludeEnd("ide");
  936. messageSends: ["ifNil:", "targetClass", "error:"]
  937. }),
  938. $globals.HLMethodGenerator);
  939. $core.addMethod(
  940. $core.method({
  941. selector: "initialize",
  942. protocol: 'initialization',
  943. fn: function (){
  944. var self=this;
  945. function $HLGenerationOutput(){return $globals.HLGenerationOutput||(typeof HLGenerationOutput=="undefined"?nil:HLGenerationOutput)}
  946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  947. return $core.withContext(function($ctx1) {
  948. //>>excludeEnd("ctx");
  949. (
  950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  951. $ctx1.supercall = true,
  952. //>>excludeEnd("ctx");
  953. $globals.HLMethodGenerator.superclass.fn.prototype._initialize.apply($recv(self), []));
  954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  955. $ctx1.supercall = false;
  956. //>>excludeEnd("ctx");;
  957. self["@output"]=$recv($HLGenerationOutput())._new();
  958. return self;
  959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  960. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.HLMethodGenerator)});
  961. //>>excludeEnd("ctx");
  962. },
  963. //>>excludeStart("ide", pragmas.excludeIdeData);
  964. args: [],
  965. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09output := HLGenerationOutput new",
  966. referencedClasses: ["HLGenerationOutput"],
  967. //>>excludeEnd("ide");
  968. messageSends: ["initialize", "new"]
  969. }),
  970. $globals.HLMethodGenerator);
  971. $core.addMethod(
  972. $core.method({
  973. selector: "output",
  974. protocol: 'accessing',
  975. fn: function (){
  976. var self=this;
  977. var $1;
  978. $1=self["@output"];
  979. return $1;
  980. },
  981. //>>excludeStart("ide", pragmas.excludeIdeData);
  982. args: [],
  983. source: "output\x0a\x09^ output",
  984. referencedClasses: [],
  985. //>>excludeEnd("ide");
  986. messageSends: []
  987. }),
  988. $globals.HLMethodGenerator);
  989. $core.addClass('HLAccessorsGenerator', $globals.HLMethodGenerator, [], 'Helios-Helpers');
  990. //>>excludeStart("ide", pragmas.excludeIdeData);
  991. $globals.HLAccessorsGenerator.comment="I am a generator used to compile the getters/setters of a class.";
  992. //>>excludeEnd("ide");
  993. $core.addMethod(
  994. $core.method({
  995. selector: "accessorProtocolForObject",
  996. protocol: 'double-dispatch',
  997. fn: function (){
  998. var self=this;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. return $core.withContext(function($ctx1) {
  1001. //>>excludeEnd("ctx");
  1002. $recv(self["@output"])._protocol_("accessing");
  1003. return self;
  1004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1005. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolForObject",{},$globals.HLAccessorsGenerator)});
  1006. //>>excludeEnd("ctx");
  1007. },
  1008. //>>excludeStart("ide", pragmas.excludeIdeData);
  1009. args: [],
  1010. source: "accessorProtocolForObject\x0a\x09output protocol: 'accessing'",
  1011. referencedClasses: [],
  1012. //>>excludeEnd("ide");
  1013. messageSends: ["protocol:"]
  1014. }),
  1015. $globals.HLAccessorsGenerator);
  1016. $core.addMethod(
  1017. $core.method({
  1018. selector: "accessorsForObject",
  1019. protocol: 'double-dispatch',
  1020. fn: function (){
  1021. var self=this;
  1022. var sources;
  1023. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1025. return $core.withContext(function($ctx1) {
  1026. //>>excludeEnd("ctx");
  1027. var $1,$2;
  1028. sources=$recv($OrderedCollection())._new();
  1029. $recv($recv($recv($recv(self["@output"])._targetClass())._instanceVariableNames())._sorted())._do_((function(each){
  1030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1031. return $core.withContext(function($ctx2) {
  1032. //>>excludeEnd("ctx");
  1033. $1=sources;
  1034. $recv($1)._add_(self._getterFor_(each));
  1035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1036. $ctx2.sendIdx["add:"]=1;
  1037. //>>excludeEnd("ctx");
  1038. $2=$recv($1)._add_(self._setterFor_(each));
  1039. return $2;
  1040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1042. //>>excludeEnd("ctx");
  1043. }));
  1044. $recv(self["@output"])._sourceCodes_(sources);
  1045. return self;
  1046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1047. }, function($ctx1) {$ctx1.fill(self,"accessorsForObject",{sources:sources},$globals.HLAccessorsGenerator)});
  1048. //>>excludeEnd("ctx");
  1049. },
  1050. //>>excludeStart("ide", pragmas.excludeIdeData);
  1051. args: [],
  1052. source: "accessorsForObject\x0a\x09| sources |\x0a\x09\x0a\x09sources := OrderedCollection new.\x0a\x09output targetClass instanceVariableNames sorted do: [ :each | \x0a\x09\x09sources \x0a\x09\x09\x09add: (self getterFor: each);\x0a\x09\x09\x09add: (self setterFor: each) ].\x0a\x09output sourceCodes: sources",
  1053. referencedClasses: ["OrderedCollection"],
  1054. //>>excludeEnd("ide");
  1055. messageSends: ["new", "do:", "sorted", "instanceVariableNames", "targetClass", "add:", "getterFor:", "setterFor:", "sourceCodes:"]
  1056. }),
  1057. $globals.HLAccessorsGenerator);
  1058. $core.addMethod(
  1059. $core.method({
  1060. selector: "generate",
  1061. protocol: 'protocol',
  1062. fn: function (){
  1063. var self=this;
  1064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1065. return $core.withContext(function($ctx1) {
  1066. //>>excludeEnd("ctx");
  1067. var $1,$2;
  1068. (
  1069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1070. $ctx1.supercall = true,
  1071. //>>excludeEnd("ctx");
  1072. $globals.HLAccessorsGenerator.superclass.fn.prototype._generate.apply($recv(self), []));
  1073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1074. $ctx1.supercall = false;
  1075. //>>excludeEnd("ctx");;
  1076. $1=$recv(self["@output"])._targetClass();
  1077. $recv($1)._accessorsSourceCodesWith_(self);
  1078. $2=$recv($1)._accessorProtocolWith_(self);
  1079. return self;
  1080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1081. }, function($ctx1) {$ctx1.fill(self,"generate",{},$globals.HLAccessorsGenerator)});
  1082. //>>excludeEnd("ctx");
  1083. },
  1084. //>>excludeStart("ide", pragmas.excludeIdeData);
  1085. args: [],
  1086. source: "generate\x0a\x09super generate.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09accessorsSourceCodesWith: self;\x0a\x09\x09accessorProtocolWith: self",
  1087. referencedClasses: [],
  1088. //>>excludeEnd("ide");
  1089. messageSends: ["generate", "accessorsSourceCodesWith:", "targetClass", "accessorProtocolWith:"]
  1090. }),
  1091. $globals.HLAccessorsGenerator);
  1092. $core.addMethod(
  1093. $core.method({
  1094. selector: "getterFor:",
  1095. protocol: 'private',
  1096. fn: function (anInstanceVariable){
  1097. var self=this;
  1098. function $HLMethodSourceCode(){return $globals.HLMethodSourceCode||(typeof HLMethodSourceCode=="undefined"?nil:HLMethodSourceCode)}
  1099. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1101. return $core.withContext(function($ctx1) {
  1102. //>>excludeEnd("ctx");
  1103. var $2,$3,$1;
  1104. $2=$recv($HLMethodSourceCode())._new();
  1105. $recv($2)._selector_(anInstanceVariable);
  1106. $3=$recv($2)._sourceCode_($recv($String())._streamContents_((function(stream){
  1107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1108. return $core.withContext(function($ctx2) {
  1109. //>>excludeEnd("ctx");
  1110. $recv(stream).__lt_lt(anInstanceVariable);
  1111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1112. $ctx2.sendIdx["<<"]=1;
  1113. //>>excludeEnd("ctx");
  1114. $recv($recv(stream)._cr())._tab();
  1115. return $recv($recv(stream).__lt_lt("^ ")).__lt_lt(anInstanceVariable);
  1116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1117. $ctx2.sendIdx["<<"]=2;
  1118. //>>excludeEnd("ctx");
  1119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1120. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1121. //>>excludeEnd("ctx");
  1122. })));
  1123. $1=$3;
  1124. return $1;
  1125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1126. }, function($ctx1) {$ctx1.fill(self,"getterFor:",{anInstanceVariable:anInstanceVariable},$globals.HLAccessorsGenerator)});
  1127. //>>excludeEnd("ctx");
  1128. },
  1129. //>>excludeStart("ide", pragmas.excludeIdeData);
  1130. args: ["anInstanceVariable"],
  1131. source: "getterFor: anInstanceVariable\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector:anInstanceVariable;\x0a\x09\x09sourceCode: (String streamContents: [ :stream |\x0a\x09\x09stream << anInstanceVariable.\x0a\x09\x09stream cr tab.\x0a\x09\x09stream << '^ ' << anInstanceVariable ])",
  1132. referencedClasses: ["HLMethodSourceCode", "String"],
  1133. //>>excludeEnd("ide");
  1134. messageSends: ["selector:", "new", "sourceCode:", "streamContents:", "<<", "tab", "cr"]
  1135. }),
  1136. $globals.HLAccessorsGenerator);
  1137. $core.addMethod(
  1138. $core.method({
  1139. selector: "setterFor:",
  1140. protocol: 'private',
  1141. fn: function (anInstanceVariable){
  1142. var self=this;
  1143. function $HLMethodSourceCode(){return $globals.HLMethodSourceCode||(typeof HLMethodSourceCode=="undefined"?nil:HLMethodSourceCode)}
  1144. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1146. return $core.withContext(function($ctx1) {
  1147. //>>excludeEnd("ctx");
  1148. var $2,$4,$3,$1;
  1149. $2=$recv($HLMethodSourceCode())._new();
  1150. $recv($2)._selector_($recv(anInstanceVariable).__comma(":"));
  1151. $3=$recv($2)._sourceCode_($recv($String())._streamContents_((function(stream){
  1152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1153. return $core.withContext(function($ctx2) {
  1154. //>>excludeEnd("ctx");
  1155. $4=$recv(stream).__lt_lt(anInstanceVariable);
  1156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1157. $ctx2.sendIdx["<<"]=2;
  1158. //>>excludeEnd("ctx");
  1159. $recv($4).__lt_lt(": anObject");
  1160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1161. $ctx2.sendIdx["<<"]=1;
  1162. //>>excludeEnd("ctx");
  1163. $recv($recv(stream)._cr())._tab();
  1164. return $recv($recv(stream).__lt_lt(anInstanceVariable)).__lt_lt(" := anObject");
  1165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1166. $ctx2.sendIdx["<<"]=3;
  1167. //>>excludeEnd("ctx");
  1168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1169. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1170. //>>excludeEnd("ctx");
  1171. })));
  1172. $1=$3;
  1173. return $1;
  1174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1175. }, function($ctx1) {$ctx1.fill(self,"setterFor:",{anInstanceVariable:anInstanceVariable},$globals.HLAccessorsGenerator)});
  1176. //>>excludeEnd("ctx");
  1177. },
  1178. //>>excludeStart("ide", pragmas.excludeIdeData);
  1179. args: ["anInstanceVariable"],
  1180. source: "setterFor: anInstanceVariable\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector: anInstanceVariable, ':';\x0a\x09\x09sourceCode: (String streamContents: [ :stream |\x0a\x09\x09stream << anInstanceVariable << ': anObject'.\x0a\x09\x09stream cr tab.\x0a\x09\x09stream << anInstanceVariable << ' := anObject' ])",
  1181. referencedClasses: ["HLMethodSourceCode", "String"],
  1182. //>>excludeEnd("ide");
  1183. messageSends: ["selector:", "new", ",", "sourceCode:", "streamContents:", "<<", "tab", "cr"]
  1184. }),
  1185. $globals.HLAccessorsGenerator);
  1186. $core.addClass('HLInitializeGenerator', $globals.HLMethodGenerator, [], 'Helios-Helpers');
  1187. //>>excludeStart("ide", pragmas.excludeIdeData);
  1188. $globals.HLInitializeGenerator.comment="I am used to double-dispatch the `initialize` method(s) generation. I am a disposable object.\x0a\x0a## Usage\x0a\x0a ^ HLInitializeGenerator new\x0a class: aClass;\x0a generate;\x0a output";
  1189. //>>excludeEnd("ide");
  1190. $core.addMethod(
  1191. $core.method({
  1192. selector: "generate",
  1193. protocol: 'protocol',
  1194. fn: function (){
  1195. var self=this;
  1196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1197. return $core.withContext(function($ctx1) {
  1198. //>>excludeEnd("ctx");
  1199. var $1,$2;
  1200. (
  1201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1202. $ctx1.supercall = true,
  1203. //>>excludeEnd("ctx");
  1204. $globals.HLInitializeGenerator.superclass.fn.prototype._generate.apply($recv(self), []));
  1205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1206. $ctx1.supercall = false;
  1207. //>>excludeEnd("ctx");;
  1208. $1=$recv(self["@output"])._targetClass();
  1209. $recv($1)._initializeSourceCodesWith_(self);
  1210. $2=$recv($1)._initializeProtocolWith_(self);
  1211. return self;
  1212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1213. }, function($ctx1) {$ctx1.fill(self,"generate",{},$globals.HLInitializeGenerator)});
  1214. //>>excludeEnd("ctx");
  1215. },
  1216. //>>excludeStart("ide", pragmas.excludeIdeData);
  1217. args: [],
  1218. source: "generate\x0a\x09super generate.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09initializeSourceCodesWith: self;\x0a\x09\x09initializeProtocolWith: self",
  1219. referencedClasses: [],
  1220. //>>excludeEnd("ide");
  1221. messageSends: ["generate", "initializeSourceCodesWith:", "targetClass", "initializeProtocolWith:"]
  1222. }),
  1223. $globals.HLInitializeGenerator);
  1224. $core.addMethod(
  1225. $core.method({
  1226. selector: "generateInitializeCodeForObject",
  1227. protocol: 'private',
  1228. fn: function (){
  1229. var self=this;
  1230. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1232. return $core.withContext(function($ctx1) {
  1233. //>>excludeEnd("ctx");
  1234. var $3,$2,$4,$5,$6,$7,$8,$1;
  1235. $1=$recv($String())._streamContents_((function(str){
  1236. var instVars,size;
  1237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1238. return $core.withContext(function($ctx2) {
  1239. //>>excludeEnd("ctx");
  1240. instVars=$recv($recv($recv(self["@output"])._targetClass())._instanceVariableNames())._sorted();
  1241. instVars;
  1242. size=$recv(instVars)._size();
  1243. size;
  1244. $recv(str).__lt_lt("initialize");
  1245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1246. $ctx2.sendIdx["<<"]=1;
  1247. //>>excludeEnd("ctx");
  1248. $3=$recv(str)._cr();
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. $ctx2.sendIdx["cr"]=1;
  1251. //>>excludeEnd("ctx");
  1252. $2=$recv($3)._tab();
  1253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1254. $ctx2.sendIdx["tab"]=1;
  1255. //>>excludeEnd("ctx");
  1256. $recv($2).__lt_lt("super initialize.");
  1257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1258. $ctx2.sendIdx["<<"]=2;
  1259. //>>excludeEnd("ctx");
  1260. $4=$recv($2)._cr();
  1261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1262. $ctx2.sendIdx["cr"]=2;
  1263. //>>excludeEnd("ctx");
  1264. $4;
  1265. $5=$recv(str)._cr();
  1266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1267. $ctx2.sendIdx["cr"]=3;
  1268. //>>excludeEnd("ctx");
  1269. $recv($5)._tab();
  1270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1271. $ctx2.sendIdx["tab"]=2;
  1272. //>>excludeEnd("ctx");
  1273. return $recv(instVars)._withIndexDo_((function(name,index){
  1274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1275. return $core.withContext(function($ctx3) {
  1276. //>>excludeEnd("ctx");
  1277. $6=$recv(index).__tild_eq((1));
  1278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1279. $ctx3.sendIdx["~="]=1;
  1280. //>>excludeEnd("ctx");
  1281. if($core.assert($6)){
  1282. $recv($recv(str)._cr())._tab();
  1283. };
  1284. $7=$recv(str).__lt_lt(name);
  1285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1286. $ctx3.sendIdx["<<"]=4;
  1287. //>>excludeEnd("ctx");
  1288. $recv($7).__lt_lt(" := nil");
  1289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1290. $ctx3.sendIdx["<<"]=3;
  1291. //>>excludeEnd("ctx");
  1292. $8=$recv(index).__tild_eq(size);
  1293. if($core.assert($8)){
  1294. return $recv(str).__lt_lt(".");
  1295. };
  1296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1297. }, function($ctx3) {$ctx3.fillBlock({name:name,index:index},$ctx2,2)});
  1298. //>>excludeEnd("ctx");
  1299. }));
  1300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1301. }, function($ctx2) {$ctx2.fillBlock({str:str,instVars:instVars,size:size},$ctx1,1)});
  1302. //>>excludeEnd("ctx");
  1303. }));
  1304. return $1;
  1305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1306. }, function($ctx1) {$ctx1.fill(self,"generateInitializeCodeForObject",{},$globals.HLInitializeGenerator)});
  1307. //>>excludeEnd("ctx");
  1308. },
  1309. //>>excludeStart("ide", pragmas.excludeIdeData);
  1310. args: [],
  1311. source: "generateInitializeCodeForObject\x09\x0a\x09^ String streamContents: [ :str || instVars size |\x0a\x09\x09instVars := output targetClass instanceVariableNames sorted.\x0a\x09\x09size := instVars size.\x0a\x09\x09str << 'initialize'.\x0a\x09\x09str cr tab << 'super initialize.';cr.\x0a\x09\x09str cr tab.\x0a\x09\x09instVars withIndexDo: [ :name :index |\x0a\x09\x09\x09index ~= 1 ifTrue: [ str cr tab ].\x0a\x09\x09\x09str << name << ' := nil'.\x0a\x09\x09\x09index ~= size ifTrue: [ str << '.' ] ] ].",
  1312. referencedClasses: ["String"],
  1313. //>>excludeEnd("ide");
  1314. messageSends: ["streamContents:", "sorted", "instanceVariableNames", "targetClass", "size", "<<", "tab", "cr", "withIndexDo:", "ifTrue:", "~="]
  1315. }),
  1316. $globals.HLInitializeGenerator);
  1317. $core.addMethod(
  1318. $core.method({
  1319. selector: "initializeForObject",
  1320. protocol: 'double-dispatch',
  1321. fn: function (){
  1322. var self=this;
  1323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1324. return $core.withContext(function($ctx1) {
  1325. //>>excludeEnd("ctx");
  1326. $recv(self["@output"])._addSourceCode_(self._initializeMethodForObject());
  1327. return self;
  1328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1329. }, function($ctx1) {$ctx1.fill(self,"initializeForObject",{},$globals.HLInitializeGenerator)});
  1330. //>>excludeEnd("ctx");
  1331. },
  1332. //>>excludeStart("ide", pragmas.excludeIdeData);
  1333. args: [],
  1334. source: "initializeForObject\x0a\x09output addSourceCode: self initializeMethodForObject",
  1335. referencedClasses: [],
  1336. //>>excludeEnd("ide");
  1337. messageSends: ["addSourceCode:", "initializeMethodForObject"]
  1338. }),
  1339. $globals.HLInitializeGenerator);
  1340. $core.addMethod(
  1341. $core.method({
  1342. selector: "initializeMethodForObject",
  1343. protocol: 'private',
  1344. fn: function (){
  1345. var self=this;
  1346. function $HLMethodSourceCode(){return $globals.HLMethodSourceCode||(typeof HLMethodSourceCode=="undefined"?nil:HLMethodSourceCode)}
  1347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1348. return $core.withContext(function($ctx1) {
  1349. //>>excludeEnd("ctx");
  1350. var $2,$3,$1;
  1351. $2=$recv($HLMethodSourceCode())._new();
  1352. $recv($2)._selector_("initialize");
  1353. $recv($2)._sourceCode_(self._generateInitializeCodeForObject());
  1354. $3=$recv($2)._yourself();
  1355. $1=$3;
  1356. return $1;
  1357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1358. }, function($ctx1) {$ctx1.fill(self,"initializeMethodForObject",{},$globals.HLInitializeGenerator)});
  1359. //>>excludeEnd("ctx");
  1360. },
  1361. //>>excludeStart("ide", pragmas.excludeIdeData);
  1362. args: [],
  1363. source: "initializeMethodForObject\x09\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector: 'initialize';\x0a\x09\x09sourceCode: self generateInitializeCodeForObject;\x0a\x09\x09yourself",
  1364. referencedClasses: ["HLMethodSourceCode"],
  1365. //>>excludeEnd("ide");
  1366. messageSends: ["selector:", "new", "sourceCode:", "generateInitializeCodeForObject", "yourself"]
  1367. }),
  1368. $globals.HLInitializeGenerator);
  1369. $core.addMethod(
  1370. $core.method({
  1371. selector: "initializeProtocolForObject",
  1372. protocol: 'double-dispatch',
  1373. fn: function (){
  1374. var self=this;
  1375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1376. return $core.withContext(function($ctx1) {
  1377. //>>excludeEnd("ctx");
  1378. $recv(self["@output"])._protocol_("initialization");
  1379. return self;
  1380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1381. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolForObject",{},$globals.HLInitializeGenerator)});
  1382. //>>excludeEnd("ctx");
  1383. },
  1384. //>>excludeStart("ide", pragmas.excludeIdeData);
  1385. args: [],
  1386. source: "initializeProtocolForObject\x0a\x09output protocol: 'initialization'",
  1387. referencedClasses: [],
  1388. //>>excludeEnd("ide");
  1389. messageSends: ["protocol:"]
  1390. }),
  1391. $globals.HLInitializeGenerator);
  1392. $core.addClass('HLMethodSourceCode', $globals.Object, ['selector', 'sourceCode'], 'Helios-Helpers');
  1393. //>>excludeStart("ide", pragmas.excludeIdeData);
  1394. $globals.HLMethodSourceCode.comment="I am a simple data object keeping track of the information about a method that will be compiled at the end of the generation process.";
  1395. //>>excludeEnd("ide");
  1396. $core.addMethod(
  1397. $core.method({
  1398. selector: "selector",
  1399. protocol: 'accessing',
  1400. fn: function (){
  1401. var self=this;
  1402. var $1;
  1403. $1=self["@selector"];
  1404. return $1;
  1405. },
  1406. //>>excludeStart("ide", pragmas.excludeIdeData);
  1407. args: [],
  1408. source: "selector\x0a\x09^ selector",
  1409. referencedClasses: [],
  1410. //>>excludeEnd("ide");
  1411. messageSends: []
  1412. }),
  1413. $globals.HLMethodSourceCode);
  1414. $core.addMethod(
  1415. $core.method({
  1416. selector: "selector:",
  1417. protocol: 'accessing',
  1418. fn: function (aSelector){
  1419. var self=this;
  1420. self["@selector"]=aSelector;
  1421. return self;
  1422. },
  1423. //>>excludeStart("ide", pragmas.excludeIdeData);
  1424. args: ["aSelector"],
  1425. source: "selector: aSelector\x0a\x09selector := aSelector",
  1426. referencedClasses: [],
  1427. //>>excludeEnd("ide");
  1428. messageSends: []
  1429. }),
  1430. $globals.HLMethodSourceCode);
  1431. $core.addMethod(
  1432. $core.method({
  1433. selector: "sourceCode",
  1434. protocol: 'accessing',
  1435. fn: function (){
  1436. var self=this;
  1437. var $1;
  1438. $1=self["@sourceCode"];
  1439. return $1;
  1440. },
  1441. //>>excludeStart("ide", pragmas.excludeIdeData);
  1442. args: [],
  1443. source: "sourceCode\x0a\x09^ sourceCode",
  1444. referencedClasses: [],
  1445. //>>excludeEnd("ide");
  1446. messageSends: []
  1447. }),
  1448. $globals.HLMethodSourceCode);
  1449. $core.addMethod(
  1450. $core.method({
  1451. selector: "sourceCode:",
  1452. protocol: 'accessing',
  1453. fn: function (aString){
  1454. var self=this;
  1455. self["@sourceCode"]=aString;
  1456. return self;
  1457. },
  1458. //>>excludeStart("ide", pragmas.excludeIdeData);
  1459. args: ["aString"],
  1460. source: "sourceCode: aString\x0a\x09sourceCode := aString",
  1461. referencedClasses: [],
  1462. //>>excludeEnd("ide");
  1463. messageSends: []
  1464. }),
  1465. $globals.HLMethodSourceCode);
  1466. $core.addClass('HLPackageCommitErrorHelper', $globals.Object, ['model'], 'Helios-Helpers');
  1467. $core.addMethod(
  1468. $core.method({
  1469. selector: "commitPackage",
  1470. protocol: 'actions',
  1471. fn: function (){
  1472. var self=this;
  1473. function $HLCommitPackageCommand(){return $globals.HLCommitPackageCommand||(typeof HLCommitPackageCommand=="undefined"?nil:HLCommitPackageCommand)}
  1474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1475. return $core.withContext(function($ctx1) {
  1476. //>>excludeEnd("ctx");
  1477. $recv($recv($HLCommitPackageCommand())._for_(self._model()))._execute();
  1478. return self;
  1479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1480. }, function($ctx1) {$ctx1.fill(self,"commitPackage",{},$globals.HLPackageCommitErrorHelper)});
  1481. //>>excludeEnd("ctx");
  1482. },
  1483. //>>excludeStart("ide", pragmas.excludeIdeData);
  1484. args: [],
  1485. source: "commitPackage\x0a\x09(HLCommitPackageCommand for: self model)\x0a\x09\x09execute",
  1486. referencedClasses: ["HLCommitPackageCommand"],
  1487. //>>excludeEnd("ide");
  1488. messageSends: ["execute", "for:", "model"]
  1489. }),
  1490. $globals.HLPackageCommitErrorHelper);
  1491. $core.addMethod(
  1492. $core.method({
  1493. selector: "commitToPath:",
  1494. protocol: 'actions',
  1495. fn: function (aString){
  1496. var self=this;
  1497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1498. return $core.withContext(function($ctx1) {
  1499. //>>excludeEnd("ctx");
  1500. $recv($recv(self._package())._transport())._setPath_(aString);
  1501. self._commitPackage();
  1502. return self;
  1503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1504. }, function($ctx1) {$ctx1.fill(self,"commitToPath:",{aString:aString},$globals.HLPackageCommitErrorHelper)});
  1505. //>>excludeEnd("ctx");
  1506. },
  1507. //>>excludeStart("ide", pragmas.excludeIdeData);
  1508. args: ["aString"],
  1509. source: "commitToPath: aString\x0a\x09\x22We only take AMD package transport into account for now\x22\x0a\x09\x0a\x09self package transport setPath: aString.\x0a\x09\x0a\x09self commitPackage",
  1510. referencedClasses: [],
  1511. //>>excludeEnd("ide");
  1512. messageSends: ["setPath:", "transport", "package", "commitPackage"]
  1513. }),
  1514. $globals.HLPackageCommitErrorHelper);
  1515. $core.addMethod(
  1516. $core.method({
  1517. selector: "model",
  1518. protocol: 'accessing',
  1519. fn: function (){
  1520. var self=this;
  1521. var $1;
  1522. $1=self["@model"];
  1523. return $1;
  1524. },
  1525. //>>excludeStart("ide", pragmas.excludeIdeData);
  1526. args: [],
  1527. source: "model\x0a\x09^ model",
  1528. referencedClasses: [],
  1529. //>>excludeEnd("ide");
  1530. messageSends: []
  1531. }),
  1532. $globals.HLPackageCommitErrorHelper);
  1533. $core.addMethod(
  1534. $core.method({
  1535. selector: "model:",
  1536. protocol: 'accessing',
  1537. fn: function (aToolModel){
  1538. var self=this;
  1539. self["@model"]=aToolModel;
  1540. return self;
  1541. },
  1542. //>>excludeStart("ide", pragmas.excludeIdeData);
  1543. args: ["aToolModel"],
  1544. source: "model: aToolModel\x0a\x09model := aToolModel",
  1545. referencedClasses: [],
  1546. //>>excludeEnd("ide");
  1547. messageSends: []
  1548. }),
  1549. $globals.HLPackageCommitErrorHelper);
  1550. $core.addMethod(
  1551. $core.method({
  1552. selector: "package",
  1553. protocol: 'accessing',
  1554. fn: function (){
  1555. var self=this;
  1556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1557. return $core.withContext(function($ctx1) {
  1558. //>>excludeEnd("ctx");
  1559. var $1;
  1560. $1=$recv(self._model())._packageToCommit();
  1561. return $1;
  1562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1563. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.HLPackageCommitErrorHelper)});
  1564. //>>excludeEnd("ctx");
  1565. },
  1566. //>>excludeStart("ide", pragmas.excludeIdeData);
  1567. args: [],
  1568. source: "package\x0a\x09^ self model packageToCommit",
  1569. referencedClasses: [],
  1570. //>>excludeEnd("ide");
  1571. messageSends: ["packageToCommit", "model"]
  1572. }),
  1573. $globals.HLPackageCommitErrorHelper);
  1574. $core.addMethod(
  1575. $core.method({
  1576. selector: "showHelp",
  1577. protocol: 'actions',
  1578. fn: function (){
  1579. var self=this;
  1580. function $HLConfirmationWidget(){return $globals.HLConfirmationWidget||(typeof HLConfirmationWidget=="undefined"?nil:HLConfirmationWidget)}
  1581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1582. return $core.withContext(function($ctx1) {
  1583. //>>excludeEnd("ctx");
  1584. var $1,$2,$3,$4;
  1585. $1=$recv($HLConfirmationWidget())._new();
  1586. $2=$1;
  1587. $3=$recv("Commit failed for namespace \x22".__comma($recv($recv(self._package())._transport())._namespace())).__comma("\x22. Do you want to commit to another path?");
  1588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1589. $ctx1.sendIdx[","]=1;
  1590. //>>excludeEnd("ctx");
  1591. $recv($2)._confirmationString_($3);
  1592. $recv($1)._actionBlock_((function(){
  1593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1594. return $core.withContext(function($ctx2) {
  1595. //>>excludeEnd("ctx");
  1596. return self._showNewCommitPath();
  1597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1599. //>>excludeEnd("ctx");
  1600. }));
  1601. $recv($1)._cancelButtonLabel_("Abandon");
  1602. $recv($1)._confirmButtonLabel_("Set path");
  1603. $4=$recv($1)._show();
  1604. return self;
  1605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1606. }, function($ctx1) {$ctx1.fill(self,"showHelp",{},$globals.HLPackageCommitErrorHelper)});
  1607. //>>excludeEnd("ctx");
  1608. },
  1609. //>>excludeStart("ide", pragmas.excludeIdeData);
  1610. args: [],
  1611. source: "showHelp\x0a\x09HLConfirmationWidget new\x0a\x09\x09confirmationString: 'Commit failed for namespace \x22', self package transport namespace, '\x22. Do you want to commit to another path?';\x0a\x09\x09actionBlock: [ self showNewCommitPath ];\x0a\x09\x09cancelButtonLabel: 'Abandon';\x0a\x09\x09confirmButtonLabel: 'Set path';\x0a\x09\x09show",
  1612. referencedClasses: ["HLConfirmationWidget"],
  1613. //>>excludeEnd("ide");
  1614. messageSends: ["confirmationString:", "new", ",", "namespace", "transport", "package", "actionBlock:", "showNewCommitPath", "cancelButtonLabel:", "confirmButtonLabel:", "show"]
  1615. }),
  1616. $globals.HLPackageCommitErrorHelper);
  1617. $core.addMethod(
  1618. $core.method({
  1619. selector: "showNewCommitPath",
  1620. protocol: 'actions',
  1621. fn: function (){
  1622. var self=this;
  1623. function $HLRequestWidget(){return $globals.HLRequestWidget||(typeof HLRequestWidget=="undefined"?nil:HLRequestWidget)}
  1624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1625. return $core.withContext(function($ctx1) {
  1626. //>>excludeEnd("ctx");
  1627. var $1,$2;
  1628. $1=$recv($HLRequestWidget())._new();
  1629. $recv($1)._beSingleline();
  1630. $recv($1)._confirmationString_("Set commit path");
  1631. $recv($1)._actionBlock_((function(url){
  1632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1633. return $core.withContext(function($ctx2) {
  1634. //>>excludeEnd("ctx");
  1635. return self._commitToPath_(url);
  1636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1637. }, function($ctx2) {$ctx2.fillBlock({url:url},$ctx1,1)});
  1638. //>>excludeEnd("ctx");
  1639. }));
  1640. $recv($1)._confirmButtonLabel_("Commit with new path");
  1641. $recv($1)._value_("/src");
  1642. $2=$recv($1)._show();
  1643. return self;
  1644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1645. }, function($ctx1) {$ctx1.fill(self,"showNewCommitPath",{},$globals.HLPackageCommitErrorHelper)});
  1646. //>>excludeEnd("ctx");
  1647. },
  1648. //>>excludeStart("ide", pragmas.excludeIdeData);
  1649. args: [],
  1650. source: "showNewCommitPath\x0a\x09HLRequestWidget new\x0a\x09\x09beSingleline;\x0a\x09\x09confirmationString: 'Set commit path';\x0a\x09\x09actionBlock: [ :url | self commitToPath: url ];\x0a\x09\x09confirmButtonLabel: 'Commit with new path';\x0a\x09\x09value: '/src';\x0a\x09\x09show",
  1651. referencedClasses: ["HLRequestWidget"],
  1652. //>>excludeEnd("ide");
  1653. messageSends: ["beSingleline", "new", "confirmationString:", "actionBlock:", "commitToPath:", "confirmButtonLabel:", "value:", "show"]
  1654. }),
  1655. $globals.HLPackageCommitErrorHelper);
  1656. $core.addMethod(
  1657. $core.method({
  1658. selector: "on:",
  1659. protocol: 'instance creation',
  1660. fn: function (aToolModel){
  1661. var self=this;
  1662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1663. return $core.withContext(function($ctx1) {
  1664. //>>excludeEnd("ctx");
  1665. var $2,$3,$1;
  1666. $2=self._new();
  1667. $recv($2)._model_(aToolModel);
  1668. $3=$recv($2)._yourself();
  1669. $1=$3;
  1670. return $1;
  1671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1672. }, function($ctx1) {$ctx1.fill(self,"on:",{aToolModel:aToolModel},$globals.HLPackageCommitErrorHelper.klass)});
  1673. //>>excludeEnd("ctx");
  1674. },
  1675. //>>excludeStart("ide", pragmas.excludeIdeData);
  1676. args: ["aToolModel"],
  1677. source: "on: aToolModel\x0a\x09^ self new\x0a\x09\x09model: aToolModel;\x0a\x09\x09yourself",
  1678. referencedClasses: [],
  1679. //>>excludeEnd("ide");
  1680. messageSends: ["model:", "new", "yourself"]
  1681. }),
  1682. $globals.HLPackageCommitErrorHelper.klass);
  1683. });