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;SACtE;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAMD,QAAQ;QACJ,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAChE,IAAI,QAAQ,GAAG,EAAE,CAAC;QAClB,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,QAAQ,IAAI,GAAG,CAAC;YAChB,QAAQ,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrE,QAAQ,IAAI,GAAG,CAAC;SACnB;QAED,OAAO,IAAI,GAAG,QAAQ,CAAC;IAC3B,CAAC;;AA5EM,gCAAkB,GAAG,CAAC,CAAC,CAAC;AAKxB,uCAAyB,GAAG,CAAC,CAAC,CAAC;AA1C1C,sCAkHC","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 = -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 = -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 * @deprecated Use serializers instead\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 && this.typeArguments.length) {\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"]}
\No newline at end of file