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

Unified Diff: lib/plugin.dart

Issue 1959373002: Rework plugin API to work better with strong mode (Closed) Base URL: https://github.com/dart-lang/plugin.git@master
Patch Set: Created 4 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 | lib/src/plugin_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/plugin.dart
diff --git a/lib/plugin.dart b/lib/plugin.dart
index 66cebb0342ec228475b33f0a49c278346cfd5aba..2dcd96e495988d56758b1e8355aaee9aeaf28d22 100644
--- a/lib/plugin.dart
+++ b/lib/plugin.dart
@@ -4,6 +4,8 @@
library plugin;
+import 'package:plugin/src/plugin_impl.dart';
+
/**
* A function used to register the given [extension] to the extension point with
* the given unique [identifier].
@@ -15,16 +17,13 @@ library plugin;
typedef void RegisterExtension(String identifier, Object extension);
/**
- * A function used to register an extension point with the given simple
- * [identifier]. If given, the [validator] will be used to validate extensions
- * to the extension point.
+ * A function used to register the given [extensionPoint].
*
* An [ExtensionError] will be thrown if the extension point cannot be
* registered, such as when a plugin attempts to define two extension points
- * with the same simple identifier.
+ * with the same identifier.
*/
-typedef ExtensionPoint RegisterExtensionPoint(String identifier,
- [ValidateExtension validateExtension]);
+typedef void RegisterExtensionPoint(ExtensionPoint extensionPoint);
/**
* A function used by a plugin to validate an [extension] to a extension point.
@@ -58,12 +57,20 @@ class ExtensionError implements Exception {
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class ExtensionPoint {
+abstract class ExtensionPoint<E> {
+ /**
+ * Initialize a newly created extension point to be defined by the given
+ * [plugin] with the given [simpleIdentifier]. The [validateExtension]
+ * function will be used to validate extensions for this extension point.
+ */
+ factory ExtensionPoint(Plugin plugin, String simpleIdentifier,
+ ValidateExtension validateExtension) = ExtensionPointImpl<E>;
+
/**
* Return an immutable list containing all of the extensions that were
* registered for this extension point.
*/
- List<Object> get extensions;
+ List<E> get extensions;
/**
* Return the plugin that defined this extension point.
« no previous file with comments | « no previous file | lib/src/plugin_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698