Interpolation constructor

Interpolation(
  1. Iterable<Object> contents,
  2. FileSpan span
)

Implementation

Interpolation(Iterable<Object /* String | Expression */ > contents, this.span)
    : contents = List.unmodifiable(contents) {
  for (var i = 0; i < this.contents.length; i++) {
    if (this.contents[i] is! String && this.contents[i] is! Expression) {
      throw ArgumentError.value(this.contents, "contents",
          "May only contains Strings or Expressions.");
    }

    if (i != 0 &&
        this.contents[i - 1] is String &&
        this.contents[i] is String) {
      throw ArgumentError.value(
          this.contents, "contents", "May not contain adjacent Strings.");
    }
  }
}