Zen
A cross-platform functional programming language

Scope Class Reference

AST Node representing Variable Scope. More...

#include <Ast.hpp>

Inheritance diagram for Scope:
Node

List of all members.

Public Types

enum  Type { InParam, Block, Continuation }
 

The type of the scope.

More...

Public Member Functions

 Scope (const Type &type)
 Default constructor.
const TypegetType () const
 Returns the scope type.
const Ast::VariableDefaddDef (const Ast::VariableDef &child)
 Adds a VariableDef to the scope.
const VariableDefMapgetDefList () const
 Returns a reference to the VariableDef list.

Private Attributes

const Type _type
 The type of this scope.
VariableDefMap _defList
 The VariableDef list managed by this class.

Detailed Description

AST Node representing Variable Scope.

Every VariableDef has a scope within which it is visible and alive. For example, a local variable's scope is the compound block sorrounding the variable declaration, or a for() variable's scope is the statement's compound block. A continuation is a sequence of named closures, each of which is represented as a named variable that exists for the lifetime of the continuation.


Member Enumeration Documentation

enum Type

The type of the scope.

Enumerator:
Block 

In-parameter scope of a function.

Continuation 

Compound statement bock scope.


Constructor & Destructor Documentation

Scope ( const Type type) [inline]

Default constructor.

Parameters:
typeThe type of the scope.

Member Function Documentation

const Ast::VariableDef& addDef ( const Ast::VariableDef child) [inline]

Adds a VariableDef to the scope.

Parameters:
childVariableDef to add
Returns:
A reference to the item just added.
const VariableDefMap& getDefList ( ) const [inline]

Returns a reference to the VariableDef list.

Returns:
Reference to the VariableDef list.
const Type& getType ( ) const [inline]

Returns the scope type.

Returns:
The scope type

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines