Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2464)

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 23983026: Fill in type arguments when creating an object from the mirrors or embedding API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: RareType Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/lib/mirrors_impl.dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index acc701d7ed3ee3e7625c2799352a5a5402755c90..be959ceb92b17749558f059031e68376673b211e 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -441,15 +441,17 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
this._reflectedType,
String simpleName,
this._isGeneric,
- this._isMixinTypedef)
+ this._isMixinTypedef,
+ this._isGenericDeclaration)
: this._simpleName = _s(simpleName),
super(reflectee);
final Type _reflectedType;
final bool _isGeneric;
final bool _isMixinTypedef;
+ final bool _isGenericDeclaration;
- bool get hasReflectedType => _reflectedType != null;
+ bool get hasReflectedType => !_isGenericDeclaration;
Type get reflectedType {
if (!hasReflectedType) {
throw new UnsupportedError(
@@ -635,7 +637,7 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
Map<Symbol, TypeMirror> _typeArguments = null;
Map<Symbol, TypeMirror> get typeArguments {
if(_typeArguments == null) {
- if(_reflectedType == null) {
+ if(_isGenericDeclaration) {
_typeArguments = new LinkedHashMap<Symbol, TypeMirror>();
} else {
_typeArguments =
@@ -647,7 +649,7 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
}
bool get isOriginalDeclaration {
- return !_isGeneric || _reflectedType == null;
+ return !_isGeneric || _isGenericDeclaration;
}
ClassMirror get originalDeclaration {
@@ -683,6 +685,7 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
}
return reflect(_invokeConstructor(_reflectee,
+ _reflectedType,
_n(constructorName),
arguments,
names));
@@ -707,7 +710,8 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
bool operator ==(other) {
return this.runtimeType == other.runtimeType &&
this._reflectee == other._reflectee &&
- this._reflectedType == other._reflectedType;
+ this._reflectedType == other._reflectedType &&
+ this._isGenericDeclaration == other._isGenericDeclaration;
}
int get hashCode => simpleName.hashCode;
@@ -739,7 +743,7 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
_invokeSetter(reflectee, setterName, value)
native 'ClassMirror_invokeSetter';
- static _invokeConstructor(reflectee, constructorName, arguments, argumentNames)
+ static _invokeConstructor(reflectee, type, constructorName, arguments, argumentNames)
native 'ClassMirror_invokeConstructor';
static _ClassMirror_type_variables(reflectee)
@@ -752,7 +756,7 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl
implements FunctionTypeMirror {
_LocalFunctionTypeMirrorImpl(reflectee, reflectedType)
- : super(reflectee, reflectedType, null, false, false);
+ : super(reflectee, reflectedType, null, false, false, false);
// FunctionTypeMirrors have a simpleName generated from their signature.
Symbol _simpleName = null;
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698