Remove EvalAltResult::ErrorInExpr.

This commit is contained in:
Stephen Chung 2021-03-09 19:13:26 +08:00
parent 9daa894e25
commit 8853ebf059
2 changed files with 2 additions and 9 deletions

View File

@ -27,9 +27,10 @@ Breaking changes
* `Module::update_fn_metadata` input parameter is changed. * `Module::update_fn_metadata` input parameter is changed.
* Function keywords (e.g. `type_of`, `eval`, `Fn`) can no longer be overloaded. It is more trouble than worth. To disable these keywords, use `Engine::disable_symbol`. * Function keywords (e.g. `type_of`, `eval`, `Fn`) can no longer be overloaded. It is more trouble than worth. To disable these keywords, use `Engine::disable_symbol`.
* `is_def_var` and `is_def_fn` are now reserved keywords. * `is_def_var` and `is_def_fn` are now reserved keywords.
* `Engine::id` field is removed. * `Engine::id` field is removed because it is never used.
* `num-traits` is now a required dependency. * `num-traits` is now a required dependency.
* The `in` operator is now implemented on top of the `contains` function and is no longer restricted to a few specific types. * The `in` operator is now implemented on top of the `contains` function and is no longer restricted to a few specific types.
* `EvalAltResult::ErrorInExpr` is removed because the `in` operator now calls `contains`.
Enhancements Enhancements
------------ ------------

View File

@ -58,8 +58,6 @@ pub enum EvalAltResult {
/// Trying to index into a type that is not an array, an object map, or a string, and has no /// Trying to index into a type that is not an array, an object map, or a string, and has no
/// indexer function defined. Wrapped value is the type name. /// indexer function defined. Wrapped value is the type name.
ErrorIndexingType(String, Position), ErrorIndexingType(String, Position),
/// Invalid arguments for `in` operator.
ErrorInExpr(Position),
/// The `for` statement encounters a type that is not an iterator. /// The `for` statement encounters a type that is not an iterator.
ErrorFor(Position), ErrorFor(Position),
/// Data race detected when accessing a variable. Wrapped value is the variable name. /// Data race detected when accessing a variable. Wrapped value is the variable name.
@ -122,7 +120,6 @@ impl EvalAltResult {
Self::ErrorDataRace(_, _) => "Data race detected when accessing variable", Self::ErrorDataRace(_, _) => "Data race detected when accessing variable",
Self::ErrorAssignmentToConstant(_, _) => "Cannot modify a constant", Self::ErrorAssignmentToConstant(_, _) => "Cannot modify a constant",
Self::ErrorMismatchOutputType(_, _, _) => "Output type is incorrect", Self::ErrorMismatchOutputType(_, _, _) => "Output type is incorrect",
Self::ErrorInExpr(_) => "Malformed 'in' expression",
Self::ErrorDotExpr(_, _) => "Malformed dot expression", Self::ErrorDotExpr(_, _) => "Malformed dot expression",
Self::ErrorArithmetic(_, _) => "Arithmetic error", Self::ErrorArithmetic(_, _) => "Arithmetic error",
Self::ErrorTooManyOperations(_) => "Too many operations", Self::ErrorTooManyOperations(_) => "Too many operations",
@ -182,7 +179,6 @@ impl fmt::Display for EvalAltResult {
Self::ErrorUnboundThis(_) Self::ErrorUnboundThis(_)
| Self::ErrorFor(_) | Self::ErrorFor(_)
| Self::ErrorInExpr(_)
| Self::ErrorDotExpr(_, _) | Self::ErrorDotExpr(_, _)
| Self::ErrorTooManyOperations(_) | Self::ErrorTooManyOperations(_)
| Self::ErrorTooManyModules(_) | Self::ErrorTooManyModules(_)
@ -305,7 +301,6 @@ impl EvalAltResult {
| Self::ErrorDataRace(_, _) | Self::ErrorDataRace(_, _)
| Self::ErrorAssignmentToConstant(_, _) | Self::ErrorAssignmentToConstant(_, _)
| Self::ErrorMismatchOutputType(_, _, _) | Self::ErrorMismatchOutputType(_, _, _)
| Self::ErrorInExpr(_)
| Self::ErrorDotExpr(_, _) | Self::ErrorDotExpr(_, _)
| Self::ErrorArithmetic(_, _) | Self::ErrorArithmetic(_, _)
| Self::ErrorRuntime(_, _) => true, | Self::ErrorRuntime(_, _) => true,
@ -362,7 +357,6 @@ impl EvalAltResult {
| Self::ErrorParsing(_, _) | Self::ErrorParsing(_, _)
| Self::ErrorUnboundThis(_) | Self::ErrorUnboundThis(_)
| Self::ErrorFor(_) | Self::ErrorFor(_)
| Self::ErrorInExpr(_)
| Self::ErrorArithmetic(_, _) | Self::ErrorArithmetic(_, _)
| Self::ErrorTooManyOperations(_) | Self::ErrorTooManyOperations(_)
| Self::ErrorTooManyModules(_) | Self::ErrorTooManyModules(_)
@ -430,7 +424,6 @@ impl EvalAltResult {
| Self::ErrorDataRace(_, pos) | Self::ErrorDataRace(_, pos)
| Self::ErrorAssignmentToConstant(_, pos) | Self::ErrorAssignmentToConstant(_, pos)
| Self::ErrorMismatchOutputType(_, _, pos) | Self::ErrorMismatchOutputType(_, _, pos)
| Self::ErrorInExpr(pos)
| Self::ErrorDotExpr(_, pos) | Self::ErrorDotExpr(_, pos)
| Self::ErrorArithmetic(_, pos) | Self::ErrorArithmetic(_, pos)
| Self::ErrorTooManyOperations(pos) | Self::ErrorTooManyOperations(pos)
@ -471,7 +464,6 @@ impl EvalAltResult {
| Self::ErrorDataRace(_, pos) | Self::ErrorDataRace(_, pos)
| Self::ErrorAssignmentToConstant(_, pos) | Self::ErrorAssignmentToConstant(_, pos)
| Self::ErrorMismatchOutputType(_, _, pos) | Self::ErrorMismatchOutputType(_, _, pos)
| Self::ErrorInExpr(pos)
| Self::ErrorDotExpr(_, pos) | Self::ErrorDotExpr(_, pos)
| Self::ErrorArithmetic(_, pos) | Self::ErrorArithmetic(_, pos)
| Self::ErrorTooManyOperations(pos) | Self::ErrorTooManyOperations(pos)