The Inbox: Tools-fbs.440.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tools-fbs.440.mcz

commits-2
Frank Shearar uploaded a new version of Tools to project The Inbox:
http://source.squeak.org/inbox/Tools-fbs.440.mcz

==================== Summary ====================

Name: Tools-fbs.440
Author: fbs
Time: 27 January 2013, 11:25:15.292 am
UUID: c8008aef-df70-41d0-bc30-4400e38412c5
Ancestors: Tools-bf.439

#subclassResponsibility in-Debugger method creation #3 of 4: given a SubclassResponsibilityError, create a stub method for the user to implement (and automatically categorise it correctly).

=============== Diff against Tools-bf.439 ===============

Item was changed:
  ----- Method: Debugger>>buildNotifierWith:label:message: (in category 'toolbuilder') -----
  buildNotifierWith: builder label: label message: messageString
  | windowSpec listSpec textSpec panelSpec quads |
  windowSpec := builder pluggableWindowSpec new.
  windowSpec model: self.
  windowSpec extent: 450 @ 156. "nice and wide to show plenty of the error msg"
  windowSpec label: label.
  windowSpec children: OrderedCollection new.
 
  panelSpec := builder pluggablePanelSpec new.
  panelSpec children: OrderedCollection new.
  quads := self preDebugButtonQuads.
  (self interruptedContext selector == #doesNotUnderstand:) ifTrue: [
  quads := quads copyWith:
  { 'Create'. #createMethod. #magenta. 'create the missing method' }
  ].
+ (self interruptedContext selector == #subclassResponsibility) ifTrue: [
+ quads := quads copyWith:
+ { 'Create'. #createOverridingMethod. #magenta. 'create the missing overriding method' }
+ ].
  quads do:[:spec| | buttonSpec |
  buttonSpec := builder pluggableButtonSpec new.
  buttonSpec model: self.
  buttonSpec label: spec first.
  buttonSpec action: spec second.
  buttonSpec help: spec fourth.
  buttonSpec frame: self preDebugButtonQuadFrame.
  panelSpec children add: buttonSpec.
  ].
  panelSpec layout: #horizontal. "buttons"
  panelSpec frame: self preDebugButtonQuadFrame.
  windowSpec children add: panelSpec.
 
  Preferences eToyFriendly | messageString notNil ifFalse:[
  listSpec := builder pluggableListSpec new.
  listSpec
  model: self;
  list: #contextStackList;
  getIndex: #contextStackIndex;
  setIndex: #debugAt:;
  frame: self contextStackFrame.
  windowSpec children add: listSpec.
  ] ifTrue:[
  message := messageString.
  textSpec := builder pluggableTextSpec new.
  textSpec
  model: self;
  getText: #preDebugMessageString;
  setText: nil;
  selection: nil;
  menu: #debugProceedMenu:;
  frame: self contextStackFrame.
  windowSpec children add: textSpec.
  ].
 
  ^windowSpec!

Item was added:
+ ----- Method: Debugger>>createOverridingMethod (in category 'private') -----
+ createOverridingMethod
+ "Should only be called when this Debugger was created in response to a
+ SubclassResponsibility exception. Create a stub for the method that was
+ missing and proceed into it."
+ | err msg |
+ err := self contextStackTop tempAt: 1.
+ msg := Message selector: err selector arguments: err calledArguments.
+ self implement: msg inClass: err offendingClass inCategory: err selectorCategory.!

Item was changed:
  ----- Method: Debugger>>implement:inClass: (in category 'context stack menu') -----
  implement: aMessage inClass: aClass
+ ^ self
+ implement: aMessage
+ inClass: aClass
+ inCategory: (self askForCategoryIn: aClass default: 'as yet unclassified').!
-
- aClass
- compile: aMessage createStubMethod
- classified: (self askForCategoryIn: aClass default: 'as yet unclassified').
- self setContentsToForceRefetch.
- self selectedContext privRefreshWith: (aClass lookupSelector: aMessage selector).
- self selectedContext method numArgs > 0 ifTrue:
- [(self selectedContext tempAt: 1) arguments withIndexDo:
- [:arg :index|
- self selectedContext tempAt: index put: arg]].
- self resetContext: self selectedContext.
- self debug.
- !

Item was added:
+ ----- Method: Debugger>>implement:inClass:inCategory: (in category 'context stack menu') -----
+ implement: aMessage inClass: aClass inCategory: aSymbol
+
+ aClass
+ compile: aMessage createStubMethod
+ classified: aSymbol.
+ self setContentsToForceRefetch.
+ self selectedContext privRefreshWith: (aClass lookupSelector: aMessage selector).
+ self selectedContext method numArgs > 0 ifTrue:
+ [(self selectedContext tempAt: 1) arguments withIndexDo:
+ [:arg :index|
+ self selectedContext tempAt: index put: arg]].
+ self resetContext: self selectedContext.
+ self debug.
+ !


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-fbs.440.mcz

Frank Shearar-3
On 27 January 2013 11:25,  <[hidden email]> wrote:

> Frank Shearar uploaded a new version of Tools to project The Inbox:
> http://source.squeak.org/inbox/Tools-fbs.440.mcz
>
> ==================== Summary ====================
>
> Name: Tools-fbs.440
> Author: fbs
> Time: 27 January 2013, 11:25:15.292 am
> UUID: c8008aef-df70-41d0-bc30-4400e38412c5
> Ancestors: Tools-bf.439
>
> #subclassResponsibility in-Debugger method creation #3 of 4: given a SubclassResponsibilityError, create a stub method for the user to implement (and automatically categorise it correctly).
>
> =============== Diff against Tools-bf.439 ===============
<snip>

> Item was added:
> + ----- Method: Debugger>>implement:inClass:inCategory: (in category 'context stack menu') -----
> + implement: aMessage inClass: aClass inCategory: aSymbol
> +
> +       aClass
> +               compile: aMessage createStubMethod
> +               classified: aSymbol.
> +       self setContentsToForceRefetch.
> +       self selectedContext privRefreshWith: (aClass lookupSelector: aMessage selector).
> +       self selectedContext method numArgs > 0 ifTrue:
> +               [(self selectedContext tempAt: 1) arguments withIndexDo:
> +                       [:arg :index|
> +                       self selectedContext tempAt: index put: arg]].
> +       self resetContext: self selectedContext.
> +       self debug.
> + !

I discovered a bug when handling selectors with numArgs > 0 - (self
selectedContext tempAt: 1) arguments fails. I'll figure it out and
resubmit.

frank