Skip to content

Support triple-shift operators. #1011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.0.1

* Support triple-shift `>>>` and `>>>=` operators (#992).

# 2.0.0

* Migrate to null safety.
Expand Down
4 changes: 2 additions & 2 deletions lib/src/dart_formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class DartFormatter {
// TODO(paulberry): consider plumbing in experiment enable flags from the
// command line.
var featureSet = FeatureSet.fromEnableFlags2(
sdkLanguageVersion: Version(2, 10, 0),
flags: ['non-nullable', 'generic-metadata']);
sdkLanguageVersion: Version(2, 13, 0),
flags: ['non-nullable', 'generic-metadata', 'triple-shift']);

var inputOffset = 0;
var text = source.text;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/line_splitting/solve_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class SolveState {

buffer.write(' \$${splits.cost}');

if (overflowChars > 0) buffer.write(' (${overflowChars} over)');
if (overflowChars > 0) buffer.write(' ($overflowChars over)');
if (!_isComplete) buffer.write(' (incomplete)');

return buffer.toString();
Expand Down
38 changes: 19 additions & 19 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "17.0.0"
version: "19.0.0"
analyzer:
dependency: "direct main"
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.3.0"
args:
dependency: "direct main"
description:
Expand Down Expand Up @@ -70,7 +70,7 @@ packages:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.2"
version: "1.0.2"
crypto:
dependency: transitive
description:
Expand All @@ -91,21 +91,21 @@ packages:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.1"
grinder:
dependency: "direct dev"
description:
name: grinder
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0-nullsafety.0"
version: "0.9.0"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "3.0.0"
http_parser:
dependency: transitive
description:
Expand All @@ -119,7 +119,7 @@ packages:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
version: "1.0.0"
js:
dependency: "direct dev"
description:
Expand All @@ -133,7 +133,7 @@ packages:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.1"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -161,7 +161,7 @@ packages:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.13"
version: "2.0.0"
package_config:
dependency: transitive
description:
Expand All @@ -182,7 +182,7 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
version: "1.11.0"
pool:
dependency: transitive
description:
Expand All @@ -203,28 +203,28 @@ packages:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "3.0.0"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.9+2"
version: "1.0.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4+1"
version: "1.0.1"
source_map_stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -280,21 +280,21 @@ packages:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.4"
version: "1.16.8"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.14"
version: "0.3.19"
test_descriptor:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -343,7 +343,7 @@ packages:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.5"
version: "1.0.0"
yaml:
dependency: "direct dev"
description:
Expand All @@ -352,4 +352,4 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
dart: ">=2.12.0 <3.0.0"
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dart_style
# Note: See tool/grind.dart for how to bump the version.
version: 2.0.0
version: 2.0.1-dev
description: >-
Opinionated, automatic Dart source code formatter.
Provides an API and a CLI tool.
Expand All @@ -10,7 +10,7 @@ environment:
sdk: '>=2.12.0-0 <3.0.0'

dependencies:
analyzer: ^1.1.0
analyzer: ^1.3.0
args: '>=1.0.0 <3.0.0'
path: ^1.0.0
pub_semver: '>=1.4.4 <3.0.0'
Expand All @@ -23,7 +23,7 @@ dev_dependencies:
# and publishing to npm hasn't been used in a while.
# node_preamble: ^1.0.0
pedantic: ^1.0.0
test: ^1.16.0
test: ^1.16.8
test_descriptor: ^2.0.0
test_process: ^2.0.0
yaml: '>=2.0.0 <4.0.0'
Expand Down
4 changes: 2 additions & 2 deletions test/splitting/mixed.stmt
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ longName +
longName -
longName;
>>> mixed shift operators
longName >> longName << longName >> longName << longName;
longName >> longName << longName >> longName >>> longName;
<<<
longName >>
longName <<
longName >>
longName <<
longName >>>
longName;
>>> mixture of same and different precedence
veryLongIdentifier + veryLongIdentifier / veryLongIdentifier *
Expand Down
4 changes: 4 additions & 0 deletions test/whitespace/expressions.stmt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
var a=1+2/(3*-b~/4);
<<<
var a = 1 + 2 / (3 * -b ~/ 4);
>>> triple-shift
a>>>=1>>>-2>>>3;
<<<
a >>>= 1 >>> -2 >>> 3;
>>> conditional operator
var c=!condition==a>b;
<<<
Expand Down