We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d55d24a commit 9ebcce6Copy full SHA for 9ebcce6
runtime/stdlib.js
@@ -215,7 +215,13 @@ function caml_obj_dup (x) {
215
return a;
216
}
217
//Provides: caml_obj_truncate (mutable, const)
218
-function caml_obj_truncate (x, s) { x.length = s + 1; return 0; }
+//Requires: caml_invalid_argument
219
+function caml_obj_truncate (x, s) {
220
+ if (s<=0 || s + 1 > x.length)
221
+ caml_invalid_argument ("Obj.truncate");
222
+ if (x.length != s + 1) x.length = s + 1;
223
+ return 0;
224
+}
225
226
//Provides: caml_lazy_make_forward const (const)
227
function caml_lazy_make_forward (v) { return [250, v]; }
0 commit comments