OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.target.targets; | 4 library kernel.target.targets; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../class_hierarchy.dart'; | 7 import '../class_hierarchy.dart'; |
8 import '../core_types.dart'; | 8 import '../core_types.dart'; |
9 import '../transformations/treeshaker.dart' show ProgramRoot; | 9 import '../transformations/treeshaker.dart' show ProgramRoot; |
10 import 'flutter.dart' show FlutterTarget; | 10 import 'flutter.dart' show FlutterTarget; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 {void logger(String msg)}); | 122 {void logger(String msg)}); |
123 | 123 |
124 /// Whether a platform library may define a restricted type, such as `bool`, | 124 /// Whether a platform library may define a restricted type, such as `bool`, |
125 /// `int`, `double`, `num`, and `String`. | 125 /// `int`, `double`, `num`, and `String`. |
126 /// | 126 /// |
127 /// By default only `dart:core` may define restricted types, but some target | 127 /// By default only `dart:core` may define restricted types, but some target |
128 /// implementations override this. | 128 /// implementations override this. |
129 bool mayDefineRestrictedType(Uri uri) => | 129 bool mayDefineRestrictedType(Uri uri) => |
130 uri.scheme == 'dart' && uri.path == 'core'; | 130 uri.scheme == 'dart' && uri.path == 'core'; |
131 | 131 |
| 132 /// Whether a library is allowed to import a platform private library. |
| 133 /// |
| 134 /// By default only `dart:*` libraries are allowed. May be overriden for |
| 135 /// testing purposes. |
| 136 bool allowPlatformPrivateLibraryAccess(Uri importer, Uri imported) => |
| 137 imported.scheme != "dart" || |
| 138 !imported.path.startsWith("_") || |
| 139 importer.scheme == "dart"; |
| 140 |
132 /// Whether the `native` language extension is supported within [library]. | 141 /// Whether the `native` language extension is supported within [library]. |
133 /// | 142 /// |
134 /// The `native` language extension is not part of the language specification, | 143 /// The `native` language extension is not part of the language specification, |
135 /// it means something else to each target, and it is enabled under different | 144 /// it means something else to each target, and it is enabled under different |
136 /// circumstances for each target implementation. For example, the VM target | 145 /// circumstances for each target implementation. For example, the VM target |
137 /// enables it everywhere because of existing support for "dart-ext:" native | 146 /// enables it everywhere because of existing support for "dart-ext:" native |
138 /// extensions, but targets like dart2js only enable it on the core libraries. | 147 /// extensions, but targets like dart2js only enable it on the core libraries. |
139 bool enableNative(Uri uri) => false; | 148 bool enableNative(Uri uri) => false; |
140 | 149 |
141 /// There are two variants of the `native` language extension. The VM expects | 150 /// There are two variants of the `native` language extension. The VM expects |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 bool isField: false, | 231 bool isField: false, |
223 bool isLocalVariable: false, | 232 bool isLocalVariable: false, |
224 bool isDynamic: false, | 233 bool isDynamic: false, |
225 bool isSuper: false, | 234 bool isSuper: false, |
226 bool isStatic: false, | 235 bool isStatic: false, |
227 bool isConstructor: false, | 236 bool isConstructor: false, |
228 bool isTopLevel: false}) { | 237 bool isTopLevel: false}) { |
229 return new InvalidExpression(); | 238 return new InvalidExpression(); |
230 } | 239 } |
231 } | 240 } |
OLD | NEW |