本文整理汇总了TypeScript中typedoc/dist/lib/converter.Context.updateReflection方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Context.updateReflection方法的具体用法?TypeScript Context.updateReflection怎么用?TypeScript Context.updateReflection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类typedoc/dist/lib/converter.Context
的用法示例。
在下文中一共展示了Context.updateReflection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onCreateDeclaration
private onCreateDeclaration(context: Context, reflection: Reflection, node: ts.Node | undefined) {
// rename built-in symbols
const match = /^__@(\w+)$/.exec(reflection.name);
if (match) {
context.updateReflection(reflection, { name: `[Symbol.${match[1]}]` });
}
// rename computed properties
if (reflection.kindOf(ReflectionKind.ClassMember) && reflection.name === "__computed" && node && ts.isDeclaration(node)) {
const name = ts.getNameOfDeclaration(node);
const symbol = name && context.checker.getSymbolAtLocation(name); // get the late-bound symbol
if (name || symbol) {
context.updateReflection(reflection, {
name: symbol
? context.checker.symbolToString(symbol, /*node*/ undefined, ts.SymbolFlags.ClassMember)
: node.getText()
});
}
else {
this.reflectionsToRemove.add(reflection);
}
}
}
示例2: finishResolution
private finishResolution(context: Context, reflection: DeclarationReflection) {
const binding = reflection.exportOf;
if (!binding || !binding.reflection) return;
binding.isExportStar = binding.reflection.kindOf(ReflectionKind.ExternalModule);
if (!binding.reflection.flags.isExported && reflection.parent === binding.reflection.parent) {
// take on the name of the first export binding.
context.updateReflection(binding.reflection, { name: reflection.name });
binding.reflection.setFlag(ReflectionFlag.Exported, true);
this.notExported.delete(binding.reflection);
this.notExported.add(reflection);
}
else {
if (reflection.kind !== binding.reflection.kind && reflection.parent.kind === binding.reflection.parent.kind) {
context.updateReflection(reflection, { kind: binding.reflection.kind });
if (binding.reflection instanceof DeclarationReflection) {
if (binding.reflection.comment) reflection.comment = binding.reflection.comment;
if (binding.reflection.defaultValue) reflection.defaultValue = binding.reflection.defaultValue;
if (binding.reflection.getSignature) reflection.getSignature = binding.reflection.getSignature;
if (binding.reflection.setSignature) reflection.setSignature = binding.reflection.setSignature;
if (binding.reflection.indexSignature) reflection.indexSignature = binding.reflection.indexSignature;
if (binding.reflection.type) reflection.type = binding.reflection.type;
if (binding.reflection.typeParameters) reflection.typeParameters = binding.reflection.typeParameters;
if (binding.reflection.overwrites) reflection.overwrites = binding.reflection.overwrites;
if (binding.reflection.inheritedFrom) reflection.inheritedFrom = binding.reflection.inheritedFrom;
if (binding.reflection.implementationOf) reflection.implementationOf = binding.reflection.implementationOf;
if (binding.reflection.extendedTypes) reflection.extendedTypes = binding.reflection.extendedTypes;
if (binding.reflection.extendedBy) reflection.extendedBy = binding.reflection.extendedBy;
if (binding.reflection.implementedTypes) reflection.implementedTypes = binding.reflection.implementedTypes;
if (binding.reflection.implementedBy) reflection.implementedBy = binding.reflection.implementedBy;
if (binding.reflection.typeHierarchy) reflection.typeHierarchy = binding.reflection.typeHierarchy;
if (binding.reflection.signatures) reflection.signatures = binding.reflection.signatures.map(sig => cloneSignatureReflectionWithName(sig, reflection, binding));
if (binding.reflection.sources) reflection.sources = binding.reflection.sources;
}
}
}
}