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 '../../../sdk/lib/_internal/compiler/compiler.dart'; | 8 import '../../../sdk/lib/_internal/compiler/compiler.dart'; |
9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l
eg; | 9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l
eg; |
10 import '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_bac
kend.dart'; | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_bac
kend.dart'; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 '''; | 53 '''; |
54 | 54 |
55 const helperLib = r''' | 55 const helperLib = r''' |
56 #library('js_helper'); | 56 #library('js_helper'); |
57 class JSInvocationMirror {} | 57 class JSInvocationMirror {} |
58 '''; | 58 '''; |
59 | 59 |
60 testDart2Dart(String src, {void continuation(String s), bool minify: false, | 60 testDart2Dart(String src, {void continuation(String s), bool minify: false, |
61 bool stripTypes: false}) { | 61 bool stripTypes: false}) { |
62 // If continuation is not provided, check that source string remains the same. | 62 // If continuation is not provided, check that source string remains the same. |
63 if (continuation === null) { | 63 if (continuation == null) { |
64 continuation = (s) { Expect.equals(src, s); }; | 64 continuation = (s) { Expect.equals(src, s); }; |
65 } | 65 } |
66 testDart2DartWithLibrary(src, '', continuation: continuation, minify: minify, | 66 testDart2DartWithLibrary(src, '', continuation: continuation, minify: minify, |
67 stripTypes: stripTypes); | 67 stripTypes: stripTypes); |
68 } | 68 } |
69 | 69 |
70 /** | 70 /** |
71 * Library name is assumed to be 'mylib' in 'mylib.dart' file. | 71 * Library name is assumed to be 'mylib' in 'mylib.dart' file. |
72 */ | 72 */ |
73 testDart2DartWithLibrary( | 73 testDart2DartWithLibrary( |
(...skipping 12 matching lines...) Expand all Loading... |
86 } | 86 } |
87 if (uri.path.endsWith('/core.dart')) return new Future.immediate(coreLib); | 87 if (uri.path.endsWith('/core.dart')) return new Future.immediate(coreLib); |
88 if (uri.path.endsWith('/io.dart')) return new Future.immediate(ioLib); | 88 if (uri.path.endsWith('/io.dart')) return new Future.immediate(ioLib); |
89 if (uri.path.endsWith('/js_helper.dart')) return new Future.immediate(helper
Lib); | 89 if (uri.path.endsWith('/js_helper.dart')) return new Future.immediate(helper
Lib); |
90 // TODO(smok): The file should change to html_dartium at some point. | 90 // TODO(smok): The file should change to html_dartium at some point. |
91 if (uri.path.endsWith('/html_dart2js.dart')) return new Future.immediate(htm
lLib); | 91 if (uri.path.endsWith('/html_dart2js.dart')) return new Future.immediate(htm
lLib); |
92 return new Future.immediate(''); | 92 return new Future.immediate(''); |
93 } | 93 } |
94 | 94 |
95 handler(uri, begin, end, message, kind) { | 95 handler(uri, begin, end, message, kind) { |
96 if (kind === Diagnostic.ERROR || kind === Diagnostic.CRASH) { | 96 if (identical(kind, Diagnostic.ERROR) || identical(kind, Diagnostic.CRASH))
{ |
97 Expect.fail('$uri: $begin-$end: $message [$kind]'); | 97 Expect.fail('$uri: $begin-$end: $message [$kind]'); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 final options = <String>['--output-type=dart']; | 101 final options = <String>['--output-type=dart']; |
102 if (minify) options.add('--minify'); | 102 if (minify) options.add('--minify'); |
103 if (stripTypes) options.add('--force-strip=types'); | 103 if (stripTypes) options.add('--force-strip=types'); |
104 | 104 |
105 compile( | 105 compile( |
106 scriptUri, | 106 scriptUri, |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 testDoubleMains(); | 716 testDoubleMains(); |
717 testStaticAccessIoLib(); | 717 testStaticAccessIoLib(); |
718 testLocalFunctionPlaceholder(); | 718 testLocalFunctionPlaceholder(); |
719 testMinification(); | 719 testMinification(); |
720 testClosureLocalsMinified(); | 720 testClosureLocalsMinified(); |
721 testParametersMinified(); | 721 testParametersMinified(); |
722 testDeclarationTypePlaceholders(); | 722 testDeclarationTypePlaceholders(); |
723 testPlatformLibraryMemberNamesAreFixed(); | 723 testPlatformLibraryMemberNamesAreFixed(); |
724 testConflictsWithCoreLib(); | 724 testConflictsWithCoreLib(); |
725 } | 725 } |
OLD | NEW |