MCPcopy Index your code
hub / github.com/lebab/lebab / toMethodDefinition

Method toMethodDefinition

src/transform/class/PotentialMethod.js:52–73  ·  view source on GitHub ↗

* Transforms the potential method to actual MethodDefinition node. * @return {MethodDefinition}

()

Source from the content-addressed store, hash-verified

50 * @return {MethodDefinition}
51 */
52 toMethodDefinition() {
53 return {
54 type: 'MethodDefinition',
55 key: {
56 type: 'Identifier',
57 name: this.name,
58 },
59 computed: false,
60 value: {
61 type: 'FunctionExpression',
62 async: this.methodNode.async,
63 params: this.methodNode.params,
64 defaults: this.methodNode.defaults,
65 body: this.getBody(),
66 generator: false,
67 expression: false,
68 },
69 kind: this.kind,
70 static: this.static,
71 comments: extractComments(this.commentNodes),
72 };
73 }
74
75 /**
76 * Removes original prototype assignment node from AST.

Callers 2

createMethodsMethod · 0.80
createConstructorMethod · 0.80

Calls 2

getBodyMethod · 0.95
extractCommentsFunction · 0.85

Tested by

no test coverage detected