fix: function body comments.
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
|
||||
*/
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class InternalNonStableExtensionPoints
|
||||
annotation class InternalNonStableExtensionPoints
|
||||
|
||||
@InternalNonStableExtensionPoints
|
||||
interface TypeResolutionInterceptorExtension {
|
||||
|
||||
@@ -153,7 +153,7 @@ public class Parser {
|
||||
Node pn = nf.createBlock(ts.tokenPosition);
|
||||
try {
|
||||
int tt;
|
||||
while ((tt = ts.peekToken()) > TokenStream.EOF && tt != TokenStream.RC) {
|
||||
while ((tt = ts.peekTokenWithComment()) > TokenStream.EOF && tt != TokenStream.RC) {
|
||||
if (tt == TokenStream.FUNCTION) {
|
||||
ts.getToken();
|
||||
pn.addChildToBack(function(ts, false));
|
||||
|
||||
@@ -536,13 +536,19 @@ public class TokenStream {
|
||||
}
|
||||
|
||||
public int peekToken() throws IOException {
|
||||
int result = getToken();
|
||||
return peekTokenHelper(getToken());
|
||||
}
|
||||
|
||||
this.pushbackToken = result;
|
||||
public int peekTokenWithComment() throws IOException {
|
||||
return peekTokenHelper(getTokenWithComment());
|
||||
}
|
||||
|
||||
private int peekTokenHelper(int token) throws IOException {
|
||||
this.pushbackToken = token;
|
||||
lastPosition = secondToLastPosition;
|
||||
lastTokenPosition = tokenPosition;
|
||||
tokenno--;
|
||||
return result;
|
||||
return token;
|
||||
}
|
||||
|
||||
public int peekTokenSameLine() throws IOException {
|
||||
|
||||
+7
-1
@@ -1,6 +1,8 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
// CHECK_COMMENT_EXISTS: text="Single line comment" multiline=false
|
||||
// CHECK_COMMENT_EXISTS: text="Multi line comment" multiline=true
|
||||
// CHECK_COMMENT_EXISTS: text="Single line comment inside function" multiline=false
|
||||
// CHECK_COMMENT_EXISTS: text="Multi line comment inside function" multiline=true
|
||||
// CHECK_COMMENT_EXISTS: text="After call single line comment" multiline=false
|
||||
// CHECK_COMMENT_EXISTS: text="After call multi line comment" multiline=true
|
||||
// CHECK_COMMENT_DOESNT_EXIST: text="random position comment 1" multiline=true
|
||||
@@ -11,7 +13,11 @@ package foo
|
||||
|
||||
fun box(): String {
|
||||
js("""
|
||||
function foo() {}
|
||||
function foo() {
|
||||
// Single line comment inside function
|
||||
Object;
|
||||
/*Multi line comment inside function*/
|
||||
}
|
||||
|
||||
// Single line comment
|
||||
foo();
|
||||
|
||||
Reference in New Issue
Block a user