Skip to content

Commit

Permalink
fixed operator keyword used in Haxe 3 code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed Oct 2, 2024
1 parent 75bb0ba commit bbd3561
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
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.15 (2024-10-02)

- Fixed operator keyword used in Haxe 3 code

## version 1.2.14 (2024-09-18)

- Fixed getArrowType running into a null pointer exception with conditionals
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 metadata for parens - see CHANGELOG for details",
"version": "1.2.14",
"releasenote": "fixed operator keyword - see CHANGELOG for details",
"version": "1.2.15",
"url": "https://github.com/HaxeCheckstyle/tokentree",
"dependencies": {}
}
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.14",
"version": "1.2.15",
"description": "TokenTree library used by haxe-checkstyle, haxe-formatter and haxe-languageserver",
"repository": {
"type": "git",
Expand Down
3 changes: 3 additions & 0 deletions src/tokentree/TokenStream.hx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class TokenStream {
return consumeToken();
case Const(CIdent(_)):
return consumeToken();
case Kwd(KwdOperator):
// pre 4.0.0 code might still use `operator` as an identifier
return consumeToken();
default:
switch (MODE) {
case Relaxed: return createDummyToken(Const(CIdent("autoInsert")));
Expand Down
9 changes: 9 additions & 0 deletions test/tokentree/TokenTreeBuilderParsingTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class TokenTreeBuilderParsingTest implements ITest {
assertCodeParses(TRUE);
assertCodeParses(FALSE);
assertCodeParses(NULL);
assertCodeParses(OPERATOR_KEYWORD_HAXE3);
}

public function assertCodeParses(code:String, ?pos:PosInfos) {
Expand Down Expand Up @@ -1915,4 +1916,12 @@ import #if haxe4 js.lib.Promise #else js.Promise #end as JsPromise;
return Expr();
}
}";

var OPERATOR_KEYWORD_HAXE3 = "
class Main {
#if (haxe_ver < '4.0.0')
public var operator(get, set):CairoOperator;
#end
}
";
}

0 comments on commit bbd3561

Please sign in to comment.