| 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, UnmodifiableMapView; | 7 import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView; |
| 8 | 8 |
| 9 import '../cps_ir/const_expression.dart'; |
| 9 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| 10 import '../scanner/scannerlib.dart'; | 11 import '../scanner/scannerlib.dart'; |
| 11 import '../resolution/resolution.dart' show Scope; | 12 import '../resolution/resolution.dart' show Scope; |
| 12 import '../dart2jslib.dart'; | 13 import '../dart2jslib.dart'; |
| 13 import '../dart_types.dart'; | 14 import '../dart_types.dart'; |
| 14 import '../tree/tree.dart'; | 15 import '../tree/tree.dart'; |
| 15 import '../util/util.dart' | 16 import '../util/util.dart' |
| 16 show Link, | 17 show Link, |
| 17 LinkBuilder; | 18 LinkBuilder; |
| 18 import '../util/characters.dart' show $CR, $LF; | 19 import '../util/characters.dart' show $CR, $LF; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 215 } |
| 215 } | 216 } |
| 216 | 217 |
| 217 List<InstanceMirror> get metadata { | 218 List<InstanceMirror> get metadata { |
| 218 if (_metadata == null) { | 219 if (_metadata == null) { |
| 219 _metadata = <InstanceMirror>[]; | 220 _metadata = <InstanceMirror>[]; |
| 220 for (MetadataAnnotation metadata in _element.metadata) { | 221 for (MetadataAnnotation metadata in _element.metadata) { |
| 221 _appendCommentTokens( | 222 _appendCommentTokens( |
| 222 mirrorSystem.compiler.commentMap[metadata.beginToken]); | 223 mirrorSystem.compiler.commentMap[metadata.beginToken]); |
| 223 metadata.ensureResolved(mirrorSystem.compiler); | 224 metadata.ensureResolved(mirrorSystem.compiler); |
| 224 _metadata.add(_convertConstantToInstanceMirror(mirrorSystem, | 225 _metadata.add(_convertConstantToInstanceMirror( |
| 225 metadata.value)); | 226 mirrorSystem, metadata.constant, metadata.constant.value)); |
| 226 } | 227 } |
| 227 _appendCommentTokens(mirrorSystem.compiler.commentMap[getBeginToken()]); | 228 _appendCommentTokens(mirrorSystem.compiler.commentMap[getBeginToken()]); |
| 228 } | 229 } |
| 229 // TODO(johnniwinther): Return an unmodifiable list instead. | 230 // TODO(johnniwinther): Return an unmodifiable list instead. |
| 230 return new List<InstanceMirror>.from(_metadata); | 231 return new List<InstanceMirror>.from(_metadata); |
| 231 } | 232 } |
| 232 | 233 |
| 233 DeclarationMirror lookupInScope(String name) { | 234 DeclarationMirror lookupInScope(String name) { |
| 234 // TODO(11653): Support lookup of constructors. | 235 // TODO(11653): Support lookup of constructors. |
| 235 Scope scope = _element.buildScope(); | 236 Scope scope = _element.buildScope(); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 } | 491 } |
| 491 | 492 |
| 492 static ResolvedNode defaultValueSyntaxOf(Dart2JsParameterMirror parameter) { | 493 static ResolvedNode defaultValueSyntaxOf(Dart2JsParameterMirror parameter) { |
| 493 if (!parameter.hasDefaultValue) return null; | 494 if (!parameter.hasDefaultValue) return null; |
| 494 ParameterElement parameterElement = parameter._element; | 495 ParameterElement parameterElement = parameter._element; |
| 495 var node = parameterElement.initializer; | 496 var node = parameterElement.initializer; |
| 496 var treeElements = parameterElement.treeElements; | 497 var treeElements = parameterElement.treeElements; |
| 497 return new ResolvedNode(node, treeElements, parameter.mirrorSystem); | 498 return new ResolvedNode(node, treeElements, parameter.mirrorSystem); |
| 498 } | 499 } |
| 499 } | 500 } |
| OLD | NEW |