aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/runtime.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime.js b/src/runtime.js
index 8acb9260..559dd125 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -169,14 +169,14 @@ Runtime = {
// but not at runtime. The reason is that during compilation we cannot simplify
// the type names yet.)
generateStructInfo: function(struct, typeName) {
- var fields = struct.map(function(item) { return item[0] });
var type, alignment;
if (typeName) {
type = Types.types[typeName];
if (!type) return null;
+ assert(type.fields.length === struct.length, 'Number of named fields must match the type for ' + typeName);
alignment = type.flatIndexes;
} else {
- var type = { fields: fields };
+ var type = { fields: struct.map(function(item) { return item[0] }) };
alignment = Runtime.calculateStructAlignment(type);
}
var ret = {