@microsoft/api-extractor
Version:
Validate, document, and review the exported API for a TypeScript library
59 lines • 2.5 kB
JavaScript
;
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
const AstPackage_1 = require("../ast/AstPackage");
const AstEnum_1 = require("../ast/AstEnum");
const AstEnumValue_1 = require("../ast/AstEnumValue");
const AstFunction_1 = require("../ast/AstFunction");
const AstStructuredType_1 = require("../ast/AstStructuredType");
const AstMethod_1 = require("../ast/AstMethod");
const AstNamespace_1 = require("../ast/AstNamespace");
const AstProperty_1 = require("../ast/AstProperty");
const AstModuleVariable_1 = require("../ast/AstModuleVariable");
/**
* This is a helper class that provides a standard way to walk the AstItem
* abstract syntax tree.
*/
class AstItemVisitor {
visit(astItem, refObject) {
if (astItem instanceof AstStructuredType_1.AstStructuredType) {
this.visitAstStructuredType(astItem, refObject);
}
else if (astItem instanceof AstEnum_1.AstEnum) {
this.visitAstEnum(astItem, refObject);
}
else if (astItem instanceof AstEnumValue_1.AstEnumValue) {
this.visitAstEnumValue(astItem, refObject);
}
else if (astItem instanceof AstFunction_1.AstFunction) {
this.visitAstFunction(astItem, refObject);
}
else if (astItem instanceof AstPackage_1.AstPackage) {
this.visitAstPackage(astItem, refObject);
}
else if (astItem instanceof AstProperty_1.AstProperty) {
this.visitAstProperty(astItem, refObject);
}
else if (astItem instanceof AstMethod_1.AstMethod) {
this.visitAstMethod(astItem, refObject);
}
else if (astItem instanceof AstNamespace_1.AstNamespace) {
this.visitAstNamespace(astItem, refObject);
}
else if (astItem instanceof AstModuleVariable_1.AstModuleVariable) {
this.visitAstModuleVariable(astItem, refObject);
}
else {
throw new Error('Not implemented');
}
}
visitAstMethod(astMethod, refObject) {
this.visitAstMember(astMethod, refObject);
}
visitAstProperty(astProperty, refObject) {
this.visitAstMember(astProperty, refObject);
}
}
exports.AstItemVisitor = AstItemVisitor;
//# sourceMappingURL=AstItemVisitor.js.map