* Updates default using the provided runtime. * @param {RuntimeSpec} runtime the runtimes * @param {R} value the value
(runtime, value)
| 512 | * @param {R} value the value |
| 513 | */ |
| 514 | set(runtime, value) { |
| 515 | switch (this._mode) { |
| 516 | case 0: |
| 517 | this._mode = 1; |
| 518 | this._singleRuntime = runtime; |
| 519 | this._singleValue = value; |
| 520 | break; |
| 521 | case 1: |
| 522 | if (runtimeEqual(this._singleRuntime, runtime)) { |
| 523 | this._singleValue = value; |
| 524 | break; |
| 525 | } |
| 526 | this._mode = 2; |
| 527 | this._map = new Map(); |
| 528 | this._map.set( |
| 529 | getRuntimeKey(this._singleRuntime), |
| 530 | /** @type {R} */ (this._singleValue) |
| 531 | ); |
| 532 | this._singleRuntime = undefined; |
| 533 | this._singleValue = undefined; |
| 534 | /* falls through */ |
| 535 | default: |
| 536 | /** @type {RuntimeSpecMapInnerMap<R>} */ |
| 537 | (this._map).set(getRuntimeKey(runtime), value); |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | /** |
| 542 | * Returns the new value. |
no test coverage detected