瀏覽代碼

* always search in the current module as well as its symtables are be popped already in case of RTTI generation

git-svn-id: trunk@39688 -
svenbarth 7 年之前
父節點
當前提交
ecc02f3fdb
共有 1 個文件被更改,包括 18 次插入1 次删除
  1. 18 1
      compiler/symdef.pas

+ 18 - 1
compiler/symdef.pas

@@ -1335,12 +1335,21 @@ implementation
         srsym: tsym;
         srsymtable: tsymtable;
         i: longint;
+        name : TIDString;
       begin
-        if searchsym_type(copy(internaltypeprefixName[prefix],2,length(internaltypeprefixName[prefix])),srsym,srsymtable) then
+        name:=copy(internaltypeprefixName[prefix],2,length(internaltypeprefixName[prefix]));
+        if searchsym_type(name,srsym,srsymtable) then
           begin
             result:=trecorddef(ttypesym(srsym).typedef);
             exit
           end;
+        { also always search in the current module (symtables are popped for
+          RTTI related code already) }
+        if searchsym_in_module(pointer(current_module),name,srsym,srsymtable) then
+          begin
+            result:=trecorddef(ttypesym(srsym).typedef);
+            exit;
+          end;
         fieldlist:=tfplist.create;
         for i:=low(fields) to high(fields) do
           fieldlist.add(fields[i]);
@@ -1368,6 +1377,14 @@ implementation
             arrdef:=tarraydef(trecordsymtable(recdef.symtable).findfieldbyoffset(countdef.size).vardef);
             exit
           end;
+        { also always search in the current module (symtables are popped for
+          RTTI related code already) }
+        if searchsym_in_module(pointer(current_module),copy(name,2,length(name)),srsym,srsymtable) then
+          begin
+            recdef:=trecorddef(ttypesym(srsym).typedef);
+            arrdef:=tarraydef(trecordsymtable(recdef.symtable).findfieldbyoffset(countdef.size).vardef);
+            exit;
+          end;
         recdef:=crecorddef.create_global_internal(name,packrecords,
           targetinfos[target_info.system]^.alignment.recordalignmin,
           targetinfos[target_info.system]^.alignment.maxCrecordalign);