Sort enum declarations.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//1136413003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45801 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
scheglov@google.com 2015-05-14 22:42:16 +00:00
parent 955a7c53a3
commit 3ffb42cd22
2 changed files with 34 additions and 0 deletions

View file

@ -270,6 +270,10 @@ class MemberSorter {
kind = _MemberKind.UNIT_CLASS;
name = member.name.name;
}
if (member is EnumDeclaration) {
kind = _MemberKind.UNIT_CLASS;
name = member.name.name;
}
if (member is FunctionDeclaration) {
FunctionDeclaration function = member;
name = function.name.name;

View file

@ -479,6 +479,36 @@ class B {}
''');
}
void test_unitMembers_enum() {
_parseTestUnit(r'''
enum C {x, y}
enum A {x, y}
enum B {x, y}
''');
// validate change
_assertSort(r'''
enum A {x, y}
enum B {x, y}
enum C {x, y}
''');
}
void test_unitMembers_enumClass() {
_parseTestUnit(r'''
enum C {x, y}
class A {}
class D {}
enum B {x, y}
''');
// validate change
_assertSort(r'''
class A {}
enum B {x, y}
enum C {x, y}
class D {}
''');
}
void test_unitMembers_function() {
_parseTestUnit(r'''
fc() {}