Kernel-Exceptions.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. define("amber_core/Kernel-Exceptions", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Exceptions');
  3. smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  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. $ctx1.sendIdx[","]=1;
  342. return $1;
  343. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.MessageNotUnderstood)})},
  344. args: [],
  345. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  346. messageSends: [",", "asString", "receiver", "selector", "message"],
  347. referencedClasses: []
  348. }),
  349. smalltalk.MessageNotUnderstood);
  350. smalltalk.addMethod(
  351. smalltalk.method({
  352. selector: "receiver",
  353. category: 'accessing',
  354. fn: function (){
  355. var self=this;
  356. return smalltalk.withContext(function($ctx1) {
  357. var $1;
  358. $1=self["@receiver"];
  359. return $1;
  360. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageNotUnderstood)})},
  361. args: [],
  362. source: "receiver\x0a\x09^receiver",
  363. messageSends: [],
  364. referencedClasses: []
  365. }),
  366. smalltalk.MessageNotUnderstood);
  367. smalltalk.addMethod(
  368. smalltalk.method({
  369. selector: "receiver:",
  370. category: 'accessing',
  371. fn: function (anObject){
  372. var self=this;
  373. return smalltalk.withContext(function($ctx1) {
  374. self["@receiver"]=anObject;
  375. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageNotUnderstood)})},
  376. args: ["anObject"],
  377. source: "receiver: anObject\x0a\x09receiver := anObject",
  378. messageSends: [],
  379. referencedClasses: []
  380. }),
  381. smalltalk.MessageNotUnderstood);
  382. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  383. smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "object",
  387. category: 'accessing',
  388. fn: function (){
  389. var self=this;
  390. return smalltalk.withContext(function($ctx1) {
  391. var $1;
  392. $1=self["@object"];
  393. return $1;
  394. }, function($ctx1) {$ctx1.fill(self,"object",{},smalltalk.NonBooleanReceiver)})},
  395. args: [],
  396. source: "object\x0a\x09^ object",
  397. messageSends: [],
  398. referencedClasses: []
  399. }),
  400. smalltalk.NonBooleanReceiver);
  401. smalltalk.addMethod(
  402. smalltalk.method({
  403. selector: "object:",
  404. category: 'accessing',
  405. fn: function (anObject){
  406. var self=this;
  407. return smalltalk.withContext(function($ctx1) {
  408. self["@object"]=anObject;
  409. return self}, function($ctx1) {$ctx1.fill(self,"object:",{anObject:anObject},smalltalk.NonBooleanReceiver)})},
  410. args: ["anObject"],
  411. source: "object: anObject\x0a\x09object := anObject",
  412. messageSends: [],
  413. referencedClasses: []
  414. }),
  415. smalltalk.NonBooleanReceiver);
  416. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  417. 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.";
  418. smalltalk.addMethod(
  419. smalltalk.method({
  420. selector: "handleError:",
  421. category: 'error handling',
  422. fn: function (anError){
  423. var self=this;
  424. return smalltalk.withContext(function($ctx1) {
  425. var $1;
  426. $1=_st(anError)._context();
  427. $ctx1.sendIdx["context"]=1;
  428. if(($receiver = $1) == nil || $receiver == null){
  429. $1;
  430. } else {
  431. self._logErrorContext_(_st(anError)._context());
  432. };
  433. self._logError_(anError);
  434. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.ErrorHandler)})},
  435. args: ["anError"],
  436. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  437. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"],
  438. referencedClasses: []
  439. }),
  440. smalltalk.ErrorHandler);
  441. smalltalk.addMethod(
  442. smalltalk.method({
  443. selector: "log:",
  444. category: 'private',
  445. fn: function (aString){
  446. var self=this;
  447. return smalltalk.withContext(function($ctx1) {
  448. _st(console)._log_(aString);
  449. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},smalltalk.ErrorHandler)})},
  450. args: ["aString"],
  451. source: "log: aString\x0a\x09console log: aString",
  452. messageSends: ["log:"],
  453. referencedClasses: []
  454. }),
  455. smalltalk.ErrorHandler);
  456. smalltalk.addMethod(
  457. smalltalk.method({
  458. selector: "logContext:",
  459. category: 'private',
  460. fn: function (aContext){
  461. var self=this;
  462. return smalltalk.withContext(function($ctx1) {
  463. var $1;
  464. $1=_st(aContext)._home();
  465. $ctx1.sendIdx["home"]=1;
  466. if(($receiver = $1) == nil || $receiver == null){
  467. $1;
  468. } else {
  469. self._logContext_(_st(aContext)._home());
  470. };
  471. self._log_(_st(aContext)._asString());
  472. return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  473. args: ["aContext"],
  474. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext asString",
  475. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"],
  476. referencedClasses: []
  477. }),
  478. smalltalk.ErrorHandler);
  479. smalltalk.addMethod(
  480. smalltalk.method({
  481. selector: "logError:",
  482. category: 'private',
  483. fn: function (anError){
  484. var self=this;
  485. return smalltalk.withContext(function($ctx1) {
  486. self._log_(_st(anError)._messageText());
  487. return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},smalltalk.ErrorHandler)})},
  488. args: ["anError"],
  489. source: "logError: anError\x0a\x09self log: anError messageText",
  490. messageSends: ["log:", "messageText"],
  491. referencedClasses: []
  492. }),
  493. smalltalk.ErrorHandler);
  494. smalltalk.addMethod(
  495. smalltalk.method({
  496. selector: "logErrorContext:",
  497. category: 'private',
  498. fn: function (aContext){
  499. var self=this;
  500. return smalltalk.withContext(function($ctx1) {
  501. var $1;
  502. if(($receiver = aContext) == nil || $receiver == null){
  503. aContext;
  504. } else {
  505. $1=_st(aContext)._home();
  506. $ctx1.sendIdx["home"]=1;
  507. if(($receiver = $1) == nil || $receiver == null){
  508. $1;
  509. } else {
  510. self._logContext_(_st(aContext)._home());
  511. };
  512. };
  513. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  514. args: ["aContext"],
  515. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  516. messageSends: ["ifNotNil:", "home", "logContext:"],
  517. referencedClasses: []
  518. }),
  519. smalltalk.ErrorHandler);
  520. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  521. smalltalk.addMethod(
  522. smalltalk.method({
  523. selector: "current",
  524. category: 'accessing',
  525. fn: function (){
  526. var self=this;
  527. return smalltalk.withContext(function($ctx1) {
  528. var $2,$1;
  529. $2=self["@current"];
  530. if(($receiver = $2) == nil || $receiver == null){
  531. self["@current"]=self._new();
  532. $1=self["@current"];
  533. } else {
  534. $1=$2;
  535. };
  536. return $1;
  537. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ErrorHandler.klass)})},
  538. args: [],
  539. source: "current\x0a\x09^current ifNil: [current := self new]",
  540. messageSends: ["ifNil:", "new"],
  541. referencedClasses: []
  542. }),
  543. smalltalk.ErrorHandler.klass);
  544. smalltalk.addMethod(
  545. smalltalk.method({
  546. selector: "initialize",
  547. category: 'initialization',
  548. fn: function (){
  549. var self=this;
  550. return smalltalk.withContext(function($ctx1) {
  551. self._register();
  552. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ErrorHandler.klass)})},
  553. args: [],
  554. source: "initialize\x0a\x09self register",
  555. messageSends: ["register"],
  556. referencedClasses: []
  557. }),
  558. smalltalk.ErrorHandler.klass);
  559. smalltalk.addMethod(
  560. smalltalk.method({
  561. selector: "register",
  562. category: 'initialization',
  563. fn: function (){
  564. var self=this;
  565. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  566. return smalltalk.withContext(function($ctx1) {
  567. _st($ErrorHandler())._setCurrent_(self._new());
  568. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ErrorHandler.klass)})},
  569. args: [],
  570. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  571. messageSends: ["setCurrent:", "new"],
  572. referencedClasses: ["ErrorHandler"]
  573. }),
  574. smalltalk.ErrorHandler.klass);
  575. smalltalk.addMethod(
  576. smalltalk.method({
  577. selector: "setCurrent:",
  578. category: 'accessing',
  579. fn: function (anHandler){
  580. var self=this;
  581. return smalltalk.withContext(function($ctx1) {
  582. self["@current"]=anHandler;
  583. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ErrorHandler.klass)})},
  584. args: ["anHandler"],
  585. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  586. messageSends: [],
  587. referencedClasses: []
  588. }),
  589. smalltalk.ErrorHandler.klass);
  590. });