Ignore:
Timestamp:
Jul 26, 2017, 11:35:26 PM (7 years ago)
Author:
chronos
Message:

*Modified: Better parsing of variable reference.

File:
1 edited

Legend:

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

    r107 r108  
    88type
    99  TVariableValue = record
    10     VarRef: PVariable;
     10    VarRef: PVariableRef;
    1111    BaseType: TBaseType;
    1212    case Integer of
     
    254254begin
    255255  case GetValue.ReadType of
    256     rtVariable: AssignVariable(Value, ExecutionContextCurrent^.VariableValues.GetByName(GetValue.Variable^.Name));
     256    rtVariable: AssignVariable(Value, ExecutionContextCurrent^.VariableValues.GetByName(GetValue.VariableRef^.Variable^.Name));
    257257    //rtConstant: Value := ExecutionContextCurrent^.VariableValues.GetByName(GetValue.Variable^.Name);
    258258    rtExpression: ExecuteExpression(GetValue.Expression, Value);
     
    352352    Param := @Execution^.Parameters.Items[I];
    353353    if (Param.ReadType = rtVariable) then
    354       AssignVariable(ExecutionContextCurrent^.VariableValues.GetByName(Param.Variable.Name), DestVar)
     354      AssignVariable(ExecutionContextCurrent^.VariableValues.GetByName(Param.VariableRef^.Variable^.Name), DestVar)
    355355    else ShowError('Function var parameter can be only variable');
    356356  end;
     
    362362  SrcVariable: TVariableValue;
    363363begin
    364   DestVariable := ExecutionContextCurrent^.VariableValues.GetByName(Assignment^.Destination^.Name);
    365   WriteLn('Assignment to ' + Assignment^.Destination^.Name);
     364  DestVariable := ExecutionContextCurrent^.VariableValues.GetByName(Assignment^.Destination^.Variable^.Name);
     365  WriteLn('Assignment to ' + Assignment^.Destination^.Variable^.Name);
    366366  FillChar(SrcVariable, SizeOf(TVariableValue), 0);
    367367  ExecuteGetValue(@Assignment^.Source, @SrcVariable);
     
    395395begin
    396396  I := 0;
    397   while (I < Length(Items)) and (Items[I].VarRef^.Name <> Name) do Inc(I);
     397  while (I < Length(Items)) and (Items[I].VarRef^.Variable^.Name <> Name) do Inc(I);
    398398  if I < Length(Items) then Result := @Items[I]
    399399    else Result := nil;
Note: See TracChangeset for help on using the changeset viewer.