diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-07-25 14:19:28 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-07-25 17:14:58 -0700 |
commit | e46306432ddb75a89f69d92ccc175a23f0b72072 (patch) | |
tree | 48ed3828064f29cefaf14e3fe61d7dc02cac0e80 /031address.cc | |
parent | e83602d3917eba137cd8fb37605076fff5a746b1 (diff) | |
download | mu-e46306432ddb75a89f69d92ccc175a23f0b72072.tar.gz |
1848 - core instructions now check for ingredients
Also standardized warnings.
Diffstat (limited to '031address.cc')
-rw-r--r-- | 031address.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/031address.cc b/031address.cc index 0e2a4f0f..51a6a960 100644 --- a/031address.cc +++ b/031address.cc @@ -40,9 +40,15 @@ reagent deref(reagent x) { //? cout << "deref: " << x.to_string() << "\n"; //? 2 static const type_ordinal ADDRESS = Type_ordinal["address"]; reagent result; - assert(x.types.at(0) == ADDRESS); - + if (x.types.at(0) != ADDRESS) { + raise << current_recipe_name() << ": tried to /deref " << x.original_string << " but it isn't an address\n" << end(); + return result; + } // compute value + if (x.value == 0) { + raise << current_recipe_name() << ": tried to /deref 0\n" << end(); + return result; + } result.set_value(Memory[x.value]); trace(Primitive_recipe_depth, "mem") << "location " << x.value << " is " << result.value << end(); |