Skip to content

Instantly share code, notes, and snippets.

@cevek
Created February 9, 2015 10:02
Show Gist options
  • Save cevek/8fba2e0a0d899e49920b to your computer and use it in GitHub Desktop.
Save cevek/8fba2e0a0d899e49920b to your computer and use it in GitHub Desktop.
emitConstructorOfClass
function emitConstructorOfClass() {
var saveTempCount = tempCount;
var saveTempVariables = tempVariables;
var saveTempParameters = tempParameters;
tempCount = 0;
tempVariables = undefined;
tempParameters = undefined;
ts.forEach(node.members, function (member) {
if (member.kind === 129 /* Constructor */ && !member.body) {
emitPinnedOrTripleSlashComments(member);
}
});
var ctor = getFirstConstructorWithBody(node);
if (ctor) {
emitLeadingComments(ctor);
}
emitStart(ctor || node);
write("function ");
emit(node.name);
emitSignatureParameters(ctor);
write(" {");
scopeEmitStart(node, "constructor");
increaseIndent();
write('this.changes__ = {};');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment