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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 22455003: Make FunctionTypeMirror and ClosureMirror handle user-defined classes that implement the call opera… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 5fb76c7c6bf92029ba1a117eb97ee0ec31daaa6c..aaa1be5476cbf0c2f0881b0ac8f672d2cf9cc7fb 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -597,17 +597,17 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
native "ClassMirror_type_variables";
}
+// Instances represent user-defined classes that implement the call operator.
class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl
implements FunctionTypeMirror {
- _LocalFunctionTypeMirrorImpl(reflectee) : super(reflectee, null);
+ _LocalFunctionTypeMirrorImpl(reflectee, owner) : super(reflectee, owner);
- // FunctionTypeMirrors have a simpleName generated from their signature.
- Symbol _simpleName = null;
- Symbol get simpleName {
- if (_simpleName == null) {
- _simpleName = _s(_makeSignatureString(returnType, parameters));
+ MethodMirror _callMethod;
+ MethodMirror get callMethod {
+ if (_callMethod==null) {
+ _callMethod = this._FunctionTypeMirror_call_method(_reflectee);
}
- return _simpleName;
+ return _callMethod;
}
TypeMirror _returnType = null;
@@ -626,12 +626,11 @@ class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl
return _parameters;
}
- Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>();
- Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>();
- final Map<Symbol, TypeVariableMirror> typeVariables = const {};
-
String toString() => "FunctionTypeMirror on '${_n(simpleName)}'";
+ MethodMirror _FunctionTypeMirror_call_method(reflectee)
+ native "FunctionTypeMirror_call_method";
+
static TypeMirror _FunctionTypeMirror_return_type(reflectee)
native "FunctionTypeMirror_return_type";
@@ -639,6 +638,25 @@ class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl
native "FunctionTypeMirror_parameters";
}
+// Instances represent the classes of true closures.
+class _LocalClosureTypeMirrorImpl extends _LocalFunctionTypeMirrorImpl
+ implements FunctionTypeMirror {
+ _LocalClosureTypeMirrorImpl(reflectee) : super(reflectee, null);
+
+ // FunctionTypeMirrors have a simpleName generated from their signature.
+ Symbol _simpleName = null;
+ Symbol get simpleName {
+ if (_simpleName == null) {
+ _simpleName = _s(_makeSignatureString(returnType, parameters));
+ }
+ return _simpleName;
+ }
+
+ Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>();
+ Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>();
+ final Map<Symbol, TypeVariableMirror> typeVariables = const {};
+}
+
abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl
implements DeclarationMirror {
_LocalDeclarationMirrorImpl(this._reflectee, this.simpleName);
@@ -743,7 +761,7 @@ class _LocalTypedefMirrorImpl extends _LocalDeclarationMirrorImpl
TypeMirror _referent = null;
TypeMirror get referent {
if (_referent == null) {
- return new _LocalFunctionTypeMirrorImpl(
+ return new _LocalClosureTypeMirrorImpl(
_TypedefMirror_referent(_reflectee));
}
return _referent;

Powered by Google App Engine
This is Rietveld 408576698