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

Side by Side Diff: tests/compiler/dart2js/unparser_test.dart

Issue 10698154: Fix getters/setters unparsing, they appeared as ordinary methods without get/set keywords. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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
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 12 matching lines...) Expand all
23 interface bool {} 23 interface bool {}
24 interface num {} 24 interface num {}
25 interface int extends num {} 25 interface int extends num {}
26 interface double extends num {} 26 interface double extends num {}
27 interface String {} 27 interface String {}
28 interface Function {} 28 interface Function {}
29 interface List {} 29 interface List {}
30 interface Closure {} 30 interface Closure {}
31 interface Dynamic {} 31 interface Dynamic {}
32 interface Null {} 32 interface Null {}
33 assert() {}
33 '''; 34 ''';
34 35
35 testDart2Dart(String src, [void continuation(String s)]) { 36 testDart2Dart(String src, [void continuation(String s)]) {
36 fileUri(path) => new Uri(scheme: 'file', path: path); 37 fileUri(path) => new Uri(scheme: 'file', path: path);
37 38
38 final scriptUri = fileUri('script.dart'); 39 final scriptUri = fileUri('script.dart');
39 40
40 provider(uri) { 41 provider(uri) {
41 if (uri == scriptUri) return new Future.immediate(src); 42 if (uri == scriptUri) return new Future.immediate(src);
42 if (uri.path.endsWith('/core.dart')) return new Future.immediate(coreLib); 43 if (uri.path.endsWith('/core.dart')) return new Future.immediate(coreLib);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 testClassWithMethod() { 142 testClassWithMethod() {
142 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(){}}');
143 } 144 }
144 145
145 testVariableDefinitions() { 146 testVariableDefinitions() {
146 testDart2Dart('main(){final var x, y; final String s;}'); 147 testDart2Dart('main(){final var x, y; final String s;}');
147 testDart2Dart('foo(f, g){}main(){foo(1, 2);}'); 148 testDart2Dart('foo(f, g){}main(){foo(1, 2);}');
148 testDart2Dart('foo(f(arg)){}main(){foo(main);}'); 149 testDart2Dart('foo(f(arg)){}main(){foo(main);}');
149 } 150 }
150 151
152 testGetSet() {
153 // Top-level get/set.
154 testDart2Dart('get foo(){return 5;}set foo(arg){}main(){foo; foo=5;}');
155 // 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;}}');
157 }
158
151 main() { 159 main() {
152 testGenericTypes(); 160 testGenericTypes();
153 testForLoop(); 161 testForLoop();
154 testEmptyList(); 162 testEmptyList();
155 testClosure(); 163 testClosure();
156 testIndexedOperatorDecl(); 164 testIndexedOperatorDecl();
157 testNativeMethods(); 165 testNativeMethods();
158 testPrefixIncrements(); 166 testPrefixIncrements();
159 testConstModifier(); 167 testConstModifier();
160 testSimpleFileUnparse(); 168 testSimpleFileUnparse();
161 testSimpleObjectInstantiation(); 169 testSimpleObjectInstantiation();
162 testSimpleTopLevelClass(); 170 testSimpleTopLevelClass();
163 testClassWithSynthesizedConstructor(); 171 testClassWithSynthesizedConstructor();
164 testClassWithMethod(); 172 testClassWithMethod();
165 testVariableDefinitions(); 173 testVariableDefinitions();
174 testGetSet();
166 testTopLevelField(); 175 testTopLevelField();
167 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698