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

Side by Side Diff: pkg/front_end/lib/src/fasta/modifier.dart

Issue 2862223002: Rewrite mixin application handling in Fasta. (Closed)
Patch Set: Update status file. Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.modifier; 5 library fasta.modifier;
6 6
7 import 'errors.dart' show internalError; 7 import 'errors.dart' show internalError;
8 8
9 enum ModifierEnum { 9 enum ModifierEnum {
10 Abstract, 10 Abstract,
11 Const, 11 Const,
12 External, 12 External,
13 Final, 13 Final,
14 Static, 14 Static,
15 15
16 // Not a real modifier. 16 // Not a real modifier.
17 Var, 17 Var,
18 } 18 }
19 19
20 const int abstractMask = 1; 20 const int abstractMask = 1;
21 21
22 const int constMask = abstractMask << 1; 22 const int constMask = abstractMask << 1;
23 23
24 const int externalMask = constMask << 1; 24 const int externalMask = constMask << 1;
25 25
26 const int finalMask = externalMask << 1; 26 const int finalMask = externalMask << 1;
27 27
28 const int staticMask = finalMask << 1; 28 const int staticMask = finalMask << 1;
29 29
30 /// Not a real modifier, and by setting it to null, it is automatically 30 const int namedMixinApplicationMask = staticMask << 1;
31 /// ignored by [Modifier.validate] below. 31
32 /// Not a real modifier, and by setting it to zero, it is automatically ignored
33 /// by [Modifier.validate] below.
32 const int varMask = 0; 34 const int varMask = 0;
33 35
34 const Modifier Abstract = const Modifier(ModifierEnum.Abstract, abstractMask); 36 const Modifier Abstract = const Modifier(ModifierEnum.Abstract, abstractMask);
35 37
36 const Modifier Const = const Modifier(ModifierEnum.Const, constMask); 38 const Modifier Const = const Modifier(ModifierEnum.Const, constMask);
37 39
38 const Modifier External = const Modifier(ModifierEnum.External, externalMask); 40 const Modifier External = const Modifier(ModifierEnum.External, externalMask);
39 41
40 const Modifier Final = const Modifier(ModifierEnum.Final, finalMask); 42 const Modifier Final = const Modifier(ModifierEnum.Final, finalMask);
41 43
(...skipping 24 matching lines...) Expand all
66 static int validate(List<Modifier> modifiers, {bool isAbstract: false}) { 68 static int validate(List<Modifier> modifiers, {bool isAbstract: false}) {
67 // TODO(ahe): Implement modifier validation: ordering and uniqueness. 69 // TODO(ahe): Implement modifier validation: ordering and uniqueness.
68 int result = isAbstract ? abstractMask : 0; 70 int result = isAbstract ? abstractMask : 0;
69 if (modifiers == null) return result; 71 if (modifiers == null) return result;
70 for (Modifier modifier in modifiers) { 72 for (Modifier modifier in modifiers) {
71 result |= modifier.mask; 73 result |= modifier.mask;
72 } 74 }
73 return result; 75 return result;
74 } 76 }
75 } 77 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_target.dart ('k') | pkg/front_end/lib/src/fasta/source/outline_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698