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

Unified Diff: client/lib/components/closure.dart

Issue 273473002: Display function signatures instead of just "Function". (Closed) Base URL: https://github.com/dart-lang/dartdoc-viewer.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « client/lib/components/category.html ('k') | client/lib/components/closure.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/lib/components/closure.dart
diff --git a/client/lib/components/closure.dart b/client/lib/components/closure.dart
new file mode 100644
index 0000000000000000000000000000000000000000..3e75d933132e55989e33623438a1fada60bb2018
--- /dev/null
+++ b/client/lib/components/closure.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library web.parameters;
+
+import 'dart:html';
+
+import 'package:polymer/polymer.dart';
+
+import 'package:dartdoc_viewer/item.dart';
+
+import 'type.dart';
+import 'parameters.dart';
+
+/**
+ * An element representing a function that is passed in as a parameter to a
+ * method.
+ */
+@CustomTag("dartdoc-closure")
+class ClosureElement extends PolymerElement {
+ @observable Closure closure;
+
+ factory ClosureElement() => new Element.tag('dartdoc-closure');
+ ClosureElement.created() : super.created();
+
+ void closureChanged() {
+ this.children.clear();
+
+ var outerSpan = new SpanElement();
+ if (!closure.returnType.isDynamic) {
+ outerSpan.append(new TypeElement()..type = closure.returnType);
+ outerSpan.appendText(' ');
+ }
+
+ var parameterName = new AnchorElement()
+ ..text = closure.name
+ ..href = closure.prefixedAnchorHref
+ ..id = closure.anchorHrefLocation.anchor;
+
+ outerSpan.append(parameterName);
+ outerSpan.append(new ParameterElement()
+ ..parameters = closure.parameters);
+ this.append(outerSpan);
+ }
+}
« no previous file with comments | « client/lib/components/category.html ('k') | client/lib/components/closure.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698