| 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:io'; | 7 import 'dart:io'; |
| 8 import 'dart:uri'; | 8 import 'dart:uri'; |
| 9 | 9 |
| 10 import '../../compiler.dart' as diagnostics; | 10 import '../../compiler.dart' as diagnostics; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return new Dart2JsInterfaceTypeMirror(system, type); | 68 return new Dart2JsInterfaceTypeMirror(system, type); |
| 69 } | 69 } |
| 70 } else if (type is TypeVariableType) { | 70 } else if (type is TypeVariableType) { |
| 71 return new Dart2JsTypeVariableMirror(system, type); | 71 return new Dart2JsTypeVariableMirror(system, type); |
| 72 } else if (type is FunctionType) { | 72 } else if (type is FunctionType) { |
| 73 return new Dart2JsFunctionTypeMirror(system, type, functionSignature); | 73 return new Dart2JsFunctionTypeMirror(system, type, functionSignature); |
| 74 } else if (type is VoidType) { | 74 } else if (type is VoidType) { |
| 75 return new Dart2JsVoidMirror(system, type); | 75 return new Dart2JsVoidMirror(system, type); |
| 76 } else if (type is TypedefType) { | 76 } else if (type is TypedefType) { |
| 77 return new Dart2JsTypedefMirror(system, type); | 77 return new Dart2JsTypedefMirror(system, type); |
| 78 } else if (type is MalformedType) { |
| 79 // TODO(johnniwinther): We need a mirror on malformed types. |
| 80 return system.dynamicType; |
| 78 } | 81 } |
| 79 throw new ArgumentError("Unexpected interface type $type"); | 82 throw new ArgumentError("Unexpected type $type of kind ${type.kind}"); |
| 80 } | 83 } |
| 81 | 84 |
| 82 Collection<Dart2JsMemberMirror> _convertElementMemberToMemberMirrors( | 85 Collection<Dart2JsMemberMirror> _convertElementMemberToMemberMirrors( |
| 83 Dart2JsContainerMirror library, Element element) { | 86 Dart2JsContainerMirror library, Element element) { |
| 84 if (element is SynthesizedConstructorElement) { | 87 if (element is SynthesizedConstructorElement) { |
| 85 return const <Dart2JsMemberMirror>[]; | 88 return const <Dart2JsMemberMirror>[]; |
| 86 } else if (element is VariableElement) { | 89 } else if (element is VariableElement) { |
| 87 return <Dart2JsMemberMirror>[new Dart2JsFieldMirror(library, element)]; | 90 return <Dart2JsMemberMirror>[new Dart2JsFieldMirror(library, element)]; |
| 88 } else if (element is FunctionElement) { | 91 } else if (element is FunctionElement) { |
| 89 return <Dart2JsMemberMirror>[new Dart2JsMethodMirror(library, element)]; | 92 return <Dart2JsMemberMirror>[new Dart2JsMethodMirror(library, element)]; |
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 var node = _variable.variables.parseNode(_diagnosticListener); | 1558 var node = _variable.variables.parseNode(_diagnosticListener); |
| 1556 if (node != null) { | 1559 if (node != null) { |
| 1557 var span = mirrors.compiler.spanFromNode(node, script.uri); | 1560 var span = mirrors.compiler.spanFromNode(node, script.uri); |
| 1558 return new Dart2JsSourceLocation(script, span); | 1561 return new Dart2JsSourceLocation(script, span); |
| 1559 } else { | 1562 } else { |
| 1560 var span = mirrors.compiler.spanFromElement(_variable); | 1563 var span = mirrors.compiler.spanFromElement(_variable); |
| 1561 return new Dart2JsSourceLocation(script, span); | 1564 return new Dart2JsSourceLocation(script, span); |
| 1562 } | 1565 } |
| 1563 } | 1566 } |
| 1564 } | 1567 } |
| OLD | NEW |