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

Unified Diff: reflectable/lib/src/encoding_constants.dart

Issue 1182083002: Implement `.instanceMembers`. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Fix return type in test Created 5 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 side-by-side diff with in-line comments
Download patch
Index: reflectable/lib/src/encoding_constants.dart
diff --git a/reflectable/lib/src/encoding_constants.dart b/reflectable/lib/src/encoding_constants.dart
index 8d80f61c27ad2582bd976acb6c6db7c528511f45..5bea637ce42ac6cca04aff3f240e9bbe010a93be 100644
--- a/reflectable/lib/src/encoding_constants.dart
+++ b/reflectable/lib/src/encoding_constants.dart
@@ -4,22 +4,22 @@
library reflectable.encoding_constants;
-// The first bits are used to enumerate the "kind" of the declaration.
-// The more significant bits are flags.
+// The first `flagsBit-1` bits are used to enumerate the "kind" of the
+// declaration. The more significant bits are flags.
+const flagsBit = 4;
// Kinds:
const generativeConstructor = 0;
const factoryConstructor = 1;
-const redirectingConstructor = 2;
-const method = 3;
-const getter = 4;
-const setter = 5;
+const method = 2;
+const getter = 3;
+const setter = 4;
// Flags:
-const staticAttribute = 16;
-const abstractAttribute = 32;
-const constAttribute = 64;
-const privateAttribute = 128;
-const syntheticAttribute = 256;
+const staticAttribute = 1 << (flagsBit);
+const privateAttribute = 1 << (flagsBit + 1);
+const syntheticAttribute = 1 << (flagsBit + 2);
+const constAttribute = 1 << (flagsBit + 3);
+const redirectingConstructor = 1 << (flagsBit + 4);
-int kindFromEncoding(int encoding) => encoding & 15;
+int kindFromEncoding(int encoding) => encoding & ((1 << flagsBit) - 1);

Powered by Google App Engine
This is Rietveld 408576698