Skip to content

Commit

Permalink
fix negative values in switch/cases, fixes HaxeCheckstyle#280
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed Sep 3, 2016
1 parent 3ae2a64 commit 2e6c22a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/checkstyle/token/TokenStream.hx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class TokenStream {
var prevTok:Token = tokens[previous];
switch (prevTok.tok) {
case Binop(_), Unop(_), BkOpen, POpen, Comma, DblDot, IntInterval(_), Question:
case Kwd(KwdReturn), Kwd(KwdIf), Kwd(KwdElse), Kwd(KwdWhile), Kwd(KwdDo), Kwd(KwdFor):
case Kwd(KwdReturn), Kwd(KwdIf), Kwd(KwdElse), Kwd(KwdWhile), Kwd(KwdDo), Kwd(KwdFor), Kwd(KwdCase):
default:
return new TokenTree(tok.tok, tok.pos, tok.index);
}
Expand Down
5 changes: 5 additions & 0 deletions test/checks/whitespace/OperatorWhitespaceCheckTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ abstract OperatorWhitespaceCheckTests(String) to String {
z: 20 * 10
};
var y:Array<String> = [];
switch int() {
case -1:
default:
}
}
}
Expand Down

0 comments on commit 2e6c22a

Please sign in to comment.