Skip to content

Frillback #9078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ analyzer:
exclude: # DIFFERENT FROM FLUTTER/FLUTTER
# Ignore generated files
- '**/*.g.dart'
- '**/*.gen.jni.dart'
- '**/*.mocks.dart' # Mockito @GenerateMocks

linter:
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/example/app/lib/src/messages.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool _deepEquals(Object? a, Object? b) {

enum Code {
one,
two,
two;
}

class MessageData {
Expand Down
24 changes: 21 additions & 3 deletions packages/pigeon/lib/src/ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class AstProxyApi extends Api {
super.documentationComments = const <String>[],
required this.constructors,
required this.fields,
this.associatedType,
this.superClass,
this.interfaces = const <TypeDeclaration>{},
this.swiftOptions,
Expand All @@ -155,6 +156,9 @@ class AstProxyApi extends Api {
/// List of fields inside the API.
List<ApiField> fields;

/// The TypeDeclaration associated with this ProxyApi.
TypeDeclaration? associatedType;

/// Name of the class this class considers the super class.
TypeDeclaration? superClass;

Expand Down Expand Up @@ -541,32 +545,38 @@ class TypeDeclaration {

/// Returns duplicated `TypeDeclaration` with attached `associatedEnum` value.
TypeDeclaration copyWithEnum(Enum enumDefinition) {
return TypeDeclaration(
final TypeDeclaration newType = TypeDeclaration(
baseName: baseName,
isNullable: isNullable,
associatedEnum: enumDefinition,
typeArguments: typeArguments,
);
enumDefinition.associatedType = newType;
return newType;
}

/// Returns duplicated `TypeDeclaration` with attached `associatedClass` value.
TypeDeclaration copyWithClass(Class classDefinition) {
return TypeDeclaration(
final TypeDeclaration newType = TypeDeclaration(
baseName: baseName,
isNullable: isNullable,
associatedClass: classDefinition,
typeArguments: typeArguments,
);
classDefinition.associatedType = newType;
return newType;
}

/// Returns duplicated `TypeDeclaration` with attached `associatedProxyApi` value.
TypeDeclaration copyWithProxyApi(AstProxyApi proxyApiDefinition) {
return TypeDeclaration(
final TypeDeclaration newType = TypeDeclaration(
baseName: baseName,
isNullable: isNullable,
associatedProxyApi: proxyApiDefinition,
typeArguments: typeArguments,
);
proxyApiDefinition.associatedType = newType;
return newType;
}

/// Returns duplicated `TypeDeclaration` with attached `associatedProxyApi` value.
Expand Down Expand Up @@ -707,6 +717,7 @@ class Class extends Node {
required this.fields,
this.superClassName,
this.superClass,
this.associatedType,
this.isSealed = false,
this.isReferenced = true,
this.isSwiftClass = false,
Expand All @@ -725,6 +736,9 @@ class Class extends Node {
/// The definition of the parent class.
Class? superClass;

/// The TypeDeclaration associated with this class.
TypeDeclaration? associatedType;

/// List of class definitions of children.
///
/// This is only meant to be used by sealed classes used in event channel methods.
Expand Down Expand Up @@ -761,6 +775,7 @@ class Enum extends Node {
Enum({
required this.name,
required this.members,
this.associatedType,
this.documentationComments = const <String>[],
});

Expand All @@ -770,6 +785,9 @@ class Enum extends Node {
/// All of the members of the enum.
List<EnumMember> members;

/// The TypeDeclaration associated with this enum.
TypeDeclaration? associatedType;

/// List of documentation comments, separated by line.
///
/// Lines should not include the comment marker itself, but should include any
Expand Down
Loading