Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 84c3eac

Browse files
author
Dart CI
committed
Version 2.10.0-77.0.dev
Merge commit '0967d19156acc5ca4fc1cf7dcc129d6c680f3696' into 'dev'
2 parents 92782d2 + 0967d19 commit 84c3eac

File tree

155 files changed

+2613
-908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+2613
-908
lines changed

.dart_tool/package_config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
"name": "csslib",
179179
"rootUri": "../third_party/pkg/csslib",
180180
"packageUri": "lib/",
181-
"languageVersion": "2.2"
181+
"languageVersion": "2.10"
182182
},
183183
{
184184
"name": "dart2js_info",
@@ -752,4 +752,4 @@
752752
"languageVersion": "2.4"
753753
}
754754
]
755-
}
755+
}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
* Adds `Abort` method to class `HttpClientRequest`, which allows users
88
to cancel outgoing HTTP requests and stop following IO operations.
9-
* A validtion check is added to `path` of class `Cookie`. Having characters
9+
* A validation check is added to `path` of class `Cookie`. Having characters
1010
ranging from 0x00 to 0x1f and 0x3b (";") will lead to a `FormatException`.
1111

1212
#### `dart:typed_data`

DEPS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ vars = {
4444
# co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
4545
# hashes. It requires access to the dart-build-access group, which EngProd
4646
# has.
47-
"co19_rev": "d94e371b8aafa3f4b88821c63a5ef1f618c2124d",
47+
"co19_rev": "12855e59cd7e031d076cc8cece9f5ee08e77ca8c",
4848
"co19_2_rev": "e48b3090826cf40b8037648f19d211e8eab1b4b6",
4949

5050
# The internal benchmarks to use. See go/dart-benchmarks-internal
@@ -79,8 +79,8 @@ vars = {
7979
"collection_rev": "583693680fc067e34ca5b72503df25e8b80579f9",
8080
"convert_rev": "c1b01f832835d3d8a06b0b246a361c0eaab35d3c",
8181
"crypto_rev": "f7c48b334b1386bc5ab0f706fbcd6df8496a87fc",
82-
"csslib_rev": "451448a9ac03f87a8d0377fc0b411d8c388a6cb4",
83-
"dart2js_info_rev" : "94ba36cb77067f28b75a4212e77b810a2d7385e9",
82+
"csslib_rev": "166d3e07eabc8283c6137cfde17fb25b8bb40080",
83+
"dart2js_info_rev" : "0632a623b08e1f601c7eba99e0186a581ae799e9",
8484

8585
# Note: Updates to dart_style have to be coordinated with the infrastructure
8686
# team so that the internal formatter in `tools/sdks/dart-sdk/bin/dartfmt`

pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,8 +1894,9 @@ abstract class AbstractScanner implements Scanner {
18941894
codeUnits.add(next);
18951895
next = advance();
18961896
}
1897-
appendToken(new StringToken.fromString(TokenType.IDENTIFIER,
1898-
new String.fromCharCodes(codeUnits), charOffset));
1897+
appendToken(new StringToken.fromString(
1898+
TokenType.IDENTIFIER, new String.fromCharCodes(codeUnits), charOffset,
1899+
precedingComments: comments));
18991900
return next;
19001901
} else {
19011902
prependErrorToken(errorToken);

pkg/analysis_server/lib/src/computer/computer_highlights.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DartUnitHighlightsComputer {
2525

2626
void _addCommentRanges() {
2727
var token = _unit.beginToken;
28-
do {
28+
while (token != null) {
2929
Token commentToken = token.precedingComments;
3030
while (commentToken != null) {
3131
HighlightRegionType highlightType;
@@ -44,8 +44,13 @@ class DartUnitHighlightsComputer {
4444
}
4545
commentToken = commentToken.next;
4646
}
47+
if (token.type == TokenType.EOF) {
48+
// Only exit the loop *after* processing the EOF token as it may
49+
// have preceeding comments.
50+
break;
51+
}
4752
token = token.next;
48-
} while (token != null && token.type != TokenType.EOF);
53+
}
4954
}
5055

5156
void _addIdentifierRegion(SimpleIdentifier node) {

pkg/analysis_server/lib/src/computer/computer_highlights2.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DartUnitHighlightsComputer2 {
2525

2626
void _addCommentRanges() {
2727
var token = _unit.beginToken;
28-
do {
28+
while (token != null) {
2929
Token commentToken = token.precedingComments;
3030
while (commentToken != null) {
3131
HighlightRegionType highlightType;
@@ -44,8 +44,13 @@ class DartUnitHighlightsComputer2 {
4444
}
4545
commentToken = commentToken.next;
4646
}
47+
if (token.type == TokenType.EOF) {
48+
// Only exit the loop *after* processing the EOF token as it may
49+
// have preceeding comments.
50+
break;
51+
}
4752
token = token.next;
48-
} while (token != null && token.type != TokenType.EOF);
53+
}
4954
}
5055

5156
void _addIdentifierRegion(SimpleIdentifier node) {

pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'package:analysis_server/src/services/correction/dart/add_override.dart';
1313
import 'package:analysis_server/src/services/correction/dart/convert_add_all_to_spread.dart';
1414
import 'package:analysis_server/src/services/correction/dart/convert_conditional_expression_to_if_element.dart';
1515
import 'package:analysis_server/src/services/correction/dart/convert_documentation_into_line.dart';
16+
import 'package:analysis_server/src/services/correction/dart/convert_map_from_iterable_to_for_literal.dart';
1617
import 'package:analysis_server/src/services/correction/dart/convert_quotes.dart';
1718
import 'package:analysis_server/src/services/correction/dart/convert_to_contains.dart';
1819
import 'package:analysis_server/src/services/correction/dart/convert_to_generic_function_syntax.dart';
@@ -86,6 +87,8 @@ class BulkFixProcessor {
8687
LintNames.prefer_equal_for_default_values:
8788
ReplaceColonWithEquals.newInstance,
8889
LintNames.prefer_final_fields: MakeFinal.newInstance,
90+
LintNames.prefer_for_elements_to_map_fromIterable:
91+
ConvertMapFromIterableToForLiteral.newInstance,
8992
LintNames.prefer_generic_function_type_aliases:
9093
ConvertToGenericFunctionSyntax.newInstance,
9194
LintNames.prefer_if_elements_to_conditional_expressions:

pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_error_code.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ class TransformSetErrorCode extends ErrorCode {
1212
* Parameters:
1313
* 0: the unsupported key
1414
*/
15-
static const TransformSetErrorCode unsupportedKey = TransformSetErrorCode(
16-
'unsupported_key', "The key '{0}' isn't supported.");
15+
static const TransformSetErrorCode unsupportedKey =
16+
TransformSetErrorCode('unsupportedKey', "The key '{0}' isn't supported.");
1717

1818
/**
1919
* Parameters:
2020
* 0: the message produced by the YAML parser
2121
*/
2222
static const TransformSetErrorCode yamlSyntaxError =
23-
TransformSetErrorCode('yaml_syntax_error', "{0}");
23+
TransformSetErrorCode('yamlSyntaxError', "{0}");
2424

2525
/// Initialize a newly created error code.
2626
const TransformSetErrorCode(String name, String message,

pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ class TransformSetParser {
4343
/// [errorReporter].
4444
TransformSetParser(this.errorReporter);
4545

46-
/// Return the result of parsing the file [content] into a transform set.
46+
/// Return the result of parsing the file [content] into a transform set, or
47+
/// `null` if the content does not represent a valid transform set.
4748
TransformSet parse(String content) {
4849
assert(content != null);
4950
var map = _parseYaml(content);
5051
if (map == null) {
51-
return TransformSet();
52+
// The error has already been reported.
53+
return null;
5254
}
5355
return _translateTransformSet(map);
5456
}
@@ -89,7 +91,8 @@ class TransformSetParser {
8991
}
9092
}
9193

92-
/// Translate the [node] into a change.
94+
/// Translate the [node] into a change. Return the resulting change, or `null`
95+
/// if the [node] does not represent a valid change.
9396
Change _translateChange(YamlNode node) {
9497
if (node is YamlMap) {
9598
var kind = _translateString(node.valueAt(_kindKey));
@@ -108,12 +111,22 @@ class TransformSetParser {
108111
}
109112
}
110113

111-
/// Translate the [node] into an element descriptor.
114+
/// Translate the [node] into an element descriptor. Return the resulting
115+
/// descriptor, or `null` if the [node] does not represent a valid element
116+
/// descriptor.
112117
ElementDescriptor _translateElement(YamlNode node) {
113118
if (node is YamlMap) {
114119
var uris = _translateList(node.valueAt(_urisKey), _translateString);
120+
if (uris == null) {
121+
// The error has already been reported.
122+
return null;
123+
}
115124
var components =
116125
_translateList(node.valueAt(_componentsKey), _translateString);
126+
if (components == null) {
127+
// The error has already been reported.
128+
return null;
129+
}
117130
return ElementDescriptor(libraryUris: uris, components: components);
118131
} else if (node == null) {
119132
// TODO(brianwilkerson) Report the missing YAML.
@@ -124,7 +137,8 @@ class TransformSetParser {
124137
}
125138
}
126139

127-
/// Translate the [node] into an integer.
140+
/// Translate the [node] into an integer. Return the resulting integer, or
141+
/// `null` if the [node] does not represent a valid integer.
128142
int _translateInteger(YamlNode node) {
129143
if (node is YamlScalar) {
130144
var value = node.value;
@@ -146,6 +160,9 @@ class TransformSetParser {
146160
}
147161

148162
/// Translate the [node] into a list of objects using the [elementTranslator].
163+
/// Return the resulting list, or `null` if the [node] does not represent a
164+
/// valid list. If any of the elements of the list can't be translated, they
165+
/// will be omitted from the list but the valid elements will be returned.
149166
List<R> _translateList<R>(
150167
YamlNode node, R Function(YamlNode) elementTranslator) {
151168
if (node is YamlList) {
@@ -166,14 +183,19 @@ class TransformSetParser {
166183
}
167184
}
168185

169-
/// Translate the [node] into a rename change.
186+
/// Translate the [node] into a rename change. Return the resulting change, or
187+
/// `null` if the [node] does not represent a valid rename change.
170188
Change _translateRenameChange(YamlMap node) {
171189
_reportUnsupportedKeys(node, const {_kindKey, _newNameKey});
172190
var newName = _translateString(node.valueAt(_newNameKey));
191+
if (newName == null) {
192+
return null;
193+
}
173194
return Rename(newName: newName);
174195
}
175196

176-
/// Translate the [node] into a string.
197+
/// Translate the [node] into a string. Return the resulting string, or `null`
198+
/// if the [node] does not represent a valid string.
177199
String _translateString(YamlNode node) {
178200
if (node is YamlScalar) {
179201
var value = node.value;
@@ -194,14 +216,19 @@ class TransformSetParser {
194216
}
195217
}
196218

197-
/// Translate the [node] into a transform.
219+
/// Translate the [node] into a transform. Return the resulting transform, or
220+
/// `null` if the [node] does not represent a valid transform.
198221
Transform _translateTransform(YamlNode node) {
199222
if (node is YamlMap) {
200223
_reportUnsupportedKeys(node, const {_changesKey, _elementKey, _titleKey});
201224
var title = _translateString(node.valueAt(_titleKey));
202225
var element = _translateElement(node.valueAt(_elementKey));
203226
var changes =
204227
_translateList<Change>(node.valueAt(_changesKey), _translateChange);
228+
if (changes == null) {
229+
// The error has already been reported.
230+
return null;
231+
}
205232
return Transform(title: title, element: element, changes: changes);
206233
} else if (node == null) {
207234
// TODO(brianwilkerson) Report the missing YAML.
@@ -212,7 +239,8 @@ class TransformSetParser {
212239
}
213240
}
214241

215-
/// Translate the [node] into a transform set.
242+
/// Translate the [node] into a transform set. Return the resulting transform
243+
/// set, or `null` if the [node] does not represent a valid transform set.
216244
TransformSet _translateTransformSet(YamlNode node) {
217245
if (node is YamlMap) {
218246
_reportUnsupportedKeys(node, const {_transformsKey, _versionKey});
@@ -225,6 +253,10 @@ class TransformSetParser {
225253
}
226254
var transformations =
227255
_translateList(node.valueAt(_transformsKey), _translateTransform);
256+
if (transformations == null) {
257+
// The error has already been reported.
258+
return null;
259+
}
228260
for (var transform in transformations) {
229261
set.addTransform(transform);
230262
}

pkg/analysis_server/test/src/computer/highlights2_computer_test.dart

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ class Highlights2ComputerTest extends AbstractContextTest {
2929
sourcePath = convertPath('/home/test/lib/test.dart');
3030
}
3131

32+
Future<void> test_comment() async {
33+
await _computeHighlights('''
34+
// A trailing comment
35+
''');
36+
_check(HighlightRegionType.COMMENT_END_OF_LINE, '// A trailing comment');
37+
}
38+
39+
Future<void> test_comment_trailing() async {
40+
await _computeHighlights('''
41+
class A {}
42+
// A trailing comment
43+
''');
44+
_check(HighlightRegionType.COMMENT_END_OF_LINE, '// A trailing comment');
45+
}
46+
3247
Future<void> test_extension() async {
3348
await _computeHighlights('''
3449
extension E on String {}
@@ -62,13 +77,6 @@ void main() {
6277
_check(HighlightRegionType.KEYWORD, 'throw');
6378
}
6479

65-
Future<void> test_trailingComment() async {
66-
await _computeHighlights('''
67-
// A trailing comment
68-
''');
69-
_check(HighlightRegionType.COMMENT_END_OF_LINE, '// A trailing comment');
70-
}
71-
7280
void _check(HighlightRegionType expectedType, String expectedText) {
7381
for (var region in highlights) {
7482
if (region.type == expectedType) {

0 commit comments

Comments
 (0)