-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
2,120 additions
and
0 deletions.
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/Ark.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
* Copyright 2022 UnitTestBot contributors (utbot.org) | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jacodb.panda.dynamic.ark.dto | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class Ark( | ||
val name: String, | ||
val absoluteFilePath: String, | ||
val projectDir: String, | ||
val projectName: String, | ||
val namespaces: List<Namespace>, | ||
val classes: List<Class>, | ||
val importInfos: List<ImportInfo>, | ||
val exportInfos: List<ExportInfo>, | ||
) | ||
|
||
@Serializable | ||
data class Namespace( | ||
val name: String, | ||
val classes: List<Class>, | ||
) | ||
|
||
@Serializable | ||
data class Class( | ||
val name: String, | ||
val modifiers: List<String>, | ||
val typeParameters: List<String>, | ||
val superClassName: String?, | ||
val implementedInterfaceNames: List<String>, | ||
val fields: List<Field>, | ||
val methods: List<Method>, | ||
) | ||
|
||
@Serializable | ||
data class Field( | ||
val name: String, | ||
val modifiers: List<String>, | ||
val type: String?, | ||
val questionToken: Boolean, | ||
val initializer: Value?, | ||
) | ||
|
||
@Serializable | ||
data class Method( | ||
val name: String, | ||
val modifiers: List<String>, | ||
val typeParameters: List<String>, | ||
val parameters: List<Parameter>, | ||
val returnType: String, | ||
val body: List<Stmt>, | ||
) | ||
|
||
@Serializable | ||
data class Parameter( | ||
val name: String, | ||
val optional: Boolean, | ||
val type: String, | ||
) | ||
|
||
@Serializable | ||
data class ImportInfo( | ||
val importClauseName: String, | ||
val importType: String, | ||
val importFrom: String, | ||
val nameBeforeAs: String?, | ||
val clauseType: String, | ||
val modifiers: List<String>, | ||
val importFromSignature: FileSignature, | ||
val importProjectType: String, | ||
val originTsPosition: LineColPosition, | ||
) | ||
|
||
@Serializable | ||
data class ExportInfo( | ||
val exportClauseName: String, | ||
val exportClauseType: String, | ||
val exportFrom: String? = null, | ||
val nameBeforeAs: String? = null, | ||
val declaringSignature: String? = null, | ||
val isDefault: Boolean, | ||
val importInfo: ImportInfo? = null, | ||
val modifiers: List<String>, | ||
val originTsPosition: LineColPosition, | ||
) | ||
|
||
// @Serializable | ||
// data class Decorator( | ||
// val kind: String, | ||
// val type: String?, | ||
// ) | ||
|
||
@Serializable | ||
data class FileSignature( | ||
val projectName: String, | ||
val fileName: String, | ||
) | ||
|
||
@Serializable | ||
data class LineColPosition( | ||
val line: Int, | ||
val col: Int, | ||
) |
92 changes: 92 additions & 0 deletions
92
jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/Stmt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Copyright 2022 UnitTestBot contributors (utbot.org) | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jacodb.panda.dynamic.ark.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.json.JsonElement | ||
|
||
@Serializable | ||
sealed interface Stmt | ||
|
||
@Serializable | ||
@SerialName("UnknownStmt") | ||
data class UnknownStmt( | ||
val stmt: JsonElement, | ||
) : Stmt | ||
|
||
@Serializable | ||
@SerialName("NopStmt") | ||
object NopStmt : Stmt { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("AssignStmt") | ||
data class AssignStmt( | ||
val left: Local, | ||
val right: Value, | ||
) : Stmt | ||
|
||
@Serializable | ||
@SerialName("CallStmt") | ||
data class CallStmt( | ||
val expr: CallExpr, | ||
) : Stmt | ||
|
||
@Serializable | ||
@SerialName("DeleteStmt") | ||
data class DeleteStmt( | ||
val arg: FieldRef, | ||
) : Stmt | ||
|
||
@Serializable | ||
sealed interface TerminatingStmt : Stmt | ||
|
||
@Serializable | ||
@SerialName("ReturnStmt") | ||
data class ReturnStmt( | ||
val arg: Value?, | ||
) : TerminatingStmt | ||
|
||
@Serializable | ||
@SerialName("ThrowStmt") | ||
data class ThrowStmt( | ||
val arg: Value, | ||
) : TerminatingStmt | ||
|
||
@Serializable | ||
sealed interface BranchingStmt : Stmt | ||
|
||
@Serializable | ||
@SerialName("GotoStmt") | ||
object GotoStmt : BranchingStmt { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("IfStmt") | ||
data class IfStmt( | ||
val condition: ConditionExpr, | ||
) : BranchingStmt | ||
|
||
@Serializable | ||
@SerialName("SwitchStmt") | ||
data class SwitchStmt( | ||
val arg: Value, | ||
val cases: List<Value>, | ||
) : BranchingStmt |
128 changes: 128 additions & 0 deletions
128
jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/ark/dto/Type.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/* | ||
* Copyright 2022 UnitTestBot contributors (utbot.org) | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jacodb.panda.dynamic.ark.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
sealed interface Type | ||
|
||
@Serializable | ||
@SerialName("AnyType") | ||
object AnyType : Type { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("UnknownType") | ||
object UnknownType : Type { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("UnionType") | ||
data class UnionType( | ||
val types: List<Type>, | ||
) : Type | ||
|
||
@Serializable | ||
@SerialName("IntersectionType") | ||
data class TupleType( | ||
val types: List<Type>, | ||
) : Type | ||
|
||
// TODO: EnumType | ||
|
||
@Serializable | ||
sealed interface PrimitiveType : Type | ||
|
||
@Serializable | ||
@SerialName("BooleanType") | ||
object BooleanType : PrimitiveType { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("NumberType") | ||
object NumberType : PrimitiveType { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("StringType") | ||
object StringType : PrimitiveType { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("NullType") | ||
object NullType : PrimitiveType { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("UndefinedType") | ||
object UndefinedType : PrimitiveType { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("VoidType") | ||
object VoidType : PrimitiveType { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("NeverType") | ||
object NeverType : PrimitiveType { | ||
override fun toString(): String = javaClass.simpleName | ||
} | ||
|
||
@Serializable | ||
@SerialName("LiteralType") | ||
data class LiteralType( | ||
val literal: String, | ||
) : PrimitiveType | ||
|
||
@Serializable | ||
sealed interface RefType : Type | ||
|
||
@Serializable | ||
@SerialName("ClassType") | ||
data class ClassType( | ||
val className: String, | ||
) : RefType | ||
|
||
@Serializable | ||
@SerialName("ArrayType") | ||
data class ArrayType( | ||
val elementType: Type, | ||
val dimensions: Int, | ||
) : RefType | ||
|
||
@Serializable | ||
@SerialName("ArrayObjectType") | ||
data class ArrayObjectType( | ||
val elementType: Type, | ||
) : RefType | ||
|
||
@Serializable | ||
@SerialName("UnclearRefType") | ||
data class UnclearRefType( | ||
val typeName: String, | ||
) : RefType |
Oops, something went wrong.