Corrected comments binding so that comments before local functions and classes are bound to them
This commit is contained in:
@@ -31,6 +31,14 @@ class D {
|
||||
|
||||
// Function foo()
|
||||
fun foo(/* parameters */ p1: Int/* p1 */, p2: Int /* p2 */) {
|
||||
// before local var
|
||||
val local = 1 // local var
|
||||
// before local fun
|
||||
fun localFun() = 1 // local fun
|
||||
// before local class
|
||||
class Local{} // local class
|
||||
// before statement
|
||||
foo() // statement
|
||||
} // end of foo
|
||||
|
||||
// class object
|
||||
|
||||
@@ -175,6 +175,60 @@ JetFile: CommentsBinding.kt
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiComment(EOL_COMMENT)('// before local var')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('local')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// local var')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiComment(EOL_COMMENT)('// before local fun')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('localFun')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// local fun')
|
||||
PsiWhiteSpace('\n ')
|
||||
CLASS
|
||||
PsiComment(EOL_COMMENT)('// before local class')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Local')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// local class')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiComment(EOL_COMMENT)('// before statement')
|
||||
PsiWhiteSpace('\n ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(EOL_COMMENT)('// statement')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
@@ -58,9 +58,9 @@ JetFile: When.kt
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiComment(EOL_COMMENT)('// foo')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiComment(EOL_COMMENT)('// foo')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
|
||||
@@ -602,11 +602,11 @@ JetFile: BinaryTree.kt
|
||||
BOOLEAN_CONSTANT
|
||||
PsiElement(false)('false')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiComment(EOL_COMMENT)('// In principle, this has access to item anyway, but then it's unreachable code')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiComment(EOL_COMMENT)('// BAD: the naive implementation of ref will create H(T) ref objects, but can be optimized to create only one')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiComment(EOL_COMMENT)('// In principle, this has access to item anyway, but then it's unreachable code')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiComment(EOL_COMMENT)('// BAD: the naive implementation of ref will create H(T) ref objects, but can be optimized to create only one')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('add')
|
||||
@@ -832,9 +832,9 @@ JetFile: BinaryTree.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiComment(EOL_COMMENT)('// In principle, this has access to item anyway')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
PsiComment(EOL_COMMENT)('// In principle, this has access to item anyway')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('addNoRef')
|
||||
|
||||
Reference in New Issue
Block a user