Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(795)

Unified Diff: lib/protobuf_field.dart

Issue 1829573002: Fix all strong mode warnings in protoc-plugin (Closed) Base URL: git@github.com:dart-lang/dart-protoc-plugin.git@master
Patch Set: regenerate pb.dart files Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/options.dart ('k') | lib/src/descriptor.pb.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/protobuf_field.dart
diff --git a/lib/protobuf_field.dart b/lib/protobuf_field.dart
index 5a5c1673c195e32940831d1aabe2294378f4fd4c..78c2b50e6a13e863f1853fc4b09de75ad7b7a854 100644
--- a/lib/protobuf_field.dart
+++ b/lib/protobuf_field.dart
@@ -112,23 +112,24 @@ class ProtobufField {
if (isRepeated) {
if (baseType.isMessage || baseType.isGroup) {
- return '..pp($number, $quotedName, $typeConstant,'
+ return '..pp/*<$type>*/($number, $quotedName, $typeConstant,'
' $type.$checkItem, $type.create)';
} else if (baseType.isEnum) {
- return '..pp($number, $quotedName, $typeConstant,'
+ return '..pp/*<$type>*/($number, $quotedName, $typeConstant,'
' $type.$checkItem, null, $type.valueOf)';
} else {
- return '..p($number, $quotedName, $typeConstant)';
+ return '..p/*<$type>*/($number, $quotedName, $typeConstant)';
}
}
String makeDefault = generateDefaultFunction(package);
if (baseType.isEnum) {
String valueOf = '$type.valueOf';
- return '..e($number, $quotedName, $typeConstant, $makeDefault, $valueOf)';
+ return '..e/*<$type>*/('
+ '$number, $quotedName, $typeConstant, $makeDefault, $valueOf)';
}
- String prefix = '..a($number, $quotedName, $typeConstant';
+ String prefix = '..a/*<$type>*/($number, $quotedName, $typeConstant';
if (makeDefault == null) return prefix + ')';
if (baseType.isMessage || baseType.isGroup) {
@@ -145,18 +146,18 @@ class ProtobufField {
String getDefaultExpr() {
if (isRepeated) return "null";
switch (_field.type) {
- case FieldDescriptorProto_Type.TYPE_BOOL:
- return _getDefaultAsBoolExpr("false");
- case FieldDescriptorProto_Type.TYPE_INT32:
- case FieldDescriptorProto_Type.TYPE_UINT32:
- case FieldDescriptorProto_Type.TYPE_SINT32:
- case FieldDescriptorProto_Type.TYPE_FIXED32:
- case FieldDescriptorProto_Type.TYPE_SFIXED32:
- return _getDefaultAsInt32Expr("0");
- case FieldDescriptorProto_Type.TYPE_STRING:
- return _getDefaultAsStringExpr("''");
- default:
- return "null";
+ case FieldDescriptorProto_Type.TYPE_BOOL:
+ return _getDefaultAsBoolExpr("false");
+ case FieldDescriptorProto_Type.TYPE_INT32:
+ case FieldDescriptorProto_Type.TYPE_UINT32:
+ case FieldDescriptorProto_Type.TYPE_SINT32:
+ case FieldDescriptorProto_Type.TYPE_FIXED32:
+ case FieldDescriptorProto_Type.TYPE_SFIXED32:
+ return _getDefaultAsInt32Expr("0");
+ case FieldDescriptorProto_Type.TYPE_STRING:
+ return _getDefaultAsStringExpr("''");
+ default:
+ return "null";
}
}
« no previous file with comments | « lib/options.dart ('k') | lib/src/descriptor.pb.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698