Fixes an off-by-one related to the different interpretations of
copyFrom:to: between String and FileSegment.  See
[EMAIL PROTECTED]/smalltalk--backstage--2.2--patch-10
or attached.

Now I get after loading compiler:

st> PackageLoader fileInPackage: 'TCP'!
Loading package TCP
stdin:2: bad primitive number, expected SmallInteger
Object: CompiledMethod class error: invalid primitive declaration
SystemExceptions.VerificationError(Smalltalk.Exception)>>#signal
SystemExceptions.VerificationError class(Smalltalk.Exception class)>>#signal:
optimized [] in Smalltalk.CompiledMethod 
class>>#literals:numArgs:numTemps:attributes:bytecodes:depth:
[] in Smalltalk.Array(Smalltalk.Collection)>>#inject:into:
Smalltalk.Array(Smalltalk.SequenceableCollection)>>#do:
Smalltalk.Array(Smalltalk.Collection)>>#inject:into:
Smalltalk.CompiledMethod 
class>>#literals:numArgs:numTemps:attributes:bytecodes:depth:
STInST.STCompiler>>#acceptMethodNode:

-- 
;;; Stephen Compall ** http://scompall.nocandysw.com/blog **
"Peta" is Greek for fifth; a petabyte is 10 to the fifth power, as
well as fifth in line after kilo, mega, giga, and tera.
  -- Lee Gomes, performing every Wednesday in his tech column
     "Portals" on page B1 of The Wall Street Journal
2007-02-18  Stephen Compall  <[EMAIL PROTECTED]>

	* compiler/RBParseNodes.st: Fix off-by-one in
	RBMethodNode>>#primitiveSources when source is a FileSegment.

--- orig/compiler/RBParseNodes.st
+++ mod/compiler/RBParseNodes.st
@@ -953,11 +953,13 @@
     ^self arguments copyWith: self body!
 
 primitiveSources
-    | offset |
+    | sourceString offset |
+    self tags isEmpty ifTrue: [^#()].
+    sourceString := self source asString.
     offset := self start - 1.
     ^self tags 
-	collect: [:each | self source copyFrom: each first - offset
-				      to: each last - offset]!
+	collect: [:each | sourceString copyFrom: each first - offset
+				       to: each last - offset]!
 
 isBinary
     ^(self isUnary or: [self isKeyword]) not!

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to