| 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
| 8 import 'parser_helper.dart'; | 8 import 'parser_helper.dart'; |
| 9 import 'mock_compiler.dart'; | 9 import 'mock_compiler.dart'; |
| 10 import '../../../sdk/lib/_internal/compiler/compiler.dart'; | 10 import '../../../sdk/lib/_internal/compiler/compiler.dart'; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 testClassWithMethod() { | 172 testClassWithMethod() { |
| 173 testDart2Dart('main(){var a=new A();a.foo();}class A{void foo(){}}'); | 173 testDart2Dart('main(){var a=new A();a.foo();}class A{void foo(){}}'); |
| 174 } | 174 } |
| 175 | 175 |
| 176 testExtendsImplements() { | 176 testExtendsImplements() { |
| 177 testDart2Dart('main(){new B<Object>();}' | 177 testDart2Dart('main(){new B<Object>();}' |
| 178 'class A<T>{}class B<T> extends A<T>{}'); | 178 'class A<T>{}class B<T> extends A<T>{}'); |
| 179 } | 179 } |
| 180 | 180 |
| 181 testVariableDefinitions() { | 181 testVariableDefinitions() { |
| 182 testDart2Dart('main(){var x,y;final String s;}'); | 182 testDart2Dart('main(){var x,y;final String s=null;}'); |
| 183 testDart2Dart('main(){final int x,y;final String s;}'); | 183 testDart2Dart('main(){final int x=0,y=0;final String s=null;}'); |
| 184 testDart2Dart('foo(f,g){}main(){foo(1,2);}'); | 184 testDart2Dart('foo(f,g){}main(){foo(1,2);}'); |
| 185 testDart2Dart('foo(f(arg)){}main(){foo(main);}'); | 185 testDart2Dart('foo(f(arg)){}main(){foo(main);}'); |
| 186 // A couple of static/finals inside a class. | 186 // A couple of static/finals inside a class. |
| 187 testDart2Dart('main(){A.a;A.b;}class A{static const String a="5";' | 187 testDart2Dart('main(){A.a;A.b;}class A{static const String a="5";' |
| 188 'static const String b="4";}'); | 188 'static const String b="4";}'); |
| 189 // Class member of typedef-ed function type. | 189 // Class member of typedef-ed function type. |
| 190 // Maybe typedef should be included in the result too, but it | 190 // Maybe typedef should be included in the result too, but it |
| 191 // works fine without it. | 191 // works fine without it. |
| 192 testDart2Dart( | 192 testDart2Dart( |
| 193 'typedef void foofunc(arg);main(){new A((arg){});}' | 193 'typedef void foofunc(arg);main(){new A((arg){});}' |
| 194 'class A{A(foofunc this.handler);final foofunc handler;}'); | 194 'class A{A(foofunc this.handler);final foofunc handler;}'); |
| 195 } | 195 } |
| 196 | 196 |
| 197 testGetSet() { | 197 testGetSet() { |
| 198 // Top-level get/set. | 198 // Top-level get/set. |
| 199 testDart2Dart('set foo(arg){}get foo{return 5;}main(){foo;foo=5;}'); | 199 testDart2Dart('set foo(arg){}get foo{return 5;}main(){foo;foo=5;}'); |
| 200 // Field get/set. | 200 // Field get/set. |
| 201 testDart2Dart('main(){var a=new A();a.foo;a.foo=5;}' | 201 testDart2Dart('main(){var a=new A();a.foo;a.foo=5;}' |
| 202 'class A{set foo(a){}get foo{return 5;}}'); | 202 'class A{set foo(a){}get foo{return 5;}}'); |
| 203 // Typed get/set. | 203 // Typed get/set. |
| 204 testDart2Dart('String get foo{return "a";}main(){foo;}'); | 204 testDart2Dart('String get foo{return "a";}main(){foo;}'); |
| 205 } | 205 } |
| 206 | 206 |
| 207 testAbstractClass() { | 207 testAbstractClass() { |
| 208 testDart2Dart('main(){A.foo;}abstract class A{final static num foo;}'); | 208 testDart2Dart('main(){A.foo;}abstract class A{final static num foo=0;}'); |
| 209 } | 209 } |
| 210 | 210 |
| 211 testConflictSendsRename() { | 211 testConflictSendsRename() { |
| 212 // Various Send-s to current library and external library. Verify that | 212 // Various Send-s to current library and external library. Verify that |
| 213 // everything is renamed correctly in conflicting class names and global | 213 // everything is renamed correctly in conflicting class names and global |
| 214 // functions. | 214 // functions. |
| 215 var librarySrc = ''' | 215 var librarySrc = ''' |
| 216 library mylib; | 216 library mylib; |
| 217 | 217 |
| 218 globalfoo() {} | 218 globalfoo() {} |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 testStaticAccessIoLib(); | 729 testStaticAccessIoLib(); |
| 730 testLocalFunctionPlaceholder(); | 730 testLocalFunctionPlaceholder(); |
| 731 testMinification(); | 731 testMinification(); |
| 732 testClosureLocalsMinified(); | 732 testClosureLocalsMinified(); |
| 733 testParametersMinified(); | 733 testParametersMinified(); |
| 734 testDeclarationTypePlaceholders(); | 734 testDeclarationTypePlaceholders(); |
| 735 testPlatformLibraryMemberNamesAreFixed(); | 735 testPlatformLibraryMemberNamesAreFixed(); |
| 736 testConflictsWithCoreLib(); | 736 testConflictsWithCoreLib(); |
| 737 testUnresolvedNamedConstructor(); | 737 testUnresolvedNamedConstructor(); |
| 738 } | 738 } |
| OLD | NEW |