OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library function_ref_element; | 5 library function_ref_element; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'package:polymer/polymer.dart'; | 8 import 'package:polymer/polymer.dart'; |
9 import 'package:observatory/service.dart'; | 9 import 'package:observatory/service.dart'; |
10 import 'service_ref.dart'; | 10 import 'service_ref.dart'; |
11 | 11 |
12 @CustomTag('function-ref') | 12 @CustomTag('function-ref') |
13 class FunctionRefElement extends ServiceRefElement { | 13 class FunctionRefElement extends ServiceRefElement { |
14 @published bool qualified = true; | 14 @published bool qualified = true; |
15 | 15 |
16 FunctionRefElement.created() : super.created(); | 16 FunctionRefElement.created() : super.created(); |
17 | 17 |
18 refChanged(oldValue) { | 18 refChanged(oldValue) { |
19 super.refChanged(oldValue); | 19 super.refChanged(oldValue); |
20 _updateShadowDom(); | 20 _updateShadowDom(); |
21 } | 21 } |
22 | 22 |
23 ServiceFunction get function => ref; | 23 ServiceFunction get function => ref; |
24 void _updateShadowDom() { | 24 void _updateShadowDom() { |
25 clearShadowRoot(); | 25 clearShadowRoot(); |
26 if (ref == null) { | 26 if (ref == null) { |
27 return; | 27 return; |
28 } | 28 } |
| 29 if (!function.kind.isDart()) { |
| 30 insertTextSpanIntoShadowRoot(name); |
| 31 return; |
| 32 } |
29 if (qualified) { | 33 if (qualified) { |
30 if (function.dartOwner is ServiceFunction) { | 34 if (function.dartOwner is ServiceFunction) { |
31 var functionRef = new Element.tag('function-ref'); | 35 var functionRef = new Element.tag('function-ref'); |
32 functionRef.ref = function.dartOwner; | 36 functionRef.ref = function.dartOwner; |
33 functionRef.qualified = true; | 37 functionRef.qualified = true; |
34 shadowRoot.children.add(functionRef); | 38 shadowRoot.children.add(functionRef); |
35 insertTextSpanIntoShadowRoot('.'); | 39 insertTextSpanIntoShadowRoot('.'); |
36 } else if (function.dartOwner is Class) { | 40 } else if (function.dartOwner is Class) { |
37 var classRef = new Element.tag('class-ref'); | 41 var classRef = new Element.tag('class-ref'); |
38 classRef.ref = function.dartOwner; | 42 classRef.ref = function.dartOwner; |
39 shadowRoot.children.add(classRef); | 43 shadowRoot.children.add(classRef); |
40 insertTextSpanIntoShadowRoot('.'); | 44 insertTextSpanIntoShadowRoot('.'); |
41 } | 45 } |
42 } | 46 } |
43 insertLinkIntoShadowRoot(name, url, hoverText); | 47 insertLinkIntoShadowRoot(name, url, hoverText); |
44 } | 48 } |
45 } | 49 } |
OLD | NEW |