Rename FnWrongDefinition to WrongFnDefinition.
This commit is contained in:
parent
d2ded7733a
commit
d756b7bac6
@ -42,6 +42,7 @@ Breaking changes
|
||||
* Shebangs at the very beginning of script files are skipped when loading them.
|
||||
* [`smartstring`](https://crates.io/crates/smartstring) is used for identifiers by default. Currently, a PR branch is pulled because it breaks on `no-std` builds. The official crate will be used once `smartstring` is fixed to support `no-std`.
|
||||
* `Map` is now an alias to `BTreeMap<SmartString, Dynamic>` instead of `HashMap` because most object maps hold few properties.
|
||||
* `EvalAltResult::FnWrongDefinition` is renamed `WrongFnDefinition` for consistency.
|
||||
|
||||
New features
|
||||
------------
|
||||
|
@ -866,7 +866,7 @@ impl Engine {
|
||||
|
||||
// If new functions are defined within the eval string, it is an error
|
||||
if ast.lib().count().0 != 0 {
|
||||
return Err(ParseErrorType::FnWrongDefinition.into());
|
||||
return Err(ParseErrorType::WrongFnDefinition.into());
|
||||
}
|
||||
|
||||
// Evaluate the AST
|
||||
|
@ -132,7 +132,7 @@ pub enum ParseErrorType {
|
||||
/// Defining a function `fn` in an appropriate place (e.g. inside another function).
|
||||
///
|
||||
/// Never appears under the `no_function` feature.
|
||||
FnWrongDefinition,
|
||||
WrongFnDefinition,
|
||||
/// Defining a function with a name that conflicts with an existing function.
|
||||
/// Wrapped values are the function name and number of parameters.
|
||||
///
|
||||
@ -199,7 +199,7 @@ impl ParseErrorType {
|
||||
Self::VariableExpected => "Expecting name of a variable",
|
||||
Self::Reserved(_) => "Invalid use of reserved keyword",
|
||||
Self::ExprExpected(_) => "Expecting an expression",
|
||||
Self::FnWrongDefinition => "Function definitions must be at global level and cannot be inside a block or another function",
|
||||
Self::WrongFnDefinition => "Function definitions must be at global level and cannot be inside a block or another function",
|
||||
Self::FnDuplicatedDefinition(_, _) => "Function already exists",
|
||||
Self::FnMissingName => "Expecting function name in function declaration",
|
||||
Self::FnMissingParams(_) => "Expecting parameters in function declaration",
|
||||
|
@ -2481,7 +2481,7 @@ fn parse_stmt(
|
||||
|
||||
// fn ...
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
Token::Fn if !settings.is_global => Err(PERR::FnWrongDefinition.into_err(settings.pos)),
|
||||
Token::Fn if !settings.is_global => Err(PERR::WrongFnDefinition.into_err(settings.pos)),
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
Token::Fn | Token::Private => {
|
||||
|
@ -875,7 +875,7 @@ pub fn parse_string_literal(
|
||||
|
||||
match next_char {
|
||||
// \r - ignore if followed by \n
|
||||
'\r' if stream.peek_next().unwrap_or('\0') == '\n' => {}
|
||||
'\r' if stream.peek_next().map(|ch| ch == '\n').unwrap_or(false) => {}
|
||||
// \...
|
||||
'\\' if escape.is_empty() && !verbatim => {
|
||||
escape.push('\\');
|
||||
|
Loading…
Reference in New Issue
Block a user