| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 220 } |
| 221 | 221 |
| 222 testConflictSendsRename() { | 222 testConflictSendsRename() { |
| 223 // Various Send-s to current library and external library. Verify that | 223 // Various Send-s to current library and external library. Verify that |
| 224 // everything is renamed correctly in conflicting class names and global | 224 // everything is renamed correctly in conflicting class names and global |
| 225 // functions. | 225 // functions. |
| 226 var librarySrc = ''' | 226 var librarySrc = ''' |
| 227 #library("mylib.dart"); | 227 #library("mylib.dart"); |
| 228 | 228 |
| 229 globalfoo() {} | 229 globalfoo() {} |
| 230 var globalVar; |
| 231 var globalVarInitialized = 6, globalVarInitialized2 = 7; |
| 230 | 232 |
| 231 class A { | 233 class A { |
| 232 A(){} | 234 A(){} |
| 233 A.fromFoo(){} | 235 A.fromFoo(){} |
| 234 static staticfoo(){} | 236 static staticfoo(){} |
| 235 foo(){} | 237 foo(){} |
| 236 static final field = 5; | 238 static final field = 5; |
| 237 } | 239 } |
| 238 '''; | 240 '''; |
| 239 var mainSrc = ''' | 241 var mainSrc = ''' |
| 240 #import("mylib.dart", prefix: "mylib"); | 242 #import("mylib.dart", prefix: "mylib"); |
| 241 | 243 |
| 242 globalfoo() {} | 244 globalfoo() {} |
| 245 var globalVar; |
| 246 var globalVarInitialized = 6, globalVarInitialized2 = 7; |
| 243 | 247 |
| 244 class A { | 248 class A { |
| 245 A(){} | 249 A(){} |
| 246 A.fromFoo(){} | 250 A.fromFoo(){} |
| 247 static staticfoo(){} | 251 static staticfoo(){} |
| 248 foo(){} | 252 foo(){} |
| 249 static final field = 5; | 253 static final field = 5; |
| 250 } | 254 } |
| 251 | 255 |
| 252 main() { | 256 main() { |
| 257 globalVar; |
| 258 globalVarInitialized; |
| 259 globalVarInitialized2; |
| 253 globalfoo(); | 260 globalfoo(); |
| 254 A.field; | 261 A.field; |
| 255 A.staticfoo(); | 262 A.staticfoo(); |
| 256 new A(); | 263 new A(); |
| 257 new A.fromFoo(); | 264 new A.fromFoo(); |
| 258 new A().foo(); | 265 new A().foo(); |
| 259 | 266 |
| 267 mylib.globalVar; |
| 268 mylib.globalVarInitialized; |
| 269 mylib.globalVarInitialized2; |
| 260 mylib.globalfoo(); | 270 mylib.globalfoo(); |
| 261 mylib.A.field; | 271 mylib.A.field; |
| 262 mylib.A.staticfoo(); | 272 mylib.A.staticfoo(); |
| 263 new mylib.A(); | 273 new mylib.A(); |
| 264 new mylib.A.fromFoo(); | 274 new mylib.A.fromFoo(); |
| 265 new mylib.A().foo(); | 275 new mylib.A().foo(); |
| 266 } | 276 } |
| 267 '''; | 277 '''; |
| 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;}'; | 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;}'; |
| 269 testDart2DartWithLibrary(mainSrc, librarySrc, | 279 testDart2DartWithLibrary(mainSrc, librarySrc, |
| 270 (String result) { Expect.equals(expectedResult, result); }); | 280 (String result) { Expect.equals(expectedResult, result); }); |
| 271 } | 281 } |
| 272 | 282 |
| 273 testNoConflictSendsRename() { | 283 testNoConflictSendsRename() { |
| 274 // Various Send-s to current library and external library. Nothing should be | 284 // Various Send-s to current library and external library. Nothing should be |
| 275 // renamed here, only library prefixes must be cut. | 285 // renamed here, only library prefixes must be cut. |
| 276 var librarySrc = ''' | 286 var librarySrc = ''' |
| 277 #library("mylib.dart"); | 287 #library("mylib.dart"); |
| 278 | 288 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 testGetSet(); | 417 testGetSet(); |
| 408 testFactoryConstructor(); | 418 testFactoryConstructor(); |
| 409 testAbstractClass(); | 419 testAbstractClass(); |
| 410 testConflictSendsRename(); | 420 testConflictSendsRename(); |
| 411 testNoConflictSendsRename(); | 421 testNoConflictSendsRename(); |
| 412 testConflictLibraryClassRename(); | 422 testConflictLibraryClassRename(); |
| 413 testDefaultClassWithArgs(); | 423 testDefaultClassWithArgs(); |
| 414 testClassExtendsWithArgs(); | 424 testClassExtendsWithArgs(); |
| 415 testStaticInvocation(); | 425 testStaticInvocation(); |
| 416 } | 426 } |
| OLD | NEW |