* more dup id fixes

git-svn-id: trunk@2465 -
This commit is contained in:
peter 2006-02-07 07:58:37 +00:00
parent 6b536c206a
commit b1c66a106e
4 changed files with 54 additions and 32 deletions

View File

@ -301,7 +301,7 @@ implementation
classrefdef : classrefdef :
begin begin
{ classrefdef inherits from pointerdef } { classrefdef inherits from pointerdef }
hpd:=tpointerdef(pd).pointertype.def; hpd:=tabstractpointerdef(pd).pointertype.def;
{ still a forward def ? } { still a forward def ? }
if hpd.deftype=forwarddef then if hpd.deftype=forwarddef then
begin begin

View File

@ -248,33 +248,44 @@ implementation
procedure single_type(var tt:ttype;isforwarddef:boolean); procedure single_type(var tt:ttype;isforwarddef:boolean);
var var
t2 : ttype; t2 : ttype;
again : boolean;
begin begin
case token of repeat
_STRING: again:=false;
string_dec(tt); case token of
_STRING:
string_dec(tt);
_FILE: _FILE:
begin begin
consume(_FILE); consume(_FILE);
if token=_OF then if try_to_consume(_OF) then
begin begin
consume(_OF); single_type(t2,false);
single_type(t2,false); tt.setdef(tfiledef.createtyped(t2));
tt.setdef(tfiledef.createtyped(t2)); end
end else
else tt:=cfiletype;
tt:=cfiletype; end;
end;
_ID: _ID:
id_type(tt,isforwarddef); begin
if try_to_consume(_SPECIALIZE) then
begin
block_type:=bt_specialize;
again:=true;
end
else
id_type(tt,isforwarddef);
end;
else else
begin begin
message(type_e_type_id_expected); message(type_e_type_id_expected);
tt:=generrortype; tt:=generrortype;
end; end;
end; end;
until not again;
end; end;
{ reads a record declaration } { reads a record declaration }

View File

@ -3365,7 +3365,7 @@ In case not, the value returned can be arbitrary.
begin begin
readchar; readchar;
c:=upcase(c); c:=upcase(c);
if (block_type=bt_type) or if (block_type in [bt_type,bt_specialize]) or
(lasttoken=_ID) or (lasttoken=_NIL) or (lasttoken=_ID) or (lasttoken=_NIL) or
(lasttoken=_RKLAMMER) or (lasttoken=_RECKKLAMMER) or (lasttoken=_CARET) then (lasttoken=_RKLAMMER) or (lasttoken=_RECKKLAMMER) or (lasttoken=_CARET) then
begin begin

View File

@ -1069,14 +1069,17 @@ implementation
var var
hsym : tsym; hsym : tsym;
begin begin
result:=inherited checkduplicate(sym); result:=false;
if result then if not assigned(defowner) then
internalerror(200602061);
if (m_duplicate_names in aktmodeswitches) and
(sym.typ in [paravarsym,localvarsym]) then
exit; exit;
{ check for duplicate field, parameter or local names { check for duplicate field, parameter or local names
also in inherited classes } also in inherited classes }
if (sym.typ in [fieldvarsym,paravarsym,localvarsym]) and if (sym.typ in [fieldvarsym,paravarsym,localvarsym]) and
assigned(defowner) and
( (
not(m_delphi in aktmodeswitches) or not(m_delphi in aktmodeswitches) or
is_object(tdef(defowner)) is_object(tdef(defowner))
@ -1090,6 +1093,12 @@ implementation
DuplicateSym(sym,hsym); DuplicateSym(sym,hsym);
result:=true; result:=true;
end; end;
end
else
begin
result:=inherited checkduplicate(sym);
if result then
exit;
end; end;
end; end;
@ -1173,7 +1182,8 @@ implementation
{ check objectsymtable, skip this for funcret sym because { check objectsymtable, skip this for funcret sym because
that will always be positive because it has the same name that will always be positive because it has the same name
as the procsym } as the procsym }
if not is_funcret_sym(sym) and if not(m_duplicate_names in aktmodeswitches) and
not is_funcret_sym(sym) and
(defowner.deftype=procdef) and (defowner.deftype=procdef) and
assigned(tprocdef(defowner)._class) and assigned(tprocdef(defowner)._class) and
(tprocdef(defowner).owner.defowner=tprocdef(defowner)._class) then (tprocdef(defowner).owner.defowner=tprocdef(defowner)._class) then
@ -1198,9 +1208,10 @@ implementation
result:=inherited checkduplicate(sym); result:=inherited checkduplicate(sym);
if result then if result then
exit; exit;
if (defowner.deftype=procdef) and if not(m_duplicate_names in aktmodeswitches) and
assigned(tprocdef(defowner)._class) and (defowner.deftype=procdef) and
(tprocdef(defowner).owner.defowner=tprocdef(defowner)._class) then assigned(tprocdef(defowner)._class) and
(tprocdef(defowner).owner.defowner=tprocdef(defowner)._class) then
result:=tprocdef(defowner)._class.symtable.checkduplicate(sym); result:=tprocdef(defowner)._class.symtable.checkduplicate(sym);
end; end;