Go to the first, previous, next, last section, table of contents.


6.4 The Calls Clause

calls-clause-seq ::= calls-clause [ calls-clause ] ...
calls-clause ::= calls [ redundantly ] function-names ;
function-names ::= everything | nothing
       | function-name [ , function-name ] ...
function-name ::= term

A calls-clause says what functions may be directly called by a correct implementation of the function being specified. This is helpful for documenting the calling pattern among virtual functions, which is needed to write subclasses [Kiczales-Lamping92] [Steyaert-etal96]. The term that represents a function-name can use the values of variables in either the pre- or post-state to access functions. The following is an example of the use of the calls-clause.

// @(#)$Id: CallsExample.lh,v 1.1 1999/03/03 20:24:29 leavens Exp $

class hclass {
public:
   static int sfun(int i);
   virtual int h();
};
 
class CallsExample {
public:
  hclass dmember;
  virtual void mymethod();

  virtual void ex(hclass vparam, hclass & rparam, hclass *p);
  //@ behavior {
  //@   modifies *p;
  //@   calls vparam.h, rparam\any.h, (*p)^.h, dmember\any.h, 
  //@         hclass::sfun, mymethod;
  //@ }
};

This calls-clause says that the member function ex of the class CallsExample may call method h found in: the value parameter vparam, the value of the reference parameter rparam in either the pre- or post-state, the pre-state value of the pointer variable *p, and either the pre- or post-state value of the data member dmember. It may also call the static function hclass::sfun, and mymethod.

[[[Detailed semantics to be written.]]]


Go to the first, previous, next, last section, table of contents.