Welcome to the NetCologne GmbH open source mirroring service!

This machine mirrors various open-source projects. 20 Gbit/s uplink.

If there are any issues or you want another project mirrored, please contact mirror-service -=AT=- netcologne DOT de !

Comma: comma::SubroutineCall Class Reference

comma::SubroutineCall Class Reference

#include <SubroutineCall.h>

Inheritance diagram for comma::SubroutineCall:
Inheritance graph
[legend]
Collaboration diagram for comma::SubroutineCall:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SubroutineCall (SubroutineRef *connective, Expr **positionalArgs, unsigned numPositional, KeywordSelector **keyedArgs, unsigned numKeys)
 SubroutineCall (SubroutineDecl *connective, Expr **positionalArgs, unsigned numPositional, KeywordSelector **keyedArgs, unsigned numKeys)
virtual ~SubroutineCall ()
bool isaFunctionCall () const
 Returns true if this is a function call expression.
bool isaProcedureCall () const
 Returns true if this is a procedure call statement.
bool denotesOperator () const
 Returns true if this call is thru an operator.
virtual Location getLocation () const =0
 Returns the location of this subroutine call.
bool isAmbiguous () const
 Returns true if this call is ambiguous.
bool isUnambiguous () const
 Returns true if this call is unambiguous.
bool isPrimitive () const
bool isAttributeCall () const
 Returns true if the connective of this call is an attribute.
virtual void resolveConnective (SubroutineDecl *connective)
unsigned getNumArgs () const
unsigned getNumPositionalArgs () const
 Returns the number of positional arguments supplied to this call.
unsigned getNumKeyedArgs () const
 Returns the number of keyed arguments supplied to this call.
bool containsConnective (SubroutineType *srTy) const
 Returns true if this call contains a connective with the given type.
unsigned numConnectives () const
 Returns the number of connectives associated with this call.
AstasAst ()
 Converts this SubroutineCall into a raw Ast node.
const AstasAst () const
Call Types.

The following predicates provide a classification of calls from the perspective of the caller. For any given unambiguous call node, one (and only one) of the following predicates returns true. For an ambiguous call node all of the following predicates return false.



bool isLocalCall () const
bool isDirectCall () const
bool isAbstractCall () const
bool isForeignCall () const
Positional Argument Iterators.

Iterators over the positional arguments of a call.

Unlike the more specific arg_iterator, positional iterators are valid even when the call is ambiguous.



arg_iterator begin_positional ()
arg_iterator end_positional ()
const_arg_iterator begin_positional () const
const_arg_iterator end_positional () const

Static Public Member Functions

static bool classof (const Ast *node)
static bool classof (const FunctionCallExpr *node)
static bool classof (const ProcedureCallStmt *node)

Protected Member Functions

bool isCompatible (SubroutineDecl *decl) const
int argExprIndex (Expr *expr) const
int keyExprIndex (Expr *expr) const

Protected Attributes

SubroutineRefconnective
Expr ** arguments
KeywordSelector ** keyedArgs
unsigned numPositional
unsigned numKeys



typedef SubroutineRef::iterator connective_iterator
typedef
SubroutineRef::const_iterator 
const_connective_iterator
FunctionCallExprasFunctionCall ()
 Returns this as a FunctionCallExpr or null.
const FunctionCallExprasFunctionCall () const
ProcedureCallStmtasProcedureCall ()
 Returns this as a ProcedureCallStmt or null.
const ProcedureCallStmtasProcedureCall () const
const SubroutineDeclgetConnective (unsigned i) const
 Returns the i'th connective associated with this call.
SubroutineDeclgetConnective (unsigned i)
SubroutineDeclgetConnective ()
const SubroutineDeclgetConnective () const
connective_iterator begin_connectives ()
connective_iterator end_connectives ()
const_connective_iterator begin_connectives () const
const_connective_iterator end_connectives () const

Argument Iterators.

Iterators over the arguments of an unambiguous call.

These iterators can be accessed only when this call is unambiguous, otherwise an assertion will be raised.

An arg_iterator is used to traverse the full set of argument expressions in the order expected by the calls connective. In other words, any keyed argument expressions are presented in an order consistent with the underlying connective, not in the order as originally supplied to call.



typedef Expr ** arg_iterator
typedef const Expr *const * const_arg_iterator
arg_iterator begin_arguments ()
arg_iterator end_arguments ()
const_arg_iterator begin_arguments () const
const_arg_iterator end_arguments () const

KeywordSelector Iterators.



