Fix computation of default values for named parameters.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2957583003 .
This commit is contained in:
Johnni Winther 2017-06-26 11:37:14 +02:00
parent 2e6521678a
commit 1298af3bd3
6 changed files with 8 additions and 37 deletions

View file

@ -2264,7 +2264,7 @@ class KernelSsaGraphBuilder extends ir.Visitor
}
/// Build argument list in canonical order for a static [target], including
/// filling in the defaulted argument value.
/// filling in the default argument value.
List<HInstruction> _visitArgumentsForStaticTarget(
ir.FunctionNode target, ir.Arguments arguments) {
// Visit arguments in source order, then re-order and fill in defaults.
@ -2276,7 +2276,7 @@ class KernelSsaGraphBuilder extends ir.Visitor
values.add(_defaultValueForParameter(parameter));
}
if (arguments.named.isNotEmpty) {
if (target.namedParameters.isNotEmpty) {
var namedValues = <String, HInstruction>{};
for (ir.NamedExpression argument in arguments.named) {
argument.value.accept(this);
@ -2301,6 +2301,8 @@ class KernelSsaGraphBuilder extends ir.Visitor
}
}
assert(namedValues.isEmpty);
} else {
assert(arguments.named.isEmpty);
}
return values;

View file

@ -849,7 +849,7 @@ void checkEmitterLibraries(Library library1, Library library2) {
checkLists(library1.classes, library2.classes, 'classes',
(a, b) => a.element.name == b.element.name,
onSameElement: checkEmitterClasses);
// TODO(johnniwinther): Check static method properties.
// TODO(johnniwinther): Check static method properties.
checkLists(library1.statics, library2.statics, 'statics',
(a, b) => a.name.key == b.name.key);
}

View file

@ -32,7 +32,7 @@ import 'compiler_helper.dart';
const SOURCE = const {
'main.dart': '''
foo() => 1;
foo({named}) => 1;
bar(a) => !a;
class Class {
var field;

View file

@ -152,7 +152,6 @@ mirrors_used_closure_test: Crash # Issue 27394
mirrors_used_metatargets_test: Crash # Issue 27394
mirrors_used_native_test: Crash # Issue 27394
reflect_native_types_test: Crash # Issue 27394
type_argument_factory_nocrash_test: RuntimeError # Issue 27394
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
js_dispatch_property_test: Crash # Issue 27394

View file

@ -224,38 +224,18 @@ big_integer_huge_mul_vm_test: Pass, Slow # Slow
[ $compiler == dart2js && $dart2js_with_kernel ]
error_stack_trace1_test: Pass # Issue 27394
symbol_reserved_word_test/03: Pass # Issue 27394
data_uri_test: RuntimeError # Issue 27394
date_time7_test: RuntimeError # Issue 27394
date_time_test: RuntimeError # Issue 27394
growable_list_test: RuntimeError # Issue 27394
iterable_empty_test: RuntimeError # Issue 27394
iterable_return_type_test/none: RuntimeError # Issue 27394
iterable_to_list_test/none: RuntimeError # Issue 27394
iterable_to_set_test: RuntimeError # Issue 27394
linked_hash_map_from_iterable_test: RuntimeError # Issue 27394
linked_hash_map_from_iterables_test: RuntimeError # Issue 27394
list_filled_type_argument_test: RuntimeError # Issue 27394
map_from_iterable_test: RuntimeError # Issue 27394
map_from_iterables_test: RuntimeError # Issue 27394
map_test: Crash # Issue 27394
reg_exp1_test: RuntimeError # Issue 27394
regexp/compile_test: RuntimeError # Issue 27394
regexp/default_arguments_test: RuntimeError # Issue 27394
regexp/multiline_test: RuntimeError # Issue 27394
regexp/parentheses_test: RuntimeError # Issue 27394
regexp/pcre-test-4_test: RuntimeError # Issue 27394
regexp/pcre_test: RuntimeError # Issue 27394
set_test: RuntimeError # Issue 27394
symbol_operator_test/03: RuntimeError # Issue 27394
symbol_reserved_word_test/06: RuntimeError # Issue 27394
symbol_reserved_word_test/09: RuntimeError # Issue 27394
symbol_reserved_word_test/12: RuntimeError # Issue 27394
symbol_test/none: RuntimeError # Issue 27394
uri_example_test: RuntimeError # Issue 27394
uri_http_test: RuntimeError # Issue 27394
uri_parameters_all_test: RuntimeError # Issue 27394
uri_query_test: RuntimeError # Issue 27394
uri_test: RuntimeError # Issue 27394
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
regress/4562_test/01: Crash # Issue 27394

View file

@ -444,16 +444,13 @@ mixin_type_variable_test/07: Crash # Issue 27394
mixin_type_variable_test/08: Crash # Issue 27394
mixin_typedef_constructor_test: Crash # Issue 27394
named_parameters_aggregated_test/05: RuntimeError # Issue 27394
named_parameters_default_eq_test/none: RuntimeError # Issue 27394
named_parameters_passing_falsy_test: RuntimeError # Issue 27394
named_parameters_passing_null_test: RuntimeError # Issue 27394
named_parameters_passing_zero_test: RuntimeError # Issue 27394
named_parameters_test/01: MissingRuntimeError # Issue 27394
null_is_bottom_test/14: RuntimeError # Issue 27394
null_is_bottom_test/16: RuntimeError # Issue 27394
null_test/none: Crash # Issue 27394
nullaware_opt_test: RuntimeError # Issue 27394
optional_named_parameters_test/none: RuntimeError # Issue 27394
optional_named_parameters_test/01: MissingRuntimeError # Issue 27394
optional_named_parameters_test/03: MissingRuntimeError # Issue 27394
private_mixin2_test: Crash # Issue 27394
redirecting_constructor_initializer_test: RuntimeError # Issue 27394
redirecting_factory_reflection_test: Crash # Issue 27394
@ -493,13 +490,6 @@ this_conditional_operator_test/01: Crash # Issue 27394
try_catch_syntax_test/13: Crash # Issue 27394
try_catch_syntax_test/14: Crash # Issue 27394
try_catch_syntax_test/15: Crash # Issue 27394
type_parameter_test/01: RuntimeError # Issue 27394
type_parameter_test/02: RuntimeError # Issue 27394
type_parameter_test/03: RuntimeError # Issue 27394
type_parameter_test/04: RuntimeError # Issue 27394
type_parameter_test/05: RuntimeError # Issue 27394
type_parameter_test/06: RuntimeError # Issue 27394
type_parameter_test/none: RuntimeError # Issue 27394
type_variable_field_initializer_closure_test: RuntimeError # Issue 27394
type_variable_field_initializer_test: RuntimeError # Issue 27394
type_variable_nested_test: RuntimeError # Issue 27394