Skip to content

Commit

Permalink
fixed POpenType detection
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed Apr 6, 2020
1 parent aa7e6f6 commit 98ccf0f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- Added final handling for interfaces [#176](https://github.com/HaxeCheckstyle/tokentree/issues/176)
- Fixed unary `OpSub` handling [#174](https://github.com/HaxeCheckstyle/tokentree/issues/174)
- Fixed arrow function detection [#175](https://github.com/HaxeCheckstyle/tokentree/issues/175) + [#177](https://github.com/HaxeCheckstyle/tokentree/issues/177)
- Fixed `POpen` type detection [#177](https://github.com/HaxeCheckstyle/tokentree/issues/177)
- Fixed `POpen` type detection [#177](https://github.com/HaxeCheckstyle/tokentree/issues/177) + [#180](https://github.com/HaxeCheckstyle/tokentree/issues/180)
- Fixed `BrOpen` type detection [#178](https://github.com/HaxeCheckstyle/tokentree/issues/178)
- Fixed `Binop(OpOr)` position [#178](https://github.com/HaxeCheckstyle/tokentree/issues/178)
- Fixed expression metadata position [#179](https://github.com/HaxeCheckstyle/tokentree/issues/179)
Expand Down
1 change: 1 addition & 0 deletions src/tokentree/utils/TokenTreeCheckUtils.hx
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ class TokenTreeCheckUtils {
case DblDot:
case At:
return true;
case Kwd(KwdDefault):
default:
return false;
}
Expand Down
16 changes: 15 additions & 1 deletion test/tokentree/utils/TokenTreeCheckUtilsTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class TokenTreeCheckUtilsTest {
Assert.isFalse(root.inserted);

var allBr:Array<TokenTree> = root.filter([POpen], ALL);
Assert.areEqual(22, allBr.length);
Assert.areEqual(24, allBr.length);
var index:Int = 0;
// @:deprecated('UnlessshuffleArray(), you should use shuffle() quality.')
Assert.areEqual(POpenType.AT, TokenTreeCheckUtils.getPOpenType(allBr[index++]));
Expand Down Expand Up @@ -320,6 +320,12 @@ class TokenTreeCheckUtilsTest {
Assert.areEqual(POpenType.EXPRESSION, TokenTreeCheckUtils.getPOpenType(allBr[index++]));
Assert.areEqual(POpenType.CALL, TokenTreeCheckUtils.getPOpenType(allBr[index++]));
Assert.areEqual(POpenType.EXPRESSION, TokenTreeCheckUtils.getPOpenType(allBr[index++]));
Assert.areEqual(POpenType.CALL, TokenTreeCheckUtils.getPOpenType(allBr[index++]));

// @:default(false) @:optional var disableFormatting:Bool;
Assert.areEqual(POpenType.AT, TokenTreeCheckUtils.getPOpenType(allBr[index++]));
// @:default(auto) @:optional var emptyLines:EmptyLinesConfig;
Assert.areEqual(POpenType.AT, TokenTreeCheckUtils.getPOpenType(allBr[index++]));
}

@Test
Expand Down Expand Up @@ -737,6 +743,14 @@ abstract TokenTreeCheckUtilsTests(String) to String {
(bytes : Bytes).sortI32(0, length, cast f);
}
}
typedef FormatterConfig = {
/**
turns off formatting for all files in current folder and subfolders
unless subfolder contains a `hxformat.json`
**/
@:default(false) @:optional var disableFormatting:Bool;
@:default(auto) @:optional var emptyLines:EmptyLinesConfig;
}
";

var MIXED_TYPE_PARAMETER = "
Expand Down

0 comments on commit 98ccf0f

Please sign in to comment.