typedef KeywordSelector ** key_iterator
 Replaces the expression associated with the given iterator.
typedef KeywordSelector *const * const_key_iterator
 Replaces the expression associated with the given iterator.
key_iterator begin_keys ()
 Replaces the expression associated with the given iterator.
key_iterator end_keys ()
 Replaces the expression associated with the given iterator.
const_key_iterator begin_keys () const
 Replaces the expression associated with the given iterator.
const_key_iterator end_keys () const
 Replaces the expression associated with the given iterator.
void setArgument (arg_iterator I, Expr *expr)
 Replaces the expression associated with the given iterator.
void setArgument (key_iterator I, Expr *expr)
 Replaces the expression associated with the given iterator.

Detailed Description

The SubroutineCall class is a mixin which provides functionality common to both FunctionCallExpr and ProcedureCallStmt. Both nodes share a great deal of functionality but with one being an expression and the other being a statement they cannot both inherit from a common base class in the AST hierarchy -- hense this class.

Definition at line 28 of file SubroutineCall.h.


Member Typedef Documentation

Definition at line 222 of file SubroutineCall.h.

Iterators over the set of connectives associcated with this call expression.

Definition at line 196 of file SubroutineCall.h.

Definition at line 234 of file SubroutineCall.h.

Iterators over the set of connectives associcated with this call expression.

Definition at line 200 of file SubroutineCall.h.

Replaces the expression associated with the given iterator.

Definition at line 281 of file SubroutineCall.h.

Replaces the expression associated with the given iterator.

Definition at line 277 of file SubroutineCall.h.


Constructor & Destructor Documentation

SubroutineCall::SubroutineCall ( SubroutineRef connective,
Expr **  positionalArgs,
unsigned  numPositional,
KeywordSelector **  keyedArgs,
unsigned  numKeys 
)

The given SubroutineRef must be compatible with the concrete implementation of this class. If the implementation is a FunctionCallExpr, then the reference must be to a collection of FunctionDecl's.

If the reference contains more than one declaration, then this SubroutineCell is said to be ambiguous.

SubroutineCall's take ownership of the connective and all arguments.

Definition at line 21 of file SubroutineCall.cpp.

SubroutineCall::SubroutineCall ( SubroutineDecl connective,
Expr **  positionalArgs,
unsigned  numPositional,
KeywordSelector **  keyedArgs,
unsigned  numKeys 
)

Constructs a subroutine call over a single connective. This constructor always results in a fully resolved call node.

Definition at line 33 of file SubroutineCall.cpp.

SubroutineCall::~SubroutineCall (  )  [virtual]

Definition at line 90 of file SubroutineCall.cpp.


Member Function Documentation

int SubroutineCall::argExprIndex ( Expr expr  )  const [protected]

Returns the index of the given expression in the argument expression array, or -1 if the expression does not exists.

Definition at line 172 of file SubroutineCall.cpp.

const Ast * SubroutineCall::asAst (  )  const

Definition at line 149 of file SubroutineCall.cpp.

Ast * SubroutineCall::asAst (  ) 

Converts this SubroutineCall into a raw Ast node.

Definition at line 137 of file SubroutineCall.cpp.

const FunctionCallExpr * SubroutineCall::asFunctionCall (  )  const

Iterators over the set of connectives associcated with this call expression.

Definition at line 122 of file SubroutineCall.cpp.

FunctionCallExpr * SubroutineCall::asFunctionCall (  ) 

Returns this as a FunctionCallExpr or null.

Definition at line 117 of file SubroutineCall.cpp.

const ProcedureCallStmt * SubroutineCall::asProcedureCall (  )  const

Iterators over the set of connectives associcated with this call expression.

Definition at line 132 of file SubroutineCall.cpp.

ProcedureCallStmt * SubroutineCall::asProcedureCall (  ) 

Returns this as a ProcedureCallStmt or null.

Definition at line 127 of file SubroutineCall.cpp.

const_arg_iterator comma::SubroutineCall::begin_arguments (  )  const [inline]

Definition at line 235 of file SubroutineCall.h.

arg_iterator comma::SubroutineCall::begin_arguments (  )  [inline]

Definition at line 223 of file SubroutineCall.h.

const_connective_iterator comma::SubroutineCall::begin_connectives (  )  const [inline]

Iterators over the set of connectives associcated with this call expression.

Definition at line 201 of file SubroutineCall.h.

connective_iterator comma::SubroutineCall::begin_connectives (  )  [inline]

