Skip to content

Commit

Permalink
Fix parens after curly (#206)
Browse files Browse the repository at this point in the history
* fixed parens after curlies
  • Loading branch information
AlexHaxe authored Jan 22, 2021
1 parent b5b8687 commit fdf249b
Show file tree
Hide file tree
Showing 6 changed files with 26 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.1.1 (2021-01-22)

- Fixed POpen after block curlies ([#206](https://github.com/HaxeCheckstyle/tokentree/issues/206))

## version 1.1.0 (2020-12-23)

- Retired Haxe 3.4.7 compile support ([#202](https://github.com/HaxeCheckstyle/tokentree/issues/202))
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": "retired Haxe 3 compilation support and bugfixes - see CHANGELOG for details",
"version": "1.1.0",
"releasenote": "fixed parens after curlies - see CHANGELOG for details",
"version": "1.1.1",
"url": "https://github.com/HaxeCheckstyle/tokentree",
"dependencies": {}
}
2 changes: 1 addition & 1 deletion 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.1.0",
"version": "1.1.1",
"description": "TokenTree library used by haxe-checkstyle, haxe-formatter and haxe-languageserver",
"repository": {
"type": "git",
Expand Down
6 changes: 5 additions & 1 deletion src/tokentree/walk/WalkBlock.hx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ class WalkBlock {
case Question:
WalkQuestion.walkQuestion(stream, parent);
case POpen:
WalkStatement.walkStatementWithoutSemicolon(stream, parent);
switch (parent.parent.tok) {
case Dollar(_):
WalkStatement.walkStatementWithoutSemicolon(stream, parent);
default:
}
case CommentLine(_), Comment(_):
var nextTokDef:Null<TokenTreeDef> = stream.peekNonCommentToken();
if (nextTokDef == null) {
Expand Down
13 changes: 13 additions & 0 deletions test/tokentree/TokenTreeBuilderParsingTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class TokenTreeBuilderParsingTest implements ITest {
assertCodeParses(FUNCTION_TYPE_PARAM);
assertCodeParses(OVERLOAD_FUNCTION);
assertCodeParses(SPREAD_OPERATOR);
assertCodeParses(PARENS_AFTER_BLOCK);
}

@Test
Expand Down Expand Up @@ -1729,4 +1730,16 @@ import #if haxe4 js.lib.Promise #else js.Promise #end as JsPromise;
return super.methodWithRest(...rest.append(999));
}
";

var PARENS_AFTER_BLOCK = "
class Test {
public static function main() {
macro function() {
$i{field.name}();
}
if (true) {}
(f : Dynamic).foo = true;
}
}
";
}

0 comments on commit fdf249b

Please sign in to comment.