1
0

Kernel-Exceptions.js 19 KB

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