view trunk/src/dil/Scope.d @ 532:50e64bab9c7a

Renamed InformationManager to InfoManager.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Mon, 17 Dec 2007 16:10:08 +0100
parents 6ddff941862a
children 709e223a8eb9
line wrap: on
line source

/++
  Author: Aziz Köksal
  License: GPL3
+/
module dil.Scope;
import dil.Symbol;
import dil.Information;
import common;

class Scope
{
  Scope parent; /// The surrounding scope.
  InfoManager infoMan; /// Collects errors reported during the semantic phase.

  this()
  {
  }

  /++
    Find an identifier in this scope.
  +/
  Symbol find(char[] ident)
  {
    return null;
  }

  /++
    Add a symbol to this scope.
  +/
  void add(Symbol sym)
  {

  }

  /++
    Create a new inner scope.
  +/
  Scope push()
  {
    auto sc = new Scope();
    sc.parent = this;
    return sc;
  }

  /++
    Destroy this scope and return the outer scope.
  +/
  Scope pop()
  {
    auto sc = parent;
    // delete this;
    return sc;
  }

  import dil.Information;
  import dil.Messages;
  import dil.Token;
  void error(Token* token, MID mid)
  {
    auto location = token.getLocation();
    auto error = new SemanticError(location, GetMsg(mid));
//     infoMan.add(error);
  }
}