Skip to content

Commit fc5655f

Browse files
authored
Merge pull request #1011 from dart-lang/triple-shift
Support triple-shift operators.
2 parents 2cf8100 + c21c6ff commit fc5655f

File tree

7 files changed

+35
-27
lines changed

7 files changed

+35
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 2.0.1
2+
3+
* Support triple-shift `>>>` and `>>>=` operators (#992).
4+
15
# 2.0.0
26

37
* Migrate to null safety.

lib/src/dart_formatter.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ class DartFormatter {
8787
// TODO(paulberry): consider plumbing in experiment enable flags from the
8888
// command line.
8989
var featureSet = FeatureSet.fromEnableFlags2(
90-
sdkLanguageVersion: Version(2, 10, 0),
91-
flags: ['non-nullable', 'generic-metadata']);
90+
sdkLanguageVersion: Version(2, 13, 0),
91+
flags: ['non-nullable', 'generic-metadata', 'triple-shift']);
9292

9393
var inputOffset = 0;
9494
var text = source.text;

lib/src/line_splitting/solve_state.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ class SolveState {
569569

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

572-
if (overflowChars > 0) buffer.write(' (${overflowChars} over)');
572+
if (overflowChars > 0) buffer.write(' ($overflowChars over)');
573573
if (!_isComplete) buffer.write(' (incomplete)');
574574

575575
return buffer.toString();

pubspec.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ packages:
77
name: _fe_analyzer_shared
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "17.0.0"
10+
version: "19.0.0"
1111
analyzer:
1212
dependency: "direct main"
1313
description:
1414
name: analyzer
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.1.0"
17+
version: "1.3.0"
1818
args:
1919
dependency: "direct main"
2020
description:
@@ -70,7 +70,7 @@ packages:
7070
name: coverage
7171
url: "https://pub.dartlang.org"
7272
source: hosted
73-
version: "0.15.2"
73+
version: "1.0.2"
7474
crypto:
7575
dependency: transitive
7676
description:
@@ -91,21 +91,21 @@ packages:
9191
name: glob
9292
url: "https://pub.dartlang.org"
9393
source: hosted
94-
version: "2.0.0"
94+
version: "2.0.1"
9595
grinder:
9696
dependency: "direct dev"
9797
description:
9898
name: grinder
9999
url: "https://pub.dartlang.org"
100100
source: hosted
101-
version: "0.9.0-nullsafety.0"
101+
version: "0.9.0"
102102
http_multi_server:
103103
dependency: transitive
104104
description:
105105
name: http_multi_server
106106
url: "https://pub.dartlang.org"
107107
source: hosted
108-
version: "2.2.0"
108+
version: "3.0.0"
109109
http_parser:
110110
dependency: transitive
111111
description:
@@ -119,7 +119,7 @@ packages:
119119
name: io
120120
url: "https://pub.dartlang.org"
121121
source: hosted
122-
version: "0.3.5"
122+
version: "1.0.0"
123123
js:
124124
dependency: "direct dev"
125125
description:
@@ -133,7 +133,7 @@ packages:
133133
name: logging
134134
url: "https://pub.dartlang.org"
135135
source: hosted
136-
version: "1.0.0"
136+
version: "1.0.1"
137137
matcher:
138138
dependency: transitive
139139
description:
@@ -161,7 +161,7 @@ packages:
161161
name: node_preamble
162162
url: "https://pub.dartlang.org"
163163
source: hosted
164-
version: "1.4.13"
164+
version: "2.0.0"
165165
package_config:
166166
dependency: transitive
167167
description:
@@ -182,7 +182,7 @@ packages:
182182
name: pedantic
183183
url: "https://pub.dartlang.org"
184184
source: hosted
185-
version: "1.10.0"
185+
version: "1.11.0"
186186
pool:
187187
dependency: transitive
188188
description:
@@ -203,28 +203,28 @@ packages:
203203
name: shelf
204204
url: "https://pub.dartlang.org"
205205
source: hosted
206-
version: "1.0.0"
206+
version: "1.1.0"
207207
shelf_packages_handler:
208208
dependency: transitive
209209
description:
210210
name: shelf_packages_handler
211211
url: "https://pub.dartlang.org"
212212
source: hosted
213-
version: "2.0.1"
213+
version: "3.0.0"
214214
shelf_static:
215215
dependency: transitive
216216
description:
217217
name: shelf_static
218218
url: "https://pub.dartlang.org"
219219
source: hosted
220-
version: "0.2.9+2"
220+
version: "1.0.0"
221221
shelf_web_socket:
222222
dependency: transitive
223223
description:
224224
name: shelf_web_socket
225225
url: "https://pub.dartlang.org"
226226
source: hosted
227-
version: "0.2.4+1"
227+
version: "1.0.1"
228228
source_map_stack_trace:
229229
dependency: transitive
230230
description:
@@ -280,21 +280,21 @@ packages:
280280
name: test
281281
url: "https://pub.dartlang.org"
282282
source: hosted
283-
version: "1.16.4"
283+
version: "1.16.8"
284284
test_api:
285285
dependency: transitive
286286
description:
287287
name: test_api
288288
url: "https://pub.dartlang.org"
289289
source: hosted
290-
version: "0.2.19"
290+
version: "0.3.0"
291291
test_core:
292292
dependency: transitive
293293
description:
294294
name: test_core
295295
url: "https://pub.dartlang.org"
296296
source: hosted
297-
version: "0.3.14"
297+
version: "0.3.19"
298298
test_descriptor:
299299
dependency: "direct dev"
300300
description:
@@ -343,7 +343,7 @@ packages:
343343
name: webkit_inspection_protocol
344344
url: "https://pub.dartlang.org"
345345
source: hosted
346-
version: "0.7.5"
346+
version: "1.0.0"
347347
yaml:
348348
dependency: "direct dev"
349349
description:
@@ -352,4 +352,4 @@ packages:
352352
source: hosted
353353
version: "3.1.0"
354354
sdks:
355-
dart: ">=2.12.0-0.0 <3.0.0"
355+
dart: ">=2.12.0 <3.0.0"

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dart_style
22
# Note: See tool/grind.dart for how to bump the version.
3-
version: 2.0.0
3+
version: 2.0.1-dev
44
description: >-
55
Opinionated, automatic Dart source code formatter.
66
Provides an API and a CLI tool.
@@ -10,7 +10,7 @@ environment:
1010
sdk: '>=2.12.0-0 <3.0.0'
1111

1212
dependencies:
13-
analyzer: ^1.1.0
13+
analyzer: ^1.3.0
1414
args: '>=1.0.0 <3.0.0'
1515
path: ^1.0.0
1616
pub_semver: '>=1.4.4 <3.0.0'
@@ -23,7 +23,7 @@ dev_dependencies:
2323
# and publishing to npm hasn't been used in a while.
2424
# node_preamble: ^1.0.0
2525
pedantic: ^1.0.0
26-
test: ^1.16.0
26+
test: ^1.16.8
2727
test_descriptor: ^2.0.0
2828
test_process: ^2.0.0
2929
yaml: '>=2.0.0 <4.0.0'

test/splitting/mixed.stmt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,12 @@ longName +
170170
longName -
171171
longName;
172172
>>> mixed shift operators
173-
longName >> longName << longName >> longName << longName;
173+
longName >> longName << longName >> longName >>> longName;
174174
<<<
175175
longName >>
176176
longName <<
177177
longName >>
178-
longName <<
178+
longName >>>
179179
longName;
180180
>>> mixture of same and different precedence
181181
veryLongIdentifier + veryLongIdentifier / veryLongIdentifier *

test/whitespace/expressions.stmt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
var a=1+2/(3*-b~/4);
44
<<<
55
var a = 1 + 2 / (3 * -b ~/ 4);
6+
>>> triple-shift
7+
a>>>=1>>>-2>>>3;
8+
<<<
9+
a >>>= 1 >>> -2 >>> 3;
610
>>> conditional operator
711
var c=!condition==a>b;
812
<<<

0 commit comments

Comments
 (0)