From 8c996fb15d898eb218cad818032dced84e31e217 Mon Sep 17 00:00:00 2001 From: gluax Date: Tue, 23 Mar 2021 16:02:01 -0400 Subject: [PATCH] do not allow _ at start of identifier --- parser/src/parser/context.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parser/src/parser/context.rs b/parser/src/parser/context.rs index 1c3f41f53e..38fedc74a8 100644 --- a/parser/src/parser/context.rs +++ b/parser/src/parser/context.rs @@ -302,6 +302,10 @@ impl ParserContext { span, } = token { + if name.starts_with('_') { + return Err(SyntaxError::invalid_ident_name(&name, &name[1..name.len()], &span)); + } + Ok(Identifier { name, span }) } else { unimplemented!()