Esempio n. 1
0
        public string GetReferencedName(DeclarationBase type)
        {
            string result;

            if (_cache.TryGetValue(type, out result))
            {
                return(result);
            }
            var m = FindModule(type);

            if (m != null)
            {
                result = m.Item1;
                if (!String.IsNullOrEmpty(result))
                {
                    result = result + ".";
                }
                result = result + type.Name;
            }
            else
            {
                result = GetFailedName(type.Name);
            }
            _cache[type] = result;
            return(result);
        }
Esempio n. 2
0
 public override void VisitGenericParameters(DeclarationBase decl)
 {
     if (decl.IsGeneric)
     {
         Formatter.Write("<");
         base.VisitGenericParameters(decl);
         Formatter.Write(">");
     }
 }
Esempio n. 3
0
 public static IEnumerable <TypescriptTypeReference> GetExtends(this DeclarationBase decl)
 {
     if (decl is InterfaceType)
     {
         return(((InterfaceType)decl).ExtendsTypes);
     }
     else if (decl is ClassType)
     {
         return((new[] { ((ClassType)decl).Extends }).Where(x => x != null));
     }
     else
     {
         throw new NotImplementedException("Cannot get extends from " + decl);
     }
 }
Esempio n. 4
0
 public void Generate(DeclarationBase decl)
 {
     if (decl is ClassType)
     {
         Generate((ClassType)decl);
     }
     else if (decl is InterfaceType)
     {
         Generate((InterfaceType)decl);
     }
     else
     {
         throw new ArgumentOutOfRangeException();
     }
 }
Esempio n. 5
0
 public DeclarationModuleElement(DeclarationBase decl)
 {
     Declaration = decl;
 }
Esempio n. 6
0
 private void GenerateReference(DeclarationBase type)
 {
     Formatter.Write(NameResolver.GetReferencedName(type));
 }