bobbylight / RSyntaxTextArea

A syntax highlighting, code folding text editor for Java Swing applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convert three assignment statements to the usage of compound operators

elfring opened this issue Β· comments

πŸ‘€ Some source code analysis tools can help to find opportunities for improving software components.
πŸ’­ I propose to increase the usage of compound operators accordingly.

diff --git a/RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/modes/JavaScriptTokenMaker.java b/RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/modes/JavaScriptTokenMaker.java
index f8caa29..00cbe6e 100755
--- a/RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/modes/JavaScriptTokenMaker.java
+++ b/RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/modes/JavaScriptTokenMaker.java
@@ -1773,7 +1773,7 @@ public class JavaScriptTokenMaker extends AbstractJFlexCTokenMaker {
 											//System.out.println((start+operatorLen) + ", " + (zzMarkedPos-2));
 											addToken(start+operatorLen,zzMarkedPos-2, Token.WHITESPACE);
 										}
-										zzStartRead = zzCurrentPos = zzMarkedPos = zzMarkedPos - 1;
+										zzStartRead = zzCurrentPos = zzMarkedPos -= 1;
 										if (isE4xSupported()) {
 											// Scanning will continue with "<" as markup tag start
 											yybegin(E4X, LANG_INDEX_E4X);
diff --git a/RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/modes/TypeScriptTokenMaker.java b/RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/modes/TypeScriptTokenMaker.java
index 078fc06..cc8984a 100755
--- a/RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/modes/TypeScriptTokenMaker.java
+++ b/RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/modes/TypeScriptTokenMaker.java
@@ -1742,7 +1742,7 @@ public class TypeScriptTokenMaker extends AbstractJFlexCTokenMaker {
 											//System.out.println((start+operatorLen) + ", " + (zzMarkedPos-2));
 											addToken(start+operatorLen,zzMarkedPos-2, Token.WHITESPACE);
 										}
-										zzStartRead = zzCurrentPos = zzMarkedPos = zzMarkedPos - 1;
+										zzStartRead = zzCurrentPos = zzMarkedPos -= 1;
 										if (isE4xSupported()) {
 											// Scanning will continue with "<" as markup tag start
 											yybegin(E4X, LANG_INDEX_E4X);
diff --git a/RSyntaxTextArea/src/main/java/org/fife/ui/rtextarea/LineNumberList.java b/RSyntaxTextArea/src/main/java/org/fife/ui/rtextarea/LineNumberList.java
index f6e66a7..9578a45 100755
--- a/RSyntaxTextArea/src/main/java/org/fife/ui/rtextarea/LineNumberList.java
+++ b/RSyntaxTextArea/src/main/java/org/fife/ui/rtextarea/LineNumberList.java
@@ -643,7 +643,7 @@ public class LineNumberList extends AbstractGutterComponent
 				int lineCount = textArea.getLineCount() +
 						getLineNumberingStartIndex() - 1;
 				do {
-					lineCount = lineCount/10;
+					lineCount /= 10;
 					count++;
 				} while (lineCount >= 10);
 				cellWidth += fontMetrics.charWidth('9')*(count+1) + 3;

All of these are in generated code except for the last one (LineNumberList.java). I’m happy to do the last one though the next time I’m in that code.

πŸ’­ Should any code generator be adjusted then?

I use jflex but I also use an old version (1.4.1) due to lib changes/laziness on my part. You can try making a or for that project if that code is still generated the same way, but I’m not sure it is either way.

Most of these are in generated code, and it would be too much mental overhead to remember updating it each time the code was regenerating, so I'm closing this as NOFIX.