Skip to content

Commit c41cfc6

Browse files
authored
fix negative values in switch/cases, fixes #280 (#283)
1 parent 3ae2a64 commit c41cfc6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/checkstyle/token/TokenStream.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class TokenStream {
196196
var prevTok:Token = tokens[previous];
197197
switch (prevTok.tok) {
198198
case Binop(_), Unop(_), BkOpen, POpen, Comma, DblDot, IntInterval(_), Question:
199-
case Kwd(KwdReturn), Kwd(KwdIf), Kwd(KwdElse), Kwd(KwdWhile), Kwd(KwdDo), Kwd(KwdFor):
199+
case Kwd(KwdReturn), Kwd(KwdIf), Kwd(KwdElse), Kwd(KwdWhile), Kwd(KwdDo), Kwd(KwdFor), Kwd(KwdCase):
200200
default:
201201
return new TokenTree(tok.tok, tok.pos, tok.index);
202202
}

test/checks/whitespace/OperatorWhitespaceCheckTest.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ abstract OperatorWhitespaceCheckTests(String) to String {
193193
z: 20 * 10
194194
};
195195
var y:Array<String> = [];
196+
197+
switch int() {
198+
case -1:
199+
default:
200+
}
196201
}
197202
}
198203

0 commit comments

Comments
 (0)