Skip to content

Commit 77e83fc

Browse files
author
Dart CI
committed
Version 2.19.0-317.0.dev
Merge 770c9d7 into dev
2 parents b10d23a + 770c9d7 commit 77e83fc

33 files changed

+437
-140
lines changed

DEPS

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ vars = {
122122
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
123123
"dart_style_rev": "f79a9828ad07e50d6e8352ac154cc16eb4d78d5c", # manually rev'd
124124

125-
"dartdoc_rev": "c8bc0655bbd4949cb49ca24ee9ff493439b7594c",
125+
"dartdoc_rev": "5b3feb67f7db7dfb52f177744715fa058f9af6ad",
126126
"devtools_rev": "b21cd59f1f6bb60cacd59ba39e376d2a50d82f74",
127127
"ffi_rev": "fb5f2667826c0900e551d19101052f84e35f41bf",
128128
"file_rev": "b2e31cb6ef40b223701dbfa0b907fe58468484d7",

pkg/dart2wasm/bin/dart2wasm.dart

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'dart:typed_data';
88
import 'package:args/args.dart' as args;
99
import 'package:front_end/src/api_unstable/vm.dart'
1010
show printDiagnosticMessage, resolveInputUri;
11+
import 'package:front_end/src/api_unstable/vm.dart' as fe;
1112

1213
import 'package:dart2wasm/compile.dart';
1314
import 'package:dart2wasm/compiler_options.dart';
@@ -51,9 +52,17 @@ final List<Option> options = [
5152
"watch", (o, values) => o.translatorOptions.watchPoints = values),
5253
StringMultiOption(
5354
"define", (o, values) => o.environment = processEnvironment(values),
54-
abbr: "D")
55+
abbr: "D"),
56+
StringMultiOption("enable-experiment",
57+
(o, values) => o.feExperimentalFlags = processFeExperimentalFlags(values))
5558
];
5659

