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 '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../scanner/scannerlib.dart'; | 10 import '../scanner/scannerlib.dart'; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 _ensureLibraries(); | 301 _ensureLibraries(); |
302 return _filteredLibraries; | 302 return _filteredLibraries; |
303 } | 303 } |
304 | 304 |
305 Dart2JsLibraryMirror _getLibrary(LibraryElement element) => | 305 Dart2JsLibraryMirror _getLibrary(LibraryElement element) => |
306 _libraryMap[element]; | 306 _libraryMap[element]; |
307 | 307 |
308 Dart2JsMirrorSystem get mirrorSystem => this; | 308 Dart2JsMirrorSystem get mirrorSystem => this; |
309 | 309 |
310 TypeMirror get dynamicType => | 310 TypeMirror get dynamicType => |
311 _convertTypeToTypeMirror(compiler.types.dynamicType); | 311 _convertTypeToTypeMirror(const DynamicType()); |
312 | 312 |
313 TypeMirror get voidType => | 313 TypeMirror get voidType => |
314 _convertTypeToTypeMirror(const VoidType()); | 314 _convertTypeToTypeMirror(const VoidType()); |
315 | 315 |
316 TypeMirror _convertTypeToTypeMirror(DartType type) { | 316 TypeMirror _convertTypeToTypeMirror(DartType type) { |
317 assert(type != null); | 317 assert(type != null); |
318 if (type.treatAsDynamic) { | 318 if (type.treatAsDynamic) { |
319 return new Dart2JsDynamicMirror(this, type); | 319 return new Dart2JsDynamicMirror(this, type); |
320 } else if (type is InterfaceType) { | 320 } else if (type is InterfaceType) { |
321 if (type.typeArguments.isEmpty) { | 321 if (type.typeArguments.isEmpty) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 node, variable._variable.treeElements, variable.mirrorSystem); | 489 node, variable._variable.treeElements, variable.mirrorSystem); |
490 } | 490 } |
491 | 491 |
492 static ResolvedNode defaultValueSyntaxOf(Dart2JsParameterMirror parameter) { | 492 static ResolvedNode defaultValueSyntaxOf(Dart2JsParameterMirror parameter) { |
493 if (!parameter.hasDefaultValue) return null; | 493 if (!parameter.hasDefaultValue) return null; |
494 var node = parameter._element.initializer; | 494 var node = parameter._element.initializer; |
495 var treeElements = parameter._element.treeElements; | 495 var treeElements = parameter._element.treeElements; |
496 return new ResolvedNode(node, treeElements, parameter.mirrorSystem); | 496 return new ResolvedNode(node, treeElements, parameter.mirrorSystem); |
497 } | 497 } |
498 } | 498 } |
OLD | NEW |