| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 mirrors_dart2js; | 5 library mirrors_dart2js; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection' show LinkedHashMap; | |
| 9 | 8 |
| 10 import '../../compiler.dart' as api; | 9 import '../../compiler.dart' as api; |
| 11 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| 12 import '../apiimpl.dart' as apiimpl; | 11 import '../apiimpl.dart' as apiimpl; |
| 13 import '../scanner/scannerlib.dart' hide SourceString; | 12 import '../scanner/scannerlib.dart' hide SourceString; |
| 14 import '../resolution/resolution.dart' show Scope; | 13 import '../resolution/resolution.dart' show Scope; |
| 15 import '../dart2jslib.dart'; | 14 import '../dart2jslib.dart'; |
| 16 import '../dart_types.dart'; | 15 import '../dart_types.dart'; |
| 17 import '../tree/tree.dart'; | 16 import '../tree/tree.dart'; |
| 18 import '../util/util.dart' show Spannable, Link; | 17 import '../util/util.dart' show Spannable, Link; |
| (...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 Map<String,Constant> _fieldMapCache; | 1593 Map<String,Constant> _fieldMapCache; |
| 1595 | 1594 |
| 1596 Dart2JsConstructedConstantMirror(Dart2JsMirrorSystem mirrors, | 1595 Dart2JsConstructedConstantMirror(Dart2JsMirrorSystem mirrors, |
| 1597 ConstructedConstant constant) | 1596 ConstructedConstant constant) |
| 1598 : super(mirrors, constant); | 1597 : super(mirrors, constant); |
| 1599 | 1598 |
| 1600 ConstructedConstant get _constant => super._constant; | 1599 ConstructedConstant get _constant => super._constant; |
| 1601 | 1600 |
| 1602 Map<String,Constant> get _fieldMap { | 1601 Map<String,Constant> get _fieldMap { |
| 1603 if (_fieldMapCache == null) { | 1602 if (_fieldMapCache == null) { |
| 1604 _fieldMapCache = new LinkedHashMap<String,Constant>(); | 1603 _fieldMapCache = new Map<String,Constant>(); |
| 1605 if (identical(_constant.type.element.kind, ElementKind.CLASS)) { | 1604 if (identical(_constant.type.element.kind, ElementKind.CLASS)) { |
| 1606 var index = 0; | 1605 var index = 0; |
| 1607 ClassElement element = _constant.type.element; | 1606 ClassElement element = _constant.type.element; |
| 1608 element.forEachInstanceField((_, Element field) { | 1607 element.forEachInstanceField((_, Element field) { |
| 1609 String fieldName = field.name.slowToString(); | 1608 String fieldName = field.name.slowToString(); |
| 1610 _fieldMapCache.putIfAbsent(fieldName, () => _constant.fields[index]); | 1609 _fieldMapCache.putIfAbsent(fieldName, () => _constant.fields[index]); |
| 1611 index++; | 1610 index++; |
| 1612 }, includeSuperAndInjectedMembers: true); | 1611 }, includeSuperAndInjectedMembers: true); |
| 1613 } | 1612 } |
| 1614 } | 1613 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 * | 1749 * |
| 1751 * All API in this class is experimental. | 1750 * All API in this class is experimental. |
| 1752 */ | 1751 */ |
| 1753 class BackDoor { | 1752 class BackDoor { |
| 1754 /// Return the compilation units comprising [library]. | 1753 /// Return the compilation units comprising [library]. |
| 1755 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { | 1754 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { |
| 1756 return library._library.compilationUnits.toList().map( | 1755 return library._library.compilationUnits.toList().map( |
| 1757 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); | 1756 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); |
| 1758 } | 1757 } |
| 1759 } | 1758 } |
| OLD | NEW |