Helios-Helpers.js 60 KB

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