Kernel-Exceptions.js 19 KB

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