private string GetTypeTemplateName(SimpleTypeReference type, int position)
        {
            TypeTarget target = type.Resolve(_targets) as TypeTarget;

            if (target != null)
            {
                IList <string> templates = target.Templates;
                if (templates.Count > position)
                {
                    return(templates[position]);
                }
                else if (target.OuterType != null)
                {
                    return(GetTypeTemplateName(target.OuterType, position));
                }
                else
                {
                    return("UTT");
                }
            }
            else
            {
                throw new InvalidOperationException(String.Format("Unknown type reference '{0}'", type.Id));
            }
        }
        private void WriteSimpleType(SimpleTypeReference simple, ReferenceLinkDisplayOptions options,
                                     bool showOuterType, XmlWriter writer)
        {
            TypeTarget type = simple.Resolve(_targets) as TypeTarget;

            if (type != null)
            {
                WriteTypeTarget(type, options, showOuterType, writer);
            }
            else
            {
                ReferenceTextUtilities.WriteSimpleTypeReference(simple, options, writer);
            }
        }
Esempio n. 3
0
 public void TypeLookupThroughUsing()
 {
     _compilationUnit.UsingDirectives.Add(new UsingNamespaceDirective("System"));
     var type = new SimpleTypeReference("Math");
     var result = type.Resolve(_compilationUnit.GetScope());
     Assert.IsInstanceOfType(result, typeof(MemberResolveResult));
     Assert.IsInstanceOfType(result.ScopeProvider, typeof(TypeDefinition));
     Assert.AreEqual("System.Math", ((TypeDefinition)result.ScopeProvider).FullName);
 }