| 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 '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 .mapToList((cu) => new Dart2JsCompilationUnitMirror(cu, library)); | 456 .mapToList((cu) => new Dart2JsCompilationUnitMirror(cu, library)); |
| 457 } | 457 } |
| 458 | 458 |
| 459 static Iterable<ConstantExpression> metadataSyntaxOf( | 459 static Iterable<ConstantExpression> metadataSyntaxOf( |
| 460 Dart2JsElementMirror declaration) { | 460 Dart2JsElementMirror declaration) { |
| 461 return declaration._element.metadata.map((metadata) => metadata.constant); | 461 return declaration._element.metadata.map((metadata) => metadata.constant); |
| 462 } | 462 } |
| 463 | 463 |
| 464 static ConstantExpression initializerSyntaxOf(Dart2JsFieldMirror variable) { | 464 static ConstantExpression initializerSyntaxOf(Dart2JsFieldMirror variable) { |
| 465 Compiler compiler = variable.mirrorSystem.compiler; | 465 Compiler compiler = variable.mirrorSystem.compiler; |
| 466 return compiler.constants.getConstantForVariable(variable._variable); | 466 return variable._variable.constant; |
| 467 } | 467 } |
| 468 | 468 |
| 469 static ConstantExpression defaultValueSyntaxOf( | 469 static ConstantExpression defaultValueSyntaxOf( |
| 470 Dart2JsParameterMirror parameter) { | 470 Dart2JsParameterMirror parameter) { |
| 471 if (!parameter.hasDefaultValue) return null; | 471 if (!parameter.hasDefaultValue) return null; |
| 472 ParameterElement parameterElement = parameter._element; | 472 ParameterElement parameterElement = parameter._element; |
| 473 Compiler compiler = parameter.mirrorSystem.compiler; | 473 Compiler compiler = parameter.mirrorSystem.compiler; |
| 474 return compiler.constants.getConstantForVariable(parameterElement); | 474 return parameterElement.constant; |
| 475 } | 475 } |
| 476 | 476 |
| 477 static Mirror getMirrorFromElement(Dart2JsMirror mirror, Element element) { | 477 static Mirror getMirrorFromElement(Dart2JsMirror mirror, Element element) { |
| 478 return _convertElementToDeclarationMirror(mirror.mirrorSystem, element); | 478 return _convertElementToDeclarationMirror(mirror.mirrorSystem, element); |
| 479 } | 479 } |
| 480 } | 480 } |
| OLD | NEW |