Skip to content

Commit db721c0

Browse files
committed
fix enum
1 parent 3537eb9 commit db721c0

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

packages/pigeon/lib/swift_generator.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ import FlutterMacOS
193193
} else if (!hostDatatype.isBuiltin &&
194194
customEnumNames.contains(field.type.baseName)) {
195195
indent.writeln('var ${field.name}: $fieldType? = nil');
196-
indent.write(
197-
'if let ${field.name}RawValue = nullToNil(value: $listValue) as! Int? ');
196+
indent.write('if let ${field.name}RawValue = $listValue as! Int? ');
198197
indent.addScoped('{', '}', () {
199198
indent.writeln(
200199
'${field.name} = $fieldType(rawValue: ${field.name}RawValue)');

packages/pigeon/platform_tests/test_plugin/ios/Classes/CoreTests.gen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ struct AllNullableTypes {
145145
let nullableMapWithAnnotations = (list[11] is NSNull) ? nullToNil(value: list[11]) as! [String?: String?]? : list[11] as! [String?: String?]?
146146
let nullableMapWithObject = (list[12] is NSNull) ? nullToNil(value: list[12]) as! [String?: Any?]? : list[12] as! [String?: Any?]?
147147
var aNullableEnum: AnEnum? = nil
148-
if let aNullableEnumRawValue = nullToNil(value: list[13]) as! Int? {
148+
if let aNullableEnumRawValue = list[13] as! Int? {
149149
aNullableEnum = AnEnum(rawValue: aNullableEnumRawValue)
150150
}
151151
let aNullableString = (list[14] is NSNull) ? nullToNil(value: list[14]) as! String? : list[14] as! String?

packages/pigeon/platform_tests/test_plugin/macos/Classes/CoreTests.gen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ struct AllNullableTypes {
145145
let nullableMapWithAnnotations = (list[11] is NSNull) ? nullToNil(value: list[11]) as! [String?: String?]? : list[11] as! [String?: String?]?
146146
let nullableMapWithObject = (list[12] is NSNull) ? nullToNil(value: list[12]) as! [String?: Any?]? : list[12] as! [String?: Any?]?
147147
var aNullableEnum: AnEnum? = nil
148-
if let aNullableEnumRawValue = nullToNil(value: list[13]) as! Int? {
148+
if let aNullableEnumRawValue = list[13] as! Int? {
149149
aNullableEnum = AnEnum(rawValue: aNullableEnumRawValue)
150150
}
151151
let aNullableString = (list[14] is NSNull) ? nullToNil(value: list[14]) as! String? : list[14] as! String?

0 commit comments

Comments
 (0)