OLD | NEW |
1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this | 1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in | 2 // source code is governed by a BSD-style license that can be found in |
3 // the LICENSE file. | 3 // the LICENSE file. |
4 | 4 |
5 library reflectable.encoding_constants; | 5 library reflectable.encoding_constants; |
6 | 6 |
7 // The first bits are used to enumerate the "kind" of the declaration. | 7 // The first `flagsBit-1` bits are used to enumerate the "kind" of the |
8 // The more significant bits are flags. | 8 // declaration. The more significant bits are flags. |
| 9 const flagsBit = 4; |
9 | 10 |
10 // Kinds: | 11 // Kinds: |
11 const generativeConstructor = 0; | 12 const generativeConstructor = 0; |
12 const factoryConstructor = 1; | 13 const factoryConstructor = 1; |
13 const redirectingConstructor = 2; | 14 const method = 2; |
14 const method = 3; | 15 const getter = 3; |
15 const getter = 4; | 16 const setter = 4; |
16 const setter = 5; | |
17 | 17 |
18 // Flags: | 18 // Flags: |
19 const staticAttribute = 16; | 19 const staticAttribute = 1 << (flagsBit); |
20 const abstractAttribute = 32; | 20 const privateAttribute = 1 << (flagsBit + 1); |
21 const constAttribute = 64; | 21 const syntheticAttribute = 1 << (flagsBit + 2); |
22 const privateAttribute = 128; | 22 const constAttribute = 1 << (flagsBit + 3); |
23 const syntheticAttribute = 256; | 23 const redirectingConstructor = 1 << (flagsBit + 4); |
| 24 const abstractAttribute = 1 << (flagsBit + 5); |
24 | 25 |
25 int kindFromEncoding(int encoding) => encoding & 15; | 26 int kindFromEncoding(int encoding) => encoding & ((1 << flagsBit) - 1); |
OLD | NEW |