Ensure that users cannot use generated arguments.

This commit gensyms the generated ident for replacement arguments so
that users cannot refer to them. It also ensures that levenshtein
distance suggestions do not suggest gensymed identifiers.
This commit is contained in:
David Wood
2019-05-01 14:31:27 +01:00
parent b05d5db87b
commit f47735c3dc
5 changed files with 104 additions and 11 deletions

View File

@@ -8878,7 +8878,7 @@ impl<'a> Parser<'a> {
// Construct a name for our temporary argument.
let name = format!("__arg{}", index);
let ident = Ident::from_str(&name);
let ident = Ident::from_str(&name).gensym();
// Check if this is a ident pattern, if so, we can optimize and avoid adding a
// `let <pat> = __argN;` statement, instead just adding a `let <pat> = <pat>;`