Skip to content

Commit 42a0bf5

Browse files
author
Dart CI
committed
Version 2.11.0-232.0.dev
Merge commit 'b7d4422587ac37e27e31d0578c8501da8ff9352d' into 'dev'
2 parents aaab579 + b7d4422 commit 42a0bf5

File tree

6 files changed

+183
-69
lines changed

6 files changed

+183
-69
lines changed

.dart_tool/package_config.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"constraint, update this by running tools/generate_package_config.dart."
1212
],
1313
"configVersion": 2,
14-
"generated": "2020-10-09T10:15:45.502457",
14+
"generated": "2020-10-15T16:28:43.685252",
1515
"generator": "tools/generate_package_config.dart",
1616
"packages": [
1717
{
@@ -454,7 +454,7 @@
454454
{
455455
"name": "observatory_test_package",
456456
"rootUri": "../runtime/observatory/tests/service/observatory_test_package",
457-
"languageVersion": "2.10"
457+
"languageVersion": "2.9"
458458
},
459459
{
460460
"name": "observatory_test_package_2",
@@ -467,6 +467,11 @@
467467
"packageUri": "lib/",
468468
"languageVersion": "2.7"
469469
},
470+
{
471+
"name": "package_deps",
472+
"rootUri": "../tools/package_deps",
473+
"languageVersion": "2.8"
474+
},
470475
{
471476
"name": "path",
472477
"rootUri": "../third_party/pkg/path",
@@ -495,7 +500,7 @@
495500
"name": "pub",
496501
"rootUri": "../third_party/pkg/pub",
497502
"packageUri": "lib/",
498-
"languageVersion": "2.9"
503+
"languageVersion": "2.11"
499504
},
500505
{
501506
"name": "pub_semver",
@@ -761,4 +766,4 @@
761766
"languageVersion": "2.4"
762767
}
763768
]
764-
}
769+
}

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ vars = {
116116
"linter_tag": "0.1.121",
117117
"logging_rev": "1590ba0b648a51e7eb3895c612e4b72f72623b6f",
118118
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
119-
"markdown_rev": "dbeafd47759e7dd0a167602153bb9c49fb5e5fe7",
119+
"markdown_rev": "6f89681d59541ddb1cf3a58efbdaa2304ffc3f51",
120120
"matcher_rev": "9cae8faa7868bf3a88a7ba45eb0bd128e66ac515",
121121
"mime_tag": "0.9.7",
122122
"mockito_rev": "d39ac507483b9891165e422ec98d9fb480037c8b",

pkg/nnbd_migration/test/api_test.dart

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4012,23 +4012,10 @@ void repro(){
40124012
await _checkSingleFileChanges(content, expected);
40134013
}
40144014

4015-
Future<void> test_late_hint_followed_by_underscore() async {
4016-
var content = '''
4017-
class _C {}
4018-
/*late*/ _C c;
4019-
''';
4020-
var expected = '''
4021-
class _C {}
4022-
late _C c;
4023-
''';
4024-
await _checkSingleFileChanges(content, expected);
4025-
}
4026-
4027-
Future<void> test_late_hint_instance_field_with_constructor() async {
4015+
Future<void> test_late_final_hint_instance_field_without_constructor() async {
40284016
var content = '''
40294017
class C {
4030-
C();
4031-
/*late*/ int x;
4018+
/*late final*/ int x;
40324019
f() {
40334020
x = 1;
40344021
}
@@ -4037,8 +4024,7 @@ class C {
40374024
''';
40384025
var expected = '''
40394026
class C {
4040-
C();
4041-
late int x;
4027+
late final int x;
40424028
f() {
40434029
x = 1;
40444030
}
@@ -4048,32 +4034,69 @@ class C {
40484034
await _checkSingleFileChanges(content, expected);
40494035
}
40504036

4051-
Future<void> test_late_hint_instance_field_without_constructor() async {
4037+
Future<void> test_late_final_hint_local_variable() async {
40524038
var content = '''
4053-
class C {
4054-
/*late*/ int x;
4055-
f() {
4039+
int f(bool b1, bool b2) {
4040+
/*late final*/ int x;
4041+
if (b1) {
40564042
x = 1;
40574043
}
4058-
int g() => x;
4044+
if (b2) {
4045+
return x;
4046+
}
4047+
return 0;
40594048
}
40604049
''';
40614050
var expected = '''
4062-
class C {
4063-
late int x;
4064-
f() {
4051+
int f(bool b1, bool b2) {
4052+
late final int x;
4053+
if (b1) {
40654054
x = 1;
40664055
}
4067-
int g() => x;
4056+
if (b2) {
4057+
return x;
4058+
}
4059+
return 0;
40684060
}
40694061
''';
40704062
await _checkSingleFileChanges(content, expected);
40714063
}
40724064

4073-
Future<void> test_late_final_hint_instance_field_without_constructor() async {
4065+
Future<void> test_late_final_hint_top_level_var() async {
4066+
var content = '''
4067+
/*late final*/ int x;
4068+
f() {
4069+
x = 1;
4070+
}
4071+
int g() => x;
4072+
''';
4073+
var expected = '''
4074+
late final int x;
4075+
f() {
4076+
x = 1;
4077+
}
4078+
int g() => x;
4079+
''';
4080+
await _checkSingleFileChanges(content, expected);
4081+
}
4082+
4083+
Future<void> test_late_hint_followed_by_underscore() async {
4084+
var content = '''
4085+
class _C {}
4086+
/*late*/ _C c;
4087+
''';
4088+
var expected = '''
4089+
class _C {}
4090+
late _C c;
4091+
''';
4092+
await _checkSingleFileChanges(content, expected);
4093+
}
4094+
4095+
Future<void> test_late_hint_instance_field_with_constructor() async {
40744096
var content = '''
40754097
class C {
4076-
/*late final*/ int x;
4098+
C();
4099+
/*late*/ int x;
40774100
f() {
40784101
x = 1;
40794102
}
@@ -4082,7 +4105,8 @@ class C {
40824105
''';
40834106
var expected = '''
40844107
class C {
4085-
late final int x;
4108+
C();
4109+
late int x;
40864110
f() {
40874111
x = 1;
40884112
}
@@ -4092,38 +4116,32 @@ class C {
40924116
await _checkSingleFileChanges(content, expected);
40934117
}
40944118

4095-
Future<void> test_late_hint_local_variable() async {
4119+
Future<void> test_late_hint_instance_field_without_constructor() async {
40964120
var content = '''
4097-
int f(bool b1, bool b2) {
4121+
class C {
40984122
/*late*/ int x;
4099-
if (b1) {
4123+
f() {
41004124
x = 1;
41014125
}
4102-
if (b2) {
4103-
return x;
4104-
}
4105-
return 0;
4126+
int g() => x;
41064127
}
41074128
''';
41084129
var expected = '''
4109-
int f(bool b1, bool b2) {
4130+
class C {
41104131
late int x;
4111-
if (b1) {
4132+
f() {
41124133
x = 1;
41134134
}
4114-
if (b2) {
4115-
return x;
4116-
}
4117-
return 0;
4135+
int g() => x;
41184136
}
41194137
''';
41204138
await _checkSingleFileChanges(content, expected);
41214139
}
41224140

4123-
Future<void> test_late_final_hint_local_variable() async {
4141+
Future<void> test_late_hint_local_variable() async {
41244142
var content = '''
41254143
int f(bool b1, bool b2) {
4126-
/*late final*/ int x;
4144+
/*late*/ int x;
41274145
if (b1) {
41284146
x = 1;
41294147
}
@@ -4135,7 +4153,7 @@ int f(bool b1, bool b2) {
41354153
''';
41364154
var expected = '''
41374155
int f(bool b1, bool b2) {
4138-
late final int x;
4156+
late int x;
41394157
if (b1) {
41404158
x = 1;
41414159
}
@@ -4188,24 +4206,6 @@ int g() => x;
41884206
await _checkSingleFileChanges(content, expected);
41894207
}
41904208

4191-
Future<void> test_late_final_hint_top_level_var() async {
4192-
var content = '''
4193-
/*late final*/ int x;
4194-
f() {
4195-
x = 1;
4196-
}
4197-
int g() => x;
4198-
''';
4199-
var expected = '''
4200-
late final int x;
4201-
f() {
4202-
x = 1;
4203-
}
4204-
int g() => x;
4205-
''';
4206-
await _checkSingleFileChanges(content, expected);
4207-
}
4208-
42094209
Future<void> test_leave_downcast_from_dynamic_implicit() async {
42104210
var content = 'int f(dynamic n) => n;';
42114211
var expected = 'int f(dynamic n) => n;';

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 11
2929
PATCH 0
30-
PRERELEASE 231
30+
PRERELEASE 232
3131
PRERELEASE_PATCH 0

tools/generate_package_config.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void main(List<String> args) {
2626
packageDirectory('sdk/lib/_internal/sdk_library_metadata'),
2727
packageDirectory('sdk/lib/_internal/js_runtime'),
2828
packageDirectory('third_party/pkg/protobuf/protobuf'),
29+
packageDirectory('tools/package_deps'),
2930
];
3031

3132
var cfePackageDirs = [

tools/opt_out_files.dart

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/usr/bin/env dart
2+
3+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
4+
// for details. All rights reserved. Use of this source code is governed by a
5+
// BSD-style license that can be found in the LICENSE file.
6+
import 'dart:io';
7+
8+
final commentLine = RegExp(r'^///?');
9+
final scriptLine = RegExp(r'^#\!');
10+
final languageMarker = RegExp(r"^\s*//\s*@dart\s*=");
11+
12+
void main(List<String> args) {
13+
if (args.length < 1) {
14+
print('Mark files passed on the command line or under a directory');
15+
print(' passed on the command line as opted out of null safety. Does');
16+
print(' not mark files under directories containing a pubspec.yaml file');
17+
print(' unless the file is specified explicitly in the argument list.');
18+
print(' Ignores files not ending in ".dart".');
19+
print('Usage: opt_files_out.dart <files or directories>');
20+
return;
21+
}
22+
for (var name in args) {
23+
switch (FileSystemEntity.typeSync(name)) {
24+
case FileSystemEntityType.directory:
25+
markDirectory(Directory(name));
26+
break;
27+
case FileSystemEntityType.file:
28+
markFile(File(name));
29+
break;
30+
default:
31+
print("Ignoring unknown object $name");
32+
break;
33+
}
34+
}
35+
}
36+
37+
bool isPubSpec(FileSystemEntity entity) =>
38+
entity is File && entity.path.endsWith("pubspec.yaml");
39+
40+
void markEntity(FileSystemEntity entity) {
41+
if (entity is File) {
42+
markFile(entity);
43+
} else if (entity is Directory) {
44+
markDirectory(entity);
45+
} else {
46+
print("Ignoring unknown object ${entity.path}");
47+
}
48+
}
49+
50+
void markDirectory(Directory dir) {
51+
var children = dir.listSync();
52+
if (children.any(isPubSpec)) {
53+
print("Skipping files under ${dir.path}");
54+
return;
55+
}
56+
for (var child in children) {
57+
markEntity(child);
58+
}
59+
}
60+
61+
void markFile(File file) {
62+
if (!file.path.endsWith(".dart")) {
63+
return;
64+
}
65+
66+
List<String> lines;
67+
try {
68+
lines = file.readAsLinesSync();
69+
} catch (e) {
70+
print("Failed to read file ${file.path}: $e");
71+
return;
72+
}
73+
if (lines.any((line) => line.startsWith(languageMarker))) {
74+
print("Skipping already marked file ${file.path}");
75+
return;
76+
}
77+
var marked = markContents(lines);
78+
try {
79+
file.writeAsStringSync(marked);
80+
} catch (e) {
81+
print("Failed to write file ${file.path}: $e");
82+
return;
83+
}
84+
print("Marked ${file.path}");
85+
}
86+
87+
String markContents(List<String> lines) {
88+
var buffer = StringBuffer();
89+
var marked = false;
90+
91+
for (var line in lines) {
92+
// If the file has not yet been marked, and we have reached the
93+
// first non-comment line, insert an opt out marker.
94+
if (!marked &&
95+
(!commentLine.hasMatch(line)) &&
96+
(!scriptLine.hasMatch(line))) {
97+
buffer.write('\n// @dart = 2.9\n');
98+
marked = true;
99+
}
100+
buffer.write('$line\n');
101+
}
102+
103+
// In case of empty file, or file of all comments (who does that!?).
104+
if (!marked) {
105+
buffer.write('\n// @dart = 2.9\n');
106+
}
107+
return buffer.toString();
108+
}

0 commit comments

Comments
 (0)