mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-19 15:20:55 +00:00
cleanup
This commit is contained in:
@@ -86,7 +86,7 @@ tasks.create<SourceTask>("tectonicDocs") {
|
|||||||
|
|
||||||
sources.forEach { (name, unit) ->
|
sources.forEach { (name, unit) ->
|
||||||
unit.getClassByName(name).ifPresent { declaration ->
|
unit.getClassByName(name).ifPresent { declaration ->
|
||||||
if(declaration.isAnnotationPresent("AutoDocAlias")) {
|
if (declaration.isAnnotationPresent("AutoDocAlias")) {
|
||||||
refactor[name] = (declaration.getAnnotationByName("AutoDocAlias").get().childNodes[1] as StringLiteralExpr).asString()
|
refactor[name] = (declaration.getAnnotationByName("AutoDocAlias").get().childNodes[1] as StringLiteralExpr).asString()
|
||||||
println("Refactoring $name to ${refactor[name]}.")
|
println("Refactoring $name to ${refactor[name]}.")
|
||||||
}
|
}
|
||||||
@@ -150,15 +150,15 @@ tasks.create<SourceTask>("tectonicDocs") {
|
|||||||
fun parseTypeLink(type: Type, refactor: Map<String, String>): String {
|
fun parseTypeLink(type: Type, refactor: Map<String, String>): String {
|
||||||
val st = parseType(type, refactor)
|
val st = parseType(type, refactor)
|
||||||
|
|
||||||
if(st.contains('<')) {
|
if (st.contains('<')) {
|
||||||
val outer = generify(type.childNodes[0].toString(), refactor)
|
val outer = generify(type.childNodes[0].toString(), refactor)
|
||||||
|
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
builder.append("[$outer](./$outer)\\<")
|
builder.append("[$outer](./$outer)\\<")
|
||||||
|
|
||||||
for(i in 1 until type.childNodes.size) {
|
for (i in 1 until type.childNodes.size) {
|
||||||
builder.append(parseTypeLink(type.childNodes[i] as Type, refactor))
|
builder.append(parseTypeLink(type.childNodes[i] as Type, refactor))
|
||||||
if(i != type.childNodes.size-1) builder.append(", ")
|
if (i != type.childNodes.size - 1) builder.append(", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append("\\>")
|
builder.append("\\>")
|
||||||
@@ -169,8 +169,8 @@ fun parseTypeLink(type: Type, refactor: Map<String, String>): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun parseType(type: Type, refactor: Map<String, String>): String {
|
fun parseType(type: Type, refactor: Map<String, String>): String {
|
||||||
if(type is com.github.javaparser.ast.type.PrimitiveType) {
|
if (type is com.github.javaparser.ast.type.PrimitiveType) {
|
||||||
return when(type.type) {
|
return when (type.type) {
|
||||||
Primitive.BOOLEAN -> "Boolean"
|
Primitive.BOOLEAN -> "Boolean"
|
||||||
Primitive.BYTE -> "Byte"
|
Primitive.BYTE -> "Byte"
|
||||||
Primitive.DOUBLE -> "Double"
|
Primitive.DOUBLE -> "Double"
|
||||||
@@ -185,8 +185,8 @@ fun parseType(type: Type, refactor: Map<String, String>): String {
|
|||||||
return generify(type.asString(), refactor)
|
return generify(type.asString(), refactor)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun generify(type:String, refactor: Map<String, String>): String {
|
fun generify(type: String, refactor: Map<String, String>): String {
|
||||||
return when(type) {
|
return when (type) {
|
||||||
"HashMap", "LinkedHashMap" -> "Map"
|
"HashMap", "LinkedHashMap" -> "Map"
|
||||||
"ArrayList", "LinkedList", "GlueList" -> "List"
|
"ArrayList", "LinkedList", "GlueList" -> "List"
|
||||||
"HashSet" -> "Set"
|
"HashSet" -> "Set"
|
||||||
|
|||||||
Reference in New Issue
Block a user