From 58ae6d63803391726fb09b938c16822688b14051 Mon Sep 17 00:00:00 2001 From: carlokok Date: Thu, 19 Mar 2009 11:02:21 +0000 Subject: [PATCH] 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 --- Source/uPSComponent.pas | 5 ++++- Source/uROPSServerLink.pas | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Source/uPSComponent.pas b/Source/uPSComponent.pas index 1aea49e..fbb608e 100644 --- a/Source/uPSComponent.pas +++ b/Source/uPSComponent.pas @@ -781,7 +781,10 @@ begin 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 else begin Result := DoOnUnknowUses (Sender, Name); diff --git a/Source/uROPSServerLink.pas b/Source/uROPSServerLink.pas index ea4895a..bc4f3e6 100644 --- a/Source/uROPSServerLink.pas +++ b/Source/uROPSServerLink.pas @@ -29,9 +29,10 @@ type FEnableBinary: Boolean; function GetHaveRodl: Boolean; function MkStructName(Struct: TRODLStruct): string; - protected + public procedure CompileImport1(CompExec: TPSScript); override; procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override; + protected procedure Loaded; override; public @@ -770,14 +771,28 @@ begin RecType := TPSRecordType(TempType).AddRecVal; RecType.FieldOrgName := Struct.Items[i1].Info.Name; 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; CompExec.Comp.AddTypeCopy(Struct.Info.Name, TempType); end; for i := 0 to FRodl.ArrayCount -1 do begin Arr := FRodl.Arrays[i]; - TempType := CompExec.Comp.AddType(Arr.Info.Name, btArray); - TPSArrayType(TempType).ArrayTypeNo := CompExec.Comp.FindType(Arr.ElementType); + 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); + TPSArrayType(TempType).ArrayTypeNo := CompExec.Comp.FindType(Arr.ElementType); + end; end; for i := 0 to FRodl.ServiceCount -1 do begin