File: EvalStmt.m3 Last modified on Fri Jun 24 12:35:51 PDT 1994 by kalsow modified on Tue Apr 10 22:53:33 1990 by muller
MODULE; IMPORT CG, Expr, Token, Scanner, Stmt, StmtRep, Error, Type; TYPE P = Stmt.T OBJECT e : Expr.T; OVERRIDES check := Check; compile := Compile; outcomes := GetOutcome; END; PROCEDURE EvalStmt Parse (): Stmt.T = VAR p: P; BEGIN p := NEW (P); StmtRep.Init (p); Scanner.Match (Token.T.tEVAL); p.e := Expr.Parse (); RETURN p; END Parse; PROCEDURECheck (p: P; VAR cs: Stmt.CheckState) = BEGIN Expr.TypeCheck (p.e, cs); IF (Expr.TypeOf (p.e) = NIL) THEN Error.Msg ("expression doesn\'t have a value"); END; END Check; PROCEDURECompile (p: P): Stmt.Outcomes = BEGIN Expr.Prep (p.e); Expr.Compile (p.e); CG.Discard (Type.CGType (Expr.TypeOf (p.e))); RETURN Stmt.Outcomes {Stmt.Outcome.FallThrough}; END Compile; PROCEDUREGetOutcome (<*UNUSED*> p: P): Stmt.Outcomes = BEGIN RETURN Stmt.Outcomes {Stmt.Outcome.FallThrough}; END GetOutcome; BEGIN END EvalStmt.