Skip to content

Commit cc5522d

Browse files
committed
Legalize external decorator for generic functions
1 parent 06ee43e commit cc5522d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/program.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,16 +1527,18 @@ export class Program extends DiagnosticEmitter {
15271527
): void {
15281528
var name = declaration.name.text;
15291529
var validDecorators = DecoratorFlags.NONE;
1530-
if (!declaration.is(CommonFlags.AMBIENT)) {
1530+
if (declaration.is(CommonFlags.AMBIENT)) {
1531+
validDecorators |= DecoratorFlags.EXTERNAL;
1532+
} else {
15311533
validDecorators |= DecoratorFlags.INLINE;
15321534
}
1533-
if (parent.kind != ElementKind.CLASS_PROTOTYPE && !declaration.is(CommonFlags.INSTANCE)) {
1534-
validDecorators |= DecoratorFlags.GLOBAL;
1535+
if (!declaration.is(CommonFlags.INSTANCE)) {
1536+
if (parent.kind != ElementKind.CLASS_PROTOTYPE) {
1537+
validDecorators |= DecoratorFlags.GLOBAL;
1538+
}
15351539
}
15361540
if (!declaration.is(CommonFlags.GENERIC)) {
1537-
if (declaration.is(CommonFlags.AMBIENT)) {
1538-
validDecorators |= DecoratorFlags.EXTERNAL;
1539-
} else if (parent.kind == ElementKind.FILE && (<File>parent).source.isEntry) {
1541+
if (parent.kind == ElementKind.FILE && (<File>parent).source.isEntry) {
15401542
validDecorators |= DecoratorFlags.START;
15411543
}
15421544
}

0 commit comments

Comments
 (0)