File tree Expand file tree Collapse file tree
packages/babel-parser/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1083,7 +1083,7 @@ export default class StatementParser extends ExpressionParser {
10831083 node . id = this . parseFunctionId ( ) ;
10841084 }
10851085
1086- this . parseFunctionParams ( node ) ;
1086+ this . parseFunctionParams ( node , /* allowModifiers */ false ) ;
10871087
10881088 // For the smartPipelines plugin: Disable topic references from outer
10891089 // contexts within the function body. They are permitted in function
Original file line number Diff line number Diff line change @@ -1709,10 +1709,14 @@ export default (superClass: Class<Parser>): Class<Parser> =>
17091709 const startPos = this . state . start ;
17101710 const startLoc = this . state . startLoc ;
17111711
1712- const accessibility = this . parseAccessModifier ( ) ;
1713- const readonly = ! ! this . tsParseModifier ( [ "readonly" ] ) ;
1714- if ( ! allowModifiers && ( accessibility || readonly ) ) {
1715- this . raise ( startPos , TSErrors . UnexpectedParameterModifier ) ;
1712+ let accessibility : ?N . Accessibility ;
1713+ let readonly = false ;
1714+ if ( allowModifiers !== undefined ) {
1715+ accessibility = this . parseAccessModifier ( ) ;
1716+ readonly = ! ! this . tsParseModifier ( [ "readonly" ] ) ;
1717+ if ( allowModifiers === false && ( accessibility || readonly ) ) {
1718+ this . raise ( startPos , TSErrors . UnexpectedParameterModifier ) ;
1719+ }
17161720 }
17171721
17181722 const left = this.parseMaybeDefault();
You can’t perform that action at this time.
0 commit comments