[ddc] Emitting nullability wrappers for records

Change-Id: I032e5cf915a70b44559a8269e22ab2dbedb9726a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272740
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
This commit is contained in:
Mark Zhou 2022-12-01 18:04:18 +00:00 committed by Commit Queue
parent 99026df0f8
commit 4a5eff63d7

View file

@ -1004,7 +1004,10 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
} else if (t is RecordType) {
var positional = t.positional.map(emitDeferredType);
var named = t.named.map((n) => emitDeferredType(n.type));
return _emitRecordType(t, positional, named);
var typeRep = _emitRecordType(t, positional, named);
return emitNullability
? _emitNullabilityWrapper(typeRep, t.nullability)
: typeRep;
} else if (t is TypeParameterType) {
return _emitTypeParameterType(t, emitNullability: emitNullability);
}
@ -3390,7 +3393,8 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
js_ast.Expression visitRecordType(type) {
var positionalTypeReps = type.positional.map((p) => p.accept(this));
var namedTypeReps = type.named.map((n) => n.type.accept(this));
return _emitRecordType(type, positionalTypeReps, namedTypeReps);
var typeRep = _emitRecordType(type, positionalTypeReps, namedTypeReps);
return _emitNullabilityWrapper(typeRep, type.nullability);
}
js_ast.Expression _emitRecordType(