Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser error returning from a function. #251

Closed
ntrippar opened this issue Feb 14, 2020 · 0 comments · Fixed by #257
Closed

Parser error returning from a function. #251

ntrippar opened this issue Feb 14, 2020 · 0 comments · Fixed by #257

Comments

@ntrippar
Copy link

the is not parsing correctly if there is a empty return in a function.

POC:

function addClass(elem){
    return
}
use boa::syntax::lexer::Lexer;
use boa::syntax::parser::Parser;
use std::fs;

fn main() {
    let buffer = fs::read_to_string("test.js").unwrap();
    let mut lexer = Lexer::new(&buffer);
    lexer.lex().expect("failed to lex");
    let mut parser = Parser::new(lexer.tokens);
    println!("{:?}", parser.parse_all());
}

Error:

Err(Expected([], Token { data: Punctuator(CloseBlock), pos: Position { column_number: 1, line_number: 3 } }, "script"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant