Skip to content

Commit 1a2140e

Browse files
authored
fixed EFunction changes in Haxe 4 (#474)
1 parent 1bdaf28 commit 1a2140e

File tree

7 files changed

+43
-6
lines changed

7 files changed

+43
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ matrix:
3636
install:
3737
- haxelib git tokentree https://github.com/HaxeCheckstyle/tokentree master src
3838
- haxelib git hxparse https://github.com/simn/hxparse
39-
- haxelib git haxeparser https://github.com/AlexHaxe/haxeparser add_final
39+
- haxelib git haxeparser https://github.com/simn/haxeparser
4040
- haxelib git mcover https://github.com/massiveinteractive/mcover master src
4141
- haxelib git munit https://github.com/massiveinteractive/MassiveUnit master src
4242
- haxelib git hxnodejs https://github.com/HaxeFoundation/hxnodejs.git master

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
- Fixed Java regexp issue in IndentationCheck ([#468](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/468))
2525
- Fixed empty lines between types with conditionals ([#469](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/469))
2626
- Fixed empty lines before comments with conditionals ([#472](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/472))
27+
- Fixed EFunction changes in Haxe 4rc4
2728
- Changed return block indentation [#453](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/453)
28-
- Changed to use formatter [#461](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/461)
29+
- Changed applied formatter [#461](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/461)
2930
- Refactored coverage reporting [#462](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/462)
3031

3132
## version 2.4.2 (2018-07-01)

resources/checkstyle-schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,18 @@
354354
"type": "object"
355355
},
356356
"DocCommentStyleCheck": {
357-
"description": "Checks code documentation style (/****/ vs /**/)",
357+
"description": "Checks code documentation style (/**...**/ vs /*...*/)",
358358
"additionalProperties": false,
359359
"properties": {
360360
"type": {
361-
"description": "Checks code documentation style (/****/ vs /**/)",
361+
"description": "Checks code documentation style (/**...**/ vs /*...*/)",
362362
"type": "string",
363363
"enum": [
364364
"DocCommentStyle"
365365
]
366366
},
367367
"props": {
368-
"description": "Checks code documentation style (/****/ vs /**/)",
368+
"description": "Checks code documentation style (/**...**/ vs /*...*/)",
369369
"additionalProperties": false,
370370
"properties": {
371371
"lineStyle": {

src/checkstyle/checks/comments/DocCommentStyleCheck.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package checkstyle.checks.comments;
44
Checks code documentation style (/** vs /*)
55
**/
66
@name("DocCommentStyle")
7-
@desc("Checks code documentation style (/****/ vs /**/)")
7+
@desc("Checks code documentation style (/**...**/ vs /*...*/)")
88
class DocCommentStyleCheck extends Check {
99
/**
1010
Defines how doc comments should start / end:

src/checkstyle/checks/size/MethodLengthCheck.hx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,21 @@ class MethodLengthCheck extends Check {
6262
var lmax = checker.getLinePos(f.pos.max).line;
6363
var fname = "(anonymous)";
6464
switch (f.expr) {
65+
#if (haxe_ver < 4.0)
6566
case EFunction(name, ff):
6667
if (name != null) fname = name;
68+
#else
69+
case EFunction(kind, ff):
70+
switch (kind) {
71+
case null:
72+
case FAnonymous:
73+
var fname = "(anonymous)";
74+
case FNamed(name, inlined):
75+
fname = name;
76+
case FArrow:
77+
var fname = "(anonymous arrow)";
78+
}
79+
#end
6780
default:
6881
throw "EFunction only";
6982
}

src/checkstyle/checks/type/ReturnCheck.hx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,21 @@ class ReturnCheck extends Check {
6464
function checkInlineFunctions() {
6565
checker.ast.walkFile(function(e) {
6666
switch (e.expr) {
67+
#if (haxe_ver < 4.0)
6768
case EFunction(fname, f):
6869
var funNoReturn:Bool = (f.ret == null);
6970
walkExpr(f.expr, funNoReturn, fname, e.pos);
71+
#else
72+
case EFunction(kind, f):
73+
var name:Null<String> = switch (kind) {
74+
case null: null;
75+
case FAnonymous: null;
76+
case FNamed(name, inlined): name;
77+
case FArrow: null;
78+
}
79+
var funNoReturn:Bool = (f.ret == null);
80+
walkExpr(f.expr, funNoReturn, name, e.pos);
81+
#end
7082
default:
7183
}
7284
});

src/checkstyle/utils/ComplexTypeUtils.hx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,19 @@ class ComplexTypeUtils {
183183
walkExpr(e, cb);
184184
case EVars(vars):
185185
for (v in vars) walkVar(v, e.pos, cb);
186+
#if (haxe_ver < 4.0)
186187
case EFunction(name, f):
187188
walkFunction(f, name, e.pos, cb);
189+
#else
190+
case EFunction(kind, f):
191+
var name:Null<String> = switch (kind) {
192+
case null: null;
193+
case FAnonymous: null;
194+
case FNamed(name, inlined): name;
195+
case FArrow: null;
196+
}
197+
walkFunction(f, name, e.pos, cb);
198+
#end
188199
case EBlock(exprs):
189200
for (e in exprs) walkExpr(e, cb);
190201
case EFor(it, expr):

0 commit comments

Comments
 (0)