Index: pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart |
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart |
index 9b2d9052f689a60ff329ddcf66ea46022e7b77ed..0a62b5d875121c7c4be21626b4b119011c357c54 100644 |
--- a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart |
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart |
@@ -360,13 +360,7 @@ class JsClassMirror extends JsMirror implements ClassMirror { |
} |
var fields = _getFields(unwrapped); |
fields.forEach((symbol, t) { |
- var metadata = []; |
- if (t is List) { |
- metadata = t.skip(1).toList(); |
- t = t[0]; |
- } |
- _declarations[symbol] = |
- new JsVariableMirror._(symbol, _wrap(t), metadata); |
+ _declarations[symbol] = new JsVariableMirror._fromField(symbol, t); |
}); |
var methods = _getMethods(unwrapped); |
methods.forEach((symbol, ft) { |
@@ -390,14 +384,7 @@ class JsClassMirror extends JsMirror implements ClassMirror { |
}); |
var staticFields = _getStaticFields(unwrapped); |
staticFields.forEach((symbol, t) { |
- var name = getName(symbol); |
- var metadata = []; |
- if (t is List) { |
- metadata = t.skip(1).toList(); |
- t = t[0]; |
- } |
- _declarations[symbol] = |
- new JsVariableMirror._(symbol, _wrap(t), metadata); |
+ _declarations[symbol] = new JsVariableMirror._fromField(symbol, t); |
}); |
var statics = _getStatics(unwrapped); |
statics.forEach((symbol, ft) { |
@@ -537,20 +524,26 @@ class JsVariableMirror extends JsMirror implements VariableMirror { |
final String _name; |
final TypeMirror type; |
final List<InstanceMirror> metadata; |
+ final bool isFinal; |
// TODO(vsm): Refactor this out. |
Symbol get simpleName => _symbol; |
// TODO(vsm): Fix this |
final bool isStatic = false; |
- final bool isFinal = false; |
- JsVariableMirror._(Symbol symbol, Type t, List annotations) |
+ JsVariableMirror._(Symbol symbol, Type t, List annotations, |
+ {this.isFinal: false}) |
: _symbol = symbol, |
_name = getName(symbol), |
type = reflectType(t), |
- metadata = new List<InstanceMirror>.unmodifiable( |
- annotations.map((a) => reflect(a))); |
+ metadata = |
+ new List<InstanceMirror>.unmodifiable(annotations.map(reflect)); |
+ |
+ JsVariableMirror._fromField(Symbol symbol, fieldInfo) |
+ : this._(symbol, _wrap(JS('', '#.type', fieldInfo)), |
+ JS('', '#.metadata', fieldInfo), |
+ isFinal: JS('bool', '#.isFinal', fieldInfo)); |
String toString() => "VariableMirror on '$_name'"; |
} |