compoundType.js 433 B

1234567891011121314151617181920
  1. import { Type } from "./types";
  2. export class CompoundType extends Type {
  3. constructor (type, dimensions) {
  4. super(null);
  5. this.innerType = type;
  6. this.dimensions = dimensions;
  7. }
  8. isCompatible (another) {
  9. if(another instanceof CompoundType){
  10. if(this.dimensions !== another.dimensions) {
  11. return false;
  12. }
  13. return this.innerType.isCompatible(another.innerType);
  14. }
  15. return false;
  16. }
  17. }