Ignore:
Timestamp:
Feb 17, 2017, 11:19:22 PM (8 years ago)
Author:
chronos
Message:
  • Modified: More work on record functions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/interpreter/interpreter4/Source.pas

    r104 r105  
    1818  PEnumerationStates = ^TEnumerationStates;
    1919  PFunction = ^TFunction;
     20  PVariables = ^TVariables;
    2021
    2122  TOperator = (opNone, opAdd, opSubtract, opAnd, opOr, opNot, opEqual, opNotEqual);
     
    5859    DataType: PType;
    5960    Index: Integer;
     61    RecordVariables: PVariables;
    6062  end;
    6163
     
    6365
    6466  TVariables = record
     67    ParentList: PVariables;
    6568    Items: array of TVariable;
    6669    procedure Add(Variable: TVariable);
    6770    function GetByName(Name: string): PVariable;
    68   end;
    69   PVariables = ^TVariables;
     71    function GetLast: PVariable;
     72  end;
    7073
    7174  TConstant = record
     
    173176    BeginEnd: TBeginEnd;
    174177    Variables: TVariables;
     178    Types: TTypes;
     179    ParentRecord: PType;
    175180  end;
    176181
     
    210215    Constants: TConstants;
    211216    UsesSection: TUses;
     217    Functions: TFunctions;
    212218  end;
    213219  PUnit = ^TUnit;
     
    343349  while (I < Length(Items)) and (Items[I].Name <> Name) do I := I + 1;
    344350  if I < Length(Items) then Result := @Items[I]
    345     else Result := nil;
     351    else begin
     352      if ParentList <> nil then Result := ParentList^.GetByName(Name)
     353        else Result := nil;
     354    end;
     355end;
     356
     357function TVariables.GetLast: PVariable;
     358begin
     359  Result := @Items[Length(Items) - 1];
    346360end;
    347361
Note: See TracChangeset for help on using the changeset viewer.