OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.js_backend.helpers; | 5 library dart2js.js_backend.helpers; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/names.dart' show Identifiers, Uris; | 8 import '../common/names.dart' show Identifiers, Uris; |
9 import '../common/resolution.dart' show Resolution; | 9 import '../common/resolution.dart' show Resolution; |
10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 ConstructorElement get symbolValidatedConstructor { | 200 ConstructorElement get symbolValidatedConstructor { |
201 return _symbolValidatedConstructor ??= _findConstructor( | 201 return _symbolValidatedConstructor ??= _findConstructor( |
202 symbolImplementationClass, symbolValidatedConstructorSelector.name); | 202 symbolImplementationClass, symbolValidatedConstructorSelector.name); |
203 } | 203 } |
204 | 204 |
205 // TODO(johnniwinther): Make these private. | 205 // TODO(johnniwinther): Make these private. |
206 // TODO(johnniwinther): Split into _findHelperFunction and _findHelperClass | 206 // TODO(johnniwinther): Split into _findHelperFunction and _findHelperClass |
207 // and add a check that the element has the expected kind. | 207 // and add a check that the element has the expected kind. |
208 Element _findHelper(String name) => _find(jsHelperLibrary, name); | 208 Element _findHelper(String name) => _find(jsHelperLibrary, name); |
209 FunctionElement _findHelperFunction(String name) => | |
210 _find(jsHelperLibrary, name); | |
211 Element _findAsyncHelper(String name) => _find(asyncLibrary, name); | 209 Element _findAsyncHelper(String name) => _find(asyncLibrary, name); |
212 Element _findInterceptor(String name) => _find(interceptorsLibrary, name); | 210 Element _findInterceptor(String name) => _find(interceptorsLibrary, name); |
213 Element _find(LibraryElement library, String name) { | 211 Element _find(LibraryElement library, String name) { |
214 Element element = library.implementation.findLocal(name); | 212 Element element = library.implementation.findLocal(name); |
215 assert(invariant(library, element != null, | 213 assert(invariant(library, element != null, |
216 message: "Element '$name' not found in '${library.canonicalUri}'.")); | 214 message: "Element '$name' not found in '${library.canonicalUri}'.")); |
217 return element; | 215 return element; |
218 } | 216 } |
219 | 217 |
220 Element findCoreHelper(String name) => | 218 Element findCoreHelper(String name) => |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 } | 873 } |
876 | 874 |
877 MethodElement get toStringForNativeObject { | 875 MethodElement get toStringForNativeObject { |
878 return _findHelper('toStringForNativeObject'); | 876 return _findHelper('toStringForNativeObject'); |
879 } | 877 } |
880 | 878 |
881 MethodElement get hashCodeForNativeObject { | 879 MethodElement get hashCodeForNativeObject { |
882 return _findHelper('hashCodeForNativeObject'); | 880 return _findHelper('hashCodeForNativeObject'); |
883 } | 881 } |
884 } | 882 } |
OLD | NEW |