--- smalltalk-2.3.1/compiler/STSymTable.st 2006-02-05 12:41:19.000000000 -0600 +++ smalltalk/compiler/STSymTable.st 2006-12-29 20:44:55.000000000 -0600 @@ -294,13 +294,7 @@ i < namesArray size ifTrue: [ self invalidScopeResolution: stCompiler ]. "Last item, add to Undeclared" - self class insideFilein ifFalse: [ ^nil ]. - (each at: 1) isUppercase ifFalse: [ ^nil ]. - - symbol := each asSymbol. - ^Undeclared associationAt: symbol ifAbsent: [ - Undeclared add: symbol -> nil - ]. + ^self lookupUndeclared: each asSymbol ]. ]. ^assoc @@ -315,6 +309,13 @@ ^nil ! +lookupPoolsAndUndeclaredFor: symbol + | assoc | + assoc := self lookupPoolsFor: symbol. + assoc isNil ifTrue: [^self lookupUndeclared: symbol]. + ^assoc +! + lookupName: aName for: stCompiler "Answers a value for the name" | symbol value assoc index | @@ -332,7 +333,7 @@ ]. assoc := index = 0 - ifTrue: [ self lookupPoolsFor: symbol ] + ifTrue: [ self lookupPoolsAndUndeclaredFor: symbol ] ifFalse: [ self bindingOf: (aName substrings: $.) for: stCompiler ]. assoc isNil ifFalse: [ ^self addLiteral: assoc ]. @@ -357,6 +358,18 @@ scopes := OrderedCollection new: 5. pools := IdentitySet new: 7. tempCount := 0. +! + +lookupUndeclared: symbol + "Answer an Association for variable symbol that will be bound + later, if undeclared variables are allowed and the symbol is a + syntactic candidate; otherwise answer nil." + self class insideFilein ifFalse: [ ^nil ]. + (symbol at: 1) isUppercase ifFalse: [ ^nil ]. + + ^Undeclared associationAt: symbol ifAbsent: [ + Undeclared add: symbol -> nil + ] ! ! STSymbolTable initialize!