0006564: Using an array type in a struct fails with RODL import in PASCALSCRIPT

git-svn-id: http://code.remobjects.com/svn/pascalscript@112 5c9d2617-0215-0410-a2ee-e80e04d1c6d8
This commit is contained in:
carlokok 2009-03-19 11:02:21 +00:00
parent 20d6649671
commit 58ae6d6380
2 changed files with 22 additions and 4 deletions

View File

@ -781,7 +781,10 @@ begin
DoOnCompile; DoOnCompile;
Result := True; Result := true;
for i := 0 to Sender.MsgCount -1 do begin
if Sender.Msg[i] is TPSPascalCompilerError then Result := false;
end;
end end
else begin else begin
Result := DoOnUnknowUses (Sender, Name); Result := DoOnUnknowUses (Sender, Name);

View File

@ -29,9 +29,10 @@ type
FEnableBinary: Boolean; FEnableBinary: Boolean;
function GetHaveRodl: Boolean; function GetHaveRodl: Boolean;
function MkStructName(Struct: TRODLStruct): string; function MkStructName(Struct: TRODLStruct): string;
protected public
procedure CompileImport1(CompExec: TPSScript); override; procedure CompileImport1(CompExec: TPSScript); override;
procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
protected
procedure Loaded; override; procedure Loaded; override;
public public
@ -770,15 +771,29 @@ begin
RecType := TPSRecordType(TempType).AddRecVal; RecType := TPSRecordType(TempType).AddRecVal;
RecType.FieldOrgName := Struct.Items[i1].Info.Name; RecType.FieldOrgName := Struct.Items[i1].Info.Name;
RecType.aType := CompExec.Comp.FindType(Struct.Items[i1].DataType); RecType.aType := CompExec.Comp.FindType(Struct.Items[i1].DataType);
if RecType.aType = nil then begin
Arr := fRodl.FindArray(Struct.Items[i1].DataType);
if Arr <> nil then begin
RecType.aType := CompExec.Comp.AddType(Arr.Info.Name, btArray);
TPSArrayType(RecType.aType).ArrayTypeNo := CompExec.Comp.FindType(Arr.ElementType);
end;
end;
end; end;
CompExec.Comp.AddTypeCopy(Struct.Info.Name, TempType); CompExec.Comp.AddTypeCopy(Struct.Info.Name, TempType);
end; end;
for i := 0 to FRodl.ArrayCount -1 do for i := 0 to FRodl.ArrayCount -1 do
begin begin
Arr := FRodl.Arrays[i]; Arr := FRodl.Arrays[i];
TempType := CompExec.Comp.FindType(Arr.Info.Name);
if TempType <> nil then begin
if not (TempType is TPSArrayType) or (CompExec.Comp.FindType(Arr.ElementType) <> TPSArrayType(TempType).ArrayTypeNo) then begin
CompExec.Comp.MakeError('ROPS', ecDuplicateIdentifier, Arr.Info.Name);
end;
end else begin
TempType := CompExec.Comp.AddType(Arr.Info.Name, btArray); TempType := CompExec.Comp.AddType(Arr.Info.Name, btArray);
TPSArrayType(TempType).ArrayTypeNo := CompExec.Comp.FindType(Arr.ElementType); TPSArrayType(TempType).ArrayTypeNo := CompExec.Comp.FindType(Arr.ElementType);
end; end;
end;
for i := 0 to FRodl.ServiceCount -1 do for i := 0 to FRodl.ServiceCount -1 do
begin begin
Service := FRodl.Services[i]; Service := FRodl.Services[i];