All files ArrayType.ts

82.75% Statements 24/29
100% Branches 0/0
0% Functions 0/4
82.75% Lines 24/29

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 24 25 26 27 28 29 301x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x           1x 1x 1x 1x 1x  
/*
 * This file is released under the MIT license.
 * Copyright (c) 2023, Mike Lischke
 *
 * See LICENSE file for more info.
 */
 
import { Type, ReferenceKind, TypeKind } from "./types";
 
import { BaseSymbol } from "./BaseSymbol";
 
export class ArrayType extends BaseSymbol implements Type {
 
    public readonly elementType: Type;
    public readonly size: number; // > 0 if fixed length.
 
    private referenceKind: ReferenceKind;
 
    public constructor(name: string, referenceKind: ReferenceKind, elemType: Type, size = 0) {
        super(name);
        this.referenceKind = referenceKind;
        this.elementType = elemType;
        this.size = size;
    }
 
    public get baseTypes(): Type[] { return []; }
    public get kind(): TypeKind { return TypeKind.Array; }
    public get reference(): ReferenceKind { return this.referenceKind; }
}