Update skeleton

This commit is contained in:
Jeehoon Kang
2020-05-18 18:57:21 +09:00
parent 773eeda067
commit e81247ba54
58 changed files with 49447 additions and 16 deletions

View File

@@ -573,6 +573,15 @@ impl Dtype {
);
let fields = fields.unwrap();
if fields.is_empty() {
return Ok(Self::Struct {
name,
fields: Some(fields),
is_const,
size_align_offsets: Some((0, 1, Vec::new())),
});
}
let align_of = fields
.iter()
.map(|f| f.deref().size_align_of(structs))
@@ -709,6 +718,7 @@ impl Dtype {
Self::Unit { .. } => todo!(),
Self::Int { .. } => true,
Self::Float { .. } => true,
Self::Pointer { .. } => true,
_ => false,
}
}

View File

@@ -644,13 +644,28 @@ mod calculator {
calculate_float_binary_operator_expression(op, lhs, rhs, lhs_w)
}
(Value::Pointer { bid, .. }, Value::Pointer { bid: other_bid, .. }) => match op {
(
Value::Pointer { bid, offset, .. },
Value::Pointer {
bid: other_bid,
offset: other_offset,
..
},
) => match op {
ast::BinaryOperator::Equals => {
let result = if bid == other_bid { 1 } else { 0 };
let result = if bid == other_bid && offset == other_offset {
1
} else {
0
};
Ok(Value::int(result, 1, false))
}
ast::BinaryOperator::NotEquals => {
let result = if bid != other_bid { 1 } else { 0 };
let result = if !(bid == other_bid && offset == other_offset) {
1
} else {
0
};
Ok(Value::int(result, 1, false))
}
_ => todo!(