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

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

Issue 2498493003: kernel->ssa: get simple constructors working (Closed)
Patch Set: respond to comments 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
« no previous file with comments | « pkg/compiler/lib/src/tree/nodes.dart ('k') | tests/compiler/dart2js/kernel/helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/kernel/constructors_test.dart
diff --git a/tests/compiler/dart2js/kernel/constructors_test.dart b/tests/compiler/dart2js/kernel/constructors_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..1d30c1c548c02003058b1b7c0320a8f1bfccbff6
--- /dev/null
+++ b/tests/compiler/dart2js/kernel/constructors_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2016, 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.
+
+import 'package:compiler/src/compiler.dart' show Compiler;
+import 'package:compiler/src/elements/elements.dart';
+import 'package:test/test.dart';
+
+import 'helper.dart' show check;
+
+main() {
+ test('simple default constructor', () {
+ String code = '''
+class A {
+}
+
+main() {
+ var a = new A();
+ return a;
+}''';
+ return check(code, lookup: defaultConstructorFor('A'));
+ });
+
+ test('simple default constructor with field', () {
+ String code = '''
+class A {
+ int x = 1;
+}
+
+main() {
+ var a = new A();
+ return a;
+}''';
+ return check(code, lookup: defaultConstructorFor('A'));
+ });
+}
+
+defaultConstructorFor(String className) => (Compiler compiler) {
+ ClassElement clazz = compiler.mainApp.find(className);
+ return clazz.lookupDefaultConstructor();
+ };
« no previous file with comments | « pkg/compiler/lib/src/tree/nodes.dart ('k') | tests/compiler/dart2js/kernel/helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698