MCPcopy
hub / github.com/bazelbuild/bazel / of

Method of

src/main/java/net/starlark/java/eval/StarlarkInt.java:55–66  ·  view source on GitHub ↗

Returns the Starlark int value that represents x.

(int x)

Source from the content-addressed store, hash-verified

53
54 /** Returns the Starlark int value that represents x. */
55 public static StarlarkInt of(int x) {
56 int index = x - LEAST_SMALLINT; // (may overflow)
57 if (0 <= index && index < smallints.length) {
58 Int32 xi = smallints[index];
59 if (xi == null) {
60 xi = new Int32(x);
61 smallints[index] = xi;
62 }
63 return xi;
64 }
65 return new Int32(x);
66 }
67
68 /** Returns the Starlark int value that represents x. */
69 public static StarlarkInt of(long x) {

Callers 15

testDictionaryAccessMethod · 0.95
testListIndexMethodMethod · 0.95
testHashMethod · 0.95
testRangeTypeMethod · 0.95
testLenOnStringMethod · 0.95
testLenOnListMethod · 0.95
testLenOnDictMethod · 0.95
checkImmutableMethod · 0.95

Calls 1

longValueMethod · 0.45

Tested by 15

testDictionaryAccessMethod · 0.76
testListIndexMethodMethod · 0.76
testHashMethod · 0.76
testRangeTypeMethod · 0.76
testLenOnStringMethod · 0.76
testLenOnListMethod · 0.76
testLenOnDictMethod · 0.76
checkImmutableMethod · 0.76