do not allow _ at start of identifier

This commit is contained in:
gluax 2021-03-23 16:02:01 -04:00
parent 0663227741
commit 8c996fb15d

View File

@ -302,6 +302,10 @@ impl ParserContext {
span, span,
} = token } = token
{ {
if name.starts_with('_') {
return Err(SyntaxError::invalid_ident_name(&name, &name[1..name.len()], &span));
}
Ok(Identifier { name, span }) Ok(Identifier { name, span })
} else { } else {
unimplemented!() unimplemented!()