Skip to content

Commit 84d3f36

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
[dart2js] pass null for missing required argument in weak mode
Now passing: language/nnbd/required_named_parameters/required_named_args_legacy_test language/nnbd/required_named_parameters/required_named_args_weak_test Change-Id: Ide909eb6eb996ca48c851b45f1069f6562b52d5e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151096 Reviewed-by: Sigmund Cherem <[email protected]> Commit-Queue: Stephen Adams <[email protected]>
1 parent 213f805 commit 84d3f36

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/compiler/lib/src/js_model/env.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,13 +648,17 @@ abstract class FunctionDataForEachParameterMixin implements FunctionData {
648648
String name = parameter.name;
649649
ConstantValue defaultValue;
650650
if (parameter.isRequired) {
651-
defaultValue = elementMap.getRequiredSentinelConstantValue();
651+
if (elementMap.types.useLegacySubtyping) {
652+
defaultValue = NullConstantValue();
653+
} else {
654+
defaultValue = elementMap.getRequiredSentinelConstantValue();
655+
}
652656
} else if (isOptional) {
653657
if (parameter.initializer != null) {
654658
defaultValue =
655659
elementMap.getConstantValue(memberContext, parameter.initializer);
656660
} else {
657-
defaultValue = new NullConstantValue();
661+
defaultValue = NullConstantValue();
658662
}
659663
}
660664
f(type, name, defaultValue);

0 commit comments

Comments
 (0)