e14472c46b
This uses the information from the static types now used in inference which can improve the precision in particular for generic classes. Since type masks lose the type argument information, we cannot expect locating members based on the type mask to be more precise than what has been found through the static types. This CL also expands the unit test framework to support unit test of optimizations and the emission model, including tests of the improved field access handling. Closes #35433 Change-Id: Ia5de15efaf8b60c8723943bb34de6eec7d380798 Reviewed-on: https://dart-review.googlesource.com/c/88440 Reviewed-by: Stephen Adams <sra@google.com>
68 lines
1.3 KiB
Dart
68 lines
1.3 KiB
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
main() {
|
|
method1(new Class1a());
|
|
method2(new Class2a<int>());
|
|
method3(new Class3a());
|
|
method3(new Class3b());
|
|
method4(new Class4a());
|
|
method4(new Class4b());
|
|
}
|
|
|
|
class Class1a {
|
|
/*element: Class1a.field1:*/
|
|
int field1;
|
|
}
|
|
|
|
@pragma('dart2js:noInline')
|
|
method1(dynamic c) {
|
|
c.field1 = 42;
|
|
}
|
|
|
|
class Class2a<T> {
|
|
/*strong.element: Class2a.field2:checked*/
|
|
/*omit.element: Class2a.field2:*/
|
|
T field2;
|
|
}
|
|
|
|
@pragma('dart2js:noInline')
|
|
method2(dynamic c) {
|
|
c.field2 = 42;
|
|
}
|
|
|
|
class Class3a {
|
|
/*strong.element: Class3a.field3:checked*/
|
|
/*omit.element: Class3a.field3:set=simple*/
|
|
int field3;
|
|
}
|
|
|
|
class Class3b {
|
|
/*strong.element: Class3b.field3:checked*/
|
|
/*omit.element: Class3b.field3:set=simple*/
|
|
int field3;
|
|
}
|
|
|
|
@pragma('dart2js:noInline')
|
|
method3(dynamic c) {
|
|
c.field3 = 42;
|
|
}
|
|
|
|
class Class4a {
|
|
/*strong.element: Class4a.field4:checked*/
|
|
/*omit.element: Class4a.field4:set=simple*/
|
|
int field4;
|
|
}
|
|
|
|
class Class4b implements Class4a {
|
|
/*strong.element: Class4b.field4:checked*/
|
|
/*omit.element: Class4b.field4:set=simple*/
|
|
int field4;
|
|
}
|
|
|
|
@pragma('dart2js:noInline')
|
|
method4(Class4a c) {
|
|
c.field4 = 42;
|
|
}
|