Kernel-Exceptions.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Kernel-Exceptions');
  4. smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('Error', globals.Object, ['messageText'], 'Kernel-Exceptions');
  6. //>>excludeStart("ide", pragmas.excludeIdeData);
  7. globals.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.";
  8. //>>excludeEnd("ide");
  9. smalltalk.addMethod(
  10. smalltalk.method({
  11. selector: "beHandled",
  12. protocol: 'accessing',
  13. fn: function (){
  14. var self=this;
  15. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16. return smalltalk.withContext(function($ctx1) {
  17. //>>excludeEnd("ctx");
  18. self.amberHandled = true;
  19. return self;
  20. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},globals.Error)});
  22. //>>excludeEnd("ctx");
  23. },
  24. //>>excludeStart("ide", pragmas.excludeIdeData);
  25. args: [],
  26. source: "beHandled\x0a\x09<self.amberHandled = true>",
  27. referencedClasses: [],
  28. //>>excludeEnd("ide");
  29. messageSends: []
  30. }),
  31. globals.Error);
  32. smalltalk.addMethod(
  33. smalltalk.method({
  34. selector: "beUnhandled",
  35. protocol: 'accessing',
  36. fn: function (){
  37. var self=this;
  38. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39. return smalltalk.withContext(function($ctx1) {
  40. //>>excludeEnd("ctx");
  41. self.amberHandled = false;
  42. return self;
  43. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},globals.Error)});
  45. //>>excludeEnd("ctx");
  46. },
  47. //>>excludeStart("ide", pragmas.excludeIdeData);
  48. args: [],
  49. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  50. referencedClasses: [],
  51. //>>excludeEnd("ide");
  52. messageSends: []
  53. }),
  54. globals.Error);
  55. smalltalk.addMethod(
  56. smalltalk.method({
  57. selector: "context",
  58. protocol: 'accessing',
  59. fn: function (){
  60. var self=this;
  61. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62. return smalltalk.withContext(function($ctx1) {
  63. //>>excludeEnd("ctx");
  64. return self.context;
  65. return self;
  66. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67. }, function($ctx1) {$ctx1.fill(self,"context",{},globals.Error)});
  68. //>>excludeEnd("ctx");
  69. },
  70. //>>excludeStart("ide", pragmas.excludeIdeData);
  71. args: [],
  72. source: "context\x0a\x09<return self.context>",
  73. referencedClasses: [],
  74. //>>excludeEnd("ide");
  75. messageSends: []
  76. }),
  77. globals.Error);
  78. smalltalk.addMethod(
  79. smalltalk.method({
  80. selector: "initialize",
  81. protocol: 'initialization',
  82. fn: function (){
  83. var self=this;
  84. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  85. return smalltalk.withContext(function($ctx1) {
  86. //>>excludeEnd("ctx");
  87. self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
  88. return self;
  89. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  90. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Error)});
  91. //>>excludeEnd("ctx");
  92. },
  93. //>>excludeStart("ide", pragmas.excludeIdeData);
  94. args: [],
  95. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  96. referencedClasses: [],
  97. //>>excludeEnd("ide");
  98. messageSends: ["messageText:", ",", "name", "class"]
  99. }),
  100. globals.Error);
  101. smalltalk.addMethod(
  102. smalltalk.method({
  103. selector: "isSmalltalkError",
  104. protocol: 'testing',
  105. fn: function (){
  106. var self=this;
  107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  108. return smalltalk.withContext(function($ctx1) {
  109. //>>excludeEnd("ctx");
  110. return self.smalltalkError === true;
  111. return self;
  112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  113. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},globals.Error)});
  114. //>>excludeEnd("ctx");
  115. },
  116. //>>excludeStart("ide", pragmas.excludeIdeData);
  117. args: [],
  118. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  119. referencedClasses: [],
  120. //>>excludeEnd("ide");
  121. messageSends: []
  122. }),
  123. globals.Error);
  124. smalltalk.addMethod(
  125. smalltalk.method({
  126. selector: "jsStack",
  127. protocol: 'accessing',
  128. fn: function (){
  129. var self=this;
  130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  131. return smalltalk.withContext(function($ctx1) {
  132. //>>excludeEnd("ctx");
  133. return self.stack;
  134. return self;
  135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  136. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},globals.Error)});
  137. //>>excludeEnd("ctx");
  138. },
  139. //>>excludeStart("ide", pragmas.excludeIdeData);
  140. args: [],
  141. source: "jsStack\x0a\x09<return self.stack>",
  142. referencedClasses: [],
  143. //>>excludeEnd("ide");
  144. messageSends: []
  145. }),
  146. globals.Error);
  147. smalltalk.addMethod(
  148. smalltalk.method({
  149. selector: "messageText",
  150. protocol: 'accessing',
  151. fn: function (){
  152. var self=this;
  153. var $1;
  154. $1=self["@messageText"];
  155. return $1;
  156. },
  157. //>>excludeStart("ide", pragmas.excludeIdeData);
  158. args: [],
  159. source: "messageText\x0a\x09^ messageText",
  160. referencedClasses: [],
  161. //>>excludeEnd("ide");
  162. messageSends: []
  163. }),
  164. globals.Error);
  165. smalltalk.addMethod(
  166. smalltalk.method({
  167. selector: "messageText:",
  168. protocol: 'accessing',
  169. fn: function (aString){
  170. var self=this;
  171. self["@messageText"]=aString;
  172. return self;
  173. },
  174. //>>excludeStart("ide", pragmas.excludeIdeData);
  175. args: ["aString"],
  176. source: "messageText: aString\x0a\x09messageText := aString",
  177. referencedClasses: [],
  178. //>>excludeEnd("ide");
  179. messageSends: []
  180. }),
  181. globals.Error);
  182. smalltalk.addMethod(
  183. smalltalk.method({
  184. selector: "resignal",
  185. protocol: 'signaling',
  186. fn: function (){
  187. var self=this;
  188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  189. return smalltalk.withContext(function($ctx1) {
  190. //>>excludeEnd("ctx");
  191. self.amberHandled = false;
  192. throw(self);
  193. ;
  194. return self;
  195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  196. }, function($ctx1) {$ctx1.fill(self,"resignal",{},globals.Error)});
  197. //>>excludeEnd("ctx");
  198. },
  199. //>>excludeStart("ide", pragmas.excludeIdeData);
  200. args: [],
  201. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09>",
  202. referencedClasses: [],
  203. //>>excludeEnd("ide");
  204. messageSends: []
  205. }),
  206. globals.Error);
  207. smalltalk.addMethod(
  208. smalltalk.method({
  209. selector: "signal",
  210. protocol: 'signaling',
  211. fn: function (){
  212. var self=this;
  213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  214. return smalltalk.withContext(function($ctx1) {
  215. //>>excludeEnd("ctx");
  216. self.amberHandled = false;
  217. self.context = smalltalk.getThisContext();
  218. self.smalltalkError = true; throw(self)
  219. ;
  220. return self;
  221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  222. }, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error)});
  223. //>>excludeEnd("ctx");
  224. },
  225. //>>excludeStart("ide", pragmas.excludeIdeData);
  226. args: [],
  227. source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = smalltalk.getThisContext(); \x0a\x09\x09self.smalltalkError = true; throw(self)\x0a\x09>",
  228. referencedClasses: [],
  229. //>>excludeEnd("ide");
  230. messageSends: []
  231. }),
  232. globals.Error);
  233. smalltalk.addMethod(
  234. smalltalk.method({
  235. selector: "signal:",
  236. protocol: 'signaling',
  237. fn: function (aString){
  238. var self=this;
  239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  240. return smalltalk.withContext(function($ctx1) {
  241. //>>excludeEnd("ctx");
  242. self._messageText_(aString);
  243. self._signal();
  244. return self;
  245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  246. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error)});
  247. //>>excludeEnd("ctx");
  248. },
  249. //>>excludeStart("ide", pragmas.excludeIdeData);
  250. args: ["aString"],
  251. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  252. referencedClasses: [],
  253. //>>excludeEnd("ide");
  254. messageSends: ["messageText:", "signal"]
  255. }),
  256. globals.Error);
  257. smalltalk.addMethod(
  258. smalltalk.method({
  259. selector: "signalerContext",
  260. protocol: 'accessing',
  261. fn: function (){
  262. var self=this;
  263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  264. return smalltalk.withContext(function($ctx1) {
  265. //>>excludeEnd("ctx");
  266. var $1;
  267. $1=self._signalerContextFrom_(self._context());
  268. return $1;
  269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  270. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},globals.Error)});
  271. //>>excludeEnd("ctx");
  272. },
  273. //>>excludeStart("ide", pragmas.excludeIdeData);
  274. args: [],
  275. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  276. referencedClasses: [],
  277. //>>excludeEnd("ide");
  278. messageSends: ["signalerContextFrom:", "context"]
  279. }),
  280. globals.Error);
  281. smalltalk.addMethod(
  282. smalltalk.method({
  283. selector: "signalerContextFrom:",
  284. protocol: 'accessing',
  285. fn: function (aContext){
  286. var self=this;
  287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  288. return smalltalk.withContext(function($ctx1) {
  289. //>>excludeEnd("ctx");
  290. var $4,$3,$2,$1;
  291. $1=_st(aContext)._findContextSuchThat_((function(context){
  292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  293. return smalltalk.withContext(function($ctx2) {
  294. //>>excludeEnd("ctx");
  295. $4=_st(context)._receiver();
  296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  297. $ctx2.sendIdx["receiver"]=1;
  298. //>>excludeEnd("ctx");
  299. $3=_st($4).__eq_eq(self);
  300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  301. $ctx2.sendIdx["=="]=1;
  302. //>>excludeEnd("ctx");
  303. $2=_st($3)._or_((function(){
  304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  305. return smalltalk.withContext(function($ctx3) {
  306. //>>excludeEnd("ctx");
  307. return _st(_st(context)._receiver()).__eq_eq(self._class());
  308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  309. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  310. //>>excludeEnd("ctx");
  311. }));
  312. return _st($2)._not();
  313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  314. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  315. //>>excludeEnd("ctx");
  316. }));
  317. return $1;
  318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  319. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Error)});
  320. //>>excludeEnd("ctx");
  321. },
  322. //>>excludeStart("ide", pragmas.excludeIdeData);
  323. args: ["aContext"],
  324. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  325. referencedClasses: [],
  326. //>>excludeEnd("ide");
  327. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  328. }),
  329. globals.Error);
  330. smalltalk.addMethod(
  331. smalltalk.method({
  332. selector: "wasHandled",
  333. protocol: 'testing',
  334. fn: function (){
  335. var self=this;
  336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  337. return smalltalk.withContext(function($ctx1) {
  338. //>>excludeEnd("ctx");
  339. return self.amberHandled || false;
  340. return self;
  341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  342. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},globals.Error)});
  343. //>>excludeEnd("ctx");
  344. },
  345. //>>excludeStart("ide", pragmas.excludeIdeData);
  346. args: [],
  347. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  348. referencedClasses: [],
  349. //>>excludeEnd("ide");
  350. messageSends: []
  351. }),
  352. globals.Error);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "heliosClass",
  356. protocol: 'helios',
  357. fn: function (){
  358. var self=this;
  359. return "exception";
  360. },
  361. //>>excludeStart("ide", pragmas.excludeIdeData);
  362. args: [],
  363. source: "heliosClass\x0a\x09^ 'exception'",
  364. referencedClasses: [],
  365. //>>excludeEnd("ide");
  366. messageSends: []
  367. }),
  368. globals.Error.klass);
  369. smalltalk.addMethod(
  370. smalltalk.method({
  371. selector: "signal",
  372. protocol: 'instance creation',
  373. fn: function (){
  374. var self=this;
  375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  376. return smalltalk.withContext(function($ctx1) {
  377. //>>excludeEnd("ctx");
  378. var $1;
  379. $1=_st(self._new())._signal();
  380. return $1;
  381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  382. }, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error.klass)});
  383. //>>excludeEnd("ctx");
  384. },
  385. //>>excludeStart("ide", pragmas.excludeIdeData);
  386. args: [],
  387. source: "signal\x0a\x09^ self new signal",
  388. referencedClasses: [],
  389. //>>excludeEnd("ide");
  390. messageSends: ["signal", "new"]
  391. }),
  392. globals.Error.klass);
  393. smalltalk.addMethod(
  394. smalltalk.method({
  395. selector: "signal:",
  396. protocol: 'instance creation',
  397. fn: function (aString){
  398. var self=this;
  399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  400. return smalltalk.withContext(function($ctx1) {
  401. //>>excludeEnd("ctx");
  402. var $1;
  403. $1=_st(self._new())._signal_(aString);
  404. return $1;
  405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  406. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error.klass)});
  407. //>>excludeEnd("ctx");
  408. },
  409. //>>excludeStart("ide", pragmas.excludeIdeData);
  410. args: ["aString"],
  411. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  412. referencedClasses: [],
  413. //>>excludeEnd("ide");
  414. messageSends: ["signal:", "new"]
  415. }),
  416. globals.Error.klass);
  417. smalltalk.addClass('Halt', globals.Error, [], 'Kernel-Exceptions');
  418. //>>excludeStart("ide", pragmas.excludeIdeData);
  419. globals.Halt.comment="I am provided to support `Object>>#halt`.";
  420. //>>excludeEnd("ide");
  421. smalltalk.addMethod(
  422. smalltalk.method({
  423. selector: "messageText",
  424. protocol: 'accessing',
  425. fn: function (){
  426. var self=this;
  427. return "Halt encountered";
  428. },
  429. //>>excludeStart("ide", pragmas.excludeIdeData);
  430. args: [],
  431. source: "messageText\x0a\x09^ 'Halt encountered'",
  432. referencedClasses: [],
  433. //>>excludeEnd("ide");
  434. messageSends: []
  435. }),
  436. globals.Halt);
  437. smalltalk.addMethod(
  438. smalltalk.method({
  439. selector: "signalerContextFrom:",
  440. protocol: 'accessing',
  441. fn: function (aContext){
  442. var self=this;
  443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  444. return smalltalk.withContext(function($ctx1) {
  445. //>>excludeEnd("ctx");
  446. var $4,$3,$2,$1;
  447. $1=_st(aContext)._findContextSuchThat_((function(context){
  448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  449. return smalltalk.withContext(function($ctx2) {
  450. //>>excludeEnd("ctx");
  451. $4=_st(context)._receiver();
  452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  453. $ctx2.sendIdx["receiver"]=1;
  454. //>>excludeEnd("ctx");
  455. $3=_st($4).__eq_eq(self);
  456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  457. $ctx2.sendIdx["=="]=1;
  458. //>>excludeEnd("ctx");
  459. $2=_st($3)._or_((function(){
  460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  461. return smalltalk.withContext(function($ctx3) {
  462. //>>excludeEnd("ctx");
  463. return _st(_st(_st(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  465. return smalltalk.withContext(function($ctx4) {
  466. //>>excludeEnd("ctx");
  467. return _st(_st(_st(context)._method())._selector()).__eq("halt");
  468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  469. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  470. //>>excludeEnd("ctx");
  471. }));
  472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  473. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  474. //>>excludeEnd("ctx");
  475. }));
  476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  477. $ctx2.sendIdx["or:"]=1;
  478. //>>excludeEnd("ctx");
  479. return _st($2)._not();
  480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  481. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  482. //>>excludeEnd("ctx");
  483. }));
  484. return $1;
  485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  486. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Halt)});
  487. //>>excludeEnd("ctx");
  488. },
  489. //>>excludeStart("ide", pragmas.excludeIdeData);
  490. args: ["aContext"],
  491. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  492. referencedClasses: [],
  493. //>>excludeEnd("ide");
  494. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  495. }),
  496. globals.Halt);
  497. smalltalk.addClass('JavaScriptException', globals.Error, ['exception'], 'Kernel-Exceptions');
  498. //>>excludeStart("ide", pragmas.excludeIdeData);
  499. globals.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:`";
  500. //>>excludeEnd("ide");
  501. smalltalk.addMethod(
  502. smalltalk.method({
  503. selector: "context:",
  504. protocol: 'accessing',
  505. fn: function (aMethodContext){
  506. var self=this;
  507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  508. return smalltalk.withContext(function($ctx1) {
  509. //>>excludeEnd("ctx");
  510. self.context = aMethodContext;
  511. return self;
  512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  513. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},globals.JavaScriptException)});
  514. //>>excludeEnd("ctx");
  515. },
  516. //>>excludeStart("ide", pragmas.excludeIdeData);
  517. args: ["aMethodContext"],
  518. 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>",
  519. referencedClasses: [],
  520. //>>excludeEnd("ide");
  521. messageSends: []
  522. }),
  523. globals.JavaScriptException);
  524. smalltalk.addMethod(
  525. smalltalk.method({
  526. selector: "exception",
  527. protocol: 'accessing',
  528. fn: function (){
  529. var self=this;
  530. var $1;
  531. $1=self["@exception"];
  532. return $1;
  533. },
  534. //>>excludeStart("ide", pragmas.excludeIdeData);
  535. args: [],
  536. source: "exception\x0a\x09^ exception",
  537. referencedClasses: [],
  538. //>>excludeEnd("ide");
  539. messageSends: []
  540. }),
  541. globals.JavaScriptException);
  542. smalltalk.addMethod(
  543. smalltalk.method({
  544. selector: "exception:",
  545. protocol: 'accessing',
  546. fn: function (anException){
  547. var self=this;
  548. self["@exception"]=anException;
  549. return self;
  550. },
  551. //>>excludeStart("ide", pragmas.excludeIdeData);
  552. args: ["anException"],
  553. source: "exception: anException\x0a\x09exception := anException",
  554. referencedClasses: [],
  555. //>>excludeEnd("ide");
  556. messageSends: []
  557. }),
  558. globals.JavaScriptException);
  559. smalltalk.addMethod(
  560. smalltalk.method({
  561. selector: "messageText",
  562. protocol: 'accessing',
  563. fn: function (){
  564. var self=this;
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. return smalltalk.withContext(function($ctx1) {
  567. //>>excludeEnd("ctx");
  568. return 'JavaScript exception: ' + self["@exception"].toString();
  569. return self;
  570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  571. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.JavaScriptException)});
  572. //>>excludeEnd("ctx");
  573. },
  574. //>>excludeStart("ide", pragmas.excludeIdeData);
  575. args: [],
  576. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  577. referencedClasses: [],
  578. //>>excludeEnd("ide");
  579. messageSends: []
  580. }),
  581. globals.JavaScriptException);
  582. smalltalk.addMethod(
  583. smalltalk.method({
  584. selector: "on:",
  585. protocol: 'instance creation',
  586. fn: function (anException){
  587. var self=this;
  588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  589. return smalltalk.withContext(function($ctx1) {
  590. //>>excludeEnd("ctx");
  591. var $2,$3,$1;
  592. $2=self._new();
  593. _st($2)._exception_(anException);
  594. $3=_st($2)._yourself();
  595. $1=$3;
  596. return $1;
  597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  598. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},globals.JavaScriptException.klass)});
  599. //>>excludeEnd("ctx");
  600. },
  601. //>>excludeStart("ide", pragmas.excludeIdeData);
  602. args: ["anException"],
  603. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  604. referencedClasses: [],
  605. //>>excludeEnd("ide");
  606. messageSends: ["exception:", "new", "yourself"]
  607. }),
  608. globals.JavaScriptException.klass);
  609. smalltalk.addMethod(
  610. smalltalk.method({
  611. selector: "on:context:",
  612. protocol: 'instance creation',
  613. fn: function (anException,aMethodContext){
  614. var self=this;
  615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  616. return smalltalk.withContext(function($ctx1) {
  617. //>>excludeEnd("ctx");
  618. var $2,$3,$1;
  619. $2=self._new();
  620. _st($2)._exception_(anException);
  621. _st($2)._context_(aMethodContext);
  622. $3=_st($2)._yourself();
  623. $1=$3;
  624. return $1;
  625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  626. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},globals.JavaScriptException.klass)});
  627. //>>excludeEnd("ctx");
  628. },
  629. //>>excludeStart("ide", pragmas.excludeIdeData);
  630. args: ["anException", "aMethodContext"],
  631. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  632. referencedClasses: [],
  633. //>>excludeEnd("ide");
  634. messageSends: ["exception:", "new", "context:", "yourself"]
  635. }),
  636. globals.JavaScriptException.klass);
  637. smalltalk.addClass('MessageNotUnderstood', globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  638. //>>excludeStart("ide", pragmas.excludeIdeData);
  639. globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  640. //>>excludeEnd("ide");
  641. smalltalk.addMethod(
  642. smalltalk.method({
  643. selector: "message",
  644. protocol: 'accessing',
  645. fn: function (){
  646. var self=this;
  647. var $1;
  648. $1=self["@message"];
  649. return $1;
  650. },
  651. //>>excludeStart("ide", pragmas.excludeIdeData);
  652. args: [],
  653. source: "message\x0a\x09^ message",
  654. referencedClasses: [],
  655. //>>excludeEnd("ide");
  656. messageSends: []
  657. }),
  658. globals.MessageNotUnderstood);
  659. smalltalk.addMethod(
  660. smalltalk.method({
  661. selector: "message:",
  662. protocol: 'accessing',
  663. fn: function (aMessage){
  664. var self=this;
  665. self["@message"]=aMessage;
  666. return self;
  667. },
  668. //>>excludeStart("ide", pragmas.excludeIdeData);
  669. args: ["aMessage"],
  670. source: "message: aMessage\x0a\x09message := aMessage",
  671. referencedClasses: [],
  672. //>>excludeEnd("ide");
  673. messageSends: []
  674. }),
  675. globals.MessageNotUnderstood);
  676. smalltalk.addMethod(
  677. smalltalk.method({
  678. selector: "messageText",
  679. protocol: 'accessing',
  680. fn: function (){
  681. var self=this;
  682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  683. return smalltalk.withContext(function($ctx1) {
  684. //>>excludeEnd("ctx");
  685. var $1;
  686. $1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
  687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  688. $ctx1.sendIdx[","]=1;
  689. //>>excludeEnd("ctx");
  690. return $1;
  691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  692. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.MessageNotUnderstood)});
  693. //>>excludeEnd("ctx");
  694. },
  695. //>>excludeStart("ide", pragmas.excludeIdeData);
  696. args: [],
  697. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  698. referencedClasses: [],
  699. //>>excludeEnd("ide");
  700. messageSends: [",", "asString", "receiver", "selector", "message"]
  701. }),
  702. globals.MessageNotUnderstood);
  703. smalltalk.addMethod(
  704. smalltalk.method({
  705. selector: "receiver",
  706. protocol: 'accessing',
  707. fn: function (){
  708. var self=this;
  709. var $1;
  710. $1=self["@receiver"];
  711. return $1;
  712. },
  713. //>>excludeStart("ide", pragmas.excludeIdeData);
  714. args: [],
  715. source: "receiver\x0a\x09^ receiver",
  716. referencedClasses: [],
  717. //>>excludeEnd("ide");
  718. messageSends: []
  719. }),
  720. globals.MessageNotUnderstood);
  721. smalltalk.addMethod(
  722. smalltalk.method({
  723. selector: "receiver:",
  724. protocol: 'accessing',
  725. fn: function (anObject){
  726. var self=this;
  727. self["@receiver"]=anObject;
  728. return self;
  729. },
  730. //>>excludeStart("ide", pragmas.excludeIdeData);
  731. args: ["anObject"],
  732. source: "receiver: anObject\x0a\x09receiver := anObject",
  733. referencedClasses: [],
  734. //>>excludeEnd("ide");
  735. messageSends: []
  736. }),
  737. globals.MessageNotUnderstood);
  738. smalltalk.addClass('NonBooleanReceiver', globals.Error, ['object'], 'Kernel-Exceptions');
  739. //>>excludeStart("ide", pragmas.excludeIdeData);
  740. globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  741. //>>excludeEnd("ide");
  742. smalltalk.addMethod(
  743. smalltalk.method({
  744. selector: "object",
  745. protocol: 'accessing',
  746. fn: function (){
  747. var self=this;
  748. var $1;
  749. $1=self["@object"];
  750. return $1;
  751. },
  752. //>>excludeStart("ide", pragmas.excludeIdeData);
  753. args: [],
  754. source: "object\x0a\x09^ object",
  755. referencedClasses: [],
  756. //>>excludeEnd("ide");
  757. messageSends: []
  758. }),
  759. globals.NonBooleanReceiver);
  760. smalltalk.addMethod(
  761. smalltalk.method({
  762. selector: "object:",
  763. protocol: 'accessing',
  764. fn: function (anObject){
  765. var self=this;
  766. self["@object"]=anObject;
  767. return self;
  768. },
  769. //>>excludeStart("ide", pragmas.excludeIdeData);
  770. args: ["anObject"],
  771. source: "object: anObject\x0a\x09object := anObject",
  772. referencedClasses: [],
  773. //>>excludeEnd("ide");
  774. messageSends: []
  775. }),
  776. globals.NonBooleanReceiver);
  777. smalltalk.addClass('PackageCommitError', globals.Error, [], 'Kernel-Exceptions');
  778. //>>excludeStart("ide", pragmas.excludeIdeData);
  779. globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  780. //>>excludeEnd("ide");
  781. });