| 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 dart2js.mirrors; | 5 library dart2js.mirrors; |
| 6 | 6 |
| 7 import 'dart:collection' show UnmodifiableListView; | 7 import 'dart:collection' show UnmodifiableListView; |
| 8 | 8 |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../scanner/scannerlib.dart'; | 10 import '../scanner/scannerlib.dart'; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 List<InstanceMirror> get metadata { | 226 List<InstanceMirror> get metadata { |
| 227 if (_metadata == null) { | 227 if (_metadata == null) { |
| 228 _metadata = <InstanceMirror>[]; | 228 _metadata = <InstanceMirror>[]; |
| 229 for (MetadataAnnotation metadata in _element.metadata) { | 229 for (MetadataAnnotation metadata in _element.metadata) { |
| 230 _appendCommentTokens( | 230 _appendCommentTokens( |
| 231 mirrorSystem.compiler.commentMap[metadata.beginToken]); | 231 mirrorSystem.compiler.commentMap[metadata.beginToken]); |
| 232 metadata.ensureResolved(mirrorSystem.compiler); | 232 metadata.ensureResolved(mirrorSystem.compiler); |
| 233 _metadata.add( | 233 _metadata.add(_convertConstantToInstanceMirror(mirrorSystem, |
| 234 _convertConstantToInstanceMirror(mirrorSystem, metadata.value)); | 234 metadata.value)); |
| 235 } | 235 } |
| 236 _appendCommentTokens(mirrorSystem.compiler.commentMap[getBeginToken()]); | 236 _appendCommentTokens(mirrorSystem.compiler.commentMap[getBeginToken()]); |
| 237 } | 237 } |
| 238 // TODO(johnniwinther): Return an unmodifiable list instead. | 238 // TODO(johnniwinther): Return an unmodifiable list instead. |
| 239 return new List<InstanceMirror>.from(_metadata); | 239 return new List<InstanceMirror>.from(_metadata); |
| 240 } | 240 } |
| 241 | 241 |
| 242 DeclarationMirror lookupInScope(String name) { | 242 DeclarationMirror lookupInScope(String name) { |
| 243 // TODO(11653): Support lookup of constructors. | 243 // TODO(11653): Support lookup of constructors. |
| 244 Scope scope = _element.buildScope(); | 244 Scope scope = _element.buildScope(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 * | 458 * |
| 459 * All API in this class is experimental. | 459 * All API in this class is experimental. |
| 460 */ | 460 */ |
| 461 class BackDoor { | 461 class BackDoor { |
| 462 /// Return the compilation units comprising [library]. | 462 /// Return the compilation units comprising [library]. |
| 463 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { | 463 static List<Mirror> compilationUnitsOf(Dart2JsLibraryMirror library) { |
| 464 return library._element.compilationUnits.toList().map( | 464 return library._element.compilationUnits.toList().map( |
| 465 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); | 465 (cu) => new Dart2JsCompilationUnitMirror(cu, library)).toList(); |
| 466 } | 466 } |
| 467 } | 467 } |
| OLD | NEW |