Fix decorator comments for export class (#2038)

We need to do the same location trick for export class unfortunately.

Fixes #1956
This commit is contained in:
Christopher Chedeau authored and GitHub committed 2017-06-07 14:55:55 -07:00
1 parent b730f4eccf
commit 42b0368e3d
3 files changed
+50

No files matched your search

+9
View File
@@ -206,9 +206,18 @@ function hasSpaces(text, index, opts) {
}
function locStart(node) {
// Handle nodes with decorators. They should start at the first decorator
if (
node.declaration &&
node.declaration.decorators &&
node.declaration.decorators.length > 0
) {
return locStart(node.declaration.decorators[0]);
}
if (node.decorators && node.decorators.length > 0) {
return locStart(node.decorators[0]);
}
if (node.range) {
return node.range[0];
}
@@ -11,6 +11,20 @@ var x = 100
class X {
}
@NgModule({
// Imports.
imports: [
// Angular modules.
BrowserModule,
// App modules.
CoreModule,
SharedModule,
],
})
export class AppModule {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var x = 100;
@@ -21,6 +35,19 @@ var x = 100;
})
class X {}
@NgModule({
// Imports.
imports: [
// Angular modules.
BrowserModule,
// App modules.
CoreModule,
SharedModule
]
})
export class AppModule {}
`;
exports[`methods.js 1`] = `
+14
View File
@@ -8,3 +8,17 @@ var x = 100
class X {
}
@NgModule({
// Imports.
imports: [
// Angular modules.
BrowserModule,
// App modules.
CoreModule,
SharedModule,
],
})
export class AppModule {}