Value classes: Support 'value' modifier in parser

This commit is contained in:
Ilmir Usmanov
2020-11-17 01:39:02 +01:00
parent d5979ffded
commit 11b2a07a59
4 changed files with 233 additions and 2 deletions
+35
View File
@@ -0,0 +1,35 @@
class value Foo
value private class Foo
value @Bar class Foo
value interface Foo
value abstract class Foo
value object Foo
value fun foo(){}
value class Foo
value class Foo {
val l = 1
fun invoke()
}
private value class Foo
expect value class Foo
actual value class Foo
@Bar value class Foo
class TopLevel {
value class Foo
}
value
class Foo
+189
View File
@@ -0,0 +1,189 @@
KtFile: valueClass.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('value')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting a top level declaration
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(private)('private')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace(' ')
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Bar')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(interface)('interface')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(abstract)('abstract')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
OBJECT_DECLARATION
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(object)('object')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
FUN
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('l')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiWhiteSpace('\n ')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('invoke')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(private)('private')
PsiWhiteSpace(' ')
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(expect)('expect')
PsiWhiteSpace(' ')
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(actual)('actual')
PsiWhiteSpace(' ')
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Bar')
PsiWhiteSpace(' ')
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n\n')
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('TopLevel')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
CLASS
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace(' ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(value)('value')
PsiWhiteSpace('\n')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Foo')