import { Type } from "./type";
import { IType } from "./itype";

export class MultiType implements IType {

  constructor (public types: Type[]) {
  }

  get value () {
    return undefined;
  }

  get ord () {
    return undefined;
  }

  stringInfo () {
    let list: any[] = [];
    for (let i = 0; i < this.types.length; i++) {
      const t = this.types[i];
      list = list.concat(t.stringInfo());
    }
    return list;
  }

  isCompatible (another: Type) {
    for (let i = 0; i < this.types.length; i++) {
      const t = this.types[i];
      if (another.isCompatible(t)) {
        return true;
      }
    }
    return false;
  }
}