Chromium Code Reviews| Index: sdk/lib/_internal/lib/js_mirrors.dart |
| diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart |
| index 4d0fe517fc221b9a484387446e254ede35b54dcb..515eaf90bbde52438b3db05de58fd3abb37040fc 100644 |
| --- a/sdk/lib/_internal/lib/js_mirrors.dart |
| +++ b/sdk/lib/_internal/lib/js_mirrors.dart |
| @@ -27,7 +27,8 @@ import 'dart:_js_helper' show |
| getMangledTypeName, |
| throwInvalidReflectionError, |
| hasReflectableProperty, |
| - runtimeTypeToString; |
| + runtimeTypeToString, |
| + TypeVariable; |
| import 'dart:_interceptors' show |
| Interceptor, |
| JSExtendableArray; |
| @@ -181,11 +182,13 @@ abstract class JsDeclarationMirror extends JsMirror |
| } |
| class JsTypeVariableMirror extends JsTypeMirror implements TypeVariableMirror { |
| - final TypeMirror upperBound; |
| final DeclarationMirror owner; |
| + final TypeVariable _typeVariable; |
| + TypeMirror _cachedUpperBound; |
| - JsTypeVariableMirror(Symbol simpleName, this.upperBound, this.owner) |
| - : super(simpleName); |
| + JsTypeVariableMirror(TypeVariable typeVariable, this.owner) |
| + : this._typeVariable = typeVariable, |
| + super(s(typeVariable.name)); |
| bool operator ==(other) { |
| return (other is JsTypeVariableMirror && |
| @@ -201,6 +204,12 @@ class JsTypeVariableMirror extends JsTypeMirror implements TypeVariableMirror { |
| } |
| String get _prettyName => 'TypeVariableMirror'; |
| + |
| + TypeMirror get upperBound { |
| + if (_cachedUpperBound != null) return _cachedUpperBound; |
| + return _cachedUpperBound = typeMirrorFromRuntimeTypeRepresentation( |
|
ahe
2013/10/15 14:56:31
Extra space after =.
zarah
2013/10/16 07:00:47
Done.
|
| + JS('', 'init.metadata[#]', _typeVariable.bound)); |
| + } |
| } |
| class JsTypeMirror extends JsDeclarationMirror implements TypeMirror { |
| @@ -1311,13 +1320,9 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror |
| List typeVars = |
| JS('JSExtendableArray|Null', '#.prototype["<>"]', _jsConstructor); |
| if (typeVars == null) return result; |
| - for (int i = 0; i < typeVars.length; i += 2) { |
| - TypeMirror upperBound = |
| - typeMirrorFromRuntimeTypeRepresentation(JS('', 'init.metadata[#]', |
| - typeVars[i+1])); |
| - var typeMirror = |
| - new JsTypeVariableMirror(s(typeVars[i]), upperBound, this); |
| - result.add(typeMirror); |
| + for (int i = 0; i < typeVars.length; i++) { |
| + TypeVariable typeVariable = JS('', 'init.metadata[#]', typeVars[i]); |
| + result.add( new JsTypeVariableMirror(typeVariable, this)); |
|
ahe
2013/10/15 14:56:31
Extra space after (.
zarah
2013/10/16 07:00:47
Done.
|
| } |
| return _cachedTypeVariables = new UnmodifiableListView(result); |
| } |