mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 17:59:27 +02:00
- removed optimization that pops the current symtable off the symtablestack
if it cannot contain local type definitions before looking up the type of a field, because the type of a field may be a new type definition (e.g. an inline record definition) and such type definitions must be added to the correct symtable for, a.o., correctly resolving uses of the name of a type that is currently being parsed git-svn-id: trunk@20187 -
This commit is contained in:
parent
c0a501bdab
commit
f984a3d74e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10547,6 +10547,7 @@ tests/test/tobjc35i.pp svneol=native#text/plain
|
||||
tests/test/tobjc36.pp svneol=native#text/plain
|
||||
tests/test/tobjc36a.pp svneol=native#text/plain
|
||||
tests/test/tobjc37.pp svneol=native#text/plain
|
||||
tests/test/tobjc38.pp svneol=native#text/plain
|
||||
tests/test/tobjc4.pp svneol=native#text/plain
|
||||
tests/test/tobjc4a.pp svneol=native#text/plain
|
||||
tests/test/tobjc5.pp svneol=native#text/plain
|
||||
|
@ -1519,7 +1519,6 @@ implementation
|
||||
srsymtable : TSymtable;
|
||||
visibility : tvisibility;
|
||||
recst : tabstractrecordsymtable;
|
||||
recstlist : tfpobjectlist;
|
||||
unionsymtable : trecordsymtable;
|
||||
offset : longint;
|
||||
uniondef : trecorddef;
|
||||
@ -1545,7 +1544,6 @@ implementation
|
||||
consume(_ID);
|
||||
{ read vars }
|
||||
sc:=TFPObjectList.create(false);
|
||||
recstlist:=TFPObjectList.create(false);
|
||||
removeclassoption:=false;
|
||||
while (token=_ID) and
|
||||
not(((vd_object in options) or
|
||||
@ -1571,16 +1569,6 @@ implementation
|
||||
block_type:=old_block_type;
|
||||
consume(_COLON);
|
||||
|
||||
{ Don't search for types where they can't be:
|
||||
types can be only in objects, classes and records.
|
||||
This just speedup the search a bit. }
|
||||
recstlist.count:=0;
|
||||
if not is_class_or_object(tdef(recst.defowner)) and
|
||||
not is_record(tdef(recst.defowner)) then
|
||||
begin
|
||||
recstlist.add(recst);
|
||||
symtablestack.pop(recst);
|
||||
end;
|
||||
read_anon_type(hdef,false);
|
||||
block_type:=bt_var;
|
||||
{ allow only static fields reference to struct where they are declared }
|
||||
@ -1592,12 +1580,6 @@ implementation
|
||||
{ for error recovery or compiler will crash later }
|
||||
hdef:=generrordef;
|
||||
end;
|
||||
{ restore stack }
|
||||
for i:=recstlist.count-1 downto 0 do
|
||||
begin
|
||||
recst:=tabstractrecordsymtable(recstlist[i]);
|
||||
symtablestack.push(recst);
|
||||
end;
|
||||
|
||||
{ Process procvar directives }
|
||||
if maybe_parse_proc_directives(hdef) then
|
||||
@ -1733,7 +1715,6 @@ implementation
|
||||
recst.addfield(fieldvs,visibility);
|
||||
end;
|
||||
end;
|
||||
recstlist.free;
|
||||
|
||||
if m_delphi in current_settings.modeswitches then
|
||||
block_type:=bt_var_type
|
||||
|
12
tests/test/tobjc38.pp
Normal file
12
tests/test/tobjc38.pp
Normal file
@ -0,0 +1,12 @@
|
||||
{ %norun }
|
||||
{$modeswitch objectivec1}
|
||||
|
||||
type
|
||||
MyClass = objcclass (NSObject)
|
||||
_rec: record
|
||||
mask: MyClass;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user