Skip to content

Commit

Permalink
fixed as is -> asis, fixes #634 (#635)
Browse files Browse the repository at this point in the history
* fixed as is -> asis, fixes #634
* upgraded to Haxe 4.2.1
  • Loading branch information
AlexHaxe authored Feb 27, 2021
1 parent 63d8ccd commit 084c876
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/formatter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build:
strategy:
matrix:
haxe-version: ['4.0.5', '4.1.5', '4.2.0', 'nightly']
haxe-version: ['4.0.5', '4.1.5', '4.2.1', 'nightly']
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down Expand Up @@ -72,5 +72,5 @@ jobs:
# name: formatter.js
# path: bin/formatter.js
- name: Upload results to codecov
if: success() && matrix.platform == 'ubuntu-latest' && (matrix.haxe-version == '4.2.0')
if: success() && matrix.platform == 'ubuntu-latest' && (matrix.haxe-version == '4.2.1')
run: bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
install:
- npm install
- if [[ "$HAXE_VERSION" == "haxe4" ]]; then npx lix download haxe 4.1.5; npx lix use haxe 4.1.5; fi
- if [[ "$HAXE_VERSION" == "haxe42" ]]; then npx lix download haxe 4.2.0; npx lix use haxe 4.2.0; fi
- if [[ "$HAXE_VERSION" == "haxe42" ]]; then npx lix download haxe 4.2.1; npx lix use haxe 4.2.1; fi
- if [[ "$HAXE_VERSION" == "nightly" ]]; then npx lix download haxe nightly; npx lix use haxe nightly; fi
- npx lix download
- npx haxe -version
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

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

- Added testcase for local metadata linebreak, fixes [#630](https://github.com/HaxeCheckstyle/haxe-formatter/issues/6230) ([#631](https://github.com/HaxeCheckstyle/haxe-formatter/issues/631))
- Added testcase for local metadata linebreak, fixes [#630](https://github.com/HaxeCheckstyle/haxe-formatter/issues/630) ([#631](https://github.com/HaxeCheckstyle/haxe-formatter/issues/631))
- Added `lineEnds.lineEndCharacter` to set line end character used for output ([#633](https://github.com/HaxeCheckstyle/haxe-formatter/issues/633))
- Fixed support for overload access modifier, fixes [#626](https://github.com/HaxeCheckstyle/haxe-formatter/issues/626) ([#627](https://github.com/HaxeCheckstyle/haxe-formatter/issues/627))
- Fixed parens after curly block, fixes [#629](https://github.com/HaxeCheckstyle/haxe-formatter/issues/629) ([#631](https://github.com/HaxeCheckstyle/haxe-formatter/issues/631))
- Fixed `is as` formatted as `isas`, fixes [#634](https://github.com/HaxeCheckstyle/haxe-formatter/issues/634) ([#635](https://github.com/HaxeCheckstyle/haxe-formatter/issues/635))
- Retired Haxe 3.4.7 compile support ([#627](https://github.com/HaxeCheckstyle/haxe-formatter/issues/627))

## version 1.11.2 (2020-11-04)
Expand Down
5 changes: 3 additions & 2 deletions src/formatter/marker/MarkWhitespace.hx
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,15 @@ class MarkWhitespace extends MarkerBase {

function markIs(token:TokenTree) {
var prev:Null<TokenInfo> = getPreviousToken(token);
var policy:WhitespacePolicy = Around;
if (prev != null) {
switch (prev.token.tok) {
case Dot | POpen:
return;
policy = policy.remove(Before);
default:
}
}
whitespace(token, Around);
whitespace(token, policy);
}

function markIn(token:TokenTree) {
Expand Down
20 changes: 20 additions & 0 deletions test/testcases/whitespace/issue_634_is_as_import.hxtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{}

---

import Std.is as isOfType;

#if (haxe_ver >= 4.2)
import Std.isOfType;
#else
import Std.is as isOfType;
#end

---

import Std.is as isOfType;
#if (haxe_ver >= 4.2)
import Std.isOfType;
#else
import Std.is as isOfType;
#end

0 comments on commit 084c876

Please sign in to comment.