Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: tests/compiler/dart2js/kernel/impact_test.dart

Issue 2468273003: Fix kernel/visitor_test (Closed)
Patch Set: Fix impact_test after changes. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/kernel/impact_test.dart
diff --git a/tests/compiler/dart2js/kernel/impact_test.dart b/tests/compiler/dart2js/kernel/impact_test.dart
index 60a95b9147afe7caf127a759ef6d34a42bd45e77..4d176adfd4f9388737e5009b1a981519bb533f89 100644
--- a/tests/compiler/dart2js/kernel/impact_test.dart
+++ b/tests/compiler/dart2js/kernel/impact_test.dart
@@ -4,16 +4,17 @@
library dart2js.kernel.impact_test;
-import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/common/names.dart';
import 'package:compiler/src/common/resolution.dart';
import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/constants/expressions.dart';
import 'package:compiler/src/dart_types.dart';
import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/resolution/registry.dart';
+import 'package:compiler/src/resolution/tree_elements.dart';
import 'package:compiler/src/ssa/kernel_impact.dart';
import 'package:compiler/src/serialization/equivalence.dart';
import 'package:compiler/src/universe/call_structure.dart';
@@ -151,6 +152,7 @@ main() {
testDefaultValuesNamed();
testFieldInitializer1();
testFieldInitializer2();
+ testFieldInitializer3();
testInstanceFieldWithInitializer();
testInstanceFieldTyped();
testThisInitializer();
@@ -478,6 +480,15 @@ class ClassFieldInitializer2 {
ClassFieldInitializer2(value) : field = value;
}
testFieldInitializer2() => new ClassFieldInitializer2(42);
+class ClassFieldInitializer3 {
+ var field;
+ ClassFieldInitializer3.a();
+ ClassFieldInitializer3.b(value) : field = value;
+}
+testFieldInitializer3() {
+ new ClassFieldInitializer3.a();
+ new ClassFieldInitializer3.b(42);
+}
class ClassInstanceFieldWithInitializer {
var field = false;
}
@@ -671,6 +682,38 @@ ResolutionImpact laxImpact(
impact.mapLiterals.forEach(builder.registerMapLiteral);
for (Feature feature in impact.features) {
switch (feature) {
+ case Feature.FIELD_WITHOUT_INITIALIZER:
+ if (element.isInstanceMember) {
+ bool missing = false;
+ OUTER:
+ for (ConstructorElement constructor
+ in element.enclosingClass.constructors) {
+ if (constructor.isGenerativeConstructor &&
+ !constructor.isRedirectingGenerative) {
+ for (ParameterElement parameter in constructor.parameters) {
+ if (parameter is InitializingFormalElement &&
+ parameter.fieldElement == element) {
+ continue OUTER;
+ }
+ }
+ if (constructor.resolvedAst.kind == ResolvedAstKind.PARSED) {
+ var function = constructor.resolvedAst.node;
+ if (function.initializers != null) {
+ TreeElements elements = constructor.resolvedAst.elements;
+ for (var initializer in function.initializers) {
+ if (elements[initializer] == element) {
+ continue OUTER;
+ }
+ }
+ }
+ }
+ missing = true;
+ }
+ }
+ if (!missing) continue;
+ }
+ builder.registerConstantLiteral(new NullConstantExpression());
+ break;
case Feature.STRING_INTERPOLATION:
case Feature.STRING_JUXTAPOSITION:
// These are both converted into a string concatenation in kernel so
« no previous file with comments | « tests/compiler/dart2js/kernel/class_hierarchy_test.dart ('k') | tests/compiler/dart2js/kernel/visitor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698