147
* may choose not to memoize arguments if they do not otherwise escape.
148
*/
149
noAlias?: boolean;
150
+
151
+ /**
152
+ * Supported only for methods (no-op when used on functions in CallExpression.callee position).
153
+ *
154
+ * Indicates that the method can only modify its receiver if any of the arguments
155
+ * are mutable or are function expressions which mutate their arguments. This is designed
156
+ * for methods such as Array.prototype.map(), which only mutate the receiver array if they are
157
+ * passed a callback which has mutable side-effects (including mutating its inputs).
158
+ *
159
+ * MethodCalls to such functions will use a different behavior depending on their arguments:
160
+ * - If arguments are all non-mutable, the arguments get the Read effect and the receiver is Capture.
161
+ * - Else uses the effects specified by this signature.
162
+ */
163
+ mutableOnlyIfOperandsAreMutable?: boolean;
164
};
165
166
/*
245
calleeEffect: Effect.ConditionallyMutate,
246
returnValueKind: ValueKind.Mutable,
247
noAlias: true,
248
+ mutableOnlyIfOperandsAreMutable: true,
249
}),
250
],
251
[
262
calleeEffect: Effect.ConditionallyMutate,
263
returnValueKind: ValueKind.Mutable,
264
noAlias: true,
265
+ mutableOnlyIfOperandsAreMutable: true,
266
+ }),
267
+ ],
268
+ [
269
+ "every",
270
+ addFunction(BUILTIN_SHAPES, [], {
271
+ positionalParams: [],
272
+ restParam: Effect.ConditionallyMutate,
273
+ returnType: { kind: "Primitive" },
274
+ /*
275
+ * callee is ConditionallyMutate because items of the array
276
+ * flow into the lambda and may be mutated there, even though
277
+ * the array object itself is not modified
278
+ */
279
+ calleeEffect: Effect.ConditionallyMutate,
280
+ returnValueKind: ValueKind.Immutable,
281
+ noAlias: true,
282
+ mutableOnlyIfOperandsAreMutable: true,
283
+ }),
284
+ ],
285
+ [
286
+ "some",
287
+ addFunction(BUILTIN_SHAPES, [], {
288
+ positionalParams: [],
289
+ restParam: Effect.ConditionallyMutate,
290
+ returnType: { kind: "Primitive" },
291
+ /*
292
+ * callee is ConditionallyMutate because items of the array
293
+ * flow into the lambda and may be mutated there, even though
294
+ * the array object itself is not modified
295
+ */
296
+ calleeEffect: Effect.ConditionallyMutate,
297
+ returnValueKind: ValueKind.Immutable,
298
+ noAlias: true,
299
+ mutableOnlyIfOperandsAreMutable: true,
300
+ }),
301
+ ],
302
+ [
303
+ "find",
304
+ addFunction(BUILTIN_SHAPES, [], {
305
+ positionalParams: [],
306
+ restParam: Effect.ConditionallyMutate,
307
+ returnType: { kind: "Poly" },
308
+ calleeEffect: Effect.ConditionallyMutate,
309
+ returnValueKind: ValueKind.Mutable,
310
+ noAlias: true,
311
+ mutableOnlyIfOperandsAreMutable: true,
312
+ }),
313
+ ],
314
+ [
315
+ "findIndex",
316
+ addFunction(BUILTIN_SHAPES, [], {
317
+ positionalParams: [],
318
+ restParam: Effect.ConditionallyMutate,
319
+ returnType: { kind: "Primitive" },
320
+ /*
321
+ * callee is ConditionallyMutate because items of the array
322
+ * flow into the lambda and may be mutated there, even though
323
+ * the array object itself is not modified
324
+ */
325
+ calleeEffect: Effect.ConditionallyMutate,
326
+ returnValueKind: ValueKind.Immutable,
327
+ noAlias: true,
328
+ mutableOnlyIfOperandsAreMutable: true,
329
}),
330
],
331
[