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

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

Issue 2396173003: Handle constructor declarations. (Closed)
Patch Set: Created 4 years, 2 months 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_impact.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c0f0658e869074c60fbf15c937142d2b3aaf5287..3bf1017b98bb929c4dcdb0e8a528cc309fbf9108 100644
--- a/tests/compiler/dart2js/kernel/impact_test.dart
+++ b/tests/compiler/dart2js/kernel/impact_test.dart
@@ -73,6 +73,8 @@ main() {
testAsGenericRaw(null);
testAsGenericDynamic(null);
testThrow();
+ testIfNull(null);
+ testSetIfNull(null);
testSyncStar();
testAsync();
testAsyncStar();
@@ -137,6 +139,10 @@ main() {
testConstRedirectingFactoryInvokeGeneric();
testConstRedirectingFactoryInvokeGenericRaw();
testConstRedirectingFactoryInvokeGenericDynamic();
+ testImplicitConstructor();
+ testFactoryConstructor();
+ testDefaultValuesPositional();
+ testDefaultValuesNamed();
}
testEmpty() {}
@@ -187,6 +193,8 @@ testAsGeneric(o) => o as GenericClass<int, String>;
testAsGenericRaw(o) => o as GenericClass;
testAsGenericDynamic(o) => o as GenericClass<dynamic, dynamic>;
testThrow() => throw '';
+testIfNull(o) => o ?? 42;
+testSetIfNull(o) => o ??= 42;
testSyncStar() sync* {}
testAsync() async {}
@@ -417,6 +425,14 @@ testConstRedirectingFactoryInvokeGenericRaw() {
testConstRedirectingFactoryInvokeGenericDynamic() {
const GenericClass<dynamic, dynamic>.redirect();
}
+class ClassImplicitConstructor {}
+testImplicitConstructor() => new ClassImplicitConstructor();
+class ClassFactoryConstructor {
+ factory ClassFactoryConstructor() => null;
+}
+testFactoryConstructor() => new ClassFactoryConstructor();
+testDefaultValuesPositional([bool value = false]) {}
+testDefaultValuesNamed({bool value: false}) {}
''',
'helper.dart': '''
class Class {
@@ -455,7 +471,10 @@ main(List<String> args) {
void checkLibrary(Compiler compiler, LibraryElement library) {
library.forEachLocalMember((AstElement element) {
if (element.isClass) {
- // TODO(johnniwinther): Handle class members.
+ ClassElement cls = element;
+ cls.forEachLocalMember((AstElement member) {
+ checkElement(compiler, member);
+ });
} else if (element.isTypedef) {
// Skip typedefs.
} else {
@@ -486,8 +505,8 @@ ResolutionImpact laxImpact(
ConstructorElement effectiveTarget = constructor.effectiveTarget;
DartType effectiveTargetType =
constructor.computeEffectiveTargetType(staticUse.type);
- builder.registerStaticUse(
- new StaticUse.typedConstructorInvoke(effectiveTarget, null, effectiveTargetType));
+ builder.registerStaticUse(new StaticUse.typedConstructorInvoke(
+ effectiveTarget, null, effectiveTargetType));
break;
default:
builder.registerStaticUse(staticUse);
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_impact.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698