mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-21 12:29:46 +02:00
* take care of m_duplicate_names when checking for duplicate locals, resolves #33221
git-svn-id: trunk@44028 -
This commit is contained in:
parent
7b4292c94e
commit
d87a5cc9fb
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -17801,6 +17801,7 @@ tests/webtbs/tw33167.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw3320.pp svneol=native#text/plain
|
tests/webtbs/tw3320.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw33202.pp svneol=native#text/pascal
|
tests/webtbs/tw33202.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw33205.pp -text svneol=native#text/plain
|
tests/webtbs/tw33205.pp -text svneol=native#text/plain
|
||||||
|
tests/webtbs/tw33221.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw33222.pp svneol=native#text/pascal
|
tests/webtbs/tw33222.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw33230.pp svneol=native#text/pascal
|
tests/webtbs/tw33230.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3324.pp svneol=native#text/plain
|
tests/webtbs/tw3324.pp svneol=native#text/plain
|
||||||
|
@ -2460,7 +2460,7 @@ implementation
|
|||||||
assigned(tprocdef(defowner).struct) and
|
assigned(tprocdef(defowner).struct) and
|
||||||
(tprocdef(defowner).owner.defowner=tprocdef(defowner).struct) and
|
(tprocdef(defowner).owner.defowner=tprocdef(defowner).struct) and
|
||||||
(
|
(
|
||||||
not(m_delphi in current_settings.modeswitches) or
|
not(m_duplicate_names in current_settings.modeswitches) or
|
||||||
is_object(tprocdef(defowner).struct)
|
is_object(tprocdef(defowner).struct)
|
||||||
) then
|
) then
|
||||||
result:=tprocdef(defowner).struct.symtable.checkduplicate(hashedid,sym);
|
result:=tprocdef(defowner).struct.symtable.checkduplicate(hashedid,sym);
|
||||||
|
30
tests/webtbs/tw33221.pp
Normal file
30
tests/webtbs/tw33221.pp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
program Project1;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
{$ModeSwitch duplicatelocals}
|
||||||
|
|
||||||
|
type
|
||||||
|
TClass1 = class(TObject)
|
||||||
|
public
|
||||||
|
X: Integer;
|
||||||
|
procedure Proc1(X: Integer);
|
||||||
|
procedure Proc2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Parameter has same name as member field.
|
||||||
|
// This is okay with duplicatelocals
|
||||||
|
procedure TClass1.Proc1(X: Integer);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Local variable has same name as member field.
|
||||||
|
// Unlike with delphi mode, this is compiler error, even with duplicatelocals!
|
||||||
|
procedure TClass1.Proc2;
|
||||||
|
var
|
||||||
|
X: Integer;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user