diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2020-01-28 17:16:41 +0300 |
---|---|---|
committer | Matthijs Kooijman <matthijs@stdin.nl> | 2020-01-29 21:04:43 +0300 |
commit | e387c23b608434c10fd46a758958186dcc3c4c6a (patch) | |
tree | 3b1aa1923651b94a6dd3de2f61c1a5aa9a443005 /arduino-core | |
parent | 8e9f7a630af6f79ebe6fa20ee97e51cf4ef0f030 (diff) |
Slightly simplify error message rebuilding
This removes some duplicate code for with and without column number by
building the column number string separately first.
Diffstat (limited to 'arduino-core')
-rw-r--r-- | arduino-core/src/cc/arduino/Compiler.java | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/arduino-core/src/cc/arduino/Compiler.java b/arduino-core/src/cc/arduino/Compiler.java index 1663bbd9f..608bf23b0 100644 --- a/arduino-core/src/cc/arduino/Compiler.java +++ b/arduino-core/src/cc/arduino/Compiler.java @@ -582,11 +582,8 @@ public class Compiler implements MessageConsumer { String fileName = ex.getCodeFile().getPrettyName(); int lineNum = ex.getCodeLine() + 1; int colNum = ex.getCodeColumn(); - if (colNum != -1) { - s = fileName + ":" + lineNum + ":" + colNum + ": error: " + error + msg; - } else { - s = fileName + ":" + lineNum + ": error: " + error + msg; - } + String column = (colNum != -1) ? (":" + colNum) : ""; + s = fileName + ":" + lineNum + column + ": error: " + error + msg; } if (ex != null) { |