1
0

Helios-Debugger.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  1. smalltalk.addPackage('Helios-Debugger');
  2. smalltalk.addClass('HLContextInspectorDecorator', smalltalk.Object, ['context'], 'Helios-Debugger');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "context",
  6. category: 'accessing',
  7. fn: function (){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) {
  10. var $1;
  11. $1=self["@context"];
  12. return $1;
  13. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.HLContextInspectorDecorator)})},
  14. args: [],
  15. source: "context\x0a\x09^ context",
  16. messageSends: [],
  17. referencedClasses: []
  18. }),
  19. smalltalk.HLContextInspectorDecorator);
  20. smalltalk.addMethod(
  21. smalltalk.method({
  22. selector: "initializeFromContext:",
  23. category: 'initialization',
  24. fn: function (aContext){
  25. var self=this;
  26. return smalltalk.withContext(function($ctx1) {
  27. self["@context"]=aContext;
  28. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromContext:",{aContext:aContext},smalltalk.HLContextInspectorDecorator)})},
  29. args: ["aContext"],
  30. source: "initializeFromContext: aContext\x0a\x09context := aContext",
  31. messageSends: [],
  32. referencedClasses: []
  33. }),
  34. smalltalk.HLContextInspectorDecorator);
  35. smalltalk.addMethod(
  36. smalltalk.method({
  37. selector: "inspectOn:",
  38. category: 'inspecting',
  39. fn: function (anInspector){
  40. var self=this;
  41. var variables,inspectedContext;
  42. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  43. return smalltalk.withContext(function($ctx1) {
  44. var $1,$2,$3;
  45. variables=_st($Dictionary())._new();
  46. inspectedContext=_st(self)._context();
  47. _st(variables)._addAll_(_st(inspectedContext)._locals());
  48. _st((function(){
  49. return smalltalk.withContext(function($ctx2) {
  50. return _st(_st(inspectedContext)._notNil())._and_((function(){
  51. return smalltalk.withContext(function($ctx3) {
  52. return _st(inspectedContext)._isBlockContext();
  53. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  54. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. inspectedContext=_st(inspectedContext)._outerContext();
  57. inspectedContext;
  58. $1=inspectedContext;
  59. if(($receiver = $1) == nil || $receiver == undefined){
  60. return $1;
  61. } else {
  62. return _st(variables)._addAll_(_st(inspectedContext)._locals());
  63. };
  64. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  65. $2=anInspector;
  66. _st($2)._setLabel_("Context");
  67. $3=_st($2)._setVariables_(variables);
  68. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,inspectedContext:inspectedContext},smalltalk.HLContextInspectorDecorator)})},
  69. args: ["anInspector"],
  70. source: "inspectOn: anInspector\x0a\x09| variables inspectedContext |\x0a\x09\x0a\x09variables := Dictionary new.\x0a\x09inspectedContext := self context.\x0a\x09\x0a\x09variables addAll: inspectedContext locals.\x0a\x09\x0a\x09[ inspectedContext notNil and: [ inspectedContext isBlockContext ] ] whileTrue: [\x0a\x09\x09inspectedContext := inspectedContext outerContext.\x0a\x09\x09inspectedContext ifNotNil: [\x0a\x09\x09\x09variables addAll: inspectedContext locals ] ].\x0a\x09\x0a\x09anInspector\x0a\x09\x09setLabel: 'Context';\x0a\x09\x09setVariables: variables",
  71. messageSends: ["new", "context", "addAll:", "locals", "whileTrue:", "outerContext", "ifNotNil:", "and:", "isBlockContext", "notNil", "setLabel:", "setVariables:"],
  72. referencedClasses: ["Dictionary"]
  73. }),
  74. smalltalk.HLContextInspectorDecorator);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "on:",
  78. category: 'instance creation',
  79. fn: function (aContext){
  80. var self=this;
  81. return smalltalk.withContext(function($ctx1) {
  82. var $2,$3,$1;
  83. $2=_st(self)._new();
  84. _st($2)._initializeFromContext_(aContext);
  85. $3=_st($2)._yourself();
  86. $1=$3;
  87. return $1;
  88. }, function($ctx1) {$ctx1.fill(self,"on:",{aContext:aContext},smalltalk.HLContextInspectorDecorator.klass)})},
  89. args: ["aContext"],
  90. source: "on: aContext\x0a\x09^ self new\x0a\x09\x09initializeFromContext: aContext;\x0a\x09\x09yourself",
  91. messageSends: ["initializeFromContext:", "new", "yourself"],
  92. referencedClasses: []
  93. }),
  94. smalltalk.HLContextInspectorDecorator.klass);
  95. smalltalk.addClass('HLDebugger', smalltalk.HLFocusableWidget, ['model', 'stackListWidget', 'codeWidget', 'inspectorWidget'], 'Helios-Debugger');
  96. smalltalk.HLDebugger.comment="I am the main widget for the Helios debugger."
  97. smalltalk.addMethod(
  98. smalltalk.method({
  99. selector: "codeWidget",
  100. category: 'accessing',
  101. fn: function (){
  102. var self=this;
  103. function $HLDebuggerCodeWidget(){return smalltalk.HLDebuggerCodeWidget||(typeof HLDebuggerCodeWidget=="undefined"?nil:HLDebuggerCodeWidget)}
  104. return smalltalk.withContext(function($ctx1) {
  105. var $2,$3,$4,$1;
  106. $2=self["@codeWidget"];
  107. if(($receiver = $2) == nil || $receiver == undefined){
  108. $3=_st($HLDebuggerCodeWidget())._new();
  109. _st($3)._browserModel_(_st(self)._model());
  110. $4=_st($3)._yourself();
  111. self["@codeWidget"]=$4;
  112. $1=self["@codeWidget"];
  113. } else {
  114. $1=$2;
  115. };
  116. return $1;
  117. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{},smalltalk.HLDebugger)})},
  118. args: [],
  119. source: "codeWidget\x0a\x09^ codeWidget ifNil: [ codeWidget := HLDebuggerCodeWidget new\x0a\x09\x09browserModel: self model;\x0a\x09\x09yourself ]",
  120. messageSends: ["ifNil:", "browserModel:", "model", "new", "yourself"],
  121. referencedClasses: ["HLDebuggerCodeWidget"]
  122. }),
  123. smalltalk.HLDebugger);
  124. smalltalk.addMethod(
  125. smalltalk.method({
  126. selector: "focus",
  127. category: 'actions',
  128. fn: function (){
  129. var self=this;
  130. return smalltalk.withContext(function($ctx1) {
  131. _st(_st(self)._stackListWidget())._focus();
  132. return self}, function($ctx1) {$ctx1.fill(self,"focus",{},smalltalk.HLDebugger)})},
  133. args: [],
  134. source: "focus\x0a\x09self stackListWidget focus",
  135. messageSends: ["focus", "stackListWidget"],
  136. referencedClasses: []
  137. }),
  138. smalltalk.HLDebugger);
  139. smalltalk.addMethod(
  140. smalltalk.method({
  141. selector: "initializeFromMethodContext:",
  142. category: 'accessing',
  143. fn: function (aMethodContext){
  144. var self=this;
  145. function $HLDebuggerModel(){return smalltalk.HLDebuggerModel||(typeof HLDebuggerModel=="undefined"?nil:HLDebuggerModel)}
  146. return smalltalk.withContext(function($ctx1) {
  147. self["@model"]=_st($HLDebuggerModel())._on_(aMethodContext);
  148. _st(self)._observeModel();
  149. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.HLDebugger)})},
  150. args: ["aMethodContext"],
  151. source: "initializeFromMethodContext: aMethodContext\x0a\x09model := HLDebuggerModel on: aMethodContext.\x0a\x09self observeModel",
  152. messageSends: ["on:", "observeModel"],
  153. referencedClasses: ["HLDebuggerModel"]
  154. }),
  155. smalltalk.HLDebugger);
  156. smalltalk.addMethod(
  157. smalltalk.method({
  158. selector: "inspectorWidget",
  159. category: 'accessing',
  160. fn: function (){
  161. var self=this;
  162. function $HLInspectorWidget(){return smalltalk.HLInspectorWidget||(typeof HLInspectorWidget=="undefined"?nil:HLInspectorWidget)}
  163. return smalltalk.withContext(function($ctx1) {
  164. var $2,$1;
  165. $2=self["@inspectorWidget"];
  166. if(($receiver = $2) == nil || $receiver == undefined){
  167. self["@inspectorWidget"]=_st($HLInspectorWidget())._new();
  168. $1=self["@inspectorWidget"];
  169. } else {
  170. $1=$2;
  171. };
  172. return $1;
  173. }, function($ctx1) {$ctx1.fill(self,"inspectorWidget",{},smalltalk.HLDebugger)})},
  174. args: [],
  175. source: "inspectorWidget\x0a\x09^ inspectorWidget ifNil: [ \x0a\x09\x09inspectorWidget := HLInspectorWidget new ]",
  176. messageSends: ["ifNil:", "new"],
  177. referencedClasses: ["HLInspectorWidget"]
  178. }),
  179. smalltalk.HLDebugger);
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "model",
  183. category: 'accessing',
  184. fn: function (){
  185. var self=this;
  186. function $HLDebuggerModel(){return smalltalk.HLDebuggerModel||(typeof HLDebuggerModel=="undefined"?nil:HLDebuggerModel)}
  187. return smalltalk.withContext(function($ctx1) {
  188. var $2,$1;
  189. $2=self["@model"];
  190. if(($receiver = $2) == nil || $receiver == undefined){
  191. self["@model"]=_st($HLDebuggerModel())._new();
  192. $1=self["@model"];
  193. } else {
  194. $1=$2;
  195. };
  196. return $1;
  197. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.HLDebugger)})},
  198. args: [],
  199. source: "model\x0a\x09^ model ifNil: [ model := HLDebuggerModel new ]",
  200. messageSends: ["ifNil:", "new"],
  201. referencedClasses: ["HLDebuggerModel"]
  202. }),
  203. smalltalk.HLDebugger);
  204. smalltalk.addMethod(
  205. smalltalk.method({
  206. selector: "observeModel",
  207. category: 'actions',
  208. fn: function (){
  209. var self=this;
  210. function $HLDebuggerContextSelected(){return smalltalk.HLDebuggerContextSelected||(typeof HLDebuggerContextSelected=="undefined"?nil:HLDebuggerContextSelected)}
  211. return smalltalk.withContext(function($ctx1) {
  212. _st(_st(_st(self)._model())._announcer())._on_send_to_($HLDebuggerContextSelected(),"onContextSelected:",self);
  213. return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},smalltalk.HLDebugger)})},
  214. args: [],
  215. source: "observeModel\x0a\x09self model announcer \x0a\x09\x09on: HLDebuggerContextSelected\x0a\x09\x09send: #onContextSelected:\x0a\x09\x09to: self",
  216. messageSends: ["on:send:to:", "announcer", "model"],
  217. referencedClasses: ["HLDebuggerContextSelected"]
  218. }),
  219. smalltalk.HLDebugger);
  220. smalltalk.addMethod(
  221. smalltalk.method({
  222. selector: "onContextSelected:",
  223. category: 'reactions',
  224. fn: function (anAnnouncement){
  225. var self=this;
  226. function $HLContextInspectorDecorator(){return smalltalk.HLContextInspectorDecorator||(typeof HLContextInspectorDecorator=="undefined"?nil:HLContextInspectorDecorator)}
  227. return smalltalk.withContext(function($ctx1) {
  228. _st(_st(self)._inspectorWidget())._inspect_(_st($HLContextInspectorDecorator())._on_(_st(anAnnouncement)._context()));
  229. return self}, function($ctx1) {$ctx1.fill(self,"onContextSelected:",{anAnnouncement:anAnnouncement},smalltalk.HLDebugger)})},
  230. args: ["anAnnouncement"],
  231. source: "onContextSelected: anAnnouncement\x0a\x09self inspectorWidget inspect: (HLContextInspectorDecorator on: anAnnouncement context)",
  232. messageSends: ["inspect:", "on:", "context", "inspectorWidget"],
  233. referencedClasses: ["HLContextInspectorDecorator"]
  234. }),
  235. smalltalk.HLDebugger);
  236. smalltalk.addMethod(
  237. smalltalk.method({
  238. selector: "open",
  239. category: 'rendering',
  240. fn: function (){
  241. var self=this;
  242. function $HLTab(){return smalltalk.HLTab||(typeof HLTab=="undefined"?nil:HLTab)}
  243. function $HLManager(){return smalltalk.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
  244. return smalltalk.withContext(function($ctx1) {
  245. _st(_st($HLManager())._current())._addTab_(_st($HLTab())._on_labelled_(self,_st(_st(self)._class())._tabLabel()));
  246. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.HLDebugger)})},
  247. args: [],
  248. source: "open\x0a\x09HLManager current addTab: (HLTab on: self labelled: self class tabLabel)",
  249. messageSends: ["addTab:", "on:labelled:", "tabLabel", "class", "current"],
  250. referencedClasses: ["HLTab", "HLManager"]
  251. }),
  252. smalltalk.HLDebugger);
  253. smalltalk.addMethod(
  254. smalltalk.method({
  255. selector: "renderContentOn:",
  256. category: 'rendering',
  257. fn: function (html){
  258. var self=this;
  259. function $HLVerticalSplitter(){return smalltalk.HLVerticalSplitter||(typeof HLVerticalSplitter=="undefined"?nil:HLVerticalSplitter)}
  260. function $HLHorizontalSplitter(){return smalltalk.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
  261. function $HLContainer(){return smalltalk.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
  262. return smalltalk.withContext(function($ctx1) {
  263. _st(html)._with_(_st($HLContainer())._with_(_st($HLHorizontalSplitter())._with_with_(_st(self)._stackListWidget(),_st($HLVerticalSplitter())._with_with_(_st(self)._codeWidget(),_st(self)._inspectorWidget()))));
  264. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLDebugger)})},
  265. args: ["html"],
  266. source: "renderContentOn: html\x0a\x09html with: (HLContainer with: (HLHorizontalSplitter\x0a\x09\x09with: self stackListWidget\x0a\x09\x09with: (HLVerticalSplitter\x0a\x09\x09\x09with: self codeWidget\x0a\x09\x09\x09with: self inspectorWidget)))",
  267. messageSends: ["with:", "with:with:", "stackListWidget", "codeWidget", "inspectorWidget"],
  268. referencedClasses: ["HLVerticalSplitter", "HLHorizontalSplitter", "HLContainer"]
  269. }),
  270. smalltalk.HLDebugger);
  271. smalltalk.addMethod(
  272. smalltalk.method({
  273. selector: "stackListWidget",
  274. category: 'accessing',
  275. fn: function (){
  276. var self=this;
  277. function $HLStackListWidget(){return smalltalk.HLStackListWidget||(typeof HLStackListWidget=="undefined"?nil:HLStackListWidget)}
  278. return smalltalk.withContext(function($ctx1) {
  279. var $2,$3,$4,$1;
  280. $2=self["@stackListWidget"];
  281. if(($receiver = $2) == nil || $receiver == undefined){
  282. $3=_st($HLStackListWidget())._on_(_st(self)._model());
  283. _st($3)._next_(_st(self)._codeWidget());
  284. $4=_st($3)._yourself();
  285. self["@stackListWidget"]=$4;
  286. $1=self["@stackListWidget"];
  287. } else {
  288. $1=$2;
  289. };
  290. return $1;
  291. }, function($ctx1) {$ctx1.fill(self,"stackListWidget",{},smalltalk.HLDebugger)})},
  292. args: [],
  293. source: "stackListWidget\x0a\x09^ stackListWidget ifNil: [ \x0a\x09\x09stackListWidget := (HLStackListWidget on: self model)\x0a\x09\x09\x09next: self codeWidget;\x0a\x09\x09\x09yourself ]",
  294. messageSends: ["ifNil:", "next:", "codeWidget", "on:", "model", "yourself"],
  295. referencedClasses: ["HLStackListWidget"]
  296. }),
  297. smalltalk.HLDebugger);
  298. smalltalk.addMethod(
  299. smalltalk.method({
  300. selector: "on:",
  301. category: 'instance creation',
  302. fn: function (aMethodContext){
  303. var self=this;
  304. return smalltalk.withContext(function($ctx1) {
  305. var $2,$3,$1;
  306. $2=_st(self)._new();
  307. _st($2)._initializeFromMethodContext_(aMethodContext);
  308. $3=_st($2)._yourself();
  309. $1=$3;
  310. return $1;
  311. }, function($ctx1) {$ctx1.fill(self,"on:",{aMethodContext:aMethodContext},smalltalk.HLDebugger.klass)})},
  312. args: ["aMethodContext"],
  313. source: "on: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  314. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  315. referencedClasses: []
  316. }),
  317. smalltalk.HLDebugger.klass);
  318. smalltalk.addMethod(
  319. smalltalk.method({
  320. selector: "tabClass",
  321. category: 'accessing',
  322. fn: function (){
  323. var self=this;
  324. return smalltalk.withContext(function($ctx1) {
  325. return "debugger";
  326. }, function($ctx1) {$ctx1.fill(self,"tabClass",{},smalltalk.HLDebugger.klass)})},
  327. args: [],
  328. source: "tabClass\x0a\x09^ 'debugger'",
  329. messageSends: [],
  330. referencedClasses: []
  331. }),
  332. smalltalk.HLDebugger.klass);
  333. smalltalk.addMethod(
  334. smalltalk.method({
  335. selector: "tabLabel",
  336. category: 'accessing',
  337. fn: function (){
  338. var self=this;
  339. return smalltalk.withContext(function($ctx1) {
  340. return "Debugger";
  341. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{},smalltalk.HLDebugger.klass)})},
  342. args: [],
  343. source: "tabLabel\x0a\x09^ 'Debugger'",
  344. messageSends: [],
  345. referencedClasses: []
  346. }),
  347. smalltalk.HLDebugger.klass);
  348. smalltalk.addClass('HLDebuggerCodeWidget', smalltalk.HLBrowserCodeWidget, ['highlightedNode'], 'Helios-Debugger');
  349. smalltalk.addMethod(
  350. smalltalk.method({
  351. selector: "addStopAt:",
  352. category: 'actions',
  353. fn: function (anInteger){
  354. var self=this;
  355. return smalltalk.withContext(function($ctx1) {
  356. _st(self["@editor"])._setGutterMarker_gutter_value_(anInteger,"stops",_st(_st(_st("<div class=\x22stop\x22></stop>")._asJQuery())._toArray())._first());
  357. return self}, function($ctx1) {$ctx1.fill(self,"addStopAt:",{anInteger:anInteger},smalltalk.HLDebuggerCodeWidget)})},
  358. args: ["anInteger"],
  359. source: "addStopAt: anInteger\x0a\x09editor\x0a\x09\x09setGutterMarker: anInteger\x0a\x09\x09gutter: 'stops'\x0a\x09\x09value: '<div class=\x22stop\x22></stop>' asJQuery toArray first",
  360. messageSends: ["setGutterMarker:gutter:value:", "first", "toArray", "asJQuery"],
  361. referencedClasses: []
  362. }),
  363. smalltalk.HLDebuggerCodeWidget);
  364. smalltalk.addMethod(
  365. smalltalk.method({
  366. selector: "clearHighlight",
  367. category: 'actions',
  368. fn: function (){
  369. var self=this;
  370. return smalltalk.withContext(function($ctx1) {
  371. var $1;
  372. _st(self["@editor"])._clearGutter_("stops");
  373. $1=_st(self)._highlightedNode();
  374. if(($receiver = $1) == nil || $receiver == undefined){
  375. $1;
  376. } else {
  377. var node;
  378. node=$receiver;
  379. _st(self["@editor"])._removeLineClass_where_class_(_st(_st(_st(node)._position())._x()).__minus((1)),"background","highlighted");
  380. };
  381. return self}, function($ctx1) {$ctx1.fill(self,"clearHighlight",{},smalltalk.HLDebuggerCodeWidget)})},
  382. args: [],
  383. source: "clearHighlight\x0a\x09editor clearGutter: 'stops'.\x0a\x09self highlightedNode ifNotNil: [ :node |\x0a\x09\x09editor \x0a\x09\x09\x09removeLineClass: node position x - 1\x0a\x09\x09\x09where: 'background'\x0a\x09\x09\x09class: 'highlighted' ]",
  384. messageSends: ["clearGutter:", "ifNotNil:", "removeLineClass:where:class:", "-", "x", "position", "highlightedNode"],
  385. referencedClasses: []
  386. }),
  387. smalltalk.HLDebuggerCodeWidget);
  388. smalltalk.addMethod(
  389. smalltalk.method({
  390. selector: "contents:",
  391. category: 'accessing',
  392. fn: function (aString){
  393. var self=this;
  394. return smalltalk.withContext(function($ctx1) {
  395. _st(self)._clearHighlight();
  396. smalltalk.HLBrowserCodeWidget.fn.prototype._contents_.apply(_st(self), [aString]);
  397. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},smalltalk.HLDebuggerCodeWidget)})},
  398. args: ["aString"],
  399. source: "contents: aString\x0a\x09self clearHighlight.\x0a\x09super contents: aString",
  400. messageSends: ["clearHighlight", "contents:"],
  401. referencedClasses: []
  402. }),
  403. smalltalk.HLDebuggerCodeWidget);
  404. smalltalk.addMethod(
  405. smalltalk.method({
  406. selector: "editorOptions",
  407. category: 'accessing',
  408. fn: function (){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) {
  411. var $2,$3,$1;
  412. $2=smalltalk.HLBrowserCodeWidget.fn.prototype._editorOptions.apply(_st(self), []);
  413. _st($2)._at_put_("gutters",["CodeMirror-linenumbers", "stops"]);
  414. $3=_st($2)._yourself();
  415. $1=$3;
  416. return $1;
  417. }, function($ctx1) {$ctx1.fill(self,"editorOptions",{},smalltalk.HLDebuggerCodeWidget)})},
  418. args: [],
  419. source: "editorOptions\x0a\x09^ super editorOptions\x0a\x09\x09at: 'gutters' put: #('CodeMirror-linenumbers' 'stops');\x0a\x09\x09yourself",
  420. messageSends: ["at:put:", "editorOptions", "yourself"],
  421. referencedClasses: []
  422. }),
  423. smalltalk.HLDebuggerCodeWidget);
  424. smalltalk.addMethod(
  425. smalltalk.method({
  426. selector: "highlight",
  427. category: 'actions',
  428. fn: function (){
  429. var self=this;
  430. var anchor,head,selection;
  431. return smalltalk.withContext(function($ctx1) {
  432. head=smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(_st(_st(_st(_st(self)._highlightedNode())._position())._x()).__minus((1))),_st("ch").__minus_gt(_st(_st(_st(_st(self)._highlightedNode())._position())._y()).__minus((1)))]);
  433. anchor=smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(_st(_st(_st(_st(self)._highlightedNode())._extent())._x()).__minus((1))),_st("ch").__minus_gt(_st(_st(_st(_st(self)._highlightedNode())._extent())._y()).__minus((1)))]);
  434. _st(self["@editor"])._setSelection_to_(head,anchor);
  435. return self}, function($ctx1) {$ctx1.fill(self,"highlight",{anchor:anchor,head:head,selection:selection},smalltalk.HLDebuggerCodeWidget)})},
  436. args: [],
  437. source: "highlight\x0a\x09| anchor head selection |\x0a\x09\x0a\x09head := #{\x0a\x09\x09'line' -> (self highlightedNode position x - 1).\x0a\x09\x09'ch' -> (self highlightedNode position y - 1)\x0a\x09}.\x0a\x09\x0a\x09anchor := #{\x0a\x09\x09'line' -> (self highlightedNode extent x - 1).\x0a\x09\x09'ch' -> (self highlightedNode extent y - 1)\x0a\x09}.\x0a\x09\x0a\x09editor setSelection: head to: anchor",
  438. messageSends: ["->", "-", "x", "position", "highlightedNode", "y", "extent", "setSelection:to:"],
  439. referencedClasses: []
  440. }),
  441. smalltalk.HLDebuggerCodeWidget);
  442. smalltalk.addMethod(
  443. smalltalk.method({
  444. selector: "highlightLine:",
  445. category: 'actions',
  446. fn: function (anInteger){
  447. var self=this;
  448. return smalltalk.withContext(function($ctx1) {
  449. _st(self["@editor"])._addLineClass_where_class_(anInteger,"background","highlighted");
  450. return self}, function($ctx1) {$ctx1.fill(self,"highlightLine:",{anInteger:anInteger},smalltalk.HLDebuggerCodeWidget)})},
  451. args: ["anInteger"],
  452. source: "highlightLine: anInteger\x0a\x09editor \x0a\x09\x09addLineClass: anInteger\x0a\x09\x09where: 'background'\x0a\x09\x09class: 'highlighted'",
  453. messageSends: ["addLineClass:where:class:"],
  454. referencedClasses: []
  455. }),
  456. smalltalk.HLDebuggerCodeWidget);
  457. smalltalk.addMethod(
  458. smalltalk.method({
  459. selector: "highlightNode:",
  460. category: 'actions',
  461. fn: function (aNode){
  462. var self=this;
  463. var line;
  464. return smalltalk.withContext(function($ctx1) {
  465. var $1,$2,$3;
  466. $1=aNode;
  467. if(($receiver = $1) == nil || $receiver == undefined){
  468. $1;
  469. } else {
  470. line=_st(_st(_st(aNode)._position())._x()).__minus((1));
  471. line;
  472. $2=self;
  473. _st($2)._clearHighlight();
  474. _st($2)._addStopAt_(line);
  475. _st($2)._highlightLine_(line);
  476. $3=_st($2)._highlightedNode_(aNode);
  477. $3;
  478. };
  479. return self}, function($ctx1) {$ctx1.fill(self,"highlightNode:",{aNode:aNode,line:line},smalltalk.HLDebuggerCodeWidget)})},
  480. args: ["aNode"],
  481. source: "highlightNode: aNode\x0a\x09| line |\x0a\x09aNode ifNotNil: [\x0a\x09\x09line := aNode position x - 1.\x0a\x09\x09self \x0a\x09\x09\x09clearHighlight; \x0a\x09\x09\x09addStopAt: line;\x0a\x09\x09\x09highlightLine: line;\x0a\x09\x09\x09highlightedNode: aNode\x0a\x09\x09]",
  482. messageSends: ["ifNotNil:", "-", "x", "position", "clearHighlight", "addStopAt:", "highlightLine:", "highlightedNode:"],
  483. referencedClasses: []
  484. }),
  485. smalltalk.HLDebuggerCodeWidget);
  486. smalltalk.addMethod(
  487. smalltalk.method({
  488. selector: "highlightedNode",
  489. category: 'accessing',
  490. fn: function (){
  491. var self=this;
  492. return smalltalk.withContext(function($ctx1) {
  493. var $1;
  494. $1=self["@highlightedNode"];
  495. return $1;
  496. }, function($ctx1) {$ctx1.fill(self,"highlightedNode",{},smalltalk.HLDebuggerCodeWidget)})},
  497. args: [],
  498. source: "highlightedNode\x0a\x09^ highlightedNode",
  499. messageSends: [],
  500. referencedClasses: []
  501. }),
  502. smalltalk.HLDebuggerCodeWidget);
  503. smalltalk.addMethod(
  504. smalltalk.method({
  505. selector: "highlightedNode:",
  506. category: 'accessing',
  507. fn: function (aNode){
  508. var self=this;
  509. return smalltalk.withContext(function($ctx1) {
  510. self["@highlightedNode"]=aNode;
  511. return self}, function($ctx1) {$ctx1.fill(self,"highlightedNode:",{aNode:aNode},smalltalk.HLDebuggerCodeWidget)})},
  512. args: ["aNode"],
  513. source: "highlightedNode: aNode\x0a\x09highlightedNode := aNode",
  514. messageSends: [],
  515. referencedClasses: []
  516. }),
  517. smalltalk.HLDebuggerCodeWidget);
  518. smalltalk.addMethod(
  519. smalltalk.method({
  520. selector: "observeBrowserModel",
  521. category: 'actions',
  522. fn: function (){
  523. var self=this;
  524. function $HLDebuggerContextSelected(){return smalltalk.HLDebuggerContextSelected||(typeof HLDebuggerContextSelected=="undefined"?nil:HLDebuggerContextSelected)}
  525. return smalltalk.withContext(function($ctx1) {
  526. smalltalk.HLBrowserCodeWidget.fn.prototype._observeBrowserModel.apply(_st(self), []);
  527. _st(_st(_st(self)._browserModel())._announcer())._on_send_to_($HLDebuggerContextSelected(),"onContextSelected",self);
  528. return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{},smalltalk.HLDebuggerCodeWidget)})},
  529. args: [],
  530. source: "observeBrowserModel\x0a\x09super observeBrowserModel.\x0a\x09\x0a\x09self browserModel announcer \x0a\x09\x09on: HLDebuggerContextSelected\x0a\x09\x09send: #onContextSelected\x0a\x09\x09to: self",
  531. messageSends: ["observeBrowserModel", "on:send:to:", "announcer", "browserModel"],
  532. referencedClasses: ["HLDebuggerContextSelected"]
  533. }),
  534. smalltalk.HLDebuggerCodeWidget);
  535. smalltalk.addMethod(
  536. smalltalk.method({
  537. selector: "onContextSelected",
  538. category: 'reactions',
  539. fn: function (){
  540. var self=this;
  541. return smalltalk.withContext(function($ctx1) {
  542. _st(self)._highlightNode_(_st(_st(self)._browserModel())._nextNode());
  543. return self}, function($ctx1) {$ctx1.fill(self,"onContextSelected",{},smalltalk.HLDebuggerCodeWidget)})},
  544. args: [],
  545. source: "onContextSelected\x0a\x09self highlightNode: self browserModel nextNode",
  546. messageSends: ["highlightNode:", "nextNode", "browserModel"],
  547. referencedClasses: []
  548. }),
  549. smalltalk.HLDebuggerCodeWidget);
  550. smalltalk.addClass('HLDebuggerModel', smalltalk.HLToolModel, ['rootContext', 'currentContext', 'contexts', 'interpreter'], 'Helios-Debugger');
  551. smalltalk.HLDebuggerModel.comment="I am a model for Helios debugging.\x0a\x0aMy instances hold a reference to an `AIContext` instance, built from a `MethodContext`. The context should be the root of the context stack."
  552. smalltalk.addMethod(
  553. smalltalk.method({
  554. selector: "contexts",
  555. category: 'accessing',
  556. fn: function (){
  557. var self=this;
  558. return smalltalk.withContext(function($ctx1) {
  559. var $1;
  560. $1=self["@contexts"];
  561. return $1;
  562. }, function($ctx1) {$ctx1.fill(self,"contexts",{},smalltalk.HLDebuggerModel)})},
  563. args: [],
  564. source: "contexts\x0a\x09^ contexts",
  565. messageSends: [],
  566. referencedClasses: []
  567. }),
  568. smalltalk.HLDebuggerModel);
  569. smalltalk.addMethod(
  570. smalltalk.method({
  571. selector: "currentContext",
  572. category: 'accessing',
  573. fn: function (){
  574. var self=this;
  575. return smalltalk.withContext(function($ctx1) {
  576. var $1,$2;
  577. $1=self["@currentContext"];
  578. if(($receiver = $1) == nil || $receiver == undefined){
  579. _st(self)._currentContext_(_st(self)._rootContext());
  580. } else {
  581. $1;
  582. };
  583. $2=self["@currentContext"];
  584. return $2;
  585. }, function($ctx1) {$ctx1.fill(self,"currentContext",{},smalltalk.HLDebuggerModel)})},
  586. args: [],
  587. source: "currentContext\x0a\x09currentContext ifNil: [ self currentContext: self rootContext ].\x0a\x09^ currentContext",
  588. messageSends: ["ifNil:", "currentContext:", "rootContext"],
  589. referencedClasses: []
  590. }),
  591. smalltalk.HLDebuggerModel);
  592. smalltalk.addMethod(
  593. smalltalk.method({
  594. selector: "currentContext:",
  595. category: 'accessing',
  596. fn: function (aContext){
  597. var self=this;
  598. function $ASTDebugger(){return smalltalk.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  599. function $HLDebuggerContextSelected(){return smalltalk.HLDebuggerContextSelected||(typeof HLDebuggerContextSelected=="undefined"?nil:HLDebuggerContextSelected)}
  600. return smalltalk.withContext(function($ctx1) {
  601. var $1,$2;
  602. _st(self)._withChangesDo_((function(){
  603. return smalltalk.withContext(function($ctx2) {
  604. _st(self)._selectedMethod_(_st(aContext)._method());
  605. self["@currentContext"]=aContext;
  606. self["@currentContext"];
  607. self["@interpreter"]=_st($ASTDebugger())._context_(aContext);
  608. self["@interpreter"];
  609. $1=_st($HLDebuggerContextSelected())._new();
  610. _st($1)._context_(aContext);
  611. $2=_st($1)._yourself();
  612. return _st(_st(self)._announcer())._announce_($2);
  613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  614. return self}, function($ctx1) {$ctx1.fill(self,"currentContext:",{aContext:aContext},smalltalk.HLDebuggerModel)})},
  615. args: ["aContext"],
  616. source: "currentContext: aContext\x0a\x09self withChangesDo: [ \x0a\x09\x09self selectedMethod: aContext method.\x0a\x09\x09currentContext := aContext.\x0a\x09\x09interpreter := ASTDebugger context: aContext.\x0a\x09\x09self announcer announce: (HLDebuggerContextSelected new\x0a\x09\x09\x09context: aContext;\x0a\x09\x09\x09yourself) ]",
  617. messageSends: ["withChangesDo:", "selectedMethod:", "method", "context:", "announce:", "new", "yourself", "announcer"],
  618. referencedClasses: ["ASTDebugger", "HLDebuggerContextSelected"]
  619. }),
  620. smalltalk.HLDebuggerModel);
  621. smalltalk.addMethod(
  622. smalltalk.method({
  623. selector: "initializeContexts",
  624. category: 'initialization',
  625. fn: function (){
  626. var self=this;
  627. var context;
  628. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  629. return smalltalk.withContext(function($ctx1) {
  630. self["@contexts"]=_st($OrderedCollection())._new();
  631. context=_st(self)._rootContext();
  632. _st((function(){
  633. return smalltalk.withContext(function($ctx2) {
  634. return _st(context)._notNil();
  635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  636. return smalltalk.withContext(function($ctx2) {
  637. _st(self["@contexts"])._add_(context);
  638. context=_st(context)._outerContext();
  639. return context;
  640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  641. return self}, function($ctx1) {$ctx1.fill(self,"initializeContexts",{context:context},smalltalk.HLDebuggerModel)})},
  642. args: [],
  643. source: "initializeContexts\x0a\x09\x22Flatten the context stack into an OrderedCollection\x22\x0a\x09\x0a\x09| context |\x0a\x09\x0a\x09contexts := OrderedCollection new.\x0a\x09context := self rootContext.\x0a\x09\x0a\x09[ context notNil ] whileTrue: [\x0a\x09\x09contexts add: context.\x0a\x09\x09context := context outerContext ]",
  644. messageSends: ["new", "rootContext", "whileTrue:", "add:", "outerContext", "notNil"],
  645. referencedClasses: ["OrderedCollection"]
  646. }),
  647. smalltalk.HLDebuggerModel);
  648. smalltalk.addMethod(
  649. smalltalk.method({
  650. selector: "initializeFromContext:",
  651. category: 'initialization',
  652. fn: function (aMethodContext){
  653. var self=this;
  654. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  655. return smalltalk.withContext(function($ctx1) {
  656. self["@rootContext"]=_st($AIContext())._fromMethodContext_(aMethodContext);
  657. _st(self)._initializeContexts();
  658. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromContext:",{aMethodContext:aMethodContext},smalltalk.HLDebuggerModel)})},
  659. args: ["aMethodContext"],
  660. source: "initializeFromContext: aMethodContext\x0a\x09rootContext := AIContext fromMethodContext: aMethodContext.\x0a\x09self initializeContexts",
  661. messageSends: ["fromMethodContext:", "initializeContexts"],
  662. referencedClasses: ["AIContext"]
  663. }),
  664. smalltalk.HLDebuggerModel);
  665. smalltalk.addMethod(
  666. smalltalk.method({
  667. selector: "interpreter",
  668. category: 'accessing',
  669. fn: function (){
  670. var self=this;
  671. return smalltalk.withContext(function($ctx1) {
  672. var $1;
  673. $1=self["@interpreter"];
  674. return $1;
  675. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.HLDebuggerModel)})},
  676. args: [],
  677. source: "interpreter\x0a\x09^ interpreter",
  678. messageSends: [],
  679. referencedClasses: []
  680. }),
  681. smalltalk.HLDebuggerModel);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "nextNode",
  685. category: 'accessing',
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. var $1;
  690. $1=_st(_st(self)._interpreter())._nextNode();
  691. return $1;
  692. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.HLDebuggerModel)})},
  693. args: [],
  694. source: "nextNode\x0a\x09^ self interpreter nextNode",
  695. messageSends: ["nextNode", "interpreter"],
  696. referencedClasses: []
  697. }),
  698. smalltalk.HLDebuggerModel);
  699. smalltalk.addMethod(
  700. smalltalk.method({
  701. selector: "rootContext",
  702. category: 'accessing',
  703. fn: function (){
  704. var self=this;
  705. return smalltalk.withContext(function($ctx1) {
  706. var $1;
  707. $1=self["@rootContext"];
  708. return $1;
  709. }, function($ctx1) {$ctx1.fill(self,"rootContext",{},smalltalk.HLDebuggerModel)})},
  710. args: [],
  711. source: "rootContext\x0a\x09^ rootContext",
  712. messageSends: [],
  713. referencedClasses: []
  714. }),
  715. smalltalk.HLDebuggerModel);
  716. smalltalk.addMethod(
  717. smalltalk.method({
  718. selector: "on:",
  719. category: 'instance creation',
  720. fn: function (aMethodContext){
  721. var self=this;
  722. return smalltalk.withContext(function($ctx1) {
  723. var $2,$3,$1;
  724. $2=_st(self)._new();
  725. _st($2)._initializeFromContext_(aMethodContext);
  726. $3=_st($2)._yourself();
  727. $1=$3;
  728. return $1;
  729. }, function($ctx1) {$ctx1.fill(self,"on:",{aMethodContext:aMethodContext},smalltalk.HLDebuggerModel.klass)})},
  730. args: ["aMethodContext"],
  731. source: "on: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromContext: aMethodContext;\x0a\x09\x09yourself",
  732. messageSends: ["initializeFromContext:", "new", "yourself"],
  733. referencedClasses: []
  734. }),
  735. smalltalk.HLDebuggerModel.klass);
  736. smalltalk.addClass('HLErrorHandler', smalltalk.ErrorHandler, [], 'Helios-Debugger');
  737. smalltalk.addMethod(
  738. smalltalk.method({
  739. selector: "handleError:",
  740. category: 'error handling',
  741. fn: function (anError){
  742. var self=this;
  743. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  744. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  745. function $HLDebugger(){return smalltalk.HLDebugger||(typeof HLDebugger=="undefined"?nil:HLDebugger)}
  746. return smalltalk.withContext(function($ctx1) {
  747. _st((function(){
  748. return smalltalk.withContext(function($ctx2) {
  749. return _st(_st($HLDebugger())._on_(_st(anError)._context()))._open();
  750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(error){
  751. return smalltalk.withContext(function($ctx2) {
  752. return _st(_st($ErrorHandler())._new())._handleError_(error);
  753. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  754. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.HLErrorHandler)})},
  755. args: ["anError"],
  756. source: "handleError: anError\x0a\x09[ (HLDebugger on: anError context)\x0a\x09\x09open ] on: Error do: [ :error |\x0a\x09\x09\x09ErrorHandler new handleError: error ]",
  757. messageSends: ["on:do:", "handleError:", "new", "open", "on:", "context"],
  758. referencedClasses: ["Error", "ErrorHandler", "HLDebugger"]
  759. }),
  760. smalltalk.HLErrorHandler);
  761. smalltalk.addClass('HLStackListWidget', smalltalk.HLToolListWidget, [], 'Helios-Debugger');
  762. smalltalk.addMethod(
  763. smalltalk.method({
  764. selector: "items",
  765. category: 'accessing',
  766. fn: function (){
  767. var self=this;
  768. return smalltalk.withContext(function($ctx1) {
  769. var $2,$1;
  770. $2=self["@items"];
  771. if(($receiver = $2) == nil || $receiver == undefined){
  772. self["@items"]=_st(_st(self)._model())._contexts();
  773. $1=self["@items"];
  774. } else {
  775. $1=$2;
  776. };
  777. return $1;
  778. }, function($ctx1) {$ctx1.fill(self,"items",{},smalltalk.HLStackListWidget)})},
  779. args: [],
  780. source: "items\x0a\x09^ items ifNil: [ items := self model contexts ]",
  781. messageSends: ["ifNil:", "contexts", "model"],
  782. referencedClasses: []
  783. }),
  784. smalltalk.HLStackListWidget);
  785. smalltalk.addMethod(
  786. smalltalk.method({
  787. selector: "label",
  788. category: 'accessing',
  789. fn: function (){
  790. var self=this;
  791. return smalltalk.withContext(function($ctx1) {
  792. return "Call stack";
  793. }, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.HLStackListWidget)})},
  794. args: [],
  795. source: "label\x0a\x09^ 'Call stack'",
  796. messageSends: [],
  797. referencedClasses: []
  798. }),
  799. smalltalk.HLStackListWidget);
  800. smalltalk.addMethod(
  801. smalltalk.method({
  802. selector: "selectItem:",
  803. category: 'actions',
  804. fn: function (aContext){
  805. var self=this;
  806. return smalltalk.withContext(function($ctx1) {
  807. _st(_st(self)._model())._currentContext_(aContext);
  808. return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aContext:aContext},smalltalk.HLStackListWidget)})},
  809. args: ["aContext"],
  810. source: "selectItem: aContext\x0a \x09self model currentContext: aContext",
  811. messageSends: ["currentContext:", "model"],
  812. referencedClasses: []
  813. }),
  814. smalltalk.HLStackListWidget);