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

Side by Side 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: Allow decls w/o a return type. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.src.generated.error; 5 library analyzer.src.generated.error;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart' show AstNode; 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode;
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR, 2675 CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR,
2676 CompileTimeErrorCode.YIELD_IN_NON_GENERATOR, 2676 CompileTimeErrorCode.YIELD_IN_NON_GENERATOR,
2677 HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 2677 HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
2678 HintCode.CAN_BE_NULL_AFTER_NULL_AWARE, 2678 HintCode.CAN_BE_NULL_AFTER_NULL_AWARE,
2679 HintCode.DEAD_CODE, 2679 HintCode.DEAD_CODE,
2680 HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH, 2680 HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH,
2681 HintCode.DEAD_CODE_ON_CATCH_SUBTYPE, 2681 HintCode.DEAD_CODE_ON_CATCH_SUBTYPE,
2682 HintCode.DEPRECATED_MEMBER_USE, 2682 HintCode.DEPRECATED_MEMBER_USE,
2683 HintCode.DUPLICATE_IMPORT, 2683 HintCode.DUPLICATE_IMPORT,
2684 HintCode.DIVISION_OPTIMIZATION, 2684 HintCode.DIVISION_OPTIMIZATION,
2685 HintCode.INVALID_FACTORY_ANNOTATION,
2686 HintCode.INVALID_FACTORY_METHOD_DECL,
2687 HintCode.INVALID_FACTORY_METHOD_IMPL,
2685 HintCode.IS_DOUBLE, 2688 HintCode.IS_DOUBLE,
2686 HintCode.IS_INT, 2689 HintCode.IS_INT,
2687 HintCode.IS_NOT_DOUBLE, 2690 HintCode.IS_NOT_DOUBLE,
2688 HintCode.IS_NOT_INT, 2691 HintCode.IS_NOT_INT,
2689 HintCode.IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION, 2692 HintCode.IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION,
2690 HintCode.INVALID_ASSIGNMENT, 2693 HintCode.INVALID_ASSIGNMENT,
2691 HintCode.INVALID_USE_OF_PROTECTED_MEMBER, 2694 HintCode.INVALID_USE_OF_PROTECTED_MEMBER,
2692 HintCode.MISSING_JS_LIB_ANNOTATION, 2695 HintCode.MISSING_JS_LIB_ANNOTATION,
2693 HintCode.MISSING_REQUIRED_PARAM, 2696 HintCode.MISSING_REQUIRED_PARAM,
2694 HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS, 2697 HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS,
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
3602 * 3605 *
3603 * Parameters: 3606 * Parameters:
3604 * 0: the name of the right hand side type 3607 * 0: the name of the right hand side type
3605 * 1: the name of the left hand side type 3608 * 1: the name of the left hand side type
3606 */ 3609 */
3607 static const HintCode INVALID_ASSIGNMENT = const HintCode( 3610 static const HintCode INVALID_ASSIGNMENT = const HintCode(
3608 'INVALID_ASSIGNMENT', 3611 'INVALID_ASSIGNMENT',
3609 "A value of type '{0}' cannot be assigned to a variable of type '{1}'"); 3612 "A value of type '{0}' cannot be assigned to a variable of type '{1}'");
3610 3613
3611 /** 3614 /**
3615 * This hint is generated anywhere a @factory annotation is associated with
3616 * anything other than a method.
3617 */
3618 static const HintCode INVALID_FACTORY_ANNOTATION = const HintCode(
3619 'INVALID_FACTORY_ANNOTATION',
3620 "Only methods can be annotated as factories.");
3621
3622 /**
3623 * This hint is generated anywhere a @factory annotation is associated with
3624 * a method that does not declare a return type.
3625 */
3626 static const HintCode INVALID_FACTORY_METHOD_DECL = const HintCode(
3627 'INVALID_FACTORY_METHOD_DECL',
3628 "Factory method '{0}' must have a return type.");
3629
3630 /**
3631 * This hint is generated anywhere a @factory annotation is associated with
3632 * a non-abstract method that can return anything other than a newly allocated
3633 * object.
3634 *
3635 * Parameters:
3636 * 0: the name of the method
3637 */
3638 static const HintCode INVALID_FACTORY_METHOD_IMPL = const HintCode(
3639 'INVALID_FACTORY_METHOD_IMPL',
3640 "Factory method '{0}' does not return a newly allocated object.");
3641
3642 /**
3612 * This hint is generated anywhere where a member annotated with `@protected` 3643 * This hint is generated anywhere where a member annotated with `@protected`
3613 * is used outside an instance member of a subclass. 3644 * is used outside an instance member of a subclass.
3614 * 3645 *
3615 * Parameters: 3646 * Parameters:
3616 * 0: the name of the member 3647 * 0: the name of the member
3617 * 1: the name of the defining class 3648 * 1: the name of the defining class
3618 */ 3649 */
3619 static const HintCode INVALID_USE_OF_PROTECTED_MEMBER = const HintCode( 3650 static const HintCode INVALID_USE_OF_PROTECTED_MEMBER = const HintCode(
3620 'INVALID_USE_OF_PROTECTED_MEMBER', 3651 'INVALID_USE_OF_PROTECTED_MEMBER',
3621 "The member '{0}' can only be used within instance members of subclasses o f '{1}'"); 3652 "The member '{0}' can only be used within instance members of subclasses o f '{1}'");
(...skipping 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after
5965 * Initialize a newly created error code to have the given [name]. 5996 * Initialize a newly created error code to have the given [name].
5966 */ 5997 */
5967 const TodoCode(String name) : super(name, "{0}"); 5998 const TodoCode(String name) : super(name, "{0}");
5968 5999
5969 @override 6000 @override
5970 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; 6001 ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
5971 6002
5972 @override 6003 @override
5973 ErrorType get type => ErrorType.TODO; 6004 ErrorType get type => ErrorType.TODO;
5974 } 6005 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/member.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698