diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-07-17 11:10:29 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-07-17 11:10:29 -0700 |
commit | 756e3e1ae499bc8849cc82ef3bf33f55fe767ef6 (patch) | |
tree | 0f46455a32b40b5a7e5e3bd916811b5f9eb7cc14 | |
parent | ab56efe76e94a0508d3983e9430e2aa18b1e2667 (diff) |
clean up generateStructInfo
-rw-r--r-- | src/runtime.js | 4 |
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 = { |