From 0fac1f87339709e9e3ef8d2df2dbd88ba8c8d706 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 12 Jan 2016 21:20:19 -0800 Subject: 2558 --- 022arithmetic.cc | 3 +++ edit/010-warnings.mu | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/022arithmetic.cc b/022arithmetic.cc index b16bc584..5181ed9d 100644 --- a/022arithmetic.cc +++ b/022arithmetic.cc @@ -269,6 +269,9 @@ case DIVIDE_WITH_REMAINDER: { long long int b = static_cast(ingredients.at(1).at(0)); if (b == 0) { raise_error << maybe(current_recipe_name()) << "divide by zero in '" << current_instruction().to_string() << "'\n" << end(); + products.resize(2); + products.at(0).push_back(0); + products.at(1).push_back(0); break; } long long int quotient = a / b; diff --git a/edit/010-warnings.mu b/edit/010-warnings.mu index 419d9c8f..6bfa3e3e 100644 --- a/edit/010-warnings.mu +++ b/edit/010-warnings.mu @@ -571,12 +571,14 @@ reply b # screen prints error message screen-should-contain [ . run (F4) . - .recipe foo \\\[ ┊ . + .recipe foo [ ┊ . .local-scope ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. .a:number <- next-ingredient ┊ x. .b:number <- next-ingredient ┊foo 4, 0 . .stash [dividing by], b ┊foo: divide by zero in '_, c:number <- divide-wi↩. ._, c:number <- divide-with-remainder a, b ┊th-remainder a, b' . + .reply b ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. + .] ┊ . ] # click on the call in the sandbox assume-console [ @@ -588,12 +590,13 @@ reply b # screen should expand trace screen-should-contain [ . run (F4) . - .recipe foo \\\[ ┊ . + .recipe foo [ ┊ . .local-scope ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. .a:number <- next-ingredient ┊ x. .b:number <- next-ingredient ┊foo 4, 0 . .stash [dividing by], b ┊dividing by 0 . ._, c:number <- divide-with-remainder a, b ┊foo: divide by zero in '_, c:number <- divide-wi↩. .reply b ┊th-remainder a, b' . + .] ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. ] ] -- cgit 1.4.1-2-gfad0