本文整理汇总了TypeScript中@babel/types.isClassMethod函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isClassMethod函数的具体用法?TypeScript isClassMethod怎么用?TypeScript isClassMethod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isClassMethod函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getConstructorClassMethod
export function getConstructorClassMethod(astNode: babel.Class):
babel.ClassMethod|undefined {
for (const member of astNode.body.body) {
if (babel.isClassMethod(member) && member.kind === 'constructor') {
return member;
}
}
}
示例2: _getMethods
function* _getMethods(node: babel.Node) {
if (!babel.isClassDeclaration(node) && !babel.isClassExpression(node)) {
return;
}
for (const statement of node.body.body) {
if (babel.isClassMethod(statement) && statement.kind === 'method') {
yield statement;
}
}
}
示例3: extractPropertyFromGetterOrSetter
export function extractPropertyFromGetterOrSetter(
method: babel.ClassMethod|babel.ObjectMethod,
jsdocAnn: jsdoc.Annotation|undefined,
document: JavaScriptDocument): ScannedProperty|null {
// TODO(43081j): remove this when static properties are supported
if (babel.isClassMethod(method) && method.static) {
return null;
}
if (method.kind !== 'get' && method.kind !== 'set') {
return null;
}
// TODO(43081j): use getPropertyName, see
// https://github.com/Polymer/polymer-analyzer/pull/867
const name = getPropertyName(method);
if (name === undefined) {
return null;
}
let type;
let description;
let privacy: Privacy = 'public';
let readOnly = false;
if (jsdocAnn) {
const ret = getReturnFromAnnotation(jsdocAnn);
type = ret ? ret.type : undefined;
description = jsdoc.getDescription(jsdocAnn);
privacy = getOrInferPrivacy(name, jsdocAnn);
readOnly = jsdoc.hasTag(jsdocAnn, 'readonly');
}
return {
name,
astNode: {language: 'js', node: method, containingDocument: document},
type,
jsdoc: jsdocAnn,
sourceRange: document.sourceRangeForNode(method)!,
description,
privacy,
warnings: [],
readOnly,
};
}
示例4: getIdentifierName
(n) => babel.isClassMethod(n) && n.static === true &&
n.kind === 'get' && getIdentifierName(n.key) === name) as