Uast: process catch parameters and finally blocks (KT-35804)
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
class TryCatch {
|
||||
fun catches() {
|
||||
try {
|
||||
body()
|
||||
} catch (e: Throwable) {
|
||||
catcher()
|
||||
} finally {
|
||||
finalizer()
|
||||
}
|
||||
}
|
||||
|
||||
fun body() {}
|
||||
fun catcher() {}
|
||||
fun finalizer() {}
|
||||
}
|
||||
|
||||
class TryCatchAnnotations {
|
||||
@java.lang.SuppressWarnings("Something")
|
||||
fun catches() {
|
||||
try {
|
||||
body()
|
||||
} catch (@java.lang.SuppressWarnings("Something") e: Throwable) {
|
||||
catcher()
|
||||
} finally {
|
||||
finalizer()
|
||||
}
|
||||
}
|
||||
|
||||
fun body() {}
|
||||
fun catcher() {}
|
||||
fun finalizer() {}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
UFile (package = )
|
||||
UClass (name = TryCatch)
|
||||
UMethod (name = catches)
|
||||
UBlockExpression
|
||||
UTryExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (body))
|
||||
USimpleNameReferenceExpression (identifier = body, resolvesTo = null)
|
||||
UCatchClause (e)
|
||||
UParameter (name = e)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (catcher))
|
||||
USimpleNameReferenceExpression (identifier = catcher, resolvesTo = null)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (finalizer))
|
||||
USimpleNameReferenceExpression (identifier = finalizer, resolvesTo = null)
|
||||
UMethod (name = body)
|
||||
UBlockExpression
|
||||
UMethod (name = catcher)
|
||||
UBlockExpression
|
||||
UMethod (name = finalizer)
|
||||
UBlockExpression
|
||||
UMethod (name = TryCatch)
|
||||
UClass (name = TryCatchAnnotations)
|
||||
UMethod (name = catches)
|
||||
UAnnotation (fqName = java.lang.SuppressWarnings)
|
||||
UNamedExpression (name = value)
|
||||
UPolyadicExpression (operator = +)
|
||||
ULiteralExpression (value = "Something")
|
||||
UBlockExpression
|
||||
UTryExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (body))
|
||||
USimpleNameReferenceExpression (identifier = body, resolvesTo = null)
|
||||
UCatchClause (e)
|
||||
UParameter (name = e)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UAnnotation (fqName = java.lang.SuppressWarnings)
|
||||
UNamedExpression (name = value)
|
||||
UPolyadicExpression (operator = +)
|
||||
ULiteralExpression (value = "Something")
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (catcher))
|
||||
USimpleNameReferenceExpression (identifier = catcher, resolvesTo = null)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (finalizer))
|
||||
USimpleNameReferenceExpression (identifier = finalizer, resolvesTo = null)
|
||||
UMethod (name = body)
|
||||
UBlockExpression
|
||||
UMethod (name = catcher)
|
||||
UBlockExpression
|
||||
UMethod (name = finalizer)
|
||||
UBlockExpression
|
||||
UMethod (name = TryCatchAnnotations)
|
||||
@@ -0,0 +1,42 @@
|
||||
public final class TryCatch {
|
||||
public final fun catches() : void {
|
||||
try {
|
||||
body()
|
||||
}
|
||||
catch (@org.jetbrains.annotations.NotNull var e: java.lang.Throwable) {
|
||||
catcher()
|
||||
}
|
||||
finally {
|
||||
finalizer()
|
||||
}
|
||||
}
|
||||
public final fun body() : void {
|
||||
}
|
||||
public final fun catcher() : void {
|
||||
}
|
||||
public final fun finalizer() : void {
|
||||
}
|
||||
public fun TryCatch() = UastEmptyExpression
|
||||
}
|
||||
|
||||
public final class TryCatchAnnotations {
|
||||
@java.lang.SuppressWarnings(value = "Something")
|
||||
public final fun catches() : void {
|
||||
try {
|
||||
body()
|
||||
}
|
||||
catch (@org.jetbrains.annotations.NotNull @java.lang.SuppressWarnings(value = "Something") var e: java.lang.Throwable) {
|
||||
catcher()
|
||||
}
|
||||
finally {
|
||||
finalizer()
|
||||
}
|
||||
}
|
||||
public final fun body() : void {
|
||||
}
|
||||
public final fun catcher() : void {
|
||||
}
|
||||
public final fun finalizer() : void {
|
||||
}
|
||||
public fun TryCatchAnnotations() = UastEmptyExpression
|
||||
}
|
||||
Reference in New Issue
Block a user