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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 /// These transformations should be optimizations and not required for | 107 /// These transformations should be optimizations and not required for |
108 /// correctness. Everything should work if a simple and fast linker chooses | 108 /// correctness. Everything should work if a simple and fast linker chooses |
109 /// not to apply these transformations. | 109 /// not to apply these transformations. |
110 /// | 110 /// |
111 /// Note that [performGlobalTransformations] doesn't have -OnProgram and | 111 /// Note that [performGlobalTransformations] doesn't have -OnProgram and |
112 /// -OnLibraries alternatives, because the global knowledge required by the | 112 /// -OnLibraries alternatives, because the global knowledge required by the |
113 /// transformations is assumed to be retrieved from a [Program] instance. | 113 /// transformations is assumed to be retrieved from a [Program] instance. |
114 void performGlobalTransformations(CoreTypes coreTypes, Program program, | 114 void performGlobalTransformations(CoreTypes coreTypes, Program program, |
115 {void logger(String msg)}); | 115 {void logger(String msg)}); |
116 | 116 |
| 117 /// Whether a platform library may define a restricted type, such as `bool`, |
| 118 /// `int`, `double`, `num`, and `String`. |
| 119 /// |
| 120 /// By default only `dart:core` may define restricted types, but some target |
| 121 /// implementations override this. |
| 122 bool mayDefineRestrictedType(Uri uri) => |
| 123 uri.scheme == 'dart' && uri.path == 'core'; |
| 124 |
| 125 /// Whether the `native` language extension is supported within [library]. |
| 126 /// |
| 127 /// The `native` language extension is not part of the language specification, |
| 128 /// it means something else to each target, and it is enabled under different |
| 129 /// circumstances for each target implementation. For example, the VM target |
| 130 /// enables it everywhere because of existing support for "dart-ext:" native |
| 131 /// extensions, but targets like dart2js only enable it on the core libraries. |
| 132 bool enableNative(Uri uri) => false; |
| 133 |
| 134 /// There are two variants of the `native` language extension. The VM expects |
| 135 /// the native token to be followed by string, whereas dart2js and DDC do not. |
| 136 // TODO(sigmund, ahe): ideally we should remove the `native` syntax, if not, |
| 137 // we should at least unify the VM and non-VM variants. |
| 138 bool get nativeExtensionExpectsString => false; |
| 139 |
117 /// Builds an expression that instantiates an [Invocation] that can be passed | 140 /// Builds an expression that instantiates an [Invocation] that can be passed |
118 /// to [noSuchMethod]. | 141 /// to [noSuchMethod]. |
119 Expression instantiateInvocation(CoreTypes coreTypes, Expression receiver, | 142 Expression instantiateInvocation(CoreTypes coreTypes, Expression receiver, |
120 String name, Arguments arguments, int offset, bool isSuper); | 143 String name, Arguments arguments, int offset, bool isSuper); |
121 | 144 |
122 Expression instantiateNoSuchMethodError(CoreTypes coreTypes, | 145 Expression instantiateNoSuchMethodError(CoreTypes coreTypes, |
123 Expression receiver, String name, Arguments arguments, int offset, | 146 Expression receiver, String name, Arguments arguments, int offset, |
124 {bool isMethod: false, | 147 {bool isMethod: false, |
125 bool isGetter: false, | 148 bool isGetter: false, |
126 bool isSetter: false, | 149 bool isSetter: false, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 bool isField: false, | 215 bool isField: false, |
193 bool isLocalVariable: false, | 216 bool isLocalVariable: false, |
194 bool isDynamic: false, | 217 bool isDynamic: false, |
195 bool isSuper: false, | 218 bool isSuper: false, |
196 bool isStatic: false, | 219 bool isStatic: false, |
197 bool isConstructor: false, | 220 bool isConstructor: false, |
198 bool isTopLevel: false}) { | 221 bool isTopLevel: false}) { |
199 return new InvalidExpression(); | 222 return new InvalidExpression(); |
200 } | 223 } |
201 } | 224 } |
OLD | NEW |