2
0

Platform-Services.js 93 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642
  1. define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections", "amber_core/Kernel-Methods", "amber_core/Kernel-Infrastructure"], function($boot){"use strict";
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Platform-Services');
  4. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "handleError:",
  13. protocol: 'error handling',
  14. fn: function (anError){
  15. var self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. var $1,$receiver;
  20. $1=$recv(anError)._context();
  21. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22. $ctx1.sendIdx["context"]=1;
  23. //>>excludeEnd("ctx");
  24. if(($receiver = $1) == null || $receiver.isNil){
  25. $1;
  26. } else {
  27. self._logErrorContext_($recv(anError)._context());
  28. };
  29. self._logError_(anError);
  30. return self;
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  33. //>>excludeEnd("ctx");
  34. },
  35. //>>excludeStart("ide", pragmas.excludeIdeData);
  36. args: ["anError"],
  37. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  38. referencedClasses: [],
  39. //>>excludeEnd("ide");
  40. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  41. }),
  42. $globals.ConsoleErrorHandler);
  43. $core.addMethod(
  44. $core.method({
  45. selector: "log:",
  46. protocol: 'private',
  47. fn: function (aString){
  48. var self=this;
  49. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  50. return $core.withContext(function($ctx1) {
  51. //>>excludeEnd("ctx");
  52. $recv(console)._log_(aString);
  53. return self;
  54. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  56. //>>excludeEnd("ctx");
  57. },
  58. //>>excludeStart("ide", pragmas.excludeIdeData);
  59. args: ["aString"],
  60. source: "log: aString\x0a\x09console log: aString",
  61. referencedClasses: [],
  62. //>>excludeEnd("ide");
  63. messageSends: ["log:"]
  64. }),
  65. $globals.ConsoleErrorHandler);
  66. $core.addMethod(
  67. $core.method({
  68. selector: "logContext:",
  69. protocol: 'private',
  70. fn: function (aContext){
  71. var self=this;
  72. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73. return $core.withContext(function($ctx1) {
  74. //>>excludeEnd("ctx");
  75. var $1,$receiver;
  76. $1=$recv(aContext)._home();
  77. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78. $ctx1.sendIdx["home"]=1;
  79. //>>excludeEnd("ctx");
  80. if(($receiver = $1) == null || $receiver.isNil){
  81. $1;
  82. } else {
  83. self._logContext_($recv(aContext)._home());
  84. };
  85. self._log_($recv(aContext)._asString());
  86. return self;
  87. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  88. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  89. //>>excludeEnd("ctx");
  90. },
  91. //>>excludeStart("ide", pragmas.excludeIdeData);
  92. args: ["aContext"],
  93. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  94. referencedClasses: [],
  95. //>>excludeEnd("ide");
  96. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  97. }),
  98. $globals.ConsoleErrorHandler);
  99. $core.addMethod(
  100. $core.method({
  101. selector: "logError:",
  102. protocol: 'private',
  103. fn: function (anError){
  104. var self=this;
  105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  106. return $core.withContext(function($ctx1) {
  107. //>>excludeEnd("ctx");
  108. self._log_($recv(anError)._messageText());
  109. return self;
  110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  111. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  112. //>>excludeEnd("ctx");
  113. },
  114. //>>excludeStart("ide", pragmas.excludeIdeData);
  115. args: ["anError"],
  116. source: "logError: anError\x0a\x09self log: anError messageText",
  117. referencedClasses: [],
  118. //>>excludeEnd("ide");
  119. messageSends: ["log:", "messageText"]
  120. }),
  121. $globals.ConsoleErrorHandler);
  122. $core.addMethod(
  123. $core.method({
  124. selector: "logErrorContext:",
  125. protocol: 'private',
  126. fn: function (aContext){
  127. var self=this;
  128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  129. return $core.withContext(function($ctx1) {
  130. //>>excludeEnd("ctx");
  131. var $1,$receiver;
  132. if(($receiver = aContext) == null || $receiver.isNil){
  133. aContext;
  134. } else {
  135. $1=$recv(aContext)._home();
  136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  137. $ctx1.sendIdx["home"]=1;
  138. //>>excludeEnd("ctx");
  139. if(($receiver = $1) == null || $receiver.isNil){
  140. $1;
  141. } else {
  142. self._logContext_($recv(aContext)._home());
  143. };
  144. };
  145. return self;
  146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  147. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  148. //>>excludeEnd("ctx");
  149. },
  150. //>>excludeStart("ide", pragmas.excludeIdeData);
  151. args: ["aContext"],
  152. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  153. referencedClasses: [],
  154. //>>excludeEnd("ide");
  155. messageSends: ["ifNotNil:", "home", "logContext:"]
  156. }),
  157. $globals.ConsoleErrorHandler);
  158. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  159. $core.addMethod(
  160. $core.method({
  161. selector: "initialize",
  162. protocol: 'initialization',
  163. fn: function (){
  164. var self=this;
  165. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  167. return $core.withContext(function($ctx1) {
  168. //>>excludeEnd("ctx");
  169. $recv($ErrorHandler())._registerIfNone_(self._new());
  170. return self;
  171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  172. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  173. //>>excludeEnd("ctx");
  174. },
  175. //>>excludeStart("ide", pragmas.excludeIdeData);
  176. args: [],
  177. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  178. referencedClasses: ["ErrorHandler"],
  179. //>>excludeEnd("ide");
  180. messageSends: ["registerIfNone:", "new"]
  181. }),
  182. $globals.ConsoleErrorHandler.klass);
  183. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  184. //>>excludeStart("ide", pragmas.excludeIdeData);
  185. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  186. //>>excludeEnd("ide");
  187. $core.addMethod(
  188. $core.method({
  189. selector: "clear",
  190. protocol: 'printing',
  191. fn: function (){
  192. var self=this;
  193. return self;
  194. },
  195. //>>excludeStart("ide", pragmas.excludeIdeData);
  196. args: [],
  197. source: "clear\x0a\x09\x22no op\x22",
  198. referencedClasses: [],
  199. //>>excludeEnd("ide");
  200. messageSends: []
  201. }),
  202. $globals.ConsoleTranscript);
  203. $core.addMethod(
  204. $core.method({
  205. selector: "cr",
  206. protocol: 'printing',
  207. fn: function (){
  208. var self=this;
  209. return self;
  210. },
  211. //>>excludeStart("ide", pragmas.excludeIdeData);
  212. args: [],
  213. source: "cr\x0a\x09\x22no op\x22",
  214. referencedClasses: [],
  215. //>>excludeEnd("ide");
  216. messageSends: []
  217. }),
  218. $globals.ConsoleTranscript);
  219. $core.addMethod(
  220. $core.method({
  221. selector: "open",
  222. protocol: 'actions',
  223. fn: function (){
  224. var self=this;
  225. return self;
  226. },
  227. //>>excludeStart("ide", pragmas.excludeIdeData);
  228. args: [],
  229. source: "open",
  230. referencedClasses: [],
  231. //>>excludeEnd("ide");
  232. messageSends: []
  233. }),
  234. $globals.ConsoleTranscript);
  235. $core.addMethod(
  236. $core.method({
  237. selector: "show:",
  238. protocol: 'printing',
  239. fn: function (anObject){
  240. var self=this;
  241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  242. return $core.withContext(function($ctx1) {
  243. //>>excludeEnd("ctx");
  244. console.log(String($recv(anObject)._asString()));
  245. return self;
  246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  247. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  248. //>>excludeEnd("ctx");
  249. },
  250. //>>excludeStart("ide", pragmas.excludeIdeData);
  251. args: ["anObject"],
  252. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<console.log(String($recv(anObject)._asString()))>",
  253. referencedClasses: [],
  254. //>>excludeEnd("ide");
  255. messageSends: []
  256. }),
  257. $globals.ConsoleTranscript);
  258. $core.addMethod(
  259. $core.method({
  260. selector: "initialize",
  261. protocol: 'initialization',
  262. fn: function (){
  263. var self=this;
  264. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  266. return $core.withContext(function($ctx1) {
  267. //>>excludeEnd("ctx");
  268. $recv($Transcript())._registerIfNone_(self._new());
  269. return self;
  270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  271. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  272. //>>excludeEnd("ctx");
  273. },
  274. //>>excludeStart("ide", pragmas.excludeIdeData);
  275. args: [],
  276. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  277. referencedClasses: ["Transcript"],
  278. //>>excludeEnd("ide");
  279. messageSends: ["registerIfNone:", "new"]
  280. }),
  281. $globals.ConsoleTranscript.klass);
  282. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  283. //>>excludeStart("ide", pragmas.excludeIdeData);
  284. $globals.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  285. //>>excludeEnd("ide");
  286. $core.addMethod(
  287. $core.method({
  288. selector: "ajax:",
  289. protocol: 'actions',
  290. fn: function (anObject){
  291. var self=this;
  292. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  294. return $core.withContext(function($ctx1) {
  295. //>>excludeEnd("ctx");
  296. var $1;
  297. self._deprecatedAPI();
  298. $1=$recv($PlatformInterface())._ajax_(anObject);
  299. return $1;
  300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  301. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  302. //>>excludeEnd("ctx");
  303. },
  304. //>>excludeStart("ide", pragmas.excludeIdeData);
  305. args: ["anObject"],
  306. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  307. referencedClasses: ["PlatformInterface"],
  308. //>>excludeEnd("ide");
  309. messageSends: ["deprecatedAPI", "ajax:"]
  310. }),
  311. $globals.InterfacingObject);
  312. $core.addMethod(
  313. $core.method({
  314. selector: "alert:",
  315. protocol: 'actions',
  316. fn: function (aString){
  317. var self=this;
  318. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  320. return $core.withContext(function($ctx1) {
  321. //>>excludeEnd("ctx");
  322. var $1;
  323. $1=$recv($PlatformInterface())._alert_(aString);
  324. return $1;
  325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  326. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  327. //>>excludeEnd("ctx");
  328. },
  329. //>>excludeStart("ide", pragmas.excludeIdeData);
  330. args: ["aString"],
  331. source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
  332. referencedClasses: ["PlatformInterface"],
  333. //>>excludeEnd("ide");
  334. messageSends: ["alert:"]
  335. }),
  336. $globals.InterfacingObject);
  337. $core.addMethod(
  338. $core.method({
  339. selector: "confirm:",
  340. protocol: 'actions',
  341. fn: function (aString){
  342. var self=this;
  343. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  345. return $core.withContext(function($ctx1) {
  346. //>>excludeEnd("ctx");
  347. var $1;
  348. $1=$recv($PlatformInterface())._confirm_(aString);
  349. return $1;
  350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  351. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  352. //>>excludeEnd("ctx");
  353. },
  354. //>>excludeStart("ide", pragmas.excludeIdeData);
  355. args: ["aString"],
  356. source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
  357. referencedClasses: ["PlatformInterface"],
  358. //>>excludeEnd("ide");
  359. messageSends: ["confirm:"]
  360. }),
  361. $globals.InterfacingObject);
  362. $core.addMethod(
  363. $core.method({
  364. selector: "prompt:",
  365. protocol: 'actions',
  366. fn: function (aString){
  367. var self=this;
  368. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  370. return $core.withContext(function($ctx1) {
  371. //>>excludeEnd("ctx");
  372. var $1;
  373. $1=$recv($PlatformInterface())._prompt_(aString);
  374. return $1;
  375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  376. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  377. //>>excludeEnd("ctx");
  378. },
  379. //>>excludeStart("ide", pragmas.excludeIdeData);
  380. args: ["aString"],
  381. source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
  382. referencedClasses: ["PlatformInterface"],
  383. //>>excludeEnd("ide");
  384. messageSends: ["prompt:"]
  385. }),
  386. $globals.InterfacingObject);
  387. $core.addMethod(
  388. $core.method({
  389. selector: "prompt:default:",
  390. protocol: 'actions',
  391. fn: function (aString,defaultString){
  392. var self=this;
  393. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  395. return $core.withContext(function($ctx1) {
  396. //>>excludeEnd("ctx");
  397. var $1;
  398. $1=$recv($PlatformInterface())._prompt_default_(aString,defaultString);
  399. return $1;
  400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  401. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  402. //>>excludeEnd("ctx");
  403. },
  404. //>>excludeStart("ide", pragmas.excludeIdeData);
  405. args: ["aString", "defaultString"],
  406. source: "prompt: aString default: defaultString\x0a\x09^ PlatformInterface prompt: aString default: defaultString",
  407. referencedClasses: ["PlatformInterface"],
  408. //>>excludeEnd("ide");
  409. messageSends: ["prompt:default:"]
  410. }),
  411. $globals.InterfacingObject);
  412. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  413. //>>excludeStart("ide", pragmas.excludeIdeData);
  414. $globals.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
  415. //>>excludeEnd("ide");
  416. $core.addMethod(
  417. $core.method({
  418. selector: "addInstVarNamed:to:",
  419. protocol: 'compiling',
  420. fn: function (aString,aClass){
  421. var self=this;
  422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  423. return $core.withContext(function($ctx1) {
  424. //>>excludeEnd("ctx");
  425. var $1,$2,$3,$4,$5;
  426. $1=self._classBuilder();
  427. $2=$recv(aClass)._superclass();
  428. $3=$recv(aClass)._name();
  429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  430. $ctx1.sendIdx["name"]=1;
  431. //>>excludeEnd("ctx");
  432. $4=$recv($recv(aClass)._instanceVariableNames())._copy();
  433. $recv($4)._add_(aString);
  434. $5=$recv($4)._yourself();
  435. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,$recv($recv(aClass)._package())._name());
  436. return self;
  437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  438. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  439. //>>excludeEnd("ctx");
  440. },
  441. //>>excludeStart("ide", pragmas.excludeIdeData);
  442. args: ["aString", "aClass"],
  443. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  444. referencedClasses: [],
  445. //>>excludeEnd("ide");
  446. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  447. }),
  448. $globals.Environment);
  449. $core.addMethod(
  450. $core.method({
  451. selector: "allSelectors",
  452. protocol: 'accessing',
  453. fn: function (){
  454. var self=this;
  455. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  457. return $core.withContext(function($ctx1) {
  458. //>>excludeEnd("ctx");
  459. var $1;
  460. $1=$recv($recv($Smalltalk())._core())._allSelectors();
  461. return $1;
  462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  463. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  464. //>>excludeEnd("ctx");
  465. },
  466. //>>excludeStart("ide", pragmas.excludeIdeData);
  467. args: [],
  468. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  469. referencedClasses: ["Smalltalk"],
  470. //>>excludeEnd("ide");
  471. messageSends: ["allSelectors", "core"]
  472. }),
  473. $globals.Environment);
  474. $core.addMethod(
  475. $core.method({
  476. selector: "availableClassNames",
  477. protocol: 'accessing',
  478. fn: function (){
  479. var self=this;
  480. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  482. return $core.withContext(function($ctx1) {
  483. //>>excludeEnd("ctx");
  484. var $1;
  485. $1=$recv($recv($Smalltalk())._classes())._collect_((function(each){
  486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  487. return $core.withContext(function($ctx2) {
  488. //>>excludeEnd("ctx");
  489. return $recv(each)._name();
  490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  492. //>>excludeEnd("ctx");
  493. }));
  494. return $1;
  495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  496. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  497. //>>excludeEnd("ctx");
  498. },
  499. //>>excludeStart("ide", pragmas.excludeIdeData);
  500. args: [],
  501. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  502. referencedClasses: ["Smalltalk"],
  503. //>>excludeEnd("ide");
  504. messageSends: ["collect:", "classes", "name"]
  505. }),
  506. $globals.Environment);
  507. $core.addMethod(
  508. $core.method({
  509. selector: "availablePackageNames",
  510. protocol: 'accessing',
  511. fn: function (){
  512. var self=this;
  513. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  515. return $core.withContext(function($ctx1) {
  516. //>>excludeEnd("ctx");
  517. var $1;
  518. $1=$recv($recv($Smalltalk())._packages())._collect_((function(each){
  519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  520. return $core.withContext(function($ctx2) {
  521. //>>excludeEnd("ctx");
  522. return $recv(each)._name();
  523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  524. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  525. //>>excludeEnd("ctx");
  526. }));
  527. return $1;
  528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  529. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  530. //>>excludeEnd("ctx");
  531. },
  532. //>>excludeStart("ide", pragmas.excludeIdeData);
  533. args: [],
  534. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  535. referencedClasses: ["Smalltalk"],
  536. //>>excludeEnd("ide");
  537. messageSends: ["collect:", "packages", "name"]
  538. }),
  539. $globals.Environment);
  540. $core.addMethod(
  541. $core.method({
  542. selector: "availableProtocolsFor:",
  543. protocol: 'accessing',
  544. fn: function (aClass){
  545. var self=this;
  546. var protocols;
  547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  548. return $core.withContext(function($ctx1) {
  549. //>>excludeEnd("ctx");
  550. var $1,$2,$receiver;
  551. protocols=$recv(aClass)._protocols();
  552. $1=$recv(aClass)._superclass();
  553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  554. $ctx1.sendIdx["superclass"]=1;
  555. //>>excludeEnd("ctx");
  556. if(($receiver = $1) == null || $receiver.isNil){
  557. $1;
  558. } else {
  559. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  560. };
  561. $2=$recv($recv($recv(protocols)._asSet())._asArray())._sort();
  562. return $2;
  563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  564. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  565. //>>excludeEnd("ctx");
  566. },
  567. //>>excludeStart("ide", pragmas.excludeIdeData);
  568. args: ["aClass"],
  569. source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray sort",
  570. referencedClasses: [],
  571. //>>excludeEnd("ide");
  572. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  573. }),
  574. $globals.Environment);
  575. $core.addMethod(
  576. $core.method({
  577. selector: "classBuilder",
  578. protocol: 'accessing',
  579. fn: function (){
  580. var self=this;
  581. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  583. return $core.withContext(function($ctx1) {
  584. //>>excludeEnd("ctx");
  585. var $1;
  586. $1=$recv($ClassBuilder())._new();
  587. return $1;
  588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  589. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  590. //>>excludeEnd("ctx");
  591. },
  592. //>>excludeStart("ide", pragmas.excludeIdeData);
  593. args: [],
  594. source: "classBuilder\x0a\x09^ ClassBuilder new",
  595. referencedClasses: ["ClassBuilder"],
  596. //>>excludeEnd("ide");
  597. messageSends: ["new"]
  598. }),
  599. $globals.Environment);
  600. $core.addMethod(
  601. $core.method({
  602. selector: "classNamed:",
  603. protocol: 'accessing',
  604. fn: function (aString){
  605. var self=this;
  606. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  608. return $core.withContext(function($ctx1) {
  609. //>>excludeEnd("ctx");
  610. var $2,$1,$receiver;
  611. $2=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol());
  612. if(($receiver = $2) == null || $receiver.isNil){
  613. $1=self._error_("Invalid class name");
  614. } else {
  615. $1=$2;
  616. };
  617. return $1;
  618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  619. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  620. //>>excludeEnd("ctx");
  621. },
  622. //>>excludeStart("ide", pragmas.excludeIdeData);
  623. args: ["aString"],
  624. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  625. referencedClasses: ["Smalltalk"],
  626. //>>excludeEnd("ide");
  627. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  628. }),
  629. $globals.Environment);
  630. $core.addMethod(
  631. $core.method({
  632. selector: "classes",
  633. protocol: 'accessing',
  634. fn: function (){
  635. var self=this;
  636. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  638. return $core.withContext(function($ctx1) {
  639. //>>excludeEnd("ctx");
  640. var $1;
  641. $1=$recv($Smalltalk())._classes();
  642. return $1;
  643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  644. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  645. //>>excludeEnd("ctx");
  646. },
  647. //>>excludeStart("ide", pragmas.excludeIdeData);
  648. args: [],
  649. source: "classes\x0a\x09^ Smalltalk classes",
  650. referencedClasses: ["Smalltalk"],
  651. //>>excludeEnd("ide");
  652. messageSends: ["classes"]
  653. }),
  654. $globals.Environment);
  655. $core.addMethod(
  656. $core.method({
  657. selector: "commitPackage:onSuccess:onError:",
  658. protocol: 'actions',
  659. fn: function (aPackage,aBlock,anotherBlock){
  660. var self=this;
  661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  662. return $core.withContext(function($ctx1) {
  663. //>>excludeEnd("ctx");
  664. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  665. return self;
  666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  667. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  668. //>>excludeEnd("ctx");
  669. },
  670. //>>excludeStart("ide", pragmas.excludeIdeData);
  671. args: ["aPackage", "aBlock", "anotherBlock"],
  672. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  673. referencedClasses: [],
  674. //>>excludeEnd("ide");
  675. messageSends: ["commitOnSuccess:onError:", "transport"]
  676. }),
  677. $globals.Environment);
  678. $core.addMethod(
  679. $core.method({
  680. selector: "compileClassComment:for:",
  681. protocol: 'compiling',
  682. fn: function (aString,aClass){
  683. var self=this;
  684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  685. return $core.withContext(function($ctx1) {
  686. //>>excludeEnd("ctx");
  687. $recv(aClass)._comment_(aString);
  688. return self;
  689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  690. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  691. //>>excludeEnd("ctx");
  692. },
  693. //>>excludeStart("ide", pragmas.excludeIdeData);
  694. args: ["aString", "aClass"],
  695. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  696. referencedClasses: [],
  697. //>>excludeEnd("ide");
  698. messageSends: ["comment:"]
  699. }),
  700. $globals.Environment);
  701. $core.addMethod(
  702. $core.method({
  703. selector: "compileClassDefinition:",
  704. protocol: 'compiling',
  705. fn: function (aString){
  706. var self=this;
  707. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  708. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  710. return $core.withContext(function($ctx1) {
  711. //>>excludeEnd("ctx");
  712. $recv((function(){
  713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  714. return $core.withContext(function($ctx2) {
  715. //>>excludeEnd("ctx");
  716. return self._evaluate_for_(aString,$recv($DoIt())._new());
  717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  719. //>>excludeEnd("ctx");
  720. }))._on_do_($Error(),(function(error){
  721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  722. return $core.withContext(function($ctx2) {
  723. //>>excludeEnd("ctx");
  724. return self._alert_($recv(error)._messageText());
  725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  726. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  727. //>>excludeEnd("ctx");
  728. }));
  729. return self;
  730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  731. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  732. //>>excludeEnd("ctx");
  733. },
  734. //>>excludeStart("ide", pragmas.excludeIdeData);
  735. args: ["aString"],
  736. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  737. referencedClasses: ["DoIt", "Error"],
  738. //>>excludeEnd("ide");
  739. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  740. }),
  741. $globals.Environment);
  742. $core.addMethod(
  743. $core.method({
  744. selector: "compileMethod:for:protocol:",
  745. protocol: 'compiling',
  746. fn: function (sourceCode,class_,protocol){
  747. var self=this;
  748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  749. return $core.withContext(function($ctx1) {
  750. //>>excludeEnd("ctx");
  751. var $1;
  752. $1=$recv(class_)._compile_protocol_(sourceCode,protocol);
  753. return $1;
  754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  755. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  756. //>>excludeEnd("ctx");
  757. },
  758. //>>excludeStart("ide", pragmas.excludeIdeData);
  759. args: ["sourceCode", "class", "protocol"],
  760. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  761. referencedClasses: [],
  762. //>>excludeEnd("ide");
  763. messageSends: ["compile:protocol:"]
  764. }),
  765. $globals.Environment);
  766. $core.addMethod(
  767. $core.method({
  768. selector: "copyClass:to:",
  769. protocol: 'actions',
  770. fn: function (aClass,aClassName){
  771. var self=this;
  772. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  773. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  775. return $core.withContext(function($ctx1) {
  776. //>>excludeEnd("ctx");
  777. var $1,$2,$receiver;
  778. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  779. if(($receiver = $1) == null || $receiver.isNil){
  780. $1;
  781. } else {
  782. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  784. $ctx1.sendIdx[","]=1;
  785. //>>excludeEnd("ctx");
  786. self._error_($2);
  787. };
  788. $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  789. return self;
  790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  791. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  792. //>>excludeEnd("ctx");
  793. },
  794. //>>excludeStart("ide", pragmas.excludeIdeData);
  795. args: ["aClass", "aClassName"],
  796. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
  797. referencedClasses: ["Smalltalk", "ClassBuilder"],
  798. //>>excludeEnd("ide");
  799. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  800. }),
  801. $globals.Environment);
  802. $core.addMethod(
  803. $core.method({
  804. selector: "doItReceiver",
  805. protocol: 'accessing',
  806. fn: function (){
  807. var self=this;
  808. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  810. return $core.withContext(function($ctx1) {
  811. //>>excludeEnd("ctx");
  812. var $1;
  813. $1=$recv($DoIt())._new();
  814. return $1;
  815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  816. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  817. //>>excludeEnd("ctx");
  818. },
  819. //>>excludeStart("ide", pragmas.excludeIdeData);
  820. args: [],
  821. source: "doItReceiver\x0a\x09^ DoIt new",
  822. referencedClasses: ["DoIt"],
  823. //>>excludeEnd("ide");
  824. messageSends: ["new"]
  825. }),
  826. $globals.Environment);
  827. $core.addMethod(
  828. $core.method({
  829. selector: "evaluate:for:",
  830. protocol: 'evaluating',
  831. fn: function (aString,anObject){
  832. var self=this;
  833. function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  835. return $core.withContext(function($ctx1) {
  836. //>>excludeEnd("ctx");
  837. var $1;
  838. $1=$recv($Evaluator())._evaluate_for_(aString,anObject);
  839. return $1;
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  842. //>>excludeEnd("ctx");
  843. },
  844. //>>excludeStart("ide", pragmas.excludeIdeData);
  845. args: ["aString", "anObject"],
  846. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  847. referencedClasses: ["Evaluator"],
  848. //>>excludeEnd("ide");
  849. messageSends: ["evaluate:for:"]
  850. }),
  851. $globals.Environment);
  852. $core.addMethod(
  853. $core.method({
  854. selector: "evaluate:on:do:",
  855. protocol: 'error handling',
  856. fn: function (aBlock,anErrorClass,exceptionBlock){
  857. var self=this;
  858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  859. return $core.withContext(function($ctx1) {
  860. //>>excludeEnd("ctx");
  861. var $1;
  862. $recv(aBlock)._tryCatch_((function(exception){
  863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  864. return $core.withContext(function($ctx2) {
  865. //>>excludeEnd("ctx");
  866. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  867. if($core.assert($1)){
  868. return $recv(exceptionBlock)._value_(exception);
  869. } else {
  870. return $recv(exception)._resignal();
  871. };
  872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  873. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  874. //>>excludeEnd("ctx");
  875. }));
  876. return self;
  877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  878. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  879. //>>excludeEnd("ctx");
  880. },
  881. //>>excludeStart("ide", pragmas.excludeIdeData);
  882. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  883. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  884. referencedClasses: [],
  885. //>>excludeEnd("ide");
  886. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  887. }),
  888. $globals.Environment);
  889. $core.addMethod(
  890. $core.method({
  891. selector: "inspect:",
  892. protocol: 'actions',
  893. fn: function (anObject){
  894. var self=this;
  895. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  897. return $core.withContext(function($ctx1) {
  898. //>>excludeEnd("ctx");
  899. $recv($Inspector())._inspect_(anObject);
  900. return self;
  901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  902. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  903. //>>excludeEnd("ctx");
  904. },
  905. //>>excludeStart("ide", pragmas.excludeIdeData);
  906. args: ["anObject"],
  907. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  908. referencedClasses: ["Inspector"],
  909. //>>excludeEnd("ide");
  910. messageSends: ["inspect:"]
  911. }),
  912. $globals.Environment);
  913. $core.addMethod(
  914. $core.method({
  915. selector: "moveClass:toPackage:",
  916. protocol: 'actions',
  917. fn: function (aClass,aPackageName){
  918. var self=this;
  919. var package_;
  920. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  922. return $core.withContext(function($ctx1) {
  923. //>>excludeEnd("ctx");
  924. var $1,$2,$receiver;
  925. package_=$recv($Package())._named_(aPackageName);
  926. $1=package_;
  927. if(($receiver = $1) == null || $receiver.isNil){
  928. self._error_("Invalid package name");
  929. } else {
  930. $1;
  931. };
  932. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  933. if($core.assert($2)){
  934. return self;
  935. };
  936. $recv(aClass)._package_(package_);
  937. return self;
  938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  939. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  940. //>>excludeEnd("ctx");
  941. },
  942. //>>excludeStart("ide", pragmas.excludeIdeData);
  943. args: ["aClass", "aPackageName"],
  944. source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package",
  945. referencedClasses: ["Package"],
  946. //>>excludeEnd("ide");
  947. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  948. }),
  949. $globals.Environment);
  950. $core.addMethod(
  951. $core.method({
  952. selector: "moveMethod:toClass:",
  953. protocol: 'actions',
  954. fn: function (aMethod,aClassName){
  955. var self=this;
  956. var destinationClass;
  957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  958. return $core.withContext(function($ctx1) {
  959. //>>excludeEnd("ctx");
  960. var $2,$3,$1,$5,$4;
  961. destinationClass=self._classNamed_(aClassName);
  962. $2=destinationClass;
  963. $3=$recv(aMethod)._methodClass();
  964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  965. $ctx1.sendIdx["methodClass"]=1;
  966. //>>excludeEnd("ctx");
  967. $1=$recv($2).__eq_eq($3);
  968. if($core.assert($1)){
  969. return self;
  970. };
  971. $5=$recv(aMethod)._methodClass();
  972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  973. $ctx1.sendIdx["methodClass"]=2;
  974. //>>excludeEnd("ctx");
  975. $4=$recv($5)._isMetaclass();
  976. if($core.assert($4)){
  977. destinationClass=$recv(destinationClass)._class();
  978. destinationClass;
  979. };
  980. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  981. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  982. return self;
  983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  984. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  985. //>>excludeEnd("ctx");
  986. },
  987. //>>excludeStart("ide", pragmas.excludeIdeData);
  988. args: ["aMethod", "aClassName"],
  989. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass class ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  990. referencedClasses: [],
  991. //>>excludeEnd("ide");
  992. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  993. }),
  994. $globals.Environment);
  995. $core.addMethod(
  996. $core.method({
  997. selector: "moveMethod:toProtocol:",
  998. protocol: 'actions',
  999. fn: function (aMethod,aProtocol){
  1000. var self=this;
  1001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1002. return $core.withContext(function($ctx1) {
  1003. //>>excludeEnd("ctx");
  1004. $recv(aMethod)._protocol_(aProtocol);
  1005. return self;
  1006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1007. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  1008. //>>excludeEnd("ctx");
  1009. },
  1010. //>>excludeStart("ide", pragmas.excludeIdeData);
  1011. args: ["aMethod", "aProtocol"],
  1012. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  1013. referencedClasses: [],
  1014. //>>excludeEnd("ide");
  1015. messageSends: ["protocol:"]
  1016. }),
  1017. $globals.Environment);
  1018. $core.addMethod(
  1019. $core.method({
  1020. selector: "packages",
  1021. protocol: 'accessing',
  1022. fn: function (){
  1023. var self=this;
  1024. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1026. return $core.withContext(function($ctx1) {
  1027. //>>excludeEnd("ctx");
  1028. var $1;
  1029. $1=$recv($Smalltalk())._packages();
  1030. return $1;
  1031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1032. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  1033. //>>excludeEnd("ctx");
  1034. },
  1035. //>>excludeStart("ide", pragmas.excludeIdeData);
  1036. args: [],
  1037. source: "packages\x0a\x09^ Smalltalk packages",
  1038. referencedClasses: ["Smalltalk"],
  1039. //>>excludeEnd("ide");
  1040. messageSends: ["packages"]
  1041. }),
  1042. $globals.Environment);
  1043. $core.addMethod(
  1044. $core.method({
  1045. selector: "registerErrorHandler:",
  1046. protocol: 'services',
  1047. fn: function (anErrorHandler){
  1048. var self=this;
  1049. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  1050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1051. return $core.withContext(function($ctx1) {
  1052. //>>excludeEnd("ctx");
  1053. $recv($ErrorHandler())._register_(anErrorHandler);
  1054. return self;
  1055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1056. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  1057. //>>excludeEnd("ctx");
  1058. },
  1059. //>>excludeStart("ide", pragmas.excludeIdeData);
  1060. args: ["anErrorHandler"],
  1061. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  1062. referencedClasses: ["ErrorHandler"],
  1063. //>>excludeEnd("ide");
  1064. messageSends: ["register:"]
  1065. }),
  1066. $globals.Environment);
  1067. $core.addMethod(
  1068. $core.method({
  1069. selector: "registerFinder:",
  1070. protocol: 'services',
  1071. fn: function (aFinder){
  1072. var self=this;
  1073. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1075. return $core.withContext(function($ctx1) {
  1076. //>>excludeEnd("ctx");
  1077. $recv($Finder())._register_(aFinder);
  1078. return self;
  1079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1080. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  1081. //>>excludeEnd("ctx");
  1082. },
  1083. //>>excludeStart("ide", pragmas.excludeIdeData);
  1084. args: ["aFinder"],
  1085. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  1086. referencedClasses: ["Finder"],
  1087. //>>excludeEnd("ide");
  1088. messageSends: ["register:"]
  1089. }),
  1090. $globals.Environment);
  1091. $core.addMethod(
  1092. $core.method({
  1093. selector: "registerInspector:",
  1094. protocol: 'services',
  1095. fn: function (anInspector){
  1096. var self=this;
  1097. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1099. return $core.withContext(function($ctx1) {
  1100. //>>excludeEnd("ctx");
  1101. $recv($Inspector())._register_(anInspector);
  1102. return self;
  1103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1104. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  1105. //>>excludeEnd("ctx");
  1106. },
  1107. //>>excludeStart("ide", pragmas.excludeIdeData);
  1108. args: ["anInspector"],
  1109. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  1110. referencedClasses: ["Inspector"],
  1111. //>>excludeEnd("ide");
  1112. messageSends: ["register:"]
  1113. }),
  1114. $globals.Environment);
  1115. $core.addMethod(
  1116. $core.method({
  1117. selector: "registerProgressHandler:",
  1118. protocol: 'services',
  1119. fn: function (aProgressHandler){
  1120. var self=this;
  1121. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  1122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1123. return $core.withContext(function($ctx1) {
  1124. //>>excludeEnd("ctx");
  1125. $recv($ProgressHandler())._register_(aProgressHandler);
  1126. return self;
  1127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1128. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  1129. //>>excludeEnd("ctx");
  1130. },
  1131. //>>excludeStart("ide", pragmas.excludeIdeData);
  1132. args: ["aProgressHandler"],
  1133. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  1134. referencedClasses: ["ProgressHandler"],
  1135. //>>excludeEnd("ide");
  1136. messageSends: ["register:"]
  1137. }),
  1138. $globals.Environment);
  1139. $core.addMethod(
  1140. $core.method({
  1141. selector: "registerTranscript:",
  1142. protocol: 'services',
  1143. fn: function (aTranscript){
  1144. var self=this;
  1145. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  1146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1147. return $core.withContext(function($ctx1) {
  1148. //>>excludeEnd("ctx");
  1149. $recv($Transcript())._register_(aTranscript);
  1150. return self;
  1151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1152. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  1153. //>>excludeEnd("ctx");
  1154. },
  1155. //>>excludeStart("ide", pragmas.excludeIdeData);
  1156. args: ["aTranscript"],
  1157. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  1158. referencedClasses: ["Transcript"],
  1159. //>>excludeEnd("ide");
  1160. messageSends: ["register:"]
  1161. }),
  1162. $globals.Environment);
  1163. $core.addMethod(
  1164. $core.method({
  1165. selector: "removeClass:",
  1166. protocol: 'actions',
  1167. fn: function (aClass){
  1168. var self=this;
  1169. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1171. return $core.withContext(function($ctx1) {
  1172. //>>excludeEnd("ctx");
  1173. $recv($Smalltalk())._removeClass_(aClass);
  1174. return self;
  1175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1176. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  1177. //>>excludeEnd("ctx");
  1178. },
  1179. //>>excludeStart("ide", pragmas.excludeIdeData);
  1180. args: ["aClass"],
  1181. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  1182. referencedClasses: ["Smalltalk"],
  1183. //>>excludeEnd("ide");
  1184. messageSends: ["removeClass:"]
  1185. }),
  1186. $globals.Environment);
  1187. $core.addMethod(
  1188. $core.method({
  1189. selector: "removeMethod:",
  1190. protocol: 'actions',
  1191. fn: function (aMethod){
  1192. var self=this;
  1193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1194. return $core.withContext(function($ctx1) {
  1195. //>>excludeEnd("ctx");
  1196. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  1197. return self;
  1198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1199. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  1200. //>>excludeEnd("ctx");
  1201. },
  1202. //>>excludeStart("ide", pragmas.excludeIdeData);
  1203. args: ["aMethod"],
  1204. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  1205. referencedClasses: [],
  1206. //>>excludeEnd("ide");
  1207. messageSends: ["removeCompiledMethod:", "methodClass"]
  1208. }),
  1209. $globals.Environment);
  1210. $core.addMethod(
  1211. $core.method({
  1212. selector: "removeProtocol:from:",
  1213. protocol: 'actions',
  1214. fn: function (aString,aClass){
  1215. var self=this;
  1216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1217. return $core.withContext(function($ctx1) {
  1218. //>>excludeEnd("ctx");
  1219. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  1220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1221. return $core.withContext(function($ctx2) {
  1222. //>>excludeEnd("ctx");
  1223. return $recv(aClass)._removeCompiledMethod_(each);
  1224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1225. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1226. //>>excludeEnd("ctx");
  1227. }));
  1228. return self;
  1229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1230. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  1231. //>>excludeEnd("ctx");
  1232. },
  1233. //>>excludeStart("ide", pragmas.excludeIdeData);
  1234. args: ["aString", "aClass"],
  1235. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  1236. referencedClasses: [],
  1237. //>>excludeEnd("ide");
  1238. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  1239. }),
  1240. $globals.Environment);
  1241. $core.addMethod(
  1242. $core.method({
  1243. selector: "renameClass:to:",
  1244. protocol: 'actions',
  1245. fn: function (aClass,aClassName){
  1246. var self=this;
  1247. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1248. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. return $core.withContext(function($ctx1) {
  1251. //>>excludeEnd("ctx");
  1252. var $1,$2,$receiver;
  1253. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  1254. if(($receiver = $1) == null || $receiver.isNil){
  1255. $1;
  1256. } else {
  1257. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  1258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1259. $ctx1.sendIdx[","]=1;
  1260. //>>excludeEnd("ctx");
  1261. self._error_($2);
  1262. };
  1263. $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  1264. return self;
  1265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1266. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  1267. //>>excludeEnd("ctx");
  1268. },
  1269. //>>excludeStart("ide", pragmas.excludeIdeData);
  1270. args: ["aClass", "aClassName"],
  1271. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
  1272. referencedClasses: ["Smalltalk", "ClassBuilder"],
  1273. //>>excludeEnd("ide");
  1274. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  1275. }),
  1276. $globals.Environment);
  1277. $core.addMethod(
  1278. $core.method({
  1279. selector: "renamePackage:to:",
  1280. protocol: 'actions',
  1281. fn: function (aPackageName,aNewPackageName){
  1282. var self=this;
  1283. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1285. return $core.withContext(function($ctx1) {
  1286. //>>excludeEnd("ctx");
  1287. var $1,$2,$receiver;
  1288. $1=$recv($recv($Smalltalk())._globals())._at_(aNewPackageName);
  1289. if(($receiver = $1) == null || $receiver.isNil){
  1290. $1;
  1291. } else {
  1292. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  1293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1294. $ctx1.sendIdx[","]=1;
  1295. //>>excludeEnd("ctx");
  1296. self._error_($2);
  1297. };
  1298. $recv($Smalltalk())._renamePackage_to_(aPackageName,aNewPackageName);
  1299. return self;
  1300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1301. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  1302. //>>excludeEnd("ctx");
  1303. },
  1304. //>>excludeStart("ide", pragmas.excludeIdeData);
  1305. args: ["aPackageName", "aNewPackageName"],
  1306. source: "renamePackage: aPackageName to: aNewPackageName\x0a (Smalltalk globals at: aNewPackageName)\x0a ifNotNil: [ self error: 'A package named ', aNewPackageName, ' already exists' ].\x0a\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  1307. referencedClasses: ["Smalltalk"],
  1308. //>>excludeEnd("ide");
  1309. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  1310. }),
  1311. $globals.Environment);
  1312. $core.addMethod(
  1313. $core.method({
  1314. selector: "renameProtocol:to:in:",
  1315. protocol: 'actions',
  1316. fn: function (aString,anotherString,aClass){
  1317. var self=this;
  1318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1319. return $core.withContext(function($ctx1) {
  1320. //>>excludeEnd("ctx");
  1321. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  1322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1323. return $core.withContext(function($ctx2) {
  1324. //>>excludeEnd("ctx");
  1325. return $recv(each)._protocol_(anotherString);
  1326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1328. //>>excludeEnd("ctx");
  1329. }));
  1330. return self;
  1331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1332. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  1333. //>>excludeEnd("ctx");
  1334. },
  1335. //>>excludeStart("ide", pragmas.excludeIdeData);
  1336. args: ["aString", "anotherString", "aClass"],
  1337. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  1338. referencedClasses: [],
  1339. //>>excludeEnd("ide");
  1340. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  1341. }),
  1342. $globals.Environment);
  1343. $core.addMethod(
  1344. $core.method({
  1345. selector: "setClassCommentOf:to:",
  1346. protocol: 'actions',
  1347. fn: function (aClass,aString){
  1348. var self=this;
  1349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1350. return $core.withContext(function($ctx1) {
  1351. //>>excludeEnd("ctx");
  1352. $recv(aClass)._comment_(aString);
  1353. return self;
  1354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1355. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  1356. //>>excludeEnd("ctx");
  1357. },
  1358. //>>excludeStart("ide", pragmas.excludeIdeData);
  1359. args: ["aClass", "aString"],
  1360. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  1361. referencedClasses: [],
  1362. //>>excludeEnd("ide");
  1363. messageSends: ["comment:"]
  1364. }),
  1365. $globals.Environment);
  1366. $core.addMethod(
  1367. $core.method({
  1368. selector: "systemAnnouncer",
  1369. protocol: 'accessing',
  1370. fn: function (){
  1371. var self=this;
  1372. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1374. return $core.withContext(function($ctx1) {
  1375. //>>excludeEnd("ctx");
  1376. var $1;
  1377. $1=$recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  1378. return $1;
  1379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1380. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  1381. //>>excludeEnd("ctx");
  1382. },
  1383. //>>excludeStart("ide", pragmas.excludeIdeData);
  1384. args: [],
  1385. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  1386. referencedClasses: ["Smalltalk"],
  1387. //>>excludeEnd("ide");
  1388. messageSends: ["current", "at:", "globals"]
  1389. }),
  1390. $globals.Environment);
  1391. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  1392. //>>excludeStart("ide", pragmas.excludeIdeData);
  1393. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  1394. //>>excludeEnd("ide");
  1395. $core.addMethod(
  1396. $core.method({
  1397. selector: "do:on:displaying:",
  1398. protocol: 'progress handling',
  1399. fn: function (aBlock,aCollection,aString){
  1400. var self=this;
  1401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1402. return $core.withContext(function($ctx1) {
  1403. //>>excludeEnd("ctx");
  1404. $recv(aCollection)._do_(aBlock);
  1405. return self;
  1406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1407. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  1408. //>>excludeEnd("ctx");
  1409. },
  1410. //>>excludeStart("ide", pragmas.excludeIdeData);
  1411. args: ["aBlock", "aCollection", "aString"],
  1412. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  1413. referencedClasses: [],
  1414. //>>excludeEnd("ide");
  1415. messageSends: ["do:"]
  1416. }),
  1417. $globals.NullProgressHandler);
  1418. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  1419. $core.addMethod(
  1420. $core.method({
  1421. selector: "initialize",
  1422. protocol: 'initialization',
  1423. fn: function (){
  1424. var self=this;
  1425. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  1426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1427. return $core.withContext(function($ctx1) {
  1428. //>>excludeEnd("ctx");
  1429. $recv($ProgressHandler())._registerIfNone_(self._new());
  1430. return self;
  1431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1432. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  1433. //>>excludeEnd("ctx");
  1434. },
  1435. //>>excludeStart("ide", pragmas.excludeIdeData);
  1436. args: [],
  1437. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  1438. referencedClasses: ["ProgressHandler"],
  1439. //>>excludeEnd("ide");
  1440. messageSends: ["registerIfNone:", "new"]
  1441. }),
  1442. $globals.NullProgressHandler.klass);
  1443. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  1444. //>>excludeStart("ide", pragmas.excludeIdeData);
  1445. $globals.PlatformInterface.comment="I am single entry point to UI and environment interface.\x0aMy `initialize` tries several options (for now, browser environment only) to set myself up.\x0a\x0a## API\x0a\x0a PlatformInterface alert: 'Hey, there is a problem'.\x0a PlatformInterface confirm: 'Affirmative?'.\x0a PlatformInterface prompt: 'Your name:'.\x0a\x0a PlatformInterface ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  1446. //>>excludeEnd("ide");
  1447. $globals.PlatformInterface.klass.iVarNames = ['worker'];
  1448. $core.addMethod(
  1449. $core.method({
  1450. selector: "ajax:",
  1451. protocol: 'actions',
  1452. fn: function (anObject){
  1453. var self=this;
  1454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1455. return $core.withContext(function($ctx1) {
  1456. //>>excludeEnd("ctx");
  1457. var $2,$1,$receiver;
  1458. $2=self["@worker"];
  1459. if(($receiver = $2) == null || $receiver.isNil){
  1460. $1=self._error_("ajax: not available");
  1461. } else {
  1462. $1=$recv(self["@worker"])._ajax_(anObject);
  1463. };
  1464. return $1;
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  1467. //>>excludeEnd("ctx");
  1468. },
  1469. //>>excludeStart("ide", pragmas.excludeIdeData);
  1470. args: ["anObject"],
  1471. source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
  1472. referencedClasses: [],
  1473. //>>excludeEnd("ide");
  1474. messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"]
  1475. }),
  1476. $globals.PlatformInterface.klass);
  1477. $core.addMethod(
  1478. $core.method({
  1479. selector: "alert:",
  1480. protocol: 'actions',
  1481. fn: function (aString){
  1482. var self=this;
  1483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1484. return $core.withContext(function($ctx1) {
  1485. //>>excludeEnd("ctx");
  1486. var $2,$1,$receiver;
  1487. $2=self["@worker"];
  1488. if(($receiver = $2) == null || $receiver.isNil){
  1489. $1=self._error_("alert: not available");
  1490. } else {
  1491. $1=$recv(self["@worker"])._alert_(aString);
  1492. };
  1493. return $1;
  1494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1495. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  1496. //>>excludeEnd("ctx");
  1497. },
  1498. //>>excludeStart("ide", pragmas.excludeIdeData);
  1499. args: ["aString"],
  1500. source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
  1501. referencedClasses: [],
  1502. //>>excludeEnd("ide");
  1503. messageSends: ["ifNotNil:ifNil:", "alert:", "error:"]
  1504. }),
  1505. $globals.PlatformInterface.klass);
  1506. $core.addMethod(
  1507. $core.method({
  1508. selector: "confirm:",
  1509. protocol: 'actions',
  1510. fn: function (aString){
  1511. var self=this;
  1512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1513. return $core.withContext(function($ctx1) {
  1514. //>>excludeEnd("ctx");
  1515. var $2,$1,$receiver;
  1516. $2=self["@worker"];
  1517. if(($receiver = $2) == null || $receiver.isNil){
  1518. $1=self._error_("confirm: not available");
  1519. } else {
  1520. $1=$recv(self["@worker"])._confirm_(aString);
  1521. };
  1522. return $1;
  1523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1524. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  1525. //>>excludeEnd("ctx");
  1526. },
  1527. //>>excludeStart("ide", pragmas.excludeIdeData);
  1528. args: ["aString"],
  1529. source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
  1530. referencedClasses: [],
  1531. //>>excludeEnd("ide");
  1532. messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"]
  1533. }),
  1534. $globals.PlatformInterface.klass);
  1535. $core.addMethod(
  1536. $core.method({
  1537. selector: "existsGlobal:",
  1538. protocol: 'actions',
  1539. fn: function (aString){
  1540. var self=this;
  1541. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  1542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1543. return $core.withContext(function($ctx1) {
  1544. //>>excludeEnd("ctx");
  1545. var $1;
  1546. $1=$recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  1547. return true;
  1548. }),(function(){
  1549. return false;
  1550. }));
  1551. return $1;
  1552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1553. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  1554. //>>excludeEnd("ctx");
  1555. },
  1556. //>>excludeStart("ide", pragmas.excludeIdeData);
  1557. args: ["aString"],
  1558. source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  1559. referencedClasses: ["PlatformInterface"],
  1560. //>>excludeEnd("ide");
  1561. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  1562. }),
  1563. $globals.PlatformInterface.klass);
  1564. $core.addMethod(
  1565. $core.method({
  1566. selector: "globals",
  1567. protocol: 'accessing',
  1568. fn: function (){
  1569. var self=this;
  1570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1571. return $core.withContext(function($ctx1) {
  1572. //>>excludeEnd("ctx");
  1573. return (new Function('return this'))();;
  1574. return self;
  1575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1576. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  1577. //>>excludeEnd("ctx");
  1578. },
  1579. //>>excludeStart("ide", pragmas.excludeIdeData);
  1580. args: [],
  1581. source: "globals\x0a\x09<return (new Function('return this'))();>",
  1582. referencedClasses: [],
  1583. //>>excludeEnd("ide");
  1584. messageSends: []
  1585. }),
  1586. $globals.PlatformInterface.klass);
  1587. $core.addMethod(
  1588. $core.method({
  1589. selector: "initialize",
  1590. protocol: 'initialization',
  1591. fn: function (){
  1592. var self=this;
  1593. var candidate;
  1594. function $BrowserInterface(){return $globals.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
  1595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1596. return $core.withContext(function($ctx1) {
  1597. //>>excludeEnd("ctx");
  1598. var $1,$receiver;
  1599. (
  1600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1601. $ctx1.supercall = true,
  1602. //>>excludeEnd("ctx");
  1603. $globals.PlatformInterface.klass.superclass.fn.prototype._initialize.apply($recv(self), []));
  1604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1605. $ctx1.supercall = false;
  1606. //>>excludeEnd("ctx");;
  1607. if(($receiver = $BrowserInterface()) == null || $receiver.isNil){
  1608. $BrowserInterface();
  1609. } else {
  1610. candidate=$recv($BrowserInterface())._new();
  1611. candidate;
  1612. $1=$recv(candidate)._isAvailable();
  1613. if($core.assert($1)){
  1614. self._setWorker_(candidate);
  1615. return self;
  1616. };
  1617. };
  1618. return self;
  1619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1620. }, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},$globals.PlatformInterface.klass)});
  1621. //>>excludeEnd("ctx");
  1622. },
  1623. //>>excludeStart("ide", pragmas.excludeIdeData);
  1624. args: [],
  1625. source: "initialize\x0a\x09| candidate |\x0a\x09\x0a\x09super initialize.\x0a\x09\x0a\x09BrowserInterface ifNotNil: [\x0a\x09\x09candidate := BrowserInterface new.\x0a\x09\x09candidate isAvailable ifTrue: [ self setWorker: candidate. ^ self ]\x0a\x09]",
  1626. referencedClasses: ["BrowserInterface"],
  1627. //>>excludeEnd("ide");
  1628. messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"]
  1629. }),
  1630. $globals.PlatformInterface.klass);
  1631. $core.addMethod(
  1632. $core.method({
  1633. selector: "newXhr",
  1634. protocol: 'actions',
  1635. fn: function (){
  1636. var self=this;
  1637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1638. return $core.withContext(function($ctx1) {
  1639. //>>excludeEnd("ctx");
  1640. var $2,$1,$receiver;
  1641. $2=self["@worker"];
  1642. if(($receiver = $2) == null || $receiver.isNil){
  1643. $1=self._error_("newXhr: not available");
  1644. } else {
  1645. $1=$recv(self["@worker"])._newXhr();
  1646. };
  1647. return $1;
  1648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1649. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  1650. //>>excludeEnd("ctx");
  1651. },
  1652. //>>excludeStart("ide", pragmas.excludeIdeData);
  1653. args: [],
  1654. source: "newXhr\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker newXhr ]\x0a\x09\x09ifNil: [ self error: 'newXhr: not available' ]",
  1655. referencedClasses: [],
  1656. //>>excludeEnd("ide");
  1657. messageSends: ["ifNotNil:ifNil:", "newXhr", "error:"]
  1658. }),
  1659. $globals.PlatformInterface.klass);
  1660. $core.addMethod(
  1661. $core.method({
  1662. selector: "prompt:",
  1663. protocol: 'actions',
  1664. fn: function (aString){
  1665. var self=this;
  1666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1667. return $core.withContext(function($ctx1) {
  1668. //>>excludeEnd("ctx");
  1669. var $2,$1,$receiver;
  1670. $2=self["@worker"];
  1671. if(($receiver = $2) == null || $receiver.isNil){
  1672. $1=self._error_("prompt: not available");
  1673. } else {
  1674. $1=$recv(self["@worker"])._prompt_(aString);
  1675. };
  1676. return $1;
  1677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1678. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  1679. //>>excludeEnd("ctx");
  1680. },
  1681. //>>excludeStart("ide", pragmas.excludeIdeData);
  1682. args: ["aString"],
  1683. source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  1684. referencedClasses: [],
  1685. //>>excludeEnd("ide");
  1686. messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"]
  1687. }),
  1688. $globals.PlatformInterface.klass);
  1689. $core.addMethod(
  1690. $core.method({
  1691. selector: "prompt:default:",
  1692. protocol: 'actions',
  1693. fn: function (aString,defaultString){
  1694. var self=this;
  1695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1696. return $core.withContext(function($ctx1) {
  1697. //>>excludeEnd("ctx");
  1698. var $2,$1,$receiver;
  1699. $2=self["@worker"];
  1700. if(($receiver = $2) == null || $receiver.isNil){
  1701. $1=self._error_("prompt: not available");
  1702. } else {
  1703. $1=$recv(self["@worker"])._prompt_default_(aString,defaultString);
  1704. };
  1705. return $1;
  1706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1707. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  1708. //>>excludeEnd("ctx");
  1709. },
  1710. //>>excludeStart("ide", pragmas.excludeIdeData);
  1711. args: ["aString", "defaultString"],
  1712. source: "prompt: aString default: defaultString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString default: defaultString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  1713. referencedClasses: [],
  1714. //>>excludeEnd("ide");
  1715. messageSends: ["ifNotNil:ifNil:", "prompt:default:", "error:"]
  1716. }),
  1717. $globals.PlatformInterface.klass);
  1718. $core.addMethod(
  1719. $core.method({
  1720. selector: "setWorker:",
  1721. protocol: 'accessing',
  1722. fn: function (anObject){
  1723. var self=this;
  1724. self["@worker"]=anObject;
  1725. return self;
  1726. },
  1727. //>>excludeStart("ide", pragmas.excludeIdeData);
  1728. args: ["anObject"],
  1729. source: "setWorker: anObject\x0a\x09worker := anObject",
  1730. referencedClasses: [],
  1731. //>>excludeEnd("ide");
  1732. messageSends: []
  1733. }),
  1734. $globals.PlatformInterface.klass);
  1735. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  1736. //>>excludeStart("ide", pragmas.excludeIdeData);
  1737. $globals.Service.comment="I implement the basic behavior for class registration to a service.\x0a\x0aSee the `Transcript` class for a concrete service.\x0a\x0a## API\x0a\x0aUse class-side methods `#register:` and `#registerIfNone:` to register classes to a specific service.";
  1738. //>>excludeEnd("ide");
  1739. $globals.Service.klass.iVarNames = ['current'];
  1740. $core.addMethod(
  1741. $core.method({
  1742. selector: "current",
  1743. protocol: 'accessing',
  1744. fn: function (){
  1745. var self=this;
  1746. var $1;
  1747. $1=self["@current"];
  1748. return $1;
  1749. },
  1750. //>>excludeStart("ide", pragmas.excludeIdeData);
  1751. args: [],
  1752. source: "current\x0a\x09^ current",
  1753. referencedClasses: [],
  1754. //>>excludeEnd("ide");
  1755. messageSends: []
  1756. }),
  1757. $globals.Service.klass);
  1758. $core.addMethod(
  1759. $core.method({
  1760. selector: "new",
  1761. protocol: 'instance creation',
  1762. fn: function (){
  1763. var self=this;
  1764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1765. return $core.withContext(function($ctx1) {
  1766. //>>excludeEnd("ctx");
  1767. self._shouldNotImplement();
  1768. return self;
  1769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1770. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  1771. //>>excludeEnd("ctx");
  1772. },
  1773. //>>excludeStart("ide", pragmas.excludeIdeData);
  1774. args: [],
  1775. source: "new\x0a\x09self shouldNotImplement",
  1776. referencedClasses: [],
  1777. //>>excludeEnd("ide");
  1778. messageSends: ["shouldNotImplement"]
  1779. }),
  1780. $globals.Service.klass);
  1781. $core.addMethod(
  1782. $core.method({
  1783. selector: "register:",
  1784. protocol: 'registration',
  1785. fn: function (anObject){
  1786. var self=this;
  1787. self["@current"]=anObject;
  1788. return self;
  1789. },
  1790. //>>excludeStart("ide", pragmas.excludeIdeData);
  1791. args: ["anObject"],
  1792. source: "register: anObject\x0a\x09current := anObject",
  1793. referencedClasses: [],
  1794. //>>excludeEnd("ide");
  1795. messageSends: []
  1796. }),
  1797. $globals.Service.klass);
  1798. $core.addMethod(
  1799. $core.method({
  1800. selector: "registerIfNone:",
  1801. protocol: 'registration',
  1802. fn: function (anObject){
  1803. var self=this;
  1804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1805. return $core.withContext(function($ctx1) {
  1806. //>>excludeEnd("ctx");
  1807. var $1,$receiver;
  1808. $1=self._current();
  1809. if(($receiver = $1) == null || $receiver.isNil){
  1810. self._register_(anObject);
  1811. } else {
  1812. $1;
  1813. };
  1814. return self;
  1815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1816. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  1817. //>>excludeEnd("ctx");
  1818. },
  1819. //>>excludeStart("ide", pragmas.excludeIdeData);
  1820. args: ["anObject"],
  1821. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  1822. referencedClasses: [],
  1823. //>>excludeEnd("ide");
  1824. messageSends: ["ifNil:", "current", "register:"]
  1825. }),
  1826. $globals.Service.klass);
  1827. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  1828. //>>excludeStart("ide", pragmas.excludeIdeData);
  1829. $globals.ErrorHandler.comment="I am the service used to handle Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aRegistered service instances must implement `#handleError:` to perform an action on the thrown exception.";
  1830. //>>excludeEnd("ide");
  1831. $core.addMethod(
  1832. $core.method({
  1833. selector: "handleError:",
  1834. protocol: 'error handling',
  1835. fn: function (anError){
  1836. var self=this;
  1837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1838. return $core.withContext(function($ctx1) {
  1839. //>>excludeEnd("ctx");
  1840. self._handleUnhandledError_(anError);
  1841. return self;
  1842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1843. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  1844. //>>excludeEnd("ctx");
  1845. },
  1846. //>>excludeStart("ide", pragmas.excludeIdeData);
  1847. args: ["anError"],
  1848. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  1849. referencedClasses: [],
  1850. //>>excludeEnd("ide");
  1851. messageSends: ["handleUnhandledError:"]
  1852. }),
  1853. $globals.ErrorHandler.klass);
  1854. $core.addMethod(
  1855. $core.method({
  1856. selector: "handleUnhandledError:",
  1857. protocol: 'error handling',
  1858. fn: function (anError){
  1859. var self=this;
  1860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1861. return $core.withContext(function($ctx1) {
  1862. //>>excludeEnd("ctx");
  1863. var $1,$2;
  1864. $1=$recv(anError)._wasHandled();
  1865. if($core.assert($1)){
  1866. return self;
  1867. };
  1868. $2=$recv(self._current())._handleError_(anError);
  1869. return $2;
  1870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1871. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  1872. //>>excludeEnd("ctx");
  1873. },
  1874. //>>excludeStart("ide", pragmas.excludeIdeData);
  1875. args: ["anError"],
  1876. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  1877. referencedClasses: [],
  1878. //>>excludeEnd("ide");
  1879. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  1880. }),
  1881. $globals.ErrorHandler.klass);
  1882. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  1883. //>>excludeStart("ide", pragmas.excludeIdeData);
  1884. $globals.Finder.comment="I am the service responsible for finding classes/methods.\x0a__There is no default finder.__\x0a\x0a## API\x0a\x0aUse `#browse` on an object to find it.";
  1885. //>>excludeEnd("ide");
  1886. $core.addMethod(
  1887. $core.method({
  1888. selector: "findClass:",
  1889. protocol: 'finding',
  1890. fn: function (aClass){
  1891. var self=this;
  1892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1893. return $core.withContext(function($ctx1) {
  1894. //>>excludeEnd("ctx");
  1895. var $1;
  1896. $1=$recv(self._current())._findClass_(aClass);
  1897. return $1;
  1898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1899. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  1900. //>>excludeEnd("ctx");
  1901. },
  1902. //>>excludeStart("ide", pragmas.excludeIdeData);
  1903. args: ["aClass"],
  1904. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  1905. referencedClasses: [],
  1906. //>>excludeEnd("ide");
  1907. messageSends: ["findClass:", "current"]
  1908. }),
  1909. $globals.Finder.klass);
  1910. $core.addMethod(
  1911. $core.method({
  1912. selector: "findMethod:",
  1913. protocol: 'finding',
  1914. fn: function (aCompiledMethod){
  1915. var self=this;
  1916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1917. return $core.withContext(function($ctx1) {
  1918. //>>excludeEnd("ctx");
  1919. var $1;
  1920. $1=$recv(self._current())._findMethod_(aCompiledMethod);
  1921. return $1;
  1922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1923. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  1924. //>>excludeEnd("ctx");
  1925. },
  1926. //>>excludeStart("ide", pragmas.excludeIdeData);
  1927. args: ["aCompiledMethod"],
  1928. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  1929. referencedClasses: [],
  1930. //>>excludeEnd("ide");
  1931. messageSends: ["findMethod:", "current"]
  1932. }),
  1933. $globals.Finder.klass);
  1934. $core.addMethod(
  1935. $core.method({
  1936. selector: "findString:",
  1937. protocol: 'finding',
  1938. fn: function (aString){
  1939. var self=this;
  1940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1941. return $core.withContext(function($ctx1) {
  1942. //>>excludeEnd("ctx");
  1943. var $1;
  1944. $1=$recv(self._current())._findString_(aString);
  1945. return $1;
  1946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1947. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  1948. //>>excludeEnd("ctx");
  1949. },
  1950. //>>excludeStart("ide", pragmas.excludeIdeData);
  1951. args: ["aString"],
  1952. source: "findString: aString\x0a\x09^ self current findString: aString",
  1953. referencedClasses: [],
  1954. //>>excludeEnd("ide");
  1955. messageSends: ["findString:", "current"]
  1956. }),
  1957. $globals.Finder.klass);
  1958. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  1959. //>>excludeStart("ide", pragmas.excludeIdeData);
  1960. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  1961. //>>excludeEnd("ide");
  1962. $core.addMethod(
  1963. $core.method({
  1964. selector: "inspect:",
  1965. protocol: 'inspecting',
  1966. fn: function (anObject){
  1967. var self=this;
  1968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1969. return $core.withContext(function($ctx1) {
  1970. //>>excludeEnd("ctx");
  1971. var $1;
  1972. $1=$recv(self._current())._inspect_(anObject);
  1973. return $1;
  1974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1975. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  1976. //>>excludeEnd("ctx");
  1977. },
  1978. //>>excludeStart("ide", pragmas.excludeIdeData);
  1979. args: ["anObject"],
  1980. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  1981. referencedClasses: [],
  1982. //>>excludeEnd("ide");
  1983. messageSends: ["inspect:", "current"]
  1984. }),
  1985. $globals.Inspector.klass);
  1986. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  1987. //>>excludeStart("ide", pragmas.excludeIdeData);
  1988. $globals.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aRegistered instances must implement `#do:on:displaying:`.\x0a\x0aThe default behavior is to simply iterate over the collection, using `NullProgressHandler`.";
  1989. //>>excludeEnd("ide");
  1990. $core.addMethod(
  1991. $core.method({
  1992. selector: "do:on:displaying:",
  1993. protocol: 'progress handling',
  1994. fn: function (aBlock,aCollection,aString){
  1995. var self=this;
  1996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1997. return $core.withContext(function($ctx1) {
  1998. //>>excludeEnd("ctx");
  1999. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  2000. return self;
  2001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2002. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  2003. //>>excludeEnd("ctx");
  2004. },
  2005. //>>excludeStart("ide", pragmas.excludeIdeData);
  2006. args: ["aBlock", "aCollection", "aString"],
  2007. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  2008. referencedClasses: [],
  2009. //>>excludeEnd("ide");
  2010. messageSends: ["do:on:displaying:", "current"]
  2011. }),
  2012. $globals.ProgressHandler.klass);
  2013. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  2014. //>>excludeStart("ide", pragmas.excludeIdeData);
  2015. $globals.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a Transcript \x0a show: 'hello world';\x0a cr;\x0a show: anObject.";
  2016. //>>excludeEnd("ide");
  2017. $core.addMethod(
  2018. $core.method({
  2019. selector: "clear",
  2020. protocol: 'printing',
  2021. fn: function (){
  2022. var self=this;
  2023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2024. return $core.withContext(function($ctx1) {
  2025. //>>excludeEnd("ctx");
  2026. $recv(self._current())._clear();
  2027. return self;
  2028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2029. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  2030. //>>excludeEnd("ctx");
  2031. },
  2032. //>>excludeStart("ide", pragmas.excludeIdeData);
  2033. args: [],
  2034. source: "clear\x0a\x09self current clear",
  2035. referencedClasses: [],
  2036. //>>excludeEnd("ide");
  2037. messageSends: ["clear", "current"]
  2038. }),
  2039. $globals.Transcript.klass);
  2040. $core.addMethod(
  2041. $core.method({
  2042. selector: "cr",
  2043. protocol: 'printing',
  2044. fn: function (){
  2045. var self=this;
  2046. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  2047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2048. return $core.withContext(function($ctx1) {
  2049. //>>excludeEnd("ctx");
  2050. $recv(self._current())._show_($recv($String())._cr());
  2051. return self;
  2052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2053. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  2054. //>>excludeEnd("ctx");
  2055. },
  2056. //>>excludeStart("ide", pragmas.excludeIdeData);
  2057. args: [],
  2058. source: "cr\x0a\x09self current show: String cr",
  2059. referencedClasses: ["String"],
  2060. //>>excludeEnd("ide");
  2061. messageSends: ["show:", "current", "cr"]
  2062. }),
  2063. $globals.Transcript.klass);
  2064. $core.addMethod(
  2065. $core.method({
  2066. selector: "inspect:",
  2067. protocol: 'printing',
  2068. fn: function (anObject){
  2069. var self=this;
  2070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2071. return $core.withContext(function($ctx1) {
  2072. //>>excludeEnd("ctx");
  2073. self._show_(anObject);
  2074. return self;
  2075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2076. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  2077. //>>excludeEnd("ctx");
  2078. },
  2079. //>>excludeStart("ide", pragmas.excludeIdeData);
  2080. args: ["anObject"],
  2081. source: "inspect: anObject\x0a\x09self show: anObject",
  2082. referencedClasses: [],
  2083. //>>excludeEnd("ide");
  2084. messageSends: ["show:"]
  2085. }),
  2086. $globals.Transcript.klass);
  2087. $core.addMethod(
  2088. $core.method({
  2089. selector: "open",
  2090. protocol: 'instance creation',
  2091. fn: function (){
  2092. var self=this;
  2093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2094. return $core.withContext(function($ctx1) {
  2095. //>>excludeEnd("ctx");
  2096. $recv(self._current())._open();
  2097. return self;
  2098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2099. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  2100. //>>excludeEnd("ctx");
  2101. },
  2102. //>>excludeStart("ide", pragmas.excludeIdeData);
  2103. args: [],
  2104. source: "open\x0a\x09self current open",
  2105. referencedClasses: [],
  2106. //>>excludeEnd("ide");
  2107. messageSends: ["open", "current"]
  2108. }),
  2109. $globals.Transcript.klass);
  2110. $core.addMethod(
  2111. $core.method({
  2112. selector: "show:",
  2113. protocol: 'printing',
  2114. fn: function (anObject){
  2115. var self=this;
  2116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2117. return $core.withContext(function($ctx1) {
  2118. //>>excludeEnd("ctx");
  2119. $recv(self._current())._show_(anObject);
  2120. return self;
  2121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2122. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  2123. //>>excludeEnd("ctx");
  2124. },
  2125. //>>excludeStart("ide", pragmas.excludeIdeData);
  2126. args: ["anObject"],
  2127. source: "show: anObject\x0a\x09self current show: anObject",
  2128. referencedClasses: [],
  2129. //>>excludeEnd("ide");
  2130. messageSends: ["show:", "current"]
  2131. }),
  2132. $globals.Transcript.klass);
  2133. $core.addMethod(
  2134. $core.method({
  2135. selector: "inspectOn:",
  2136. protocol: '*Platform-Services',
  2137. fn: function (anInspector){
  2138. var self=this;
  2139. var variables;
  2140. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2142. return $core.withContext(function($ctx1) {
  2143. //>>excludeEnd("ctx");
  2144. var $1;
  2145. variables=$recv($Dictionary())._new();
  2146. $recv(variables)._at_put_("#self",self);
  2147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2148. $ctx1.sendIdx["at:put:"]=1;
  2149. //>>excludeEnd("ctx");
  2150. $recv(variables)._at_put_("#keys",self._keys());
  2151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2152. $ctx1.sendIdx["at:put:"]=2;
  2153. //>>excludeEnd("ctx");
  2154. self._keysAndValuesDo_((function(key,value){
  2155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2156. return $core.withContext(function($ctx2) {
  2157. //>>excludeEnd("ctx");
  2158. return $recv(variables)._at_put_(key,value);
  2159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2160. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2161. //>>excludeEnd("ctx");
  2162. }));
  2163. $recv(anInspector)._setLabel_(self._printString());
  2164. $1=$recv(anInspector)._setVariables_(variables);
  2165. return self;
  2166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2167. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  2168. //>>excludeEnd("ctx");
  2169. },
  2170. //>>excludeStart("ide", pragmas.excludeIdeData);
  2171. args: ["anInspector"],
  2172. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#keys' put: self keys.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09variables at: key put: value ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  2173. referencedClasses: ["Dictionary"],
  2174. //>>excludeEnd("ide");
  2175. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  2176. }),
  2177. $globals.AssociativeCollection);
  2178. $core.addMethod(
  2179. $core.method({
  2180. selector: "inspectOn:",
  2181. protocol: '*Platform-Services',
  2182. fn: function (anInspector){
  2183. var self=this;
  2184. var variables;
  2185. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2187. return $core.withContext(function($ctx1) {
  2188. //>>excludeEnd("ctx");
  2189. var $1;
  2190. variables=$recv($Dictionary())._new();
  2191. $recv(variables)._at_put_("#self",self);
  2192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2193. $ctx1.sendIdx["at:put:"]=1;
  2194. //>>excludeEnd("ctx");
  2195. self._withIndexDo_((function(each,i){
  2196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2197. return $core.withContext(function($ctx2) {
  2198. //>>excludeEnd("ctx");
  2199. return $recv(variables)._at_put_(i,each);
  2200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2201. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  2202. //>>excludeEnd("ctx");
  2203. }));
  2204. $recv(anInspector)._setLabel_(self._printString());
  2205. $1=$recv(anInspector)._setVariables_(variables);
  2206. return self;
  2207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2208. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  2209. //>>excludeEnd("ctx");
  2210. },
  2211. //>>excludeStart("ide", pragmas.excludeIdeData);
  2212. args: ["anInspector"],
  2213. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09variables at: i put: each ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  2214. referencedClasses: ["Dictionary"],
  2215. //>>excludeEnd("ide");
  2216. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  2217. }),
  2218. $globals.Collection);
  2219. $core.addMethod(
  2220. $core.method({
  2221. selector: "inspectOn:",
  2222. protocol: '*Platform-Services',
  2223. fn: function (anInspector){
  2224. var self=this;
  2225. var variables;
  2226. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2228. return $core.withContext(function($ctx1) {
  2229. //>>excludeEnd("ctx");
  2230. var $1;
  2231. variables=$recv($Dictionary())._new();
  2232. $recv(variables)._at_put_("#self",self);
  2233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2234. $ctx1.sendIdx["at:put:"]=1;
  2235. //>>excludeEnd("ctx");
  2236. $recv(variables)._at_put_("#year",self._year());
  2237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2238. $ctx1.sendIdx["at:put:"]=2;
  2239. //>>excludeEnd("ctx");
  2240. $recv(variables)._at_put_("#month",self._month());
  2241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2242. $ctx1.sendIdx["at:put:"]=3;
  2243. //>>excludeEnd("ctx");
  2244. $recv(variables)._at_put_("#day",self._day());
  2245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2246. $ctx1.sendIdx["at:put:"]=4;
  2247. //>>excludeEnd("ctx");
  2248. $recv(variables)._at_put_("#hours",self._hours());
  2249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2250. $ctx1.sendIdx["at:put:"]=5;
  2251. //>>excludeEnd("ctx");
  2252. $recv(variables)._at_put_("#minutes",self._minutes());
  2253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2254. $ctx1.sendIdx["at:put:"]=6;
  2255. //>>excludeEnd("ctx");
  2256. $recv(variables)._at_put_("#seconds",self._seconds());
  2257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2258. $ctx1.sendIdx["at:put:"]=7;
  2259. //>>excludeEnd("ctx");
  2260. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  2261. $recv(anInspector)._setLabel_(self._printString());
  2262. $1=$recv(anInspector)._setVariables_(variables);
  2263. return self;
  2264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2265. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  2266. //>>excludeEnd("ctx");
  2267. },
  2268. //>>excludeStart("ide", pragmas.excludeIdeData);
  2269. args: ["anInspector"],
  2270. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#year' put: self year.\x0a\x09variables at: '#month' put: self month.\x0a\x09variables at: '#day' put: self day.\x0a\x09variables at: '#hours' put: self hours.\x0a\x09variables at: '#minutes' put: self minutes.\x0a\x09variables at: '#seconds' put: self seconds.\x0a\x09variables at: '#milliseconds' put: self milliseconds.\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  2271. referencedClasses: ["Dictionary"],
  2272. //>>excludeEnd("ide");
  2273. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  2274. }),
  2275. $globals.Date);
  2276. $core.addMethod(
  2277. $core.method({
  2278. selector: "inspectOn:",
  2279. protocol: '*Platform-Services',
  2280. fn: function (anInspector){
  2281. var self=this;
  2282. var variables;
  2283. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2284. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  2285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2286. return $core.withContext(function($ctx1) {
  2287. //>>excludeEnd("ctx");
  2288. variables=$recv($Dictionary())._new();
  2289. $recv(variables)._at_put_("#self",self._jsObject());
  2290. $recv(anInspector)._setLabel_(self._printString());
  2291. $recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self);
  2292. $recv(anInspector)._setVariables_(variables);
  2293. return self;
  2294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2295. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  2296. //>>excludeEnd("ctx");
  2297. },
  2298. //>>excludeStart("ide", pragmas.excludeIdeData);
  2299. args: ["anInspector"],
  2300. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09JSObjectProxy addObjectVariablesTo: variables ofProxy: self.\x0a\x09anInspector setVariables: variables",
  2301. referencedClasses: ["Dictionary", "JSObjectProxy"],
  2302. //>>excludeEnd("ide");
  2303. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  2304. }),
  2305. $globals.JSObjectProxy);
  2306. $core.addMethod(
  2307. $core.method({
  2308. selector: "inspectOn:",
  2309. protocol: '*Platform-Services',
  2310. fn: function (anInspector){
  2311. var self=this;
  2312. var variables;
  2313. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2315. return $core.withContext(function($ctx1) {
  2316. //>>excludeEnd("ctx");
  2317. var $1;
  2318. variables=$recv($Dictionary())._new();
  2319. $recv(variables)._at_put_("#self",self);
  2320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2321. $ctx1.sendIdx["at:put:"]=1;
  2322. //>>excludeEnd("ctx");
  2323. $recv(variables)._at_put_("#home",self._home());
  2324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2325. $ctx1.sendIdx["at:put:"]=2;
  2326. //>>excludeEnd("ctx");
  2327. $recv(variables)._at_put_("#receiver",self._receiver());
  2328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2329. $ctx1.sendIdx["at:put:"]=3;
  2330. //>>excludeEnd("ctx");
  2331. $recv(variables)._at_put_("#selector",self._selector());
  2332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2333. $ctx1.sendIdx["at:put:"]=4;
  2334. //>>excludeEnd("ctx");
  2335. $recv(variables)._at_put_("#locals",self._locals());
  2336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2337. $ctx1.sendIdx["at:put:"]=5;
  2338. //>>excludeEnd("ctx");
  2339. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  2340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2341. return $core.withContext(function($ctx2) {
  2342. //>>excludeEnd("ctx");
  2343. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  2344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2346. //>>excludeEnd("ctx");
  2347. }));
  2348. $recv(anInspector)._setLabel_(self._printString());
  2349. $1=$recv(anInspector)._setVariables_(variables);
  2350. return self;
  2351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2352. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  2353. //>>excludeEnd("ctx");
  2354. },
  2355. //>>excludeStart("ide", pragmas.excludeIdeData);
  2356. args: ["anInspector"],
  2357. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#home' put: self home.\x0a\x09variables at: '#receiver' put: self receiver.\x0a\x09variables at: '#selector' put: self selector.\x0a\x09variables at: '#locals' put: self locals.\x0a\x09self class instanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  2358. referencedClasses: ["Dictionary"],
  2359. //>>excludeEnd("ide");
  2360. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  2361. }),
  2362. $globals.MethodContext);
  2363. $core.addMethod(
  2364. $core.method({
  2365. selector: "inspectOn:",
  2366. protocol: '*Platform-Services',
  2367. fn: function (anInspector){
  2368. var self=this;
  2369. var variables;
  2370. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2372. return $core.withContext(function($ctx1) {
  2373. //>>excludeEnd("ctx");
  2374. var $1;
  2375. variables=$recv($Dictionary())._new();
  2376. $recv(variables)._at_put_("#self",self);
  2377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2378. $ctx1.sendIdx["at:put:"]=1;
  2379. //>>excludeEnd("ctx");
  2380. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  2381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2382. return $core.withContext(function($ctx2) {
  2383. //>>excludeEnd("ctx");
  2384. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  2385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2386. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2387. //>>excludeEnd("ctx");
  2388. }));
  2389. $recv(anInspector)._setLabel_(self._printString());
  2390. $1=$recv(anInspector)._setVariables_(variables);
  2391. return self;
  2392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2393. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  2394. //>>excludeEnd("ctx");
  2395. },
  2396. //>>excludeStart("ide", pragmas.excludeIdeData);
  2397. args: ["anInspector"],
  2398. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  2399. referencedClasses: ["Dictionary"],
  2400. //>>excludeEnd("ide");
  2401. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  2402. }),
  2403. $globals.Object);
  2404. $core.addMethod(
  2405. $core.method({
  2406. selector: "do:displayingProgress:",
  2407. protocol: '*Platform-Services',
  2408. fn: function (aBlock,aString){
  2409. var self=this;
  2410. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  2411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2412. return $core.withContext(function($ctx1) {
  2413. //>>excludeEnd("ctx");
  2414. $recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  2415. return self;
  2416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2417. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  2418. //>>excludeEnd("ctx");
  2419. },
  2420. //>>excludeStart("ide", pragmas.excludeIdeData);
  2421. args: ["aBlock", "aString"],
  2422. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  2423. referencedClasses: ["ProgressHandler"],
  2424. //>>excludeEnd("ide");
  2425. messageSends: ["do:on:displaying:"]
  2426. }),
  2427. $globals.SequenceableCollection);
  2428. $core.addMethod(
  2429. $core.method({
  2430. selector: "inspectOn:",
  2431. protocol: '*Platform-Services',
  2432. fn: function (anInspector){
  2433. var self=this;
  2434. var variables,i;
  2435. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2437. return $core.withContext(function($ctx1) {
  2438. //>>excludeEnd("ctx");
  2439. var $1;
  2440. variables=$recv($Dictionary())._new();
  2441. $recv(variables)._at_put_("#self",self);
  2442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2443. $ctx1.sendIdx["at:put:"]=1;
  2444. //>>excludeEnd("ctx");
  2445. i=(1);
  2446. self._do_((function(each){
  2447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2448. return $core.withContext(function($ctx2) {
  2449. //>>excludeEnd("ctx");
  2450. $recv(variables)._at_put_(i,each);
  2451. i=$recv(i).__plus((1));
  2452. return i;
  2453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2455. //>>excludeEnd("ctx");
  2456. }));
  2457. $recv(anInspector)._setLabel_(self._printString());
  2458. $1=$recv(anInspector)._setVariables_(variables);
  2459. return self;
  2460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2461. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  2462. //>>excludeEnd("ctx");
  2463. },
  2464. //>>excludeStart("ide", pragmas.excludeIdeData);
  2465. args: ["anInspector"],
  2466. source: "inspectOn: anInspector\x0a\x09| variables i |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09i := 1.\x0a\x09self do: [ :each |\x0a\x09\x09variables at: i put: each.\x0a\x09\x09i := i + 1 ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  2467. referencedClasses: ["Dictionary"],
  2468. //>>excludeEnd("ide");
  2469. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  2470. }),
  2471. $globals.Set);
  2472. $core.addMethod(
  2473. $core.method({
  2474. selector: "inspectOn:",
  2475. protocol: '*Platform-Services',
  2476. fn: function (anInspector){
  2477. var self=this;
  2478. var label;
  2479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2480. return $core.withContext(function($ctx1) {
  2481. //>>excludeEnd("ctx");
  2482. var $3,$2,$1,$5,$4;
  2483. (
  2484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2485. $ctx1.supercall = true,
  2486. //>>excludeEnd("ctx");
  2487. $globals.String.superclass.fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  2488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2489. $ctx1.supercall = false;
  2490. //>>excludeEnd("ctx");;
  2491. $3=self._printString();
  2492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2493. $ctx1.sendIdx["printString"]=1;
  2494. //>>excludeEnd("ctx");
  2495. $2=$recv($3)._size();
  2496. $1=$recv($2).__gt((30));
  2497. if($core.assert($1)){
  2498. $5=self._printString();
  2499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2500. $ctx1.sendIdx["printString"]=2;
  2501. //>>excludeEnd("ctx");
  2502. $4=$recv($5)._copyFrom_to_((1),(30));
  2503. label=$recv($4).__comma("...'");
  2504. label;
  2505. } else {
  2506. label=self._printString();
  2507. label;
  2508. };
  2509. $recv(anInspector)._setLabel_(label);
  2510. return self;
  2511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2512. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  2513. //>>excludeEnd("ctx");
  2514. },
  2515. //>>excludeStart("ide", pragmas.excludeIdeData);
  2516. args: ["anInspector"],
  2517. source: "inspectOn: anInspector\x0a\x09| label |\x0a\x09super inspectOn: anInspector.\x0a\x09self printString size > 30\x0a\x09\x09ifTrue: [ label := (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ label := self printString ].\x0a\x09anInspector setLabel: label",
  2518. referencedClasses: [],
  2519. //>>excludeEnd("ide");
  2520. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  2521. }),
  2522. $globals.String);
  2523. });