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

Side by Side Diff: tests/language/src/CompileTimeConstTest.dart

Issue 8231031: Check for compile-time constants in DartCompiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: All tests pass but one junit test Created 9 years, 2 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) 2011, 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 // Exercises language constructs that require compile time constants
6
7 final int TOP1 = 1;
8 final int TOP2 = TOP1;
9 final bool TOP3 = true;
10 final String TOP4 = "Hello";
11
12 // Binary Expressions
13 // Negative Test: final TOP1 = 1; final TOP_BOP1 = TOP1 * 1; // TOP1 isn't type int
14 final TOP_BOP1 = TOP1 * 1;
15 final TOP_BOP2 = 1 * TOP1;
16 final TOP_BOP2_0 = 1 + 3;
17 final TOP_BOP2_1 = 2 * (TOP_BOP2_0 - TOP_BOP2);
18
19 final TOP_BOP3 = 2 < TOP1;
20 final TOP_BOP4 = TOP1 < 2;
21 final TOP_BOP5 = 0x80 & 0x04;
22 final TOP_BOP6 = TOP3 && true;
23 final TOP_BOP7 = false && TOP3;
24 final TOP_BOP8 = TOP4 == "World!";
25 final bool TOP_BOP9 = "Hello" == TOP4;
26 final TOP_BOP10 = TOP1 === TOP2;
27 final TOP_BOP11 = TOP3 !== TOP_BOP9;
28 // Multiple binary expresions
29 final TOP_BOP12 = 1 * TOP1 / 3 + TOP1;
30
31 // Parenthized expression
32 final TOP_BOP20 = ( 1 > 2 );
33 final TOP_BOP21 = (1 * 2) + 3;
34
35
36 // Unary expression
37 final TOP_BOP22 = !TOP3;
38 final TOP_BOP23 = (!TOP3) && true;
39
40
41 main () {
42
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698