当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Context.updateReflection方法代码示例

本文整理汇总了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);
            }
        }
    }
开发者ID:rbuckton,项目名称:QueryJS,代码行数:23,代码来源:naming.ts

示例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;
             }
         }
     }
 }
开发者ID:rbuckton,项目名称:QueryJS,代码行数:36,代码来源:exports.ts


注:本文中的typedoc/dist/lib/converter.Context.updateReflection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。