| 526 | it('should stringify an AccessorNode with custom toString', function () { |
| 527 | // Also checks if the custom functions get passed on to the children |
| 528 | const customFunction = function (node, options) { |
| 529 | if (node.type === 'AccessorNode') { |
| 530 | let string = node.object.toString(options) + ' at ' |
| 531 | node.index.dimensions.forEach(function (range) { |
| 532 | string += range.toString(options) + ', ' |
| 533 | }) |
| 534 | |
| 535 | return string |
| 536 | } else if (node.type === 'ConstantNode') { |
| 537 | return 'const(' + node.value + ', ' + math.typeOf(node.value) + ')' |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | const a = new SymbolNode('a') |
| 542 | const b = new ConstantNode(1) |