| 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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 // From dart:_isolate_helper | 1078 // From dart:_isolate_helper |
| 1079 | 1079 |
| 1080 FunctionEntity get startRootIsolate => | 1080 FunctionEntity get startRootIsolate => |
| 1081 _findLibraryMember(isolateHelperLibrary, 'startRootIsolate'); | 1081 _findLibraryMember(isolateHelperLibrary, 'startRootIsolate'); |
| 1082 | 1082 |
| 1083 FunctionEntity get currentIsolate => | 1083 FunctionEntity get currentIsolate => |
| 1084 _findLibraryMember(isolateHelperLibrary, '_currentIsolate'); | 1084 _findLibraryMember(isolateHelperLibrary, '_currentIsolate'); |
| 1085 | 1085 |
| 1086 FunctionEntity get callInIsolate => | 1086 FunctionEntity get callInIsolate => |
| 1087 _findLibraryMember(isolateHelperLibrary, '_callInIsolate'); | 1087 _findLibraryMember(isolateHelperLibrary, '_callInIsolate'); |
| 1088 |
| 1089 static final Uri PACKAGE_EXPECT = |
| 1090 new Uri(scheme: 'package', path: 'expect/expect.dart'); |
| 1091 |
| 1092 bool _expectAnnotationChecked = false; |
| 1093 ClassEntity _expectNoInlineClass; |
| 1094 ClassEntity _expectTrustTypeAnnotationsClass; |
| 1095 ClassEntity _expectAssumeDynamicClass; |
| 1096 |
| 1097 void _ensureExpectAnnotations() { |
| 1098 if (!_expectAnnotationChecked) { |
| 1099 _expectAnnotationChecked = true; |
| 1100 LibraryEntity library = _env.lookupLibrary(PACKAGE_EXPECT); |
| 1101 if (library != null) { |
| 1102 _expectNoInlineClass = _env.lookupClass(library, 'NoInline'); |
| 1103 _expectTrustTypeAnnotationsClass = |
| 1104 _env.lookupClass(library, 'TrustTypeAnnotations'); |
| 1105 _expectAssumeDynamicClass = _env.lookupClass(library, 'AssumeDynamic'); |
| 1106 if (_expectNoInlineClass == null || |
| 1107 _expectTrustTypeAnnotationsClass == null || |
| 1108 _expectAssumeDynamicClass == null) { |
| 1109 // This is not the package you're looking for. |
| 1110 _expectNoInlineClass = null; |
| 1111 _expectTrustTypeAnnotationsClass = null; |
| 1112 _expectAssumeDynamicClass = null; |
| 1113 } |
| 1114 } |
| 1115 } |
| 1116 } |
| 1117 |
| 1118 ClassEntity get expectNoInlineClass { |
| 1119 _ensureExpectAnnotations(); |
| 1120 return _expectNoInlineClass; |
| 1121 } |
| 1122 |
| 1123 ClassEntity get expectTrustTypeAnnotationsClass { |
| 1124 _ensureExpectAnnotations(); |
| 1125 return _expectTrustTypeAnnotationsClass; |
| 1126 } |
| 1127 |
| 1128 ClassEntity get expectAssumeDynamicClass { |
| 1129 _ensureExpectAnnotations(); |
| 1130 return _expectAssumeDynamicClass; |
| 1131 } |
| 1088 } | 1132 } |
| 1089 | 1133 |
| 1090 /// Interface for accessing libraries, classes and members. | 1134 /// Interface for accessing libraries, classes and members. |
| 1091 /// | 1135 /// |
| 1092 /// The _env makes private and injected members directly available and | 1136 /// The _env makes private and injected members directly available and |
| 1093 /// should therefore not be used to determine scopes. | 1137 /// should therefore not be used to determine scopes. |
| 1094 // TODO(johnniwinther): Split this into an element environment and a type query | 1138 // TODO(johnniwinther): Split this into an element environment and a type query |
| 1095 // interface, the first should only be used during resolution and the latter in | 1139 // interface, the first should only be used during resolution and the latter in |
| 1096 // both resolution and codegen. | 1140 // both resolution and codegen. |
| 1097 abstract class ElementEnvironment { | 1141 abstract class ElementEnvironment { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 DartType getUnaliasedType(DartType type); | 1238 DartType getUnaliasedType(DartType type); |
| 1195 | 1239 |
| 1196 /// Returns the [CallStructure] corresponding to calling [entity] with all | 1240 /// Returns the [CallStructure] corresponding to calling [entity] with all |
| 1197 /// arguments, both required and optional. | 1241 /// arguments, both required and optional. |
| 1198 CallStructure getCallStructure(FunctionEntity entity); | 1242 CallStructure getCallStructure(FunctionEntity entity); |
| 1199 | 1243 |
| 1200 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected | 1244 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected |
| 1201 /// on deferred libraries. | 1245 /// on deferred libraries. |
| 1202 bool isDeferredLoadLibraryGetter(MemberEntity member); | 1246 bool isDeferredLoadLibraryGetter(MemberEntity member); |
| 1203 } | 1247 } |
| OLD | NEW |