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

Unified Diff: tests/compiler/dart2js_extra/ir_representation_test.dart

Issue 108333007: tests for inlining between IR and AST functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: \moved tests to dart2js_extra, library for test annotations Created 7 years 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_extra/ir_representation_test.dart
diff --git a/tests/compiler/dart2js_extra/ir_representation_test.dart b/tests/compiler/dart2js_extra/ir_representation_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f6041fd5e0558dc5f437c19f2948c0583961f936
--- /dev/null
+++ b/tests/compiler/dart2js_extra/ir_representation_test.dart
@@ -0,0 +1,60 @@
+// Copyright (c) 2013, 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 '../dart2js_native/compiler_test_internals.dart';
+
+/**
+ * This test verifies that the @IrRepresentation annotation works as expected.
+ * It might fail when extending the IR to express more of Dart.
+ */
+
+// closure
+@IrRepresentation(true)
+test1() {
+ var f = () => 42;
+ return 1;
+}
+
+// parameter
+@IrRepresentation(true)
+test2(x) {
+ return x;
+}
+
+// dynamic invocation, construction
+@IrRepresentation(true)
+test3() {
+ new Object().hashCode;
+}
+
+// exceptions
+@IrRepresentation(true)
+test4() {
+ try {
+ throw "possum";
+ } catch (e) {
+ return e;
+ }
+}
+
+// control flow, loops
+@IrRepresentation(true)
+test5(x) {
+ while (x < 100) {
+ x += x;
+ }
+ if (x % 2 == 0) {
+ return 1;
+ } else {
+ return 2;
+ }
+}
+
+main() {
+ print(test1());
+ print(test2(1));
+ print(test3());
+ print(test4());
+ print(test5(2));
+}

Powered by Google App Engine
This is Rietveld 408576698