| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 /// These transformations should be optimizations and not required for | 114 /// These transformations should be optimizations and not required for |
| 115 /// correctness. Everything should work if a simple and fast linker chooses | 115 /// correctness. Everything should work if a simple and fast linker chooses |
| 116 /// not to apply these transformations. | 116 /// not to apply these transformations. |
| 117 /// | 117 /// |
| 118 /// Note that [performGlobalTransformations] doesn't have -OnProgram and | 118 /// Note that [performGlobalTransformations] doesn't have -OnProgram and |
| 119 /// -OnLibraries alternatives, because the global knowledge required by the | 119 /// -OnLibraries alternatives, because the global knowledge required by the |
| 120 /// transformations is assumed to be retrieved from a [Program] instance. | 120 /// transformations is assumed to be retrieved from a [Program] instance. |
| 121 void performGlobalTransformations(CoreTypes coreTypes, Program program, | 121 void performGlobalTransformations(CoreTypes coreTypes, Program program, |
| 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`, | |
| 125 /// `int`, `double`, `num`, and `String`. | |
| 126 /// | |
| 127 /// By default only `dart:core` may define restricted types, but some target | |
| 128 /// implementations override this. | |
| 129 bool mayDefineRestrictedType(Uri uri) => | |
| 130 uri.scheme == 'dart' && uri.path == 'core'; | |
| 131 | |
| 132 /// Whether the `native` language extension is supported within [library]. | |
| 133 /// | |
| 134 /// 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 | |
| 136 /// circumstances for each target implementation. For example, the VM target | |
| 137 /// enables it everywhere because of existing support for "dart-ext:" native | |
| 138 /// extensions, but targets like dart2js only enable it on the core libraries. | |
| 139 bool enableNative(Uri uri) => false; | |
| 140 | |
| 141 /// There are two variants of the `native` language extension. The VM expects | |
| 142 /// the native token to be followed by string, whereas dart2js and DDC do not. | |
| 143 // TODO(sigmund, ahe): ideally we should remove the `native` syntax, if not, | |
| 144 // we should at least unify the VM and non-VM variants. | |
| 145 bool get nativeExtensionExpectsString => false; | |
| 146 | |
| 147 /// Builds an expression that instantiates an [Invocation] that can be passed | 124 /// Builds an expression that instantiates an [Invocation] that can be passed |
| 148 /// to [noSuchMethod]. | 125 /// to [noSuchMethod]. |
| 149 Expression instantiateInvocation(CoreTypes coreTypes, Expression receiver, | 126 Expression instantiateInvocation(CoreTypes coreTypes, Expression receiver, |
| 150 String name, Arguments arguments, int offset, bool isSuper); | 127 String name, Arguments arguments, int offset, bool isSuper); |
| 151 | 128 |
| 152 Expression instantiateNoSuchMethodError(CoreTypes coreTypes, | 129 Expression instantiateNoSuchMethodError(CoreTypes coreTypes, |
| 153 Expression receiver, String name, Arguments arguments, int offset, | 130 Expression receiver, String name, Arguments arguments, int offset, |
| 154 {bool isMethod: false, | 131 {bool isMethod: false, |
| 155 bool isGetter: false, | 132 bool isGetter: false, |
| 156 bool isSetter: false, | 133 bool isSetter: false, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 bool isField: false, | 199 bool isField: false, |
| 223 bool isLocalVariable: false, | 200 bool isLocalVariable: false, |
| 224 bool isDynamic: false, | 201 bool isDynamic: false, |
| 225 bool isSuper: false, | 202 bool isSuper: false, |
| 226 bool isStatic: false, | 203 bool isStatic: false, |
| 227 bool isConstructor: false, | 204 bool isConstructor: false, |
| 228 bool isTopLevel: false}) { | 205 bool isTopLevel: false}) { |
| 229 return new InvalidExpression(); | 206 return new InvalidExpression(); |
| 230 } | 207 } |
| 231 } | 208 } |
| OLD | NEW |