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

Unified Diff: tests/standalone/javascript_compatibility_errors_test.dart

Issue 317793003: Add javascript compatibility warnings for integer values and integral double (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | « runtime/lib/identical.cc ('k') | tests/standalone/javascript_compatibility_warnings_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/javascript_compatibility_errors_test.dart
===================================================================
--- tests/standalone/javascript_compatibility_errors_test.dart (revision 37016)
+++ tests/standalone/javascript_compatibility_errors_test.dart (working copy)
@@ -7,7 +7,7 @@
import "package:expect/expect.dart";
f(x, y) {
- // Unoptimized code.
+ // Unoptimized and optimized code.
1 is double; /// 00: compile-time error
if (1 is double) { x++; } /// 01: compile-time error
try { 1 as double; } on CastError catch (e) { } /// 02: compile-time error
@@ -40,35 +40,41 @@
b = b.substring(1);
if (identical(a, b)) { } /// 28: ok
+ if (identical(x, y)) { } /// 29: ok
+ if (identical(y, x)) { } /// 30: ok
+
if (x > 10) {
// Optimized code.
- x is double; /// 30: ok
- if (x is double) { } /// 31: ok
- try { x as double; } on CastError catch (e) { } /// 32: ok
- try { var z = x as double; } on CastError catch (e) { } /// 33: ok
- y is int; /// 34: ok
- if (y is int) { } /// 35: ok
- try { y as int; } on CastError catch (e) { } /// 36: ok
- try { var z = y as int; } on CastError catch (e) { } /// 37: ok
+ x is double; /// 40: ok
+ if (x is double) { } /// 41: ok
+ try { x as double; } on CastError catch (e) { } /// 42: ok
+ try { var z = x as double; } on CastError catch (e) { } /// 43: ok
+ y is int; /// 44: ok
+ if (y is int) { } /// 45: ok
+ try { y as int; } on CastError catch (e) { } /// 46: ok
+ try { var z = y as int; } on CastError catch (e) { } /// 47: ok
- "${1.0}"; /// 40: compile-time error
- var z = "${1.0}"; /// 41: compile-time error
- (1.0).toString(); /// 42: ok
- var z = (1.0).toString(); /// 43: ok
- "$y"; /// 44: ok
- var z = "$y"; /// 45: ok
- y.toString(); /// 46: ok
- var z = y.toString(); /// 47: ok
+ "${1.0}"; /// 50: compile-time error
+ var z = "${1.0}"; /// 51: compile-time error
+ (1.0).toString(); /// 52: ok
+ var z = (1.0).toString(); /// 53: ok
+ "$y"; /// 54: ok
+ var z = "$y"; /// 55: ok
+ y.toString(); /// 56: ok
+ var z = y.toString(); /// 57: ok
var a = "yz";
var b = "xyz";
b = b.substring(1);
- if (identical(a, b)) { } /// 48: ok
+ if (identical(a, b)) { } /// 58: ok
+
+ if (identical(x, y)) { } /// 59: ok
+ if (identical(y, x)) { } /// 60: ok
}
}
k(x, y) {
- // Unoptimized code.
+ // Unoptimized and optimized code.
1.5 is double;
if (1.5 is double) { x++; }
try { 1.5 as double; } on CastError catch (e) { }
@@ -105,6 +111,14 @@
y.toString();
z = y.toString();
+ var a = "xyz";
+ var b = "xyz";
+ b = b.substring(1);
+ if (identical(a, b)) { }
+
+ if (identical(x, y)) { }
+ if (identical(y, x)) { }
+
if (x > 10) {
// Optimized code.
x is double;
@@ -124,6 +138,14 @@
z = "$y";
y.toString();
z = y.toString();
+
+ var a = "xyz";
+ var b = "xyz";
+ b = b.substring(1);
+ if (identical(a, b)) { }
+
+ if (identical(x, y)) { }
+ if (identical(y, x)) { }
}
}
« no previous file with comments | « runtime/lib/identical.cc ('k') | tests/standalone/javascript_compatibility_warnings_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698