Add STATIC_BASE_TYPE property to calls#1830
Merged
johannescoetzee merged 4 commits intomasterfrom Jul 23, 2025
Merged
Conversation
johannescoetzee
commented
Jul 16, 2025
| val AstParentType = 56 | ||
| val AstParentFullName = 57 | ||
| val DependencyGroupId = 58 | ||
| val StaticBaseType = 59 |
Contributor
Author
There was a problem hiding this comment.
I chose this arbitrarily since I don't know if this has any special meaning. I'm happy to change it if needs be
Edit: word from Michael is that it needs to be unique across the closed source schema too, but I checked and it looks good
ml86
approved these changes
Jul 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In several languages (at least PHP, C++, and Java), static methods are inherited as well as instance methods, e.g.
In this example, the
methodFullNameof thefoocall will beBar.foo:int(int)while the fullName of the method actually being called isFoo.foo:int(int). This call then isn't linked correctly since we assume for static calls the fullName of the call and method are the same.This issue can be fixed during AST creation if we have the type information available (probably Java, probably not C++ and definitely not PHP). To fix this in general, we need to know the base type on which the method is being called so that we can search the ancestor types for the method declaration if necessary, so this PR adds the
STATIC_BASE_TYPEfield to keep track of this information. Before call linking, we can use this information to look up the corresponding type decl which would give us the information we need. The callMETHOD_FULL_NAMEcan then be overwritten when we know the correct name.The
STATIC_BASE_TYPEproperty name is just an idea and I'm open to changing it if someone has a better one :)Other ideas @ml86 and I discussed for how to represent this were:
RECEIVERedge to aTYPE_REFfor relevant static calls. The issue is thatTYPE_REFsare a starting point for some dataflow steps, so without special handling this could impact performance.