diff --git a/src/program.ts b/src/program.ts index 41fbd843..3ab27cde 100644 --- a/src/program.ts +++ b/src/program.ts @@ -1527,16 +1527,18 @@ export class Program extends DiagnosticEmitter { ): void { var name = declaration.name.text; var validDecorators = DecoratorFlags.NONE; - if (!declaration.is(CommonFlags.AMBIENT)) { + if (declaration.is(CommonFlags.AMBIENT)) { + validDecorators |= DecoratorFlags.EXTERNAL; + } else { validDecorators |= DecoratorFlags.INLINE; } - if (parent.kind != ElementKind.CLASS_PROTOTYPE && !declaration.is(CommonFlags.INSTANCE)) { - validDecorators |= DecoratorFlags.GLOBAL; + if (!declaration.is(CommonFlags.INSTANCE)) { + if (parent.kind != ElementKind.CLASS_PROTOTYPE) { + validDecorators |= DecoratorFlags.GLOBAL; + } } if (!declaration.is(CommonFlags.GENERIC)) { - if (declaration.is(CommonFlags.AMBIENT)) { - validDecorators |= DecoratorFlags.EXTERNAL; - } else if (parent.kind == ElementKind.FILE && (parent).source.isEntry) { + if (parent.kind == ElementKind.FILE && (parent).source.isEntry) { validDecorators |= DecoratorFlags.START; } }