Skip to content

Commit

Permalink
prepare v1.0.23 (#170)
Browse files Browse the repository at this point in the history
* prepare v1.0.23
  • Loading branch information
AlexHaxe authored Sep 10, 2019
1 parent 41a0f7e commit d6f75b9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## dev branch / next version (1.x.x)

## version 1.0.23 (2019-09-10)

- Fixed postfix exclamation mark [#165](https://github.com/HaxeCheckstyle/tokentree/issues/165)
- Fixed C# exception handling [#166](https://github.com/HaxeCheckstyle/tokentree/issues/166)
- Fixed null pointer issues in TokenTreeCheckUtils [#167](https://github.com/HaxeCheckstyle/tokentree/issues/167)
Expand Down
4 changes: 2 additions & 2 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"contributors": [
"AlexHaxe"
],
"releasenote": "fixed type hints in enums, comments in OPAdd chains and imports with conditionals - see CHANGELOG for details",
"version": "1.0.22",
"releasenote": "fixed null pointer issues, C# exception handling and other bugfixes - see CHANGELOG for details",
"version": "1.0.23",
"url": "https://github.com/HaxeCheckstyle/tokentree",
"dependencies": {}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tokentree",
"version": "1.0.22",
"version": "1.0.23",
"description": "TokenTree library used by haxe-checkstyle, haxe-formatter and haxe-languageserver",
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions src/tokentree/TokenTreeAccessHelper.hx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ abstract TokenTreeAccessHelper(TokenTree) from TokenTree {
return if (exists()) this.parent else null;
}

public function findParent(predicate:TokenTreeAccessHelper->Bool):TokenTreeAccessHelper {
var parent:TokenTreeAccessHelper = parent();
public function findParent(predicate:TokenTreeAccessHelper->Bool):Null<TokenTreeAccessHelper> {
var parent:Null<TokenTreeAccessHelper> = parent();
while (parent.exists() && parent.token.tok != null) {
if (predicate(parent)) {
return parent;
Expand Down Expand Up @@ -82,4 +82,4 @@ abstract TokenTreeAccessHelper(TokenTree) from TokenTree {
public inline function exists():Bool {
return this != null;
}
}
}
4 changes: 2 additions & 2 deletions src/tokentree/utils/TokenTreeCheckUtils.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class TokenTreeCheckUtils {
}
}

public static function isImport(token:TokenTree):Bool {
var parent:TokenTree = token;
public static function isImport(token:Null<TokenTree>):Bool {
var parent:Null<TokenTree> = token;
while (parent != null) {
if (parent.tok == null) return false;
switch (parent.tok) {
Expand Down
16 changes: 12 additions & 4 deletions test/tokentree/TokenTreeBuilderTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ class TokenTreeBuilderTest {
builder.getTokenStream().consumeToken(); // remove comment line
checkStreamEmpty(builder);

#if (haxe_ver < 4.0)
assertTokenEquals(cast StringTools.replace(AT_ANNOTATION_GOLD, ",null", ""), treeToString(root));
#else
assertTokenEquals(AT_ANNOTATION_GOLD, treeToString(root));
#end
}

@Test
Expand All @@ -54,7 +58,11 @@ class TokenTreeBuilderTest {
WalkIf.walkIf(stream, root);
checkStreamEmpty(builder);

#if (haxe_ver < 4.0)
assertTokenEquals(cast StringTools.replace(IF_GOLD, ",null", ""), treeToString(root));
#else
assertTokenEquals(IF_GOLD, treeToString(root));
#end
}

// public static function buildTokenTree(tokens:Array<Token>, bytes:ByteData, entryPoint:TokenTreeEntryPoint):TokenTree {
Expand Down Expand Up @@ -156,15 +164,15 @@ abstract TokenTreeBuilderTests(String) to String {
" At\n" +
" Const(CIdent(SuppressWarnings))\n" +
" POpen\n" +
" Const(CString(checkstyle:MagicNumber))\n" +
" Const(CString(checkstyle:MagicNumber,null))\n" +
" PClose\n" +
" At\n" +
" Const(CIdent(SuppressWarnings))\n" +
" POpen\n" +
" BkOpen\n" +
" Const(CString(checkstyle:MagicNumber))\n" +
" Const(CString(checkstyle:MagicNumber,null))\n" +
" Comma\n" +
" Const(CString(checkstyle:AvoidStarImport))\n" +
" Const(CString(checkstyle:AvoidStarImport,null))\n" +
" BkClose\n" +
" PClose\n" +
" At\n" +
Expand Down Expand Up @@ -208,7 +216,7 @@ abstract TokenTreeBuilderTests(String) to String {
" Semicolon\n" +
" Kwd(KwdElse)\n" +
" Kwd(KwdThrow)\n" +
" Const(CString(error))\n" +
" Const(CString(error,null))\n" +
" Semicolon\n" +
" Kwd(KwdIf)\n" +
" POpen\n" +
Expand Down

0 comments on commit d6f75b9

Please sign in to comment.