當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。