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

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

Issue 1181993003: Add support for getters, setters and constructors in declarations of classMirrors. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Reintroduce abstract members in declarations 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
« no previous file with comments | « reflectable/lib/mirrors.dart ('k') | reflectable/lib/src/mirrors_unimpl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f29fd35b9fae566b879b0107bdb8282857bc3daf 100644
--- a/reflectable/lib/src/encoding_constants.dart
+++ b/reflectable/lib/src/encoding_constants.dart
@@ -4,22 +4,23 @@
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);
+const abstractAttribute = 1 << (flagsBit + 5);
-int kindFromEncoding(int encoding) => encoding & 15;
+int kindFromEncoding(int encoding) => encoding & ((1 << flagsBit) - 1);
« no previous file with comments | « reflectable/lib/mirrors.dart ('k') | reflectable/lib/src/mirrors_unimpl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698