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

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

Issue 10836261: dart2dart Preproces placeholders instead of renaming them lazily, (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/dart_backend/renamer.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 new A().foo(); 258 new A().foo();
259 259
260 mylib.globalfoo(); 260 mylib.globalfoo();
261 mylib.A.field; 261 mylib.A.field;
262 mylib.A.staticfoo(); 262 mylib.A.staticfoo();
263 new mylib.A(); 263 new mylib.A();
264 new mylib.A.fromFoo(); 264 new mylib.A.fromFoo();
265 new mylib.A().foo(); 265 new mylib.A().foo();
266 } 266 }
267 '''; 267 ''';
268 var expectedResult = @'globalfoo(){}' 268 var expectedResult = 'globalfoo(){}p_globalfoo(){}main(){p_globalfoo(); p_A.fi eld; p_A.staticfoo(); new p_A(); new p_A.fromFoo(); new p_A().foo(); globalfoo() ; A.field; A.staticfoo(); new A(); new A.fromFoo(); new A().foo();}class p_A{p_A (){}p_A.fromFoo(){}foo(){}static staticfoo(){}static final field=5;}class A{A(){ }A.fromFoo(){}foo(){}static staticfoo(){}static final field=5;}';
269 @'p_globalfoo(){}'
270 @'main(){p_globalfoo(); A.field; A.staticfoo(); new A(); '
271 @'new A.fromFoo(); new A().foo(); globalfoo(); p_A.field; '
272 @'p_A.staticfoo(); new p_A(); new p_A.fromFoo(); new p_A().foo();}'
273 @'class A{A(){}A.fromFoo(){}foo(){}static staticfoo(){}'
274 @'static final field=5;}'
275 @'class p_A{p_A(){}p_A.fromFoo(){}foo(){}static staticfoo(){}'
276 @'static final field=5;}';
277 testDart2DartWithLibrary(mainSrc, librarySrc, 269 testDart2DartWithLibrary(mainSrc, librarySrc,
278 (String result) { Expect.equals(expectedResult, result); }); 270 (String result) { Expect.equals(expectedResult, result); });
279 } 271 }
280 272
281 testNoConflictSendsRename() { 273 testNoConflictSendsRename() {
282 // Various Send-s to current library and external library. Nothing should be 274 // Various Send-s to current library and external library. Nothing should be
283 // renamed here, only library prefixes must be cut. 275 // renamed here, only library prefixes must be cut.
284 var librarySrc = ''' 276 var librarySrc = '''
285 #library("mylib.dart"); 277 #library("mylib.dart");
286 278
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 a.foo(); 358 a.foo();
367 var b = new A.fromFoo(); 359 var b = new A.fromFoo();
368 b.foo(); 360 b.foo();
369 var GREATVAR = b.myliba; 361 var GREATVAR = b.myliba;
370 b.mylist; 362 b.mylist;
371 a = getA(); 363 a = getA();
372 topfoo(); 364 topfoo();
373 mylib.topfoo(); 365 mylib.topfoo();
374 } 366 }
375 '''; 367 ''';
376 var expectedResult = @'topfoo(){}p_topfoo(){var x=5;}A getA()=> null;' 368 var expectedResult = 'topfoo(){}p_topfoo(){var x=5;}p_A getA()=> null;main(){v ar a=new p_A(); a.foo(); var b=new A.fromFoo(); b.foo(); var GREATVAR=b.myliba; b.mylist; a=getA(); p_topfoo(); topfoo();}class A{A.fromFoo(){}List<A> mylist;nu m foo(){}p_A myliba;}class p_A{foo(){}}';
377 @'main(){var a=new A(); a.foo(); var b=new p_A.fromFoo(); b.foo(); '
378 @'var GREATVAR=b.myliba; b.mylist; a=getA(); p_topfoo(); topfoo();}'
379 @'class p_A{p_A.fromFoo(){}List<p_A> mylist;num foo(){}A myliba;}'
380 @'class A{foo(){}}';
381 testDart2DartWithLibrary(mainSrc, librarySrc, 369 testDart2DartWithLibrary(mainSrc, librarySrc,
382 (String result) { Expect.equals(expectedResult, result); }); 370 (String result) { Expect.equals(expectedResult, result); });
383 } 371 }
384 372
385 testDefaultClassWithArgs() { 373 testDefaultClassWithArgs() {
386 testDart2Dart('main(){var result=new IA<String>();}' 374 testDart2Dart('main(){var result=new IA<String>();}'
387 'interface IA<T> default A<T extends Object>{IA();}' 375 'interface IA<T> default A<T extends Object>{IA();}'
388 'class A<T extends Object> implements IA<T>{factory A(){}}'); 376 'class A<T extends Object> implements IA<T>{factory A(){}}');
389 } 377 }
390 378
(...skipping 28 matching lines...) Expand all
419 testGetSet(); 407 testGetSet();
420 testFactoryConstructor(); 408 testFactoryConstructor();
421 testAbstractClass(); 409 testAbstractClass();
422 testConflictSendsRename(); 410 testConflictSendsRename();
423 testNoConflictSendsRename(); 411 testNoConflictSendsRename();
424 testConflictLibraryClassRename(); 412 testConflictLibraryClassRename();
425 testDefaultClassWithArgs(); 413 testDefaultClassWithArgs();
426 testClassExtendsWithArgs(); 414 testClassExtendsWithArgs();
427 testStaticInvocation(); 415 testStaticInvocation();
428 } 416 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/dart_backend/renamer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698