Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
6e385f1
update ast
bparrishMines Jan 10, 2024
abc026a
constructor extend method and make required default to true
bparrishMines Jan 10, 2024
870cec3
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Jan 10, 2024
0c69e1d
use helper method
bparrishMines Jan 10, 2024
eb14522
fix some validation and add tests
bparrishMines Jan 12, 2024
155469f
change required to isRequired
bparrishMines Jan 12, 2024
3a45694
improve docs
bparrishMines Jan 12, 2024
6350353
fix lint errors and hide ProxyApi
bparrishMines Jan 12, 2024
5cfcb3a
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Jan 12, 2024
4ce1e21
add hide comment
bparrishMines Jan 12, 2024
22c3065
test for recursive looks
bparrishMines Jan 12, 2024
a14485e
fix tools version
bparrishMines Jan 12, 2024
360dd7a
review comments
bparrishMines Jan 23, 2024
ea9f7c3
switch to a method that looks for matching prefix
bparrishMines Jan 24, 2024
33b2e07
avoid loops
bparrishMines Jan 24, 2024
6c79879
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Jan 24, 2024
c8db9c8
fix test
bparrishMines Jan 24, 2024
b414381
change superClass and interfaces to TypeDeclarations
bparrishMines Jan 25, 2024
00db939
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Jan 25, 2024
54c7ac2
add deps
bparrishMines Jan 25, 2024
d05bebf
add proxyapi ast helper gen methods
bparrishMines Jan 27, 2024
dfb7e45
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Jan 30, 2024
8015a9a
implementation of proxyapis stuff for dart
bparrishMines Jan 31, 2024
2dac15d
add proxy api base class
bparrishMines Jan 31, 2024
36bbca1
add documentation
bparrishMines Feb 2, 2024
afa62e8
add tests and some minor validatation improvements
bparrishMines Feb 2, 2024
1cd4d95
add tests actually
bparrishMines Feb 2, 2024
b08d017
generate test api file
bparrishMines Feb 2, 2024
fc3df6f
method improvements
bparrishMines Feb 2, 2024
0caa963
add protected for more methods
bparrishMines Feb 2, 2024
1c61c51
improvement of docs
bparrishMines Feb 2, 2024
cb2e654
change enum name
bparrishMines Feb 4, 2024
12d9c7d
dont gen method without apis
bparrishMines Feb 4, 2024
8abdb3f
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Feb 4, 2024
1d2c549
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Feb 27, 2024
c0aa558
fix class name generation without underscore
bparrishMines Feb 27, 2024
1f0c6ce
change to indexMap and fix extra space
bparrishMines Feb 27, 2024
7f1f70e
review comments and regen
bparrishMines Feb 27, 2024
2b04aa5
`Merge branch 'main' of github.com:flutter/packages into pigeon_wrapp…
bparrishMines Feb 27, 2024
94106ae
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Feb 28, 2024
796d336
move methods
bparrishMines Feb 28, 2024
dcbd085
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Feb 28, 2024
358b6d7
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Mar 5, 2024
0138563
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Mar 14, 2024
ea338c8
Merge branch 'main' of github.com:flutter/packages into pigeon_wrappe…
bparrishMines Mar 14, 2024
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
add protected for more methods
  • Loading branch information
bparrishMines committed Feb 2, 2024
commit 0caa96372bf2971c98cd43fd80f20183e3dee24e
2 changes: 2 additions & 0 deletions packages/pigeon/lib/dart/templates.dart
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see these templates changing much in the future? I get a bit nervous thinking about adding logic into this later. Just based on doing that with previously written pigeon code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't expect these to have many changes in the future. And if they do, it shouldn't be changes that require adding logic when generating them. This should at least be true for InstanceManager, InstanceManagerApi, and ProxyApiBaseClass. I expect all of these to always be basic templates.

However, ProxyApiBaseCodec could require logic later to solve some complex issues, but I don't have any plans for it yet.

Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,11 @@ abstract class $proxyApiBaseClassName {
///
/// If it is null, the default BinaryMessenger will be used, which routes to
/// the host platform.
@protected
final BinaryMessenger? $_proxyApiBaseClassMessengerVarName;

/// Maintains instances stored to communicate with native language objects.
@protected
final $instanceManagerClassName $_proxyApiBaseClassInstanceManagerVarName;

/// Instantiates and returns a functionally identical object to oneself.
Expand Down
7 changes: 4 additions & 3 deletions packages/pigeon/lib/dart_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1170,11 +1170,12 @@ if (${_varNamePrefix}replyList == null) {
(cb.ConstructorBuilder builder) => builder
..name = '${classMemberNamePrefix}detached'
..docs.addAll(<String>[
'/// Constructs $apiName without creating the associated native object.',
'/// Constructs [$apiName] without creating the associated native object.',
'///',
'/// This should only be used by subclasses created by this library or to',
'/// create copies for an [$instanceManagerClassName].',
])
..annotations.add(cb.refer('protected'))
..optionalParameters.addAll(<cb.Parameter>[
binaryMessengerParameter,
instanceManagerParameter,
Expand Down Expand Up @@ -1226,7 +1227,7 @@ if (${_varNamePrefix}replyList == null) {
);
}

/// Converts unattached constructors from the pigeon AST to `code_builder`
/// Converts unattached fields from the pigeon AST to `code_builder`
/// Fields.
Iterable<cb.Field> _proxyApiUnattachedFields(
Iterable<ApiField> fields,
Expand Down Expand Up @@ -1279,7 +1280,7 @@ if (${_varNamePrefix}replyList == null) {
');',
'```',
'',
'Alternatively, `$instanceManagerClassName.removeWeakReference` can be used to',
'Alternatively, [$instanceManagerClassName.removeWeakReference] can be used to',
'release the associated Native object manually.',
],
],
Expand Down
Copy link
Contributor

