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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import '../dart2js_native/compiler_test_internals.dart';
6
7 /**
8 * This test verifies that the @IrRepresentation annotation works as expected.
9 * It might fail when extending the IR to express more of Dart.
10 */
11
12 // closure
13 @IrRepresentation(true)
14 test1() {
15 var f = () => 42;
16 return 1;
17 }
18
19 // parameter
20 @IrRepresentation(true)
21 test2(x) {
22 return x;
23 }
24
25 // dynamic invocation, construction
26 @IrRepresentation(true)
27 test3() {
28 new Object().hashCode;
29 }
30
31 // exceptions
32 @IrRepresentation(true)
33 test4() {
34 try {
35 throw "possum";
36 } catch (e) {
37 return e;
38 }
39 }
40
41 // control flow, loops
42 @IrRepresentation(true)
43 test5(x) {
44 while (x < 100) {
45 x += x;
46 }
47 if (x % 2 == 0) {
48 return 1;
49 } else {
50 return 2;
51 }
52 }
53
54 main() {
55 print(test1());
56 print(test2(1));
57 print(test3());
58 print(test4());
59 print(test5(2));
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698