Fix parsing variable declaration in when subject

- parse destructuring declarations
- parse annotations on variable declaration in when subject
This commit is contained in:
Dmitry Petrov
2017-10-23 14:13:06 +03:00
parent 091b935c2d
commit 8aec99f4b5
7 changed files with 387 additions and 5 deletions
+341
View File
@@ -0,0 +1,341 @@
KtFile: WhenWithSubjectVariable.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('test')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x1')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x2t')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('y2t')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
DESTRUCTURING_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
DESTRUCTURING_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('x3')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DESTRUCTURING_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('x4')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
DESTRUCTURING_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
DESTRUCTURING_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('y3t')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DESTRUCTURING_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('y4')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
DESTRUCTURING_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
DESTRUCTURING_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('z3')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DESTRUCTURING_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('z4t')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
DESTRUCTURING_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
DESTRUCTURING_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('w3t')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DESTRUCTURING_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('w4t')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(DOT)('.')
PsiElement(IDENTIFIER)('x5')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T1')
PsiElement(DOT)('.')
PsiElement(IDENTIFIER)('x5t')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T2')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
PROPERTY
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Ann')
PsiWhiteSpace(' ')
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x6a')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x7a')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Ann')
PsiWhiteSpace(' ')
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x8a')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
ANNOTATED_EXPRESSION
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Ann')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')