mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 01:43:59 -05:00
Emit detached comments for constructor body
This commit is contained in:
@@ -1616,6 +1616,9 @@ module ts {
|
||||
write(" {");
|
||||
scopeEmitStart(node, "constructor");
|
||||
increaseIndent();
|
||||
if (ctor) {
|
||||
emitDetachedComments((<Block>ctor.body).statements);
|
||||
}
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
if (ctor) {
|
||||
emitDefaultValueAssignments(ctor);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [detachedCommentAtStartOfConstructor1.ts]
|
||||
class TestFile {
|
||||
public message: string;
|
||||
public name;
|
||||
constructor(message: string) {
|
||||
/// <summary>Test summary</summary>
|
||||
/// <param name="message" type="String" />
|
||||
var getMessage = () => message + this.name;
|
||||
this.message = getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
//// [detachedCommentAtStartOfConstructor1.js]
|
||||
var TestFile = (function () {
|
||||
function TestFile(message) {
|
||||
var _this = this;
|
||||
/// <summary>Test summary</summary>
|
||||
/// <param name="message" type="String" />
|
||||
var getMessage = function () { return message + _this.name; };
|
||||
this.message = getMessage();
|
||||
}
|
||||
return TestFile;
|
||||
})();
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [detachedCommentAtStartOfConstructor2.ts]
|
||||
class TestFile {
|
||||
public message: string;
|
||||
public name: string;
|
||||
constructor(message: string) {
|
||||
/// <summary>Test summary</summary>
|
||||
/// <param name="message" type="String" />
|
||||
|
||||
var getMessage = () => message + this.name;
|
||||
this.message = getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
//// [detachedCommentAtStartOfConstructor2.js]
|
||||
var TestFile = (function () {
|
||||
function TestFile(message) {
|
||||
/// <summary>Test summary</summary>
|
||||
/// <param name="message" type="String" />
|
||||
var _this = this;
|
||||
var getMessage = function () { return message + _this.name; };
|
||||
this.message = getMessage();
|
||||
}
|
||||
return TestFile;
|
||||
})();
|
||||
@@ -43,9 +43,9 @@ var __extends = this.__extends || function (d, b) {
|
||||
};
|
||||
var Event = (function () {
|
||||
function Event() {
|
||||
this._listeners = [];
|
||||
// TODO: remove
|
||||
this._listeners = [];
|
||||
this._listeners = [];
|
||||
}
|
||||
Event.prototype.add = function (listener) {
|
||||
/// <summary>Registers a new listener for the event.</summary>
|
||||
|
||||
10
tests/cases/compiler/detachedCommentAtStartOfConstructor1.ts
Normal file
10
tests/cases/compiler/detachedCommentAtStartOfConstructor1.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
class TestFile {
|
||||
public message: string;
|
||||
public name;
|
||||
constructor(message: string) {
|
||||
/// <summary>Test summary</summary>
|
||||
/// <param name="message" type="String" />
|
||||
var getMessage = () => message + this.name;
|
||||
this.message = getMessage();
|
||||
}
|
||||
}
|
||||
11
tests/cases/compiler/detachedCommentAtStartOfConstructor2.ts
Normal file
11
tests/cases/compiler/detachedCommentAtStartOfConstructor2.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
class TestFile {
|
||||
public message: string;
|
||||
public name: string;
|
||||
constructor(message: string) {
|
||||
/// <summary>Test summary</summary>
|
||||
/// <param name="message" type="String" />
|
||||
|
||||
var getMessage = () => message + this.name;
|
||||
this.message = getMessage();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user