import { assert } from "../fixed_assert" ; import { nonNullValue } from "../util/nonNull" ; import { DefinitionKind } from "./INamedDefinition" ; import { IReference } from "./IReference" ; /**
 * A list of references that have been found.
 */ export class ReferenceList { constructor ( private _type , private _refs = [ ] ) { nonNullValue ( _type , "_type" ) ; nonNullValue ( _refs , "_refs" ) ; } public get length ( ) : number { return this . _refs . length ; } public get references ( ) : IReference [ ] { return this . _refs ; } public get kind ( ) : DefinitionKind { return this . _type ; } public add ( reference ) { this . _refs . push ( reference ) ; } public addAll ( list ) { assert . deepStrictEqual ( this . _type , list . kind , "Cannot add references from a list of a different reference type." ) ; for ( const ref of list . references ) { this . add ( ref ) ; } } }