diff --git a/.github/workflows/tokentree.yml b/.github/workflows/tokentree.yml index 93d4693..c2d7a16 100644 --- a/.github/workflows/tokentree.yml +++ b/.github/workflows/tokentree.yml @@ -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 diff --git a/.haxerc b/.haxerc index 6d9c573..ef43126 100644 --- a/.haxerc +++ b/.haxerc @@ -1,4 +1,4 @@ { - "version": "4.3.5", + "version": "4.3.6", "resolveLibs": "scoped" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b122e4a..47b01e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/haxelib.json b/haxelib.json index 5aadeb0..c3e42d3 100644 --- a/haxelib.json +++ b/haxelib.json @@ -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": {} } \ No newline at end of file diff --git a/makeReleaseZip.sh b/makeReleaseZip.sh index 86781a4..5166c2c 100755 --- a/makeReleaseZip.sh +++ b/makeReleaseZip.sh @@ -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 diff --git a/package-lock.json b/package-lock.json index fe8fb6b..33fa662 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tokentree", - "version": "1.2.13", + "version": "1.2.14", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tokentree", - "version": "1.2.13", + "version": "1.2.14", "license": "MIT", "devDependencies": { "lix": "^15.12.0" diff --git a/package.json b/package.json index 6352095..f283d32 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/tokentree/utils/TokenTreeCheckUtils.hx b/src/tokentree/utils/TokenTreeCheckUtils.hx index 24cf6f3..9c07452 100644 --- a/src/tokentree/utils/TokenTreeCheckUtils.hx +++ b/src/tokentree/utils/TokenTreeCheckUtils.hx @@ -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; } @@ -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) { diff --git a/test/tokentree/utils/TokenTreeCheckUtilsTest.hx b/test/tokentree/utils/TokenTreeCheckUtilsTest.hx index 41bc28f..443aff7 100644 --- a/test/tokentree/utils/TokenTreeCheckUtilsTest.hx +++ b/test/tokentree/utils/TokenTreeCheckUtilsTest.hx @@ -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)); } @@ -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 } } ";