Iterators over the set of connectives associcated with this call expression.

Definition at line 197 of file SubroutineCall.h.

const_key_iterator comma::SubroutineCall::begin_keys (  )  const [inline]

Replaces the expression associated with the given iterator.

Definition at line 282 of file SubroutineCall.h.

key_iterator comma::SubroutineCall::begin_keys (  )  [inline]

Replaces the expression associated with the given iterator.

Definition at line 278 of file SubroutineCall.h.

const_arg_iterator comma::SubroutineCall::begin_positional (  )  const [inline]

Definition at line 261 of file SubroutineCall.h.

arg_iterator comma::SubroutineCall::begin_positional (  )  [inline]

Definition at line 254 of file SubroutineCall.h.

static bool comma::SubroutineCall::classof ( const ProcedureCallStmt node  )  [inline, static]

Definition at line 307 of file SubroutineCall.h.

static bool comma::SubroutineCall::classof ( const FunctionCallExpr node  )  [inline, static]

Definition at line 306 of file SubroutineCall.h.

static bool comma::SubroutineCall::classof ( const Ast node  )  [inline, static]

Reimplemented in comma::FunctionCallExpr, and comma::ProcedureCallStmt.

Definition at line 301 of file SubroutineCall.h.

bool comma::SubroutineCall::containsConnective ( SubroutineType srTy  )  const [inline]

Returns true if this call contains a connective with the given type.

Definition at line 159 of file SubroutineCall.h.

bool SubroutineCall::denotesOperator (  )  const

Returns true if this call is thru an operator.

Definition at line 108 of file SubroutineCall.cpp.

const_arg_iterator comma::SubroutineCall::end_arguments (  )  const [inline]

Definition at line 240 of file SubroutineCall.h.

arg_iterator comma::SubroutineCall::end_arguments (  )  [inline]

Definition at line 228 of file SubroutineCall.h.

const_connective_iterator comma::SubroutineCall::end_connectives (  )  const [inline]

Iterators over the set of connectives associcated with this call expression.

Definition at line 204 of file SubroutineCall.h.

connective_iterator comma::SubroutineCall::end_connectives (  )  [inline]

Iterators over the set of connectives associcated with this call expression.

Definition at line 198 of file SubroutineCall.h.

const_key_iterator comma::SubroutineCall::end_keys (  )  const [inline]

Replaces the expression associated with the given iterator.

Definition at line 285 of file SubroutineCall.h.

key_iterator comma::SubroutineCall::end_keys (  )  [inline]

Replaces the expression associated with the given iterator.

Definition at line 279 of file SubroutineCall.h.

const_arg_iterator comma::SubroutineCall::end_positional (  )  const [inline]

Definition at line 264 of file SubroutineCall.h.

arg_iterator comma::SubroutineCall::end_positional (  )  [inline]

Definition at line 257 of file SubroutineCall.h.

const SubroutineDecl* comma::SubroutineCall::getConnective (  )  const [inline]

Iterators over the set of connectives associcated with this call expression.

Reimplemented in comma::FunctionCallExpr, and comma::ProcedureCallStmt.

Definition at line 186 of file SubroutineCall.h.

SubroutineDecl* comma::SubroutineCall::getConnective (  )  [inline]

When this call is unambiguous, returns the unique subroutine declaration associated with this call. If this call is ambiguous, an assertion will fire.

Reimplemented in comma::FunctionCallExpr, and comma::ProcedureCallStmt.

Definition at line 180 of file SubroutineCall.h.

SubroutineDecl* comma::SubroutineCall::getConnective ( unsigned  i  )  [inline]

Iterators over the set of connectives associcated with this call expression.

Reimplemented in comma::FunctionCallExpr.

Definition at line 171 of file SubroutineCall.h.

const SubroutineDecl* comma::SubroutineCall::getConnective ( unsigned  i  )  const [inline]

Returns the i'th connective associated with this call.

Reimplemented in comma::FunctionCallExpr.

Definition at line 168 of file SubroutineCall.h.

virtual Location comma::SubroutineCall::getLocation (  )  const [pure virtual]

Returns the location of this subroutine call.

Implemented in comma::FunctionCallExpr, and comma::ProcedureCallStmt.

unsigned comma::SubroutineCall::getNumArgs (  )  const [inline]

Returns total the number of arguments supplied to this call. This is the sum of all positional and keyed arguments.

Definition at line 150 of file SubroutineCall.h.

unsigned comma::SubroutineCall::getNumKeyedArgs (  )  const [inline]

