Kernel-Exceptions.js 19 KB

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