Refactor static properties / use correct this arguments #1259
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.
This PR fixes #1252 by refactoring static property prototypes to have a singleton instance. Previously, the compiler would instead resolve the respective getter/setter, skipping over the static prototype, while it now behaves more like with functions. Note that this still does not apply to instance properties, since properties can never be generic anyway so these are resolved together with the class, which then doesn't contain property prototypes anymore.
While on it, I also made compilation of
this
arguments use the correct type, which is either the implicit or explicitthis
type of a function or getter/setter, or the class type for fields. Noticed that this was still TODO for properties, but then also implemented it for everything else. Has a couple implications on null checking, where some property accesses would not have complained previously, but now do (see the related compiler source changes, likenamespace.members ? namespace.members.x : y
, necessary to fix bootstrapping).