From bb29f8e1424b390c867c161b1821e35fe2644daa Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Mon, 26 Apr 2021 00:10:41 -0400 Subject: [PATCH] [spv-in] emit the cast expression for builtin signness --- src/front/spv/function.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/front/spv/function.rs b/src/front/spv/function.rs index 3ab6a97807..a8e97ba615 100644 --- a/src/front/spv/function.rs +++ b/src/front/spv/function.rs @@ -212,11 +212,16 @@ impl> super::Parser { } else { // The only case where the type is different is if we need to treat // unsigned integer as signed. - function.expressions.append(crate::Expression::As { + let old_len = function.expressions.len(); + let handle = function.expressions.append(crate::Expression::As { expr: arg_expr, kind: crate::ScalarKind::Sint, convert: true, - }) + }); + function.body.push(crate::Statement::Emit( + function.expressions.range_from(old_len), + )); + handle }; function.body.push(crate::Statement::Store { pointer: function