Returns the number of keyed arguments supplied to this call.

Definition at line 156 of file SubroutineCall.h.

unsigned comma::SubroutineCall::getNumPositionalArgs (  )  const [inline]

Returns the number of positional arguments supplied to this call.

Definition at line 153 of file SubroutineCall.h.

bool SubroutineCall::isAbstractCall (  )  const

Returns true if this is an abstract call.

A call is abstract if it references a subroutine declaration provided by an abstract domain.

Definition at line 239 of file SubroutineCall.cpp.

bool SubroutineCall::isaFunctionCall (  )  const

Returns true if this is a function call expression.

Definition at line 98 of file SubroutineCall.cpp.

bool comma::SubroutineCall::isAmbiguous (  )  const [inline]

Returns true if this call is ambiguous.

Definition at line 77 of file SubroutineCall.h.

bool SubroutineCall::isaProcedureCall (  )  const

Returns true if this is a procedure call statement.

Definition at line 103 of file SubroutineCall.cpp.

bool SubroutineCall::isAttributeCall (  )  const

Returns true if the connective of this call is an attribute.

Definition at line 212 of file SubroutineCall.cpp.

bool SubroutineCall::isCompatible ( SubroutineDecl decl  )  const [protected]

Returns true if the given declaration is compatible with this kind of call.

Definition at line 154 of file SubroutineCall.cpp.

bool SubroutineCall::isDirectCall (  )  const

Returns true if this is a direct call.

A direct call is one which references a subroutine declaration provided by a concrete (non-abstract) domain, and is not a local call.

Definition at line 217 of file SubroutineCall.cpp.

bool SubroutineCall::isForeignCall (  )  const

Returns true if this is a foreign call.

A foreign call is one which references a subroutine declaration which has an Import pragma attached to it.

Definition at line 249 of file SubroutineCall.cpp.

bool SubroutineCall::isLocalCall (  )  const

Returns true if this is a local call.

A local call is one which references a subroutine declaration which is internal to a capsule. A consequence of beeing local is that callee must be local to the capsule as well.

Definition at line 227 of file SubroutineCall.cpp.

bool comma::SubroutineCall::isPrimitive (  )  const [inline]

Returns true if this call is primitive.

This method returns true iff the call has been resolved (that is, isUnambiguous() returns true), and if the connective of this call denotes a primitive operation.

Definition at line 89 of file SubroutineCall.h.

bool comma::SubroutineCall::isUnambiguous (  )  const [inline]

Returns true if this call is unambiguous.

Definition at line 82 of file SubroutineCall.h.

int SubroutineCall::keyExprIndex ( Expr expr  )  const [protected]

Returns the index of the given expression in the keyed argument array, or -1 if the expression does not exists.

Definition at line 181 of file SubroutineCall.cpp.

unsigned comma::SubroutineCall::numConnectives (  )  const [inline]

Returns the number of connectives associated with this call.

Definition at line 164 of file SubroutineCall.h.

void SubroutineCall::resolveConnective ( SubroutineDecl connective  )  [virtual]

Resolved the connective for this call.

The supplied subroutine declaration must accept the exact number of arguments this call supplies and be compatible with the type of call. Furthermore, if this call was made with keyed arguments, the supplied declaration must accept the format of this call. In particular:

  • For each keyword argument supplied to this call, the declaration must provide a matching keyword.
  • The formal position of a keyed argument must be greater than the number of positional parameters supplied to this call.

Provided that the supplied connective meets these constraints, this call becomes unambiguous, and the full set of arguments becomes available thru the arg_iterator interface.

Definition at line 162 of file SubroutineCall.cpp.

void SubroutineCall::setArgument ( key_iterator  I,
Expr expr 
)

Replaces the expression associated with the given iterator.

Definition at line 200 of file SubroutineCall.cpp.

void SubroutineCall::setArgument ( arg_iterator  I,
Expr expr 
)

Replaces the expression associated with the given iterator.

Definition at line 189 of file SubroutineCall.cpp.


Member Data Documentation

Definition at line 311 of file SubroutineCall.h.

Definition at line 310 of file SubroutineCall.h.

Definition at line 312 of file SubroutineCall.h.

unsigned comma::SubroutineCall::numKeys [protected]

Definition at line 314 of file SubroutineCall.h.

Definition at line 313 of file SubroutineCall.h.


The documentation for this class was generated from the following files:

Generated on 1 Feb 2010 for Comma by  doxygen 1.6.1