undefinedVariableNotification fix
authorClaus Gittinger <cg@exept.de>
Mon, 21 Apr 2003 16:50:34 +0200
changeset 1399 95b2eaa4e457
parent 1398 eaef898b063e
child 1400 20ccdab04698
undefinedVariableNotification fix
Parser.st
--- a/Parser.st	Mon Apr 21 16:39:40 2003 +0200
+++ b/Parser.st	Mon Apr 21 16:50:34 2003 +0200
@@ -57,7 +57,7 @@
 !
 
 Notification subclass:#UndefinedVariableNotification
-	instanceVariableNames:''
+	instanceVariableNames:'parser'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:Parser
@@ -247,6 +247,36 @@
     [author:]
         Claus Gittinger
 "
+!
+
+examples
+"
+                                                                        [exBegin]
+    Parser 
+        evaluate:'1+2*3' 
+        in:nil 
+        receiver:nil 
+        notifying:nil 
+        logged:false 
+        ifFail:nil      
+                                                                        [exEnd]
+                                                                        [exBegin]
+    Parser undefinedVariableNotification handle:[:ex |
+        |badName|
+
+        badName := ex variableName.
+        ex proceedWith:(ConstantNode value:5).
+    ] do:[
+        ^ self compilerClass 
+            evaluate:'foo * 3' 
+            in:nil 
+            receiver:nil 
+            notifying:nil 
+            logged:false 
+            ifFail:nil 
+    ]
+                                                                        [exEnd]
+"
 ! !
 
 !Parser class methodsFor:'instance creation'!
@@ -3172,6 +3202,11 @@
 
     |doCorrect msg idx boldName|
 
+    doCorrect := UndefinedVariableNotification raiseRequestWith:aName.
+    doCorrect notNil ifTrue:[
+        ^ doCorrect
+    ].
+
     warnUndeclared ifFalse:[^ false].
     ignoreWarnings ifTrue:[^ false].
 
@@ -3185,11 +3220,6 @@
         ].
     ].
 
-    doCorrect := UndefinedVariableNotification raiseRequestWith:aName.
-    doCorrect notNil ifTrue:[
-        ^ doCorrect
-    ].
-
 "/    (classToCompileFor notNil 
 "/    and:[classToCompileFor superclass notNil
 "/    and:[classToCompileFor superclass instanceVariableString isNil]]) ifTrue:[
@@ -7146,10 +7176,28 @@
     ^ startPosition
 ! !
 
+!Parser::UndefinedVariableNotification methodsFor:'accessing'!
+
+parser
+    "return the value of the instance variable 'parser' (automatically generated)"
+
+    ^ parser
+!
+
+parser:something
+    "set the value of the instance variable 'parser' (automatically generated)"
+
+    parser := something.
+!
+
+variableName
+    ^ parameter
+! !
+
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.379 2003-04-21 14:39:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.380 2003-04-21 14:50:34 cg Exp $'
 ! !
 
 Parser initialize!