| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 mylib.globalVarInitialized; | 268 mylib.globalVarInitialized; |
| 269 mylib.globalVarInitialized2; | 269 mylib.globalVarInitialized2; |
| 270 mylib.globalfoo(); | 270 mylib.globalfoo(); |
| 271 mylib.A.field; | 271 mylib.A.field; |
| 272 mylib.A.staticfoo(); | 272 mylib.A.staticfoo(); |
| 273 new mylib.A(); | 273 new mylib.A(); |
| 274 new mylib.A.fromFoo(); | 274 new mylib.A.fromFoo(); |
| 275 new mylib.A().foo(); | 275 new mylib.A().foo(); |
| 276 } | 276 } |
| 277 '''; | 277 '''; |
| 278 var expectedResult = 'globalfoo(){}p_globalfoo(){}main(){globalVar; p_globalVa
rInitialized; globalVarInitialized2; p_globalfoo(); A.field; A.staticfoo(); new
A(); new A.fromFoo(); new A().foo(); p_globalVar; globalVarInitialized; p_global
VarInitialized2; globalfoo(); p_A.field; p_A.staticfoo(); new p_A(); new p_A.fro
mFoo(); new p_A().foo();}var globalVar;var p_globalVar;var p_globalVarInitialize
d=6,globalVarInitialized2=7;var globalVarInitialized=6,p_globalVarInitialized2=7
;class A{A.fromFoo(){}A(){}foo(){}static staticfoo(){}static final field=5;}clas
s p_A{p_A(){}p_A.fromFoo(){}foo(){}static staticfoo(){}static final field=5;}'; | 278 var expectedResult = |
| 279 'globalfoo(){}var p_globalVar;var globalVarInitialized=6,p_globalVarInitia
lized2=7;' |
| 280 'class p_A{p_A(){}p_A.fromFoo(){}static staticfoo(){}foo(){}static final f
ield=5;}' |
| 281 'p_globalfoo(){}var globalVar;var p_globalVarInitialized=6,globalVarInitia
lized2=7;' |
| 282 'class A{A(){}A.fromFoo(){}static staticfoo(){}foo(){}static final field=5
;}' |
| 283 'main(){globalVar; p_globalVarInitialized; globalVarInitialized2; p_global
foo();' |
| 284 ' A.field; A.staticfoo();' |
| 285 ' new A(); new A.fromFoo(); new A().foo();' |
| 286 ' p_globalVar; globalVarInitialized; p_globalVarInitialized2; globalfoo
();' |
| 287 ' p_A.field; p_A.staticfoo();' |
| 288 ' new p_A(); new p_A.fromFoo(); new p_A().foo();}'; |
| 279 testDart2DartWithLibrary(mainSrc, librarySrc, | 289 testDart2DartWithLibrary(mainSrc, librarySrc, |
| 280 (String result) { Expect.equals(expectedResult, result); }); | 290 (String result) { Expect.equals(expectedResult, result); }); |
| 281 } | 291 } |
| 282 | 292 |
| 283 testNoConflictSendsRename() { | 293 testNoConflictSendsRename() { |
| 284 // Various Send-s to current library and external library. Nothing should be | 294 // Various Send-s to current library and external library. Nothing should be |
| 285 // renamed here, only library prefixes must be cut. | 295 // renamed here, only library prefixes must be cut. |
| 286 var librarySrc = ''' | 296 var librarySrc = ''' |
| 287 #library("mylib.dart"); | 297 #library("mylib.dart"); |
| 288 | 298 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 318 new MyA().myfoo(); | 328 new MyA().myfoo(); |
| 319 | 329 |
| 320 mylib.globalfoo(); | 330 mylib.globalfoo(); |
| 321 mylib.A.field; | 331 mylib.A.field; |
| 322 mylib.A.staticfoo(); | 332 mylib.A.staticfoo(); |
| 323 new mylib.A(); | 333 new mylib.A(); |
| 324 new mylib.A.fromFoo(); | 334 new mylib.A.fromFoo(); |
| 325 new mylib.A().foo(); | 335 new mylib.A().foo(); |
| 326 } | 336 } |
| 327 '''; | 337 '''; |
| 328 var expectedResult = 'myglobalfoo(){}' | 338 var expectedResult = |
| 329 'globalfoo(){}' | 339 'globalfoo(){}' |
| 330 'main(){myglobalfoo(); MyA.myfield; MyA.mystaticfoo(); new MyA(); ' | 340 'class A{A(){}A.fromFoo(){}static staticfoo(){}foo(){}static final field=5
;}' |
| 331 'new MyA.myfromFoo(); new MyA().myfoo(); globalfoo(); A.field; ' | 341 'myglobalfoo(){}' |
| 332 'A.staticfoo(); new A(); new A.fromFoo(); new A().foo();}' | 342 'class MyA{MyA(){}MyA.myfromFoo(){}static mystaticfoo(){}myfoo(){}static f
inal myfield=5;}' |
| 333 'class MyA{MyA(){}MyA.myfromFoo(){}myfoo(){}' | 343 'main(){myglobalfoo(); MyA.myfield; MyA.mystaticfoo(); new MyA();' |
| 334 'static final myfield=5;static mystaticfoo(){}}' | 344 ' new MyA.myfromFoo(); new MyA().myfoo(); globalfoo(); A.field;' |
| 335 'class A{A(){}A.fromFoo(){}foo(){}' | 345 ' A.staticfoo(); new A(); new A.fromFoo(); new A().foo();}'; |
| 336 'static staticfoo(){}static final field=5;}'; | |
| 337 testDart2DartWithLibrary(mainSrc, librarySrc, | 346 testDart2DartWithLibrary(mainSrc, librarySrc, |
| 338 (String result) { Expect.equals(expectedResult, result); }); | 347 (String result) { Expect.equals(expectedResult, result); }); |
| 339 } | 348 } |
| 340 | 349 |
| 341 testConflictLibraryClassRename() { | 350 testConflictLibraryClassRename() { |
| 342 var librarySrc = ''' | 351 var librarySrc = ''' |
| 343 #library('mylib'); | 352 #library('mylib'); |
| 344 | 353 |
| 345 topfoo() {} | 354 topfoo() {} |
| 346 | 355 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 368 a.foo(); | 377 a.foo(); |
| 369 var b = new A.fromFoo(); | 378 var b = new A.fromFoo(); |
| 370 b.foo(); | 379 b.foo(); |
| 371 var GREATVAR = b.myliba; | 380 var GREATVAR = b.myliba; |
| 372 b.mylist; | 381 b.mylist; |
| 373 a = getA(); | 382 a = getA(); |
| 374 topfoo(); | 383 topfoo(); |
| 375 mylib.topfoo(); | 384 mylib.topfoo(); |
| 376 } | 385 } |
| 377 '''; | 386 '''; |
| 378 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(){}}'; | 387 var expectedResult = |
| 388 'topfoo(){}' |
| 389 'class p_A{foo(){}}' |
| 390 'p_topfoo(){var x=5;}' |
| 391 'class A{num foo(){}A.fromFoo(){}p_A myliba;List<A> mylist;}' |
| 392 'p_A getA()=> null;' |
| 393 'main(){var a=new p_A(); a.foo(); var b=new A.fromFoo(); b.foo(); var GREATV
AR=b.myliba; b.mylist; a=getA(); p_topfoo(); topfoo();}'; |
| 379 testDart2DartWithLibrary(mainSrc, librarySrc, | 394 testDart2DartWithLibrary(mainSrc, librarySrc, |
| 380 (String result) { Expect.equals(expectedResult, result); }); | 395 (String result) { Expect.equals(expectedResult, result); }); |
| 381 } | 396 } |
| 382 | 397 |
| 383 testDefaultClassWithArgs() { | 398 testDefaultClassWithArgs() { |
| 384 testDart2Dart('main(){var result=new IA<String>();}' | 399 testDart2Dart('main(){var result=new IA<String>();}' |
| 385 'interface IA<T> default A<T extends Object>{IA();}' | 400 'interface IA<T> default A<T extends Object>{IA();}' |
| 386 'class A<T extends Object> implements IA<T>{factory A(){}}'); | 401 'class A<T extends Object> implements IA<T>{factory A(){}}'); |
| 387 } | 402 } |
| 388 | 403 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 404 set topgetset(arg) {} | 419 set topgetset(arg) {} |
| 405 '''; | 420 '''; |
| 406 var mainSrc = ''' | 421 var mainSrc = ''' |
| 407 #import('mylib.dart', prefix: 'mylib'); | 422 #import('mylib.dart', prefix: 'mylib'); |
| 408 | 423 |
| 409 main() { | 424 main() { |
| 410 mylib.topgetset; | 425 mylib.topgetset; |
| 411 mylib.topgetset = 5; | 426 mylib.topgetset = 5; |
| 412 } | 427 } |
| 413 '''; | 428 '''; |
| 414 var expectedResult = 'set topgetset(arg){}get topgetset()=> 5;main(){topgetset
; topgetset=5;}'; | 429 var expectedResult = |
| 430 'get topgetset()=> 5;' |
| 431 'set topgetset(arg){}' |
| 432 'main(){topgetset; topgetset=5;}'; |
| 415 testDart2DartWithLibrary(mainSrc, librarySrc, | 433 testDart2DartWithLibrary(mainSrc, librarySrc, |
| 416 (String result) { Expect.equals(expectedResult, result); }); | 434 (String result) { Expect.equals(expectedResult, result); }); |
| 417 } | 435 } |
| 418 | 436 |
| 419 main() { | 437 main() { |
| 420 testSignedConstants(); | 438 testSignedConstants(); |
| 421 testGenericTypes(); | 439 testGenericTypes(); |
| 422 testForLoop(); | 440 testForLoop(); |
| 423 testEmptyList(); | 441 testEmptyList(); |
| 424 testClosure(); | 442 testClosure(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 438 testFactoryConstructor(); | 456 testFactoryConstructor(); |
| 439 testAbstractClass(); | 457 testAbstractClass(); |
| 440 testConflictSendsRename(); | 458 testConflictSendsRename(); |
| 441 testNoConflictSendsRename(); | 459 testNoConflictSendsRename(); |
| 442 testConflictLibraryClassRename(); | 460 testConflictLibraryClassRename(); |
| 443 testDefaultClassWithArgs(); | 461 testDefaultClassWithArgs(); |
| 444 testClassExtendsWithArgs(); | 462 testClassExtendsWithArgs(); |
| 445 testStaticInvocation(); | 463 testStaticInvocation(); |
| 446 testLibraryGetSet(); | 464 testLibraryGetSet(); |
| 447 } | 465 } |
| OLD | NEW |