changed: #fileInNextChunkNotifying:passChunk:silent:
authorClaus Gittinger <cg@exept.de>
Sat, 05 Feb 2011 11:40:33 +0100
changeset 13282 9b8542c8439e
parent 13281 54e7f034b1e8
child 13283 352069a0b1f4
changed: #fileInNextChunkNotifying:passChunk:silent: do not allow undefined globals when filing in
PeekableStream.st
--- a/PeekableStream.st	Fri Feb 04 16:30:40 2011 +0100
+++ b/PeekableStream.st	Sat Feb 05 11:40:33 2011 +0100
@@ -547,7 +547,7 @@
         (in theory) create readers for any syntax.
     "
 
-    |aString sawExcla rslt done|
+    |aString sawExcla rslt done compiler|
 
     self skipSeparators.
     self atEnd ifFalse:[
@@ -565,13 +565,21 @@
             passChunk ifTrue:[
                 someone notNil ifTrue:[someone source:aString]
             ].
+            compiler := Smalltalk::Compiler new.
+            compiler allowUndeclaredVariables:false.
+
             sawExcla ifFalse:[
-                rslt := Smalltalk::Compiler new evaluate:aString notifying:someone.
+                "/ class definition chunks, etc., which are simply evaluated
+                rslt := compiler evaluate:aString notifying:someone.
             ] ifTrue:[
+                "/ methodsFor chunks, etc., which generate a reader
                 Smalltalk::Compiler emptySourceNotificationSignal handle:[:ex |
                     ^ nil
                 ] do:[
-                    rslt := Smalltalk::Compiler new evaluate:aString notifying:someone compile:false.
+                    rslt := compiler 
+                                evaluate:aString 
+                                notifying:someone 
+                                compile:false.
                 ].
 
                 "
@@ -579,7 +587,7 @@
                  in this case, the returned value is a ClassCategoryReader,
                  which is used to load & compile the methods ...
                 "
-                rslt isNil ifTrue:[
+                (rslt isNil or:[rslt == #Error]) ifTrue:[
                     "
                      however, if that was nil (i.e. some error), we skip chunks
                      up to the next empty chunk.
@@ -603,7 +611,7 @@
     ].
     ^ rslt
 
-    "Modified: 14.10.1997 / 17:10:35 / cg"
+    "Modified: / 05-02-2011 / 10:06:57 / cg"
 !
 
 fileInNotifying:notifiedLoader passChunk:passChunk
@@ -1026,11 +1034,11 @@
 !PeekableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.39 2010-03-12 12:39:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.40 2011-02-05 10:40:33 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.39 2010-03-12 12:39:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.40 2011-02-05 10:40:33 cg Exp $'
 ! !
 
 PeekableStream initialize!