| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // TODO(sigmund): rename and move to common/elements.dart | 5 // TODO(sigmund): rename and move to common/elements.dart |
| 6 library dart2js.type_system; | 6 library dart2js.type_system; |
| 7 | 7 |
| 8 import 'common/names.dart' show Identifiers, Uris; | 8 import 'common/names.dart' show Identifiers, Uris; |
| 9 import 'js_backend/constant_system_javascript.dart'; | 9 import 'js_backend/constant_system_javascript.dart'; |
| 10 import 'elements/types.dart'; | 10 import 'elements/types.dart'; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 LibraryEntity _foreignLibrary; | 130 LibraryEntity _foreignLibrary; |
| 131 LibraryEntity get foreignLibrary => | 131 LibraryEntity get foreignLibrary => |
| 132 _foreignLibrary ??= _env.lookupLibrary(Uris.dart__foreign_helper); | 132 _foreignLibrary ??= _env.lookupLibrary(Uris.dart__foreign_helper); |
| 133 | 133 |
| 134 LibraryEntity _isolateHelperLibrary; | 134 LibraryEntity _isolateHelperLibrary; |
| 135 LibraryEntity get isolateHelperLibrary => | 135 LibraryEntity get isolateHelperLibrary => |
| 136 _isolateHelperLibrary ??= _env.lookupLibrary(Uris.dart__isolate_helper); | 136 _isolateHelperLibrary ??= _env.lookupLibrary(Uris.dart__isolate_helper); |
| 137 | 137 |
| 138 /// Reference to the internal library to lookup functions to always inline. | 138 /// Reference to the internal library to lookup functions to always inline. |
| 139 LibraryEntity _internalLibrary; | 139 LibraryEntity _internalLibrary; |
| 140 LibraryEntity get internalLibrary => | 140 LibraryEntity get internalLibrary => _internalLibrary ??= |
| 141 _internalLibrary ??= _env.lookupLibrary(Uris.dart__internal); | 141 _env.lookupLibrary(Uris.dart__internal, required: true); |
| 142 | 142 |
| 143 /// The `NativeTypedData` class from dart:typed_data. | 143 /// The `NativeTypedData` class from dart:typed_data. |
| 144 ClassEntity _typedDataClass; | 144 ClassEntity _typedDataClass; |
| 145 ClassEntity get typedDataClass => | 145 ClassEntity get typedDataClass => |
| 146 _typedDataClass ??= _findClass(typedDataLibrary, 'NativeTypedData'); | 146 _typedDataClass ??= _findClass(typedDataLibrary, 'NativeTypedData'); |
| 147 | 147 |
| 148 /// Constructor of the `Symbol` class. This getter will ensure that `Symbol` | 148 /// Constructor of the `Symbol` class in dart:internal. This getter will |
| 149 /// is resolved and lookup the constructor on demand. | 149 /// ensure that `Symbol` is resolved and lookup the constructor on demand. |
| 150 ConstructorEntity _symbolConstructor; | 150 ConstructorEntity _symbolConstructorTarget; |
| 151 ConstructorEntity get symbolConstructor => | 151 ConstructorEntity get symbolConstructorTarget { |
| 152 // TODO(johnniwinther): Kernel does not include redirecting factories | 152 // TODO(johnniwinther): Kernel does not include redirecting factories |
| 153 // so this cannot be found in kernel. Find a consistent way to handle | 153 // so this cannot be found in kernel. Find a consistent way to handle |
| 154 // this and similar cases. | 154 // this and similar cases. |
| 155 _symbolConstructor ??= _findConstructor(symbolClass, '', required: false); | 155 return _symbolConstructorTarget ??= |
| 156 _findConstructor(symbolImplementationClass, ''); |
| 157 } |
| 156 | 158 |
| 157 /// Whether [element] is the same as [symbolConstructor]. Used to check | 159 /// Whether [element] is the same as [symbolConstructor]. Used to check |
| 158 /// for the constructor without computing it until it is likely to be seen. | 160 /// for the constructor without computing it until it is likely to be seen. |
| 159 // TODO(johnniwinther): Change type of [e] to [MemberEntity]. | 161 // TODO(johnniwinther): Change type of [e] to [MemberEntity]. |
| 160 bool isSymbolConstructor(Entity e) => e == symbolConstructor; | 162 bool isSymbolConstructor(Entity e) { |
| 163 return e == symbolConstructorTarget || |
| 164 e == _findConstructor(symbolClass, '', required: false); |
| 165 } |
| 161 | 166 |
| 162 /// The `MirrorSystem` class in dart:mirrors. | 167 /// The `MirrorSystem` class in dart:mirrors. |
| 163 ClassEntity _mirrorSystemClass; | 168 ClassEntity _mirrorSystemClass; |
| 164 ClassEntity get mirrorSystemClass => _mirrorSystemClass ??= | 169 ClassEntity get mirrorSystemClass => _mirrorSystemClass ??= |
| 165 _findClass(mirrorsLibrary, 'MirrorSystem', required: false); | 170 _findClass(mirrorsLibrary, 'MirrorSystem', required: false); |
| 166 | 171 |
| 167 /// Whether [element] is `MirrorClass.getName`. Used to check for the use of | 172 /// Whether [element] is `MirrorClass.getName`. Used to check for the use of |
| 168 /// that static method without forcing the resolution of the `MirrorSystem` | 173 /// that static method without forcing the resolution of the `MirrorSystem` |
| 169 /// class until it is necessary. | 174 /// class until it is necessary. |
| 170 FunctionEntity _mirrorSystemGetNameFunction; | 175 FunctionEntity _mirrorSystemGetNameFunction; |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 DartType getUnaliasedType(DartType type); | 1243 DartType getUnaliasedType(DartType type); |
| 1239 | 1244 |
| 1240 /// Returns the [CallStructure] corresponding to calling [entity] with all | 1245 /// Returns the [CallStructure] corresponding to calling [entity] with all |
| 1241 /// arguments, both required and optional. | 1246 /// arguments, both required and optional. |
| 1242 CallStructure getCallStructure(FunctionEntity entity); | 1247 CallStructure getCallStructure(FunctionEntity entity); |
| 1243 | 1248 |
| 1244 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected | 1249 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected |
| 1245 /// on deferred libraries. | 1250 /// on deferred libraries. |
| 1246 bool isDeferredLoadLibraryGetter(MemberEntity member); | 1251 bool isDeferredLoadLibraryGetter(MemberEntity member); |
| 1247 } | 1252 } |
| OLD | NEW |