aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def
diff options
context:
space:
mode:
authorJade <[email protected]>2021-05-12 13:44:01 +0100
committerJade <[email protected]>2021-05-13 05:22:46 +0100
commit73023c0299d4adeada026648c3684621f129e038 (patch)
tree302ca449ae51a546d808d93037134af9c470d6b5 /crates/hir_def
parent8b147624ff906a11134d2e18be071c6cb8ec4beb (diff)
Support length for ByteStrings
I am not confident that my added byte string parsing is right.
Diffstat (limited to 'crates/hir_def')
-rw-r--r--crates/hir_def/src/body/lower.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs
index 9f278d35b..b00dcbdf0 100644
--- a/crates/hir_def/src/body/lower.rs
+++ b/crates/hir_def/src/body/lower.rs
@@ -1022,7 +1022,10 @@ impl From<ast::LiteralKind> for Literal {
1022 let ty = lit.suffix().and_then(|it| BuiltinFloat::from_suffix(&it)); 1022 let ty = lit.suffix().and_then(|it| BuiltinFloat::from_suffix(&it));
1023 Literal::Float(Default::default(), ty) 1023 Literal::Float(Default::default(), ty)
1024 } 1024 }
1025 LiteralKind::ByteString(_) => Literal::ByteString(Default::default()), 1025 LiteralKind::ByteString(bs) => {
1026 let text = bs.value().map(Vec::from).unwrap_or_else(Default::default);
1027 Literal::ByteString(text)
1028 }
1026 LiteralKind::String(_) => Literal::String(Default::default()), 1029 LiteralKind::String(_) => Literal::String(Default::default()),
1027 LiteralKind::Byte => Literal::Uint(Default::default(), Some(BuiltinUint::U8)), 1030 LiteralKind::Byte => Literal::Uint(Default::default(), Some(BuiltinUint::U8)),
1028 LiteralKind::Bool(val) => Literal::Bool(val), 1031 LiteralKind::Bool(val) => Literal::Bool(val),