[ffigen] Fix record use mapping#3316
Conversation
PR HealthBreaking changes ✔️
This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with |
e6201b6 to
a64ee6d
Compare
|
|
||
| /// The resolved name of the function as written in the bindings, used for | ||
| /// record use mapping. | ||
| String? resolvedRecordUseKey; |
There was a problem hiding this comment.
I don't like having state that's set during codegen. I think the correct approach is to make funcVarName a proper Symbol, rather than an ad-hoc private name. Then resolvedRecordUseKey can be deleted and recordUseMapping can determine the key itself. This would also let you revert the changes in writer.dart.
Aside from code cleanliness, this is also a better approach because Scope.addPrivate is only supposed to be used for internal names. But the record use map is now exposing that symbol, so it should use the Symbol infra.
a64ee6d to
447cdf4
Compare
447cdf4 to
3b9f355
Compare
Generate the mapping after FFIgen has run, so that we can properly rely on the renamers.
Fixes the code assets sample. (Note this sample isn't tested with
darton the CI because record use is still experimental and that would break on changes.)