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

Side by Side Diff: tests/standalone/javascript_compatibility_warnings_test.dart

Issue 260713008: Add support for javascript incompatibility warnings. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 // VMOptions=--warn_on_javascript_incompatibility --no_warning_as_error --optimi zation_counter_threshold=5
6
7 import "package:expect/expect.dart";
8
9 f(x, y) {
10 // Unoptimized code.
11 1 is double; /// 00: ok
12 if (1 is double) { x++; } /// 01: ok
13 try { 1 as double; } on CastError catch (e) { } /// 02: ok
14 try { var y = 1 as double; } on CastError catch (e) { } /// 03: ok
15 1.0 is int; /// 04: ok
16 if (1.0 is int) { x++; } /// 05: ok
17 try { 1.0 as int; } on CastError catch (e) { } /// 06: ok
18 try { var z = 1.0 as int; } on CastError catch (e) { } /// 07: ok
19
20 x is double; /// 10: ok
21 if (x is double) { } /// 11: ok
22 try { x as double; } on CastError catch (e) { } /// 12: ok
23 try { var z = x as double; } on CastError catch (e) { } /// 13: ok
24 y is int; /// 14: ok
25 if (y is int) { } /// 15: ok
26 try { y as int; } on CastError catch (e) { } /// 16: ok
27 try { var z = y as int; } on CastError catch (e) { } /// 17: ok
28
29 "${1.0}"; /// 20: ok
30 var z = "${1.0}"; /// 21: ok
31 (1.0).toString(); /// 22: ok
32 var z = (1.0).toString(); /// 23: ok
33 "$y"; /// 24: ok
34 var z = "$y"; /// 25: ok
35 y.toString(); /// 26: ok
36 var z = y.toString(); /// 27: ok
37
38 if (x > 10) {
39 // Optimized code.
40 x is double; /// 30: ok
41 if (x is double) { } /// 31: ok
42 try { x as double; } on CastError catch (e) { } /// 32: ok
43 try { var z = x as double; } on CastError catch (e) { } /// 33: ok
44 y is int; /// 34: ok
45 if (y is int) { } /// 35: ok
46 try { y as int; } on CastError catch (e) { } /// 36: ok
47 try { var z = y as int; } on CastError catch (e) { } /// 37: ok
48
49 "${1.0}"; /// 40: ok
50 var z = "${1.0}"; /// 41: ok
51 (1.0).toString(); /// 42: ok
52 var z = (1.0).toString(); /// 43: ok
53 "$y"; /// 44: ok
54 var z = "$y"; /// 45: ok
55 y.toString(); /// 46: ok
56 var z = y.toString(); /// 47: ok
57 }
58 }
59
60 g(x, y) => f(x, y); // Test inlining calls.
61 h(x, y) => g(x, y);
62
63 main() {
64 for (var i = 0; i < 20; i++) {
65 h(i, i* 1.0);
66 }
67 }
68
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698