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

Unified Diff: pkg/analysis_server/lib/src/services/correction/sort_members.dart

Issue 961443004: Issue 21978. Put function 'main' first when sorting members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/analysis_server/lib/src/services/correction/sort_members.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/sort_members.dart b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
index 0c64a63873355b7980858794bee3913119618aec..90c6806d5160b81f86d7a6bff93bf17cdd8dc3d9 100644
--- a/pkg/analysis_server/lib/src/services/correction/sort_members.dart
+++ b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
@@ -14,6 +14,7 @@ import 'package:analyzer/src/generated/ast.dart';
*/
class MemberSorter {
static List<_PriorityItem> _PRIORITY_ITEMS = [
+ new _PriorityItem(false, _MemberKind.UNIT_FUNCTION_MAIN, false),
new _PriorityItem(false, _MemberKind.UNIT_VARIABLE, false),
new _PriorityItem(false, _MemberKind.UNIT_VARIABLE, true),
new _PriorityItem(false, _MemberKind.UNIT_ACCESSOR, false),
@@ -265,7 +266,11 @@ class MemberSorter {
kind = _MemberKind.UNIT_ACCESSOR;
name += " setter";
} else {
- kind = _MemberKind.UNIT_FUNCTION;
+ if (name == 'main') {
+ kind = _MemberKind.UNIT_FUNCTION_MAIN;
+ } else {
+ kind = _MemberKind.UNIT_FUNCTION;
+ }
}
}
if (member is FunctionTypeAlias) {
@@ -385,15 +390,16 @@ class _MemberInfo {
}
class _MemberKind {
- static const UNIT_ACCESSOR = const _MemberKind('UNIT_ACCESSOR', 0);
- static const UNIT_FUNCTION = const _MemberKind('UNIT_FUNCTION', 1);
- static const UNIT_FUNCTION_TYPE = const _MemberKind('UNIT_FUNCTION_TYPE', 2);
- static const UNIT_CLASS = const _MemberKind('UNIT_CLASS', 3);
- static const UNIT_VARIABLE = const _MemberKind('UNIT_VARIABLE', 4);
- static const CLASS_ACCESSOR = const _MemberKind('CLASS_ACCESSOR', 5);
- static const CLASS_CONSTRUCTOR = const _MemberKind('CLASS_CONSTRUCTOR', 6);
- static const CLASS_FIELD = const _MemberKind('CLASS_FIELD', 7);
- static const CLASS_METHOD = const _MemberKind('CLASS_METHOD', 8);
+ static const UNIT_FUNCTION_MAIN = const _MemberKind('UNIT_FUNCTION_MAIN', 0);
+ static const UNIT_ACCESSOR = const _MemberKind('UNIT_ACCESSOR', 1);
+ static const UNIT_FUNCTION = const _MemberKind('UNIT_FUNCTION', 2);
+ static const UNIT_FUNCTION_TYPE = const _MemberKind('UNIT_FUNCTION_TYPE', 3);
+ static const UNIT_CLASS = const _MemberKind('UNIT_CLASS', 4);
+ static const UNIT_VARIABLE = const _MemberKind('UNIT_VARIABLE', 5);
+ static const CLASS_ACCESSOR = const _MemberKind('CLASS_ACCESSOR', 6);
+ static const CLASS_CONSTRUCTOR = const _MemberKind('CLASS_CONSTRUCTOR', 7);
+ static const CLASS_FIELD = const _MemberKind('CLASS_FIELD', 8);
+ static const CLASS_METHOD = const _MemberKind('CLASS_METHOD', 9);
final String name;
final int ordinal;

Powered by Google App Engine
This is Rietveld 408576698