(name, ty, is_parameter, is_buffer)
| 10550 | return slot; |
| 10551 | } |
| 10552 | addOrCheckAttribute(name, ty, is_parameter, is_buffer) { |
| 10553 | is_parameter = is_parameter || false; |
| 10554 | is_buffer = is_buffer || false; |
| 10555 | const slot_idx = this.findAttributeSlot(name); |
| 10556 | if (slot_idx === null) { |
| 10557 | return this.addAttribute(name, ty, is_parameter, is_buffer); |
| 10558 | } |
| 10559 | // TORCH_CHECK(is_parameter == this.is_parameter(*slot_idx), "Parameter field mismatch for the field '", name, "'"); |
| 10560 | // const TypePtr& atype = getAttribute(*slot_idx); |
| 10561 | // TORCH_CHECK(ty.isSubtypeOf(*atype), ty.repr_str(), " is not compatible with the type ", atype.repr_str(), " for the field '", name, "'"); |
| 10562 | return slot_idx; |
| 10563 | } |
| 10564 | findAttributeSlot(name) { |
| 10565 | for (let pos = 0; pos < this._attributes.length; pos++) { |
| 10566 | if (name === this._attributes[pos].name) { |
no test coverage detected