Uast: Update tests, make the tests a bit more readable (provide toString() methods for Uast kinds)
This commit is contained in:
@@ -127,4 +127,8 @@ open class UastBinaryOperator(override val text: String): UastOperator {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val UNSIGNED_SHIFT_RIGHT_ASSIGN = AssignOperator(">>>=")
|
val UNSIGNED_SHIFT_RIGHT_ASSIGN = AssignOperator(">>>=")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastBinaryOperator(text='$text')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -23,4 +23,8 @@ class UastCallKind(val name: String) {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val CONSTRUCTOR_CALL = UastCallKind("constructor_call")
|
val CONSTRUCTOR_CALL = UastCallKind("constructor_call")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastCallKind(name='$name')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -35,4 +35,8 @@ open class UastClassKind(val text: String) {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val OBJECT = UastClassKind("object")
|
val OBJECT = UastClassKind("object")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastClassKind(text='$text')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -25,4 +25,8 @@ open class UastFunctionKind(val text: String) {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val CONSTRUCTOR = UastFunctionKind("CONSTRUCTOR")
|
val CONSTRUCTOR = UastFunctionKind("CONSTRUCTOR")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastFunctionKind(text='$text')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -25,4 +25,8 @@ class UastImportKind(val text: String) {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val MEMBER = UastImportKind("member")
|
val MEMBER = UastImportKind("member")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastImportKind(text='$text')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,4 +28,8 @@ class UastModifier(val name: String) {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val OVERRIDE = UastModifier("override")
|
val OVERRIDE = UastModifier("override")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastModifier(name='$name')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,8 @@ class UastPostfixOperator(override val text: String): UastOperator {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val UNKNOWN = UastPostfixOperator("<unknown>")
|
val UNKNOWN = UastPostfixOperator("<unknown>")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastPostfixOperator(text='$text')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,4 +40,8 @@ class UastPrefixOperator(override val text: String): UastOperator {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val UNKNOWN = UastPrefixOperator("<unknown>")
|
val UNKNOWN = UastPrefixOperator("<unknown>")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastPrefixOperator(text='$text')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,8 @@ class UastQualifiedExpressionAccessType(val name: String) {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val SIMPLE = UastQualifiedExpressionAccessType(".")
|
val SIMPLE = UastQualifiedExpressionAccessType(".")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastQualifiedExpressionAccessType(name='$name')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -29,4 +29,8 @@ class UastSpecialExpressionKind(val name: String) {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val CONTINUE = UastSpecialExpressionKind("continue")
|
val CONTINUE = UastSpecialExpressionKind("continue")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastSpecialExpressionKind(name='$name')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,4 +26,8 @@ class UastVariableKind(val name: String) {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val VALUE_PARAMETER = UastVariableKind("parameter")
|
val VALUE_PARAMETER = UastVariableKind("parameter")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String{
|
||||||
|
return "UastVariableKind(name='$name')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,4 +28,8 @@ class UastVisibility(val name: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isPublic() = this == PUBLIC
|
fun isPublic() = this == PUBLIC
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "UastVisibility(name='$name')"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ import java.io.File
|
|||||||
|
|
||||||
open class AbstractStructureTest : LightCodeInsightTestCase() {
|
open class AbstractStructureTest : LightCodeInsightTestCase() {
|
||||||
fun test(name: String) {
|
fun test(name: String) {
|
||||||
val testDir = File("testData")
|
val testDir = testDataPath
|
||||||
val javaFile = File(testDir, "$name.java")
|
val javaFile = File(testDir, "$name.java")
|
||||||
val logFile = File(File(testDir, "log"), "$name.txt")
|
val logFile = File(File(testDir, "log"), "$name.txt")
|
||||||
val renderFile = File(File(testDir, "render"), "$name.txt")
|
val renderFile = File(File(testDir, "render"), "$name.txt")
|
||||||
@@ -61,4 +61,6 @@ open class AbstractStructureTest : LightCodeInsightTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class NoTestFileException(file: File) : RuntimeException("Test file was generated: $file")
|
private class NoTestFileException(file: File) : RuntimeException("Test file was generated: $file")
|
||||||
|
|
||||||
|
override fun getTestDataPath() = "plugins/uast-java/testData"
|
||||||
}
|
}
|
||||||
+7
-7
@@ -1,6 +1,6 @@
|
|||||||
UFile (package = null)
|
UFile (package = null)
|
||||||
UClass (_Dummy_, enum = false, interface = false, object = false)
|
UClass (_Dummy_, kind = class)
|
||||||
UClass (ControlStructures, enum = false, interface = false, object = false)
|
UClass (ControlStructures, kind = class)
|
||||||
UFunction (main, kind = function, paramCount = 1)
|
UFunction (main, kind = function, paramCount = 1)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
UIfExpression
|
UIfExpression
|
||||||
@@ -11,7 +11,7 @@ UFile (package = null)
|
|||||||
ULiteralExpression (0)
|
ULiteralExpression (0)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
USpecialExpressionList (return)
|
USpecialExpressionList (return)
|
||||||
|
|
||||||
EmptyExpression
|
EmptyExpression
|
||||||
UDeclarationsExpression
|
UDeclarationsExpression
|
||||||
UVariable (mode, kind = local)
|
UVariable (mode, kind = local)
|
||||||
@@ -30,7 +30,7 @@ UFile (package = null)
|
|||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (System)
|
USimpleReferenceExpression (System)
|
||||||
USimpleReferenceExpression (out)
|
USimpleReferenceExpression (out)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (println)
|
USimpleReferenceExpression (println)
|
||||||
USimpleReferenceExpression (arg)
|
USimpleReferenceExpression (arg)
|
||||||
UForExpression
|
UForExpression
|
||||||
@@ -49,7 +49,7 @@ UFile (package = null)
|
|||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (System)
|
USimpleReferenceExpression (System)
|
||||||
USimpleReferenceExpression (out)
|
USimpleReferenceExpression (out)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (println)
|
USimpleReferenceExpression (println)
|
||||||
UBinaryExpression (+)
|
UBinaryExpression (+)
|
||||||
UBinaryExpression (+)
|
UBinaryExpression (+)
|
||||||
@@ -72,7 +72,7 @@ UFile (package = null)
|
|||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (System)
|
USimpleReferenceExpression (System)
|
||||||
USimpleReferenceExpression (out)
|
USimpleReferenceExpression (out)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (println)
|
USimpleReferenceExpression (println)
|
||||||
UBinaryExpression (+)
|
UBinaryExpression (+)
|
||||||
ULiteralExpression ("Index ")
|
ULiteralExpression ("Index ")
|
||||||
@@ -93,7 +93,7 @@ UFile (package = null)
|
|||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (System)
|
USimpleReferenceExpression (System)
|
||||||
USimpleReferenceExpression (out)
|
USimpleReferenceExpression (out)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (println)
|
USimpleReferenceExpression (println)
|
||||||
USimpleReferenceExpression (i)
|
USimpleReferenceExpression (i)
|
||||||
UAssignmentExpression (+=)
|
UAssignmentExpression (+=)
|
||||||
|
|||||||
+6
-6
@@ -1,9 +1,9 @@
|
|||||||
UFile (package = null)
|
UFile (package = null)
|
||||||
UClass (_Dummy_, enum = false, interface = false, object = false)
|
UClass (_Dummy_, kind = class)
|
||||||
UClass (Lambda, enum = false, interface = false, object = false)
|
UClass (Lambda, kind = class)
|
||||||
UFunction (example, kind = function, paramCount = 0)
|
UFunction (example, kind = function, paramCount = 0)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 2)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 2)
|
||||||
USimpleReferenceExpression (doJob)
|
USimpleReferenceExpression (doJob)
|
||||||
ULambdaExpression
|
ULambdaExpression
|
||||||
UVariable (arg, kind = parameter)
|
UVariable (arg, kind = parameter)
|
||||||
@@ -18,13 +18,13 @@ UFile (package = null)
|
|||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (System)
|
USimpleReferenceExpression (System)
|
||||||
USimpleReferenceExpression (out)
|
USimpleReferenceExpression (out)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (println)
|
USimpleReferenceExpression (println)
|
||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (job)
|
USimpleReferenceExpression (job)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (doJob)
|
USimpleReferenceExpression (doJob)
|
||||||
USimpleReferenceExpression (arg)
|
USimpleReferenceExpression (arg)
|
||||||
UClass (Job, enum = false, interface = true, object = false)
|
UClass (Job, kind = interface)
|
||||||
UFunction (doJob, kind = function, paramCount = 1)
|
UFunction (doJob, kind = function, paramCount = 1)
|
||||||
EmptyExpression
|
EmptyExpression
|
||||||
+6
-7
@@ -1,11 +1,10 @@
|
|||||||
UFile (package = null)
|
UFile (package = null)
|
||||||
UClass (_Dummy_, enum = false, interface = false, object = false)
|
UClass (_Dummy_, kind = class)
|
||||||
UClass (NestedClasses, enum = false, interface = false, object = false)
|
UClass (NestedClasses, kind = class)
|
||||||
UClass (Nested, enum = false, interface = false, object = false)
|
UClass (Nested, kind = class)
|
||||||
UFunction (func1, kind = function, paramCount = 0)
|
UFunction (func1, kind = function, paramCount = 0)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
|
|
||||||
UClass (Inner, enum = false, interface = false, object = false)
|
UClass (Inner, kind = class)
|
||||||
UFunction (func2, kind = function, paramCount = 0)
|
UFunction (func2, kind = function, paramCount = 0)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
|
|
||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
UFile (package = null)
|
UFile (package = null)
|
||||||
UClass (_Dummy_, enum = false, interface = false, object = false)
|
UClass (_Dummy_, kind = class)
|
||||||
UClass (Simple, enum = false, interface = false, object = false)
|
UClass (Simple, kind = class)
|
||||||
UVariable (name, kind = member)
|
UVariable (name, kind = member)
|
||||||
EmptyExpression
|
EmptyExpression
|
||||||
UFunction (Simple, kind = function, paramCount = 1)
|
UFunction (<init>, kind = CONSTRUCTOR, paramCount = 1)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
UAssignmentExpression (=)
|
UAssignmentExpression (=)
|
||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
|
|||||||
+14
-14
@@ -1,6 +1,6 @@
|
|||||||
UFile (package = null)
|
UFile (package = null)
|
||||||
UClass (_Dummy_, enum = false, interface = false, object = false)
|
UClass (_Dummy_, kind = class)
|
||||||
UClass (SpecialExpressions, enum = false, interface = false, object = false)
|
UClass (SpecialExpressions, kind = class)
|
||||||
UFunction (test, kind = function, paramCount = 0)
|
UFunction (test, kind = function, paramCount = 0)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
USpecialExpressionList (assert)
|
USpecialExpressionList (assert)
|
||||||
@@ -20,7 +20,7 @@ UFile (package = null)
|
|||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (System)
|
USimpleReferenceExpression (System)
|
||||||
USimpleReferenceExpression (out)
|
USimpleReferenceExpression (out)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (println)
|
USimpleReferenceExpression (println)
|
||||||
ULiteralExpression ("A")
|
ULiteralExpression ("A")
|
||||||
UDeclarationsExpression
|
UDeclarationsExpression
|
||||||
@@ -41,7 +41,7 @@ UFile (package = null)
|
|||||||
ULiteralExpression (3)
|
ULiteralExpression (3)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
USpecialExpressionList (break)
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
EmptyExpression
|
EmptyExpression
|
||||||
UIfExpression
|
UIfExpression
|
||||||
UBinaryExpression (===)
|
UBinaryExpression (===)
|
||||||
@@ -51,20 +51,20 @@ UFile (package = null)
|
|||||||
ULiteralExpression (0)
|
ULiteralExpression (0)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
USpecialExpressionList (continue)
|
USpecialExpressionList (continue)
|
||||||
|
|
||||||
EmptyExpression
|
EmptyExpression
|
||||||
UPostfixExpression (--)
|
UPostfixExpression (--)
|
||||||
USimpleReferenceExpression (a)
|
USimpleReferenceExpression (a)
|
||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
UThisExpression
|
UThisExpression
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 0)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 0)
|
||||||
USimpleReferenceExpression (test)
|
USimpleReferenceExpression (test)
|
||||||
|
|
||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USuperExpression
|
USuperExpression
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 0)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 0)
|
||||||
USimpleReferenceExpression (hashCode)
|
USimpleReferenceExpression (hashCode)
|
||||||
|
|
||||||
UDeclarationsExpression
|
UDeclarationsExpression
|
||||||
UVariable (x, kind = local)
|
UVariable (x, kind = local)
|
||||||
EmptyExpression
|
EmptyExpression
|
||||||
@@ -78,7 +78,7 @@ UFile (package = null)
|
|||||||
USimpleReferenceExpression (x)
|
USimpleReferenceExpression (x)
|
||||||
ULiteralExpression ("1")
|
ULiteralExpression ("1")
|
||||||
USpecialExpressionList (break)
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
UExpressionSwitchClauseExpression
|
UExpressionSwitchClauseExpression
|
||||||
ULiteralExpression (3)
|
ULiteralExpression (3)
|
||||||
UAssignmentExpression (=)
|
UAssignmentExpression (=)
|
||||||
@@ -97,16 +97,16 @@ UFile (package = null)
|
|||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (System)
|
USimpleReferenceExpression (System)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 2)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 2)
|
||||||
USimpleReferenceExpression (getProperty)
|
USimpleReferenceExpression (getProperty)
|
||||||
ULiteralExpression ("abc")
|
ULiteralExpression ("abc")
|
||||||
ULiteralExpression ("")
|
ULiteralExpression ("")
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (equals)
|
USimpleReferenceExpression (equals)
|
||||||
ULiteralExpression ("1")
|
ULiteralExpression ("1")
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
USpecialExpressionList (throw)
|
USpecialExpressionList (throw)
|
||||||
UFunctionCallExpression (CONSTRUCTOR_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='constructor_call'), argCount = 1)
|
||||||
<no element>
|
<no element>
|
||||||
ULiteralExpression ("Err")
|
ULiteralExpression ("Err")
|
||||||
EmptyExpression
|
EmptyExpression
|
||||||
@@ -114,7 +114,7 @@ UFile (package = null)
|
|||||||
UBlockExpression
|
UBlockExpression
|
||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (Thread)
|
USimpleReferenceExpression (Thread)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (sleep)
|
USimpleReferenceExpression (sleep)
|
||||||
ULiteralExpression (1000) UCatchClause
|
ULiteralExpression (1000) UCatchClause
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
|
|||||||
+10
-10
@@ -1,33 +1,33 @@
|
|||||||
default class _Dummy_ {
|
default class _Dummy_ {
|
||||||
default inner class ControlStructures {
|
default class ControlStructures {
|
||||||
public fun main(args: java.lang.String[]): void {
|
public fun main(args: String[]): void {
|
||||||
if (args.length === 0) {
|
if (args.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var mode: String = (args.length === 1) ? ("singleArg") : ("multiArgs")
|
var mode: String = (args.length === 1) ? ("singleArg") : ("multiArgs")
|
||||||
for (arg : args) {
|
for (arg : args) {
|
||||||
System.out.println(arg)
|
System.out.println(arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i: int = 0; i < args.length; ++i) {
|
for (var i: int = 0; i < args.length; ++i) {
|
||||||
System.out.println(i + ": " + args[i])
|
System.out.println(i + ": " + args[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
var i: int = 0
|
var i: int = 0
|
||||||
while (i < args.length) {
|
while (i < args.length) {
|
||||||
System.out.println("Index " + i)
|
System.out.println("Index " + i)
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
do {
|
do {
|
||||||
System.out.println(i)
|
System.out.println(i)
|
||||||
i += 1
|
i += 1
|
||||||
}
|
}
|
||||||
while (i < args.length)
|
while (i < args.length)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
default class _Dummy_ {
|
default class _Dummy_ {
|
||||||
default inner class Lambda {
|
default class Lambda {
|
||||||
default fun example(): void {
|
default fun example(): void {
|
||||||
doJob({ arg: String ->
|
doJob({ arg: String ->
|
||||||
arg + arg
|
arg + arg
|
||||||
@@ -11,7 +11,7 @@ default class _Dummy_ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
default abstract interface Job {
|
default abstract static interface Job {
|
||||||
public fun doJob(arg: String): String = EmptyExpression
|
public fun doJob(arg: String): String = EmptyExpression
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -1,14 +1,14 @@
|
|||||||
default class _Dummy_ {
|
default class _Dummy_ {
|
||||||
default inner class NestedClasses {
|
default class NestedClasses {
|
||||||
public class Nested {
|
public static class Nested {
|
||||||
default fun func1(): void {
|
default fun func1(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public inner class Inner {
|
public class Inner {
|
||||||
default fun func2(): void {
|
default fun func2(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+7
-7
@@ -1,18 +1,18 @@
|
|||||||
default class _Dummy_ {
|
default class _Dummy_ {
|
||||||
default inner class Simple {
|
default class Simple {
|
||||||
var name: String
|
var name: String
|
||||||
|
|
||||||
public fun Simple(name: String) {
|
public fun <init>(name: String) {
|
||||||
this.name = name
|
this.name = name
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun getName(): String {
|
public fun getName(): String {
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun setName(name: String): void {
|
public fun setName(name: String): void {
|
||||||
this.name = name
|
this.name = name
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+23
-23
@@ -1,68 +1,68 @@
|
|||||||
default class _Dummy_ {
|
default class _Dummy_ {
|
||||||
default inner class SpecialExpressions {
|
default class SpecialExpressions {
|
||||||
default fun test(): boolean {
|
default fun test(): boolean {
|
||||||
assert 5 > 3 : EmptyExpression
|
assert 5 > 3 : EmptyExpression
|
||||||
assert 5 > 3 : "Message"
|
assert 5 > 3 : "Message"
|
||||||
synchronized this : {
|
synchronized this : {
|
||||||
System.out.println("A")
|
System.out.println("A")
|
||||||
}
|
}
|
||||||
|
|
||||||
var a: int = 5
|
var a: int = 5
|
||||||
var b: int = 7
|
var b: int = 7
|
||||||
var c: int
|
var c: int
|
||||||
while (a > 0) {
|
while (a > 0) {
|
||||||
if (a === 3) {
|
if (a === 3) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a % 5 === 0) {
|
if (a % 5 === 0) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
a--
|
a--
|
||||||
}
|
}
|
||||||
|
|
||||||
this.test()
|
this.test()
|
||||||
super.hashCode()
|
super.hashCode()
|
||||||
var x: String
|
var x: String
|
||||||
switch (a)
|
switch (a)
|
||||||
{
|
{
|
||||||
case 1:
|
1 ->
|
||||||
{
|
{
|
||||||
x = "1"
|
x = "1"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
case 3:
|
3 ->
|
||||||
x = "3"
|
x = "3"
|
||||||
case 4:
|
4 ->
|
||||||
x = "4"
|
x = "4"
|
||||||
else:
|
else ->
|
||||||
x = ""
|
x = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (System.getProperty("abc", "").equals("1")) {
|
if (System.getProperty("abc", "").equals("1")) {
|
||||||
throw <noref>("Err")
|
throw AssertionError("Err")
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000)
|
Thread.sleep(1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (e) {
|
catch (e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
finally {
|
finally {
|
||||||
a = 3
|
a = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
a = 5
|
a = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+196
-5
@@ -1,11 +1,202 @@
|
|||||||
UFile (package = null)
|
UFile (package = null)
|
||||||
UClass (ControlStructures, enum = false, interface = false, object = false)
|
UClass (ControlStructures, kind = class)
|
||||||
|
UFunction (<init>, kind = CONSTRUCTOR, paramCount = 0)
|
||||||
|
EmptyExpression
|
||||||
UFunction (test, kind = function, paramCount = 0)
|
UFunction (test, kind = function, paramCount = 0)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
|
UIfExpression
|
||||||
|
UBinaryExpression (>)
|
||||||
|
ULiteralExpression (5)
|
||||||
|
ULiteralExpression (3)
|
||||||
|
UBlockExpression
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (println)
|
||||||
|
ULiteralExpression ("5 > 3")
|
||||||
|
<no element>
|
||||||
|
UForEachExpression (c)
|
||||||
|
ULiteralExpression ("ABC")
|
||||||
|
UBlockExpression
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (println)
|
||||||
|
USimpleReferenceExpression (c)
|
||||||
|
UForEachExpression (c)
|
||||||
|
ULiteralExpression ("DEF")
|
||||||
|
UBlockExpression
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (println)
|
||||||
|
UQualifiedExpression
|
||||||
|
USimpleReferenceExpression (c)
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 0)
|
||||||
|
USimpleReferenceExpression (toByte)
|
||||||
|
|
||||||
|
UDeclarationsExpression
|
||||||
|
UVariable (i, kind = local)
|
||||||
|
ULiteralExpression (5)
|
||||||
|
UWhileExpression
|
||||||
|
UBinaryExpression (>)
|
||||||
|
USimpleReferenceExpression (i)
|
||||||
|
ULiteralExpression (0)
|
||||||
|
UBlockExpression
|
||||||
|
UPostfixExpression (--)
|
||||||
|
USimpleReferenceExpression (i)
|
||||||
|
UIfExpression
|
||||||
|
UBinaryExpression (==)
|
||||||
|
USimpleReferenceExpression (i)
|
||||||
|
ULiteralExpression (3)
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
|
<no element>
|
||||||
|
UIfExpression
|
||||||
|
UBinaryExpression (==)
|
||||||
|
USimpleReferenceExpression (i)
|
||||||
|
ULiteralExpression (2)
|
||||||
|
UBlockExpression
|
||||||
|
USpecialExpressionList (continue)
|
||||||
|
|
||||||
|
<no element>
|
||||||
|
UBinaryExpression (=)
|
||||||
|
USimpleReferenceExpression (i)
|
||||||
|
ULiteralExpression (5)
|
||||||
|
UDoWhileExpression
|
||||||
|
UBinaryExpression (>)
|
||||||
|
USimpleReferenceExpression (i)
|
||||||
|
ULiteralExpression (0)
|
||||||
|
UBlockExpression
|
||||||
|
UBinaryExpression (-=)
|
||||||
|
USimpleReferenceExpression (i)
|
||||||
|
ULiteralExpression (1)
|
||||||
|
UQualifiedExpression
|
||||||
|
ULiteralExpression ("ABC")
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (forEach)
|
||||||
|
ULambdaExpression
|
||||||
|
|
||||||
|
UBlockExpression
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (println)
|
||||||
|
UArrayAccessExpression
|
||||||
|
UQualifiedExpression
|
||||||
|
USimpleReferenceExpression (it)
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 0)
|
||||||
|
USimpleReferenceExpression (toString)
|
||||||
|
|
||||||
|
ULiteralExpression (0)
|
||||||
|
UQualifiedExpression
|
||||||
|
UQualifiedExpression
|
||||||
|
ULiteralExpression ("ABC")
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (zip)
|
||||||
|
ULiteralExpression ("DEF")
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (forEach)
|
||||||
|
ULambdaExpression
|
||||||
|
|
||||||
|
UBlockExpression
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (println)
|
||||||
|
UBinaryExpression (+)
|
||||||
|
UBinaryExpression (+)
|
||||||
|
UQualifiedExpression
|
||||||
|
USimpleReferenceExpression (it)
|
||||||
|
USimpleReferenceExpression (first)
|
||||||
|
ULiteralExpression (" ")
|
||||||
|
UQualifiedExpression
|
||||||
|
USimpleReferenceExpression (it)
|
||||||
|
USimpleReferenceExpression (second)
|
||||||
|
UDeclarationsExpression
|
||||||
|
UVariable (var1496943053, kind = local)
|
||||||
|
UQualifiedExpression
|
||||||
|
ULiteralExpression ("ABC")
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (zip)
|
||||||
|
ULiteralExpression ("DEF")
|
||||||
|
UVariable (a, kind = local)
|
||||||
|
UQualifiedExpression
|
||||||
|
USimpleReferenceExpression (var1496943053)
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 0)
|
||||||
|
USimpleReferenceExpression (component1)
|
||||||
|
|
||||||
|
UVariable (b, kind = local)
|
||||||
|
UQualifiedExpression
|
||||||
|
USimpleReferenceExpression (var1496943053)
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 0)
|
||||||
|
USimpleReferenceExpression (component2)
|
||||||
|
|
||||||
|
UDeclarationsExpression
|
||||||
|
UVariable (value, kind = local)
|
||||||
|
UIfExpression
|
||||||
|
UBinaryExpression (>)
|
||||||
|
ULiteralExpression (5)
|
||||||
|
ULiteralExpression (3)
|
||||||
|
ULiteralExpression ("a")
|
||||||
|
ULiteralExpression ("b")
|
||||||
|
UDeclarationsExpression
|
||||||
|
UVariable (list, kind = local)
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (listOf)
|
||||||
|
ULiteralExpression ("A")
|
||||||
|
UDeclarationsExpression
|
||||||
|
UVariable (list2, kind = local)
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (listOf)
|
||||||
|
ULiteralExpression ("A")
|
||||||
|
UDeclarationsExpression
|
||||||
|
UVariable (type, kind = local)
|
||||||
|
USwitchExpression
|
||||||
|
USimpleReferenceExpression (value)
|
||||||
|
USpecialExpressionList (when)
|
||||||
|
KotlinUSwitchEntry
|
||||||
|
USpecialExpressionList (when_entry)
|
||||||
|
ULiteralExpression ("inlist")
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
|
KotlinUSwitchEntry
|
||||||
|
USpecialExpressionList (when_entry)
|
||||||
|
ULiteralExpression ("notinlist2")
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
|
KotlinUSwitchEntry
|
||||||
|
USpecialExpressionList (when_entry)
|
||||||
|
ULiteralExpression ("string")
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
|
KotlinUSwitchEntry
|
||||||
|
USpecialExpressionList (when_entry)
|
||||||
|
ULiteralExpression ("cs")
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
|
KotlinUSwitchEntry
|
||||||
|
USpecialExpressionList (when_entry)
|
||||||
|
ULiteralExpression ("unknown")
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
UDeclarationsExpression
|
UDeclarationsExpression
|
||||||
UVariable (x, kind = local)
|
UVariable (x, kind = local)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
USwitchExpression
|
||||||
USimpleReferenceExpression (listOf)
|
<no element>
|
||||||
ULiteralExpression ("ABC")
|
USpecialExpressionList (when)
|
||||||
|
KotlinUSwitchEntry
|
||||||
|
USpecialExpressionList (when_entry)
|
||||||
|
ULiteralExpression ("B")
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
|
KotlinUSwitchEntry
|
||||||
|
USpecialExpressionList (when_entry)
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (println)
|
||||||
|
ULiteralExpression ("A")
|
||||||
|
ULiteralExpression ("Q")
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
|
KotlinUSwitchEntry
|
||||||
|
USpecialExpressionList (when_entry)
|
||||||
|
ULiteralExpression ("!")
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
|
KotlinUSwitchEntry
|
||||||
|
USpecialExpressionList (when_entry)
|
||||||
|
ULiteralExpression ("A")
|
||||||
|
USpecialExpressionList (break)
|
||||||
|
|
||||||
USpecialExpressionList (return)
|
USpecialExpressionList (return)
|
||||||
ULiteralExpression (false)
|
ULiteralExpression (false)
|
||||||
+10
-4
@@ -1,11 +1,17 @@
|
|||||||
UFile (package = null)
|
UFile (package = null)
|
||||||
UClass (Declarations, enum = false, interface = false, object = false)
|
UClass (Declarations, kind = class)
|
||||||
|
UFunction (<init>, kind = CONSTRUCTOR, paramCount = 0)
|
||||||
|
EmptyExpression
|
||||||
UVariable (a, kind = member)
|
UVariable (a, kind = member)
|
||||||
ULiteralExpression ("a")
|
ULiteralExpression ("a")
|
||||||
UClass (NestedClass, enum = false, interface = false, object = false)
|
UClass (NestedClass, kind = class)
|
||||||
|
UFunction (<init>, kind = CONSTRUCTOR, paramCount = 0)
|
||||||
|
EmptyExpression
|
||||||
UVariable (b, kind = member)
|
UVariable (b, kind = member)
|
||||||
ULiteralExpression ("b")
|
ULiteralExpression ("b")
|
||||||
UClass (InnerClass, enum = false, interface = false, object = false)
|
UClass (InnerClass, kind = class)
|
||||||
|
UFunction (<init>, kind = CONSTRUCTOR, paramCount = 0)
|
||||||
|
EmptyExpression
|
||||||
UVariable (c, kind = member)
|
UVariable (c, kind = member)
|
||||||
USimpleReferenceExpression (a)
|
USimpleReferenceExpression (a)
|
||||||
UFunction (func, kind = function, paramCount = 2)
|
UFunction (func, kind = function, paramCount = 2)
|
||||||
@@ -18,4 +24,4 @@ UFile (package = null)
|
|||||||
ULiteralExpression (1)
|
ULiteralExpression (1)
|
||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (b)
|
USimpleReferenceExpression (b)
|
||||||
USimpleReferenceExpression (length)
|
USimpleReferenceExpression (length)
|
||||||
+9
-3
@@ -1,19 +1,25 @@
|
|||||||
UFile (package = null)
|
UFile (package = null)
|
||||||
UClass (Simple, enum = false, interface = false, object = false)
|
UClass (Simple, kind = class)
|
||||||
|
UFunction (<init>, kind = CONSTRUCTOR, paramCount = 0)
|
||||||
|
EmptyExpression
|
||||||
UVariable (a, kind = member)
|
UVariable (a, kind = member)
|
||||||
UBinaryExpression (+)
|
UBinaryExpression (+)
|
||||||
UBinaryExpression (+)
|
UBinaryExpression (+)
|
||||||
ULiteralExpression ("text")
|
ULiteralExpression ("text")
|
||||||
ULiteralExpression ("other")
|
ULiteralExpression ("other")
|
||||||
ULiteralExpression ("text")
|
ULiteralExpression ("text")
|
||||||
|
UVariable (b, kind = member)
|
||||||
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
|
USimpleReferenceExpression (listOf)
|
||||||
|
ULiteralExpression ("A")
|
||||||
UFunction (test, kind = function, paramCount = 0)
|
UFunction (test, kind = function, paramCount = 0)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
UQualifiedExpression
|
UQualifiedExpression
|
||||||
USimpleReferenceExpression (System)
|
USimpleReferenceExpression (System)
|
||||||
USimpleReferenceExpression (out)
|
USimpleReferenceExpression (out)
|
||||||
UFunctionCallExpression (FUNCTION_CALL, argCount = 1)
|
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
|
||||||
USimpleReferenceExpression (println)
|
USimpleReferenceExpression (println)
|
||||||
UBinaryExpression (/)
|
UBinaryExpression (/)
|
||||||
ULiteralExpression (5.0f)
|
ULiteralExpression (5.0f)
|
||||||
ULiteralExpression (2)
|
ULiteralExpression (2)
|
||||||
+94
-2
@@ -1,6 +1,98 @@
|
|||||||
public class ControlStructures {
|
public static class ControlStructures {
|
||||||
|
public fun <init>() = EmptyExpression
|
||||||
public fun test(): Boolean {
|
public fun test(): Boolean {
|
||||||
var x: List = listOf("ABC")
|
if (5 > 3) {
|
||||||
|
println("5 > 3")
|
||||||
|
}
|
||||||
|
|
||||||
|
for (c : "ABC") {
|
||||||
|
println(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (c : "DEF") {
|
||||||
|
println(c.toByte())
|
||||||
|
}
|
||||||
|
|
||||||
|
var i: Int = 5
|
||||||
|
while (i > 0) {
|
||||||
|
i--
|
||||||
|
if (i == 3) break
|
||||||
|
if (i == 2) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
i = 5
|
||||||
|
do {
|
||||||
|
i -= 1
|
||||||
|
}
|
||||||
|
while (i > 0)
|
||||||
|
|
||||||
|
"ABC".forEach({
|
||||||
|
println(it.toString()[0])
|
||||||
|
})
|
||||||
|
"ABC".zip("DEF").forEach({
|
||||||
|
println(it.first + " " + it.second)
|
||||||
|
})
|
||||||
|
var var1496943053: <error> = "ABC".zip("DEF")
|
||||||
|
var a: Pair<Char, Char> = var1496943053.component1()
|
||||||
|
var b: Pair<Char, Char> = var1496943053.component2()
|
||||||
|
var value: String = if (5 > 3) "a" else "b"
|
||||||
|
var list: List<String> = listOf("A")
|
||||||
|
var list2: List<String> = listOf("A")
|
||||||
|
var type: String = switch (value) {
|
||||||
|
it in list -> {
|
||||||
|
"inlist"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
it in list2 -> {
|
||||||
|
"notinlist2"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
(it) is null -> {
|
||||||
|
"string"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
(it) is null -> {
|
||||||
|
"cs"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
"unknown"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var x: String = switch {
|
||||||
|
value == "b" -> {
|
||||||
|
"B"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
5 % 2 == 0 -> {
|
||||||
|
println("A")
|
||||||
|
"Q"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
false -> {
|
||||||
|
"!"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
"A"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -1,11 +1,14 @@
|
|||||||
public class Declarations {
|
public static class Declarations {
|
||||||
|
public fun <init>() = EmptyExpression
|
||||||
var a: String = "a"
|
var a: String = "a"
|
||||||
|
|
||||||
public class NestedClass {
|
public static class NestedClass {
|
||||||
|
public fun <init>() = EmptyExpression
|
||||||
var b: String = "b"
|
var b: String = "b"
|
||||||
|
|
||||||
}
|
}
|
||||||
public inner class InnerClass {
|
public class InnerClass {
|
||||||
|
public fun <init>() = EmptyExpression
|
||||||
var c: CharSequence = a
|
var c: CharSequence = a
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -1,6 +1,8 @@
|
|||||||
public class Simple {
|
public static class Simple {
|
||||||
|
public fun <init>() = EmptyExpression
|
||||||
var a: String = "text" + "other" + "text"
|
var a: String = "text" + "other" + "text"
|
||||||
val b = listOf("A")
|
|
||||||
|
var b: List<String> = listOf("A")
|
||||||
|
|
||||||
public fun test(): Unit {
|
public fun test(): Unit {
|
||||||
System.out.println(5.0f / 2)
|
System.out.println(5.0f / 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user