aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/mcprepack/ProguardWriter.kt
blob: 64d84f80f24d9804048220cf244b3013da930959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package mcprepack

import java.io.Writer

data class ProguardWriter(val writer: Writer) {
    fun visitClass(sourceName: String, targetName: String) {
        writer.write(sourceName)
        writer.write(" -> ")
        writer.write(targetName)
        writer.write(":\n")
    }

    fun visitField(sourceName: String, targetName: String, proguardType: String) {
        writer.write("    ")
        writer.write(proguardType)
        writer.write(" ")
        writer.write(sourceName)
        writer.write(" -> ")
        writer.write(targetName)
        writer.write("\n")
    }

    fun visitMethod(sourceName: String, targetName: String, arguments: List<String>, returnType: String) {
        writer.write("    ")
        writer.write(returnType)
        writer.write(" ")
        writer.write(sourceName)
        writer.write("(")
        writer.write(arguments.joinToString(","))
        writer.write(") -> ")
        writer.write(targetName)
        writer.write("\n")
    }

}