1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. with Scripting.Expressions.Functions;   use Scripting.Expressions.Functions; 
  10.  
  11. package Scripting.Statements.Methods is 
  12.  
  13.     -- A Method statement evaluates a function, ignoring any return value. 
  14.     type Method is new Statement with private; 
  15.     type A_Method is access all Method'Class; 
  16.  
  17.     -- Creates a new empty Method. 
  18.     function Create_Method return A_Method; 
  19.     pragma Postcondition( Create_Method'Result /= null ); 
  20.  
  21.     -- Sets the function that the method statement will evaluate. 
  22.     procedure Set_Function( this : not null access Method'Class; 
  23.                             func : not null A_Function ); 
  24.  
  25. private 
  26.  
  27.     type Method is new Statement with 
  28.         record 
  29.             func : A_Function; 
  30.         end record; 
  31.  
  32.     procedure Delete( this : in out Method ); 
  33.  
  34.     -- Evaluates/executes the Method. Evaluates the function but the return 
  35.     -- value is ignored. Evaluation_Exception will be raised if an error occurs. 
  36.     procedure Evaluate( this    : access Method; 
  37.                         context : not null A_Eval_Context ); 
  38.  
  39. end Scripting.Statements.Methods;