--- a/PeekableStream.st Wed Jan 27 19:23:31 2016 +0100
+++ b/PeekableStream.st Wed Jan 27 19:26:00 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
@@ -416,7 +414,7 @@
(in theory) create readers for any syntax.
"
- |aString sawExcla rslt done compiler|
+ |aString sawExcla rslt done compiler lastClass|
self skipSeparators.
self atEnd ifFalse:[
@@ -426,8 +424,7 @@
"/ handle empty chunks;
"/ this allows for Squeak code to be filedIn
"/
- [aString size == 0
- and:[self atEnd not]] whileTrue:[
+ [aString size == 0 and:[self atEnd not]] whileTrue:[
aString := self nextChunk.
].
aString size ~~ 0 ifTrue:[
@@ -441,6 +438,11 @@
sawExcla ifFalse:[
"/ class definition chunks, etc., which are simply evaluated
rslt := compiler evaluate:aString receiver:someone notifying:someone compile:false.
+ rslt isBehavior ifTrue:[
+ lastClass := rslt
+ ] ifFalse:[
+ lastClass := nil
+ ].
] ifTrue:[
"/ methodsFor chunks, etc., which generate a reader
(Smalltalk at:#Compiler) emptySourceNotificationSignal handle:[:ex |
@@ -469,12 +471,20 @@
done := (aString size == 0).
]
] ifFalse:[
- rslt := rslt
+ Class packageQuerySignal handle:[:ex |
+ lastClass notNil ifTrue:[
+ ex proceedWith:lastClass package
+ ] ifFalse:[
+ ex reject
+ ].
+ ] do:[
+ rslt := rslt
fileInFrom:self
notifying:someone
passChunk:passChunk
single:false
silent:beSilent
+ ].
]
]
]