Ignore:
Timestamp:
Apr 22, 2020, 12:04:22 PM (5 years ago)
Author:
chronos
Message:
  • Added: Support for custom functions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/interpreter2/UExecutor.pas

    r211 r212  
    630630  FuncName: string;
    631631begin
    632   if Expression.Operation = eoAdd then FuncName := '_Add'
    633   else if Expression.Operation = eoSub then FuncName := '_Sub'
    634   else if Expression.Operation = eoEqual then FuncName := '_Equal'
    635   else if Expression.Operation = eoNotEqual then FuncName := '_NotEqual'
    636   else raise Exception.Create('Unsupported operation type.');
    637 
    638   ExecutorFunction := Block.GetTypeFunction(Expression.TypeRef, FuncName);
     632  FuncName := Expression.GetFunctionName;
     633
     634  ExecutorFunction := Block.GetTypeFunction(Expression.FunctionRef.ParentType, FuncName);
     635  if not Assigned(ExecutorFunction) then
     636    raise Exception.Create('Missing operator function ' + FuncName + ' for type ' + Expression.TypeRef.Name);
     637
    639638  Result := Expression.TypeRef.ValueClass.Create;
    640639
Note: See TracChangeset for help on using the changeset viewer.