about summary refs log blame commit diff stats
path: root/026assert.cc
blob: 5b03e318343f84c65d535dd473d7397c5e4ff0c9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                
                                  
                                                   

                                                                 
                                                                           
   

        
:(scenario assert)
% Hide_warnings = true;
recipe main [
  assert 0:literal, [this is an assert in mu]
]
+warn: this is an assert in mu

:(before "End Primitive Recipe Declarations")
ASSERT,
:(before "End Primitive Recipe Numbers")
Recipe_number["assert"] = ASSERT;
:(before "End Primitive Recipe Implementations")
case ASSERT: {
  assert(ingredients.size() == 2);
  assert(ingredients.at(0).size() == 1);  // scalar
  if (!ingredients.at(0).at(0)) {
    assert(isa_literal(current_instruction().ingredients.at(1)));
    raise << current_instruction().ingredients.at(1).name << '\n' << die();
  }
  break;
}