Mercurial > projects > dil
diff trunk/src/dil/semantic/Interpreter.d @ 798:c24be8d4f6ab
Added documentation comments.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 01 Mar 2008 02:53:06 +0100 |
parents | 5fe89bb8cbdd |
children |
line wrap: on
line diff
--- a/trunk/src/dil/semantic/Interpreter.d Fri Feb 29 22:51:24 2008 +0100 +++ b/trunk/src/dil/semantic/Interpreter.d Sat Mar 01 02:53:06 2008 +0100 @@ -18,9 +18,10 @@ dil.semantic.Types; import dil.Information; +/// Used for compile-time evaluation of expressions. class Interpreter : Visitor { - Scope scop; + // Scope scop; InfoManager infoMan; static class Result : Expression @@ -36,23 +37,27 @@ NAR.type = Types.Error; } - static Expression interpret(Expression e, InfoManager infoMan, Scope scop) + /// Evaluates the expression e. + /// Returns: NAR or a value. + static Expression interpret(Expression e, InfoManager infoMan/+, Scope scop+/) { - return (new Interpreter(scop, infoMan)).start(e); + return (new Interpreter(/+scop,+/ infoMan)).eval(e); } - this(Scope scop, InfoManager infoMan) + /// Constructs an Interpreter object. + this(/+Scope scop, +/InfoManager infoMan) { - this.scop = scop; + // this.scop = scop; this.infoMan = infoMan; } - /// Start interpretation. - Expression start(Expression e) + /// Start evaluation. + Expression eval(Expression e) { return e; } + /// Returns true if e is immutable. bool isImmutable(Expression e) { switch (e.kind)