getConstantValue method

  1. @override
Vector getConstantValue()
override

Returns the constant value of this literal. Throws StateError if literal is not constant, check before usage with isConstant().

Implementation

@override
Vector getConstantValue() {
  // TODO unit test
  final constVals = elements.map<Expression>((e) => (e is Literal)
      ? e.getConstantValue()
      : throw UnsupportedError('Vector $this is not constant.'));

  return Vector(constVals as List<Expression>);
}