All files / src/ast/collection inline-list.ts

100% Statements 18/18
100% Branches 5/5
100% Functions 3/3
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  1x 1x 1x   1x 1x 18x 18x   1x 14x 14x 28x 28x 14x 14x   1x 2x 2x 1x  
import type { ExpressionState } from '../../expression-state.js';
import { TypedValue } from '../../typed-value.js';
import { SpelNodeImpl } from '../spel-node.js';
import { NodeType } from '../../language/node-type.js';
 
export class InlineList extends SpelNodeImpl {
  constructor(startPos: number, endPos: number, ...elements: SpelNodeImpl[]) {
    super(NodeType.INLINE_LIST, startPos, endPos, ...elements);
  }
 
  public getValueInternal(state: ExpressionState): TypedValue {
    const result: unknown[] = [];
    for (const child of this.children) {
      result.push(child.getValue(state).getValue());
    }
    return new TypedValue(result);
  }
 
  public toStringAST(): string {
    return '{' + this.children.map((c) => c.toStringAST()).join(', ') + '}';
  }
}