Ejemplo n.º 1
0
        public ITypeBuildingContext?ResolveType(string initialUnitPath, ITypeGenerator typeGenerator, ITypeInfo typeInfo, ITypeScriptUnitFactory unitFactory)
        {
            if (typeInfo.Equals(TypeInfo.From <MethodRootType>()) || typeInfo.Equals(TypeInfo.From <NullableReferenceMethodType>()))
            {
                return(new MethodTypeBuildingContext(unitFactory.GetOrCreateTypeUnit(initialUnitPath), typeInfo));
            }

            if (CollectionTypeBuildingContext.Accept(typeInfo))
            {
                return(new CollectionTypeBuildingContext(typeInfo));
            }

            if (typeInfo.Equals(TypeInfo.From <TimeSpan>()))
            {
                return(new StringBuildingContext(typeInfo));
            }

            if (typeInfo.IsAbstract)
            {
                return(new AbstractTypeBuildingContext(unitFactory.GetOrCreateTypeUnit(initialUnitPath), typeInfo));
            }

            return(null);
        }
Ejemplo n.º 2
0
        public ITypeBuildingContext ResolveType(string initialUnitPath, Type type, ITypeScriptUnitFactory unitFactory)
        {
            if (type == typeof(MethodRootType))
            {
                return(new MethodTypeBuildingContext(unitFactory.GetOrCreateTypeUnit(initialUnitPath), type));
            }

            if (CollectionTypeBuildingContext.Accept(type))
            {
                return(new CollectionTypeBuildingContext(type));
            }

            if (type == typeof(TimeSpan))
            {
                return(new StringBuildingContext());
            }

            if (type.IsAbstract)
            {
                return(new AbstractTypeBuildingContext(unitFactory.GetOrCreateTypeUnit(initialUnitPath), type));
            }

            return(null);
        }