--- a/MessageNode.st Wed Dec 13 18:55:49 1995 +0100
+++ b/MessageNode.st Wed Dec 13 20:04:48 1995 +0100
@@ -1224,39 +1224,59 @@
codeWhileOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler
"generate code for [...] whilexxx:[ ... ]"
- |pos pos2 theReceiver theArg theByteCode optByteCode|
+ |pos pos2 theReceiver theArg theByteCode optByteCode needLineNr blockExpr|
(selector == #whileTrue:) ifTrue:[
- theByteCode := #falseJump
+ theByteCode := #falseJump
] ifFalse:[
- theByteCode := #trueJump
+ theByteCode := #trueJump
].
theReceiver := receiver.
optByteCode := self optimizedConditionFor:theReceiver with:theByteCode.
optByteCode notNil ifTrue:[
- ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[
- theArg := receiver statements expression arg1
- ].
- theReceiver := receiver statements expression receiver.
- theByteCode := optByteCode
+ ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[
+ theArg := receiver statements expression arg1
+ ].
+ theReceiver := receiver statements expression receiver.
+ theByteCode := optByteCode
].
"/ OLD:
"/ valueNeeded ifTrue:[aStream nextPut:#pushNil].
"/
+ needLineNr := true.
+
pos := aStream position.
optByteCode notNil ifTrue:[
- theReceiver codeOn:aStream inBlock:b for:aCompiler.
- theArg notNil ifTrue:[
- theArg codeOn:aStream inBlock:b for:aCompiler
- ]
+ theReceiver codeOn:aStream inBlock:b for:aCompiler.
+ theArg notNil ifTrue:[
+ theArg codeOn:aStream inBlock:b for:aCompiler
+ ]
] ifFalse:[
- theReceiver codeInlineOn:aStream inBlock:b for:aCompiler
+ theReceiver codeInlineOn:aStream inBlock:b for:aCompiler.
+
+ "/
+ "/ cannot enable code below
+ "/ (tiny loops would not be debuggable with next, since lineNo remains the same)
+ "/ think about it ...
+ "/
+"/ blockExpr := theReceiver simpleSendBlockReceiver.
+"/ blockExpr notNil ifTrue:[
+"/ blockExpr isMessage ifTrue:[
+"/ (self class hasLineNumber:(blockExpr selector)) ifTrue:[
+"/ blockExpr lineNumber == lineNr ifTrue:[
+"/ needLineNr := false
+"/ ]
+"/ ]
+"/ ]
+"/ ].
].
- (lineNr between:1 and:255) ifTrue:[
- aStream nextPut:#lineno; nextPut:lineNr.
+ needLineNr ifTrue:[
+ (lineNr between:1 and:255) ifTrue:[
+ aStream nextPut:#lineno; nextPut:lineNr.
+ ]
].
aStream nextPut:theByteCode.
@@ -1273,6 +1293,8 @@
(aStream contents) at:pos2 put:(aStream position).
"/ NEW:
valueNeeded ifTrue:[aStream nextPut:#pushNil].
+
+ "Modified: 13.12.1995 / 19:42:49 / cg"
!
optimizedConditionFor:aReceiver with:aByteCode
@@ -1540,5 +1562,5 @@
!MessageNode class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.35 1995-12-13 17:55:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.36 1995-12-13 19:04:48 cg Exp $'
! !