From 73023c0299d4adeada026648c3684621f129e038 Mon Sep 17 00:00:00 2001 From: Jade Date: Wed, 12 May 2021 05:44:01 -0700 Subject: Support length for ByteStrings I am not confident that my added byte string parsing is right. --- crates/hir_def/src/body/lower.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crates/hir_def/src/body') 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 for Literal { let ty = lit.suffix().and_then(|it| BuiltinFloat::from_suffix(&it)); Literal::Float(Default::default(), ty) } - LiteralKind::ByteString(_) => Literal::ByteString(Default::default()), + LiteralKind::ByteString(bs) => { + let text = bs.value().map(Vec::from).unwrap_or_else(Default::default); + Literal::ByteString(text) + } LiteralKind::String(_) => Literal::String(Default::default()), LiteralKind::Byte => Literal::Uint(Default::default(), Some(BuiltinUint::U8)), LiteralKind::Bool(val) => Literal::Bool(val), -- cgit v1.2.3