()
| 1332 | jsDeclaredCopy(js: NodeCompiler, written?: Key[]): NodeCompiler { |
| 1333 | if (this.sequence || this.writesInto(js)) return js |
| 1334 | const copyKeys = () => { |
| 1335 | for (const prop of this.inOrder) { |
| 1336 | if (written?.includes(prop.key) || prop.key in Object.prototype) |
| 1337 | continue |
| 1338 | js.line(`${js.ref(keepOwn)}(out, data, ${js.serialize(prop.key)})`) |
| 1339 | } |
| 1340 | // out inherits these, so only an own one is missing |
| 1341 | for (const prop of this.protoProps) { |
| 1342 | js.if( |
| 1343 | `!Object.prototype.hasOwnProperty.call(out, ${js.serialize(prop.key)}) && Object.prototype.hasOwnProperty.call(data, ${js.serialize(prop.key)})`, |
| 1344 | () => |
| 1345 | js.line( |
| 1346 | jsSetOwnProp(js, "out", prop.key, `data${js.prop(prop.key)}`) |
| 1347 | ) |
| 1348 | ) |
| 1349 | } |
| 1350 | return js |
| 1351 | } |
| 1352 | return written === undefined ? js.if("out !== data", copyKeys) : copyKeys() |
| 1353 | } |
| 1354 |
nothing calls this directly
no test coverage detected