Inline decorators with no arguments (#1910)

Fixes #1898
This commit is contained in:
Christopher Chedeau authored and GitHub committed 2017-06-02 14:40:39 -07:00
1 parent 0e35d3758a
commit 6933d16125
3 files changed
+27 -6

No files matched your search

+5 -4
View File
@@ -100,10 +100,11 @@ function genericPrint(path, options, printPath, args) {
(decorator.type === "Identifier" ||
decorator.type === "MemberExpression" ||
(decorator.type === "CallExpression" &&
decorator.arguments.length === 1 &&
(isStringLiteral(decorator.arguments[0]) ||
decorator.arguments[0].type === "Identifier" ||
decorator.arguments[0].type === "MemberExpression")))
(decorator.arguments.length === 0 ||
(decorator.arguments.length === 1 &&
(isStringLiteral(decorator.arguments[0]) ||
decorator.arguments[0].type === "Identifier" ||
decorator.arguments[0].type === "MemberExpression")))))
) {
separator = " ";
}
@@ -11,6 +11,13 @@ export class TestTextFileService {
@commonEditorContribution
export class TabCompletionController {
}
@Component({
selector: 'angular-component',
})
class AngularComponent {
@Input() myInput: string;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export class TestTextFileService {
constructor(@ILifecycleService lifecycleService) {}
@@ -19,6 +26,13 @@ export class TestTextFileService {
@commonEditorContribution
export class TabCompletionController {}
@Component({
selector: "angular-component"
})
class AngularComponent {
@Input() myInput: string;
}
`;
exports[`inline-decorators.ts 1`] = `
@@ -95,8 +109,7 @@ class Class3 {
@d1 fieldA;
@d2(foo) fieldB;
@d3.bar fieldC;
@d4.baz()
fieldD;
@d4.baz() fieldD;
constructor(
@d1 private x: number,
@@ -8,3 +8,10 @@ export class TestTextFileService {
@commonEditorContribution
export class TabCompletionController {
}
@Component({
selector: 'angular-component',
})
class AngularComponent {
@Input() myInput: string;
}