Skip to content

[native_doc_dartifier] Extract Public API Signatures for LLM Context #2370

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

marshelino-maged
Copy link
Contributor

closes #2309
This PR statically extracts public API signatures from Dart source code. The extracted information includes:

  • Public class names
  • Public Constructors
  • Public methods
  • Public fields
  • Getters and setters

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.

? (node.parent as ClassDeclaration).name.lexeme
: '';

if (className.isEmpty || !_isPublic(className)) return;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Skipped the "fields" that are outside classes, is that true, or JNIgen may generate ones that are outside classes?
Same with "methods"

return;
}

final returnType = node.returnType?.toSource() ?? 'dynamic';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the default value for the returnType, if not explicit, should be "dynamic", or "void"?

expect(withParamsConstructor.className, 'Bar');
expect(withParamsConstructor.name, 'withParams');
expect(withParamsConstructor.factoryKeyword, isNull);
expect(withParamsConstructor.parameters, '(this.a, this.b, {int? k})');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for (this.a, this.b) should I get the type of them to be (int? a, int? b)

const code = '''
class Bar {
int _privateField;
int publicField = 10;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also here ... in case of final publicField = 10, the return type will be dynamic ... should I use Dart analyzer to infer its type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[native_doc_dartifier] Code context for the LLM
1 participant