Index: runtime/bin/vmservice/client/lib/src/elements/function_view.dart |
diff --git a/runtime/bin/vmservice/client/lib/src/elements/function_view.dart b/runtime/bin/vmservice/client/lib/src/elements/function_view.dart |
index 1c3620c24d91bde1b445ffaefc043a5eed8d28a7..4a09f709a9569cc9bb64c158deb01662b169eafc 100644 |
--- a/runtime/bin/vmservice/client/lib/src/elements/function_view.dart |
+++ b/runtime/bin/vmservice/client/lib/src/elements/function_view.dart |
@@ -14,7 +14,74 @@ class FunctionViewElement extends ObservatoryElement { |
@published ServiceMap function; |
FunctionViewElement.created() : super.created(); |
+ @published String qualifiedName; |
+ @published String kind; |
+ |
+ String _getQualifiedName(ServiceMap function) { |
+ var parent = (function != null && function['parent'] != null |
+ ? function['parent'] : null); |
+ if (parent != null) { |
+ return "${_getQualifiedName(parent)}.${function['user_name']}"; |
+ } |
+ var cls = (function != null && |
+ function['class'] != null && |
+ function['class']['user_name'] != null && |
+ function['class']['user_name'] != '::' |
+ ? function['class'] : null); |
+ if (cls != null) { |
+ return "${cls['user_name']}.${function['user_name']}"; |
+ } |
+ return "${function['username']}"; |
+ } |
+ |
+ void functionChanged(oldValue) { |
+ notifyPropertyChange(#qualifiedName, 0, 1); |
+ notifyPropertyChange(#kind, 0, 1); |
+ qualifiedName = _getQualifiedName(function); |
+ switch(function['kind']) { |
Cutch
2014/03/25 23:12:38
Maybe add a TODO here that this code should be fac
turnidge
2014/03/26 17:05:20
Done.
|
+ case 'kRegularFunction': |
+ kind = 'function'; |
+ break; |
+ case 'kClosureFunction': |
+ kind = 'closure function'; |
+ break; |
+ case 'kSignatureFunction': |
+ kind = 'signature function'; |
+ break; |
+ case 'kGetterFunction': |
+ kind = 'getter function'; |
+ break; |
+ case 'kSetterFunction': |
+ kind = 'setter function'; |
+ break; |
+ case 'kConstructor': |
+ kind = 'constructor'; |
+ break; |
+ case 'kImplicitGetterFunction': |
+ kind = 'implicit getter function'; |
+ break; |
+ case 'kImplicitSetterFunction': |
+ kind = 'implicit setter function'; |
+ break; |
+ case 'kStaticInitializer': |
+ kind = 'static initializer'; |
+ break; |
+ case 'kMethodExtractor': |
+ kind = 'method extractor'; |
+ break; |
+ case 'kNoSuchMethodDispatcher': |
+ kind = 'noSuchMethod dispatcher'; |
+ break; |
+ case 'kInvokeFieldDispatcher': |
+ kind = 'invoke field dispatcher'; |
+ break; |
+ default: |
+ kind = 'UNKNOWN'; |
+ break; |
+ } |
+ } |
+ |
void refresh(var done) { |
function.reload().whenComplete(done); |
} |
-} |
+} |