@@ -369,7 +369,8 @@ module TypeScript {
369369
370370 public visitIndexSignature ( node : IndexSignatureSyntax ) : void {
371371 if ( this . checkIndexSignatureParameter ( node ) ||
372- this . checkForCommaInsteadOfSemicolon ( node . semicolonOrCommaToken ) ) {
372+ this . checkForCommaInsteadOfSemicolon ( node . semicolonOrCommaToken ) ||
373+ this . checkIndexSignatureModifiers ( node ) ) {
373374 return ;
374375 }
375376
@@ -624,15 +625,7 @@ module TypeScript {
624625 return false ;
625626 }
626627
627- public visitIndexMemberDeclaration ( node : IndexMemberDeclarationSyntax ) : void {
628- if ( this . checkIndexMemberModifiers ( node ) ) {
629- return ;
630- }
631-
632- super . visitIndexMemberDeclaration ( node ) ;
633- }
634-
635- private checkIndexMemberModifiers ( node : IndexMemberDeclarationSyntax ) : boolean {
628+ private checkIndexSignatureModifiers ( node : IndexSignatureSyntax ) : boolean {
636629 if ( node . modifiers . length > 0 ) {
637630 return this . pushDiagnostic ( node . modifiers [ 0 ] , DiagnosticCode . Modifiers_cannot_appear_here ) ;
638631 }
@@ -658,7 +651,7 @@ module TypeScript {
658651 public visitGetAccessor ( node : GetAccessorSyntax ) : void {
659652 if ( this . checkForAccessorDeclarationInAmbientContext ( node ) ||
660653 this . checkEcmaScriptVersionIsAtLeast ( node . getKeyword , ts . ScriptTarget . ES5 , DiagnosticCode . Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher ) ||
661- this . checkForDisallowedModifiers ( node . modifiers ) ||
654+ this . checkForDisallowedModifiersInBlockOrObjectLitera ( node . modifiers ) ||
662655 this . checkClassElementModifiers ( node . modifiers ) ||
663656 this . checkForDisallowedAccessorTypeParameters ( node . callSignature ) ||
664657 this . checkGetAccessorParameter ( node ) ||
@@ -749,7 +742,7 @@ module TypeScript {
749742 public visitSetAccessor ( node : SetAccessorSyntax ) : void {
750743 if ( this . checkForAccessorDeclarationInAmbientContext ( node ) ||
751744 this . checkEcmaScriptVersionIsAtLeast ( node . setKeyword , ts . ScriptTarget . ES5 , DiagnosticCode . Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher ) ||
752- this . checkForDisallowedModifiers ( node . modifiers ) ||
745+ this . checkForDisallowedModifiersInBlockOrObjectLitera ( node . modifiers ) ||
753746 this . checkClassElementModifiers ( node . modifiers ) ||
754747 this . checkForDisallowedAccessorTypeParameters ( node . callSignature ) ||
755748 this . checkForDisallowedSetAccessorTypeAnnotation ( node ) ||
@@ -1432,7 +1425,7 @@ module TypeScript {
14321425 return false ;
14331426 }
14341427
1435- private checkForDisallowedModifiers ( modifiers : ISyntaxToken [ ] ) : boolean {
1428+ private checkForDisallowedModifiersInBlockOrObjectLitera ( modifiers : ISyntaxToken [ ] ) : boolean {
14361429 if ( this . inBlock || this . inObjectLiteralExpression ) {
14371430 if ( modifiers . length > 0 ) {
14381431 return this . pushDiagnostic ( modifiers [ 0 ] , DiagnosticCode . Modifiers_cannot_appear_here ) ;
@@ -1444,7 +1437,7 @@ module TypeScript {
14441437
14451438 public visitFunctionDeclaration ( node : FunctionDeclarationSyntax ) : void {
14461439 if ( this . checkForDisallowedDeclareModifier ( node . modifiers ) ||
1447- this . checkForDisallowedModifiers ( node . modifiers ) ||
1440+ this . checkForDisallowedModifiersInBlockOrObjectLitera ( node . modifiers ) ||
14481441 this . checkForRequiredDeclareModifier ( node , node . identifier , node . modifiers ) ||
14491442 this . checkModuleElementModifiers ( node . modifiers ) ||
14501443 this . checkForDisallowedEvalOrArguments ( node , node . identifier ) ||
@@ -1490,7 +1483,7 @@ module TypeScript {
14901483
14911484 public visitVariableStatement ( node : VariableStatementSyntax ) : void {
14921485 if ( this . checkForDisallowedDeclareModifier ( node . modifiers ) ||
1493- this . checkForDisallowedModifiers ( node . modifiers ) ||
1486+ this . checkForDisallowedModifiersInBlockOrObjectLitera ( node . modifiers ) ||
14941487 this . checkForRequiredDeclareModifier ( node , node . variableDeclaration . varConstOrLetKeyword , node . modifiers ) ||
14951488 this . checkModuleElementModifiers ( node . modifiers ) ||
14961489 this . checkForDisallowedAsyncModifier ( node . modifiers ) ) {
0 commit comments