From a8ed4d0ecfed099522f61dc90fadfe6a21416438 Mon Sep 17 00:00:00 2001 From: Stepami Date: Mon, 16 Oct 2023 22:30:36 +0300 Subject: [PATCH] fix bug sequence has no elements --- .../IR/Ast/Visitors/ExpressionInstructionProvider.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Interpreter.Lib/IR/Ast/Visitors/ExpressionInstructionProvider.cs b/Interpreter.Lib/IR/Ast/Visitors/ExpressionInstructionProvider.cs index 5779e46b..dfd83b60 100644 --- a/Interpreter.Lib/IR/Ast/Visitors/ExpressionInstructionProvider.cs +++ b/Interpreter.Lib/IR/Ast/Visitors/ExpressionInstructionProvider.cs @@ -179,7 +179,11 @@ public AddressedInstructions Visit(AssignmentExpression visitable) } if (visitable.Destination.Empty()) - result.OfType().Last().Left = visitable.Destination.Id; + { + var lastSimple = result.OfType().LastOrDefault(); + if (lastSimple is not null) + lastSimple.Left = visitable.Destination.Id; + } else { var last = new Name(result.OfType().Last().Left);