Skip to content

Commit

Permalink
fixed conditionals in arguments with question mark, fixes #397
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed Mar 20, 2019
1 parent de33b8d commit 9a732e5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

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

## version 1.5.1 (2019-03-06)

- Fixed vanishing string literals at end of file ([#391](https://github.com/HaxeCheckstyle/haxe-formatter/issues/391))
- Fixed specifiying an entry point for tokentree, fixes [#393](https://github.com/HaxeCheckstyle/haxe-formatter/issues/393)
- Fixed whitespace for conditionals in function arguments with question mark, fixes [#397](https://github.com/HaxeCheckstyle/haxe-formatter/issues/397)
- Fixed unary OpSub in arrays
- Changed default value for `excludes` to include `.git` folders ([#399](https://github.com/HaxeCheckstyle/haxe-formatter/issues/399))
- Changed using comma as an indicator for simple wrapping ([#403](https://github.com/HaxeCheckstyle/haxe-formatter/issues/403))
- Changed formatter api calls, fixes [#393](https://github.com/HaxeCheckstyle/haxe-formatter/issues/393) ([#403](https://github.com/HaxeCheckstyle/haxe-formatter/issues/403))
- Changed command line help text, fixes [#400](https://github.com/HaxeCheckstyle/haxe-formatter/issues/400) ([#402](https://github.com/HaxeCheckstyle/haxe-formatter/issues/402))
- Replaced custom schema generator with json2objects ([#398](https://github.com/HaxeCheckstyle/haxe-formatter/issues/398))

## version 1.5.1 (2019-03-06)

- Fixed vanishing string literals at end of file ([#391](https://github.com/HaxeCheckstyle/haxe-formatter/issues/391))

## version 1.5.0 (2019-03-04)

- Added `wrapping.opAddSubChain` ([#370](https://github.com/HaxeCheckstyle/haxe-formatter/issues/370))
Expand Down
5 changes: 4 additions & 1 deletion src/formatter/marker/MarkWhitespace.hx
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ class MarkWhitespace extends MarkerBase {
case Const(CIdent(_)):
whitespace(token, After);
return;
case Question:
whitespace(token, After);
return;
default:
}
}
Expand Down Expand Up @@ -399,7 +402,7 @@ class MarkWhitespace extends MarkerBase {
if (next != null) {
switch (next.token.tok) {
case Comma, Semicolon:
case Const(_), Kwd(_), POpen, BrOpen, BkOpen:
case Const(_), Kwd(_), POpen, BrOpen, BkOpen, Question:
whitespace(token, After);
default:
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{}


---

class Main {
static function foo(#if false bar:Int, #else baz:int, #end foobar:Int) {}
static function foo(#if false ?bar:Int, #end ?foobar:Int) {}
static function foo(#if false ?bar:Int, #else ?baz:Int, #end ?foobar:Int) {}
}

---

class Main {
static function foo(#if false bar:Int, #else baz:int, #end foobar:Int) {}

static function foo(#if false ?bar:Int, #end ?foobar:Int) {}

static function foo(#if false ?bar:Int, #else ?baz:Int, #end ?foobar:Int) {}
}

0 comments on commit 9a732e5

Please sign in to comment.