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

Unified Diff: pkg/docgen/lib/src/models/closure.dart

Issue 263013006: Add function parameter info in docgen. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 | « no previous file | pkg/docgen/lib/src/models/method.dart » ('j') | pkg/docgen/lib/src/models/parameter.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/src/models/closure.dart
diff --git a/pkg/docgen/lib/src/models/closure.dart b/pkg/docgen/lib/src/models/closure.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2fcfa19b2fc4950028fb7eb5ce98125dea46bfad
--- /dev/null
+++ b/pkg/docgen/lib/src/models/closure.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2014, 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 docgen.models.closure;
+
+import '../exports/source_mirrors.dart';
+
+import 'doc_gen_type.dart';
+import 'indexable.dart';
+import 'mirror_based.dart';
+import 'model_helpers.dart';
+import 'parameter.dart';
+
+/// A class containing the properties of a function to be called (used in our
+/// case specifically to illustrate evidence of the type of function for a
+/// parameter).
+class Closure extends MirrorBased<FunctionTypeMirror> {
+
+ /// Parameters for this method.
+ final Map<String, Parameter> parameters;
+ final DocGenType returnType;
+ final FunctionTypeMirror mirror;
+
+ Closure(FunctionTypeMirror mirror, Indexable owner)
+ : returnType = new DocGenType(mirror.returnType, owner.owningLibrary),
+ parameters = createParameters(mirror.parameters, owner),
+ mirror = mirror;
+
+ /// Generates a map describing the [Method] object.
+ Map toMap() => {
+ 'return': [returnType.toMap()],
+ 'parameters': recurseMap(parameters),
+ };
+}
« no previous file with comments | « no previous file | pkg/docgen/lib/src/models/method.dart » ('j') | pkg/docgen/lib/src/models/parameter.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698