Exemple #1
0
        internal static KotlinTypeAlias FromProtobuf(TypeAlias ta, JvmNameResolver resolver)
        {
            if (ta is null)
            {
                return(null);
            }

            return(new KotlinTypeAlias {
                Flags = ta.Flags,
                Name = resolver.GetString(ta.Name),
                TypeParameters = ta.TypeParameters?.Select(tp => KotlinTypeParameter.FromProtobuf(tp, resolver)).ToList(),
                UnderlyingType = KotlinType.FromProtobuf(ta.UnderlyingType, resolver),
                UnderlyingTypeId = ta.UnderlyingTypeId,
                ExpandedType = KotlinType.FromProtobuf(ta.ExpandedType, resolver),
                ExpandedTypeId = ta.ExpandedTypeId,
                VersionRequirements = ta.VersionRequirements
            });
        }
Exemple #2
0
        internal static KotlinFunction FromProtobuf(Function f, JvmNameResolver resolver)
        {
            if (f is null)
            {
                return(null);
            }

            return(new KotlinFunction {
                Flags = f.Flags,
                Name = resolver.GetString(f.Name),
                ReturnType = KotlinType.FromProtobuf(f.ReturnType, resolver),
                ReturnTypeId = f.ReturnTypeId,
                ReceiverType = KotlinType.FromProtobuf(f.ReceiverType, resolver),
                ReceiverTypeId = f.ReceiverTypeId,
                TypeParameters = f.TypeParameters?.Select(tp => KotlinTypeParameter.FromProtobuf(tp, resolver)).ToList(),
                ValueParameters = f.ValueParameters?.Select(vp => KotlinValueParameter.FromProtobuf(vp, resolver)).ToList(),
                VersionRequirements = f.VersionRequirements
            });
        }
Exemple #3
0
 internal static KotlinClass FromProtobuf(Class c, JvmNameResolver resolver)
 {
     return(new KotlinClass {
         CompanionObjectName = c.CompanionObjectName > 0 ? resolver.GetString(c.CompanionObjectName) : null,
         Constructors = c.Constructors?.Select(ctor => KotlinConstructor.FromProtobuf(ctor, resolver)).ToList(),
         EnumEntries = c.EnumEntries?.Select(e => resolver.GetString(e.Name)).ToList(),
         Flags = (KotlinClassFlags)c.Flags,
         FullyQualifiedName = c.FqName > 0 ? resolver.GetString(c.FqName) : null,
         Functions = c.Functions?.Select(f => KotlinFunction.FromProtobuf(f, resolver)).ToList(),
         NestedClassNames = c.NestedClassNames?.Select(n => resolver.GetString(n)).ToList(),
         Properties = c.Properties?.Select(p => KotlinProperty.FromProtobuf(p, resolver)).ToList(),
         SealedSubclassFullyQualifiedNames = c.SealedSubclassFqNames?.Select(n => resolver.GetString(n)).ToList(),
         SuperTypeIds = c.SupertypeIds?.Select(n => resolver.GetString(n)).ToList(),
         SuperTypes = c.Supertypes?.Select(st => KotlinType.FromProtobuf(st, resolver)).ToList(),
         TypeAliases = c.TypeAlias?.Select(tp => KotlinTypeAlias.FromProtobuf(tp, resolver)).ToList(),
         TypeParameters = c.TypeParameters?.Select(tp => KotlinTypeParameter.FromProtobuf(tp, resolver)).ToList(),
         VersionRequirements = c.VersionRequirements,
         TypeTable = KotlinTypeTable.FromProtobuf(c.TypeTable, resolver),
         VersionRequirementTable = KotlinVersionRequirementTable.FromProtobuf(c.VersionRequirementTable, resolver)
     });
 }
Exemple #4
0
        internal static KotlinProperty FromProtobuf(Property p, JvmNameResolver resolver)
        {
            if (p is null)
            {
                return(null);
            }

            return(new KotlinProperty {
                Flags = p.Flags,
                Name = resolver.GetString(p.Name),
                ReturnTypeId = p.ReturnTypeId,
                ReturnType = KotlinType.FromProtobuf(p.ReturnType, resolver),
                ReceiverType = KotlinType.FromProtobuf(p.ReceiverType, resolver),
                ReceiverTypeId = p.ReceiverTypeId,
                SetterValueParameter = KotlinValueParameter.FromProtobuf(p.SetterValueParameter, resolver),
                GetterFlags = p.GetterFlags,
                SetterFlags = p.SetterFlags,
                TypeParameters = p.TypeParameters?.Select(tp => KotlinTypeParameter.FromProtobuf(tp, resolver)).ToList(),
                VersionRequirements = p.VersionRequirements
            });
        }