@@ -752,6 +752,7 @@ export class Parser extends DiagnosticEmitter {
752752 this . tryParseSignatureIsSignature = true ;
753753 return null ;
754754 }
755+ this . reportInvalidParameterDecorators ( tn ) ;
755756 thisType = < NamedTypeNode > type ;
756757 thisDecorators = decorators ;
757758 } else {
@@ -782,10 +783,12 @@ export class Parser extends DiagnosticEmitter {
782783 this . tryParseSignatureIsSignature = isSignature ;
783784 return null ;
784785 }
786+ this . reportInvalidParameterDecorators ( tn ) ;
785787 let param = Node . createParameter ( kind , name , type , null , tn . range ( paramStart , tn . pos ) , decorators ) ;
786788 if ( ! parameters ) parameters = [ param ] ;
787789 else parameters . push ( param ) ;
788790 } else {
791+ this . reportInvalidParameterDecorators ( tn ) ;
789792 if ( ! isSignature ) {
790793 if ( tn . peek ( ) == Token . Comma ) {
791794 isSignature = true ;
@@ -949,6 +952,17 @@ export class Parser extends DiagnosticEmitter {
949952 return decorators ;
950953 }
951954
955+ /** Consumes decorators that appear after a parameter has already started. */
956+ private reportInvalidParameterDecorators ( tn : Tokenizer ) : void {
957+ let decorators = this . parseParameterDecorators ( tn ) ;
958+ if ( decorators ) {
959+ this . error (
960+ DiagnosticCode . Decorators_are_not_valid_here ,
961+ Range . join ( decorators [ 0 ] . range , decorators [ decorators . length - 1 ] . range )
962+ ) ;
963+ }
964+ }
965+
952966 parseVariable (
953967 tn : Tokenizer ,
954968 flags : CommonFlags ,
@@ -1292,6 +1306,7 @@ export class Parser extends DiagnosticEmitter {
12921306 thisType . range
12931307 ) ;
12941308 }
1309+ this . reportInvalidParameterDecorators ( tn ) ;
12951310 } else {
12961311 this . error (
12971312 DiagnosticCode . _0_expected ,
@@ -1420,12 +1435,14 @@ export class Parser extends DiagnosticEmitter {
14201435 ) ;
14211436 }
14221437 }
1438+ this . reportInvalidParameterDecorators ( tn ) ;
14231439 if ( tn . skip ( Token . Colon ) ) {
14241440 type = this . parseType ( tn ) ;
14251441 if ( ! type ) return null ;
14261442 } else {
14271443 type = Node . createOmittedType ( tn . range ( tn . pos ) ) ;
14281444 }
1445+ this . reportInvalidParameterDecorators ( tn ) ;
14291446 let initializer : Expression | null = null ;
14301447 if ( tn . skip ( Token . Equals ) ) {
14311448 if ( isRest ) {
0 commit comments