Kernel-Exceptions.deploy.js 13 KB

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