fix: expect [] on a non-empty list now fails.
This commit is contained in:
@@ -219,6 +219,9 @@ pub enum Air {
|
||||
FieldsEmpty {
|
||||
scope: Scope,
|
||||
},
|
||||
ListEmpty {
|
||||
scope: Scope,
|
||||
},
|
||||
}
|
||||
|
||||
impl Air {
|
||||
@@ -257,6 +260,7 @@ impl Air {
|
||||
| Air::RecordAccess { scope, .. }
|
||||
| Air::FieldsExpose { scope, .. }
|
||||
| Air::FieldsEmpty { scope }
|
||||
| Air::ListEmpty { scope }
|
||||
| Air::ListAccessor { scope, .. }
|
||||
| Air::ListExpose { scope, .. }
|
||||
| Air::TupleAccessor { scope, .. }
|
||||
@@ -301,6 +305,7 @@ impl Air {
|
||||
| Air::RecordAccess { scope, .. }
|
||||
| Air::FieldsExpose { scope, .. }
|
||||
| Air::FieldsEmpty { scope }
|
||||
| Air::ListEmpty { scope }
|
||||
| Air::ListAccessor { scope, .. }
|
||||
| Air::ListExpose { scope, .. }
|
||||
| Air::TupleAccessor { scope, .. }
|
||||
@@ -398,6 +403,7 @@ impl Air {
|
||||
| Air::Finally { .. }
|
||||
| Air::FieldsExpose { .. }
|
||||
| Air::FieldsEmpty { .. }
|
||||
| Air::ListEmpty { .. }
|
||||
| Air::NoOp { .. } => None,
|
||||
Air::UnOp { op, .. } => match op {
|
||||
UnOp::Not => Some(
|
||||
|
||||
@@ -781,6 +781,16 @@ impl AirStack {
|
||||
|
||||
self.call(void(), expect_stack, vec![tail_stack, arg_stack2])
|
||||
}
|
||||
|
||||
pub fn list_empty(&mut self, value_stack: AirStack) {
|
||||
self.new_scope();
|
||||
|
||||
self.air.push(Air::ListEmpty {
|
||||
scope: self.scope.clone(),
|
||||
});
|
||||
|
||||
self.merge_child(value_stack);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user