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AAQ,EAAE,EAAZ,CAAY,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,CAAC,MAAM,CAAC;IAClB,CAAC;IAMD,gCAAQ,GAAR;QACI,IAAM,IAAI,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAChE,IAAI,QAAQ,GAAG,EAAE,CAAC;QAClB,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACrB,QAAQ,IAAI,GAAG,CAAC;YAChB,QAAQ,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,QAAQ,EAAE,EAAd,CAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrE,QAAQ,IAAI,GAAG,CAAC;QACpB,CAAC;QAED,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;IAC3B,CAAC;IA3EM,gCAAkB,GAAW,CAAC,CAAC,CAAC;IAKhC,uCAAyB,GAAW,CAAC,CAAC,CAAC;IAuElD,oBAAC;CAAA,AAjHD,CAAmC,eAAI,GAiHtC;AAjHY,sCAAa","sourcesContent":["import { Reflection } from '../reflections/abstract';\nimport { Type } from './abstract';\n\n/**\n * Represents a type that refers to another reflection like a class, interface or enum.\n *\n * ~~~\n * let value: MyClass;\n * ~~~\n */\nexport class ReferenceType extends Type {\n /**\n * The type name identifier.\n */\n readonly type: string = 'reference';\n\n /**\n * The name of the referenced type.\n *\n * If the symbol cannot be found cause it's not part of the documentation this\n * can be used to represent the type.\n */\n name: string;\n\n /**\n * The type arguments of this reference.\n */\n typeArguments: Type[];\n\n /**\n * The symbol id of the referenced type as returned from the TypeScript compiler.\n *\n * After the all reflections have been generated this is can be used to lookup the\n * relevant reflection with [[ProjectReflection.symbolMapping]].\n */\n symbolID: number;\n\n /**\n * The resolved reflection.\n *\n * The [[TypePlugin]] will try to set this property in the resolving phase.\n */\n reflection: Reflection;\n\n /**\n * Special symbol ID noting that the reference of a ReferenceType was known when creating the type.\n */\n static SYMBOL_ID_RESOLVED: number = -1;\n\n /**\n * Special symbol ID noting that the reference should be resolved by the type name.\n */\n static SYMBOL_ID_RESOLVE_BY_NAME: number = -2;\n\n /**\n * Create a new instance of ReferenceType.\n *\n * @param name The name of the referenced type.\n * @param symbolID The symbol id of the referenced type as returned from the TypeScript compiler.\n * @param reflection The resolved reflection if already known.\n */\n constructor(name: string, symbolID: number, reflection?: Reflection) {\n super();\n this.name = name;\n this.symbolID = symbolID;\n this.reflection = reflection;\n }\n\n /**\n * Clone this type.\n *\n * @return A clone of this type.\n */\n clone(): Type {\n const clone = new ReferenceType(this.name, this.symbolID, this.reflection);\n clone.typeArguments = this.typeArguments;\n return clone;\n }\n\n /**\n * Test whether this type equals the given type.\n *\n * @param type The type that should be checked for equality.\n * @returns TRUE if the given type equals this type, FALSE otherwise.\n */\n equals(type: ReferenceType): boolean {\n return type instanceof ReferenceType &&\n (type.symbolID === this.symbolID || type.reflection === this.reflection);\n }\n\n /**\n * Return a raw object representation of this type.\n */\n toObject(): any {\n const result: any = super.toObject();\n result.name = this.name;\n\n if (this.reflection) {\n result.id = this.reflection.id;\n }\n\n if (this.typeArguments) {\n result.typeArguments = this.typeArguments.map((t) => t.toObject());\n }\n\n return result;\n }\n\n /**\n * Return a string representation of this type.\n * @example EventEmitter<any>\n */\n toString() {\n const name = this.reflection ? this.reflection.name : this.name;\n let typeArgs = '';\n if (this.typeArguments) {\n typeArgs += '<';\n typeArgs += this.typeArguments.map(arg => arg.toString()).join(', ');\n typeArgs += '>';\n }\n\n return name + typeArgs;\n }\n}\n"]}
|