PeekableStream.st
branchjv
changeset 17834 04ff72c5039a
parent 17814 b75a7f0c346b
child 17841 7abcc4aef871
--- a/PeekableStream.st	Wed Apr 06 13:25:19 2011 +0100
+++ b/PeekableStream.st	Sat Apr 09 18:19:04 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,15 +1034,15 @@
 !PeekableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Id: PeekableStream.st 10602 2010-12-20 07:13:27Z vranyj1 $'
+    ^ '$Id: PeekableStream.st 10632 2011-04-09 17:19:04Z vranyj1 $'
 !
 
 version_CVS
-    ^ 'Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.39 2010/03/12 12:39:13 cg Exp '
+    ^ 'Header: /var/local/cvs/stx/libbasic/PeekableStream.st,v 1.40 2011-02-05 10:40:33 cg Exp '
 !
 
 version_SVN
-    ^ '$Id: PeekableStream.st 10602 2010-12-20 07:13:27Z vranyj1 $'
+    ^ '$Id: PeekableStream.st 10632 2011-04-09 17:19:04Z vranyj1 $'
 ! !
 
 PeekableStream initialize!
@@ -1043,3 +1051,4 @@
 
 
 
+