60+
Map<fe.ExperimentalFlag, bool> processFeExperimentalFlags(
61+
List<String> experiments) =>
62+
fe.parseExperimentalFlags(fe.parseExperimentalArguments(experiments),
63+
onError: (error) => throw ArgumentError(error),
64+
onWarning: (warning) => print(warning));
65+
5766
Map<String, String> processEnvironment(List<String> defines) =>
5867
Map<String, String>.fromEntries(defines.map((d) {
5968
List<String> keyAndValue = d.split('=');

pkg/dart2wasm/lib/class_info.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FieldIndex {
2929
static const vtableInstantiationFunction = 0;
3030
static const instantiationContextInner = 0;
3131
static const instantiationContextTypeArgumentsBase = 1;
32-
static const typeIsNullable = 2;
32+
static const typeIsDeclaredNullable = 2;
3333
static const interfaceTypeTypeArguments = 4;
3434
static const functionTypeNamedParameters = 6;
3535
static const typedListBaseLength = 2;
@@ -57,7 +57,8 @@ class FieldIndex {
5757
check(translator.hashFieldBaseClass, "_index", FieldIndex.hashBaseIndex);
5858
check(translator.hashFieldBaseClass, "_data", FieldIndex.hashBaseData);
5959
check(translator.functionClass, "context", FieldIndex.closureContext);
60-
check(translator.typeClass, "isNullable", FieldIndex.typeIsNullable);
60+
check(translator.typeClass, "isDeclaredNullable",
61+
FieldIndex.typeIsDeclaredNullable);
6162
check(translator.interfaceTypeClass, "typeArguments",
6263
FieldIndex.interfaceTypeTypeArguments);
6364
check(translator.functionTypeClass, "namedParameters",

pkg/dart2wasm/lib/compile.dart

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Future<Uint8List?> compileToModule(compiler.CompilerOptions options,
4848
..librariesSpecificationUri = options.librariesSpecPath
4949
..packagesFileUri = options.packagesPath
5050
..environmentDefines = options.environment
51+
..explicitExperimentalFlags = options.feExperimentalFlags
5152
..verbose = false
5253
..onDiagnostic = diagnosticMessageHandler
5354
..nnbdMode = NnbdMode.Strong;

pkg/dart2wasm/lib/compiler_options.dart

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'dart:io';
66

77
import 'package:dart2wasm/translator.dart';
8+
import 'package:front_end/src/api_unstable/vm.dart' as fe;
89

910
class CompilerOptions {
1011
final TranslatorOptions translatorOptions = TranslatorOptions();
@@ -16,6 +17,7 @@ class CompilerOptions {
1617
Uri mainUri;
1718
String outputFile;
1819
Map<String, String> environment = const {};
20+
Map<fe.ExperimentalFlag, bool> feExperimentalFlags = const {};
1921

2022
factory CompilerOptions.defaultOptions() =>
2123
CompilerOptions(mainUri: Uri(), outputFile: '');

pkg/dart2wasm/lib/constants.dart

+6-12
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ class ConstantCreator extends ConstantVisitor<ConstantInfo?> {
729729

730730
b.i32_const(info.classId);
731731
b.i32_const(initialIdentityHash);
732-
types.encodeNullability(b, type);
732+
b.i32_const(types.encodedNullability(type));
733733
b.i64_const(typeInfo.classId);
734734
constants.instantiateConstant(
735735
function, b, typeArgs, typeListExpectedType);
@@ -744,7 +744,7 @@ class ConstantCreator extends ConstantVisitor<ConstantInfo?> {
744744
return createConstant(constant, info.nonNullableType, (function, b) {
745745
b.i32_const(info.classId);
746746
b.i32_const(initialIdentityHash);
747-
types.encodeNullability(b, type);
747+
b.i32_const(types.encodedNullability(type));
748748
constants.instantiateConstant(
749749
function, b, typeArgument, types.nonNullableTypeType);
750750
b.struct_new(info.struct);
@@ -768,7 +768,7 @@ class ConstantCreator extends ConstantVisitor<ConstantInfo?> {
768768
return createConstant(constant, info.nonNullableType, (function, b) {
769769
b.i32_const(info.classId);
770770
b.i32_const(initialIdentityHash);
771-
types.encodeNullability(b, type);
771+
b.i32_const(types.encodedNullability(type));
772772
constants.instantiateConstant(
773773
function, b, returnTypeConstant, types.nonNullableTypeType);
774774
constants.instantiateConstant(function, b, positionalParametersConstant,
@@ -798,7 +798,7 @@ class ConstantCreator extends ConstantVisitor<ConstantInfo?> {
798798
return createConstant(constant, info.nonNullableType, (function, b) {
799799
b.i32_const(info.classId);
800800
b.i32_const(initialIdentityHash);
801-
types.encodeNullability(b, type);
801+
b.i32_const(types.encodedNullability(type));
802802
b.struct_new(info.struct);
803803
});
804804
} else {
@@ -812,13 +812,7 @@ class ConstantCreator extends ConstantVisitor<ConstantInfo?> {
812812
return createConstant(constant, info.nonNullableType, (function, b) {
813813
b.i32_const(info.classId);
814814
b.i32_const(initialIdentityHash);
815-
816-
// A type parameter's type nullability is undetermined when it's
817-
// syntactically not declared nullable and the bound of the type
818-
// parameter is nullable. Because we are encoding the declared
819-
// nullability, we only declare a type parameter to be nullable if it is
820-
// explicitly declared to be nullabe.
821-
b.i32_const(type.declaredNullability == Nullability.nullable ? 1 : 0);
815+
b.i32_const(types.encodedNullability(type));
822816
b.i64_const(environmentIndex);
823817
b.struct_new(info.struct);
824818
});
@@ -830,7 +824,7 @@ class ConstantCreator extends ConstantVisitor<ConstantInfo?> {
830824
return createConstant(constant, info.nonNullableType, (function, b) {
831825
b.i32_const(info.classId);
832826
b.i32_const(initialIdentityHash);
833-
types.encodeNullability(b, type);
827+
b.i32_const(types.encodedNullability(type));
834828
b.struct_new(info.struct);
835829
});
836830
}

pkg/dart2wasm/lib/types.dart

+8-32
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ class Types {
308308
CodeGenerator codeGen, ClassInfo info, InterfaceType type) {
309309
w.Instructions b = codeGen.b;
310310
ClassInfo typeInfo = translator.classInfo[type.classNode]!;
311-
encodeNullability(b, type);
311+
b.i32_const(encodedNullability(type));
312312
b.i64_const(typeInfo.classId);
313313
_makeTypeList(codeGen, type.typeArguments);
314314
}
@@ -366,29 +366,14 @@ class Types {
366366

367367
void _makeFutureOrType(CodeGenerator codeGen, FutureOrType type) {
368368
w.Instructions b = codeGen.b;
369-
w.DefinedFunction function = codeGen.function;
370-
371-
// We canonicalize `FutureOr<T?>` to `FutureOr<T?>?`. However, we have to
372-
// take special care to handle the case where we have
373-
// undetermined nullability. To handle this, we emit the type argument, and
374-
// read back its nullability at runtime.
375-
if (type.nullability == Nullability.undetermined) {
376-
w.ValueType typeArgumentType = makeType(codeGen, type.typeArgument);
377-
w.Local typeArgumentTemporary = codeGen.addLocal(typeArgumentType);
378-
b.local_tee(typeArgumentTemporary);
379-
b.struct_get(typeClassInfo.struct, FieldIndex.typeIsNullable);
380-
b.local_get(typeArgumentTemporary);
381-
translator.convertType(function, typeArgumentType, nonNullableTypeType);
382-
} else {
383-
encodeNullability(b, type);
384-
makeType(codeGen, type.typeArgument);
385-
}
369+
b.i32_const(encodedNullability(type));
370+
makeType(codeGen, type.typeArgument);
386371
}
387372

388373
void _makeFunctionType(
389374
CodeGenerator codeGen, ClassInfo info, FunctionType type) {
390375
w.Instructions b = codeGen.b;
391-
encodeNullability(b, type);
376+
b.i32_const(encodedNullability(type));
392377
makeType(codeGen, type.returnType);
393378
if (type.positionalParameters.every(_isTypeConstant)) {
394379
translator.constants.instantiateConstant(
@@ -469,7 +454,7 @@ class Types {
469454
// TODO(joshualitt): Implement generic function types and share most of
470455
// the logic with _makeFunctionType.
471456
print("Not implemented: RTI ${type}");
472-
encodeNullability(b, type);
457+
b.i32_const(encodedNullability(type));
473458
} else {
474459
_makeFunctionType(codeGen, info, type);
475460
}
@@ -515,7 +500,7 @@ class Types {
515500
if (isPotentiallyNullable) {
516501
b.br(resultLabel!);
517502
b.end(); // nullLabel
518-
encodeNullability(b, type);
503+
b.i32_const(encodedNullability(type));
519504
b.end(); // resultLabel
520505
}
521506
}
@@ -570,15 +555,6 @@ class Types {
570555
_endPotentiallyNullableBlock();
571556
}
572557

573-
/// Returns true if a given type is nullable, and false otherwise. This
574-
/// function should not be used on [DartType]s with undetermined nullability.
575-
bool isNullable(DartType type) {
576-
Nullability nullability = type.nullability;
577-
assert(nullability == Nullability.nullable ||
578-
nullability == Nullability.nonNullable);
579-
return nullability == Nullability.nullable ? true : false;
580-
}
581-
582-
void encodeNullability(w.Instructions b, DartType type) =>
583-
b.i32_const(isNullable(type) ? 1 : 0);
558+
int encodedNullability(DartType type) =>
559+
type.declaredNullability == Nullability.nullable ? 1 : 0;
584560
}

pkg/dds/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 2.5.0-dev
2+
- [DAP] `variables` requests now treat lists from `dart:typed_data` (such as `Uint8List`) like standard `List` instances and return their elements instead of class fields.
3+
- [DAP] `variables` requests now return information about the number of items in lists to allow the client to page through them.
4+
15
# 2.4.0
26
- [DAP] Added support for sending progress notifications via `DartDebugAdapter.startProgressNotification`.
37
Standard progress events are sent when a clients sets `supportsProgressReporting: true` in its capabilities,

pkg/dds/lib/src/dap/adapters/dart.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -1619,8 +1619,12 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
16191619
]);
16201620
}
16211621
} else if (vmData is vm.ObjRef) {
1622-
final object =
1623-
await _isolateManager.getObject(storedData.thread.isolate, vmData);
1622+
final object = await _isolateManager.getObject(
1623+
storedData.thread.isolate,
1624+
vmData,
1625+
offset: childStart,
1626+
count: childCount,
1627+
);
16241628

16251629
if (object is vm.Sentinel) {
16261630
variables.add(Variable(

pkg/dds/lib/src/dap/isolate_manager.dart

+11-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,17 @@ class IsolateManager {
140140
}
141141

142142
Future<T> getObject<T extends vm.Response>(
143-
vm.IsolateRef isolate, vm.ObjRef object) async {
144-
final res = await _adapter.vmService?.getObject(isolate.id!, object.id!);
143+
vm.IsolateRef isolate,
144+
vm.ObjRef object, {
145+
int? offset,
146+
int? count,
147+
}) async {
148+
final res = await _adapter.vmService?.getObject(
149+
isolate.id!,
150+
object.id!,
151+
offset: offset,
152+
count: count,
153+
);
145154
return res as T;
146155
}
147156

0 commit comments

Comments
 (0)