Index: pkg/fletchc/lib/src/fletch_selector.dart |
diff --git a/pkg/fletchc/lib/src/fletch_selector.dart b/pkg/fletchc/lib/src/fletch_selector.dart |
deleted file mode 100644 |
index 78a2e73ed4962a591db3d9590a5d9f24ee54ecb6..0000000000000000000000000000000000000000 |
--- a/pkg/fletchc/lib/src/fletch_selector.dart |
+++ /dev/null |
@@ -1,50 +0,0 @@ |
-// Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
-// for details. All rights reserved. Use of this source code is governed by a |
-// BSD-style license that can be found in the LICENSE.md file. |
- |
-library fletchc.fletch_selector; |
- |
-enum SelectorKind { |
- Method, |
- Getter, |
- Setter, |
-} |
- |
-class FletchSelector { |
- final int encodedSelector; |
- |
- const FletchSelector(this.encodedSelector); |
- |
- int get id => decodeId(encodedSelector); |
- |
- SelectorKind get kind => SelectorKind.values[encodedSelector >> 8 & 3]; |
- |
- int get arity => encodedSelector & 255; |
- |
- static const MAX_ARITY = (1 << 8) - 1; |
- static const MAX_UNIQUE_SELECTORS = (1 << 22) - 1; |
- static const ID_SHIFT = 10; |
- |
- // Encode a fletch selector. The result is a 32bit integer with the following |
- // layout (lower to higher): |
- // - 8 bit arity |
- // - 2 bit kind |
- // - 22 bit id |
- static int encode(int id, SelectorKind kind, int arity) { |
- if (arity > MAX_ARITY) throw "Only arity up to 255 is supported"; |
- if (id > MAX_UNIQUE_SELECTORS) { |
- throw "Only ${MAX_UNIQUE_SELECTORS + 1} unique identifiers is supported"; |
- } |
- return arity | (kind.index << 8) | (id << ID_SHIFT); |
- } |
- |
- static int encodeMethod(int id, int arity) { |
- return encode(id, SelectorKind.Method, arity); |
- } |
- |
- static int encodeGetter(int id) => encode(id, SelectorKind.Getter, 0); |
- |
- static int encodeSetter(int id) => encode(id, SelectorKind.Setter, 1); |
- |
- static int decodeId(int selector) => selector >> ID_SHIFT; |
-} |