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

Unified Diff: tests/language/const_syntax_test.dart

Issue 10855174: Lazy implementation of final variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase wrt CL 10832351. Created 8 years, 4 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
Index: tests/language/const_syntax_test.dart
diff --git a/tests/language/final_syntax_test.dart b/tests/language/const_syntax_test.dart
similarity index 64%
copy from tests/language/final_syntax_test.dart
copy to tests/language/const_syntax_test.dart
index c0189bd54be635c1cf713c9ac040699e3244a254..e321e9cd8e556331657ec9b36fcdcee1247a8114 100644
--- a/tests/language/final_syntax_test.dart
+++ b/tests/language/const_syntax_test.dart
@@ -3,13 +3,15 @@
// BSD-style license that can be found in the LICENSE file.
main() {
- final f0 = 42;
- final f1; /// 01: compile-time error
- final int f2 = 87;
- final int f3; /// 02: compile-time error
+ const f1; /// 01: compile-time error
+ const int f3; /// 02: compile-time error
+
+ const f0 = 42;
+ const int f2 = 87;
Expect.equals(42, f0);
Expect.equals(87, f2);
+ // It is ok not to raise a compile-time error for 03 and 04.
Expect.equals(42, F0); /// 03: compile-time error
Expect.equals(87, F2); /// 04: compile-time error
@@ -30,10 +32,10 @@ main() {
Expect.equals("42Hello", B3); /// 10: compile-time error
}
-final F0 = 42;
-final F1; /// 03: continued
-final int F2 = 87;
-final int F3; /// 04: continued
+const F0 = 42;
+const F1; /// 03: continued
+const int F2 = 87;
+const int F3; /// 04: continued
class Point {
final x, y;
@@ -43,31 +45,31 @@ class Point {
// Check that compile time expressions can include invocations of
// user-defined const constructors.
-final P0 = const Point(0, 0);
-final P1 = const Point(0, 0) + 1; /// 05: continued
-final P2 = new Point(0, 0); /// 06: continued
-final P3 = new Point(0, 0) + 1; /// 07: continued
+const P0 = const Point(0, 0);
+const P1 = const Point(0, 0) + 1; /// 05: continued
+const P2 = new Point(0, 0); /// 06: continued
+const P3 = new Point(0, 0) + 1; /// 07: continued
// Check that we cannot have cyclic references in compile time
// expressions.
-final A0 = 42;
-final A1 = A0 + 1;
-final A2 = A3 + 1; /// 08: continued
-final A3 = A2 + 1; /// 08: continued
+const A0 = 42;
+const A1 = A0 + 1;
+const A2 = A3 + 1; /// 08: continued
+const A3 = A2 + 1; /// 08: continued
class C0 {
- static final X = const C1();
+ static const X = const C1();
}
class C1 {
const C1()
: x = C0.X /// 09: continued
;
- final x = null;
+ const x = null;
}
// Check that sub-expressions of binary + are numeric.
-final B0 = 42;
-final B1 = "Hello";
-final B2 = "$B1 $B0";
-final B3 = B0 + B1; /// 10: continued
+const B0 = 42;
+const B1 = "Hello";
+const B2 = "$B1 $B0";
+const B3 = B0 + B1; /// 10: continued

Powered by Google App Engine
This is Rietveld 408576698