(* Copyright (C) 1989, Digital Equipment Corporation *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* File: CallStmt.m3 *) (* Last modified on Tue Apr 10 22:52:56 1990 by muller *) (* modified on Sat Feb 10 20:33:57 1990 by kalsow *) MODULE CallStmt; IMPORT Expr, Stmt, StmtRep, Error, Type, Void, Temp; TYPE P = Stmt.T OBJECT e : Expr.T; METHODS bind := Bind; check := Check; precompile := Precompile; compile := Compile; END; PROCEDURE New (e: Expr.T): Stmt.T = VAR p: P; BEGIN p := NEW (P); StmtRep.Init (p); p.e := e; RETURN p; END New; PROCEDURE Bind (p: P) = BEGIN Expr.Bind (p.e); END Bind; PROCEDURE Check (p: P) = VAR t: Type.T; BEGIN Expr.TypeCheck (p.e); t := Type.Base (Expr.TypeOf (p.e)); IF (t # NIL) AND (t # Void.T) THEN Error.Msg ("Expression is not a statement"); END; END Check; PROCEDURE Precompile (<*UNUSED*> p: P) = BEGIN END Precompile; PROCEDURE Compile (p: P): Stmt.Outcomes = VAR t: Temp.T; BEGIN t := Expr.Compile (p.e); (*** Emit.OpT ("@;\n", t); ***) (*** Temp.Free (t); ***) RETURN Stmt.Outcomes {Stmt.Outcome.FallThrough}; END Compile; BEGIN END CallStmt.