Commit 893b65e4 authored by Dan O'Reilly's avatar Dan O'Reilly

Merge remote-tracking branch 'upstream/master' into py2_py3_straddle

parents 7013a75b 0cb84ee3
......@@ -244,7 +244,6 @@ namespace Google.Protobuf
[TestCase(null, "{ }")]
[TestCase("x", "{ 'fooString': 'x' }")]
[TestCase("", "{ 'fooString': '' }")]
[TestCase(null, "{ }")]
public void Oneof(string fooStringValue, string expectedJson)
{
var message = new TestOneof();
......
......@@ -251,5 +251,12 @@ namespace Google.Protobuf.Reflection
Assert.AreEqual(new[] { 11, 1, 101, 200 }, fields.InDeclarationOrder().Select(x => x.FieldNumber));
Assert.AreEqual(new[] { 1, 11, 101, 200 }, fields.InFieldNumberOrder().Select(x => x.FieldNumber));
}
[Test]
public void DescriptorProtoFileDescriptor()
{
var descriptor = Google.Protobuf.Reflection.FileDescriptor.DescriptorProtoFileDescriptor;
}
}
}
......@@ -11,7 +11,6 @@ set -eu
readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
readonly ProtoRootDir="${ScriptDir}/.."
readonly ProtoC="${ProtoRootDir}/src/protoc"
pushd "${ProtoRootDir}" > /dev/null
......@@ -35,7 +34,7 @@ fi
cd src
make $@ protoc
declare -a RUNTIME_PROTO_FILES=(\
declare -a RUNTIME_PROTO_FILES=( \
google/protobuf/any.proto \
google/protobuf/api.proto \
google/protobuf/descriptor.proto \
......@@ -49,5 +48,3 @@ declare -a RUNTIME_PROTO_FILES=(\
google/protobuf/wrappers.proto)
./protoc --objc_out="${ProtoRootDir}/objectivec" ${RUNTIME_PROTO_FILES[@]}
popd > /dev/null
......@@ -67,7 +67,7 @@ void FieldGeneratorBase::SetCommonFieldVariables(
tag_bytes += ", " + SimpleItoa(tag_array[i]);
}
(*variables)["access_level"] = class_access_level();
(*variables)["access_level"] = "public";
(*variables)["tag"] = SimpleItoa(tag);
(*variables)["tag_size"] = SimpleItoa(tag_size);
(*variables)["tag_bytes"] = tag_bytes;
......
......@@ -54,9 +54,6 @@ FileGenerator::FileGenerator(const FileDescriptor *file)
: file_(file),
root_class_name_(FileClassName(file)),
is_public_dep_(false) {
// Validate the objc prefix.
ValidateObjCClassPrefix(file_);
for (int i = 0; i < file_->enum_type_count(); i++) {
EnumGenerator *generator = new EnumGenerator(file_->enum_type(i));
enum_generators_.push_back(generator);
......
......@@ -57,8 +57,13 @@ bool ObjectiveCGenerator::Generate(const FileDescriptor* file,
return false;
}
FileGenerator file_generator(file);
// Validate the objc prefix/package pairing.
if (!ValidateObjCClassPrefix(file, error)) {
// *error will have been filled in.
return false;
}
FileGenerator file_generator(file);
string filepath = FilePath(file);
// Generate header.
......
......@@ -53,6 +53,7 @@ class LIBPROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator {
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjectiveCGenerator);
};
} // namespace objectivec
} // namespace compiler
} // namespace protobuf
......
......@@ -62,9 +62,6 @@ string FileName(const FileDescriptor* file);
// declared in the proto package.
string FilePath(const FileDescriptor* file);
// Checks the prefix for a given file and outputs any warnings/errors needed.
void ValidateObjCClassPrefix(const FileDescriptor* file);
// Gets the name of the root class we'll generate in the file. This class
// is not meant for external consumption, but instead contains helpers that
// the rest of the the classes need
......@@ -145,6 +142,11 @@ string BuildFlagsString(const vector<string>& strings);
string BuildCommentsString(const SourceLocation& location);
// Checks the prefix for a given file and outputs any warnings needed, if
// there are flat out errors, then out_error is filled in and the result is
// false.
bool ValidateObjCClassPrefix(const FileDescriptor* file, string *out_error);
// Generate decode data needed for ObjC's GPBDecodeTextFormatName() to transform
// the input into the the expected output.
class LIBPROTOC_EXPORT TextFormatDecodeData {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment