[squeak-dev] The Trunk: System-eem.708.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Mar 19 19:11:22 UTC 2015


Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.708.mcz

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

Name: System-eem.708
Author: eem
Time: 19 March 2015, 12:10:48.635 pm
UUID: d4bc49a3-c726-4233-bec5-8c9f25b1466c
Ancestors: System-mt.707

Have BreakpointManager preserve source when
adding breakpoints via toggle on entry.

=============== Diff against System-mt.707 ===============

Item was changed:
  ----- Method: BreakpointManager class>>compilePrototype:in: (in category 'private') -----
+ compilePrototype: aSymbol in: aClass
+ 	"Compile and answer a new method containing a break statement"
- compilePrototype: aSymbol in: aClass 
- 	"Compile and return a new method containing a break statement"
  
+ 	| oldSource parser methodNode breakOnlyMethodNode sendBreakMessageNode hasTemps newSource mark |
+ 	oldSource := aClass sourceCodeAt: aSymbol.
+ 	parser := aClass newParser.
+ 	methodNode := parser
+ 						parse: oldSource
+ 						class: aClass
+ 						noPattern: false
+ 						notifying: nil 
+ 						ifFail: [self error: '[breakpoint] unable to install breakpoint'].
+ 	breakOnlyMethodNode := aClass newCompiler
+ 								compile: 'temporaryMethodSelectorForBreakpoint self break. ^self'
+ 								in: aClass 
+ 								notifying: nil 
+ 								ifFail: [self error: '[breakpoint] unable to install breakpoint'].
+ 	sendBreakMessageNode := breakOnlyMethodNode block statements first.
+ 	methodNode block statements addFirst: sendBreakMessageNode.
+ 	hasTemps := parser tempsMark <= oldSource size and: [(oldSource at: parser tempsMark) = $|].
+ 	"If no temps, tempsMark points at start of first token in body"
+ 	mark := hasTemps
+ 				ifTrue: [parser tempsMark + 2]
+ 				ifFalse:
+ 					[parser tempsMark >= oldSource size
+ 						ifTrue: "empty body"
+ 							[(parser tempsMark min: oldSource size) + 1]
+ 						ifFalse:
+ 							[parser tempsMark - 1]].
+ 	newSource := oldSource copyReplaceFrom: mark to: mark - 1 with: '	self break.\' withCRs.
+ 	^methodNode generate copyWithSourceCode: newSource!
- 	| source node method |
- 	source := self breakpointMethodSourceFor: aSymbol in: aClass.
- 	node := aClass newCompiler
- 				compile: source
- 				in: aClass 
- 				notifying: nil 
- 				ifFail: [self error: '[breakpoint] unable to install breakpoint'].
- 	node isNil ifTrue: [^nil].
- 	method := node generateWithTempNames.
- 	^method!



More information about the Squeak-dev mailing list