Kernel-Exceptions.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. define("amber/Kernel-Exceptions", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Exceptions');
  3. smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber"};
  4. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  5. smalltalk.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "context",
  9. category: 'accessing',
  10. fn: function (){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. return self.context;
  14. return self}, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.Error)})},
  15. args: [],
  16. source: "context\x0a\x09<return self.context>",
  17. messageSends: [],
  18. referencedClasses: []
  19. }),
  20. smalltalk.Error);
  21. smalltalk.addMethod(
  22. smalltalk.method({
  23. selector: "initialize",
  24. category: 'initialization',
  25. fn: function (){
  26. var self=this;
  27. return smalltalk.withContext(function($ctx1) {
  28. self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
  29. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Error)})},
  30. args: [],
  31. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  32. messageSends: ["messageText:", ",", "name", "class"],
  33. referencedClasses: []
  34. }),
  35. smalltalk.Error);
  36. smalltalk.addMethod(
  37. smalltalk.method({
  38. selector: "isSmalltalkError",
  39. category: 'testing',
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx1) {
  43. return self.smalltalkError === true;
  44. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},smalltalk.Error)})},
  45. args: [],
  46. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  47. messageSends: [],
  48. referencedClasses: []
  49. }),
  50. smalltalk.Error);
  51. smalltalk.addMethod(
  52. smalltalk.method({
  53. selector: "jsStack",
  54. category: 'accessing',
  55. fn: function (){
  56. var self=this;
  57. return smalltalk.withContext(function($ctx1) {
  58. return self.stack;
  59. return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},smalltalk.Error)})},
  60. args: [],
  61. source: "jsStack\x0a\x09<return self.stack>",
  62. messageSends: [],
  63. referencedClasses: []
  64. }),
  65. smalltalk.Error);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "messageText",
  69. category: 'accessing',
  70. fn: function (){
  71. var self=this;
  72. return smalltalk.withContext(function($ctx1) {
  73. var $1;
  74. $1=self["@messageText"];
  75. return $1;
  76. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.Error)})},
  77. args: [],
  78. source: "messageText\x0a\x09^messageText",
  79. messageSends: [],
  80. referencedClasses: []
  81. }),
  82. smalltalk.Error);
  83. smalltalk.addMethod(
  84. smalltalk.method({
  85. selector: "messageText:",
  86. category: 'accessing',
  87. fn: function (aString){
  88. var self=this;
  89. return smalltalk.withContext(function($ctx1) {
  90. self["@messageText"]=aString;
  91. return self}, function($ctx1) {$ctx1.fill(self,"messageText:",{aString:aString},smalltalk.Error)})},
  92. args: ["aString"],
  93. source: "messageText: aString\x0a\x09messageText := aString",
  94. messageSends: [],
  95. referencedClasses: []
  96. }),
  97. smalltalk.Error);
  98. smalltalk.addMethod(
  99. smalltalk.method({
  100. selector: "resignal",
  101. category: 'signaling',
  102. fn: function (){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) {
  105. throw(self);
  106. return self}, function($ctx1) {$ctx1.fill(self,"resignal",{},smalltalk.Error)})},
  107. args: [],
  108. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<throw(self)>",
  109. messageSends: [],
  110. referencedClasses: []
  111. }),
  112. smalltalk.Error);
  113. smalltalk.addMethod(
  114. smalltalk.method({
  115. selector: "signal",
  116. category: 'signaling',
  117. fn: function (){
  118. var self=this;
  119. return smalltalk.withContext(function($ctx1) {
  120. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  121. return self}, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error)})},
  122. args: [],
  123. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  124. messageSends: [],
  125. referencedClasses: []
  126. }),
  127. smalltalk.Error);
  128. smalltalk.addMethod(
  129. smalltalk.method({
  130. selector: "signal:",
  131. category: 'signaling',
  132. fn: function (aString){
  133. var self=this;
  134. return smalltalk.withContext(function($ctx1) {
  135. self._messageText_(aString);
  136. self._signal();
  137. return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error)})},
  138. args: ["aString"],
  139. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  140. messageSends: ["messageText:", "signal"],
  141. referencedClasses: []
  142. }),
  143. smalltalk.Error);
  144. smalltalk.addMethod(
  145. smalltalk.method({
  146. selector: "heliosClass",
  147. category: 'helios',
  148. fn: function (){
  149. var self=this;
  150. return smalltalk.withContext(function($ctx1) {
  151. return "exception";
  152. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Error.klass)})},
  153. args: [],
  154. source: "heliosClass\x0a\x09^ 'exception'",
  155. messageSends: [],
  156. referencedClasses: []
  157. }),
  158. smalltalk.Error.klass);
  159. smalltalk.addMethod(
  160. smalltalk.method({
  161. selector: "signal",
  162. category: 'instance creation',
  163. fn: function (){
  164. var self=this;
  165. return smalltalk.withContext(function($ctx1) {
  166. var $1;
  167. $1=_st(self._new())._signal();
  168. return $1;
  169. }, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error.klass)})},
  170. args: [],
  171. source: "signal\x0a\x09^self new signal",
  172. messageSends: ["signal", "new"],
  173. referencedClasses: []
  174. }),
  175. smalltalk.Error.klass);
  176. smalltalk.addMethod(
  177. smalltalk.method({
  178. selector: "signal:",
  179. category: 'instance creation',
  180. fn: function (aString){
  181. var self=this;
  182. return smalltalk.withContext(function($ctx1) {
  183. var $1;
  184. $1=_st(self._new())._signal_(aString);
  185. return $1;
  186. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error.klass)})},
  187. args: ["aString"],
  188. source: "signal: aString\x0a\x09\x09^self new\x0a\x09\x09signal: aString",
  189. messageSends: ["signal:", "new"],
  190. referencedClasses: []
  191. }),
  192. smalltalk.Error.klass);
  193. smalltalk.addClass('JavaScriptException', smalltalk.Error, ['exception'], 'Kernel-Exceptions');
  194. smalltalk.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`";
  195. smalltalk.addMethod(
  196. smalltalk.method({
  197. selector: "context:",
  198. category: 'accessing',
  199. fn: function (aMethodContext){
  200. var self=this;
  201. return smalltalk.withContext(function($ctx1) {
  202. self.context = aMethodContext;
  203. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},smalltalk.JavaScriptException)})},
  204. args: ["aMethodContext"],
  205. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<self.context = aMethodContext>",
  206. messageSends: [],
  207. referencedClasses: []
  208. }),
  209. smalltalk.JavaScriptException);
  210. smalltalk.addMethod(
  211. smalltalk.method({
  212. selector: "exception",
  213. category: 'accessing',
  214. fn: function (){
  215. var self=this;
  216. return smalltalk.withContext(function($ctx1) {
  217. var $1;
  218. $1=self["@exception"];
  219. return $1;
  220. }, function($ctx1) {$ctx1.fill(self,"exception",{},smalltalk.JavaScriptException)})},
  221. args: [],
  222. source: "exception\x0a\x09^ exception",
  223. messageSends: [],
  224. referencedClasses: []
  225. }),
  226. smalltalk.JavaScriptException);
  227. smalltalk.addMethod(
  228. smalltalk.method({
  229. selector: "exception:",
  230. category: 'accessing',
  231. fn: function (anException){
  232. var self=this;
  233. return smalltalk.withContext(function($ctx1) {
  234. self["@exception"]=anException;
  235. return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException},smalltalk.JavaScriptException)})},
  236. args: ["anException"],
  237. source: "exception: anException\x0a\x09exception := anException",
  238. messageSends: [],
  239. referencedClasses: []
  240. }),
  241. smalltalk.JavaScriptException);
  242. smalltalk.addMethod(
  243. smalltalk.method({
  244. selector: "messageText",
  245. category: 'accessing',
  246. fn: function (){
  247. var self=this;
  248. return smalltalk.withContext(function($ctx1) {
  249. return 'JavaScript exception: ' + self["@exception"].toString();
  250. return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.JavaScriptException)})},
  251. args: [],
  252. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  253. messageSends: [],
  254. referencedClasses: []
  255. }),
  256. smalltalk.JavaScriptException);
  257. smalltalk.addMethod(
  258. smalltalk.method({
  259. selector: "on:",
  260. category: 'instance creation',
  261. fn: function (anException){
  262. var self=this;
  263. return smalltalk.withContext(function($ctx1) {
  264. var $2,$3,$1;
  265. $2=self._new();
  266. _st($2)._exception_(anException);
  267. $3=_st($2)._yourself();
  268. $1=$3;
  269. return $1;
  270. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},smalltalk.JavaScriptException.klass)})},
  271. args: ["anException"],
  272. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  273. messageSends: ["exception:", "new", "yourself"],
  274. referencedClasses: []
  275. }),
  276. smalltalk.JavaScriptException.klass);
  277. smalltalk.addMethod(
  278. smalltalk.method({
  279. selector: "on:context:",
  280. category: 'instance creation',
  281. fn: function (anException,aMethodContext){
  282. var self=this;
  283. return smalltalk.withContext(function($ctx1) {
  284. var $2,$3,$1;
  285. $2=self._new();
  286. _st($2)._exception_(anException);
  287. _st($2)._context_(aMethodContext);
  288. $3=_st($2)._yourself();
  289. $1=$3;
  290. return $1;
  291. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},smalltalk.JavaScriptException.klass)})},
  292. args: ["anException", "aMethodContext"],
  293. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  294. messageSends: ["exception:", "new", "context:", "yourself"],
  295. referencedClasses: []
  296. }),
  297. smalltalk.JavaScriptException.klass);
  298. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  299. smalltalk.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  300. smalltalk.addMethod(
  301. smalltalk.method({
  302. selector: "message",
  303. category: 'accessing',
  304. fn: function (){
  305. var self=this;
  306. return smalltalk.withContext(function($ctx1) {
  307. var $1;
  308. $1=self["@message"];
  309. return $1;
  310. }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.MessageNotUnderstood)})},
  311. args: [],
  312. source: "message\x0a\x09^message",
  313. messageSends: [],
  314. referencedClasses: []
  315. }),
  316. smalltalk.MessageNotUnderstood);
  317. smalltalk.addMethod(
  318. smalltalk.method({
  319. selector: "message:",
  320. category: 'accessing',
  321. fn: function (aMessage){
  322. var self=this;
  323. return smalltalk.withContext(function($ctx1) {
  324. self["@message"]=aMessage;
  325. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aMessage:aMessage},smalltalk.MessageNotUnderstood)})},
  326. args: ["aMessage"],
  327. source: "message: aMessage\x0a\x09message := aMessage",
  328. messageSends: [],
  329. referencedClasses: []
  330. }),
  331. smalltalk.MessageNotUnderstood);
  332. smalltalk.addMethod(
  333. smalltalk.method({
  334. selector: "messageText",
  335. category: 'accessing',
  336. fn: function (){
  337. var self=this;
  338. return smalltalk.withContext(function($ctx1) {
  339. var $1;
  340. $1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
  341. return $1;
  342. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.MessageNotUnderstood)})},
  343. args: [],
  344. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  345. messageSends: [",", "selector", "message", "asString", "receiver"],
  346. referencedClasses: []
  347. }),
  348. smalltalk.MessageNotUnderstood);
  349. smalltalk.addMethod(
  350. smalltalk.method({
  351. selector: "receiver",
  352. category: 'accessing',
  353. fn: function (){
  354. var self=this;
  355. return smalltalk.withContext(function($ctx1) {
  356. var $1;
  357. $1=self["@receiver"];
  358. return $1;
  359. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageNotUnderstood)})},
  360. args: [],
  361. source: "receiver\x0a\x09^receiver",
  362. messageSends: [],
  363. referencedClasses: []
  364. }),
  365. smalltalk.MessageNotUnderstood);
  366. smalltalk.addMethod(
  367. smalltalk.method({
  368. selector: "receiver:",
  369. category: 'accessing',
  370. fn: function (anObject){
  371. var self=this;
  372. return smalltalk.withContext(function($ctx1) {
  373. self["@receiver"]=anObject;
  374. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageNotUnderstood)})},
  375. args: ["anObject"],
  376. source: "receiver: anObject\x0a\x09receiver := anObject",
  377. messageSends: [],
  378. referencedClasses: []
  379. }),
  380. smalltalk.MessageNotUnderstood);
  381. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  382. smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  383. smalltalk.addMethod(
  384. smalltalk.method({
  385. selector: "object",
  386. category: 'accessing',
  387. fn: function (){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. var $1;
  391. $1=self["@object"];
  392. return $1;
  393. }, function($ctx1) {$ctx1.fill(self,"object",{},smalltalk.NonBooleanReceiver)})},
  394. args: [],
  395. source: "object\x0a\x09^ object",
  396. messageSends: [],
  397. referencedClasses: []
  398. }),
  399. smalltalk.NonBooleanReceiver);
  400. smalltalk.addMethod(
  401. smalltalk.method({
  402. selector: "object:",
  403. category: 'accessing',
  404. fn: function (anObject){
  405. var self=this;
  406. return smalltalk.withContext(function($ctx1) {
  407. self["@object"]=anObject;
  408. return self}, function($ctx1) {$ctx1.fill(self,"object:",{anObject:anObject},smalltalk.NonBooleanReceiver)})},
  409. args: ["anObject"],
  410. source: "object: anObject\x0a\x09object := anObject",
  411. messageSends: [],
  412. referencedClasses: []
  413. }),
  414. smalltalk.NonBooleanReceiver);
  415. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  416. smalltalk.ErrorHandler.comment="I am used to manage Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aSubclasses can register themselves as the current handler with\x0a`ErrorHandler class >> register`.\x0a\x0aSubclasses may override `#handleError:` to perform an action on the thrown exception.\x0aThe default behavior is to log the error and the context stack to the JavaScript console.";
  417. smalltalk.addMethod(
  418. smalltalk.method({
  419. selector: "handleError:",
  420. category: 'error handling',
  421. fn: function (anError){
  422. var self=this;
  423. return smalltalk.withContext(function($ctx1) {
  424. var $1;
  425. $1=_st(anError)._context();
  426. if(($receiver = $1) == nil || $receiver == undefined){
  427. $1;
  428. } else {
  429. self._logErrorContext_(_st(anError)._context());
  430. };
  431. self._logError_(anError);
  432. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.ErrorHandler)})},
  433. args: ["anError"],
  434. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  435. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  436. referencedClasses: []
  437. }),
  438. smalltalk.ErrorHandler);
  439. smalltalk.addMethod(
  440. smalltalk.method({
  441. selector: "log:",
  442. category: 'private',
  443. fn: function (aString){
  444. var self=this;
  445. return smalltalk.withContext(function($ctx1) {
  446. _st(console)._log_(aString);
  447. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},smalltalk.ErrorHandler)})},
  448. args: ["aString"],
  449. source: "log: aString\x0a\x09console log: aString",
  450. messageSends: ["log:"],
  451. referencedClasses: []
  452. }),
  453. smalltalk.ErrorHandler);
  454. smalltalk.addMethod(
  455. smalltalk.method({
  456. selector: "logContext:",
  457. category: 'private',
  458. fn: function (aContext){
  459. var self=this;
  460. return smalltalk.withContext(function($ctx1) {
  461. var $1;
  462. $1=_st(aContext)._home();
  463. if(($receiver = $1) == nil || $receiver == undefined){
  464. $1;
  465. } else {
  466. self._logContext_(_st(aContext)._home());
  467. };
  468. self._log_(_st(aContext)._asString());
  469. return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  470. args: ["aContext"],
  471. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext asString",
  472. messageSends: ["ifNotNil:", "logContext:", "home", "log:", "asString"],
  473. referencedClasses: []
  474. }),
  475. smalltalk.ErrorHandler);
  476. smalltalk.addMethod(
  477. smalltalk.method({
  478. selector: "logError:",
  479. category: 'private',
  480. fn: function (anError){
  481. var self=this;
  482. return smalltalk.withContext(function($ctx1) {
  483. self._log_(_st(anError)._messageText());
  484. return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},smalltalk.ErrorHandler)})},
  485. args: ["anError"],
  486. source: "logError: anError\x0a\x09self log: anError messageText",
  487. messageSends: ["log:", "messageText"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.ErrorHandler);
  491. smalltalk.addMethod(
  492. smalltalk.method({
  493. selector: "logErrorContext:",
  494. category: 'private',
  495. fn: function (aContext){
  496. var self=this;
  497. return smalltalk.withContext(function($ctx1) {
  498. var $1,$2;
  499. $1=aContext;
  500. if(($receiver = $1) == nil || $receiver == undefined){
  501. $1;
  502. } else {
  503. $2=_st(aContext)._home();
  504. if(($receiver = $2) == nil || $receiver == undefined){
  505. $2;
  506. } else {
  507. self._logContext_(_st(aContext)._home());
  508. };
  509. };
  510. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  511. args: ["aContext"],
  512. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  513. messageSends: ["ifNotNil:", "logContext:", "home"],
  514. referencedClasses: []
  515. }),
  516. smalltalk.ErrorHandler);
  517. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  518. smalltalk.addMethod(
  519. smalltalk.method({
  520. selector: "current",
  521. category: 'accessing',
  522. fn: function (){
  523. var self=this;
  524. return smalltalk.withContext(function($ctx1) {
  525. var $2,$1;
  526. $2=self["@current"];
  527. if(($receiver = $2) == nil || $receiver == undefined){
  528. self["@current"]=self._new();
  529. $1=self["@current"];
  530. } else {
  531. $1=$2;
  532. };
  533. return $1;
  534. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ErrorHandler.klass)})},
  535. args: [],
  536. source: "current\x0a\x09^current ifNil: [current := self new]",
  537. messageSends: ["ifNil:", "new"],
  538. referencedClasses: []
  539. }),
  540. smalltalk.ErrorHandler.klass);
  541. smalltalk.addMethod(
  542. smalltalk.method({
  543. selector: "initialize",
  544. category: 'initialization',
  545. fn: function (){
  546. var self=this;
  547. return smalltalk.withContext(function($ctx1) {
  548. self._register();
  549. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ErrorHandler.klass)})},
  550. args: [],
  551. source: "initialize\x0a\x09self register",
  552. messageSends: ["register"],
  553. referencedClasses: []
  554. }),
  555. smalltalk.ErrorHandler.klass);
  556. smalltalk.addMethod(
  557. smalltalk.method({
  558. selector: "register",
  559. category: 'initialization',
  560. fn: function (){
  561. var self=this;
  562. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  563. return smalltalk.withContext(function($ctx1) {
  564. _st($ErrorHandler())._setCurrent_(self._new());
  565. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ErrorHandler.klass)})},
  566. args: [],
  567. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  568. messageSends: ["setCurrent:", "new"],
  569. referencedClasses: ["ErrorHandler"]
  570. }),
  571. smalltalk.ErrorHandler.klass);
  572. smalltalk.addMethod(
  573. smalltalk.method({
  574. selector: "setCurrent:",
  575. category: 'accessing',
  576. fn: function (anHandler){
  577. var self=this;
  578. return smalltalk.withContext(function($ctx1) {
  579. self["@current"]=anHandler;
  580. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ErrorHandler.klass)})},
  581. args: ["anHandler"],
  582. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  583. messageSends: [],
  584. referencedClasses: []
  585. }),
  586. smalltalk.ErrorHandler.klass);
  587. });