* @constructor IndexNode * @extends Node * * Describes a subset of a matrix or an object property. * Cannot be used on its own, needs to be used within an AccessorNode or * AssignmentNode. * * @param {Node[]} dimensions * @param {boolean} [dotNotation=false]
(dimensions, dotNotation)
| 27 | * (which is the default). This property is used for string conversion. |
| 28 | */ |
| 29 | constructor (dimensions, dotNotation) { |
| 30 | super() |
| 31 | this.dimensions = dimensions |
| 32 | this.dotNotation = dotNotation || false |
| 33 | |
| 34 | // validate input |
| 35 | if (!Array.isArray(dimensions) || !dimensions.every(isNode)) { |
| 36 | throw new TypeError( |
| 37 | 'Array containing Nodes expected for parameter "dimensions"') |
| 38 | } |
| 39 | if (this.dotNotation && !this.isObjectProperty()) { |
| 40 | throw new Error('dotNotation only applicable for object properties') |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | static name = name |
| 45 | get type () { return name } |
nothing calls this directly
no test coverage detected