This repository has been archived by the owner on May 19, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Property variance type annotations for Flow plugin (#161)
* Property variance type annotations for Flow plugin Non-method properties and indexers of object types, declare class, and interfaces can be "positive" or "negative." Class fields, but again not methods, can also have variance. This PR generalizes the variance annotations for type parameters into a new node type, and reuses that node for those properties. The code for object types is reused for interfaces and declare classes. The changes there are straightfoward. The code for class fields is reused for object literals, which do not support variance annotations (currently). This code is a bit sketchy, because we always parse variance annotations in the `parsePropertyName` extension, then error in a the subsequent parse phase for object literals (`parseObjPropValue`) or class methods (`parseClassMethod`). * Remove bogus unreachable code, clarify variance parsing conditional * Don't use a new node type for variance annotations Adding a new node type, specifically changing the TypeParameter node's variance property to be node-valued, is a breaking change. We might choose to make this breaking change in a later version. * s/start/variancePos
- Loading branch information
1 parent
b5877f0
commit 26809e8
Showing
63 changed files
with
1,228 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -292,7 +292,8 @@ | |
} | ||
} | ||
}, | ||
"optional": false | ||
"optional": false, | ||
"variance": null | ||
} | ||
], | ||
"indexers": [] | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,7 +188,8 @@ | |
} | ||
}, | ||
"optional": false, | ||
"static": true | ||
"static": true, | ||
"variance": null | ||
} | ||
], | ||
"indexers": [] | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,7 +137,8 @@ | |
"column": 51 | ||
} | ||
} | ||
} | ||
}, | ||
"variance": null | ||
} | ||
] | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,7 +231,8 @@ | |
}, | ||
"name": "U" | ||
} | ||
} | ||
}, | ||
"variance": null | ||
} | ||
] | ||
} | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,7 +235,8 @@ | |
} | ||
} | ||
}, | ||
"optional": false | ||
"optional": false, | ||
"variance": null | ||
} | ||
], | ||
"indexers": [] | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -333,4 +333,4 @@ | |
], | ||
"directives": [] | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.