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

100% Statements 7/7
100% Branches 0/0
100% Functions 4/4
100% Lines 6/6

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              27x       23x 23x 57x   23x       6x      
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(', ') + '}';
  }
}