Kernel-Exceptions.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. smalltalk.addPackage('Kernel-Exceptions', {});
  2. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  3. smalltalk.addMethod(
  4. "_context",
  5. smalltalk.method({
  6. selector: "context",
  7. category: 'accessing',
  8. fn: function (){
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) { return self.context;
  11. return self}, function($ctx1) {$ctx1.fill(self,"context", [], {}, smalltalk.Error)})},
  12. args: [],
  13. source: "context\x0a\x09<return self.context>",
  14. messageSends: [],
  15. referencedClasses: []
  16. }),
  17. smalltalk.Error);
  18. smalltalk.addMethod(
  19. "_isSmalltalkError",
  20. smalltalk.method({
  21. selector: "isSmalltalkError",
  22. category: 'testing',
  23. fn: function (){
  24. var self=this;
  25. return smalltalk.withContext(function($ctx1) { return self.smalltalkError === true;
  26. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError", [], {}, smalltalk.Error)})},
  27. args: [],
  28. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  29. messageSends: [],
  30. referencedClasses: []
  31. }),
  32. smalltalk.Error);
  33. smalltalk.addMethod(
  34. "_jsStack",
  35. smalltalk.method({
  36. selector: "jsStack",
  37. category: 'accessing',
  38. fn: function (){
  39. var self=this;
  40. return smalltalk.withContext(function($ctx1) { return self.stack;
  41. return self}, function($ctx1) {$ctx1.fill(self,"jsStack", [], {}, smalltalk.Error)})},
  42. args: [],
  43. source: "jsStack\x0a\x09<return self.stack>",
  44. messageSends: [],
  45. referencedClasses: []
  46. }),
  47. smalltalk.Error);
  48. smalltalk.addMethod(
  49. "_messageText",
  50. smalltalk.method({
  51. selector: "messageText",
  52. category: 'accessing',
  53. fn: function (){
  54. var self=this;
  55. return smalltalk.withContext(function($ctx1) { var $1;
  56. $1=self["@messageText"];
  57. return $1;
  58. }, function($ctx1) {$ctx1.fill(self,"messageText", [], {}, smalltalk.Error)})},
  59. args: [],
  60. source: "messageText\x0a\x09^messageText",
  61. messageSends: [],
  62. referencedClasses: []
  63. }),
  64. smalltalk.Error);
  65. smalltalk.addMethod(
  66. "_messageText_",
  67. smalltalk.method({
  68. selector: "messageText:",
  69. category: 'accessing',
  70. fn: function (aString){
  71. var self=this;
  72. return smalltalk.withContext(function($ctx1) { self["@messageText"]=aString;
  73. return self}, function($ctx1) {$ctx1.fill(self,"messageText:", [aString], {}, smalltalk.Error)})},
  74. args: ["aString"],
  75. source: "messageText: aString\x0a\x09messageText := aString",
  76. messageSends: [],
  77. referencedClasses: []
  78. }),
  79. smalltalk.Error);
  80. smalltalk.addMethod(
  81. "_signal",
  82. smalltalk.method({
  83. selector: "signal",
  84. category: 'signaling',
  85. fn: function (){
  86. var self=this;
  87. return smalltalk.withContext(function($ctx1) { self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  88. return self}, function($ctx1) {$ctx1.fill(self,"signal", [], {}, smalltalk.Error)})},
  89. args: [],
  90. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  91. messageSends: [],
  92. referencedClasses: []
  93. }),
  94. smalltalk.Error);
  95. smalltalk.addMethod(
  96. "_signal_",
  97. smalltalk.method({
  98. selector: "signal:",
  99. category: 'signaling',
  100. fn: function (aString){
  101. var self=this;
  102. return smalltalk.withContext(function($ctx1) { _st(self)._messageText_(aString);
  103. _st(self)._signal();
  104. return self}, function($ctx1) {$ctx1.fill(self,"signal:", [aString], {}, smalltalk.Error)})},
  105. args: ["aString"],
  106. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  107. messageSends: ["messageText:", "signal"],
  108. referencedClasses: []
  109. }),
  110. smalltalk.Error);
  111. smalltalk.addMethod(
  112. "_signal",
  113. smalltalk.method({
  114. selector: "signal",
  115. category: 'instance creation',
  116. fn: function (){
  117. var self=this;
  118. return smalltalk.withContext(function($ctx1) { var $1;
  119. $1=_st(_st(self)._new())._signal();
  120. return $1;
  121. }, function($ctx1) {$ctx1.fill(self,"signal", [], {}, smalltalk.Error.klass)})},
  122. args: [],
  123. source: "signal\x0a\x09^self new signal",
  124. messageSends: ["signal", "new"],
  125. referencedClasses: []
  126. }),
  127. smalltalk.Error.klass);
  128. smalltalk.addMethod(
  129. "_signal_",
  130. smalltalk.method({
  131. selector: "signal:",
  132. category: 'instance creation',
  133. fn: function (aString){
  134. var self=this;
  135. return smalltalk.withContext(function($ctx1) { var $1;
  136. $1=_st(_st(self)._new())._signal_(aString);
  137. return $1;
  138. }, function($ctx1) {$ctx1.fill(self,"signal:", [aString], {}, smalltalk.Error.klass)})},
  139. args: ["aString"],
  140. source: "signal: aString\x0a\x09 ^self new\x0a\x09\x09signal: aString",
  141. messageSends: ["signal:", "new"],
  142. referencedClasses: []
  143. }),
  144. smalltalk.Error.klass);
  145. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  146. smalltalk.addMethod(
  147. "_message",
  148. smalltalk.method({
  149. selector: "message",
  150. category: 'accessing',
  151. fn: function (){
  152. var self=this;
  153. return smalltalk.withContext(function($ctx1) { var $1;
  154. $1=self["@message"];
  155. return $1;
  156. }, function($ctx1) {$ctx1.fill(self,"message", [], {}, smalltalk.MessageNotUnderstood)})},
  157. args: [],
  158. source: "message\x0a\x09^message",
  159. messageSends: [],
  160. referencedClasses: []
  161. }),
  162. smalltalk.MessageNotUnderstood);
  163. smalltalk.addMethod(
  164. "_message_",
  165. smalltalk.method({
  166. selector: "message:",
  167. category: 'accessing',
  168. fn: function (aMessage){
  169. var self=this;
  170. return smalltalk.withContext(function($ctx1) { self["@message"]=aMessage;
  171. return self}, function($ctx1) {$ctx1.fill(self,"message:", [aMessage], {}, smalltalk.MessageNotUnderstood)})},
  172. args: ["aMessage"],
  173. source: "message: aMessage\x0a\x09message := aMessage",
  174. messageSends: [],
  175. referencedClasses: []
  176. }),
  177. smalltalk.MessageNotUnderstood);
  178. smalltalk.addMethod(
  179. "_messageText",
  180. smalltalk.method({
  181. selector: "messageText",
  182. category: 'accessing',
  183. fn: function (){
  184. var self=this;
  185. return smalltalk.withContext(function($ctx1) { var $1;
  186. $1=_st(_st(_st(_st(self)._receiver())._asString()).__comma(" does not understand #")).__comma(_st(_st(self)._message())._selector());
  187. return $1;
  188. }, function($ctx1) {$ctx1.fill(self,"messageText", [], {}, smalltalk.MessageNotUnderstood)})},
  189. args: [],
  190. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  191. messageSends: [",", "selector", "message", "asString", "receiver"],
  192. referencedClasses: []
  193. }),
  194. smalltalk.MessageNotUnderstood);
  195. smalltalk.addMethod(
  196. "_receiver",
  197. smalltalk.method({
  198. selector: "receiver",
  199. category: 'accessing',
  200. fn: function (){
  201. var self=this;
  202. return smalltalk.withContext(function($ctx1) { var $1;
  203. $1=self["@receiver"];
  204. return $1;
  205. }, function($ctx1) {$ctx1.fill(self,"receiver", [], {}, smalltalk.MessageNotUnderstood)})},
  206. args: [],
  207. source: "receiver\x0a\x09^receiver",
  208. messageSends: [],
  209. referencedClasses: []
  210. }),
  211. smalltalk.MessageNotUnderstood);
  212. smalltalk.addMethod(
  213. "_receiver_",
  214. smalltalk.method({
  215. selector: "receiver:",
  216. category: 'accessing',
  217. fn: function (anObject){
  218. var self=this;
  219. return smalltalk.withContext(function($ctx1) { self["@receiver"]=anObject;
  220. return self}, function($ctx1) {$ctx1.fill(self,"receiver:", [anObject], {}, smalltalk.MessageNotUnderstood)})},
  221. args: ["anObject"],
  222. source: "receiver: anObject\x0a\x09receiver := anObject",
  223. messageSends: [],
  224. referencedClasses: []
  225. }),
  226. smalltalk.MessageNotUnderstood);
  227. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  228. smalltalk.addMethod(
  229. "_object",
  230. smalltalk.method({
  231. selector: "object",
  232. category: 'accessing',
  233. fn: function (){
  234. var self=this;
  235. return smalltalk.withContext(function($ctx1) { var $1;
  236. $1=self["@object"];
  237. return $1;
  238. }, function($ctx1) {$ctx1.fill(self,"object", [], {}, smalltalk.NonBooleanReceiver)})},
  239. args: [],
  240. source: "object\x0a\x09^ object",
  241. messageSends: [],
  242. referencedClasses: []
  243. }),
  244. smalltalk.NonBooleanReceiver);
  245. smalltalk.addMethod(
  246. "_object_",
  247. smalltalk.method({
  248. selector: "object:",
  249. category: 'accessing',
  250. fn: function (anObject){
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) { self["@object"]=anObject;
  253. return self}, function($ctx1) {$ctx1.fill(self,"object:", [anObject], {}, smalltalk.NonBooleanReceiver)})},
  254. args: ["anObject"],
  255. source: "object: anObject\x0a\x09object := anObject",
  256. messageSends: [],
  257. referencedClasses: []
  258. }),
  259. smalltalk.NonBooleanReceiver);
  260. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  261. smalltalk.addMethod(
  262. "_handleError_",
  263. smalltalk.method({
  264. selector: "handleError:",
  265. category: 'error handling',
  266. fn: function (anError){
  267. var self=this;
  268. return smalltalk.withContext(function($ctx1) { var $1;
  269. $1=_st(anError)._context();
  270. if(($receiver = $1) == nil || $receiver == undefined){
  271. $1;
  272. } else {
  273. _st(self)._logErrorContext_(_st(anError)._context());
  274. };
  275. _st(self)._logError_(anError);
  276. return self}, function($ctx1) {$ctx1.fill(self,"handleError:", [anError], {}, smalltalk.ErrorHandler)})},
  277. args: ["anError"],
  278. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  279. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  280. referencedClasses: []
  281. }),
  282. smalltalk.ErrorHandler);
  283. smalltalk.addMethod(
  284. "_log_",
  285. smalltalk.method({
  286. selector: "log:",
  287. category: 'private',
  288. fn: function (aString){
  289. var self=this;
  290. return smalltalk.withContext(function($ctx1) { _st(console)._log_(aString);
  291. return self}, function($ctx1) {$ctx1.fill(self,"log:", [aString], {}, smalltalk.ErrorHandler)})},
  292. args: ["aString"],
  293. source: "log: aString\x0a\x09console log: aString",
  294. messageSends: ["log:"],
  295. referencedClasses: []
  296. }),
  297. smalltalk.ErrorHandler);
  298. smalltalk.addMethod(
  299. "_logContext_",
  300. smalltalk.method({
  301. selector: "logContext:",
  302. category: 'private',
  303. fn: function (aContext){
  304. var self=this;
  305. return smalltalk.withContext(function($ctx1) { var $1;
  306. $1=_st(aContext)._home();
  307. if(($receiver = $1) == nil || $receiver == undefined){
  308. $1;
  309. } else {
  310. _st(self)._logContext_(_st(aContext)._home());
  311. };
  312. _st(self)._log_(_st(_st(_st(_st(aContext)._receiver())._asString()).__comma(">>")).__comma(_st(_st(aContext)._selector())._asString()));
  313. return self}, function($ctx1) {$ctx1.fill(self,"logContext:", [aContext], {}, smalltalk.ErrorHandler)})},
  314. args: ["aContext"],
  315. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector asString\x0a",
  316. messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "asString", "selector", "receiver"],
  317. referencedClasses: []
  318. }),
  319. smalltalk.ErrorHandler);
  320. smalltalk.addMethod(
  321. "_logError_",
  322. smalltalk.method({
  323. selector: "logError:",
  324. category: 'private',
  325. fn: function (anError){
  326. var self=this;
  327. return smalltalk.withContext(function($ctx1) { _st(self)._log_(_st(anError)._messageText());
  328. return self}, function($ctx1) {$ctx1.fill(self,"logError:", [anError], {}, smalltalk.ErrorHandler)})},
  329. args: ["anError"],
  330. source: "logError: anError\x0a\x09self log: anError messageText",
  331. messageSends: ["log:", "messageText"],
  332. referencedClasses: []
  333. }),
  334. smalltalk.ErrorHandler);
  335. smalltalk.addMethod(
  336. "_logErrorContext_",
  337. smalltalk.method({
  338. selector: "logErrorContext:",
  339. category: 'private',
  340. fn: function (aContext){
  341. var self=this;
  342. return smalltalk.withContext(function($ctx1) { var $1,$3,$2;
  343. $1=aContext;
  344. $2=(function(){
  345. return smalltalk.withContext(function($ctx2) { $3=_st(aContext)._home();
  346. if(($receiver = $3) == nil || $receiver == undefined){
  347. return $3;
  348. } else {
  349. return _st(self)._logContext_(_st(aContext)._home());
  350. };
  351. }, function($ctx2) {$ctx2.fillBlock([], {})})});
  352. _st($1)._ifNotNil_($2);
  353. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:", [aContext], {}, smalltalk.ErrorHandler)})},
  354. args: ["aContext"],
  355. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  356. messageSends: ["ifNotNil:", "logContext:", "home"],
  357. referencedClasses: []
  358. }),
  359. smalltalk.ErrorHandler);
  360. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  361. smalltalk.addMethod(
  362. "_current",
  363. smalltalk.method({
  364. selector: "current",
  365. category: 'accessing',
  366. fn: function (){
  367. var self=this;
  368. return smalltalk.withContext(function($ctx1) { var $2,$1;
  369. $2=self["@current"];
  370. if(($receiver = $2) == nil || $receiver == undefined){
  371. self["@current"]=_st(self)._new();
  372. $1=self["@current"];
  373. } else {
  374. $1=$2;
  375. };
  376. return $1;
  377. }, function($ctx1) {$ctx1.fill(self,"current", [], {}, smalltalk.ErrorHandler.klass)})},
  378. args: [],
  379. source: "current\x0a\x09^current ifNil: [current := self new]",
  380. messageSends: ["ifNil:", "new"],
  381. referencedClasses: []
  382. }),
  383. smalltalk.ErrorHandler.klass);
  384. smalltalk.addMethod(
  385. "_initialize",
  386. smalltalk.method({
  387. selector: "initialize",
  388. category: 'initialization',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) { _st(self)._register();
  392. return self}, function($ctx1) {$ctx1.fill(self,"initialize", [], {}, smalltalk.ErrorHandler.klass)})},
  393. args: [],
  394. source: "initialize\x0a\x09self register",
  395. messageSends: ["register"],
  396. referencedClasses: []
  397. }),
  398. smalltalk.ErrorHandler.klass);
  399. smalltalk.addMethod(
  400. "_register",
  401. smalltalk.method({
  402. selector: "register",
  403. category: 'initialization',
  404. fn: function (){
  405. var self=this;
  406. return smalltalk.withContext(function($ctx1) { _st((smalltalk.ErrorHandler || ErrorHandler))._setCurrent_(_st(self)._new());
  407. return self}, function($ctx1) {$ctx1.fill(self,"register", [], {}, smalltalk.ErrorHandler.klass)})},
  408. args: [],
  409. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  410. messageSends: ["setCurrent:", "new"],
  411. referencedClasses: ["ErrorHandler"]
  412. }),
  413. smalltalk.ErrorHandler.klass);
  414. smalltalk.addMethod(
  415. "_setCurrent_",
  416. smalltalk.method({
  417. selector: "setCurrent:",
  418. category: 'accessing',
  419. fn: function (anHandler){
  420. var self=this;
  421. return smalltalk.withContext(function($ctx1) { self["@current"]=anHandler;
  422. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:", [anHandler], {}, smalltalk.ErrorHandler.klass)})},
  423. args: ["anHandler"],
  424. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  425. messageSends: [],
  426. referencedClasses: []
  427. }),
  428. smalltalk.ErrorHandler.klass);