diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-08-25 12:42:32 -0700 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-09-07 10:46:36 -0700 |
commit | 66743bea14568eb52617df3e9fb973a4f9be92eb (patch) | |
tree | 60c2fc5e053e0b93b5d3494f9aa61c73de20e83b | |
parent | cb1059786df114cae72b8baea038dc5ea638269d (diff) |
Add the TypeKind name to the IR graphviz output
-rw-r--r-- | src/ir/ty.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/ir/ty.rs b/src/ir/ty.rs index b588dbb4..8cfbde10 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -443,6 +443,8 @@ impl DotAttributes for TypeKind { where W: io::Write, { + writeln!(out, "<tr><td>type kind</td><td>{}</td></tr>", self.kind_name())?; + if let TypeKind::Comp(ref comp) = *self { comp.dot_attributes(ctx, out)?; } @@ -451,6 +453,35 @@ impl DotAttributes for TypeKind { } } +impl TypeKind { + fn kind_name(&self) -> &'static str { + match *self { + TypeKind::Void => "Void", + TypeKind::NullPtr => "NullPtr", + TypeKind::Comp(..) => "Comp", + TypeKind::Opaque => "Opaque", + TypeKind::Int(..) => "Int", + TypeKind::Float(..) => "Float", + TypeKind::Complex(..) => "Complex", + TypeKind::Alias(..) => "Alias", + TypeKind::TemplateAlias(..) => "TemplateAlias", + TypeKind::Array(..) => "Array", + TypeKind::Function(..) => "Function", + TypeKind::Enum(..) => "Enum", + TypeKind::Pointer(..) => "Pointer", + TypeKind::BlockPointer => "BlockPointer", + TypeKind::Reference(..) => "Reference", + TypeKind::TemplateInstantiation(..) => "TemplateInstantiation", + TypeKind::UnresolvedTypeRef(..) => "UnresolvedTypeRef", + TypeKind::ResolvedTypeRef(..) => "ResolvedTypeRef", + TypeKind::TypeParam => "TypeParam", + TypeKind::ObjCInterface(..) => "ObjCInterface", + TypeKind::ObjCId => "ObjCId", + TypeKind::ObjCSel => "ObjCSel", + } + } +} + #[test] fn is_invalid_type_param_valid() { let ty = Type::new(Some("foo".into()), None, TypeKind::TypeParam, false); |