False-positive capturing prevention bug fix
This commit is contained in:
@@ -414,7 +414,8 @@ struct ParseState<'e> {
|
||||
/// Tracks a list of external variables (variables that are not explicitly declared in the scope).
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
externals: HashMap<String, Position>,
|
||||
/// An indicator that disables variable capturing into externals one single time.
|
||||
/// An indicator that disables variable capturing into externals one single time
|
||||
/// up until the nearest consumed Identifier token.
|
||||
/// If set to false the next call to `access_var` will not capture the variable.
|
||||
/// All consequent calls to `access_var` will not be affected
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
@@ -1637,6 +1638,8 @@ fn parse_primary(
|
||||
|
||||
// Function call
|
||||
Token::Identifier(s) if *next_token == Token::LeftParen || *next_token == Token::Bang => {
|
||||
// Once the identifier consumed we must enable next variables capturing
|
||||
state.allow_capture = true;
|
||||
Expr::Variable(Box::new(((s, settings.pos), None, 0, None)))
|
||||
}
|
||||
// Normal variable access
|
||||
|
Reference in New Issue
Block a user