Closure Compiler Fix
Anthony Hannan
ajhannan at yahoo.com
Wed Mar 26 06:37:29 UTC 2003
Attached is a fix to a bug found when a var is shadowed more than two
level/closures deep. Thanks to Ken Dickey for finding this bug.
This fix has been incorporated in the latest zipped changesets found on the
Closure Compiler web page.
Cheers,
Anthony
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
--0-185158885-1048660649=:10528
Content-Type: text/plain; name="CCShadowedVarsFix-ajh.cs"
Content-Description: CCShadowedVarsFix-ajh.cs
Content-Disposition: inline; filename="CCShadowedVarsFix-ajh.cs"
'From Squeak3.4gamma of ''7 January 2003'' [latest update: #5169] on 26 March 2003 at 12:12:48 am'!
"Change Set: CCShadowedVarFix-ajh
Date: 25 March 2003
Author: Anthony Hannan <ajh18 at cornell.edu>
This fixes a bug found when a var is shadowed more than two level/closures deep. Thanks to Ken Dickey for finding this bug."!
!Parser2 methodsFor: 'accessing' stamp: 'ajh 3/25/2003 23:45'!
encoder
^ self! !
!SemScope methodsFor: 'lookup' stamp: 'ajh 3/25/2003 23:38'!
rawVar: name
"subclass responsibility"
^ self outerScope rawVar: name! !
!SemClassScope methodsFor: 'lookup' stamp: 'ajh 3/25/2003 23:38'!
rawVar: name
"Return a SemVar for my pool var with this name. Return nil if none found"
class scopeHas: name asSymbol ifTrue:
[:assoc | ^ SemPoolVar newFor: assoc].
^ nil
! !
!SemContextScope methodsFor: 'lookup' stamp: 'ajh 3/25/2003 23:38'!
rawVar: name
"Return the SemVar with this name without wrapping in captured var or adding to local dictionary"
| nm |
nm _ name = 'super' ifTrue: ['self'] ifFalse: [name].
^ vars at: nm ifAbsent: [self outerScope rawVar: nm]! !
!SemNilScope methodsFor: 'lookup' stamp: 'ajh 3/25/2003 23:38'!
rawVar: name
"subclass responsibility, default is to look up global vars"
ProtoObject scopeHas: name asSymbol ifTrue:
[:assoc | ^ SemPoolVar newFor: assoc].
^ nil
! !
!SemanticChecker methodsFor: 'visitor-double dispatching' stamp: 'ajh 3/25/2003 23:39'!
declareVariableNode: aVariableNode
| semVar |
(semVar _ scope rawVar: aVariableNode name)
ifNotNil: [self variable: aVariableNode shadows: semVar].
semVar _ scope addTemp: aVariableNode name.
aVariableNode binding: semVar.
^ semVar! !
More information about the Squeak-dev
mailing list
|