summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/analysis/Token.java
diff options
context:
space:
mode:
authorGravatar Gegy2019-01-30 21:05:32 +0200
committerGravatar GitHub2019-01-30 21:05:32 +0200
commitba7a354efae7d49833c887cf147ac940c975a1fa (patch)
tree02e14fda81dd5984e24f2df392c57c6e829fc875 /src/main/java/cuchaz/enigma/analysis/Token.java
parentRewrite the Jenkinsfile to use the new declarative pipeline syntax, lets hope... (diff)
downloadenigma-fork-ba7a354efae7d49833c887cf147ac940c975a1fa.tar.gz
enigma-fork-ba7a354efae7d49833c887cf147ac940c975a1fa.tar.xz
enigma-fork-ba7a354efae7d49833c887cf147ac940c975a1fa.zip
Remap sources (#106)
* Source remapping beginnings * Fix navigation to remapped classes * Translate identifier info reference * Remap local variables with default names in source * Caching translator * Fix lack of highlighting for first opened class * Fix unicode variable names * Unicode checker shouldn't be checking just alphanumeric * Fix package tree being built from obf names * Don't index `this` as method call for method::reference * Apply proposed names * Fix source export issues * Replace unicode var names at bytecode level uniquely * Drop imports from editor source * Class selector fixes * Delta keep track of base mappings to enable lookup of old names * Optimize source remapping by remapping source with a StringBuffer instead of copying * Bump version
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis/Token.java')
-rw-r--r--src/main/java/cuchaz/enigma/analysis/Token.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/Token.java b/src/main/java/cuchaz/enigma/analysis/Token.java
index 14fa7ca..12e0aa6 100644
--- a/src/main/java/cuchaz/enigma/analysis/Token.java
+++ b/src/main/java/cuchaz/enigma/analysis/Token.java
@@ -30,12 +30,12 @@ public class Token implements Comparable<Token> {
30 return to.length() - length; 30 return to.length() - length;
31 } 31 }
32 32
33 public String rename(String source, String to) { 33 public void rename(StringBuffer source, String to) {
34 int oldEnd = this.end; 34 int oldEnd = this.end;
35 this.text = to; 35 this.text = to;
36 this.end = this.start + to.length(); 36 this.end = this.start + to.length();
37 37
38 return source.substring(0, this.start) + to + source.substring(oldEnd); 38 source.replace(start, oldEnd, to);
39 } 39 }
40 40
41 public Token move(int offset) { 41 public Token move(int offset) {
@@ -64,7 +64,7 @@ public class Token implements Comparable<Token> {
64 } 64 }
65 65
66 public boolean equals(Token other) { 66 public boolean equals(Token other) {
67 return start == other.start && end == other.end; 67 return start == other.start && end == other.end && text.equals(other.text);
68 } 68 }
69 69
70 @Override 70 @Override