On Fri, Oct 18, 2013 at 09:21:28AM +0200, Gwenaël Casaccio wrote:
Dear Gwenaël,
sourceCodeMap [
- "Answer an array which maps bytecode indices to source code
- line numbers. 0 values represent invalid instruction
- pointer indices."
-
- <category: 'testing accesses'>
- | map line first |
- map := ByteArray new: self size.
- line := 1.
- first := true.
- self allByteCodeIndicesDo:
- [:each :byte :operand |
- (self class bytecodeInfoTable at: byte * 4 + 4) >= 128
- ifTrue:
- [first ifFalse: [line := operand].
- first := false.
- operand > 255 ifTrue: [map := map asArray]].
- map at: each put: line].
- ^map
+ "Answer an array which maps bytecode indices to source code
+ line numbers. 0 values represent invalid instruction
+ pointer indices."
+
+ <category: 'testing accesses'>
+ | map line first next |
+ map := ByteArray new: self size.
+ next := -1.
+ line := 1.
+ first := true.
+ self allByteCodeIndicesDo:
+ [ :each :byte :operand |
+ (self class bytecodeInfoTable at: byte * 4 + 4) >= 128
+ ifTrue:
+ [ first ifFalse: [ next := operand ].
+ first := false.
+ operand > 255 ifTrue: [ map := map asArray ] ].
+ map at: each put: line.
+ next = -1 ifFalse: [ line := next.
+ next := -1. ] ].
+ ^ map
I hope you agree that this is very difficult to read to actually find the
few lines that have changed. It would be nice if you could continue to use
tabs in sourcecode that is already using tabs or separate the part that is
changing the code to spaces from the semantic change.