Skip to content

Commit

Permalink
fixed getArrowType running into a null pointer exception with conditi…
Browse files Browse the repository at this point in the history
…onals
  • Loading branch information
AlexHaxe committed Sep 17, 2024
1 parent 24b6657 commit 75bb0ba
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tokentree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
haxe-version: ['4.3.5', 'nightly']
haxe-version: ['4.3.6', 'nightly']
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .haxerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "4.3.5",
"version": "4.3.6",
"resolveLibs": "scoped"
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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

## version 1.2.14 (2024-09-18)

- Fixed getArrowType running into a null pointer exception with conditionals

## version 1.2.13 (2024-08-02)

- Fixed metadata for parens
Expand Down
2 changes: 1 addition & 1 deletion haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"AlexHaxe"
],
"releasenote": "fixed metadata for parens - see CHANGELOG for details",
"version": "1.2.13",
"version": "1.2.14",
"url": "https://github.com/HaxeCheckstyle/tokentree",
"dependencies": {}
}
2 changes: 1 addition & 1 deletion makeReleaseZip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

npm install
npx lix download
npx lix use haxe 4.3.5
npx lix use haxe 4.3.6

haxe test.hxml

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.2.13",
"version": "1.2.14",
"description": "TokenTree library used by haxe-checkstyle, haxe-formatter and haxe-languageserver",
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions src/tokentree/utils/TokenTreeCheckUtils.hx
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ class TokenTreeCheckUtils {
case Arrow, Dot, Semicolon, Question:
case BrOpen:
var brClose:TokenTree = child.getFirstChild();
if (brClose == null) {
break;
}
if (brClose.tok.match(BrClose)) {
return ArrowFunction;
}
Expand Down Expand Up @@ -863,6 +866,10 @@ class TokenTreeCheckUtils {
}
switch (parent.tok) {
case POpen:
switch (parent?.parent.tok) {
case POpen: return ArrowFunction;
default:
}
case Const(CIdent(_)):
if ((parent.parent == null) || (parent.parent.tok == Root)) return ArrowFunction;
switch (parent.parent.tok) {
Expand Down
9 changes: 8 additions & 1 deletion test/tokentree/utils/TokenTreeCheckUtilsTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class TokenTreeCheckUtilsTest implements ITest {
default: GoDeeper;
}
});
Assert.equals(12, allArrows.length);
Assert.equals(13, allArrows.length);
for (ar in allArrows) {
Assert.equals(ArrowType.ArrowFunction, TokenTreeCheckUtils.getArrowType(ar));
}
Expand Down Expand Up @@ -932,6 +932,13 @@ enum abstract TokenTreeCheckUtilsTests(String) to String {
}, (error:Error) -> {
trace(2);
});
#if (target.threaded)
Thread.create(() -> {
#end
completedThread();
#if (target.threaded)
});
#end
}
}
";
Expand Down

0 comments on commit 75bb0ba

Please sign in to comment.