From e731520be5d43059b5b87ffc8e1b249e4a824a9a Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Sat, 20 Nov 2010 22:04:34 -0800 Subject: Add helper function to double-check non-null types. --- src/comp/middle/trans.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/comp') diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 091896fa..b93235f2 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -239,6 +239,12 @@ fn T_taskptr() -> TypeRef { } fn type_of(@trans_ctxt cx, @typeck.ty t) -> TypeRef { + let TypeRef llty = type_of_inner(cx, t); + check (llty as int != 0); + ret llty; +} + +fn type_of_inner(@trans_ctxt cx, @typeck.ty t) -> TypeRef { alt (t.struct) { case (typeck.ty_nil) { ret T_nil(); } case (typeck.ty_bool) { ret T_bool(); } -- cgit v1.2.3