OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #import('dart:uri'); | 5 #import('dart:uri'); |
6 #import('parser_helper.dart'); | 6 #import('parser_helper.dart'); |
7 #import("../../../lib/compiler/compiler.dart"); | 7 #import("../../../lib/compiler/compiler.dart"); |
8 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 8 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
9 | 9 |
10 testUnparse(String statement) { | 10 testUnparse(String statement) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 | 141 |
142 testClassWithMethod() { | 142 testClassWithMethod() { |
143 testDart2Dart('main(){var a=new A(); a.foo();}class A{void foo(){}}'); | 143 testDart2Dart('main(){var a=new A(); a.foo();}class A{void foo(){}}'); |
144 } | 144 } |
145 | 145 |
146 testVariableDefinitions() { | 146 testVariableDefinitions() { |
147 testDart2Dart('main(){final var x, y; final String s;}'); | 147 testDart2Dart('main(){final var x, y; final String s;}'); |
148 testDart2Dart('foo(f, g){}main(){foo(1, 2);}'); | 148 testDart2Dart('foo(f, g){}main(){foo(1, 2);}'); |
149 testDart2Dart('foo(f(arg)){}main(){foo(main);}'); | 149 testDart2Dart('foo(f(arg)){}main(){foo(main);}'); |
| 150 // A couple of static/finals inside a class. |
| 151 testDart2Dart('main(){A.a; A.b;}class A{static final String a="5";' |
| 152 'static final String b="4";}'); |
150 } | 153 } |
151 | 154 |
152 testGetSet() { | 155 testGetSet() { |
153 // Top-level get/set. | 156 // Top-level get/set. |
154 testDart2Dart('get foo(){return 5;}set foo(arg){}main(){foo; foo=5;}'); | 157 testDart2Dart('get foo(){return 5;}set foo(arg){}main(){foo; foo=5;}'); |
155 // Field get/set. | 158 // Field get/set. |
156 testDart2Dart('main(){var a=new A(); a.foo; a.foo=5;}class A{set foo(a){}get f
oo(){return 5;}}'); | 159 testDart2Dart('main(){var a=new A(); a.foo; a.foo=5;}class A{set foo(a){}get f
oo(){return 5;}}'); |
157 // Typed get/set. | 160 // Typed get/set. |
158 testDart2Dart('String get foo(){return "a";}main(){foo;}'); | 161 testDart2Dart('String get foo(){return "a";}main(){foo;}'); |
159 } | 162 } |
160 | 163 |
161 main() { | 164 main() { |
162 testGenericTypes(); | 165 testGenericTypes(); |
163 testForLoop(); | 166 testForLoop(); |
164 testEmptyList(); | 167 testEmptyList(); |
165 testClosure(); | 168 testClosure(); |
166 testIndexedOperatorDecl(); | 169 testIndexedOperatorDecl(); |
167 testNativeMethods(); | 170 testNativeMethods(); |
168 testPrefixIncrements(); | 171 testPrefixIncrements(); |
169 testConstModifier(); | 172 testConstModifier(); |
170 testSimpleFileUnparse(); | 173 testSimpleFileUnparse(); |
171 testSimpleObjectInstantiation(); | 174 testSimpleObjectInstantiation(); |
172 testSimpleTopLevelClass(); | 175 testSimpleTopLevelClass(); |
173 testClassWithSynthesizedConstructor(); | 176 testClassWithSynthesizedConstructor(); |
174 testClassWithMethod(); | 177 testClassWithMethod(); |
175 testVariableDefinitions(); | 178 testVariableDefinitions(); |
176 testGetSet(); | 179 testGetSet(); |
177 testTopLevelField(); | 180 testTopLevelField(); |
178 } | 181 } |
OLD | NEW |