@tarrinneal tarrinneal Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file makes me want to quit my job. Generally seems like everything is there and makes sense.

I'm torn about whether or not to keep it apart from the other core_tests file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this file is all generated so that I can write the integration tests and verify the generated code doesn't cause any lint warnings. I assumed the review for this file would only require someone to skim it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a sense this is the code that needs the most review, since it's the actual functioning code from what you've written. The rest of it is just preference and future work looking.

Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ abstract class Pigeon_ProxyApiBaseClass {
///
/// If it is null, the default BinaryMessenger will be used, which routes to
/// the host platform.
@protected
final BinaryMessenger? pigeon_binaryMessenger;

/// Maintains instances stored to communicate with native language objects.
@protected
final Pigeon_InstanceManager pigeon_instanceManager;

/// Instantiates and returns a functionally identical object to oneself.
Expand Down Expand Up @@ -533,10 +535,11 @@ class ProxyApiTestClass extends ProxyApiSuperClass
}();
}

/// Constructs ProxyApiTestClass without creating the associated native object.
/// Constructs [ProxyApiTestClass] without creating the associated native object.
///
/// This should only be used by subclasses created by this library or to
/// create copies for an [Pigeon_InstanceManager].
@protected
ProxyApiTestClass.pigeon_detached({
super.pigeon_binaryMessenger,
super.pigeon_instanceManager,
Expand Down Expand Up @@ -644,7 +647,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final void Function(ProxyApiTestClass pigeon_instance)? flutterNoop;

Expand All @@ -666,7 +669,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final Object? Function(ProxyApiTestClass pigeon_instance)? flutterThrowError;

Expand All @@ -688,7 +691,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final void Function(ProxyApiTestClass pigeon_instance)?
flutterThrowErrorFromVoid;
Expand All @@ -711,7 +714,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final bool Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -736,7 +739,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final int Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -761,7 +764,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final double Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -786,7 +789,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final String Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -811,7 +814,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final Uint8List Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -836,7 +839,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final List<Object?> Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -862,7 +865,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final List<ProxyApiTestClass?> Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -887,7 +890,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final Map<String?, Object?> Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -913,7 +916,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final Map<String?, ProxyApiTestClass?> Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -938,7 +941,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final AnEnum Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -963,7 +966,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final ProxyApiSuperClass Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -988,7 +991,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final bool? Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -1013,7 +1016,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final int? Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -1038,7 +1041,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final double? Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -1063,7 +1066,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final String? Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -1088,7 +1091,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final Uint8List? Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -1113,7 +1116,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final List<Object?>? Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -1138,7 +1141,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final Map<String?, Object?>? Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -1163,7 +1166,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final AnEnum? Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -1188,7 +1191,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final ProxyApiSuperClass? Function(
ProxyApiTestClass pigeon_instance,
Expand All @@ -1214,7 +1217,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final Future<void> Function(ProxyApiTestClass pigeon_instance)?
flutterNoopAsync;
Expand All @@ -1237,7 +1240,7 @@ class ProxyApiTestClass extends ProxyApiSuperClass
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final Future<String> Function(
ProxyApiTestClass pigeon_instance,
Expand Down Expand Up @@ -4819,10 +4822,11 @@ class ProxyApiSuperClass extends Pigeon_ProxyApiBaseClass {
}();
}

/// Constructs ProxyApiSuperClass without creating the associated native object.
/// Constructs [ProxyApiSuperClass] without creating the associated native object.
///
/// This should only be used by subclasses created by this library or to
/// create copies for an [Pigeon_InstanceManager].
@protected
ProxyApiSuperClass.pigeon_detached({
super.pigeon_binaryMessenger,
super.pigeon_instanceManager,
Expand Down Expand Up @@ -4917,10 +4921,11 @@ class ProxyApiSuperClass extends Pigeon_ProxyApiBaseClass {

/// ProxyApi to serve as an interface to the core ProxyApi interface.
class ProxyApiInterface extends Pigeon_ProxyApiBaseClass {
/// Constructs ProxyApiInterface without creating the associated native object.
/// Constructs [ProxyApiInterface] without creating the associated native object.
///
/// This should only be used by subclasses created by this library or to
/// create copies for an [Pigeon_InstanceManager].
@protected
ProxyApiInterface.pigeon_detached({
super.pigeon_binaryMessenger,
super.pigeon_instanceManager,
Expand All @@ -4943,7 +4948,7 @@ class ProxyApiInterface extends Pigeon_ProxyApiBaseClass {
/// );
/// ```
///
/// Alternatively, `Pigeon_InstanceManager.removeWeakReference` can be used to
/// Alternatively, [Pigeon_InstanceManager.removeWeakReference] can be used to
/// release the associated Native object manually.
final void Function(ProxyApiInterface pigeon_instance)? anInterfaceMethod;

Expand Down