MCPcopy Create free account
hub / github.com/bazelbuild/bazel / freeze

Method freeze

src/test/java/net/starlark/java/eval/ScriptTest.java:165–181  ·  view source on GitHub ↗
(Object x, StarlarkThread thread)

Source from the content-addressed store, hash-verified

163 }
164
165 @StarlarkMethod(
166 name = "freeze",
167 doc = "Shallow-freezes the operand. With no argument, freezes the thread.",
168 parameters = {@Param(name = "x", defaultValue = "unbound")},
169 useStarlarkThread = true)
170 public void freeze(Object x, StarlarkThread thread) throws EvalException {
171 if (x == Starlark.UNBOUND) {
172 thread.mutability().close();
173 return;
174 }
175
176 if (x instanceof Mutability.Freezable) {
177 ((Mutability.Freezable) x).unsafeShallowFreeze();
178 } else {
179 throw Starlark.errorf("%s value is not freezable", Starlark.type(x));
180 }
181 }
182
183 @StarlarkMethod(
184 name = "int_mul_slow",

Callers

nothing calls this directly

Calls 5

errorfMethod · 0.95
typeMethod · 0.95
closeMethod · 0.65
mutabilityMethod · 0.65
unsafeShallowFreezeMethod · 0.65

Tested by

no test coverage detected