Doc comments for parameters and property accessors

This commit is contained in:
Valentin Kipyatkov
2014-10-30 18:32:59 +03:00
parent 6915255d2f
commit 2200908367
9 changed files with 258 additions and 31 deletions
+6 -6
View File
@@ -400,8 +400,8 @@ JetFile: CommentsBinding.kt
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// this is getter')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// this is getter')
PsiWhiteSpace('\n ')
PROPERTY_ACCESSOR
PsiElement(set)('set')
@@ -414,8 +414,8 @@ JetFile: CommentsBinding.kt
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// this is setter')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// this is setter')
PsiWhiteSpace('\n\n')
PROPERTY
PsiElement(val)('val')
@@ -441,5 +441,5 @@ JetFile: CommentsBinding.kt
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// prop2')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// prop2')
@@ -0,0 +1,40 @@
/**
* Doc comment for A
*/
// some comment
class A(
/**
* Doc comment for val-parameter
*/
val p: Int
) {
/**
* Doc comment for function
*/
fun foo() {
/**
* Doc comment for local function
*/
fun localFoo() { }
/**
* Doc comment for local class
*/
class LocalClass
}
/**
* Doc comment for property
*/
var property: Int
/** Doc comment for getter */
get() = 1
/** Doc comment for setter */
set(value) {}
}
/**
* Doc comment for B
*/
class B {
}
@@ -0,0 +1,169 @@
JetFile: DocCommentsBinding.kt
PACKAGE_DIRECTIVE
<empty list>
CLASS
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('*')
PsiElement(KDOC_TEXT)(' Doc comment for A')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('// some comment')
PsiWhiteSpace('\n')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('A')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiWhiteSpace('\n ')
VALUE_PARAMETER
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('*')
PsiElement(KDOC_TEXT)(' Doc comment for val-parameter')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n ')
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('p')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiWhiteSpace('\n')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
FUN
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('*')
PsiElement(KDOC_TEXT)(' Doc comment for function')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n ')
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
FUN
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('*')
PsiElement(KDOC_TEXT)(' Doc comment for local function')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n ')
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('localFoo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace(' ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
CLASS
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('*')
PsiElement(KDOC_TEXT)(' Doc comment for local class')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n ')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('LocalClass')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ')
PROPERTY
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('*')
PsiElement(KDOC_TEXT)(' Doc comment for property')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n ')
PsiElement(var)('var')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('property')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiWhiteSpace('\n ')
PROPERTY_ACCESSOR
KDoc
PsiElement(KDOC_START)('/**')
PsiElement(KDOC_TEXT)(' Doc comment for getter ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n ')
PsiElement(get)('get')
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiWhiteSpace('\n ')
PROPERTY_ACCESSOR
KDoc
PsiElement(KDOC_START)('/**')
PsiElement(KDOC_TEXT)(' Doc comment for setter ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n ')
PsiElement(set)('set')
PsiElement(LPAR)('(')
VALUE_PARAMETER_LIST
VALUE_PARAMETER
PsiElement(IDENTIFIER)('value')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
CLASS
KDoc
PsiElement(KDOC_START)('/**')
PsiWhiteSpace('\n ')
PsiElement(KDOC_LEADING_ASTERISK)('*')
PsiElement(KDOC_TEXT)(' Doc comment for B')
PsiWhiteSpace('\n ')
PsiElement(KDOC_END)('*/')
PsiWhiteSpace('\n')
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('B')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n')
PsiElement(RBRACE)('}')