added #usedSymbols statistic
authorClaus Gittinger <cg@exept.de>
Wed, 09 Aug 2000 22:39:15 +0200
changeset 1064 ecd50cdfb881
parent 1063 c8fc5ae326c5
child 1065 435a2c310b19
added #usedSymbols statistic
Parser.st
--- a/Parser.st	Tue Aug 08 18:17:43 2000 +0200
+++ b/Parser.st	Wed Aug 09 22:39:15 2000 +0200
@@ -4361,7 +4361,11 @@
             tokenValue := tokenValue copy.
             tokenValue changeClassTo:ImmutableString.
         ].
-
+        (tokenType == #Symbol) ifTrue:[
+            parseForCode ifFalse:[
+                self rememberSymbolUsed:tokenValue
+            ].
+        ].
         val := ConstantNode type:tokenType value:tokenValue.
         self nextToken.
         (self noAssignmentAllowed:'assignment to a constant' at:pos) ifFalse:[
@@ -5369,6 +5373,12 @@
     "Modified: 19.6.1997 / 17:54:38 / cg"
 !
 
+usedSymbols
+    "return a collection with used symbols (except for sent messages) (valid after parsing)"
+
+    ^ (usedSymbols ? #()) 
+!
+
 usedVars
     "return a collection with variablenames refd by method (valid after parsing)"
 
@@ -5505,6 +5515,13 @@
     usedSuperMessages add:sel
 !
 
+rememberSymbolUsed:aSymbol
+    usedSymbols isNil ifTrue:[
+        usedSymbols := IdentitySet new.
+    ].
+    usedSymbols add:aSymbol 
+!
+
 rememberVariableUsed:name 
     usedVars isNil ifTrue:[
 	usedVars := Set new
@@ -5515,6 +5532,6 @@
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.250 2000-08-08 16:17:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.251 2000-08-09 20:39:15 cg Exp $'
 ! !
 Parser initialize!