當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript converter.Context類代碼示例

本文整理匯總了TypeScript中typedoc/dist/lib/converter.Context的典型用法代碼示例。如果您正苦於以下問題:TypeScript Context類的具體用法?TypeScript Context怎麽用?TypeScript Context使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Context類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: onEnd

 private onEnd(context: Context) {
     if (this.excludeNotExported) {
         context.removeReflections(this.notExported);
         this.notExported = undefined!;
     }
     this.application.options.setValue("excludeNotExported", this.excludeNotExported);
 }
開發者ID:rbuckton,項目名稱:QueryJS,代碼行數:7,代碼來源:exports.ts

示例2: 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

示例3: 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

示例4: onCreateDeclaration

 private onCreateDeclaration(context: Context, reflection: DeclarationReflection, node: ts.Node | undefined) {
     if (node && ts.isExportSpecifier(node)) {
         return;
     }
     if (node && node.parent && ts.isSourceFile(node.parent) && !ts.isExternalModule(node.parent)) {
         // ignore globals
         return;
     }
     if (reflection.kindOf(ReflectionKind.ExternalModule) && node && ts.isSourceFile(node) && node.symbol) {
         const renameTo = getRename(node);
         if (renameTo) {
             this.renames.push({ symbolID: context.getSymbolID(node.symbol), renameTo });
         }
     }
     if (reflection.kindOf(ReflectionKind.Method) && reflection.flags.isExported && node && ts.isFunctionDeclaration(node) && !(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export)) {
         // A function in a module that merges with a class declaration should *not* be explicitly exported.
         reflection.setFlag(ReflectionFlag.Exported, false);
     }
     if (reflection.kindOf(ReflectionKind.ModuleMember | ReflectionKind.ClassMember) && !reflection.flags.isExported) {
         this.notExported.add(reflection);
     }
 }
開發者ID:rbuckton,項目名稱:QueryJS,代碼行數:22,代碼來源:exports.ts

示例5: convert

 convert(context: Context, node: ts.ExportDeclaration) {
     if (node.exportClause) {
         for (const specifier of node.exportClause.elements) {
             const exportedName = ts.unescapeLeadingUnderscores(specifier.name.escapedText);
             const localName = specifier.propertyName ? ts.unescapeLeadingUnderscores(specifier.propertyName.escapedText) : exportedName;
             const symbol = getTargetSymbol(context, context.checker.getExportSpecifierLocalTargetSymbol(specifier));
             // const kind = !symbol ? ReflectionKind.Variable :
             //     symbol.flags & ts.SymbolFlags.Function ? ReflectionKind.Function :
             //     symbol.flags & ts.SymbolFlags.Class ? ReflectionKind.Class :
             //     symbol.flags & ts.SymbolFlags.Interface ? ReflectionKind.Interface :
             //     symbol.flags & ts.SymbolFlags.Enum ? ReflectionKind.Enum :
             //     symbol.flags & ts.SymbolFlags.TypeAlias ? ReflectionKind.TypeAlias :
             //     symbol.flags & ts.SymbolFlags.Variable ? ReflectionKind.Variable :
             //     // symbol.flags & ts.SymbolFlags.Module ? ReflectionKind.Module :
             //     ReflectionKind.Variable;
             const kind = ReflectionKind.Export;
             const reflection = createDeclaration(context, specifier, kind, exportedName);
             if (reflection) {
                 reflection.exportOf = new ExportBinding(localName, symbol && context.getSymbolID(symbol));
             }
         }
     }
     return context.scope;
 }
開發者ID:rbuckton,項目名稱:QueryJS,代碼行數:24,代碼來源:exportDeclaration.ts

示例6: onCreateParameter

 private onCreateParameter(context: Context, parameter: ParameterReflection, node: ts.ParameterDeclaration | undefined) {
     if (node && (ts.isObjectBindingPattern(node.name) || ts.isArrayBindingPattern(node.name)) && parameter.type) {
         parameter.type = context.converter.convertType(context, node.type, context.getTypeAtLocation(node));
     }
 }
開發者ID:rbuckton,項目名稱:QueryJS,代碼行數:5,代碼來源:naming.ts

示例7: onEnd

 private onEnd(context: Context) {
     context.removeReflections(this.reflectionsToRemove);
     this.reflectionsToRemove = undefined!;
     enableRename = false;
 }
開發者ID:rbuckton,項目名稱:QueryJS,代碼行數:5,代碼來源:naming.ts

示例8: onEnd

 private onEnd(context: Context) {
     context.removeReflections(this.reflectionsToRemove);
     this.shouldStripInternal = false;
     this.reflectionsToRemove = undefined!;
 }
開發者ID:rbuckton,項目名稱:QueryJS,代碼行數:5,代碼來源:stripInternal.ts

示例9: createBiblioReflection

 function createBiblioReflection(name: string, url: string) {
     const symbol = checker.resolveName(name, undefined, ts.SymbolFlags.Type, false);
     if (symbol) {
         for (const node of symbol.declarations) {
             const kind = 
                 ts.isInterfaceDeclaration(node) ? ReflectionKind.Interface :
                 ts.isClassDeclaration(node) ? ReflectionKind.Class :
                 ts.isEnumDeclaration(node) ? ReflectionKind.Enum :
                 ts.isModuleDeclaration(node) ? ts.isStringLiteral(node.name) ? ReflectionKind.ExternalModule : ReflectionKind.Module :
                 ts.isTypeAliasDeclaration(node) ? ReflectionKind.TypeAlias :
                 ts.isVariableDeclaration(node) ? ReflectionKind.Variable :
                 undefined;
             if (kind === undefined) continue;
             const reflection = new DeclarationReflection(context.project, name, kind);
             context.registerReflection(reflection, node, symbol);
             context.trigger(Converter.EVENT_CREATE_DECLARATION, reflection, node);
             if (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) {
                 context.withScope(reflection, node.typeParameters!, () => {});
             }
             if (reflection) {
                 reflection.url = url;
                 reflection.urlTarget = "external";
             }
         }
     }
 }
開發者ID:rbuckton,項目名稱:QueryJS,代碼行數:26,代碼來源:biblio.ts

示例10: removeEmptyReflection

 function removeEmptyReflection(reflection: Reflection) {
     if (reflection.kindOf(ReflectionKind.SomeModule) && reflection instanceof ContainerReflection) {
         if (!reflection.comment || !reflection.comment.hasTag("preferred")) {
             if (!reflection.children || reflection.children.length === 0) {
                 if (!(reflection instanceof DeclarationReflection && reflection.exportOf)) {
                     context.removeReflection(reflection);
                     return true;
                 }
             }
         }
     }
     return false;
 }
開發者ID:rbuckton,項目名稱:QueryJS,代碼行數:13,代碼來源:excludeEmpty.ts


注:本文中的typedoc/dist/lib/converter.Context類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。