Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix android unit test bug, merge annotations, one windows fix
  • Loading branch information
tarrinneal committed Mar 22, 2024
commit 73935b962faf581f2244daa67804de3a8fa48a8b
18 changes: 10 additions & 8 deletions packages/pigeon/lib/pigeon_lib.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,10 @@ class SwiftFunction {
/// Metadata to annotate data classes to be defined as class in Swift output.
class SwiftClass {
/// Constructor.
const SwiftClass();
}
const SwiftClass({this.inheritNSObject = false});

/// Metadata to annotate data classes to be defined as inheriting from NSObject.
class SwiftObjcInteropClass {
/// Constructor.
const SwiftObjcInteropClass();
/// Whether to define data class as inheriting from NSObject with `@objc` annotation.
final bool inheritNSObject;
}

/// Type of TaskQueue which determines how handlers are dispatched for
Expand Down Expand Up @@ -1563,8 +1560,13 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor<Object?> {
name: node.name.lexeme,
fields: <NamedType>[],
isSwiftClass: _hasMetadata(node.metadata, 'SwiftClass'),
isSwiftObjcInteropClass:
_hasMetadata(node.metadata, 'SwiftObjcInteropClass'),
isSwiftObjcInteropClass: _findMetadata(node.metadata, 'SwiftClass')
?.arguments
?.arguments
.first
.toString()
.contains('true') ??
false,
documentationComments:
_documentationCommentsParser(node.documentationComment?.tokens),
);
Expand Down
3 changes: 1 addition & 2 deletions packages/pigeon/pigeons/core_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class AllTypes {
}

/// A class containing all supported nullable types.
@SwiftClass()
@SwiftObjcInteropClass()
@SwiftClass(inheritNSObject: true)
class AllNullableTypes {
AllNullableTypes(
this.aNullableBool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ internal class AllDatatypesTest : TestCase() {
null,
null,
null,
null,
null)
val everything2 = AllNullableTypes.fromList(list2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ void TestPlugin::CallFlutterSendMultipleNullableTypesWithoutRecursion(
const std::string* a_nullable_string,
std::function<void(ErrorOr<AllNullableTypesWithoutRecursion> reply)>
result) {
flutter_api_->SendMultipleNullableTypes(
flutter_api_->SendMultipleNullableTypesWithoutRecursion(
a_nullable_bool, a_nullable_int, a_nullable_string,
[result](const AllNullableTypesWithoutRecursion& echo) { result(echo); },
[result](const FlutterError& error) { result(error); });
Expand Down