expression_function Class Reference

#include <function.h>

Inheritance diagram for expression_function:

expression List of all members.

Public Member Functions

virtual ~expression_function ()
 expression_function (const location &locn, symbol_function *sfp, translator_compile *cntxt)

Protected Member Functions

void traversal (int pprec)
void logical_traversal (int pprec, label::pointer &true_branch, label::pointer &false_branch, bool fall_through_preference)
expression::pointer assignment_expression_factory (const expression::pointer &rhs) const
expression::pointer optimize () const
int get_precedence () const
type::pointer get_type () const
bool is_lvalue () const
side_effect_t has_side_effect () const
expression::pointer function_call_expression_factory (expression_list *args)

Private Member Functions

 expression_function ()
 expression_function (const expression_function &)
expression_functionoperator= (const expression_function &)

Private Attributes

translator_compilecode
symbol_functionsfp

Detailed Description

The expression_function class is used to represent a simple function name in an expression. It is a precursor to creating a function call expression, or a function return value assignment. Only an error will see this expression attempt to be compiled.

Definition at line 35 of file function.h.


Constructor & Destructor Documentation

virtual expression_function::~expression_function (  )  [virtual]

The destructor.

expression_function::expression_function ( const location locn,
symbol_function sfp,
translator_compile cntxt 
)

The constructor.

expression_function::expression_function (  )  [private]

The default constructor. Do not use.

expression_function::expression_function ( const expression_function  )  [private]

The copy constructor. Do not use.


Member Function Documentation

void expression_function::traversal ( int  pprec  )  [protected, virtual]

The traversal method may be used to traverse each of the declaractions in the list.

Parameters:
pprec The precedence of the parent expression node.

Implements expression.

void expression_function::logical_traversal ( int  pprec,
label::pointer true_branch,
label::pointer false_branch,
bool  fall_through_preference 
) [protected]

expression::pointer expression_function::assignment_expression_factory ( const expression::pointer rhs  )  const [protected, virtual]

The assignment_expression_factory method is used by the assignment_expression method to build an assignment expression node.

The default implementation prints and error saying that the left hand side of the assignment is inappropriate.

Parameters:
rhs The right hand side of the assignment ("this" is the left hand side).
Note:
The parser will delete this expression tree once the assignment tree has been manufactored. If you wish to keep using this tree, you will need to self() it.

Reimplemented from expression.

expression::pointer expression_function::optimize (  )  const [protected, virtual]

The optimize method may be used to evaluate constant expressions, or substitute more efficient expressions.

This is intended to be called by the translator:: expression_statement method, or similar, where the expression is in its final form, and will get no deeper. In other words, when all available information has been provided.

There is no default implementation, even though most optimize implementations return self(), because this gives the compiler no opportunity to remind the authors of new classes that they have forgotten something.

Returns:
If the expression tree is not constant, or it is already as reduced as it can get, it returns itself. Otherwise, it returns a new expression node.

Implements expression.

int expression_function::get_precedence (  )  const [protected, virtual]

The get_precedence method is used to obtain the precedence of this expression node.

The highest precedence has the highest absolute value, the lowest precedence gets the lowest absolute value.

Implements expression.

type::pointer expression_function::get_type (  )  const [protected, virtual]

The get_type method is used to get the type of this expression.

Implements expression.

bool expression_function::is_lvalue (  )  const [protected, virtual]

The is_lvalue method is used to determine whether or not this expression is suitable to appear on the left hand side of an assignment expression.

Implements expression.

side_effect_t expression_function::has_side_effect (  )  const [protected, virtual]

The has_side_effect method is used to determine if an expression has any effect. It is used by the parse to produce "statement with no effect" warnings.

Implements expression.

expression::pointer expression_function::function_call_expression_factory ( expression_list args  )  [protected, virtual]

The function_call_expression_factory method is used by the function_call_expression method to build a function call expression node.

The default implementation prints and error saying that the left hand side of the function_call is inappropriate.

Parameters:
args All of the arguments of the function call, including the function name as the first argument (usually [0] == this).
Note:
The parser will delete this expression tree once the function_call tree has been manufactured. If you wish to keep using this tree, you will need to self() it.

Reimplemented from expression.

expression_function& expression_function::operator= ( const expression_function  )  [private]

The assignment operator. Do not use.


Member Data Documentation

translator_compile& expression_function::code [private]

The code instance variable is used to remember where to send our generated code.

Definition at line 86 of file function.h.

symbol_function* expression_function::sfp [private]

The sfp instance variable is used to remember the function being referred to.

Definition at line 92 of file function.h.


The documentation for this class was generated from the following file:
Generated on Sun Feb 25 01:27:11 2007 for UCSDp-SystemCrossCompiler by  doxygen 1.5.1