File: TypeExpr.m3 Last modified on Fri Feb 24 16:47:54 PST 1995 by kalsow modified on Tue Aug 28 06:03:04 1990 by muller
MODULE; IMPORT M3, M3ID, Expr, ExprRep, Type, Value, NamedExpr, QualifyExpr; TYPE P = Expr.T BRANDED "TypeExpr.P"OBJECT t: Type.T; OVERRIDES typeOf := TypeOf; check := Check; need_addr := ExprRep.NotAddressable; prep := Compile; compile := Compile; prepLV := ExprRep.NotLValue; compileLV := ExprRep.NotLValue; prepBR := ExprRep.NotBoolean; compileBR := ExprRep.NotBoolean; evaluate := ExprRep.Self; isEqual := EqCheck; getBounds := ExprRep.NoBounds; isWritable := ExprRep.IsNever; isDesignator := ExprRep.IsNever; isZeroes := ExprRep.IsNever; genFPLiteral := ExprRep.NoFPLiteral; prepLiteral := ExprRep.NoPrepLiteral; genLiteral := ExprRep.NoLiteral; note_write := ExprRep.NotWritable; END; PROCEDURE TypeExpr New (t: Type.T): Expr.T = VAR p := NEW (P); BEGIN ExprRep.Init (p); p.t := t; p.type := NIL; RETURN p; END New; PROCEDURESplit (e: Expr.T; VAR t: Type.T): BOOLEAN = VAR obj: Value.T; name: M3ID.T; BEGIN TYPECASE e OF | NULL => RETURN FALSE; | P(p) => t := p.t; RETURN TRUE; ELSE IF (NamedExpr.Split (e, name, obj) OR QualifyExpr.Split (e, obj)) AND (Value.ClassOf (obj) = Value.Class.Type) THEN t := Value.ToType (obj); RETURN TRUE; ELSE RETURN FALSE; END; END; END Split; PROCEDURETypeOf (<*UNUSED*> p: P): Type.T = BEGIN RETURN NIL; END TypeOf; PROCEDURECheck (p: P; <*UNUSED*> VAR cs: Expr.CheckState) = BEGIN p.t := Type.Check (p.t); END Check; PROCEDUREEqCheck (a: P; e: Expr.T; x: M3.EqAssumption): BOOLEAN = BEGIN TYPECASE e OF | NULL => RETURN FALSE; | P(b) => RETURN Type.IsEqual (a.t, b.t, x); ELSE RETURN FALSE; END; END EqCheck; PROCEDURECompile (<*UNUSED*> p: P) = BEGIN <*ASSERT FALSE*> END Compile; BEGIN END TypeExpr.