File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
src/checkstyle/token/walk Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 11## next version (2.x.x)
22
33- Fixed handling of default setters/getters in indentation check [ #391 ] ( https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/391 )
4+ - Fixed token tree structure for Sharp(If) inside Kwd(KwdCase) [ #394 ] ( https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/394 )
45- Added unittests for ParserQueue and CheckerPool [ #393 ] ( https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/393 )
56- Improved wrapped code detection [ #392 ] ( https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/392 )
67
Original file line number Diff line number Diff line change @@ -85,6 +85,31 @@ class WalkSwitch {
8585 WalkComment .walkComment (stream , parent );
8686 case Sharp (_ ):
8787 WalkSharp .walkSharp (stream , parent , WalkSwitch .walkSwitchCases );
88+ /*
89+ * relocate sharp subtree from:
90+ * |- BrOpen
91+ * |- Kwd(KwdCase)
92+ * | |- expression
93+ * | |- DblDot
94+ * | |- statement
95+ * |- Sharp(If)
96+ * | |- condition
97+ * | |- statement (if not a new case)
98+ * to:
99+ * |- Kwd(KwdCase)
100+ * | |- expression
101+ * | |- DblDot
102+ * | |- statement
103+ * | |- Sharp(If)
104+ * | |- condition
105+ * | |- statement
106+ */
107+ var sharp : TokenTree = parent .getLastChild ();
108+ if (sharp .children .length < 2 ) continue ;
109+ var body : TokenTree = sharp .children [1 ];
110+ if (body .is (Kwd (KwdCase ))) continue ;
111+ parent .children .pop ();
112+ dblDot .addChild (sharp );
88113 default :
89114 WalkStatement .walkStatement (stream , dblDot );
90115 }
Original file line number Diff line number Diff line change @@ -131,6 +131,17 @@ long comment
131131 4,
132132 5:
133133 doSomething();
134+ case 6:
135+ #if php
136+ doSomething();
137+ #else
138+ doSomething();
139+ #end
140+ doSomething();
141+ #if (haxe_ver < 4.0)
142+ case 7:
143+ doSomething();
144+ #end
134145 default:
135146 doSomething();
136147 }
You can’t perform that action at this time.
0 commit comments