[dcc32 Fatal Error]: F2084 Internal Error: NC1921
[dcc32 Fatal Error]: F2084 Internal Error: NC1921
我正在尝试在 Delphi Rio 中编译以下代码:
unit untObjectHelper;
interface
uses
SysUtils;
type
TObjectHelper = class(TInterfacedObject)
public
class procedure Clone(const objOrigem: TObject; const objDestino: TObject);
end;
implementation
uses
System.Rtti;
{ TObjectHelper }
class procedure TObjectHelper.Clone(const objOrigem,
objDestino: TObject);
begin
if not Assigned(objOrigem) then
Exit;
if not Assigned(objDestino) then
Exit;
if objOrigem.ClassType <> objDestino.ClassType then
Exit;
var contexto := TRttiContext.Create;
try
var tipo := contexto.GetType(objOrigem.ClassType);
var campos := tipo.GetFields();
finally
contexto.Free;
end;
end;
end.
但是出现以下错误:
[dcc32 Fatal Error] untObjectHelper.pas (36): F2084 Internal Error:
NC1921
在线:
var fields: = type.GetFields ();
版本:Embarcadero® Delphi 10.3 版本 26.0.33219.4899
我没有找到对这个错误的引用,有人可以帮助我吗?非常感谢
问题出在类型推断上,感谢 Rudy Velthuis 的提示
unit untObjectHelper;
interface
uses
SysUtils;
type
TObjectHelper = class(TInterfacedObject)
public
class procedure Clone(const objOrigem: TObject; const objDestino: TObject);
end;
implementation
uses
System.Rtti;
{ TObjectHelper }
class procedure TObjectHelper.Clone(const objOrigem,
objDestino: TObject);
begin
if not Assigned(objOrigem) then
Exit;
if not Assigned(objDestino) then
Exit;
if objOrigem.ClassType <> objDestino.ClassType then
Exit;
var contexto := TRttiContext.Create;
try
var tipo := contexto.GetType(objOrigem.ClassType);
var campos: TArray<TRttiField> := tipo.GetFields();
finally
contexto.Free;
end;
end;
end.
我正在尝试在 Delphi Rio 中编译以下代码:
unit untObjectHelper;
interface
uses
SysUtils;
type
TObjectHelper = class(TInterfacedObject)
public
class procedure Clone(const objOrigem: TObject; const objDestino: TObject);
end;
implementation
uses
System.Rtti;
{ TObjectHelper }
class procedure TObjectHelper.Clone(const objOrigem,
objDestino: TObject);
begin
if not Assigned(objOrigem) then
Exit;
if not Assigned(objDestino) then
Exit;
if objOrigem.ClassType <> objDestino.ClassType then
Exit;
var contexto := TRttiContext.Create;
try
var tipo := contexto.GetType(objOrigem.ClassType);
var campos := tipo.GetFields();
finally
contexto.Free;
end;
end;
end.
但是出现以下错误:
[dcc32 Fatal Error] untObjectHelper.pas (36): F2084 Internal Error: NC1921
在线:
var fields: = type.GetFields ();
版本:Embarcadero® Delphi 10.3 版本 26.0.33219.4899
我没有找到对这个错误的引用,有人可以帮助我吗?非常感谢
问题出在类型推断上,感谢 Rudy Velthuis 的提示
unit untObjectHelper;
interface
uses
SysUtils;
type
TObjectHelper = class(TInterfacedObject)
public
class procedure Clone(const objOrigem: TObject; const objDestino: TObject);
end;
implementation
uses
System.Rtti;
{ TObjectHelper }
class procedure TObjectHelper.Clone(const objOrigem,
objDestino: TObject);
begin
if not Assigned(objOrigem) then
Exit;
if not Assigned(objDestino) then
Exit;
if objOrigem.ClassType <> objDestino.ClassType then
Exit;
var contexto := TRttiContext.Create;
try
var tipo := contexto.GetType(objOrigem.ClassType);
var campos: TArray<TRttiField> := tipo.GetFields();
finally
contexto.Free;
end;
end;
end.