Kernel-Exceptions.js 14 KB

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