| 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('mock_compiler.dart'); | 7 #import('mock_compiler.dart'); |
| 8 #import("../../../lib/compiler/compiler.dart"); | 8 #import("../../../lib/compiler/compiler.dart"); |
| 9 #import("../../../lib/compiler/implementation/leg.dart", prefix:'leg'); | 9 #import("../../../lib/compiler/implementation/leg.dart", prefix:'leg'); |
| 10 #import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart"); | 10 #import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart"); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 Window __window; | 43 Window __window; |
| 44 Window get window() => __window; | 44 Window get window() => __window; |
| 45 abstract class Window { | 45 abstract class Window { |
| 46 abstract Navigator get navigator; | 46 abstract Navigator get navigator; |
| 47 } | 47 } |
| 48 abstract class Navigator { | 48 abstract class Navigator { |
| 49 abstract String get userAgent; | 49 abstract String get userAgent; |
| 50 } | 50 } |
| 51 '''; | 51 '''; |
| 52 | 52 |
| 53 const helperLib = r''' |
| 54 #library('js_helper'); |
| 55 '''; |
| 56 |
| 53 testDart2Dart(String src, [void continuation(String s), bool minify = false, | 57 testDart2Dart(String src, [void continuation(String s), bool minify = false, |
| 54 bool stripTypes = false]) { | 58 bool stripTypes = false]) { |
| 55 // If continuation is not provided, check that source string remains the same. | 59 // If continuation is not provided, check that source string remains the same. |
| 56 if (continuation === null) { | 60 if (continuation === null) { |
| 57 continuation = (s) { Expect.equals(src, s); }; | 61 continuation = (s) { Expect.equals(src, s); }; |
| 58 } | 62 } |
| 59 testDart2DartWithLibrary(src, '', continuation, minify, stripTypes); | 63 testDart2DartWithLibrary(src, '', continuation, minify, stripTypes); |
| 60 } | 64 } |
| 61 | 65 |
| 62 /** | 66 /** |
| 63 * Library name is assumed to be 'mylib' in 'mylib.dart' file. | 67 * Library name is assumed to be 'mylib' in 'mylib.dart' file. |
| 64 */ | 68 */ |
| 65 testDart2DartWithLibrary( | 69 testDart2DartWithLibrary( |
| 66 String srcMain, String srcLibrary, | 70 String srcMain, String srcLibrary, |
| 67 [void continuation(String s), bool minify = false, | 71 [void continuation(String s), bool minify = false, |
| 68 bool stripTypes = false]) { | 72 bool stripTypes = false]) { |
| 69 fileUri(path) => new Uri.fromComponents(scheme: 'file', path: path); | 73 fileUri(path) => new Uri.fromComponents(scheme: 'file', path: path); |
| 70 | 74 |
| 71 final scriptUri = fileUri('script.dart'); | 75 final scriptUri = fileUri('script.dart'); |
| 72 final libUri = fileUri('mylib.dart'); | 76 final libUri = fileUri('mylib.dart'); |
| 73 | 77 |
| 74 provider(uri) { | 78 provider(uri) { |
| 75 if (uri == scriptUri) return new Future.immediate(srcMain); | 79 if (uri == scriptUri) return new Future.immediate(srcMain); |
| 76 if (uri.toString() == libUri.toString()) { | 80 if (uri.toString() == libUri.toString()) { |
| 77 return new Future.immediate(srcLibrary); | 81 return new Future.immediate(srcLibrary); |
| 78 } | 82 } |
| 79 if (uri.path.endsWith('/core.dart')) return new Future.immediate(coreLib); | 83 if (uri.path.endsWith('/core.dart')) return new Future.immediate(coreLib); |
| 80 if (uri.path.endsWith('/io.dart')) return new Future.immediate(ioLib); | 84 if (uri.path.endsWith('/io.dart')) return new Future.immediate(ioLib); |
| 85 if (uri.path.endsWith('/js_helper.dart')) return new Future.immediate(helper
Lib); |
| 81 // TODO(smok): The file should change to html_dartium at some point. | 86 // TODO(smok): The file should change to html_dartium at some point. |
| 82 if (uri.path.endsWith('/html_dart2js.dart')) return new Future.immediate(htm
lLib); | 87 if (uri.path.endsWith('/html_dart2js.dart')) return new Future.immediate(htm
lLib); |
| 83 return new Future.immediate(''); | 88 return new Future.immediate(''); |
| 84 } | 89 } |
| 85 | 90 |
| 86 handler(uri, begin, end, message, kind) { | 91 handler(uri, begin, end, message, kind) { |
| 87 if (kind === Diagnostic.ERROR || kind === Diagnostic.CRASH) { | 92 if (kind === Diagnostic.ERROR || kind === Diagnostic.CRASH) { |
| 88 Expect.fail('$uri: $begin-$end: $message [$kind]'); | 93 Expect.fail('$uri: $begin-$end: $message [$kind]'); |
| 89 } | 94 } |
| 90 } | 95 } |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 testInterfaceDefaultAnotherLib(); | 806 testInterfaceDefaultAnotherLib(); |
| 802 testStaticAccessIoLib(); | 807 testStaticAccessIoLib(); |
| 803 testLocalFunctionPlaceholder(); | 808 testLocalFunctionPlaceholder(); |
| 804 testMinification(); | 809 testMinification(); |
| 805 testClosureLocalsMinified(); | 810 testClosureLocalsMinified(); |
| 806 testParametersMinified(); | 811 testParametersMinified(); |
| 807 testTypeVariablesInDifferentLibraries(); | 812 testTypeVariablesInDifferentLibraries(); |
| 808 testDeclarationTypePlaceholders(); | 813 testDeclarationTypePlaceholders(); |
| 809 testPlatformLibraryMemberNamesAreFixed(); | 814 testPlatformLibraryMemberNamesAreFixed(); |
| 810 } | 815 } |
| OLD | NEW |