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

Commit 68fd701

Browse files
author
Dart CI
committed
Version 2.18.0-171.0.dev
Merge commit 'de8f84f62d58ab4d124a9706b34ae81de7b1ae34' into 'dev'
2 parents 6a7e6de + de8f84f commit 68fd701

File tree

242 files changed

+24041
-16586
lines changed

Some content is hidden

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

242 files changed

+24041
-16586
lines changed

CHANGELOG.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ them, you must set the lower bound on the SDK constraint for your package to
5656

5757
#### `dart:io`
5858

59+
- **Breaking Change** [#34218](https://github.com/dart-lang/sdk/issues/34218):
60+
Constants in `dart:io`'s networking APIs following the `SCREAMING_CAPS`
61+
convention have been removed (they were previously deprecated). Please use
62+
the corresponding `lowerCamelCase` constants instead.
63+
5964
- **Breaking Change** [#45630][]: The Dart VM no longer automatically restores
6065
the initial terminal settings upon exit. Programs that change the `Stdin`
6166
settings `lineMode` and `echoMode` are now responsible for restoring the
@@ -113,28 +118,33 @@ them, you must set the lower bound on the SDK constraint for your package to
113118
114119
#### Linter
115120
116-
Updated the Linter to `1.24.0`, which includes changes that
121+
Updated the Linter to `1.25.0`, which includes changes that
117122
118-
- fixes `prefer_final_parameters` to support super parameters.
119-
- adds new lint: `unnecessary_to_list_in_spreads`.
120-
- fixes `unawaited_futures` to handle string interpolated
123+
- add new lint: `discarded_futures`.
124+
- improve message and highlight range for `no_duplicate_case_values`
125+
- improve performance for `lines_longer_than_80_chars`,
126+
`prefer_const_constructors_in_immutables`, and
127+
`prefer_initializing_formals`.
128+
- fix `prefer_final_parameters` to support super parameters.
129+
- add new lint: `unnecessary_to_list_in_spreads`.
130+
- fix `unawaited_futures` to handle string interpolated
121131
futures.
122-
- updates `use_colored_box` to not flag nullable colors,
123-
- adds new lint:
132+
- update `use_colored_box` to not flag nullable colors,
133+
- add new lint:
124134
`unnecessary_null_aware_operator_on_extension_on_nullable`.
125-
- fixes `no_leading_underscores_for_local_identifiers`
135+
- fix `no_leading_underscores_for_local_identifiers`
126136
to lint local function declarations.
127-
- fixes `avoid_init_to_null` to correctly handle super
137+
- fix `avoid_init_to_null` to correctly handle super
128138
initializing defaults that are non-null.
129-
- updates `no_leading_underscores_for_local_identifiers`
139+
- update `no_leading_underscores_for_local_identifiers`
130140
to allow identifiers with just underscores.
131-
- fixes `flutter_style_todos` to support usernames that
141+
- fix `flutter_style_todos` to support usernames that
132142
start with a digit.
133-
- updates `require_trailing_commas` to handle functions
143+
- update `require_trailing_commas` to handle functions
134144
in asserts and multi-line strings.
135-
- updates `unsafe_html` to allow assignments to
145+
- update `unsafe_html` to allow assignments to
136146
`img.src`.
137-
- fixes `unnecessary_null_checks` to properly handle map
147+
- fix `unnecessary_null_checks` to properly handle map
138148
literal entries.
139149
140150
#### Pub

DEPS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ vars = {
106106
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
107107
"dart_style_rev": "d7b73536a8079331c888b7da539b80e6825270ea",
108108

109-
"dartdoc_rev": "8549817bb1b59808108e83ef0e513157cb572d2a",
109+
"dartdoc_rev": "f5bcc4bd46f4ce956b6c27ebaf741f6e90d7fca9",
110110
"devtools_rev": "51ac983d2db7eb19b3ce5956cb70b769d74fe784",
111111
"ffi_rev": "0c8364a728cfe4e4ba859c53b99d56b3dbe3add4",
112112
"file_rev": "0132eeedea2933513bf230513a766a8baeab0c4f",
@@ -120,7 +120,7 @@ vars = {
120120
"intl_rev": "9145f308f1458f37630a1ffce3b7d3b471ebbc56",
121121
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
122122
"json_rpc_2_rev": "2de9a1f9821807fa2c85fd48e2f70b9cbcddcb67",
123-
"linter_rev": "a8529c6692922b45bc287543b355c90d7b1286d3", # 1.24.0
123+
"linter_rev": "1ddc70948d94f2449fec69a95e3ceb7b6b6c8348", # 1.25.0
124124
"lints_rev": "8294e5648ab49474541527e2911e72e4c5aefe55",
125125
"logging_rev": "f6979e3bc3b6e1847a08335b7eb6304e18986195",
126126
"markdown_rev": "e3f4bd28c9e61b522f75f291d4d6cfcfeccd83ee", # 5.0.0

pkg/_js_interop_checks/lib/src/transformations/js_util_wasm_optimizer.dart

Lines changed: 45 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import '../js_interop.dart'
1616

1717
/// Replaces:
1818
/// 1) Factory constructors in classes with `@staticInterop` annotations with
19-
/// calls to `js_util_wasm.callConstructorVarArgs`.
19+
/// calls to `js_util.callConstructor`.
2020
/// 2) External methods in `@staticInterop` class extensions to their
21-
/// corresponding `js_util_wasm` calls.
21+
/// corresponding `js_util` calls.
2222
/// TODO(joshualitt): In the long term we'd like to have the same
2323
/// `JsUtilOptimizer` for all web backends. This is to ensure uniform semantics
2424
/// across all web backends. Some known challenges remain, and there may be
@@ -45,21 +45,18 @@ import '../js_interop.dart'
4545
class JsUtilWasmOptimizer extends Transformer {
4646
final Procedure _callMethodTarget;
4747
final Procedure _callConstructorTarget;
48-
final Procedure _globalThisTarget;
4948
final Procedure _getPropertyTarget;
5049
final Procedure _setPropertyTarget;
51-
final Procedure _jsifyTarget;
5250
final Procedure _jsifyRawTarget;
53-
final Procedure _dartifyTarget;
5451
final Procedure _newObjectTarget;
5552
final Procedure _wrapDartCallbackTarget;
5653
final Procedure _allowInteropTarget;
57-
final Class _jsValueClass;
5854
final Class _wasmAnyRefClass;
5955
final Class _objectClass;
6056
final Class _pragmaClass;
6157
final Field _pragmaName;
6258
final Field _pragmaOptions;
59+
final Member _globalThisMember;
6360
int _callbackTrampolineN = 1;
6461

6562
final CoreTypes _coreTypes;
@@ -68,30 +65,24 @@ class JsUtilWasmOptimizer extends Transformer {
6865
final Set<Class> _transformedClasses = {};
6966

7067
JsUtilWasmOptimizer(this._coreTypes, ClassHierarchy hierarchy)
71-
: _callMethodTarget = _coreTypes.index
72-
.getTopLevelProcedure('dart:js_util_wasm', 'callMethodVarArgs'),
73-
_globalThisTarget = _coreTypes.index
74-
.getTopLevelProcedure('dart:js_util_wasm', 'globalThis'),
75-
_callConstructorTarget = _coreTypes.index.getTopLevelProcedure(
76-
'dart:js_util_wasm', 'callConstructorVarArgs'),
68+
: _callMethodTarget =
69+
_coreTypes.index.getTopLevelProcedure('dart:js_util', 'callMethod'),
70+
_globalThisMember = _coreTypes.index
71+
.getTopLevelMember('dart:js_util', 'get:globalThis'),
72+
_callConstructorTarget = _coreTypes.index
73+
.getTopLevelProcedure('dart:js_util', 'callConstructor'),
7774
_getPropertyTarget = _coreTypes.index
78-
.getTopLevelProcedure('dart:js_util_wasm', 'getProperty'),
75+
.getTopLevelProcedure('dart:js_util', 'getProperty'),
7976
_setPropertyTarget = _coreTypes.index
80-
.getTopLevelProcedure('dart:js_util_wasm', 'setProperty'),
81-
_jsifyTarget =
82-
_coreTypes.index.getTopLevelProcedure('dart:js_util_wasm', 'jsify'),
77+
.getTopLevelProcedure('dart:js_util', 'setProperty'),
8378
_jsifyRawTarget = _coreTypes.index
84-
.getTopLevelProcedure('dart:js_util_wasm', 'jsifyRaw'),
85-
_dartifyTarget = _coreTypes.index
86-
.getTopLevelProcedure('dart:js_util_wasm', 'dartify'),
79+
.getTopLevelProcedure('dart:_js_helper', 'jsifyRaw'),
8780
_wrapDartCallbackTarget = _coreTypes.index
8881
.getTopLevelProcedure('dart:js_util_wasm', '_wrapDartCallback'),
89-
_newObjectTarget = _coreTypes.index
90-
.getTopLevelProcedure('dart:js_util_wasm', 'newObject'),
82+
_newObjectTarget =
83+
_coreTypes.index.getTopLevelProcedure('dart:js_util', 'newObject'),
9184
_allowInteropTarget = _coreTypes.index
9285
.getTopLevelProcedure('dart:js_util_wasm', 'allowInterop'),
93-
_jsValueClass =
94-
_coreTypes.index.getClass('dart:js_util_wasm', 'JSValue'),
9586
_wasmAnyRefClass = _coreTypes.index.getClass('dart:wasm', 'WasmAnyRef'),
9687
_objectClass = _coreTypes.objectClass,
9788
_pragmaClass = _coreTypes.pragmaClass,
@@ -120,6 +111,7 @@ class JsUtilWasmOptimizer extends Transformer {
120111

121112
@override
122113
StaticInvocation visitStaticInvocation(StaticInvocation node) {
114+
node = super.visitStaticInvocation(node) as StaticInvocation;
123115
if (node.target == _allowInteropTarget) {
124116
Expression argument = node.arguments.positional.single;
125117
DartType functionType = argument.getStaticType(_staticTypeContext);
@@ -208,14 +200,11 @@ class JsUtilWasmOptimizer extends Transformer {
208200
return _extensionMemberIndex!;
209201
}
210202

211-
DartType get _nullableJSValueType =>
212-
_jsValueClass.getThisType(_coreTypes, Nullability.nullable);
203+
DartType get _nullableObjectType =>
204+
_coreTypes.objectRawType(Nullability.nullable);
213205

214-
DartType get _nonNullableJSValueType =>
215-
_jsValueClass.getThisType(_coreTypes, Nullability.nonNullable);
216-
217-
Expression _dartify(Expression expression) =>
218-
StaticInvocation(_dartifyTarget, Arguments([expression]));
206+
DartType get _nonNullableObjectType =>
207+
_coreTypes.objectRawType(Nullability.nonNullable);
219208

220209
/// Creates a callback trampoline for the given [function]. This callback
221210
/// trampoline expects a Dart callback as its first argument, followed by all
@@ -298,17 +287,7 @@ class JsUtilWasmOptimizer extends Transformer {
298287
Arguments([argument, StringLiteral(callbackTrampolineName)]));
299288
}
300289

301-
Expression _jsifyVariable(Procedure node, VariableDeclaration variable) {
302-
if (variable.type is FunctionType) {
303-
return _allowInterop(
304-
node, variable.type as FunctionType, VariableGet(variable));
305-
} else {
306-
return StaticInvocation(_jsifyTarget, Arguments([VariableGet(variable)]));
307-
}
308-
}
309-
310-
StaticInvocation get _globalThis =>
311-
StaticInvocation(_globalThisTarget, Arguments([]));
290+
StaticGet get _globalThis => StaticGet(_globalThisMember);
312291

313292
/// Takes a list of [selectors] and returns an object off of
314293
/// `globalThis`. We could optimize this with a custom method built with
@@ -329,8 +308,9 @@ class JsUtilWasmOptimizer extends Transformer {
329308
Block _getExternalAnonymousConstructorBody(Procedure node) {
330309
List<Statement> body = [];
331310
final object = VariableDeclaration('|anonymousObject',
332-
initializer: StaticInvocation(_newObjectTarget, Arguments([])),
333-
type: _nonNullableJSValueType);
311+
initializer: StaticInvocation(
312+
_newObjectTarget, Arguments([], types: [node.function.returnType])),
313+
type: _nonNullableObjectType);
334314
body.add(object);
335315
for (VariableDeclaration variable in node.function.namedParameters) {
336316
body.add(ExpressionStatement(
@@ -342,21 +322,22 @@ class JsUtilWasmOptimizer extends Transformer {
342322

343323
/// Returns a new function body for the given [node] external method.
344324
///
345-
/// The new function body will call `js_util_wasm.callConstructorVarArgs`
325+
/// The new function body will call `js_util.callConstructor`
346326
/// for the given external method.
347327
ReturnStatement _getExternalCallConstructorBody(
348328
Procedure node, String constructorName) {
349329
var function = node.function;
350330
var callConstructorInvocation = StaticInvocation(
351331
_callConstructorTarget,
352332
Arguments([
353-
_globalThis,
354-
StringLiteral(constructorName),
333+
_getProperty(node, _globalThis, constructorName),
355334
ListLiteral(
356335
function.positionalParameters
357-
.map((arg) => _jsifyVariable(node, arg))
336+
.map<Expression>((value) => VariableGet(value))
358337
.toList(),
359-
typeArgument: _nonNullableJSValueType)
338+
typeArgument: _nullableObjectType)
339+
], types: [
340+
node.function.returnType
360341
]))
361342
..fileOffset = node.fileOffset;
362343
return ReturnStatement(callConstructorInvocation);
@@ -365,17 +346,19 @@ class JsUtilWasmOptimizer extends Transformer {
365346
/// Returns a new [Expression] for the given [node] external getter.
366347
///
367348
/// The new [Expression] is equivalent to:
368-
/// `js_util_wasm.getProperty([object], [getterName])`.
349+
/// `js_util.getProperty([object], [getterName])`.
369350
Expression _getProperty(
370351
Procedure node, Expression object, String getterName) =>
371352
StaticInvocation(
372-
_getPropertyTarget, Arguments([object, StringLiteral(getterName)]))
353+
_getPropertyTarget,
354+
Arguments([object, StringLiteral(getterName)],
355+
types: [node.function.returnType]))
373356
..fileOffset = node.fileOffset;
374357

375358
/// Returns a new function body for the given [node] external getter.
376359
ReturnStatement _getExternalGetterBody(
377360
Procedure node, Expression object, String getterName) =>
378-
ReturnStatement(_dartify(_getProperty(node, object, getterName)));
361+
ReturnStatement(_getProperty(node, object, getterName));
379362

380363
ReturnStatement _getExternalExtensionGetterBody(Procedure node) =>
381364
_getExternalGetterBody(
@@ -390,19 +373,19 @@ class JsUtilWasmOptimizer extends Transformer {
390373
/// Returns a new [Expression] for the given [node] external setter.
391374
///
392375
/// The new [Expression] is equivalent to:
393-
/// `js_util_wasm.setProperty([object], [setterName], [value])`.
376+
/// `js_util.setProperty([object], [setterName], [value])`.
394377
Expression _setProperty(Procedure node, Expression object, String setterName,
395378
VariableDeclaration value) =>
396379
StaticInvocation(
397380
_setPropertyTarget,
398-
Arguments(
399-
[object, StringLiteral(setterName), _jsifyVariable(node, value)]))
381+
Arguments([object, StringLiteral(setterName), VariableGet(value)],
382+
types: [node.function.returnType]))
400383
..fileOffset = node.fileOffset;
401384

402385
/// Returns a new function body for the given [node] external setter.
403386
ReturnStatement _getExternalSetterBody(Procedure node, Expression object,
404387
String setterName, VariableDeclaration value) =>
405-
ReturnStatement(_dartify(_setProperty(node, object, setterName, value)));
388+
ReturnStatement(_setProperty(node, object, setterName, value));
406389

407390
ReturnStatement _getExternalExtensionSetterBody(Procedure node) {
408391
final parameters = node.function.positionalParameters;
@@ -419,18 +402,20 @@ class JsUtilWasmOptimizer extends Transformer {
419402
/// Returns a new function body for the given [node] external method.
420403
///
421404
/// The new function body is equivalent to:
422-
/// `js_util_wasm.callMethodVarArgs([object], [methodName], [values])`.
405+
/// `js_util.callMethod([object], [methodName], [values])`.
423406
ReturnStatement _getExternalMethodBody(Procedure node, Expression object,
424407
String methodName, List<VariableDeclaration> values) {
425-
final callMethodInvocation = _dartify(StaticInvocation(
408+
final callMethodInvocation = StaticInvocation(
426409
_callMethodTarget,
427410
Arguments([
428411
object,
429412
StringLiteral(methodName),
430413
ListLiteral(
431-
values.map((value) => _jsifyVariable(node, value)).toList(),
432-
typeArgument: _nullableJSValueType)
433-
])))
414+
values.map<Expression>((value) => VariableGet(value)).toList(),
415+
typeArgument: _nullableObjectType)
416+
], types: [
417+
node.function.returnType
418+
]))
434419
..fileOffset = node.fileOffset;
435420
return ReturnStatement(callMethodInvocation);
436421
}

0 commit comments

Comments
 (0)