expression_check_range Class Reference

#include <check_range.h>

Inheritance diagram for expression_check_range:

expression List of all members.

Public Member Functions

virtual ~expression_check_range ()
 expression_check_range (const expression::pointer &value, const expression::pointer &minimum, const expression::pointer &maximum, translator_compile *cntxt)

Protected Member Functions

expression::pointer optimize () const
void traversal (int pprec)
void logical_traversal (int pprec, label::pointer &true_branch, label::pointer &false_branch, bool fall_through_preference)
int get_precedence () const
type::pointer get_type () const
bool is_lvalue () const
side_effect_t has_side_effect () const
const symbolget_symbol_hint () const

Private Member Functions

 expression_check_range ()
 expression_check_range (const expression_check_range &)
expression_check_rangeoperator= (const expression_check_range &)

Private Attributes

translator_compilecode
expression::pointer value
expression::pointer minimum
expression::pointer maximum

Detailed Description

The expression_check_range class is used to represent code to check the range of an integer value before assigning it to a subrange typed variable, or using it as an array index.

Definition at line 33 of file check_range.h.


Constructor & Destructor Documentation

virtual expression_check_range::~expression_check_range (  )  [virtual]

The destructor.

expression_check_range::expression_check_range ( const expression::pointer value,
const expression::pointer minimum,
const expression::pointer maximum,
translator_compile cntxt 
)

The constructor.

expression_check_range::expression_check_range (  )  [private]

The default constructor. Do not use.

expression_check_range::expression_check_range ( const expression_check_range  )  [private]

The copy constructor. Do not use.


Member Function Documentation

expression::pointer expression_check_range::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.

void expression_check_range::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_check_range::logical_traversal ( int  pprec,
label::pointer true_branch,
label::pointer false_branch,
bool  fall_through_preference 
) [protected]

int expression_check_range::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_check_range::get_type (  )  const [protected, virtual]

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

Implements expression.

bool expression_check_range::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_check_range::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.

const symbol* expression_check_range::get_symbol_hint (  )  const [protected, virtual]

The get_symbol_hint method is used to get the symbol associated with the expression.

Returns:
pointer to a symbol, or NULL if there is no hint present

Reimplemented from expression.

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

The assignment operator. Do not use.


Member Data Documentation

translator_compile& expression_check_range::code [private]

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

Definition at line 80 of file check_range.h.

expression::pointer expression_check_range::value [private]

The value instance variable is used to remember the value of this expression.

Definition at line 86 of file check_range.h.

expression::pointer expression_check_range::minimum [private]

The minimum instance variable is used to remember the minimum accepttable value.

Definition at line 92 of file check_range.h.

expression::pointer expression_check_range::maximum [private]

The maximum instance variable is used to remember the maximum acceptable value.

Definition at line 98 of file check_range.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