Platform-Services.js 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201
  1. define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){
  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. $1=$recv($PlatformInterface())._ajax_(anObject);
  298. return $1;
  299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  300. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  301. //>>excludeEnd("ctx");
  302. },
  303. //>>excludeStart("ide", pragmas.excludeIdeData);
  304. args: ["anObject"],
  305. source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject",
  306. referencedClasses: ["PlatformInterface"],
  307. //>>excludeEnd("ide");
  308. messageSends: ["ajax:"]
  309. }),
  310. $globals.InterfacingObject);
  311. $core.addMethod(
  312. $core.method({
  313. selector: "alert:",
  314. protocol: 'actions',
  315. fn: function (aString){
  316. var self=this;
  317. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  319. return $core.withContext(function($ctx1) {
  320. //>>excludeEnd("ctx");
  321. var $1;
  322. $1=$recv($PlatformInterface())._alert_(aString);
  323. return $1;
  324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  325. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  326. //>>excludeEnd("ctx");
  327. },
  328. //>>excludeStart("ide", pragmas.excludeIdeData);
  329. args: ["aString"],
  330. source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
  331. referencedClasses: ["PlatformInterface"],
  332. //>>excludeEnd("ide");
  333. messageSends: ["alert:"]
  334. }),
  335. $globals.InterfacingObject);
  336. $core.addMethod(
  337. $core.method({
  338. selector: "confirm:",
  339. protocol: 'actions',
  340. fn: function (aString){
  341. var self=this;
  342. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  344. return $core.withContext(function($ctx1) {
  345. //>>excludeEnd("ctx");
  346. var $1;
  347. $1=$recv($PlatformInterface())._confirm_(aString);
  348. return $1;
  349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  350. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  351. //>>excludeEnd("ctx");
  352. },
  353. //>>excludeStart("ide", pragmas.excludeIdeData);
  354. args: ["aString"],
  355. source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
  356. referencedClasses: ["PlatformInterface"],
  357. //>>excludeEnd("ide");
  358. messageSends: ["confirm:"]
  359. }),
  360. $globals.InterfacingObject);
  361. $core.addMethod(
  362. $core.method({
  363. selector: "prompt:",
  364. protocol: 'actions',
  365. fn: function (aString){
  366. var self=this;
  367. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  369. return $core.withContext(function($ctx1) {
  370. //>>excludeEnd("ctx");
  371. var $1;
  372. $1=$recv($PlatformInterface())._prompt_(aString);
  373. return $1;
  374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  375. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  376. //>>excludeEnd("ctx");
  377. },
  378. //>>excludeStart("ide", pragmas.excludeIdeData);
  379. args: ["aString"],
  380. source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
  381. referencedClasses: ["PlatformInterface"],
  382. //>>excludeEnd("ide");
  383. messageSends: ["prompt:"]
  384. }),
  385. $globals.InterfacingObject);
  386. $core.addMethod(
  387. $core.method({
  388. selector: "prompt:default:",
  389. protocol: 'actions',
  390. fn: function (aString,defaultString){
  391. var self=this;
  392. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  394. return $core.withContext(function($ctx1) {
  395. //>>excludeEnd("ctx");
  396. var $1;
  397. $1=$recv($PlatformInterface())._prompt_default_(aString,defaultString);
  398. return $1;
  399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  400. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  401. //>>excludeEnd("ctx");
  402. },
  403. //>>excludeStart("ide", pragmas.excludeIdeData);
  404. args: ["aString", "defaultString"],
  405. source: "prompt: aString default: defaultString\x0a\x09^ PlatformInterface prompt: aString default: defaultString",
  406. referencedClasses: ["PlatformInterface"],
  407. //>>excludeEnd("ide");
  408. messageSends: ["prompt:default:"]
  409. }),
  410. $globals.InterfacingObject);
  411. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  412. //>>excludeStart("ide", pragmas.excludeIdeData);
  413. $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.";
  414. //>>excludeEnd("ide");
  415. $core.addMethod(
  416. $core.method({
  417. selector: "addInstVarNamed:to:",
  418. protocol: 'compiling',
  419. fn: function (aString,aClass){
  420. var self=this;
  421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  422. return $core.withContext(function($ctx1) {
  423. //>>excludeEnd("ctx");
  424. var $1,$2,$3,$4,$5;
  425. $1=self._classBuilder();
  426. $2=$recv(aClass)._superclass();
  427. $3=$recv(aClass)._name();
  428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  429. $ctx1.sendIdx["name"]=1;
  430. //>>excludeEnd("ctx");
  431. $4=$recv($recv(aClass)._instanceVariableNames())._copy();
  432. $recv($4)._add_(aString);
  433. $5=$recv($4)._yourself();
  434. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,$recv($recv(aClass)._package())._name());
  435. return self;
  436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  437. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  438. //>>excludeEnd("ctx");
  439. },
  440. //>>excludeStart("ide", pragmas.excludeIdeData);
  441. args: ["aString", "aClass"],
  442. 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",
  443. referencedClasses: [],
  444. //>>excludeEnd("ide");
  445. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  446. }),
  447. $globals.Environment);
  448. $core.addMethod(
  449. $core.method({
  450. selector: "allSelectors",
  451. protocol: 'accessing',
  452. fn: function (){
  453. var self=this;
  454. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  456. return $core.withContext(function($ctx1) {
  457. //>>excludeEnd("ctx");
  458. var $1;
  459. $1=$recv($recv($Smalltalk())._core())._allSelectors();
  460. return $1;
  461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  462. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  463. //>>excludeEnd("ctx");
  464. },
  465. //>>excludeStart("ide", pragmas.excludeIdeData);
  466. args: [],
  467. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  468. referencedClasses: ["Smalltalk"],
  469. //>>excludeEnd("ide");
  470. messageSends: ["allSelectors", "core"]
  471. }),
  472. $globals.Environment);
  473. $core.addMethod(
  474. $core.method({
  475. selector: "availableClassNames",
  476. protocol: 'accessing',
  477. fn: function (){
  478. var self=this;
  479. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  481. return $core.withContext(function($ctx1) {
  482. //>>excludeEnd("ctx");
  483. var $1;
  484. $1=$recv($recv($Smalltalk())._classes())._collect_((function(each){
  485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  486. return $core.withContext(function($ctx2) {
  487. //>>excludeEnd("ctx");
  488. return $recv(each)._name();
  489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  491. //>>excludeEnd("ctx");
  492. }));
  493. return $1;
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  496. //>>excludeEnd("ctx");
  497. },
  498. //>>excludeStart("ide", pragmas.excludeIdeData);
  499. args: [],
  500. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  501. referencedClasses: ["Smalltalk"],
  502. //>>excludeEnd("ide");
  503. messageSends: ["collect:", "classes", "name"]
  504. }),
  505. $globals.Environment);
  506. $core.addMethod(
  507. $core.method({
  508. selector: "availablePackageNames",
  509. protocol: 'accessing',
  510. fn: function (){
  511. var self=this;
  512. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  514. return $core.withContext(function($ctx1) {
  515. //>>excludeEnd("ctx");
  516. var $1;
  517. $1=$recv($recv($Smalltalk())._packages())._collect_((function(each){
  518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  519. return $core.withContext(function($ctx2) {
  520. //>>excludeEnd("ctx");
  521. return $recv(each)._name();
  522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  524. //>>excludeEnd("ctx");
  525. }));
  526. return $1;
  527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  528. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  529. //>>excludeEnd("ctx");
  530. },
  531. //>>excludeStart("ide", pragmas.excludeIdeData);
  532. args: [],
  533. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  534. referencedClasses: ["Smalltalk"],
  535. //>>excludeEnd("ide");
  536. messageSends: ["collect:", "packages", "name"]
  537. }),
  538. $globals.Environment);
  539. $core.addMethod(
  540. $core.method({
  541. selector: "availableProtocolsFor:",
  542. protocol: 'accessing',
  543. fn: function (aClass){
  544. var self=this;
  545. var protocols;
  546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  547. return $core.withContext(function($ctx1) {
  548. //>>excludeEnd("ctx");
  549. var $1,$2,$receiver;
  550. protocols=$recv(aClass)._protocols();
  551. $1=$recv(aClass)._superclass();
  552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  553. $ctx1.sendIdx["superclass"]=1;
  554. //>>excludeEnd("ctx");
  555. if(($receiver = $1) == null || $receiver.isNil){
  556. $1;
  557. } else {
  558. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  559. };
  560. $2=$recv($recv($recv(protocols)._asSet())._asArray())._sort();
  561. return $2;
  562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  563. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  564. //>>excludeEnd("ctx");
  565. },
  566. //>>excludeStart("ide", pragmas.excludeIdeData);
  567. args: ["aClass"],
  568. 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",
  569. referencedClasses: [],
  570. //>>excludeEnd("ide");
  571. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  572. }),
  573. $globals.Environment);
  574. $core.addMethod(
  575. $core.method({
  576. selector: "classBuilder",
  577. protocol: 'accessing',
  578. fn: function (){
  579. var self=this;
  580. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  582. return $core.withContext(function($ctx1) {
  583. //>>excludeEnd("ctx");
  584. var $1;
  585. $1=$recv($ClassBuilder())._new();
  586. return $1;
  587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  588. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  589. //>>excludeEnd("ctx");
  590. },
  591. //>>excludeStart("ide", pragmas.excludeIdeData);
  592. args: [],
  593. source: "classBuilder\x0a\x09^ ClassBuilder new",
  594. referencedClasses: ["ClassBuilder"],
  595. //>>excludeEnd("ide");
  596. messageSends: ["new"]
  597. }),
  598. $globals.Environment);
  599. $core.addMethod(
  600. $core.method({
  601. selector: "classNamed:",
  602. protocol: 'accessing',
  603. fn: function (aString){
  604. var self=this;
  605. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  607. return $core.withContext(function($ctx1) {
  608. //>>excludeEnd("ctx");
  609. var $2,$1,$receiver;
  610. $2=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol());
  611. if(($receiver = $2) == null || $receiver.isNil){
  612. $1=self._error_("Invalid class name");
  613. } else {
  614. $1=$2;
  615. };
  616. return $1;
  617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  618. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  619. //>>excludeEnd("ctx");
  620. },
  621. //>>excludeStart("ide", pragmas.excludeIdeData);
  622. args: ["aString"],
  623. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  624. referencedClasses: ["Smalltalk"],
  625. //>>excludeEnd("ide");
  626. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  627. }),
  628. $globals.Environment);
  629. $core.addMethod(
  630. $core.method({
  631. selector: "classes",
  632. protocol: 'accessing',
  633. fn: function (){
  634. var self=this;
  635. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  637. return $core.withContext(function($ctx1) {
  638. //>>excludeEnd("ctx");
  639. var $1;
  640. $1=$recv($Smalltalk())._classes();
  641. return $1;
  642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  643. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  644. //>>excludeEnd("ctx");
  645. },
  646. //>>excludeStart("ide", pragmas.excludeIdeData);
  647. args: [],
  648. source: "classes\x0a\x09^ Smalltalk classes",
  649. referencedClasses: ["Smalltalk"],
  650. //>>excludeEnd("ide");
  651. messageSends: ["classes"]
  652. }),
  653. $globals.Environment);
  654. $core.addMethod(
  655. $core.method({
  656. selector: "commitPackage:onSuccess:onError:",
  657. protocol: 'actions',
  658. fn: function (aPackage,aBlock,anotherBlock){
  659. var self=this;
  660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  661. return $core.withContext(function($ctx1) {
  662. //>>excludeEnd("ctx");
  663. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  664. return self;
  665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  666. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  667. //>>excludeEnd("ctx");
  668. },
  669. //>>excludeStart("ide", pragmas.excludeIdeData);
  670. args: ["aPackage", "aBlock", "anotherBlock"],
  671. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  672. referencedClasses: [],
  673. //>>excludeEnd("ide");
  674. messageSends: ["commitOnSuccess:onError:", "transport"]
  675. }),
  676. $globals.Environment);
  677. $core.addMethod(
  678. $core.method({
  679. selector: "compileClassComment:for:",
  680. protocol: 'compiling',
  681. fn: function (aString,aClass){
  682. var self=this;
  683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  684. return $core.withContext(function($ctx1) {
  685. //>>excludeEnd("ctx");
  686. $recv(aClass)._comment_(aString);
  687. return self;
  688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  689. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  690. //>>excludeEnd("ctx");
  691. },
  692. //>>excludeStart("ide", pragmas.excludeIdeData);
  693. args: ["aString", "aClass"],
  694. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  695. referencedClasses: [],
  696. //>>excludeEnd("ide");
  697. messageSends: ["comment:"]
  698. }),
  699. $globals.Environment);
  700. $core.addMethod(
  701. $core.method({
  702. selector: "compileClassDefinition:",
  703. protocol: 'compiling',
  704. fn: function (aString){
  705. var self=this;
  706. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  707. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  709. return $core.withContext(function($ctx1) {
  710. //>>excludeEnd("ctx");
  711. $recv((function(){
  712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  713. return $core.withContext(function($ctx2) {
  714. //>>excludeEnd("ctx");
  715. return self._evaluate_for_(aString,$recv($DoIt())._new());
  716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  718. //>>excludeEnd("ctx");
  719. }))._on_do_($Error(),(function(error){
  720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  721. return $core.withContext(function($ctx2) {
  722. //>>excludeEnd("ctx");
  723. return self._alert_($recv(error)._messageText());
  724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  725. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  726. //>>excludeEnd("ctx");
  727. }));
  728. return self;
  729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  730. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  731. //>>excludeEnd("ctx");
  732. },
  733. //>>excludeStart("ide", pragmas.excludeIdeData);
  734. args: ["aString"],
  735. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  736. referencedClasses: ["DoIt", "Error"],
  737. //>>excludeEnd("ide");
  738. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  739. }),
  740. $globals.Environment);
  741. $core.addMethod(
  742. $core.method({
  743. selector: "compileMethod:for:protocol:",
  744. protocol: 'compiling',
  745. fn: function (sourceCode,class_,protocol){
  746. var self=this;
  747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  748. return $core.withContext(function($ctx1) {
  749. //>>excludeEnd("ctx");
  750. var $1;
  751. $1=$recv(class_)._compile_protocol_(sourceCode,protocol);
  752. return $1;
  753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  754. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  755. //>>excludeEnd("ctx");
  756. },
  757. //>>excludeStart("ide", pragmas.excludeIdeData);
  758. args: ["sourceCode", "class", "protocol"],
  759. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  760. referencedClasses: [],
  761. //>>excludeEnd("ide");
  762. messageSends: ["compile:protocol:"]
  763. }),
  764. $globals.Environment);
  765. $core.addMethod(
  766. $core.method({
  767. selector: "copyClass:to:",
  768. protocol: 'actions',
  769. fn: function (aClass,aClassName){
  770. var self=this;
  771. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  772. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  774. return $core.withContext(function($ctx1) {
  775. //>>excludeEnd("ctx");
  776. var $1,$2,$receiver;
  777. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  778. if(($receiver = $1) == null || $receiver.isNil){
  779. $1;
  780. } else {
  781. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  783. $ctx1.sendIdx[","]=1;
  784. //>>excludeEnd("ctx");
  785. self._error_($2);
  786. };
  787. $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  788. return self;
  789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  790. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  791. //>>excludeEnd("ctx");
  792. },
  793. //>>excludeStart("ide", pragmas.excludeIdeData);
  794. args: ["aClass", "aClassName"],
  795. 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",
  796. referencedClasses: ["Smalltalk", "ClassBuilder"],
  797. //>>excludeEnd("ide");
  798. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  799. }),
  800. $globals.Environment);
  801. $core.addMethod(
  802. $core.method({
  803. selector: "doItReceiver",
  804. protocol: 'accessing',
  805. fn: function (){
  806. var self=this;
  807. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  809. return $core.withContext(function($ctx1) {
  810. //>>excludeEnd("ctx");
  811. var $1;
  812. $1=$recv($DoIt())._new();
  813. return $1;
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  816. //>>excludeEnd("ctx");
  817. },
  818. //>>excludeStart("ide", pragmas.excludeIdeData);
  819. args: [],
  820. source: "doItReceiver\x0a\x09^ DoIt new",
  821. referencedClasses: ["DoIt"],
  822. //>>excludeEnd("ide");
  823. messageSends: ["new"]
  824. }),
  825. $globals.Environment);
  826. $core.addMethod(
  827. $core.method({
  828. selector: "evaluate:for:",
  829. protocol: 'evaluating',
  830. fn: function (aString,anObject){
  831. var self=this;
  832. function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  834. return $core.withContext(function($ctx1) {
  835. //>>excludeEnd("ctx");
  836. var $1;
  837. $1=$recv($Evaluator())._evaluate_for_(aString,anObject);
  838. return $1;
  839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  840. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  841. //>>excludeEnd("ctx");
  842. },
  843. //>>excludeStart("ide", pragmas.excludeIdeData);
  844. args: ["aString", "anObject"],
  845. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  846. referencedClasses: ["Evaluator"],
  847. //>>excludeEnd("ide");
  848. messageSends: ["evaluate:for:"]
  849. }),
  850. $globals.Environment);
  851. $core.addMethod(
  852. $core.method({
  853. selector: "evaluate:on:do:",
  854. protocol: 'error handling',
  855. fn: function (aBlock,anErrorClass,exceptionBlock){
  856. var self=this;
  857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  858. return $core.withContext(function($ctx1) {
  859. //>>excludeEnd("ctx");
  860. var $1;
  861. $recv(aBlock)._tryCatch_((function(exception){
  862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  863. return $core.withContext(function($ctx2) {
  864. //>>excludeEnd("ctx");
  865. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  866. if($core.assert($1)){
  867. return $recv(exceptionBlock)._value_(exception);
  868. } else {
  869. return $recv(exception)._resignal();
  870. };
  871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  872. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  873. //>>excludeEnd("ctx");
  874. }));
  875. return self;
  876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  877. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  878. //>>excludeEnd("ctx");
  879. },
  880. //>>excludeStart("ide", pragmas.excludeIdeData);
  881. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  882. 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 ] ]",
  883. referencedClasses: [],
  884. //>>excludeEnd("ide");
  885. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  886. }),
  887. $globals.Environment);
  888. $core.addMethod(
  889. $core.method({
  890. selector: "inspect:",
  891. protocol: 'actions',
  892. fn: function (anObject){
  893. var self=this;
  894. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  896. return $core.withContext(function($ctx1) {
  897. //>>excludeEnd("ctx");
  898. $recv($Inspector())._inspect_(anObject);
  899. return self;
  900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  901. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  902. //>>excludeEnd("ctx");
  903. },
  904. //>>excludeStart("ide", pragmas.excludeIdeData);
  905. args: ["anObject"],
  906. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  907. referencedClasses: ["Inspector"],
  908. //>>excludeEnd("ide");
  909. messageSends: ["inspect:"]
  910. }),
  911. $globals.Environment);
  912. $core.addMethod(
  913. $core.method({
  914. selector: "moveClass:toPackage:",
  915. protocol: 'actions',
  916. fn: function (aClass,aPackageName){
  917. var self=this;
  918. var package_;
  919. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  921. return $core.withContext(function($ctx1) {
  922. //>>excludeEnd("ctx");
  923. var $1,$2,$receiver;
  924. package_=$recv($Package())._named_(aPackageName);
  925. $1=package_;
  926. if(($receiver = $1) == null || $receiver.isNil){
  927. self._error_("Invalid package name");
  928. } else {
  929. $1;
  930. };
  931. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  932. if($core.assert($2)){
  933. return self;
  934. };
  935. $recv(aClass)._package_(package_);
  936. return self;
  937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  938. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  939. //>>excludeEnd("ctx");
  940. },
  941. //>>excludeStart("ide", pragmas.excludeIdeData);
  942. args: ["aClass", "aPackageName"],
  943. 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",
  944. referencedClasses: ["Package"],
  945. //>>excludeEnd("ide");
  946. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  947. }),
  948. $globals.Environment);
  949. $core.addMethod(
  950. $core.method({
  951. selector: "moveMethod:toClass:",
  952. protocol: 'actions',
  953. fn: function (aMethod,aClassName){
  954. var self=this;
  955. var destinationClass;
  956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  957. return $core.withContext(function($ctx1) {
  958. //>>excludeEnd("ctx");
  959. var $2,$3,$1,$5,$4;
  960. destinationClass=self._classNamed_(aClassName);
  961. $2=destinationClass;
  962. $3=$recv(aMethod)._methodClass();
  963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  964. $ctx1.sendIdx["methodClass"]=1;
  965. //>>excludeEnd("ctx");
  966. $1=$recv($2).__eq_eq($3);
  967. if($core.assert($1)){
  968. return self;
  969. };
  970. $5=$recv(aMethod)._methodClass();
  971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  972. $ctx1.sendIdx["methodClass"]=2;
  973. //>>excludeEnd("ctx");
  974. $4=$recv($5)._isMetaclass();
  975. if($core.assert($4)){
  976. destinationClass=$recv(destinationClass)._class();
  977. destinationClass;
  978. };
  979. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  980. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  981. return self;
  982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  983. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  984. //>>excludeEnd("ctx");
  985. },
  986. //>>excludeStart("ide", pragmas.excludeIdeData);
  987. args: ["aMethod", "aClassName"],
  988. 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",
  989. referencedClasses: [],
  990. //>>excludeEnd("ide");
  991. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  992. }),
  993. $globals.Environment);
  994. $core.addMethod(
  995. $core.method({
  996. selector: "moveMethod:toProtocol:",
  997. protocol: 'actions',
  998. fn: function (aMethod,aProtocol){
  999. var self=this;
  1000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1001. return $core.withContext(function($ctx1) {
  1002. //>>excludeEnd("ctx");
  1003. $recv(aMethod)._protocol_(aProtocol);
  1004. return self;
  1005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1006. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  1007. //>>excludeEnd("ctx");
  1008. },
  1009. //>>excludeStart("ide", pragmas.excludeIdeData);
  1010. args: ["aMethod", "aProtocol"],
  1011. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  1012. referencedClasses: [],
  1013. //>>excludeEnd("ide");
  1014. messageSends: ["protocol:"]
  1015. }),
  1016. $globals.Environment);
  1017. $core.addMethod(
  1018. $core.method({
  1019. selector: "packages",
  1020. protocol: 'accessing',
  1021. fn: function (){
  1022. var self=this;
  1023. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1025. return $core.withContext(function($ctx1) {
  1026. //>>excludeEnd("ctx");
  1027. var $1;
  1028. $1=$recv($Smalltalk())._packages();
  1029. return $1;
  1030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1031. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  1032. //>>excludeEnd("ctx");
  1033. },
  1034. //>>excludeStart("ide", pragmas.excludeIdeData);
  1035. args: [],
  1036. source: "packages\x0a\x09^ Smalltalk packages",
  1037. referencedClasses: ["Smalltalk"],
  1038. //>>excludeEnd("ide");
  1039. messageSends: ["packages"]
  1040. }),
  1041. $globals.Environment);
  1042. $core.addMethod(
  1043. $core.method({
  1044. selector: "registerErrorHandler:",
  1045. protocol: 'services',
  1046. fn: function (anErrorHandler){
  1047. var self=this;
  1048. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  1049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1050. return $core.withContext(function($ctx1) {
  1051. //>>excludeEnd("ctx");
  1052. $recv($ErrorHandler())._register_(anErrorHandler);
  1053. return self;
  1054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1055. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  1056. //>>excludeEnd("ctx");
  1057. },
  1058. //>>excludeStart("ide", pragmas.excludeIdeData);
  1059. args: ["anErrorHandler"],
  1060. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  1061. referencedClasses: ["ErrorHandler"],
  1062. //>>excludeEnd("ide");
  1063. messageSends: ["register:"]
  1064. }),
  1065. $globals.Environment);
  1066. $core.addMethod(
  1067. $core.method({
  1068. selector: "registerFinder:",
  1069. protocol: 'services',
  1070. fn: function (aFinder){
  1071. var self=this;
  1072. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1074. return $core.withContext(function($ctx1) {
  1075. //>>excludeEnd("ctx");
  1076. $recv($Finder())._register_(aFinder);
  1077. return self;
  1078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1079. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  1080. //>>excludeEnd("ctx");
  1081. },
  1082. //>>excludeStart("ide", pragmas.excludeIdeData);
  1083. args: ["aFinder"],
  1084. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  1085. referencedClasses: ["Finder"],
  1086. //>>excludeEnd("ide");
  1087. messageSends: ["register:"]
  1088. }),
  1089. $globals.Environment);
  1090. $core.addMethod(
  1091. $core.method({
  1092. selector: "registerInspector:",
  1093. protocol: 'services',
  1094. fn: function (anInspector){
  1095. var self=this;
  1096. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1098. return $core.withContext(function($ctx1) {
  1099. //>>excludeEnd("ctx");
  1100. $recv($Inspector())._register_(anInspector);
  1101. return self;
  1102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1103. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  1104. //>>excludeEnd("ctx");
  1105. },
  1106. //>>excludeStart("ide", pragmas.excludeIdeData);
  1107. args: ["anInspector"],
  1108. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  1109. referencedClasses: ["Inspector"],
  1110. //>>excludeEnd("ide");
  1111. messageSends: ["register:"]
  1112. }),
  1113. $globals.Environment);
  1114. $core.addMethod(
  1115. $core.method({
  1116. selector: "registerProgressHandler:",
  1117. protocol: 'services',
  1118. fn: function (aProgressHandler){
  1119. var self=this;
  1120. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  1121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1122. return $core.withContext(function($ctx1) {
  1123. //>>excludeEnd("ctx");
  1124. $recv($ProgressHandler())._register_(aProgressHandler);
  1125. return self;
  1126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1127. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  1128. //>>excludeEnd("ctx");
  1129. },
  1130. //>>excludeStart("ide", pragmas.excludeIdeData);
  1131. args: ["aProgressHandler"],
  1132. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  1133. referencedClasses: ["ProgressHandler"],
  1134. //>>excludeEnd("ide");
  1135. messageSends: ["register:"]
  1136. }),
  1137. $globals.Environment);
  1138. $core.addMethod(
  1139. $core.method({
  1140. selector: "registerTranscript:",
  1141. protocol: 'services',
  1142. fn: function (aTranscript){
  1143. var self=this;
  1144. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  1145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1146. return $core.withContext(function($ctx1) {
  1147. //>>excludeEnd("ctx");
  1148. $recv($Transcript())._register_(aTranscript);
  1149. return self;
  1150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1151. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  1152. //>>excludeEnd("ctx");
  1153. },
  1154. //>>excludeStart("ide", pragmas.excludeIdeData);
  1155. args: ["aTranscript"],
  1156. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  1157. referencedClasses: ["Transcript"],
  1158. //>>excludeEnd("ide");
  1159. messageSends: ["register:"]
  1160. }),
  1161. $globals.Environment);
  1162. $core.addMethod(
  1163. $core.method({
  1164. selector: "removeClass:",
  1165. protocol: 'actions',
  1166. fn: function (aClass){
  1167. var self=this;
  1168. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1170. return $core.withContext(function($ctx1) {
  1171. //>>excludeEnd("ctx");
  1172. $recv($Smalltalk())._removeClass_(aClass);
  1173. return self;
  1174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1175. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  1176. //>>excludeEnd("ctx");
  1177. },
  1178. //>>excludeStart("ide", pragmas.excludeIdeData);
  1179. args: ["aClass"],
  1180. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  1181. referencedClasses: ["Smalltalk"],
  1182. //>>excludeEnd("ide");
  1183. messageSends: ["removeClass:"]
  1184. }),
  1185. $globals.Environment);
  1186. $core.addMethod(
  1187. $core.method({
  1188. selector: "removeMethod:",
  1189. protocol: 'actions',
  1190. fn: function (aMethod){
  1191. var self=this;
  1192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1193. return $core.withContext(function($ctx1) {
  1194. //>>excludeEnd("ctx");
  1195. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  1196. return self;
  1197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1198. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  1199. //>>excludeEnd("ctx");
  1200. },
  1201. //>>excludeStart("ide", pragmas.excludeIdeData);
  1202. args: ["aMethod"],
  1203. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  1204. referencedClasses: [],
  1205. //>>excludeEnd("ide");
  1206. messageSends: ["removeCompiledMethod:", "methodClass"]
  1207. }),
  1208. $globals.Environment);
  1209. $core.addMethod(
  1210. $core.method({
  1211. selector: "removeProtocol:from:",
  1212. protocol: 'actions',
  1213. fn: function (aString,aClass){
  1214. var self=this;
  1215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1216. return $core.withContext(function($ctx1) {
  1217. //>>excludeEnd("ctx");
  1218. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  1219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1220. return $core.withContext(function($ctx2) {
  1221. //>>excludeEnd("ctx");
  1222. return $recv(aClass)._removeCompiledMethod_(each);
  1223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1225. //>>excludeEnd("ctx");
  1226. }));
  1227. return self;
  1228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1229. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  1230. //>>excludeEnd("ctx");
  1231. },
  1232. //>>excludeStart("ide", pragmas.excludeIdeData);
  1233. args: ["aString", "aClass"],
  1234. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  1235. referencedClasses: [],
  1236. //>>excludeEnd("ide");
  1237. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  1238. }),
  1239. $globals.Environment);
  1240. $core.addMethod(
  1241. $core.method({
  1242. selector: "renameClass:to:",
  1243. protocol: 'actions',
  1244. fn: function (aClass,aClassName){
  1245. var self=this;
  1246. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1247. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. return $core.withContext(function($ctx1) {
  1250. //>>excludeEnd("ctx");
  1251. var $1,$2,$receiver;
  1252. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  1253. if(($receiver = $1) == null || $receiver.isNil){
  1254. $1;
  1255. } else {
  1256. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  1257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1258. $ctx1.sendIdx[","]=1;
  1259. //>>excludeEnd("ctx");
  1260. self._error_($2);
  1261. };
  1262. $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  1263. return self;
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  1266. //>>excludeEnd("ctx");
  1267. },
  1268. //>>excludeStart("ide", pragmas.excludeIdeData);
  1269. args: ["aClass", "aClassName"],
  1270. 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",
  1271. referencedClasses: ["Smalltalk", "ClassBuilder"],
  1272. //>>excludeEnd("ide");
  1273. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  1274. }),
  1275. $globals.Environment);
  1276. $core.addMethod(
  1277. $core.method({
  1278. selector: "renameProtocol:to:in:",
  1279. protocol: 'actions',
  1280. fn: function (aString,anotherString,aClass){
  1281. var self=this;
  1282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1283. return $core.withContext(function($ctx1) {
  1284. //>>excludeEnd("ctx");
  1285. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  1286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1287. return $core.withContext(function($ctx2) {
  1288. //>>excludeEnd("ctx");
  1289. return $recv(each)._protocol_(anotherString);
  1290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1292. //>>excludeEnd("ctx");
  1293. }));
  1294. return self;
  1295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1296. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  1297. //>>excludeEnd("ctx");
  1298. },
  1299. //>>excludeStart("ide", pragmas.excludeIdeData);
  1300. args: ["aString", "anotherString", "aClass"],
  1301. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  1302. referencedClasses: [],
  1303. //>>excludeEnd("ide");
  1304. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  1305. }),
  1306. $globals.Environment);
  1307. $core.addMethod(
  1308. $core.method({
  1309. selector: "setClassCommentOf:to:",
  1310. protocol: 'actions',
  1311. fn: function (aClass,aString){
  1312. var self=this;
  1313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1314. return $core.withContext(function($ctx1) {
  1315. //>>excludeEnd("ctx");
  1316. $recv(aClass)._comment_(aString);
  1317. return self;
  1318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1319. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  1320. //>>excludeEnd("ctx");
  1321. },
  1322. //>>excludeStart("ide", pragmas.excludeIdeData);
  1323. args: ["aClass", "aString"],
  1324. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  1325. referencedClasses: [],
  1326. //>>excludeEnd("ide");
  1327. messageSends: ["comment:"]
  1328. }),
  1329. $globals.Environment);
  1330. $core.addMethod(
  1331. $core.method({
  1332. selector: "systemAnnouncer",
  1333. protocol: 'accessing',
  1334. fn: function (){
  1335. var self=this;
  1336. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1338. return $core.withContext(function($ctx1) {
  1339. //>>excludeEnd("ctx");
  1340. var $1;
  1341. $1=$recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  1342. return $1;
  1343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1344. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  1345. //>>excludeEnd("ctx");
  1346. },
  1347. //>>excludeStart("ide", pragmas.excludeIdeData);
  1348. args: [],
  1349. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  1350. referencedClasses: ["Smalltalk"],
  1351. //>>excludeEnd("ide");
  1352. messageSends: ["current", "at:", "globals"]
  1353. }),
  1354. $globals.Environment);
  1355. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  1356. //>>excludeStart("ide", pragmas.excludeIdeData);
  1357. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  1358. //>>excludeEnd("ide");
  1359. $core.addMethod(
  1360. $core.method({
  1361. selector: "do:on:displaying:",
  1362. protocol: 'progress handling',
  1363. fn: function (aBlock,aCollection,aString){
  1364. var self=this;
  1365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1366. return $core.withContext(function($ctx1) {
  1367. //>>excludeEnd("ctx");
  1368. $recv(aCollection)._do_(aBlock);
  1369. return self;
  1370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1371. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  1372. //>>excludeEnd("ctx");
  1373. },
  1374. //>>excludeStart("ide", pragmas.excludeIdeData);
  1375. args: ["aBlock", "aCollection", "aString"],
  1376. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  1377. referencedClasses: [],
  1378. //>>excludeEnd("ide");
  1379. messageSends: ["do:"]
  1380. }),
  1381. $globals.NullProgressHandler);
  1382. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  1383. $core.addMethod(
  1384. $core.method({
  1385. selector: "initialize",
  1386. protocol: 'initialization',
  1387. fn: function (){
  1388. var self=this;
  1389. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  1390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1391. return $core.withContext(function($ctx1) {
  1392. //>>excludeEnd("ctx");
  1393. $recv($ProgressHandler())._registerIfNone_(self._new());
  1394. return self;
  1395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1396. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  1397. //>>excludeEnd("ctx");
  1398. },
  1399. //>>excludeStart("ide", pragmas.excludeIdeData);
  1400. args: [],
  1401. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  1402. referencedClasses: ["ProgressHandler"],
  1403. //>>excludeEnd("ide");
  1404. messageSends: ["registerIfNone:", "new"]
  1405. }),
  1406. $globals.NullProgressHandler.klass);
  1407. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  1408. //>>excludeStart("ide", pragmas.excludeIdeData);
  1409. $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 }.";
  1410. //>>excludeEnd("ide");
  1411. $globals.PlatformInterface.klass.iVarNames = ['worker'];
  1412. $core.addMethod(
  1413. $core.method({
  1414. selector: "ajax:",
  1415. protocol: 'actions',
  1416. fn: function (anObject){
  1417. var self=this;
  1418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1419. return $core.withContext(function($ctx1) {
  1420. //>>excludeEnd("ctx");
  1421. var $2,$1,$receiver;
  1422. $2=self["@worker"];
  1423. if(($receiver = $2) == null || $receiver.isNil){
  1424. $1=self._error_("ajax: not available");
  1425. } else {
  1426. $1=$recv(self["@worker"])._ajax_(anObject);
  1427. };
  1428. return $1;
  1429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1430. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  1431. //>>excludeEnd("ctx");
  1432. },
  1433. //>>excludeStart("ide", pragmas.excludeIdeData);
  1434. args: ["anObject"],
  1435. source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
  1436. referencedClasses: [],
  1437. //>>excludeEnd("ide");
  1438. messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"]
  1439. }),
  1440. $globals.PlatformInterface.klass);
  1441. $core.addMethod(
  1442. $core.method({
  1443. selector: "alert:",
  1444. protocol: 'actions',
  1445. fn: function (aString){
  1446. var self=this;
  1447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1448. return $core.withContext(function($ctx1) {
  1449. //>>excludeEnd("ctx");
  1450. var $2,$1,$receiver;
  1451. $2=self["@worker"];
  1452. if(($receiver = $2) == null || $receiver.isNil){
  1453. $1=self._error_("alert: not available");
  1454. } else {
  1455. $1=$recv(self["@worker"])._alert_(aString);
  1456. };
  1457. return $1;
  1458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1459. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  1460. //>>excludeEnd("ctx");
  1461. },
  1462. //>>excludeStart("ide", pragmas.excludeIdeData);
  1463. args: ["aString"],
  1464. source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
  1465. referencedClasses: [],
  1466. //>>excludeEnd("ide");
  1467. messageSends: ["ifNotNil:ifNil:", "alert:", "error:"]
  1468. }),
  1469. $globals.PlatformInterface.klass);
  1470. $core.addMethod(
  1471. $core.method({
  1472. selector: "confirm:",
  1473. protocol: 'actions',
  1474. fn: function (aString){
  1475. var self=this;
  1476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1477. return $core.withContext(function($ctx1) {
  1478. //>>excludeEnd("ctx");
  1479. var $2,$1,$receiver;
  1480. $2=self["@worker"];
  1481. if(($receiver = $2) == null || $receiver.isNil){
  1482. $1=self._error_("confirm: not available");
  1483. } else {
  1484. $1=$recv(self["@worker"])._confirm_(aString);
  1485. };
  1486. return $1;
  1487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1488. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  1489. //>>excludeEnd("ctx");
  1490. },
  1491. //>>excludeStart("ide", pragmas.excludeIdeData);
  1492. args: ["aString"],
  1493. source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
  1494. referencedClasses: [],
  1495. //>>excludeEnd("ide");
  1496. messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"]
  1497. }),
  1498. $globals.PlatformInterface.klass);
  1499. $core.addMethod(
  1500. $core.method({
  1501. selector: "existsGlobal:",
  1502. protocol: 'actions',
  1503. fn: function (aString){
  1504. var self=this;
  1505. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  1506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1507. return $core.withContext(function($ctx1) {
  1508. //>>excludeEnd("ctx");
  1509. var $1;
  1510. $1=$recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  1511. return true;
  1512. }),(function(){
  1513. return false;
  1514. }));
  1515. return $1;
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  1518. //>>excludeEnd("ctx");
  1519. },
  1520. //>>excludeStart("ide", pragmas.excludeIdeData);
  1521. args: ["aString"],
  1522. source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  1523. referencedClasses: ["PlatformInterface"],
  1524. //>>excludeEnd("ide");
  1525. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  1526. }),
  1527. $globals.PlatformInterface.klass);
  1528. $core.addMethod(
  1529. $core.method({
  1530. selector: "globals",
  1531. protocol: 'accessing',
  1532. fn: function (){
  1533. var self=this;
  1534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1535. return $core.withContext(function($ctx1) {
  1536. //>>excludeEnd("ctx");
  1537. return (new Function('return this'))();;
  1538. return self;
  1539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1540. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  1541. //>>excludeEnd("ctx");
  1542. },
  1543. //>>excludeStart("ide", pragmas.excludeIdeData);
  1544. args: [],
  1545. source: "globals\x0a\x09<return (new Function('return this'))();>",
  1546. referencedClasses: [],
  1547. //>>excludeEnd("ide");
  1548. messageSends: []
  1549. }),
  1550. $globals.PlatformInterface.klass);
  1551. $core.addMethod(
  1552. $core.method({
  1553. selector: "initialize",
  1554. protocol: 'initialization',
  1555. fn: function (){
  1556. var self=this;
  1557. var candidate;
  1558. function $BrowserInterface(){return $globals.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
  1559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1560. return $core.withContext(function($ctx1) {
  1561. //>>excludeEnd("ctx");
  1562. var $1,$receiver;
  1563. (
  1564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1565. $ctx1.supercall = true,
  1566. //>>excludeEnd("ctx");
  1567. $globals.PlatformInterface.klass.superclass.fn.prototype._initialize.apply($recv(self), []));
  1568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1569. $ctx1.supercall = false;
  1570. //>>excludeEnd("ctx");;
  1571. if(($receiver = $BrowserInterface()) == null || $receiver.isNil){
  1572. $BrowserInterface();
  1573. } else {
  1574. candidate=$recv($BrowserInterface())._new();
  1575. candidate;
  1576. $1=$recv(candidate)._isAvailable();
  1577. if($core.assert($1)){
  1578. self._setWorker_(candidate);
  1579. return self;
  1580. };
  1581. };
  1582. return self;
  1583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1584. }, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},$globals.PlatformInterface.klass)});
  1585. //>>excludeEnd("ctx");
  1586. },
  1587. //>>excludeStart("ide", pragmas.excludeIdeData);
  1588. args: [],
  1589. 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]",
  1590. referencedClasses: ["BrowserInterface"],
  1591. //>>excludeEnd("ide");
  1592. messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"]
  1593. }),
  1594. $globals.PlatformInterface.klass);
  1595. $core.addMethod(
  1596. $core.method({
  1597. selector: "prompt:",
  1598. protocol: 'actions',
  1599. fn: function (aString){
  1600. var self=this;
  1601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1602. return $core.withContext(function($ctx1) {
  1603. //>>excludeEnd("ctx");
  1604. var $2,$1,$receiver;
  1605. $2=self["@worker"];
  1606. if(($receiver = $2) == null || $receiver.isNil){
  1607. $1=self._error_("prompt: not available");
  1608. } else {
  1609. $1=$recv(self["@worker"])._prompt_(aString);
  1610. };
  1611. return $1;
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  1614. //>>excludeEnd("ctx");
  1615. },
  1616. //>>excludeStart("ide", pragmas.excludeIdeData);
  1617. args: ["aString"],
  1618. source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  1619. referencedClasses: [],
  1620. //>>excludeEnd("ide");
  1621. messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"]
  1622. }),
  1623. $globals.PlatformInterface.klass);
  1624. $core.addMethod(
  1625. $core.method({
  1626. selector: "prompt:default:",
  1627. protocol: 'actions',
  1628. fn: function (aString,defaultString){
  1629. var self=this;
  1630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1631. return $core.withContext(function($ctx1) {
  1632. //>>excludeEnd("ctx");
  1633. var $2,$1,$receiver;
  1634. $2=self["@worker"];
  1635. if(($receiver = $2) == null || $receiver.isNil){
  1636. $1=self._error_("prompt: not available");
  1637. } else {
  1638. $1=$recv(self["@worker"])._prompt_default_(aString,defaultString);
  1639. };
  1640. return $1;
  1641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1642. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  1643. //>>excludeEnd("ctx");
  1644. },
  1645. //>>excludeStart("ide", pragmas.excludeIdeData);
  1646. args: ["aString", "defaultString"],
  1647. source: "prompt: aString default: defaultString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString default: defaultString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  1648. referencedClasses: [],
  1649. //>>excludeEnd("ide");
  1650. messageSends: ["ifNotNil:ifNil:", "prompt:default:", "error:"]
  1651. }),
  1652. $globals.PlatformInterface.klass);
  1653. $core.addMethod(
  1654. $core.method({
  1655. selector: "setWorker:",
  1656. protocol: 'accessing',
  1657. fn: function (anObject){
  1658. var self=this;
  1659. self["@worker"]=anObject;
  1660. return self;
  1661. },
  1662. //>>excludeStart("ide", pragmas.excludeIdeData);
  1663. args: ["anObject"],
  1664. source: "setWorker: anObject\x0a\x09worker := anObject",
  1665. referencedClasses: [],
  1666. //>>excludeEnd("ide");
  1667. messageSends: []
  1668. }),
  1669. $globals.PlatformInterface.klass);
  1670. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  1671. //>>excludeStart("ide", pragmas.excludeIdeData);
  1672. $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.";
  1673. //>>excludeEnd("ide");
  1674. $globals.Service.klass.iVarNames = ['current'];
  1675. $core.addMethod(
  1676. $core.method({
  1677. selector: "current",
  1678. protocol: 'accessing',
  1679. fn: function (){
  1680. var self=this;
  1681. var $1;
  1682. $1=self["@current"];
  1683. return $1;
  1684. },
  1685. //>>excludeStart("ide", pragmas.excludeIdeData);
  1686. args: [],
  1687. source: "current\x0a\x09^ current",
  1688. referencedClasses: [],
  1689. //>>excludeEnd("ide");
  1690. messageSends: []
  1691. }),
  1692. $globals.Service.klass);
  1693. $core.addMethod(
  1694. $core.method({
  1695. selector: "new",
  1696. protocol: 'instance creation',
  1697. fn: function (){
  1698. var self=this;
  1699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1700. return $core.withContext(function($ctx1) {
  1701. //>>excludeEnd("ctx");
  1702. self._shouldNotImplement();
  1703. return self;
  1704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1705. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  1706. //>>excludeEnd("ctx");
  1707. },
  1708. //>>excludeStart("ide", pragmas.excludeIdeData);
  1709. args: [],
  1710. source: "new\x0a\x09self shouldNotImplement",
  1711. referencedClasses: [],
  1712. //>>excludeEnd("ide");
  1713. messageSends: ["shouldNotImplement"]
  1714. }),
  1715. $globals.Service.klass);
  1716. $core.addMethod(
  1717. $core.method({
  1718. selector: "register:",
  1719. protocol: 'registration',
  1720. fn: function (anObject){
  1721. var self=this;
  1722. self["@current"]=anObject;
  1723. return self;
  1724. },
  1725. //>>excludeStart("ide", pragmas.excludeIdeData);
  1726. args: ["anObject"],
  1727. source: "register: anObject\x0a\x09current := anObject",
  1728. referencedClasses: [],
  1729. //>>excludeEnd("ide");
  1730. messageSends: []
  1731. }),
  1732. $globals.Service.klass);
  1733. $core.addMethod(
  1734. $core.method({
  1735. selector: "registerIfNone:",
  1736. protocol: 'registration',
  1737. fn: function (anObject){
  1738. var self=this;
  1739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1740. return $core.withContext(function($ctx1) {
  1741. //>>excludeEnd("ctx");
  1742. var $1,$receiver;
  1743. $1=self._current();
  1744. if(($receiver = $1) == null || $receiver.isNil){
  1745. self._register_(anObject);
  1746. } else {
  1747. $1;
  1748. };
  1749. return self;
  1750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1751. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  1752. //>>excludeEnd("ctx");
  1753. },
  1754. //>>excludeStart("ide", pragmas.excludeIdeData);
  1755. args: ["anObject"],
  1756. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  1757. referencedClasses: [],
  1758. //>>excludeEnd("ide");
  1759. messageSends: ["ifNil:", "current", "register:"]
  1760. }),
  1761. $globals.Service.klass);
  1762. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  1763. //>>excludeStart("ide", pragmas.excludeIdeData);
  1764. $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.";
  1765. //>>excludeEnd("ide");
  1766. $core.addMethod(
  1767. $core.method({
  1768. selector: "handleError:",
  1769. protocol: 'error handling',
  1770. fn: function (anError){
  1771. var self=this;
  1772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1773. return $core.withContext(function($ctx1) {
  1774. //>>excludeEnd("ctx");
  1775. self._handleUnhandledError_(anError);
  1776. return self;
  1777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1778. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  1779. //>>excludeEnd("ctx");
  1780. },
  1781. //>>excludeStart("ide", pragmas.excludeIdeData);
  1782. args: ["anError"],
  1783. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  1784. referencedClasses: [],
  1785. //>>excludeEnd("ide");
  1786. messageSends: ["handleUnhandledError:"]
  1787. }),
  1788. $globals.ErrorHandler.klass);
  1789. $core.addMethod(
  1790. $core.method({
  1791. selector: "handleUnhandledError:",
  1792. protocol: 'error handling',
  1793. fn: function (anError){
  1794. var self=this;
  1795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1796. return $core.withContext(function($ctx1) {
  1797. //>>excludeEnd("ctx");
  1798. var $1,$2;
  1799. $1=$recv(anError)._wasHandled();
  1800. if($core.assert($1)){
  1801. return self;
  1802. };
  1803. $2=$recv(self._current())._handleError_(anError);
  1804. return $2;
  1805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1806. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  1807. //>>excludeEnd("ctx");
  1808. },
  1809. //>>excludeStart("ide", pragmas.excludeIdeData);
  1810. args: ["anError"],
  1811. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  1812. referencedClasses: [],
  1813. //>>excludeEnd("ide");
  1814. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  1815. }),
  1816. $globals.ErrorHandler.klass);
  1817. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  1818. //>>excludeStart("ide", pragmas.excludeIdeData);
  1819. $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.";
  1820. //>>excludeEnd("ide");
  1821. $core.addMethod(
  1822. $core.method({
  1823. selector: "findClass:",
  1824. protocol: 'finding',
  1825. fn: function (aClass){
  1826. var self=this;
  1827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1828. return $core.withContext(function($ctx1) {
  1829. //>>excludeEnd("ctx");
  1830. var $1;
  1831. $1=$recv(self._current())._findClass_(aClass);
  1832. return $1;
  1833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1834. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  1835. //>>excludeEnd("ctx");
  1836. },
  1837. //>>excludeStart("ide", pragmas.excludeIdeData);
  1838. args: ["aClass"],
  1839. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  1840. referencedClasses: [],
  1841. //>>excludeEnd("ide");
  1842. messageSends: ["findClass:", "current"]
  1843. }),
  1844. $globals.Finder.klass);
  1845. $core.addMethod(
  1846. $core.method({
  1847. selector: "findMethod:",
  1848. protocol: 'finding',
  1849. fn: function (aCompiledMethod){
  1850. var self=this;
  1851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1852. return $core.withContext(function($ctx1) {
  1853. //>>excludeEnd("ctx");
  1854. var $1;
  1855. $1=$recv(self._current())._findMethod_(aCompiledMethod);
  1856. return $1;
  1857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1858. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  1859. //>>excludeEnd("ctx");
  1860. },
  1861. //>>excludeStart("ide", pragmas.excludeIdeData);
  1862. args: ["aCompiledMethod"],
  1863. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  1864. referencedClasses: [],
  1865. //>>excludeEnd("ide");
  1866. messageSends: ["findMethod:", "current"]
  1867. }),
  1868. $globals.Finder.klass);
  1869. $core.addMethod(
  1870. $core.method({
  1871. selector: "findString:",
  1872. protocol: 'finding',
  1873. fn: function (aString){
  1874. var self=this;
  1875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1876. return $core.withContext(function($ctx1) {
  1877. //>>excludeEnd("ctx");
  1878. var $1;
  1879. $1=$recv(self._current())._findString_(aString);
  1880. return $1;
  1881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1882. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  1883. //>>excludeEnd("ctx");
  1884. },
  1885. //>>excludeStart("ide", pragmas.excludeIdeData);
  1886. args: ["aString"],
  1887. source: "findString: aString\x0a\x09^ self current findString: aString",
  1888. referencedClasses: [],
  1889. //>>excludeEnd("ide");
  1890. messageSends: ["findString:", "current"]
  1891. }),
  1892. $globals.Finder.klass);
  1893. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  1894. //>>excludeStart("ide", pragmas.excludeIdeData);
  1895. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  1896. //>>excludeEnd("ide");
  1897. $core.addMethod(
  1898. $core.method({
  1899. selector: "inspect:",
  1900. protocol: 'inspecting',
  1901. fn: function (anObject){
  1902. var self=this;
  1903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1904. return $core.withContext(function($ctx1) {
  1905. //>>excludeEnd("ctx");
  1906. var $1;
  1907. $1=$recv(self._current())._inspect_(anObject);
  1908. return $1;
  1909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1910. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  1911. //>>excludeEnd("ctx");
  1912. },
  1913. //>>excludeStart("ide", pragmas.excludeIdeData);
  1914. args: ["anObject"],
  1915. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  1916. referencedClasses: [],
  1917. //>>excludeEnd("ide");
  1918. messageSends: ["inspect:", "current"]
  1919. }),
  1920. $globals.Inspector.klass);
  1921. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  1922. //>>excludeStart("ide", pragmas.excludeIdeData);
  1923. $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`.";
  1924. //>>excludeEnd("ide");
  1925. $core.addMethod(
  1926. $core.method({
  1927. selector: "do:on:displaying:",
  1928. protocol: 'progress handling',
  1929. fn: function (aBlock,aCollection,aString){
  1930. var self=this;
  1931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1932. return $core.withContext(function($ctx1) {
  1933. //>>excludeEnd("ctx");
  1934. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  1935. return self;
  1936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1937. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  1938. //>>excludeEnd("ctx");
  1939. },
  1940. //>>excludeStart("ide", pragmas.excludeIdeData);
  1941. args: ["aBlock", "aCollection", "aString"],
  1942. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  1943. referencedClasses: [],
  1944. //>>excludeEnd("ide");
  1945. messageSends: ["do:on:displaying:", "current"]
  1946. }),
  1947. $globals.ProgressHandler.klass);
  1948. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  1949. //>>excludeStart("ide", pragmas.excludeIdeData);
  1950. $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.";
  1951. //>>excludeEnd("ide");
  1952. $core.addMethod(
  1953. $core.method({
  1954. selector: "clear",
  1955. protocol: 'printing',
  1956. fn: function (){
  1957. var self=this;
  1958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1959. return $core.withContext(function($ctx1) {
  1960. //>>excludeEnd("ctx");
  1961. $recv(self._current())._clear();
  1962. return self;
  1963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1964. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  1965. //>>excludeEnd("ctx");
  1966. },
  1967. //>>excludeStart("ide", pragmas.excludeIdeData);
  1968. args: [],
  1969. source: "clear\x0a\x09self current clear",
  1970. referencedClasses: [],
  1971. //>>excludeEnd("ide");
  1972. messageSends: ["clear", "current"]
  1973. }),
  1974. $globals.Transcript.klass);
  1975. $core.addMethod(
  1976. $core.method({
  1977. selector: "cr",
  1978. protocol: 'printing',
  1979. fn: function (){
  1980. var self=this;
  1981. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1983. return $core.withContext(function($ctx1) {
  1984. //>>excludeEnd("ctx");
  1985. $recv(self._current())._show_($recv($String())._cr());
  1986. return self;
  1987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1988. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  1989. //>>excludeEnd("ctx");
  1990. },
  1991. //>>excludeStart("ide", pragmas.excludeIdeData);
  1992. args: [],
  1993. source: "cr\x0a\x09self current show: String cr",
  1994. referencedClasses: ["String"],
  1995. //>>excludeEnd("ide");
  1996. messageSends: ["show:", "current", "cr"]
  1997. }),
  1998. $globals.Transcript.klass);
  1999. $core.addMethod(
  2000. $core.method({
  2001. selector: "inspect:",
  2002. protocol: 'printing',
  2003. fn: function (anObject){
  2004. var self=this;
  2005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2006. return $core.withContext(function($ctx1) {
  2007. //>>excludeEnd("ctx");
  2008. self._show_(anObject);
  2009. return self;
  2010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2011. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  2012. //>>excludeEnd("ctx");
  2013. },
  2014. //>>excludeStart("ide", pragmas.excludeIdeData);
  2015. args: ["anObject"],
  2016. source: "inspect: anObject\x0a\x09self show: anObject",
  2017. referencedClasses: [],
  2018. //>>excludeEnd("ide");
  2019. messageSends: ["show:"]
  2020. }),
  2021. $globals.Transcript.klass);
  2022. $core.addMethod(
  2023. $core.method({
  2024. selector: "open",
  2025. protocol: 'instance creation',
  2026. fn: function (){
  2027. var self=this;
  2028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2029. return $core.withContext(function($ctx1) {
  2030. //>>excludeEnd("ctx");
  2031. $recv(self._current())._open();
  2032. return self;
  2033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2034. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  2035. //>>excludeEnd("ctx");
  2036. },
  2037. //>>excludeStart("ide", pragmas.excludeIdeData);
  2038. args: [],
  2039. source: "open\x0a\x09self current open",
  2040. referencedClasses: [],
  2041. //>>excludeEnd("ide");
  2042. messageSends: ["open", "current"]
  2043. }),
  2044. $globals.Transcript.klass);
  2045. $core.addMethod(
  2046. $core.method({
  2047. selector: "show:",
  2048. protocol: 'printing',
  2049. fn: function (anObject){
  2050. var self=this;
  2051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2052. return $core.withContext(function($ctx1) {
  2053. //>>excludeEnd("ctx");
  2054. $recv(self._current())._show_(anObject);
  2055. return self;
  2056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2057. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  2058. //>>excludeEnd("ctx");
  2059. },
  2060. //>>excludeStart("ide", pragmas.excludeIdeData);
  2061. args: ["anObject"],
  2062. source: "show: anObject\x0a\x09self current show: anObject",
  2063. referencedClasses: [],
  2064. //>>excludeEnd("ide");
  2065. messageSends: ["show:", "current"]
  2066. }),
  2067. $globals.Transcript.klass);
  2068. $core.addMethod(
  2069. $core.method({
  2070. selector: "do:displayingProgress:",
  2071. protocol: '*Platform-Services',
  2072. fn: function (aBlock,aString){
  2073. var self=this;
  2074. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  2075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2076. return $core.withContext(function($ctx1) {
  2077. //>>excludeEnd("ctx");
  2078. $recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  2079. return self;
  2080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2081. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  2082. //>>excludeEnd("ctx");
  2083. },
  2084. //>>excludeStart("ide", pragmas.excludeIdeData);
  2085. args: ["aBlock", "aString"],
  2086. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  2087. referencedClasses: ["ProgressHandler"],
  2088. //>>excludeEnd("ide");
  2089. messageSends: ["do:on:displaying:"]
  2090. }),
  2091. $globals.SequenceableCollection);
  2092. });