Skip to content

feat: add support for nullable types and ArrayBuffers for pointers#357

Open
edusperoni wants to merge 3 commits intomainfrom
feat/strict-types
Open

feat: add support for nullable types and ArrayBuffers for pointers#357
edusperoni wants to merge 3 commits intomainfrom
feat/strict-types

Conversation

@edusperoni
Copy link
Copy Markdown
Collaborator

This adds support for strict mode by making all nullable types | null and adding the extra support for ArrayBuffers being passed to pointer types

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the metadata generator’s type system to represent Objective-C nullability and updates the TypeScript definition output so nullable types are emitted as T | null. It also broadens pointer-typed function parameters in generated .d.ts files to accept ArrayBuffer-backed inputs.

Changes:

  • Introduces Meta::NullableType (and visitor support) to propagate ObjC nullability through the metadata type model.
  • Updates the TS definition writer to emit | null for nullable types and to accept ArrayBuffer / views for pointer parameters.
  • Updates validation and binary serialization visitors to handle (or flatten) nullable types.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
metadata-generator/src/TypeScript/DefinitionWriter.cpp Emits `T
metadata-generator/src/Meta/ValidateMetaTypeVisitor.h Adds visitNullable to the meta type validator visitor interface.
metadata-generator/src/Meta/ValidateMetaTypeVisitor.cpp Implements visitNullable to validate the wrapped inner type.
metadata-generator/src/Meta/TypeVisitor.h Extends the TypeVisitor contract with visitNullable.
metadata-generator/src/Meta/TypeFactory.cpp Wraps clang::AttributedType with NullableType when immediate nullability is Nullable.
metadata-generator/src/Meta/TypeEntities.h Adds TypeNullable to TypeType, wires dispatch in Type::visit, and defines NullableType.
metadata-generator/src/Meta/NameRetrieverVisitor.h Adds visitNullable to keep visitor compatibility.
metadata-generator/src/Meta/NameRetrieverVisitor.cpp Implements visitNullable (currently returns the inner type name).
metadata-generator/src/Binary/binaryTypeEncodingSerializer.h Adds visitNullable to the binary type encoding serializer.
metadata-generator/src/Binary/binaryTypeEncodingSerializer.cpp Implements visitNullable by serializing the inner type encoding (nullability flattened).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

edusperoni and others added 2 commits April 14, 2026 00:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants