PY-20744 Parse PEP-526 variable annotations
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Tue, 13 Sep 2016 19:46:35 +0000 (22:46 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Fri, 16 Sep 2016 05:16:26 +0000 (08:16 +0300)
commit3266460142a77c3a2b1fc9e9e85ef4cf1db768b8
tree464785d14d93a9f0de66f136d27ba545589744db
parent1ec6d3d0dd867f332fe683e06f00917bcd069104
PY-20744 Parse PEP-526 variable annotations

Annotation is preserved at the level of assignment nodes similar to
where CPython keeps them in its AST (in special "augassign" nodes).
For type annotations in form "x: int" without variable initialization
special statement PyTypeDefinitionStatement was introduced.
15 files changed:
python/psi-api/src/com/jetbrains/python/psi/PyAnnotationOwner.java [new file with mode: 0644]
python/psi-api/src/com/jetbrains/python/psi/PyAssignmentStatement.java
python/psi-api/src/com/jetbrains/python/psi/PyElementVisitor.java
python/psi-api/src/com/jetbrains/python/psi/PyFunction.java
python/psi-api/src/com/jetbrains/python/psi/PyNamedParameter.java
python/psi-api/src/com/jetbrains/python/psi/PyTypeDeclarationStatement.java [new file with mode: 0644]
python/src/com/jetbrains/python/PyElementTypes.java
python/src/com/jetbrains/python/PyTypeDeclarationStatementImpl.java [new file with mode: 0644]
python/src/com/jetbrains/python/PythonTokenSetContributor.java
python/src/com/jetbrains/python/parsing/FunctionParsing.java
python/src/com/jetbrains/python/parsing/StatementParsing.java
python/src/com/jetbrains/python/psi/impl/PyAssignmentStatementImpl.java
python/testData/psi/VariableAnnotations.py [new file with mode: 0644]
python/testData/psi/VariableAnnotations.txt [new file with mode: 0644]
python/testSrc/com/jetbrains/python/PythonParsingTest.java