Ignore:
Timestamp:
Nov 10, 2010, 9:42:27 AM (14 years ago)
Author:
george
Message:
  • Added: Parsing type parameters.
  • Fixed: Saving edited files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/USourceCode.pas

    r19 r24  
    182182  end;
    183183
     184  { TType }
     185
    184186  TType = class
    185187    ForwardDeclared: Boolean;
     
    191193    Exported: Boolean;
    192194    Visibility: TTypeVisibility;
     195    Parameters: TTypeList;
     196    procedure Assign(Source: TType);
     197    constructor Create;
     198    destructor Destroy; override;
    193199  end;
    194200
     
    468474    'shr', 'as', 'div', 'mod', 'or', 'xor', '-', '+', '=', '>', '<', '<>', '<=',
    469475     '>=', 'is', 'in', ':=');
     476
     477resourcestring
     478  SAssignmentError = 'Assignment error';
    470479
    471480implementation
     
    10711080constructor TTypeClass.Create;
    10721081begin
     1082  inherited;
    10731083  Items := TListType.Create;
    10741084end;
     
    10801090end;
    10811091
     1092{ TType }
     1093
     1094procedure TType.Assign(Source: TType);
     1095var
     1096  I: Integer;
     1097  NewType: TType;
     1098begin
     1099  if Assigned(Source) then begin
     1100    Name := Source.Name;
     1101    Parameters.Clear;
     1102    for I := 0 to Source.Parameters.Count - 1 do begin
     1103      NewType := TType.Create;
     1104      //NewType := TType(Source.Parameters[I].ClassType.Create);
     1105      NewType.Assign(Source.Parameters[I]);
     1106      Parameters.Add(NewType);
     1107    end;
     1108    Visibility := Source.Visibility;
     1109    Parent := Source.Parent;
     1110    Internal := Source.Internal;
     1111    ForwardDeclared := Source.ForwardDeclared;
     1112    Exported := Source.Exported;
     1113    Size := Source.Size;
     1114    UsedType := Source.UsedType;
     1115  end else raise Exception.Create(SAssignmentError);
     1116end;
     1117
     1118constructor TType.Create;
     1119begin
     1120  Parameters := TTypeList.Create;
     1121  //Parameters.Parent := Parent.Parent;
     1122end;
     1123
     1124destructor TType.Destroy;
     1125begin
     1126  Parameters.Free;
     1127  inherited Destroy;
     1128end;
     1129
    10821130end.
    10831131
Note: See TracChangeset for help on using the changeset viewer.