MCPcopy Index your code
hub / github.com/nodejs/node / createDefaultConstructorBody

Function createDefaultConstructorBody

test/fixtures/snapshot/typescript.js:99097–99114  ·  view source on GitHub ↗
(node, isDerivedClass)

Source from the content-addressed store, hash-verified

99095 || [];
99096 }
99097 function createDefaultConstructorBody(node, isDerivedClass) {
99098 // We must be here because the user didn't write a constructor
99099 // but we needed to call 'super(...args)' anyway as per 14.5.14 of the ES2016 spec.
99100 // If that's the case we can just immediately return the result of a 'super()' call.
99101 var statements = [];
99102 resumeLexicalEnvironment();
99103 factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
99104 if (isDerivedClass) {
99105 // return _super !== null && _super.apply(this, arguments) || this;
99106 statements.push(factory.createReturnStatement(createDefaultSuperCallOrThis()));
99107 }
99108 var statementsArray = factory.createNodeArray(statements);
99109 ts.setTextRange(statementsArray, node.members);
99110 var block = factory.createBlock(statementsArray, /*multiLine*/ true);
99111 ts.setTextRange(block, node);
99112 ts.setEmitFlags(block, 1536 /* EmitFlags.NoComments */);
99113 return block;
99114 }
99115 /**
99116 * Transforms the body of a constructor declaration of a class.
99117 *

Callers 1

transformConstructorBodyFunction · 0.85

Calls 4

resumeLexicalEnvironmentFunction · 0.85
endLexicalEnvironmentFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…