| 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 | 4 |
| 5 library kernel.transformations.continuation; | 5 library kernel.transformations.continuation; |
| 6 | 6 |
| 7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
| 8 | 8 |
| 9 import '../ast.dart'; | 9 import '../ast.dart'; |
| 10 import '../visitor.dart'; | 10 import '../visitor.dart'; |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 } | 856 } |
| 857 } | 857 } |
| 858 throw 'Procedure "$name" not found'; | 858 throw 'Procedure "$name" not found'; |
| 859 } | 859 } |
| 860 | 860 |
| 861 var asyncLibrary = findLibrary('dart:async'); | 861 var asyncLibrary = findLibrary('dart:async'); |
| 862 var coreLibrary = findLibrary('dart:core'); | 862 var coreLibrary = findLibrary('dart:core'); |
| 863 | 863 |
| 864 var completerClass = findClass(asyncLibrary, 'Completer'); | 864 var completerClass = findClass(asyncLibrary, 'Completer'); |
| 865 var futureClass = findClass(asyncLibrary, 'Future'); | 865 var futureClass = findClass(asyncLibrary, 'Future'); |
| 866 var streamIteratorClass = findClass(asyncLibrary, '_StreamIterator'); | 866 |
| 867 // The VM's dart:async implementation has renamed _StreamIteratorImpl to |
| 868 // _StreamIterator. To support both old and new library implementations we |
| 869 // look for the old name first and then the new name. |
| 870 var streamIteratorClass; |
| 871 try { |
| 872 streamIteratorClass = findClass(asyncLibrary, '_StreamIteratorImpl'); |
| 873 } catch (e) { |
| 874 if (e == 'Class "_StreamIteratorImpl" not found') { |
| 875 streamIteratorClass = findClass(asyncLibrary, '_StreamIterator'); |
| 876 } else { |
| 877 rethrow; |
| 878 } |
| 879 } |
| 880 |
| 867 var syncIterableClass = findClass(coreLibrary, '_SyncIterable'); | 881 var syncIterableClass = findClass(coreLibrary, '_SyncIterable'); |
| 868 var streamControllerClass = | 882 var streamControllerClass = |
| 869 findClass(asyncLibrary, '_AsyncStarStreamController'); | 883 findClass(asyncLibrary, '_AsyncStarStreamController'); |
| 870 | 884 |
| 871 return new HelperNodes( | 885 return new HelperNodes( |
| 872 asyncLibrary, | 886 asyncLibrary, |
| 873 coreLibrary, | 887 coreLibrary, |
| 874 findProcedure(coreLibrary, 'print'), | 888 findProcedure(coreLibrary, 'print'), |
| 875 findFactoryConstructor(completerClass, 'sync'), | 889 findFactoryConstructor(completerClass, 'sync'), |
| 876 findConstructor(syncIterableClass, ''), | 890 findConstructor(syncIterableClass, ''), |
| 877 findConstructor(streamIteratorClass, ''), | 891 findConstructor(streamIteratorClass, ''), |
| 878 findFactoryConstructor(futureClass, 'microtask'), | 892 findFactoryConstructor(futureClass, 'microtask'), |
| 879 findConstructor(streamControllerClass, ''), | 893 findConstructor(streamControllerClass, ''), |
| 880 findProcedure(asyncLibrary, '_asyncThenWrapperHelper'), | 894 findProcedure(asyncLibrary, '_asyncThenWrapperHelper'), |
| 881 findProcedure(asyncLibrary, '_asyncErrorWrapperHelper'), | 895 findProcedure(asyncLibrary, '_asyncErrorWrapperHelper'), |
| 882 findProcedure(asyncLibrary, '_awaitHelper')); | 896 findProcedure(asyncLibrary, '_awaitHelper')); |
| 883 } | 897 } |
| 884 } | 898 } |
| OLD | NEW |