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

Unified Diff: pkg/analyzer/lib/src/generated/error.dart

Issue 2096103002: Analyzer support for `@factory` methods (linter#253). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
Index: pkg/analyzer/lib/src/generated/error.dart
diff --git a/pkg/analyzer/lib/src/generated/error.dart b/pkg/analyzer/lib/src/generated/error.dart
index 074a6aad2b1ea9e037e9b1e371af055ffb8553ff..b657a315845b1a0ff0aef51aede41d6010a7c4df 100644
--- a/pkg/analyzer/lib/src/generated/error.dart
+++ b/pkg/analyzer/lib/src/generated/error.dart
@@ -2682,6 +2682,9 @@ abstract class ErrorCode {
HintCode.DEPRECATED_MEMBER_USE,
HintCode.DUPLICATE_IMPORT,
HintCode.DIVISION_OPTIMIZATION,
+ HintCode.INVALID_FACTORY_ANNOTATION,
+ HintCode.INVALID_FACTORY_METHOD_DECL,
+ HintCode.INVALID_FACTORY_METHOD_IMPL,
HintCode.IS_DOUBLE,
HintCode.IS_INT,
HintCode.IS_NOT_DOUBLE,
@@ -3609,6 +3612,34 @@ class HintCode extends ErrorCode {
"A value of type '{0}' cannot be assigned to a variable of type '{1}'");
/**
+ * This hint is generated anywhere a @factory annotation is associated with
+ * anything other than a method.
+ */
+ static const HintCode INVALID_FACTORY_ANNOTATION = const HintCode(
+ 'INVALID_FACTORY_ANNOTATION',
+ "Only methods can be annotated as factories.");
+
+ /**
+ * This hint is generated anywhere a @factory annotation is associated with
+ * a method that does not declare a return type.
+ */
+ static const HintCode INVALID_FACTORY_METHOD_DECL = const HintCode(
+ 'INVALID_FACTORY_METHOD_DECL',
+ "Factory method '{0}' must have a return type.");
+
+ /**
+ * This hint is generated anywhere a @factory annotation is associated with
+ * a non-abstract method that can return anything other than a newly allocated
+ * object.
+ *
+ * Parameters:
+ * 0: the name of the method
+ */
+ static const HintCode INVALID_FACTORY_METHOD_IMPL = const HintCode(
+ 'INVALID_FACTORY_METHOD_IMPL',
+ "Factory method '{0}' does not return a newly allocated object.");
+
+ /**
* This hint is generated anywhere where a member annotated with `@protected`
* is used outside an instance member of a subclass.
*

Powered by Google App Engine
This is Rietveld 408576698