LocChk.cxx File Reference

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <dirent.h>
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <libsherpa/UExcept.hxx>
#include "AST.hxx"
#include "Type.hxx"
#include "inter-pass.hxx"

Go to the source code of this file.

Functions

static bool LocChk (std::ostream &errStream, bool &errFree, shared_ptr< AST > ast, bool inSET)


Function Documentation

static bool LocChk ( std::ostream &  errStream,
bool &  errFree,
shared_ptr< AST ast,
bool  inSET 
) [static]

Return whether the expression constitutes an assignable location (an l-value).

The general idea here is to prevent assignment to intermediate expressions, though the implementation is haphazard.

Rules: 1. If e is an identifier node, then e is a location.

2. If e is a reference type, then (deref e) is a location. By extension, if v is a vector , then v[i] is a location.

3. If e is an array reference a[i], then e is a location exactly if a is a location.

4. s.f is a location exactly if s is a location.

5. Nothing else is a location, though switch and try require some special handling.

Generally, we do not require a location, but we *do* require one within the l-value argument to set!.

Bug:
Not clear that this should return true. Swaroop?

Definition at line 79 of file LocChk.cxx.

References at_array_nth, at_deref, at_fqCtr, at_ident, at_sel_ctr, at_select, at_setbang, at_try, at_uswitch, at_vector_nth, and IGNORE.


Generated on Thu May 17 23:59:16 2012 for BitC Compiler by  doxygen 1.4.7