@@ -55,6 +55,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
5555 "private" : kw ( "modifier" ) ,
5656 "protected" : kw ( "modifier" ) ,
5757 "abstract" : kw ( "modifier" ) ,
58+ "readonly" : kw ( "modifier" ) ,
5859
5960 // types
6061 "string" : type , "number" : type , "boolean" : type , "any" : type
@@ -647,7 +648,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
647648 if ( isTS && value == "<" ) return cont ( pushlex ( ">" ) , commasep ( typeexpr , ">" ) , poplex , functiondef )
648649 }
649650 function funarg ( type ) {
650- if ( type == "spread" ) return cont ( funarg ) ;
651+ if ( type == "spread" || type == "modifier" ) return cont ( funarg ) ;
651652 return pass ( pattern , maybetype , maybeAssign ) ;
652653 }
653654 function classExpression ( type , value ) {
@@ -665,13 +666,14 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
665666 if ( type == "{" ) return cont ( pushlex ( "}" ) , classBody , poplex ) ;
666667 }
667668 function classBody ( type , value ) {
668- if ( type == "variable" || cx . style == "keyword" ) {
669- if ( ( value == "async" || value == "static" || value == "get" || value == "set" ||
670- ( isTS && ( value == "public" || value == "private" || value == "protected" || value == "readonly" || value == "abstract" ) ) ) &&
671- cx . stream . match ( / ^ \s + [ \w $ \xa1 - \uffff ] / , false ) ) {
672- cx . marked = "keyword" ;
673- return cont ( classBody ) ;
674- }
669+ if ( type == "modifier" || type == "async" ||
670+ ( type == "variable" &&
671+ ( value == "static" || value == "get" || value == "set" ) &&
672+ cx . stream . match ( / ^ \s + [ \w $ \xa1 - \uffff ] / , false ) ) ) {
673+ cx . marked = "keyword" ;
674+ return cont ( classBody ) ;
675+ }
676+ if ( type == "variable" ) {
675677 cx . marked = "property" ;
676678 return cont ( isTS ? classfield : functiondef , classBody ) ;
677679 }
0 commit comments