Refactoring. Move flexible type factory to deserialization module.
This commit is contained in:
+6
-5
@@ -506,15 +506,16 @@ public class DescriptorSerializer {
|
||||
}
|
||||
|
||||
if (FlexibleTypesKt.isFlexible(type)) {
|
||||
Flexibility flexibility = FlexibleTypesKt.flexibility(type);
|
||||
DelegatingFlexibleType flexibleType = (DelegatingFlexibleType) FlexibleTypesKt.flexibility(type);
|
||||
|
||||
ProtoBuf.Type.Builder lowerBound = type(flexibility.getLowerBound());
|
||||
lowerBound.setFlexibleTypeCapabilitiesId(getStringTable().getStringIndex(flexibility.getFactory().getId()));
|
||||
ProtoBuf.Type.Builder lowerBound = type(flexibleType.getLowerBound());
|
||||
ProtoBuf.Type.Builder upperBound = type(flexibleType.getUpperBound());
|
||||
extension.serializeFlexibleType(flexibleType, lowerBound, upperBound);
|
||||
if (useTypeTable()) {
|
||||
lowerBound.setFlexibleUpperBoundId(typeId(flexibility.getUpperBound()));
|
||||
lowerBound.setFlexibleUpperBoundId(typeTable.get(upperBound));
|
||||
}
|
||||
else {
|
||||
lowerBound.setFlexibleUpperBound(type(flexibility.getUpperBound()));
|
||||
lowerBound.setFlexibleUpperBound(upperBound);
|
||||
}
|
||||
return lowerBound;
|
||||
}
|
||||
|
||||
+6
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.serialization;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.types.DelegatingFlexibleType;
|
||||
import org.jetbrains.kotlin.types.Flexibility;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
|
||||
public abstract class SerializerExtension {
|
||||
@@ -49,6 +51,9 @@ public abstract class SerializerExtension {
|
||||
public void serializeValueParameter(@NotNull ValueParameterDescriptor descriptor, @NotNull ProtoBuf.ValueParameter.Builder proto) {
|
||||
}
|
||||
|
||||
public void serializeFlexibleType(@NotNull DelegatingFlexibleType flexibleType, @NotNull ProtoBuf.Type.Builder lowerProto, @NotNull ProtoBuf.Type.Builder upperProto) {
|
||||
}
|
||||
|
||||
public void serializeType(@NotNull KotlinType type, @NotNull ProtoBuf.Type.Builder proto) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user