diff --git a/crates/dreammaker/src/parser.rs b/crates/dreammaker/src/parser.rs index e91f8cbe..e024881d 100644 --- a/crates/dreammaker/src/parser.rs +++ b/crates/dreammaker/src/parser.rs @@ -1434,7 +1434,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { // for(var/a = 1 to require!(self.exact_ident("to")); let rhs = require!(self.expression()); - return spanned(require!(self.for_range(Some(vs.var_type), vs.name, Box::new(value), Box::new(rhs)))); + return spanned(require!(self.for_range(Some(vs.var_type), vs.name, value, rhs))); } }, Statement::Expr(Expression::AssignOp { @@ -1449,7 +1449,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { }; require!(self.exact_ident("to")); let to_rhs = require!(self.expression()); - return spanned(require!(self.for_range(None, name, rhs, Box::new(to_rhs)))); + return spanned(require!(self.for_range(None, name, *rhs, to_rhs))); } Statement::Expr(Expression::BinaryOp { op: BinaryOp::In, @@ -1462,7 +1462,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { }; match *rhs { Expression::BinaryOp { op: BinaryOp::To, lhs, rhs } => { - return spanned(require!(self.for_range(None, name, lhs, rhs))); + return spanned(require!(self.for_range(None, name, *lhs, *rhs))); }, rhs => { // I love code duplication, don't you? @@ -1495,7 +1495,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { let value = require!(self.expression()); if let Some(()) = self.exact_ident("to")? { let rhs = require!(self.expression()); - return spanned(require!(self.for_range(var_type, name, Box::new(value), Box::new(rhs)))); + return spanned(require!(self.for_range(var_type, name, value, rhs))); } Some(value) } else { @@ -1761,8 +1761,8 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { &mut self, var_type: Option, name: Ident, - start: Box, - end: Box, + start: Expression, + end: Expression, ) -> Status { // step 2 let step = if let Some(()) = self.exact_ident("step")? { @@ -1776,8 +1776,8 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { success(Statement::ForRange(Box::new(ForRangeStatement { var_type, name: name.into(), - start: *start, - end: *end, + start, + end, step, block: require!(self.block(&LoopContext::ForRange)), })))