Kernel-Exceptions.js 11 KB

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