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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 assert(loadedLibraries.containsLibrary(DART_INTERCEPTORS)); | 340 assert(loadedLibraries.containsLibrary(DART_INTERCEPTORS)); |
341 assert(loadedLibraries.containsLibrary(DART_JS_HELPER)); | 341 assert(loadedLibraries.containsLibrary(DART_JS_HELPER)); |
342 | 342 |
343 if (jsInvocationMirrorClass != null) { | 343 if (jsInvocationMirrorClass != null) { |
344 jsInvocationMirrorClass.ensureResolved(resolution); | 344 jsInvocationMirrorClass.ensureResolved(resolution); |
345 invokeOnMethod = jsInvocationMirrorClass.lookupLocalMember(INVOKE_ON); | 345 invokeOnMethod = jsInvocationMirrorClass.lookupLocalMember(INVOKE_ON); |
346 } | 346 } |
347 | 347 |
348 // [LinkedHashMap] is reexported from dart:collection and can therefore not | 348 // [LinkedHashMap] is reexported from dart:collection and can therefore not |
349 // be loaded from dart:core in [onLibraryScanned]. | 349 // be loaded from dart:core in [onLibraryScanned]. |
350 mapLiteralClass = compiler.coreLibrary.find('LinkedHashMap'); | 350 mapLiteralClass = compiler.commonElements.coreLibrary.find('LinkedHashMap'); |
351 assert(invariant(compiler.coreLibrary, mapLiteralClass != null, | 351 assert(invariant( |
| 352 compiler.commonElements.coreLibrary, mapLiteralClass != null, |
352 message: "Element 'LinkedHashMap' not found in 'dart:core'.")); | 353 message: "Element 'LinkedHashMap' not found in 'dart:core'.")); |
353 | 354 |
354 // TODO(kasperl): Some tests do not define the special JSArray | 355 // TODO(kasperl): Some tests do not define the special JSArray |
355 // subclasses, so we check to see if they are defined before | 356 // subclasses, so we check to see if they are defined before |
356 // trying to resolve them. | 357 // trying to resolve them. |
357 if (jsFixedArrayClass != null) { | 358 if (jsFixedArrayClass != null) { |
358 jsFixedArrayClass.ensureResolved(resolution); | 359 jsFixedArrayClass.ensureResolved(resolution); |
359 } | 360 } |
360 if (jsExtendableArrayClass != null) { | 361 if (jsExtendableArrayClass != null) { |
361 jsExtendableArrayClass.ensureResolved(resolution); | 362 jsExtendableArrayClass.ensureResolved(resolution); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 return classElement; | 615 return classElement; |
615 } | 616 } |
616 | 617 |
617 Element get syncStarIterableConstructor { | 618 Element get syncStarIterableConstructor { |
618 ClassElement classElement = syncStarIterable; | 619 ClassElement classElement = syncStarIterable; |
619 classElement.ensureResolved(resolution); | 620 classElement.ensureResolved(resolution); |
620 return classElement.lookupConstructor(""); | 621 return classElement.lookupConstructor(""); |
621 } | 622 } |
622 | 623 |
623 Element get syncCompleterConstructor { | 624 Element get syncCompleterConstructor { |
624 ClassElement classElement = find(compiler.asyncLibrary, "Completer"); | 625 ClassElement classElement = find(asyncLibrary, "Completer"); |
625 classElement.ensureResolved(resolution); | 626 classElement.ensureResolved(resolution); |
626 return classElement.lookupConstructor("sync"); | 627 return classElement.lookupConstructor("sync"); |
627 } | 628 } |
628 | 629 |
629 Element get asyncStarController { | 630 Element get asyncStarController { |
630 ClassElement classElement = findAsyncHelper("_AsyncStarStreamController"); | 631 ClassElement classElement = findAsyncHelper("_AsyncStarStreamController"); |
631 classElement.ensureResolved(resolution); | 632 classElement.ensureResolved(resolution); |
632 return classElement; | 633 return classElement; |
633 } | 634 } |
634 | 635 |
635 Element get asyncStarControllerConstructor { | 636 Element get asyncStarControllerConstructor { |
636 ClassElement classElement = asyncStarController; | 637 ClassElement classElement = asyncStarController; |
637 return classElement.lookupConstructor(""); | 638 return classElement.lookupConstructor(""); |
638 } | 639 } |
639 | 640 |
640 Element get streamIteratorConstructor { | 641 Element get streamIteratorConstructor { |
641 ClassElement classElement = find(compiler.asyncLibrary, "StreamIterator"); | 642 ClassElement classElement = find(asyncLibrary, "StreamIterator"); |
642 classElement.ensureResolved(resolution); | 643 classElement.ensureResolved(resolution); |
643 return classElement.lookupConstructor(""); | 644 return classElement.lookupConstructor(""); |
644 } | 645 } |
645 | 646 |
646 ClassElement get VoidRuntimeType { | 647 ClassElement get VoidRuntimeType { |
647 return findHelper('VoidRuntimeType'); | 648 return findHelper('VoidRuntimeType'); |
648 } | 649 } |
649 | 650 |
650 ClassElement get RuntimeType { | 651 ClassElement get RuntimeType { |
651 return findHelper('RuntimeType'); | 652 return findHelper('RuntimeType'); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 MethodElement _objectNoSuchMethod; | 703 MethodElement _objectNoSuchMethod; |
703 | 704 |
704 MethodElement get objectNoSuchMethod { | 705 MethodElement get objectNoSuchMethod { |
705 if (_objectNoSuchMethod == null) { | 706 if (_objectNoSuchMethod == null) { |
706 _objectNoSuchMethod = | 707 _objectNoSuchMethod = |
707 coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_); | 708 coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_); |
708 } | 709 } |
709 return _objectNoSuchMethod; | 710 return _objectNoSuchMethod; |
710 } | 711 } |
711 } | 712 } |
OLD | NEW |