Skip to content

Commit

Permalink
Fixes from #1175 that are not related to protocols (#1184)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamappelbe committed May 31, 2024
1 parent 4f3e4d8 commit 2b3240e
Show file tree
Hide file tree
Showing 5 changed files with 1,071 additions and 705 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool _isClassDeclaration(clang_types.CXCursor cursor) {
// It's a class declaration if it has no children other than ObjCClassRef.
bool result = true;
cursor.visitChildrenMayBreak((child) {
if (cursor.kind == clang_types.CXCursorKind.CXCursor_ObjCClassRef) {
if (child.kind == clang_types.CXCursorKind.CXCursor_ObjCClassRef) {
return true;
}
result = false;
Expand Down
13 changes: 6 additions & 7 deletions pkgs/ffigen/lib/src/header_parser/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ extension CXCursorExt on clang_types.CXCursor {
bool visitChildrenMayRecurse(
int Function(clang_types.CXCursor child, clang_types.CXCursor parent)
callback) {
final protocolVisitor = NativeCallable<_CursorVisitorCallback>.isolateLocal(
final visitor = NativeCallable<_CursorVisitorCallback>.isolateLocal(
(clang_types.CXCursor child, clang_types.CXCursor parent,
Pointer<Void> clientData) =>
callback(child, parent),
exceptionalReturn: exceptional_visitor_return);
final result = clang.clang_visitChildren(
this, protocolVisitor.nativeFunction, nullptr);
protocolVisitor.close();
final result =
clang.clang_visitChildren(this, visitor.nativeFunction, nullptr);
visitor.close();
return result == 0;
}

Expand All @@ -214,13 +214,12 @@ extension CXCursorExt on clang_types.CXCursor {

/// Recursively print the AST, for debugging.
void printAst([int maxDepth = 3]) => _printAst(maxDepth, 0);
bool _printAst(int maxDepth, int depth) {
void _printAst(int maxDepth, int depth) {
if (depth > maxDepth) {
return false;
return;
}
print((' ' * depth) + completeStringRepr());
visitChildren((child) => child._printAst(maxDepth, depth + 1));
return true;
}
}

Expand Down
1 change: 1 addition & 0 deletions pkgs/objective_c/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
implementing ObjC protocols from Dart. Also adds `DartProxyBuilder` for
constructing `DartProxy`.
- Add some extensions methods for `NSMutableData`.
- Fix the `NSError` bindings so that they're not empty.

## 1.0.1

Expand Down
Loading

0 comments on commit 2b3240e

Please sign in to comment.