diff options
author | Jon Skeet <jonskeet@google.com> | 2015-08-06 14:29:34 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-08-08 07:25:28 +0100 |
commit | 6f300442bc0e5eced5f48820bcd5f24fce9e3867 (patch) | |
tree | 26b97843db46795208b7da0568b0d23ec3fc1f8e /csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs | |
parent | cac45313235bd11b08e0803453a2ec5a7d4b652a (diff) | |
download | protobuf-6f300442bc0e5eced5f48820bcd5f24fce9e3867.tar.gz protobuf-6f300442bc0e5eced5f48820bcd5f24fce9e3867.tar.bz2 protobuf-6f300442bc0e5eced5f48820bcd5f24fce9e3867.zip |
Tidying up - fix a bunch of TODOs and remove outdated ones.
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs index 72927702..500e467c 100644 --- a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs @@ -287,23 +287,23 @@ namespace Google.Protobuf.Reflection DescriptorPool pool = new DescriptorPool(dependencies); FileDescriptor result = new FileDescriptor(descriptorData, proto, dependencies, pool, allowUnknownDependencies, generatedCodeInfo); - // TODO(jonskeet): Reinstate these checks, or get rid of them entirely. They aren't in the Java code, - // and fail for the CustomOptions test right now. (We get "descriptor.proto" vs "google/protobuf/descriptor.proto".) - //if (dependencies.Length != proto.DependencyCount) - //{ - // throw new DescriptorValidationException(result, - // "Dependencies passed to FileDescriptor.BuildFrom() don't match " + - // "those listed in the FileDescriptorProto."); - //} - //for (int i = 0; i < proto.DependencyCount; i++) - //{ - // if (dependencies[i].Name != proto.DependencyList[i]) - // { - // throw new DescriptorValidationException(result, - // "Dependencies passed to FileDescriptor.BuildFrom() don't match " + - // "those listed in the FileDescriptorProto."); - // } - //} + // Validate that the dependencies we've been passed (as FileDescriptors) are actually the ones we + // need. + if (dependencies.Length != proto.Dependency.Count) + { + throw new DescriptorValidationException(result, + "Dependencies passed to FileDescriptor.BuildFrom() don't match " + + "those listed in the FileDescriptorProto."); + } + for (int i = 0; i < proto.Dependency.Count; i++) + { + if (dependencies[i].Name != proto.Dependency[i]) + { + throw new DescriptorValidationException(result, + "Dependencies passed to FileDescriptor.BuildFrom() don't match " + + "those listed in the FileDescriptorProto."); + } + } result.CrossLink(); return result; |