facebook/flow

can' parse class static method code

brookate opened this issue · 0 comments

class C {
  static {
    let x;
    let x;
  }
}

Flow version: current HEAD and 0.244.0

Expected behavior

Actual behavior

dell➜ bin git:(main) ./flow ast 1.js --pretty
{
"errors":[
{
"loc":{"source":"1.js","start":{"line":2,"column":9},"end":{"line":2,"column":10}},
"message":"Unexpected token {, expected an identifier"
},
{
"loc":{"source":"1.js","start":{"line":3,"column":8},"end":{"line":3,"column":9}},
"message":"Unexpected identifier, expected the token ("
},
{
"loc":{"source":"1.js","start":{"line":3,"column":9},"end":{"line":3,"column":10}},
"message":"Unexpected token ;, expected an identifier"
},
{
"loc":{"source":"1.js","start":{"line":4,"column":4},"end":{"line":4,"column":7}},
"message":"Unexpected token let, expected the token ,"
},
{
"loc":{"source":"1.js","start":{"line":4,"column":9},"end":{"line":4,"column":10}},
"message":"Unexpected token ;, expected the token ,"
},
{
"loc":{"source":"1.js","start":{"line":5,"column":2},"end":{"line":5,"column":3}},
"message":"Unexpected token }, expected an identifier"
},
{
"loc":{"source":"1.js","start":{"line":6,"column":0},"end":{"line":6,"column":1}},
"message":"Unexpected token }, expected the token ,"
},
{
"loc":{"source":"1.js","start":{"line":8,"column":0},"end":{"line":8,"column":0}},
"message":"Rest parameter must be final parameter of an argument list"
},
{
"loc":{"source":"1.js","start":{"line":8,"column":0},"end":{"line":8,"column":0}},
"message":"Unexpected end of input, expected the token )"
},
{
"loc":{"source":"1.js","start":{"line":8,"column":0},"end":{"line":8,"column":0}},
"message":"Unexpected end of input, expected the token {"
},
{
"loc":{"source":"1.js","start":{"line":8,"column":0},"end":{"line":8,"column":0}},
"message":"Unexpected end of input, expected the token }"
},
{
"loc":{"source":"1.js","start":{"line":5,"column":2},"end":{"line":5,"column":3}},
"message":"Strict mode function may not have duplicate parameter names"
}
],

in my program is file "src/parser/parser_flow.ml", line 509,

  • Link to Try-Flow or Github repo: