Add ARRAY for reserved name (#3150)
This commit is contained in:
parent
bf04c83267
commit
dba8928ff5
@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
#include "protobuf.h"
|
#include "protobuf.h"
|
||||||
|
|
||||||
const char* const kReservedNames[] = {"Empty"};
|
const char* const kReservedNames[] = {"Empty", "ECHO", "ARRAY"};
|
||||||
const int kReservedNamesSize = 1;
|
const int kReservedNamesSize = 3;
|
||||||
|
|
||||||
// Forward declare.
|
// Forward declare.
|
||||||
static void descriptor_init_c_instance(Descriptor* intern TSRMLS_DC);
|
static void descriptor_init_c_instance(Descriptor* intern TSRMLS_DC);
|
||||||
|
@ -236,7 +236,7 @@ function getClassNamePrefix(
|
|||||||
return $prefix;
|
return $prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
$reserved_words = array("Empty");
|
$reserved_words = array("Empty", "ECHO", "ARRAY");
|
||||||
foreach ($reserved_words as $reserved_word) {
|
foreach ($reserved_words as $reserved_word) {
|
||||||
if ($classname === $reserved_word) {
|
if ($classname === $reserved_word) {
|
||||||
if ($file_proto->getPackage() === "google.protobuf") {
|
if ($file_proto->getPackage() === "google.protobuf") {
|
||||||
|
@ -876,5 +876,6 @@ class GeneratedClassTest extends TestBase
|
|||||||
$m = new \Foo\TestMessage_Empty();
|
$m = new \Foo\TestMessage_Empty();
|
||||||
$m = new \Foo\PBEmpty();
|
$m = new \Foo\PBEmpty();
|
||||||
$m = new \PrefixEmpty();
|
$m = new \PrefixEmpty();
|
||||||
|
$m = new \Foo\PBARRAY();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ require_once('generated/NoNamespaceMessage_NestedEnum.php');
|
|||||||
require_once('generated/PrefixEmpty.php');
|
require_once('generated/PrefixEmpty.php');
|
||||||
require_once('generated/PrefixTestPrefix.php');
|
require_once('generated/PrefixTestPrefix.php');
|
||||||
require_once('generated/Bar/TestInclude.php');
|
require_once('generated/Bar/TestInclude.php');
|
||||||
|
require_once('generated/Foo/PBARRAY.php');
|
||||||
require_once('generated/Foo/PBEmpty.php');
|
require_once('generated/Foo/PBEmpty.php');
|
||||||
require_once('generated/Foo/TestEnum.php');
|
require_once('generated/Foo/TestEnum.php');
|
||||||
require_once('generated/Foo/TestIncludePrefixMessage.php');
|
require_once('generated/Foo/TestIncludePrefixMessage.php');
|
||||||
|
@ -127,6 +127,10 @@ message Empty {
|
|||||||
int32 a = 1;
|
int32 a = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message ARRAY {
|
||||||
|
int32 a = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message TestPackedMessage {
|
message TestPackedMessage {
|
||||||
repeated int32 repeated_int32 = 90 [packed = true];
|
repeated int32 repeated_int32 = 90 [packed = true];
|
||||||
repeated int64 repeated_int64 = 91 [packed = true];
|
repeated int64 repeated_int64 = 91 [packed = true];
|
||||||
|
@ -49,8 +49,8 @@ const std::string kDescriptorMetadataFile =
|
|||||||
"GPBMetadata/Google/Protobuf/Internal/Descriptor.php";
|
"GPBMetadata/Google/Protobuf/Internal/Descriptor.php";
|
||||||
const std::string kDescriptorDirName = "Google/Protobuf/Internal";
|
const std::string kDescriptorDirName = "Google/Protobuf/Internal";
|
||||||
const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal";
|
const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal";
|
||||||
const char* const kReservedNames[] = {"Empty", "ECHO"};
|
const char* const kReservedNames[] = {"ARRAY", "Empty", "ECHO"};
|
||||||
const int kReservedNamesSize = 2;
|
const int kReservedNamesSize = 3;
|
||||||
|
|
||||||
namespace google {
|
namespace google {
|
||||||
namespace protobuf {
|
namespace protobuf {
|
||||||
|
Loading…
Reference in New Issue
Block a user