about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--030container.cc7
-rw-r--r--042name.cc9
2 files changed, 12 insertions, 4 deletions
diff --git a/030container.cc b/030container.cc
index 4d5399c3..de22f1e6 100644
--- a/030container.cc
+++ b/030container.cc
@@ -382,11 +382,10 @@ case GET: {
     break;
   }
   int offset_value = 0;
-  //: later layers will permit non-integer offsets
-  if (is_integer(offset.name))
+  if (is_integer(offset.name)) {
     offset_value = to_integer(offset.name);
-  else
-    offset_value = offset.value;
+  }
+  // End update GET offset_value in Check
   if (offset_value < 0 || offset_value >= SIZE(get(Type, base_type->value).elements)) {
     raise << maybe(get(Recipe, r).name) << "invalid offset '" << offset_value << "' for '" << get(Type, base_type->value).name << "'\n" << end();
     break;
diff --git a/042name.cc b/042name.cc
index 9be2b4da..cae48c8a 100644
--- a/042name.cc
+++ b/042name.cc
@@ -229,6 +229,15 @@ $error: 0
 //:: Support element names for containers in 'get' and 'get-location' and 'put'.
 //: (get-location is implemented later)
 
+:(before "End update GET offset_value in Check")
+else {
+  if (!offset.initialized) {
+    raise << maybe(get(Recipe, r).name) << "uninitialized offset '" << offset.name << "' in '" << to_original_string(inst) << "'\n" << end();
+    break;
+  }
+  offset_value = offset.value;
+}
+
 :(scenario transform_names_transforms_container_elements)
 def main [
   p:&:point <- copy 0