Skip to content

Add support for searching for alternate invocees for externs #11

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

Conversation

bdunderscore
Copy link

For certain C# methods, Udon exposes the method via a different type than Roslyn considers it to be defined on. One example is
System.Type.Name, which is actually defined in System.Reflection.MemberInfo, but exposed via System.Type.Name.

This change allows U# to locate these alternate extern symbols and use them transparently. We move the logic for checking whether
symbols are exposed to udon down into BoundExternMethodInvocation, then teach this class to search declared interfaces and
superclasses of the invocation target (rather than the symbol's containing type) for defined externs.

Note that we assume that any exposed extern will match if we find it via a constructed symbol here.

Note: This is more-or-less a straight rebase of MerlinVR#129 .
I'm currently unable to add new tests to the integration test scene on this branch, due to what I suspect
are issues related to the serialization branch. For now I'm putting this PR up in case you can get the test
suite working on your machine; it at least does not seem to cause new regressions.

For certain C# methods, Udon exposes the method via a different type than Roslyn considers it to be defined on. One example is
`System.Type.Name`, which is actually defined in `System.Reflection.MemberInfo`, but exposed via `System.Type.Name`.

This change allows U# to locate these alternate extern symbols and use them transparently. We move the logic for checking whether
symbols are exposed to udon down into BoundExternMethodInvocation, then teach this class to search declared interfaces and
superclasses of the _invocation_ target (rather than the symbol's containing type) for defined externs.

Note that we assume that any exposed extern will match if we find it via a constructed symbol here.
@MerlinVR MerlinVR merged commit 365bc75 into vrchat-community:1.0-dev-serialization Mar 3, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants