diff options
author | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-11-07 08:53:15 +0000 |
---|---|---|
committer | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-11-07 08:53:15 +0000 |
commit | 203f938b4aed7d7e3263071f6fe2c72c5d012395 (patch) | |
tree | 6fc23109247c631de317494e9749377a24f2021a /compiler/symbase.pas | |
parent | 81e3202d43f8822fdc851f77a5dc0e9c57787d6c (diff) | |
download | fpc-203f938b4aed7d7e3263071f6fe2c72c5d012395.tar.gz |
* fix hiding of symbols
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@5272 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/symbase.pas')
-rw-r--r-- | compiler/symbase.pas | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/compiler/symbase.pas b/compiler/symbase.pas index a11b07ebf1..7c2e57adba 100644 --- a/compiler/symbase.pas +++ b/compiler/symbase.pas @@ -104,13 +104,11 @@ interface procedure freeinstance;override; function getcopy:TSymtable; procedure clear;virtual; -// function rename(const olds,news:TIDString):TSymEntry; function checkduplicate(var s:THashedIDString;sym:TSymEntry):boolean;virtual; - procedure insert(sym:TSymEntry);virtual; + procedure insert(sym:TSymEntry;checkdup:boolean=true); function Find(const s:TIDString) : TSymEntry; function FindWithHash(const s:THashedIDString) : TSymEntry;virtual; procedure insertdef(def:TDefEntry);virtual; -// procedure deletedef(def:TDefEntry);virtual; function iscurrentunit:boolean;virtual; end; @@ -275,20 +273,26 @@ implementation end; - procedure TSymtable.insert(sym:TSymEntry); + procedure TSymtable.insert(sym:TSymEntry;checkdup:boolean=true); var hashedid : THashedIDString; begin - if sym.realname[1]='$' then - hashedid.id:=Copy(sym.realname,2,255) - else - hashedid.id:=Upper(sym.realname); - { First check for duplicates, this can change the symbol name - in case of a duplicate entry } - checkduplicate(hashedid,sym); + if checkdup then + begin + if sym.realname[1]='$' then + hashedid.id:=Copy(sym.realname,2,255) + else + hashedid.id:=Upper(sym.realname); + { First check for duplicates, this can change the symbol name + in case of a duplicate entry } + checkduplicate(hashedid,sym); + end; { Now we can insert the symbol, any duplicate entries are renamed to an unique (and for users unaccessible) name } - sym.ChangeOwnerAndName(SymList,hashedid.id); + if sym.realname[1]='$' then + sym.ChangeOwnerAndName(SymList,Copy(sym.realname,2,255)) + else + sym.ChangeOwnerAndName(SymList,Upper(sym.realname)); sym.Owner:=self; end; |