Permalink
Browse files

Merge pull request #20 from dicej/master

avoid "local ... hides instance variable" warnings in generated code
  • Loading branch information...
2 parents 1c49e10 + 2a22a14 commit 9eb586b2178163c2fdbdfce772a48731e5884905 @jparise jparise committed Jan 18, 2012
@@ -100,8 +100,8 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
"- (BOOL) has$capitalized_name$ {\n"
" return !!has$capitalized_name$_;\n"
"}\n"
- "- (void) setHas$capitalized_name$:(BOOL) value {\n"
- " has$capitalized_name$_ = !!value;\n"
+ "- (void) setHas$capitalized_name$:(BOOL) value_ {\n"
+ " has$capitalized_name$_ = !!value_;\n"
"}\n"
"@synthesize $name$;\n");
}
@@ -199,7 +199,7 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
void EnumFieldGenerator::GenerateSerializedSizeCodeSource(io::Printer* printer) const {
printer->Print(variables_,
"if (self.has$capitalized_name$) {\n"
- " size += computeEnumSize($number$, self.$name$);\n"
+ " size_ += computeEnumSize($number$, self.$name$);\n"
"}\n");
}
@@ -436,17 +436,17 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
"}\n");
printer->Print(
- "size += dataSize;\n");
+ "size_ += dataSize;\n");
if (descriptor_->options().packed()) {
printer->Print(variables_,
"if (count > 0) {\n"
- " size += $tag_size$;\n"
- " size += computeRawVarint32Size(dataSize);\n"
+ " size_ += $tag_size$;\n"
+ " size_ += computeRawVarint32Size(dataSize);\n"
"}\n");
} else {
printer->Print(variables_,
- "size += $tag_size$ * count;\n");
+ "size_ += $tag_size$ * count;\n");
}
if (descriptor_->options().packed()) {
@@ -584,12 +584,12 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
printer->Print(
"}\n"
"- (int32_t) serializedSize {\n"
- " int32_t size = memoizedSerializedSize;\n"
- " if (size != -1) {\n"
- " return size;\n"
+ " int32_t size_ = memoizedSerializedSize;\n"
+ " if (size_ != -1) {\n"
+ " return size_;\n"
" }\n"
"\n"
- " size = 0;\n");
+ " size_ = 0;\n");
printer->Indent();
for (int i = 0; i < descriptor_->field_count(); i++) {
@@ -598,21 +598,21 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
if (descriptor_->extension_range_count() > 0) {
printer->Print(
- "size += [self extensionsSerializedSize];\n");
+ "size_ += [self extensionsSerializedSize];\n");
}
if (descriptor_->options().message_set_wire_format()) {
printer->Print(
- "size += self.unknownFields.serializedSizeAsMessageSet;\n");
+ "size_ += self.unknownFields.serializedSizeAsMessageSet;\n");
} else {
printer->Print(
- "size += self.unknownFields.serializedSize;\n");
+ "size_ += self.unknownFields.serializedSize;\n");
}
printer->Outdent();
printer->Print(
- " memoizedSerializedSize = size;\n"
- " return size;\n"
+ " memoizedSerializedSize = size_;\n"
+ " return size_;\n"
"}\n");
}
@@ -101,8 +101,8 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
"- (BOOL) has$capitalized_name$ {\n"
" return !!has$capitalized_name$_;\n"
"}\n"
- "- (void) setHas$capitalized_name$:(BOOL) value {\n"
- " has$capitalized_name$_ = !!value;\n"
+ "- (void) setHas$capitalized_name$:(BOOL) value_ {\n"
+ " has$capitalized_name$_ = !!value_;\n"
"}\n"
"@synthesize $name$;\n");
}
@@ -226,7 +226,7 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
void MessageFieldGenerator::GenerateSerializedSizeCodeSource(io::Printer* printer) const {
printer->Print(variables_,
"if (self.has$capitalized_name$) {\n"
- " size += compute$group_or_message$Size($number$, self.$name$);\n"
+ " size_ += compute$group_or_message$Size($number$, self.$name$);\n"
"}\n");
}
@@ -433,7 +433,7 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
void RepeatedMessageFieldGenerator::GenerateSerializedSizeCodeSource(io::Printer* printer) const {
printer->Print(variables_,
"for ($type$ *element in self.$list_name$) {\n"
- " size += compute$group_or_message$Size($number$, element);\n"
+ " size_ += compute$group_or_message$Size($number$, element);\n"
"}\n");
}
@@ -269,17 +269,17 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
"- (BOOL) has$capitalized_name$ {\n"
" return !!has$capitalized_name$_;\n"
"}\n"
- "- (void) setHas$capitalized_name$:(BOOL) value {\n"
- " has$capitalized_name$_ = !!value;\n"
+ "- (void) setHas$capitalized_name$:(BOOL) value_ {\n"
+ " has$capitalized_name$_ = !!value_;\n"
"}\n");
if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) {
printer->Print(variables_,
"- (BOOL) $name$ {\n"
" return !!$name$_;\n"
"}\n"
- "- (void) set$capitalized_name$:(BOOL) value {\n"
- " $name$_ = !!value;\n"
+ "- (void) set$capitalized_name$:(BOOL) value_ {\n"
+ " $name$_ = !!value_;\n"
"}\n");
} else {
printer->Print(variables_, "@synthesize $name$;\n");
@@ -384,7 +384,7 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
void PrimitiveFieldGenerator::GenerateSerializedSizeCodeSource(io::Printer* printer) const {
printer->Print(variables_,
"if (self.has$capitalized_name$) {\n"
- " size += compute$capitalized_type$Size($number$, self.$name$);\n"
+ " size_ += compute$capitalized_type$Size($number$, self.$name$);\n"
"}\n");
}
@@ -627,18 +627,18 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
"dataSize = $fixed_size$ * count;\n");
}
- printer->Print("size += dataSize;\n");
+ printer->Print("size_ += dataSize;\n");
if (descriptor_->options().packed()) {
printer->Print(variables_,
"if (count > 0) {\n"
- " size += $tag_size$;\n"
- " size += computeInt32SizeNoTag(dataSize);\n"
+ " size_ += $tag_size$;\n"
+ " size_ += computeInt32SizeNoTag(dataSize);\n"
"}\n"
"$name$MemoizedSerializedSize = dataSize;\n");
} else {
printer->Print(variables_,
- "size += $tag_size$ * count;\n");
+ "size_ += $tag_size$ * count;\n");
}
printer->Outdent();

0 comments on commit 9eb586b

Please sign in to comment.