summaryrefslogtreecommitdiff
path: root/compiler/symbase.pas
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/symbase.pas')
-rw-r--r--compiler/symbase.pas28
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;