Build local elements in initializer expressions, so support closures.

R=brianwilkerson@google.com

Change-Id: Ic84841835ed4a24c3a58ed0ef3c3d1332e12e8f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99186
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2019-04-11 20:20:02 +00:00 committed by commit-bot@chromium.org
parent 850d56c681
commit a91381ab07
2 changed files with 4 additions and 126 deletions

View file

@ -5,9 +5,11 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/element/builder.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/resolver/scope.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/summary2/ast_resolver.dart';
import 'package:analyzer/src/summary2/lazy_ast.dart';
import 'package:analyzer/src/summary2/link.dart';
@ -148,6 +150,8 @@ class TopLevelInference {
return;
}
initializer.accept(LocalElementBuilder(ElementHolder(), null));
var astResolver = AstResolver(linker, _libraryElement, _nameScope);
astResolver.resolve(initializer);

View file

@ -219,18 +219,6 @@ T max<T extends num>(T a, T b) => null;
await super.test_class_type_parameters_bound();
}
@override
@failingTest
test_closure_generic() async {
await super.test_closure_generic();
}
@override
@failingTest
test_closure_in_variable_declaration_in_part() async {
await super.test_closure_in_variable_declaration_in_part();
}
@override
@failingTest
test_const_constructor_inferred_args() async {
@ -352,12 +340,6 @@ T max<T extends num>(T a, T b) => null;
await super.test_field_propagatedType_final_dep_inPart();
}
@override
@failingTest
test_futureOr_inferred() async {
await super.test_futureOr_inferred();
}
@override
@failingTest
test_getter_inferred_type_nonStatic_implicit_return() async {
@ -420,12 +402,6 @@ T max<T extends num>(T a, T b) => null;
await super.test_inferred_type_refers_to_bound_type_param();
}
@override
@failingTest
test_inferred_type_refers_to_function_typed_param_of_typedef() async {
await super.test_inferred_type_refers_to_function_typed_param_of_typedef();
}
@override
@failingTest
test_inferred_type_refers_to_function_typed_parameter_type_generic_class() async {
@ -447,19 +423,6 @@ T max<T extends num>(T a, T b) => null;
.test_inferred_type_refers_to_method_function_typed_parameter_type();
}
@override
@failingTest
test_inferred_type_refers_to_nested_function_typed_param() async {
await super.test_inferred_type_refers_to_nested_function_typed_param();
}
@override
@failingTest
test_inferred_type_refers_to_nested_function_typed_param_named() async {
await super
.test_inferred_type_refers_to_nested_function_typed_param_named();
}
@override
@failingTest
test_inferred_type_refers_to_setter_function_typed_parameter_type() async {
@ -479,47 +442,6 @@ T max<T extends num>(T a, T b) => null;
await super.test_inferredType_implicitCreation();
}
@override
@failingTest
test_initializer_executable_with_return_type_from_closure() async {
await super.test_initializer_executable_with_return_type_from_closure();
}
@override
@failingTest
test_initializer_executable_with_return_type_from_closure_await_dynamic() async {
await super
.test_initializer_executable_with_return_type_from_closure_await_dynamic();
}
@override
@failingTest
test_initializer_executable_with_return_type_from_closure_await_future3_int() async {
await super
.test_initializer_executable_with_return_type_from_closure_await_future3_int();
}
@override
@failingTest
test_initializer_executable_with_return_type_from_closure_await_future_int() async {
await super
.test_initializer_executable_with_return_type_from_closure_await_future_int();
}
@override
@failingTest
test_initializer_executable_with_return_type_from_closure_await_future_noArg() async {
await super
.test_initializer_executable_with_return_type_from_closure_await_future_noArg();
}
@override
@failingTest
test_initializer_executable_with_return_type_from_closure_field() async {
await super
.test_initializer_executable_with_return_type_from_closure_field();
}
@override
@failingTest
test_instantiateToBounds_boundRefersToEarlierTypeArgument() async {
@ -636,66 +558,18 @@ T max<T extends num>(T a, T b) => null;
await super.test_syntheticFunctionType_genericClosure();
}
@override
@failingTest
test_syntheticFunctionType_inGenericClass() async {
await super.test_syntheticFunctionType_inGenericClass();
}
@override
@failingTest
test_syntheticFunctionType_noArguments() async {
await super.test_syntheticFunctionType_noArguments();
}
@override
@failingTest
test_syntheticFunctionType_withArguments() async {
await super.test_syntheticFunctionType_withArguments();
}
@override
@failingTest
test_type_inference_based_on_loadLibrary() async {
await super.test_type_inference_based_on_loadLibrary();
}
@override
@failingTest
test_type_inference_closure_with_function_typed_parameter() async {
await super.test_type_inference_closure_with_function_typed_parameter();
}
@override
@failingTest
test_type_inference_closure_with_function_typed_parameter_new() async {
await super.test_type_inference_closure_with_function_typed_parameter_new();
}
@override
@failingTest
test_type_inference_depends_on_exported_variable() async {
await super.test_type_inference_depends_on_exported_variable();
}
@override
@failingTest
test_type_inference_nested_function() async {
await super.test_type_inference_nested_function();
}
@override
@failingTest
test_type_inference_nested_function_with_parameter_types() async {
await super.test_type_inference_nested_function_with_parameter_types();
}
@override
@failingTest
test_type_inference_of_closure_with_default_value() async {
await super.test_type_inference_of_closure_with_default_value();
}
@override
@failingTest
test_typedef_generic() async {